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.
133 lines
726 KiB
133 lines
726 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[244,7,16],{"+NIl":function(Je,je,J){(function(Q){Q(J("VrN/"))})(function(Q){"use strict";Q.defineMode("stex",function(K,A){"use strict";function W(w,y){w.cmdState.push(y)}function M(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function P(w){var y=w.cmdState.pop();y&&y.closeBracket()}function I(w){for(var y=w.cmdState,b=y.length-1;b>=0;b--){var l=y[b];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function k(w,y,b){return function(){this.name=w,this.bracketNo=0,this.style=y,this.styles=b,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var O={};O.importmodule=k("importmodule","tag",["string","builtin"]),O.documentclass=k("documentclass","tag",["","atom"]),O.usepackage=k("usepackage","tag",["atom"]),O.begin=k("begin","tag",["atom"]),O.end=k("end","tag",["atom"]),O.label=k("label","tag",["atom"]),O.ref=k("ref","tag",["atom"]),O.eqref=k("eqref","tag",["atom"]),O.cite=k("cite","tag",["atom"]),O.bibitem=k("bibitem","tag",["atom"]),O.Bibitem=k("Bibitem","tag",["atom"]),O.RBibitem=k("RBibitem","tag",["atom"]),O.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function _(w,y){w.f=y}function c(w,y){var b;if(w.match(/^\\[a-zA-Z@]+/)){var l=w.current().slice(1);return b=O.hasOwnProperty(l)?O[l]:O.DEFAULT,b=new b,W(y,b),_(y,D),b.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return _(y,function(s,u){return p(s,u,"\\]")}),"keyword";if(w.match("\\("))return _(y,function(s,u){return p(s,u,"\\)")}),"keyword";if(w.match("$$"))return _(y,function(s,u){return p(s,u,"$$")}),"keyword";if(w.match("$"))return _(y,function(s,u){return p(s,u,"$")}),"keyword";var a=w.next();if(a=="%")return w.skipToEnd(),"comment";if(a=="}"||a=="]"){if(b=M(y),b)b.closeBracket(a),_(y,D);else return"error";return"bracket"}else return a=="{"||a=="["?(b=O.DEFAULT,b=new b,W(y,b),"bracket"):/\d/.test(a)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),b=I(y),b.name=="begin"&&(b.argument=w.current()),b.styleIdentifier())}function p(w,y,b){if(w.eatSpace())return null;if(b&&w.match(b))return _(y,c),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=w.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(w.skipToEnd(),"comment"):"error"}function D(w,y){var b=w.peek(),l;return b=="{"||b=="["?(l=M(y),l.openBracket(b),w.eat(b),_(y,c),"bracket"):/[ \t\r]/.test(b)?(w.eat(b),null):(_(y,c),P(y),c(w,y))}return{startState:function(){var w=A.inMathMode?function(y,b){return p(y,b)}:c;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,y){return y.f(w,y)},blankLine:function(w){w.f=c,w.cmdState.length=0},lineComment:"%"}}),Q.defineMIME("text/x-stex","stex"),Q.defineMIME("text/x-latex","stex")})},"19Vz":function(Je,je,J){(function(Q){Q(J("VrN/"))})(function(Q){Q.defineOption("placeholder","",function(k,O,_){var c=_&&_!=Q.Init;if(O&&!c)k.on("blur",M),k.on("change",P),k.on("swapDoc",P),Q.on(k.getInputField(),"compositionupdate",k.state.placeholderCompose=function(){W(k)}),P(k);else if(!O&&c){k.off("blur",M),k.off("change",P),k.off("swapDoc",P),Q.off(k.getInputField(),"compositionupdate",k.state.placeholderCompose),K(k);var p=k.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}O&&!k.hasFocus()&&M(k)});function K(k){k.state.placeholder&&(k.state.placeholder.parentNode.removeChild(k.state.placeholder),k.state.placeholder=null)}function A(k){K(k);var O=k.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=k.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var _=k.getOption("placeholder");typeof _=="string"&&(_=document.createTextNode(_)),O.appendChild(_),k.display.lineSpace.insertBefore(O,k.display.lineSpace.firstChild)}function W(k){setTimeout(function(){var O=!1,_=k.getInputField();_.nodeName=="TEXTAREA"?O=!_.value:k.lineCount()==1&&(O=!/[^\u200b]/.test(_.querySelector(".CodeMirror-line").textContent)),O?A(k):K(k)},20)}function M(k){I(k)&&A(k)}function P(k){var O=k.getWrapperElement(),_=I(k);O.className=O.className.replace(" CodeMirror-empty","")+(_?" CodeMirror-empty":""),_?A(k):K(k)}function I(k){return k.lineCount()===1&&k.getLine(0)===""}})},"1eCo":function(Je,je,J){(function(Q){Q(J("VrN/"))})(function(Q){"use strict";var K={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},A={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};Q.defineMode("xml",function(W,M){var P=W.indentUnit,I={},k=M.htmlMode?K:A;for(var O in k)I[O]=k[O];for(var O in M)I[O]=M[O];var _,c;function p(o,T){function E(N){return T.tokenize=N,N(o,T)}var v=o.next();if(v=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?E(y("atom","]]>")):null:o.match("--")?E(y("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),E(b(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),T.tokenize=y("meta","?>"),"meta"):(_=o.eat("/")?"closeTag":"openTag",T.tokenize=D,"tag bracket");if(v=="&"){var R;return o.eat("#")?o.eat("x")?R=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):R=o.eatWhile(/[\d]/)&&o.eat(";"):R=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),R?"atom":"error"}else return o.eatWhile(/[^&<]/),null}p.isInText=!0;function D(o,T){var E=o.next();if(E==">"||E=="/"&&o.eat(">"))return T.tokenize=p,_=E==">"?"endTag":"selfcloseTag","tag bracket";if(E=="=")return _="equals",null;if(E=="<"){T.tokenize=p,T.state=u,T.tagName=T.tagStart=null;var v=T.tokenize(o,T);return v?v+" tag error":"tag error"}else return/[\'\"]/.test(E)?(T.tokenize=w(E),T.stringStartCol=o.column(),T.tokenize(o,T)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(o){var T=function(E,v){for(;!E.eol();)if(E.next()==o){v.tokenize=D;break}return"string"};return T.isInAttribute=!0,T}function y(o,T){return function(E,v){for(;!E.eol();){if(E.match(T)){v.tokenize=p;break}E.next()}return o}}function b(o){return function(T,E){for(var v;(v=T.next())!=null;){if(v=="<")return E.tokenize=b(o+1),E.tokenize(T,E);if(v==">")if(o==1){E.tokenize=p;break}else return E.tokenize=b(o-1),E.tokenize(T,E)}return"meta"}}function l(o,T,E){this.prev=o.context,this.tagName=T,this.indent=o.indented,this.startOfLine=E,(I.doNotIndent.hasOwnProperty(T)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function s(o,T){for(var E;;){if(!o.context)return;if(E=o.context.tagName,!I.contextGrabbers.hasOwnProperty(E)||!I.contextGrabbers[E].hasOwnProperty(T))return;a(o)}}function u(o,T,E){return o=="openTag"?(E.tagStart=T.column(),C):o=="closeTag"?g:u}function C(o,T,E){return o=="word"?(E.tagName=T.current(),c="tag",x):I.allowMissingTagName&&o=="endTag"?(c="tag bracket",x(o,T,E)):(c="error",C)}function g(o,T,E){if(o=="word"){var v=T.current();return E.context&&E.context.tagName!=v&&I.implicitlyClosed.hasOwnProperty(E.context.tagName)&&a(E),E.context&&E.context.tagName==v||I.matchClosing===!1?(c="tag",m):(c="tag error",L)}else return I.allowMissingTagName&&o=="endTag"?(c="tag bracket",m(o,T,E)):(c="error",L)}function m(o,T,E){return o!="endTag"?(c="error",m):(a(E),u)}function L(o,T,E){return c="error",m(o,T,E)}function x(o,T,E){if(o=="word")return c="attribute",f;if(o=="endTag"||o=="selfcloseTag"){var v=E.tagName,R=E.tagStart;return E.tagName=E.tagStart=null,o=="selfcloseTag"||I.autoSelfClosers.hasOwnProperty(v)?s(E,v):(s(E,v),E.context=new l(E,v,R==E.indented)),u}return c="error",x}function f(o,T,E){return o=="equals"?h:(I.allowMissing||(c="error"),x(o,T,E))}function h(o,T,E){return o=="string"?d:o=="word"&&I.allowUnquoted?(c="string",x):(c="error",x(o,T,E))}function d(o,T,E){return o=="string"?d:x(o,T,E)}return{startState:function(o){var T={tokenize:p,state:u,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(T.baseIndent=o),T},token:function(o,T){if(!T.tagName&&o.sol()&&(T.indented=o.indentation()),o.eatSpace())return null;_=null;var E=T.tokenize(o,T);return(E||_)&&E!="comment"&&(c=null,T.state=T.state(_||E,o,T),c&&(E=c=="error"?E+" error":c)),E},indent:function(o,T,E){var v=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+P;if(v&&v.noIndent)return Q.Pass;if(o.tokenize!=D&&o.tokenize!=p)return E?E.match(/^(\s*)/)[0].length:0;if(o.tagName)return I.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+P*(I.multilineTagIndentFactor||1);if(I.alignCDATA&&/<!\[CDATA\[/.test(T))return 0;var R=T&&/^<(\/)?([\w_:\.-]*)/.exec(T);if(R&&R[1])for(;v;)if(v.tagName==R[2]){v=v.prev;break}else if(I.implicitlyClosed.hasOwnProperty(v.tagName))v=v.prev;else break;else if(R)for(;v;){var N=I.contextGrabbers[v.tagName];if(N&&N.hasOwnProperty(R[2]))v=v.prev;else break}for(;v&&v.prev&&!v.startOfLine;)v=v.prev;return v?v.indent+P:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:I.htmlMode?"html":"xml",helperType:I.htmlMode?"html":"xml",skipAttribute:function(o){o.state==h&&(o.state=x)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var T=[],E=o.context;E;E=E.prev)E.tagName&&T.push(E.tagName);return T.reverse()}}}),Q.defineMIME("text/xml","xml"),Q.defineMIME("application/xml","xml"),Q.mimeModes.hasOwnProperty("text/html")||Q.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"2RCv":function(Je,je,J){"use strict";var Q=J("Awhp"),K=J("KrTs"),A=J("+L6B"),W=J("2/Rp"),M=J("5NDa"),P=J("5rEg"),I=J("0Owb"),k=J("oBTY"),O=J("tJVT"),_=J("PpiC"),c=J("cDcd"),p=J.n(c),D=function(y){var b=y.InputRight,l=y.value,a=l===void 0?[]:l,s=y.onChange,u=s===void 0?function(){}:s,C=Object(_.a)(y,["InputRight","value","onChange"]),g=Object(c.useState)(),m=Object(O.a)(g,2),L=m[0],x=m[1],f=function(o){var T=a.filter(function(E,v){return v!==o});u(T)},h=function(o){if(o.preventDefault(),!L)return;u([].concat(Object(k.a)(a),[L])),x(null)};return p.a.createElement("div",null,p.a.createElement(P.a,Object(I.a)({},C,{value:L,onChange:function(o){return x(o.target.value)},onPressEnter:h,onBlur:h})),b,p.a.createElement("div",{className:"mt20"},a==null?void 0:a.map(function(d,o){return p.a.createElement(K.a,{className:"ml10 mr10",count:"x",onClick:function(){return f(o)}},p.a.createElement(W.a,{type:"primary",ghost:!0},d))})))};je.a=D},"7Cbv":function(Je,je,J){"use strict";var Q=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),K=new Uint8Array(16);function A(){if(!Q)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Q(K)}var W=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function M(D){return typeof D=="string"&&W.test(D)}for(var P=M,I=[],k=0;k<256;++k)I.push((k+256).toString(16).substr(1));function O(D){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,y=(I[D[w+0]]+I[D[w+1]]+I[D[w+2]]+I[D[w+3]]+"-"+I[D[w+4]]+I[D[w+5]]+"-"+I[D[w+6]]+I[D[w+7]]+"-"+I[D[w+8]]+I[D[w+9]]+"-"+I[D[w+10]]+I[D[w+11]]+I[D[w+12]]+I[D[w+13]]+I[D[w+14]]+I[D[w+15]]).toLowerCase();if(!P(y))throw TypeError("Stringified UUID is invalid");return y}var _=O;function c(D,w,y){D=D||{};var b=D.random||(D.rng||A)();if(b[6]=b[6]&15|64,b[8]=b[8]&63|128,w){y=y||0;for(var l=0;l<16;++l)w[y+l]=b[l];return w}return _(b)}var p=je.a=c},"7ahc":function(Je,je,J){"use strict";J.d(je,"a",function(){return C});var Q=J("k1fw"),K=J("0Owb"),A=J("+L6B"),W=J("2/Rp"),M=J("y8nQ"),P=J("Vl3Y"),I=J("tJVT"),k=J("OaEy"),O=J("2fM7"),_=J("cDcd"),c=J.n(_),p=J("VrN/"),D=J.n(p),w=J("p77/"),y=J.n(w),b=J("c5Ni"),l=J.n(b),a=O.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};je.b=function(g){var m=g.callback,L=g.onCancel,x=Object(_.useState)("python"),f=Object(I.a)(x,2),h=f[0],d=f[1];function o(E){d(u[E][1])}function T(E){m(E)}return c.a.createElement(P.a,Object(K.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:T}),c.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},c.a.createElement(O.a,{onChange:o},Object.keys(u).map(function(E){return c.a.createElement(a,{key:E,value:E},u[E][0])}))),c.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},c.a.createElement(C,{mode:h})),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(W.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function C(g){var m=g.value,L=g.onChange,x=g.mode,f=g.options,h=f===void 0?{}:f,d=Object(_.useRef)(),o=Object(_.useState)(),T=Object(I.a)(o,2),E=T[0],v=T[1];return Object(_.useEffect)(function(){if(E){function R(N){var B=N.getValue();L&&L(B)}return E.on("change",R),function(){E.off("change",R)}}},[E,L]),Object(_.useEffect)(function(){E&&E.setOption("mode",x)},[E,x]),Object(_.useEffect)(function(){E&&((m!==E.getValue()||m==="")&&setTimeout(function(){E.setValue(m||" ")},300))},[E,m]),Object(_.useEffect)(function(){if(d.current&&!E){var R=D.a.fromTextArea(d.current,Object(Q.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},h));v(R)}},[d.current,E]),c.a.createElement("div",{className:"my-codemirror-container"},c.a.createElement("textarea",{ref:d}))}},"7ixt":function(Je,je,J){"use strict";J.d(je,"a",function(){return A});var Q={adjustX:1,adjustY:1},K=[0,0],A={left:{points:["cr","cl"],overflow:Q,offset:[-4,0],targetOffset:K},right:{points:["cl","cr"],overflow:Q,offset:[4,0],targetOffset:K},top:{points:["bc","tc"],overflow:Q,offset:[0,-4],targetOffset:K},bottom:{points:["tc","bc"],overflow:Q,offset:[0,4],targetOffset:K},topLeft:{points:["bl","tl"],overflow:Q,offset:[0,-4],targetOffset:K},leftTop:{points:["tr","tl"],overflow:Q,offset:[-4,0],targetOffset:K},topRight:{points:["br","tr"],overflow:Q,offset:[0,-4],targetOffset:K},rightTop:{points:["tl","tr"],overflow:Q,offset:[4,0],targetOffset:K},bottomRight:{points:["tr","br"],overflow:Q,offset:[0,4],targetOffset:K},rightBottom:{points:["bl","br"],overflow:Q,offset:[4,0],targetOffset:K},bottomLeft:{points:["tl","bl"],overflow:Q,offset:[0,4],targetOffset:K},leftBottom:{points:["br","bl"],overflow:Q,offset:[-4,0],targetOffset:K}},W=A},"8EBN":function(Je,je,J){(function(Q){Q(J("VrN/"))})(function(Q){"use strict";Q.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var K=0;K<Q.modeInfo.length;K++){var A=Q.modeInfo[K];A.mimes&&(A.mime=A.mimes[0])}Q.findModeByMIME=function(W){W=W.toLowerCase();for(var M=0;M<Q.modeInfo.length;M++){var P=Q.modeInfo[M];if(P.mime==W)return P;if(P.mimes){for(var I=0;I<P.mimes.length;I++)if(P.mimes[I]==W)return P}}if(/\+xml$/.test(W))return Q.findModeByMIME("application/xml");if(/\+json$/.test(W))return Q.findModeByMIME("application/json")},Q.findModeByExtension=function(W){W=W.toLowerCase();for(var M=0;M<Q.modeInfo.length;M++){var P=Q.modeInfo[M];if(P.ext){for(var I=0;I<P.ext.length;I++)if(P.ext[I]==W)return P}}},Q.findModeByFileName=function(W){for(var M=0;M<Q.modeInfo.length;M++){var P=Q.modeInfo[M];if(P.file&&P.file.test(W))return P}var I=W.lastIndexOf("."),k=I>-1&&W.substring(I+1,W.length);if(k)return Q.findModeByExtension(k)},Q.findModeByName=function(W){W=W.toLowerCase();for(var M=0;M<Q.modeInfo.length;M++){var P=Q.modeInfo[M];if(P.name.toLowerCase()==W)return P;if(P.alias){for(var I=0;I<P.alias.length;I++)if(P.alias[I].toLowerCase()==W)return P}}}})},"8hTe":function(Je,je,J){Je.exports={button:"button___1wy9m"}},"93VE":function(Je,je,J){},"9Bee":function(Je,je,J){"use strict";var Q=J("DYRE"),K=J("zeV3"),A=J("+L6B"),W=J("2/Rp"),M=J("k1fw"),P=J("tJVT"),I=J("cDcd"),k=J.n(I),O=J("vg9a"),_=J("DlQD"),c=J.n(_),p=J("rUJ1");function D(fe,de){var ce=fe.match(/^(\s+)(?:```)/);if(ce===null)return de;var re=ce[1];return de.split(`
|
|
`).map(function(se){var be=se.match(/^\s+/);if(be===null)return se;var Me=Object(P.a)(be,1),Ie=Me[0];return Ie.length>=re.length?se.slice(re.length):se}).join(`
|
|
`)}var w=[],y=["<ul>"],b=new c.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function a(){w.length=0,y=["<ul>"]}var s={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function u(fe,de,ce,re){if(de>=fe.length||fe[de].level<=ce)return de;var se=fe[de];re.push("<li><a href='#"+se.anchor+"'>"+se.text+"</a>"),de++;var be=[];return de=u(fe,de,se.level,be),be.length>0&&(re.push("<ul>"),be.forEach(function(Me){re.push(Me)}),re.push("</ul>")),re.push("</li>"),de=u(fe,de,ce,re),de}function C(){return u(w,0,0,y),y.push("</ul>"),y.join("")}var g={heading:function(de){var ce=l.exec(de);if(ce)return{type:"heading",raw:ce[0],depth:ce[1].length,text:ce[2]}},fences:function(de){var ce=this.rules.block.fences.exec(de);if(ce){var re=ce[0],se=D(re,ce[3]||""),be=ce[2]?ce[2].trim():ce[2];if(["latex","katex","math"].indexOf(be)>=0){var Me=x(),Ie=se;se=Me,f[Me]={type:"block",expression:Ie}}return{type:"code",raw:re,lang:be,text:se}}}},m=/(?:\${2})([^\n`]+?)(?:\${2})/gi,L=0,x=function(){return"__special_katext_id_".concat(L++,"__")},f={};function h(){return f}function d(){L=0,f={}}function o(fe){return fe=fe.replace(m,function(de,ce){var re=x();return f[re]={type:"inline",expression:ce},re}),fe}var T=b.listitem;b.listitem=function(fe){return T(o(fe))};var E=b.paragraph;b.paragraph=function(fe){return E(o(fe))};var v=b.tablecell;b.tablecell=function(fe,de){return v(o(fe),de)},b.code=function(fe,de,ce){var re=(de||"").match(/\S*/)[0];return re?["latex","katex","math"].indexOf(re)>=0?"<p class='editormd-tex'>".concat(fe,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(de,'">').concat(ce?fe:Object(p.escape)(fe,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(ce?fe:Object(p.escape)(fe,!0))+"</code></pre>"},b.heading=function(fe,de,ce){var re=this.options.headerPrefix+ce.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return w.push({anchor:re,level:de,text:fe}),"<h"+de+' id="'+re+'">'+fe+"</h"+de+">"},c.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),c.a.use({tokenizer:g,renderer:b});var R=c.a,N=J("SJMd"),B=J("ulZh"),z=J.n(B),j=J("m3rI"),F=J("Oy/b"),X=J("p5ED"),q=J("8hTe"),ne=J.n(q),ue=/<pre[^>]*>/g;function Ee(fe){var de=document.createElement("div");return de.innerHTML=fe,de.childNodes.length===0?"":de.childNodes[0].nodeValue}var pe=je.a=function(fe){var de=fe.value,ce=de===void 0?"":de,re=fe.edit,se=re===void 0?!1:re,be=fe.className,Me=fe.showTextOnly,Ie=fe.showLines,Ge=fe.replaces,He=fe.zoomImg,Se=fe.hasMask,De=fe.style,ke=De===void 0?{}:De,Ke=fe.stylesPrev,Fe=Ke===void 0?{}:Ke,_e=String(ce),Le=Object(I.useRef)(),rt=Object(I.useRef)(),qe=Object(I.useState)(""),Ye=Object(P.a)(qe,2),We=Ye[0],et=Ye[1],ze=Object(I.useState)("office"),Ve=Object(P.a)(ze,2),ve=Ve[0],Ze=Ve[1],Xe=Object(I.useMemo)(function(){try{var oe=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Y=/\"\/api\/attachments\/|\"\/attachments\/download\//g,$=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;_e=_e.replace(oe,"("+j.a.API_SERVER+"/api/attachments/").replace(Y,'"'+j.a.API_SERVER+"/api/attachments/").replace($,'"'+j.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(xe){}var Z=R(_e),te=h();if(_e.match(/\[TOC\]/)&&(Z=Z.replace("<p>[TOC]</p>",C()),a()),Z=Z.replace(/(__special_katext_id_\d+__)/g,function(xe,Pe){var st=te[Pe],vt=st.type,we=st.expression;return Object(F.renderToString)(Ee(we)||"",{displayMode:vt==="block",throwOnError:!1,output:"html"})}),Z=Z.replace(/▁/g,"\u2581\u2581\u2581"),d(),Me){var ge=document.createElement("div");return ge.innerHTML=Z,ge.innerText}return setTimeout(function(){return le()},500),Z},[_e]),ye=Object(I.useRef)();s.WebkitLineClamp=Ie,Ie&&(ke=Object(M.a)(Object(M.a)({},ke),s));function Ae(oe){var Y=oe.target;if(Y.tagName.toUpperCase()==="IMG"){if(He){var $=Y.getAttribute("src");et($),Ze("image")}}else if(Y.tagName.toUpperCase()==="A"){var Z=Y.getAttribute("href");if(Z.indexOf("office")>-1)oe.preventDefault(),et(Z),Ze("office");else if(Z.indexOf("application/pdf")>-1)oe.preventDefault(),et(Z),Ze("pdf");else if(Z.indexOf("text/html")>-1)oe.preventDefault(),et(Z),Ze("html");else if(Z.startsWith("#")){oe.preventDefault();var te=document.getElementById(Z.replace("#",""));te&&te.scrollIntoView(!0)}}}var le=function(){var Y,$=(Y=ye.current)===null||Y===void 0?void 0:Y.querySelectorAll("video");$==null||$.forEach(function(Z){if(Z.oncontextmenu=function(){return!1},Z.src.indexOf(".m3u8")>-1&&!Z.canPlayType("application/vnd.apple.mpegurl")){if(z.a.isSupported()){var te=new z.a;te.loadSource(Z.src),te.attachMedia(Z)}}})};Object(I.useEffect)(function(){if(ye.current&&Xe&&(Xe.match(ue)&&window.PR.prettyPrint()),ye.current)return ye.current.addEventListener("click",Ae),function(){ye.current.removeEventListener("click",Ae),d(),a()}},[Xe,ye.current,Ae]);var ae=function(Y){if(!se)return;Y.target.nodeName==="IMG"?(Le.current.style.display="flex",Le.current.style.width=Y.target.clientWidth+"px",Le.current.style.height=Y.target.clientHeight+"px",Le.current.style.top=Y.target.offsetTop+"px",Le.current.style.left=Y.target.offsetLeft+"px",rt.current.src=Y.target.getAttribute("src")):Le.current.style.display="none"};return k.a.createElement("div",{style:{position:"relative"}},k.a.createElement("div",{ref:ye,style:Object(M.a)({},ke),className:"".concat(be||""," markdown-body ").concat(ne.a.mdBody),onMouseOver:ae,dangerouslySetInnerHTML:{__html:Xe}}),k.a.createElement("div",{ref:Le,className:ne.a.button},k.a.createElement(K.a,null,k.a.createElement(W.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),k.a.createElement(W.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),k.a.createElement("img",{ref:rt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),k.a.createElement(X.a,{close:!0,data:We,type:We!=null&&We.length?ve:"",style:Object(M.a)({},Fe),onClose:function(){return et("")}}))}},"9VGf":function(Je,je,J){"use strict";J.d(je,"a",function(){return A});var Q=J("cDcd"),K=J.n(Q);function A(W,M){var P=Object(Q.useRef)();Object(Q.useEffect)(function(){P.current=W}),Object(Q.useEffect)(function(){function I(){P.current()}if(M!==null){var k=setInterval(I,M);return function(){return clearInterval(k)}}},[M])}},"9ZNV":function(Je,je,J){"use strict";J.d(je,"a",function(){return _});var Q=J("0Owb"),K=J("+L6B"),A=J("2/Rp"),W=J("cDcd"),M=J.n(W),P=J("UUDw"),I=J.n(P),k=J("TSYQ"),O=J.n(k),_=function(p){var D=p.cancelText,w=D===void 0?"\u53D6\u6D88":D,y=p.okText,b=y===void 0?"\u786E\u5B9A":y,l=p.loading,a=l===void 0?!1:l,s=p.hasOkBtn,u=s===void 0?!0:s,C=p.okButtonProps,g=C===void 0?{}:C,m=p.onCancel,L=m===void 0?function(){}:m,x=p.onOk,f=x===void 0?function(){}:x,h=p.className,d=h===void 0?"":h;return M.a.createElement("div",{className:O()(I.a.buttonFixed,d)},M.a.createElement("div",{className:I.a.buttonWrap},M.a.createElement(A.a,{size:"large",className:"".concat(I.a.button," mr20"),onClick:L},w),u&&M.a.createElement(A.a,Object(Q.a)({size:"large",type:"primary",className:"".concat(I.a.button," mr20"),loading:a,onClick:f},g),b)))}},Bd2K:function(Je,je,J){(function(Q){Q(J("VrN/"),J("osHv"))})(function(Q){Q.defineOption("autoCloseTags",!1,function(O,_,c){if(c!=Q.Init&&c&&O.removeKeyMap("autoCloseTags"),!_)return;var p={name:"autoCloseTags"};(typeof _!="object"||_.whenClosing!==!1)&&(p["'/'"]=function(D){return P(D)}),(typeof _!="object"||_.whenOpening!==!1)&&(p["'>'"]=function(D){return W(D)}),O.addKeyMap(p)});var K=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],A=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function W(O){if(O.getOption("disableInput"))return Q.Pass;for(var _=O.listSelections(),c=[],p=O.getOption("autoCloseTags"),D=0;D<_.length;D++){if(!_[D].empty())return Q.Pass;var w=_[D].head,y=O.getTokenAt(w),b=Q.innerMode(O.getMode(),y.state),l=b.state,a=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(l),s=a&&a.name;if(!s)return Q.Pass;var u=b.mode.configuration=="html",C=typeof p=="object"&&p.dontCloseTags||u&&K,g=typeof p=="object"&&p.indentTags||u&&A;y.end>w.ch&&(s=s.slice(0,s.length-y.end+w.ch));var m=s.toLowerCase();if(!s||y.type=="string"&&(y.end!=w.ch||!/[\"\']/.test(y.string.charAt(y.string.length-1))||y.string.length==1)||y.type=="tag"&&a.close||y.string.indexOf("/")==w.ch-y.start-1||C&&I(C,m)>-1||k(O,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(l)||[],s,w,!0))return Q.Pass;var L=typeof p=="object"&&p.emptyTags;if(L&&I(L,s)>-1){c[D]={text:"/>",newPos:Q.Pos(w.line,w.ch+2)};continue}var x=g&&I(g,m)>-1;c[D]={indent:x,text:">"+(x?`
|
|
|
|
`:"")+"</"+s+">",newPos:x?Q.Pos(w.line+1,0):Q.Pos(w.line,w.ch+1)}}for(var f=typeof p=="object"&&p.dontIndentOnAutoClose,D=_.length-1;D>=0;D--){var h=c[D];O.replaceRange(h.text,_[D].head,_[D].anchor,"+insert");var d=O.listSelections().slice(0);d[D]={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 M(O,_){for(var c=O.listSelections(),p=[],D=_?"/":"</",w=O.getOption("autoCloseTags"),y=typeof w=="object"&&w.dontIndentOnSlash,b=0;b<c.length;b++){if(!c[b].empty())return Q.Pass;var l=c[b].head,a=O.getTokenAt(l),s=Q.innerMode(O.getMode(),a.state),u=s.state;if(_&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=l.ch-1))return Q.Pass;var C,g=s.mode.name!="xml"&&O.getMode().name=="htmlmixed";if(g&&s.mode.name=="javascript")C=D+"script";else if(g&&s.mode.name=="css")C=D+"style";else{var m=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!m||m.length&&k(O,m,m[m.length-1],l))return Q.Pass;C=D+m[m.length-1]}O.getLine(l.line).charAt(a.end)!=">"&&(C+=">"),p[b]=C}if(O.replaceSelections(p),c=O.listSelections(),!y)for(var b=0;b<c.length;b++)(b==c.length-1||c[b].head.line<c[b+1].head.line)&&O.indentLine(c[b].head.line)}function P(O){return O.getOption("disableInput")?Q.Pass:M(O,!0)}Q.commands.closeTag=function(O){return M(O)};function I(O,_){if(O.indexOf)return O.indexOf(_);for(var c=0,p=O.length;c<p;++c)if(O[c]==_)return c;return-1}function k(O,_,c,p,D){if(!Q.scanForClosingTag)return!1;var w=Math.min(O.lastLine()+1,p.line+500),y=Q.scanForClosingTag(O,p,null,w);if(!y||y.tag!=c)return!1;for(var b=D?1:0,l=_.length-1;l>=0&&_[l]==c;l--)++b;p=y.to;for(var l=1;l<b;l++){var a=Q.scanForClosingTag(O,p,null,w);if(!a||a.tag!=c)return!1;p=a.to}return!0}})},BjJ7:function(Je,je,J){"use strict";J.d(je,"d",function(){return K}),J.d(je,"c",function(){return A}),J.d(je,"e",function(){return W}),J.d(je,"b",function(){return M}),J.d(je,"a",function(){return I});var Q=J("m3rI");function K(k){var O=!0;if(k.length>0){for(var _=0;_<k.length;_++)if(k[_].compile_success==0||!k[_].compile_success){O=!1;break}}else O=!1;return O}function A(k){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",_=[],c=0;c<k.length;c++){var p=k[c],D=O?"".concat(O,"/").concat(p.name):"".concat(p.name);_.push({title:p.name,isLeaf:!(p.type==="tree"),key:D})}return _}function W(k,O,_){for(var c=0;c<k.length;c++){var p=k[c];if(p.key===O){p.children=_;break}p.children&&W(p.children,O,_)}return k}function M(k,O,_){var c;return function(){var p=this,D=arguments,w=function(){c=null,_||k.apply(p,D)},y=_&&!c;clearTimeout(c),c=setTimeout(w,O),y&&k.apply(p,D)}}var P=!0,I=Q.a.API_SERVER},"C+DQ":function(Je,je,J){},D1Df:function(Je,je,J){"use strict";function Q(v){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Q=function(N){return typeof N}:Q=function(N){return N&&typeof Symbol=="function"&&N.constructor===Symbol&&N!==Symbol.prototype?"symbol":typeof N},Q(v)}function K(){return K=Object.assign||function(v){for(var R=1;R<arguments.length;R++){var N=arguments[R];for(var B in N)Object.prototype.hasOwnProperty.call(N,B)&&(v[B]=N[B])}return v},K.apply(this,arguments)}function A(v,R){var N=Object.keys(v);if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(v);R&&(B=B.filter(function(z){return Object.getOwnPropertyDescriptor(v,z).enumerable})),N.push.apply(N,B)}return N}function W(v){for(var R=1;R<arguments.length;R++){var N=arguments[R]!=null?arguments[R]:{};R%2?A(N,!0).forEach(function(B){y(v,B,N[B])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(N)):A(N).forEach(function(B){Object.defineProperty(v,B,Object.getOwnPropertyDescriptor(N,B))})}return v}function M(v,R){if(v==null)return{};var N=P(v,R),B,z;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(v);for(z=0;z<j.length;z++){if(B=j[z],R.indexOf(B)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(v,B))continue;N[B]=v[B]}}return N}function P(v,R){if(v==null)return{};var N={},B=Object.keys(v),z,j;for(j=0;j<B.length;j++){if(z=B[j],R.indexOf(z)>=0)continue;N[z]=v[z]}return N}function I(v,R){if(!(v instanceof R))throw new TypeError("Cannot call a class as a function")}function k(v,R){for(var N=0;N<R.length;N++){var B=R[N];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(v,B.key,B)}}function O(v,R,N){return R&&k(v.prototype,R),N&&k(v,N),v}function _(v,R){return R&&(Q(R)==="object"||typeof R=="function")?R:p(v)}function c(v){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(N){return N.__proto__||Object.getPrototypeOf(N)},c(v)}function p(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function D(v,R){if(typeof R!="function"&&R!==null)throw new TypeError("Super expression must either be null or a function");v.prototype=Object.create(R&&R.prototype,{constructor:{value:v,writable:!0,configurable:!0}}),R&&w(v,R)}function w(v,R){return w=Object.setPrototypeOf||function(B,z){return B.__proto__=z,B},w(v,R)}function y(v,R,N){return R in v?Object.defineProperty(v,R,{value:N,enumerable:!0,configurable:!0,writable:!0}):v[R]=N,v}var b=J("cDcd"),l=J("17x9"),a=J("H38U"),s=J("aRTE");function u(v){for(var R="",N=0;N<v.length;N++){var B=v.charCodeAt(N);B<128?R+=String.fromCharCode(B):B<2048?(R+=String.fromCharCode(192|B>>6),R+=String.fromCharCode(128|B&63)):B<55296||B>=57344?(R+=String.fromCharCode(224|B>>12),R+=String.fromCharCode(128|B>>6&63),R+=String.fromCharCode(128|B&63)):(N++,B=65536+((B&1023)<<10|v.charCodeAt(N)&1023),R+=String.fromCharCode(240|B>>18),R+=String.fromCharCode(128|B>>12&63),R+=String.fromCharCode(128|B>>6&63),R+=String.fromCharCode(128|B&63))}return R}var C={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},g={},m=4,L=.1;function x(v){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,N=[];return v.forEach(function(B,z){var j=null;B.forEach(function(F,X){if(!F&&j!==null){N.push("M".concat(j+R," ").concat(z+R,"h").concat(X-j,"v1H").concat(j+R,"z")),j=null;return}if(X===B.length-1){if(!F)return;j===null?N.push("M".concat(X+R,",").concat(z+R," h1v1H").concat(X+R,"z")):N.push("M".concat(j+R,",").concat(z+R," h").concat(X+1-j,"v1H").concat(j+R,"z"));return}F&&j===null&&(j=X)})}),N.join("")}function f(v,R){return v.slice().map(function(N,B){return B<R.y||B>=R.y+R.h?N:N.map(function(z,j){return j<R.x||j>=R.x+R.w?z:!1})})}function h(v,R){var N=v.imageSettings,B=v.size,z=v.includeMargin;if(N==null)return null;var j=z?m:0,F=R.length+j*2,X=Math.floor(B*L),q=F/B,ne=(N.width||X)*q,ue=(N.height||X)*q,Ee=N.x==null?R.length/2-ne/2:N.x*q,pe=N.y==null?R.length/2-ue/2:N.y*q,fe=null;if(N.excavate){var de=Math.floor(Ee),ce=Math.floor(pe),re=Math.ceil(ne+Ee-de),se=Math.ceil(ue+pe-ce);fe={x:de,y:ce,w:re,h:se}}return{x:Ee,y:pe,h:ue,w:ne,excavation:fe}}var d=function(){try{new Path2D().addPath(new Path2D)}catch(v){return!1}return!0}(),o=function(v){D(R,v);function R(){var N,B;I(this,R);for(var z=arguments.length,j=new Array(z),F=0;F<z;F++)j[F]=arguments[F];return B=_(this,(N=c(R)).call.apply(N,[this].concat(j))),y(p(B),"_canvas",void 0),y(p(B),"_image",void 0),y(p(B),"state",{imgLoaded:!1}),y(p(B),"handleImageLoad",function(){B.setState({imgLoaded:!0})}),B}return O(R,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var B=this.props,z=B.value,j=B.size,F=B.level,X=B.bgColor,q=B.fgColor,ne=B.includeMargin,ue=B.imageSettings,Ee=new a(-1,s[F]);if(Ee.addData(u(z)),Ee.make(),this._canvas!=null){var pe=this._canvas,fe=pe.getContext("2d");if(!fe)return;var de=Ee.modules;if(de===null)return;var ce=ne?m:0,re=de.length+ce*2,se=h(this.props,de);ue!=null&&se!=null&&(se.excavation!=null&&(de=f(de,se.excavation)));var be=window.devicePixelRatio||1;pe.height=pe.width=j*be;var Me=j/re*be;fe.scale(Me,Me),fe.fillStyle=X,fe.fillRect(0,0,re,re),fe.fillStyle=q,d?fe.fill(new Path2D(x(de,ce))):de.forEach(function(Ie,Ge){Ie.forEach(function(He,Se){He&&fe.fillRect(Se+ce,Ge+ce,1,1)})}),this.state.imgLoaded&&this._image&&se!=null&&fe.drawImage(this._image,se.x+ce,se.y+ce,se.w,se.h)}}},{key:"render",value:function(){var B=this,z=this.props,j=z.value,F=z.size,X=z.level,q=z.bgColor,ne=z.fgColor,ue=z.style,Ee=z.includeMargin,pe=z.imageSettings,fe=M(z,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),de=W({height:F,width:F},ue),ce=null,re=pe&&pe.src;return pe!=null&&re!=null&&(ce=b.createElement("img",{src:re,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(be){return B._image=be}})),b.createElement(b.Fragment,null,b.createElement("canvas",K({style:de,height:F,width:F,ref:function(be){return B._canvas=be}},fe)),ce)}}]),R}(b.PureComponent);y(o,"defaultProps",C);var T=function(v){D(R,v);function R(){return I(this,R),_(this,c(R).apply(this,arguments))}return O(R,[{key:"render",value:function(){var B=this.props,z=B.value,j=B.size,F=B.level,X=B.bgColor,q=B.fgColor,ne=B.includeMargin,ue=B.imageSettings,Ee=M(B,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),pe=new a(-1,s[F]);pe.addData(u(z)),pe.make();var fe=pe.modules;if(fe===null)return null;var de=ne?m:0,ce=fe.length+de*2,re=h(this.props,fe),se=null;ue!=null&&re!=null&&(re.excavation!=null&&(fe=f(fe,re.excavation)),se=b.createElement("image",{xlinkHref:ue.src,height:re.h,width:re.w,x:re.x+de,y:re.y+de,preserveAspectRatio:"none"}));var be=x(fe,de);return b.createElement("svg",K({shapeRendering:"crispEdges",height:j,width:j,viewBox:"0 0 ".concat(ce," ").concat(ce)},Ee),b.createElement("path",{fill:X,d:"M0,0 h".concat(ce,"v").concat(ce,"H0z")}),b.createElement("path",{fill:q,d:be}),se)}}]),R}(b.PureComponent);y(T,"defaultProps",C);var E=function(R){var N=R.renderAs,B=M(R,["renderAs"]),z=N==="svg"?T:o;return b.createElement(z,B)};E.defaultProps=W({renderAs:"canvas"},C),Je.exports=E},DlQD:function(Je,je,J){(function(Q,K){Je.exports=K()})(this,function(){"use strict";function Q(le,ae){for(var oe=0;oe<ae.length;oe++){var Y=ae[oe];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(le,Y.key,Y)}}function K(le,ae,oe){return ae&&Q(le.prototype,ae),oe&&Q(le,oe),le}function A(le,ae){if(!le)return;if(typeof le=="string")return W(le,ae);var oe=Object.prototype.toString.call(le).slice(8,-1);if(oe==="Object"&&le.constructor&&(oe=le.constructor.name),oe==="Map"||oe==="Set")return Array.from(le);if(oe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(oe))return W(le,ae)}function W(le,ae){(ae==null||ae>le.length)&&(ae=le.length);for(var oe=0,Y=new Array(ae);oe<ae;oe++)Y[oe]=le[oe];return Y}function M(le,ae){var oe;if(typeof Symbol=="undefined"||le[Symbol.iterator]==null){if(Array.isArray(le)||(oe=A(le))||ae&&le&&typeof le.length=="number"){oe&&(le=oe);var Y=0;return function(){return Y>=le.length?{done:!0}:{done:!1,value:le[Y++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return oe=le[Symbol.iterator](),oe.next.bind(oe)}function P(le,ae){return ae={exports:{}},le(ae,ae.exports),ae.exports}var I=P(function(le){function ae(){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 oe(Y){le.exports.defaults=Y}le.exports={defaults:ae(),getDefaults:ae,changeDefaults:oe}}),k=I.defaults,O=I.getDefaults,_=I.changeDefaults,c=/[&<>"']/,p=/[&<>"']/g,D=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,y={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(ae){return y[ae]};function l(le,ae){if(ae){if(c.test(le))return le.replace(p,b)}else if(D.test(le))return le.replace(w,b);return le}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(le){return le.replace(a,function(ae,oe){return oe=oe.toLowerCase(),oe==="colon"?":":oe.charAt(0)==="#"?oe.charAt(1)==="x"?String.fromCharCode(parseInt(oe.substring(2),16)):String.fromCharCode(+oe.substring(1)):""})}var u=/(^|[^\[])\^/g;function C(le,ae){le=le.source||le,ae=ae||"";var oe={replace:function($,Z){return Z=Z.source||Z,Z=Z.replace(u,"$1"),le=le.replace($,Z),oe},getRegex:function(){return new RegExp(le,ae)}};return oe}var g=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(le,ae,oe){if(le){var Y;try{Y=decodeURIComponent(s(oe)).replace(g,"").toLowerCase()}catch($){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}ae&&!m.test(oe)&&(oe=o(ae,oe));try{oe=encodeURI(oe).replace(/%25/g,"%")}catch($){return null}return oe}var x={},f=/^[^:]+:\/*[^/]*$/,h=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(le,ae){x[" "+le]||(f.test(le)?x[" "+le]=le+"/":x[" "+le]=R(le,"/",!0)),le=x[" "+le];var oe=le.indexOf(":")===-1;return ae.substring(0,2)==="//"?oe?ae:le.replace(h,"$1")+ae:ae.charAt(0)==="/"?oe?ae:le.replace(d,"$1")+ae:le+ae}var T={exec:function(){}};function E(le){for(var ae=1,oe,Y;ae<arguments.length;ae++){oe=arguments[ae];for(Y in oe)Object.prototype.hasOwnProperty.call(oe,Y)&&(le[Y]=oe[Y])}return le}function v(le,ae){var oe=le.replace(/\|/g,function(Z,te,ge){for(var xe=!1,Pe=te;--Pe>=0&&ge[Pe]==="\\";)xe=!xe;return xe?"|":" |"}),Y=oe.split(/ \|/),$=0;if(Y.length>ae)Y.splice(ae);else for(;Y.length<ae;)Y.push("");for(;$<Y.length;$++)Y[$]=Y[$].trim().replace(/\\\|/g,"|");return Y}function R(le,ae,oe){var Y=le.length;if(Y===0)return"";for(var $=0;$<Y;){var Z=le.charAt(Y-$-1);if(Z===ae&&!oe)$++;else if(Z!==ae&&oe)$++;else break}return le.substr(0,Y-$)}function N(le,ae){if(le.indexOf(ae[1])===-1)return-1;for(var oe=le.length,Y=0,$=0;$<oe;$++)if(le[$]==="\\")$++;else if(le[$]===ae[0])Y++;else if(le[$]===ae[1]&&(Y--,Y<0))return $;return-1}function B(le){le&&le.sanitize&&!le.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var z={escape:l,unescape:s,edit:C,cleanUrl:L,resolveUrl:o,noopTest:T,merge:E,splitCells:v,rtrim:R,findClosingBracket:N,checkSanitizeDeprecation:B},j=I.defaults,F=z.rtrim,X=z.splitCells,q=z.escape,ne=z.findClosingBracket;function ue(le,ae,oe){var Y=ae.href,$=ae.title?q(ae.title):null,Z=le[1].replace(/\\([\[\]])/g,"$1");return le[0].charAt(0)!=="!"?{type:"link",raw:oe,href:Y,title:$,text:Z}:{type:"image",raw:oe,href:Y,title:$,text:q(Z)}}function Ee(le,ae){var oe=le.match(/^(\s+)(?:```)/);if(oe===null)return ae;var Y=oe[1];return ae.split(`
|
|
`).map(function($){var Z=$.match(/^\s+/);if(Z===null)return $;var te=Z[0];return te.length>=Y.length?$.slice(Y.length):$}).join(`
|
|
`)}var pe=function(){function le(oe){this.options=oe||j}var ae=le.prototype;return ae.space=function(Y){var $=this.rules.block.newline.exec(Y);if($)return $[0].length>1?{type:"space",raw:$[0]}:{raw:`
|
|
`}},ae.code=function(Y,$){var Z=this.rules.block.code.exec(Y);if(Z){var te=$[$.length-1];if(te&&te.type==="paragraph")return{raw:Z[0],text:Z[0].trimRight()};var ge=Z[0].replace(/^ {4}/gm,"");return{type:"code",raw:Z[0],codeBlockStyle:"indented",text:this.options.pedantic?ge:F(ge,`
|
|
`)}}},ae.fences=function(Y){var $=this.rules.block.fences.exec(Y);if($){var Z=$[0],te=Ee(Z,$[3]||"");return{type:"code",raw:Z,lang:$[2]?$[2].trim():$[2],text:te}}},ae.heading=function(Y){var $=this.rules.block.heading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[1].length,text:$[2]}},ae.nptable=function(Y){var $=this.rules.block.nptable.exec(Y);if($){var Z={type:"table",header:X($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[],raw:$[0]};if(Z.header.length===Z.align.length){var te=Z.align.length,ge;for(ge=0;ge<te;ge++)/^ *-+: *$/.test(Z.align[ge])?Z.align[ge]="right":/^ *:-+: *$/.test(Z.align[ge])?Z.align[ge]="center":/^ *:-+ *$/.test(Z.align[ge])?Z.align[ge]="left":Z.align[ge]=null;for(te=Z.cells.length,ge=0;ge<te;ge++)Z.cells[ge]=X(Z.cells[ge],Z.header.length);return Z}}},ae.hr=function(Y){var $=this.rules.block.hr.exec(Y);if($)return{type:"hr",raw:$[0]}},ae.blockquote=function(Y){var $=this.rules.block.blockquote.exec(Y);if($){var Z=$[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:$[0],text:Z}}},ae.list=function(Y){var $=this.rules.block.list.exec(Y);if($){for(var Z=$[0],te=$[2],ge=te.length>1,xe=te[te.length-1]===")",Pe={type:"list",raw:Z,ordered:ge,start:ge?+te.slice(0,-1):"",loose:!1,items:[]},st=$[0].match(this.rules.block.item),vt=!1,we,yt,it,Qe,xt,ct,ft,ht=st.length,nt=0;nt<ht;nt++)we=st[nt],Z=we,yt=we.length,we=we.replace(/^ *([*+-]|\d+[.)]) */,""),~we.indexOf(`
|
|
`)&&(yt-=we.length,we=this.options.pedantic?we.replace(/^ {1,4}/gm,""):we.replace(new RegExp("^ {1,"+yt+"}","gm"),"")),nt!==ht-1&&(it=this.rules.block.bullet.exec(st[nt+1])[0],(ge?it.length===1||!xe&&it[it.length-1]===")":it.length>1||this.options.smartLists&&it!==te)&&(Qe=st.slice(nt+1).join(`
|
|
`),Pe.raw=Pe.raw.substring(0,Pe.raw.length-Qe.length),nt=ht-1)),xt=vt||/\n\n(?!\s*$)/.test(we),nt!==ht-1&&(vt=we.charAt(we.length-1)===`
|
|
`,xt||(xt=vt)),xt&&(Pe.loose=!0),ct=/^\[[ xX]\] /.test(we),ft=void 0,ct&&(ft=we[1]!==" ",we=we.replace(/^\[[ xX]\] +/,"")),Pe.items.push({type:"list_item",raw:Z,task:ct,checked:ft,loose:xt,text:we});return Pe}},ae.html=function(Y){var $=this.rules.block.html.exec(Y);if($)return{type:this.options.sanitize?"paragraph":"html",raw:$[0],pre:!this.options.sanitizer&&($[1]==="pre"||$[1]==="script"||$[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer($[0]):q($[0]):$[0]}},ae.def=function(Y){var $=this.rules.block.def.exec(Y);if($){$[3]&&($[3]=$[3].substring(1,$[3].length-1));var Z=$[1].toLowerCase().replace(/\s+/g," ");return{tag:Z,raw:$[0],href:$[2],title:$[3]}}},ae.table=function(Y){var $=this.rules.block.table.exec(Y);if($){var Z={type:"table",header:X($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[]};if(Z.header.length===Z.align.length){Z.raw=$[0];var te=Z.align.length,ge;for(ge=0;ge<te;ge++)/^ *-+: *$/.test(Z.align[ge])?Z.align[ge]="right":/^ *:-+: *$/.test(Z.align[ge])?Z.align[ge]="center":/^ *:-+ *$/.test(Z.align[ge])?Z.align[ge]="left":Z.align[ge]=null;for(te=Z.cells.length,ge=0;ge<te;ge++)Z.cells[ge]=X(Z.cells[ge].replace(/^ *\| *| *\| *$/g,""),Z.header.length);return Z}}},ae.lheading=function(Y){var $=this.rules.block.lheading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[2].charAt(0)==="="?1:2,text:$[1]}},ae.paragraph=function(Y){var $=this.rules.block.paragraph.exec(Y);if($)return{type:"paragraph",raw:$[0],text:$[1].charAt($[1].length-1)===`
|
|
`?$[1].slice(0,-1):$[1]}},ae.text=function(Y,$){var Z=this.rules.block.text.exec(Y);if(Z){var te=$[$.length-1];return te&&te.type==="text"?{raw:Z[0],text:Z[0]}:{type:"text",raw:Z[0],text:Z[0]}}},ae.escape=function(Y){var $=this.rules.inline.escape.exec(Y);if($)return{type:"escape",raw:$[0],text:q($[1])}},ae.tag=function(Y,$,Z){var te=this.rules.inline.tag.exec(Y);if(te)return!$&&/^<a /i.test(te[0])?$=!0:$&&/^<\/a>/i.test(te[0])&&($=!1),!Z&&/^<(pre|code|kbd|script)(\s|>)/i.test(te[0])?Z=!0:Z&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(te[0])&&(Z=!1),{type:this.options.sanitize?"text":"html",raw:te[0],inLink:$,inRawBlock:Z,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):q(te[0]):te[0]}},ae.link=function(Y){var $=this.rules.inline.link.exec(Y);if($){var Z=ne($[2],"()");if(Z>-1){var te=$[0].indexOf("!")===0?5:4,ge=te+$[1].length+Z;$[2]=$[2].substring(0,Z),$[0]=$[0].substring(0,ge).trim(),$[3]=""}var xe=$[2],Pe="";if(this.options.pedantic){var st=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(xe);st?(xe=st[1],Pe=st[3]):Pe=""}else Pe=$[3]?$[3].slice(1,-1):"";xe=xe.trim().replace(/^<([\s\S]*)>$/,"$1");var vt=ue($,{href:xe&&xe.replace(this.rules.inline._escapes,"$1"),title:Pe&&Pe.replace(this.rules.inline._escapes,"$1")},$[0]);return vt}},ae.reflink=function(Y,$){var Z;if((Z=this.rules.inline.reflink.exec(Y))||(Z=this.rules.inline.nolink.exec(Y))){var te=(Z[2]||Z[1]).replace(/\s+/g," ");if(te=$[te.toLowerCase()],!te||!te.href){var ge=Z[0].charAt(0);return{type:"text",raw:ge,text:ge}}var xe=ue(Z,te,Z[0]);return xe}},ae.strong=function(Y,$,Z){Z===void 0&&(Z="");var te=this.rules.inline.strong.start.exec(Y);if(te&&(!te[1]||te[1]&&(Z===""||this.rules.inline.punctuation.exec(Z)))){$=$.slice(-1*Y.length);var ge=te[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ge.lastIndex=0;for(var xe;(te=ge.exec($))!=null;)if(xe=this.rules.inline.strong.middle.exec($.slice(0,te.index+3)),xe)return{type:"strong",raw:Y.slice(0,xe[0].length),text:Y.slice(2,xe[0].length-2)}}},ae.em=function(Y,$,Z){Z===void 0&&(Z="");var te=this.rules.inline.em.start.exec(Y);if(te&&(!te[1]||te[1]&&(Z===""||this.rules.inline.punctuation.exec(Z)))){$=$.slice(-1*Y.length);var ge=te[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ge.lastIndex=0;for(var xe;(te=ge.exec($))!=null;)if(xe=this.rules.inline.em.middle.exec($.slice(0,te.index+2)),xe)return{type:"em",raw:Y.slice(0,xe[0].length),text:Y.slice(1,xe[0].length-1)}}},ae.codespan=function(Y){var $=this.rules.inline.code.exec(Y);if($){var Z=$[2].replace(/\n/g," "),te=/[^ ]/.test(Z),ge=Z.startsWith(" ")&&Z.endsWith(" ");return te&&ge&&(Z=Z.substring(1,Z.length-1)),Z=q(Z,!0),{type:"codespan",raw:$[0],text:Z}}},ae.br=function(Y){var $=this.rules.inline.br.exec(Y);if($)return{type:"br",raw:$[0]}},ae.del=function(Y){var $=this.rules.inline.del.exec(Y);if($)return{type:"del",raw:$[0],text:$[1]}},ae.autolink=function(Y,$){var Z=this.rules.inline.autolink.exec(Y);if(Z){var te,ge;return Z[2]==="@"?(te=q(this.options.mangle?$(Z[1]):Z[1]),ge="mailto:"+te):(te=q(Z[1]),ge=te),{type:"link",raw:Z[0],text:te,href:ge,tokens:[{type:"text",raw:te,text:te}]}}},ae.url=function(Y,$){var Z;if(Z=this.rules.inline.url.exec(Y)){var te,ge;if(Z[2]==="@")te=q(this.options.mangle?$(Z[0]):Z[0]),ge="mailto:"+te;else{var xe;do xe=Z[0],Z[0]=this.rules.inline._backpedal.exec(Z[0])[0];while(xe!==Z[0]);te=q(Z[0]),Z[1]==="www."?ge="http://"+te:ge=te}return{type:"link",raw:Z[0],text:te,href:ge,tokens:[{type:"text",raw:te,text:te}]}}},ae.inlineText=function(Y,$,Z){var te=this.rules.inline.text.exec(Y);if(te){var ge;return $?ge=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):q(te[0]):te[0]:ge=q(this.options.smartypants?Z(te[0]):te[0]),{type:"text",raw:te[0],text:ge}}},le}(),fe=z.noopTest,de=z.edit,ce=z.merge,re={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:fe,table:fe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};re._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,re._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,re.def=de(re.def).replace("label",re._label).replace("title",re._title).getRegex(),re.bullet=/(?:[*+-]|\d{1,9}[.)])/,re.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,re.item=de(re.item,"gm").replace(/bull/g,re.bullet).getRegex(),re.list=de(re.list).replace(/bull/g,re.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+re.def.source+")").getRegex(),re._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",re._comment=/<!--(?!-?>)[\s\S]*?-->/,re.html=de(re.html,"i").replace("comment",re._comment).replace("tag",re._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),re.paragraph=de(re._paragraph).replace("hr",re.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",re._tag).getRegex(),re.blockquote=de(re.blockquote).replace("paragraph",re.paragraph).getRegex(),re.normal=ce({},re),re.gfm=ce({},re.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*|$)"}),re.gfm.nptable=de(re.gfm.nptable).replace("hr",re.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",re._tag).getRegex(),re.gfm.table=de(re.gfm.table).replace("hr",re.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",re._tag).getRegex(),re.pedantic=ce({},re.normal,{html:de(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",re._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:fe,paragraph:de(re.normal._paragraph).replace("hr",re.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",re.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:fe,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:fe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=de(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=de(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=de(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=de(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=de(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=de(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=de(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=de(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=de(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=de(se._blockSkip,"g").getRegex(),se.overlapSkip=de(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._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])?)+(?![-_])/,se.autolink=de(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=de(se.tag).replace("comment",re._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=de(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=de(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=de(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=ce({},se),se.pedantic=ce({},se.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:de(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:de(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=ce({},se.normal,{escape:de(se.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=de(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=ce({},se.gfm,{br:de(se.br).replace("{2,}","*").getRegex(),text:de(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var be={block:re,inline:se},Me=I.defaults,Ie=be.block,Ge=be.inline;function He(le){return le.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Se(le){var ae="",oe,Y,$=le.length;for(oe=0;oe<$;oe++)Y=le.charCodeAt(oe),Math.random()>.5&&(Y="x"+Y.toString(16)),ae+="&#"+Y+";";return ae}var De=function(){function le(oe){this.tokens=[],this.tokens.links=Object.create(null),this.options=oe||Me,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:Ie.normal,inline:Ge.normal};this.options.pedantic?(Y.block=Ie.pedantic,Y.inline=Ge.pedantic):this.options.gfm&&(Y.block=Ie.gfm,this.options.breaks?Y.inline=Ge.breaks:Y.inline=Ge.gfm),this.tokenizer.rules=Y}le.lex=function(Y,$){var Z=new le($);return Z.lex(Y)};var ae=le.prototype;return ae.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},ae.blockTokens=function(Y,$,Z){$===void 0&&($=[]),Z===void 0&&(Z=!0),Y=Y.replace(/^ +$/gm,"");for(var te,ge,xe,Pe;Y;){if(te=this.tokenizer.space(Y)){Y=Y.substring(te.raw.length),te.type&&$.push(te);continue}if(te=this.tokenizer.code(Y,$)){Y=Y.substring(te.raw.length),te.type?$.push(te):(Pe=$[$.length-1],Pe.raw+=`
|
|
`+te.raw,Pe.text+=`
|
|
`+te.text);continue}if(te=this.tokenizer.fences(Y)){Y=Y.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.heading(Y)){Y=Y.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.nptable(Y)){Y=Y.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.hr(Y)){Y=Y.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.blockquote(Y)){Y=Y.substring(te.raw.length),te.tokens=this.blockTokens(te.text,[],Z),$.push(te);continue}if(te=this.tokenizer.list(Y)){for(Y=Y.substring(te.raw.length),xe=te.items.length,ge=0;ge<xe;ge++)te.items[ge].tokens=this.blockTokens(te.items[ge].text,[],!1);$.push(te);continue}if(te=this.tokenizer.html(Y)){Y=Y.substring(te.raw.length),$.push(te);continue}if(Z&&(te=this.tokenizer.def(Y))){Y=Y.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(Y)){Y=Y.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.lheading(Y)){Y=Y.substring(te.raw.length),$.push(te);continue}if(Z&&(te=this.tokenizer.paragraph(Y))){Y=Y.substring(te.raw.length),$.push(te);continue}if(te=this.tokenizer.text(Y,$)){Y=Y.substring(te.raw.length),te.type?$.push(te):(Pe=$[$.length-1],Pe.raw+=`
|
|
`+te.raw,Pe.text+=`
|
|
`+te.text);continue}if(Y){var st="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(st);break}else throw new Error(st)}}return $},ae.inline=function(Y){var $,Z,te,ge,xe,Pe,st=Y.length;for($=0;$<st;$++){Pe=Y[$];switch(Pe.type){case"paragraph":case"text":case"heading":{Pe.tokens=[],this.inlineTokens(Pe.text,Pe.tokens);break}case"table":{for(Pe.tokens={header:[],cells:[]},ge=Pe.header.length,Z=0;Z<ge;Z++)Pe.tokens.header[Z]=[],this.inlineTokens(Pe.header[Z],Pe.tokens.header[Z]);for(ge=Pe.cells.length,Z=0;Z<ge;Z++)for(xe=Pe.cells[Z],Pe.tokens.cells[Z]=[],te=0;te<xe.length;te++)Pe.tokens.cells[Z][te]=[],this.inlineTokens(xe[te],Pe.tokens.cells[Z][te]);break}case"blockquote":{this.inline(Pe.tokens);break}case"list":{for(ge=Pe.items.length,Z=0;Z<ge;Z++)this.inline(Pe.items[Z].tokens);break}}}return Y},ae.inlineTokens=function(Y,$,Z,te,ge){$===void 0&&($=[]),Z===void 0&&(Z=!1),te===void 0&&(te=!1),ge===void 0&&(ge="");var xe,Pe=Y,st;if(this.tokens.links){var vt=Object.keys(this.tokens.links);if(vt.length>0)for(;(st=this.tokenizer.rules.inline.reflinkSearch.exec(Pe))!=null;)vt.includes(st[0].slice(st[0].lastIndexOf("[")+1,-1))&&(Pe=Pe.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(st=this.tokenizer.rules.inline.blockSkip.exec(Pe))!=null;)Pe=Pe.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(xe=this.tokenizer.escape(Y)){Y=Y.substring(xe.raw.length),$.push(xe);continue}if(xe=this.tokenizer.tag(Y,Z,te)){Y=Y.substring(xe.raw.length),Z=xe.inLink,te=xe.inRawBlock,$.push(xe);continue}if(xe=this.tokenizer.link(Y)){Y=Y.substring(xe.raw.length),xe.type==="link"&&(xe.tokens=this.inlineTokens(xe.text,[],!0,te)),$.push(xe);continue}if(xe=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(xe.raw.length),xe.type==="link"&&(xe.tokens=this.inlineTokens(xe.text,[],!0,te)),$.push(xe);continue}if(xe=this.tokenizer.strong(Y,Pe,ge)){Y=Y.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],Z,te),$.push(xe);continue}if(xe=this.tokenizer.em(Y,Pe,ge)){Y=Y.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],Z,te),$.push(xe);continue}if(xe=this.tokenizer.codespan(Y)){Y=Y.substring(xe.raw.length),$.push(xe);continue}if(xe=this.tokenizer.br(Y)){Y=Y.substring(xe.raw.length),$.push(xe);continue}if(xe=this.tokenizer.del(Y)){Y=Y.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],Z,te),$.push(xe);continue}if(xe=this.tokenizer.autolink(Y,Se)){Y=Y.substring(xe.raw.length),$.push(xe);continue}if(!Z&&(xe=this.tokenizer.url(Y,Se))){Y=Y.substring(xe.raw.length),$.push(xe);continue}if(xe=this.tokenizer.inlineText(Y,te,He)){Y=Y.substring(xe.raw.length),ge=xe.raw.slice(-1),$.push(xe);continue}if(Y){var we="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(we);break}else throw new Error(we)}}return $},K(le,null,[{key:"rules",get:function(){return{block:Ie,inline:Ge}}}]),le}(),ke=I.defaults,Ke=z.cleanUrl,Fe=z.escape,_e=function(){function le(oe){this.options=oe||ke}var ae=le.prototype;return ae.code=function(Y,$,Z){var te=($||"").match(/\S*/)[0];if(this.options.highlight){var ge=this.options.highlight(Y,te);ge!=null&&ge!==Y&&(Z=!0,Y=ge)}return te?'<pre><code class="'+this.options.langPrefix+Fe(te,!0)+'">'+(Z?Y:Fe(Y,!0))+`</code></pre>
|
|
`:"<pre><code>"+(Z?Y:Fe(Y,!0))+`</code></pre>
|
|
`},ae.blockquote=function(Y){return`<blockquote>
|
|
`+Y+`</blockquote>
|
|
`},ae.html=function(Y){return Y},ae.heading=function(Y,$,Z,te){return this.options.headerIds?"<h"+$+' id="'+this.options.headerPrefix+te.slug(Z)+'">'+Y+"</h"+$+`>
|
|
`:"<h"+$+">"+Y+"</h"+$+`>
|
|
`},ae.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ae.list=function(Y,$,Z){var te=$?"ol":"ul",ge=$&&Z!==1?' start="'+Z+'"':"";return"<"+te+ge+`>
|
|
`+Y+"</"+te+`>
|
|
`},ae.listitem=function(Y){return"<li>"+Y+`</li>
|
|
`},ae.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(Y){return"<p>"+Y+`</p>
|
|
`},ae.table=function(Y,$){return $&&($="<tbody>"+$+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Y+`</thead>
|
|
`+$+`</table>
|
|
`},ae.tablerow=function(Y){return`<tr>
|
|
`+Y+`</tr>
|
|
`},ae.tablecell=function(Y,$){var Z=$.header?"th":"td",te=$.align?"<"+Z+' align="'+$.align+'">':"<"+Z+">";return te+Y+"</"+Z+`>
|
|
`},ae.strong=function(Y){return"<strong>"+Y+"</strong>"},ae.em=function(Y){return"<em>"+Y+"</em>"},ae.codespan=function(Y){return"<code>"+Y+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(Y){return"<del>"+Y+"</del>"},ae.link=function(Y,$,Z){if(Y=Ke(this.options.sanitize,this.options.baseUrl,Y),Y===null)return Z;var te='<a href="'+Fe(Y)+'"';return $&&(te+=' title="'+$+'"'),te+=">"+Z+"</a>",te},ae.image=function(Y,$,Z){if(Y=Ke(this.options.sanitize,this.options.baseUrl,Y),Y===null)return Z;var te='<img src="'+Y+'" alt="'+Z+'"';return $&&(te+=' title="'+$+'"'),te+=this.options.xhtml?"/>":">",te},ae.text=function(Y){return Y},le}(),Le=function(){function le(){}var ae=le.prototype;return ae.strong=function(Y){return Y},ae.em=function(Y){return Y},ae.codespan=function(Y){return Y},ae.del=function(Y){return Y},ae.html=function(Y){return Y},ae.text=function(Y){return Y},ae.link=function(Y,$,Z){return""+Z},ae.image=function(Y,$,Z){return""+Z},ae.br=function(){return""},le}(),rt=function(){function le(){this.seen={}}var ae=le.prototype;return ae.slug=function(Y){var $=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty($)){var Z=$;do this.seen[Z]++,$=Z+"-"+this.seen[Z];while(this.seen.hasOwnProperty($))}return this.seen[$]=0,$},le}(),qe=I.defaults,Ye=z.unescape,We=function(){function le(oe){this.options=oe||qe,this.options.renderer=this.options.renderer||new _e,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Le,this.slugger=new rt}le.parse=function(Y,$){var Z=new le($);return Z.parse(Y)};var ae=le.prototype;return ae.parse=function(Y,$){$===void 0&&($=!0);var Z="",te,ge,xe,Pe,st,vt,we,yt,it,Qe,xt,ct,ft,ht,nt,Ht,Ct,Mt,lr=Y.length;for(te=0;te<lr;te++){Qe=Y[te];switch(Qe.type){case"space":continue;case"hr":{Z+=this.renderer.hr();continue}case"heading":{Z+=this.renderer.heading(this.parseInline(Qe.tokens),Qe.depth,Ye(this.parseInline(Qe.tokens,this.textRenderer)),this.slugger);continue}case"code":{Z+=this.renderer.code(Qe.text,Qe.lang,Qe.escaped);continue}case"table":{for(yt="",we="",Pe=Qe.header.length,ge=0;ge<Pe;ge++)we+=this.renderer.tablecell(this.parseInline(Qe.tokens.header[ge]),{header:!0,align:Qe.align[ge]});for(yt+=this.renderer.tablerow(we),it="",Pe=Qe.cells.length,ge=0;ge<Pe;ge++){for(vt=Qe.tokens.cells[ge],we="",st=vt.length,xe=0;xe<st;xe++)we+=this.renderer.tablecell(this.parseInline(vt[xe]),{header:!1,align:Qe.align[xe]});it+=this.renderer.tablerow(we)}Z+=this.renderer.table(yt,it);continue}case"blockquote":{it=this.parse(Qe.tokens),Z+=this.renderer.blockquote(it);continue}case"list":{for(xt=Qe.ordered,ct=Qe.start,ft=Qe.loose,Pe=Qe.items.length,it="",ge=0;ge<Pe;ge++)nt=Qe.items[ge],Ht=nt.checked,Ct=nt.task,ht="",nt.task&&(Mt=this.renderer.checkbox(Ht),ft?nt.tokens.length>0&&nt.tokens[0].type==="text"?(nt.tokens[0].text=Mt+" "+nt.tokens[0].text,nt.tokens[0].tokens&&nt.tokens[0].tokens.length>0&&nt.tokens[0].tokens[0].type==="text"&&(nt.tokens[0].tokens[0].text=Mt+" "+nt.tokens[0].tokens[0].text)):nt.tokens.unshift({type:"text",text:Mt}):ht+=Mt),ht+=this.parse(nt.tokens,ft),it+=this.renderer.listitem(ht,Ct,Ht);Z+=this.renderer.list(it,xt,ct);continue}case"html":{Z+=this.renderer.html(Qe.text);continue}case"paragraph":{Z+=this.renderer.paragraph(this.parseInline(Qe.tokens));continue}case"text":{for(it=Qe.tokens?this.parseInline(Qe.tokens):Qe.text;te+1<lr&&Y[te+1].type==="text";)Qe=Y[++te],it+=`
|
|
`+(Qe.tokens?this.parseInline(Qe.tokens):Qe.text);Z+=$?this.renderer.paragraph(it):it;continue}default:{var gr='Token with "'+Qe.type+'" type was not found.';if(this.options.silent){console.error(gr);return}else throw new Error(gr)}}}return Z},ae.parseInline=function(Y,$){$=$||this.renderer;var Z="",te,ge,xe=Y.length;for(te=0;te<xe;te++){ge=Y[te];switch(ge.type){case"escape":{Z+=$.text(ge.text);break}case"html":{Z+=$.html(ge.text);break}case"link":{Z+=$.link(ge.href,ge.title,this.parseInline(ge.tokens,$));break}case"image":{Z+=$.image(ge.href,ge.title,ge.text);break}case"strong":{Z+=$.strong(this.parseInline(ge.tokens,$));break}case"em":{Z+=$.em(this.parseInline(ge.tokens,$));break}case"codespan":{Z+=$.codespan(ge.text);break}case"br":{Z+=$.br();break}case"del":{Z+=$.del(this.parseInline(ge.tokens,$));break}case"text":{Z+=$.text(ge.text);break}default:{var Pe='Token with "'+ge.type+'" type was not found.';if(this.options.silent){console.error(Pe);return}else throw new Error(Pe)}}}return Z},le}(),et=z.merge,ze=z.checkSanitizeDeprecation,Ve=z.escape,ve=I.getDefaults,Ze=I.changeDefaults,Xe=I.defaults;function ye(le,ae,oe){if(typeof le=="undefined"||le===null)throw new Error("marked(): input parameter is undefined or null");if(typeof le!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(le)+", string expected");if(typeof ae=="function"&&(oe=ae,ae=null),ae=et({},ye.defaults,ae||{}),ze(ae),oe){var Y=ae.highlight,$;try{$=De.lex(le,ae)}catch(xe){return oe(xe)}var Z=function(Pe){var st;if(!Pe)try{st=We.parse($,ae)}catch(vt){Pe=vt}return ae.highlight=Y,Pe?oe(Pe):oe(null,st)};if(!Y||Y.length<3)return Z();if(delete ae.highlight,!$.length)return Z();var te=0;ye.walkTokens($,function(xe){xe.type==="code"&&(te++,setTimeout(function(){Y(xe.text,xe.lang,function(Pe,st){if(Pe)return Z(Pe);st!=null&&st!==xe.text&&(xe.text=st,xe.escaped=!0),te--,te===0&&Z()})},0))}),te===0&&Z();return}try{var ge=De.lex(le,ae);return ae.walkTokens&&ye.walkTokens(ge,ae.walkTokens),We.parse(ge,ae)}catch(xe){if(xe.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+Ve(xe.message+"",!0)+"</pre>";throw xe}}ye.options=ye.setOptions=function(le){return et(ye.defaults,le),Ze(ye.defaults),ye},ye.getDefaults=ve,ye.defaults=Xe,ye.use=function(le){var ae=et({},le);if(le.renderer&&function(){var Y=ye.defaults.renderer||new _e,$=function(ge){var xe=Y[ge];Y[ge]=function(){for(var Pe=arguments.length,st=new Array(Pe),vt=0;vt<Pe;vt++)st[vt]=arguments[vt];var we=le.renderer[ge].apply(Y,st);return we===!1&&(we=xe.apply(Y,st)),we}};for(var Z in le.renderer)$(Z);ae.renderer=Y}(),le.tokenizer&&function(){var Y=ye.defaults.tokenizer||new pe,$=function(ge){var xe=Y[ge];Y[ge]=function(){for(var Pe=arguments.length,st=new Array(Pe),vt=0;vt<Pe;vt++)st[vt]=arguments[vt];var we=le.tokenizer[ge].apply(Y,st);return we===!1&&(we=xe.apply(Y,st)),we}};for(var Z in le.tokenizer)$(Z);ae.tokenizer=Y}(),le.walkTokens){var oe=ye.defaults.walkTokens;ae.walkTokens=function(Y){le.walkTokens(Y),oe&&oe(Y)}}ye.setOptions(ae)},ye.walkTokens=function(le,ae){for(var oe=M(le),Y;!(Y=oe()).done;){var $=Y.value;ae($);switch($.type){case"table":{for(var Z=M($.tokens.header),te;!(te=Z()).done;){var ge=te.value;ye.walkTokens(ge,ae)}for(var xe=M($.tokens.cells),Pe;!(Pe=xe()).done;)for(var st=Pe.value,vt=M(st),we;!(we=vt()).done;){var yt=we.value;ye.walkTokens(yt,ae)}break}case"list":{ye.walkTokens($.items,ae);break}default:$.tokens&&ye.walkTokens($.tokens,ae)}}},ye.Parser=We,ye.parser=We.parse,ye.Renderer=_e,ye.TextRenderer=Le,ye.Lexer=De,ye.lexer=De.lex,ye.Tokenizer=pe,ye.Slugger=rt,ye.parse=ye;var Ae=ye;return Ae})},ELLl:function(Je,je,J){(function(Q){Q(J("VrN/"))})(function(Q){var K={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},A=Q.Pos;Q.defineOption("autoCloseBrackets",!1,function(y,b,l){l&&l!=Q.Init&&(y.removeKeyMap(M),y.state.closeBrackets=null),b&&(P(W(b,"pairs")),y.state.closeBrackets=b,y.addKeyMap(M))});function W(y,b){return b=="pairs"&&typeof y=="string"?y:typeof y=="object"&&y[b]!=null?y[b]:K[b]}var M={Backspace:O,Enter:_};function P(y){for(var b=0;b<y.length;b++){var l=y.charAt(b),a="'"+l+"'";M[a]||(M[a]=I(l))}}P(K.pairs+"`");function I(y){return function(b){return p(b,y)}}function k(y){var b=y.state.closeBrackets;if(!b||b.override)return b;var l=y.getModeAt(y.getCursor());return l.closeBrackets||b}function O(y){var b=k(y);if(!b||y.getOption("disableInput"))return Q.Pass;for(var l=W(b,"pairs"),a=y.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return Q.Pass;var u=D(y,a[s].head);if(!u||l.indexOf(u)%2!=0)return Q.Pass}for(var s=a.length-1;s>=0;s--){var C=a[s].head;y.replaceRange("",A(C.line,C.ch-1),A(C.line,C.ch+1),"+delete")}}function _(y){var b=k(y),l=b&&W(b,"explode");if(!l||y.getOption("disableInput"))return Q.Pass;for(var a=y.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return Q.Pass;var u=D(y,a[s].head);if(!u||l.indexOf(u)%2!=0)return Q.Pass}y.operation(function(){var C=y.lineSeparator()||`
|
|
`;y.replaceSelection(C+C,null),y.execCommand("goCharLeft"),a=y.listSelections();for(var g=0;g<a.length;g++){var m=a[g].head.line;y.indentLine(m,null,!0),y.indentLine(m+1,null,!0)}})}function c(y){var b=Q.cmpPos(y.anchor,y.head)>0;return{anchor:new A(y.anchor.line,y.anchor.ch+(b?-1:1)),head:new A(y.head.line,y.head.ch+(b?1:-1))}}function p(y,b){var l=k(y);if(!l||y.getOption("disableInput"))return Q.Pass;var a=W(l,"pairs"),s=a.indexOf(b);if(s==-1)return Q.Pass;for(var u=W(l,"closeBefore"),C=W(l,"triples"),g=a.charAt(s+1)==b,m=y.listSelections(),L=s%2==0,x,f=0;f<m.length;f++){var h=m[f],d=h.head,o,T=y.getRange(d,A(d.line,d.ch+1));if(L&&!h.empty())o="surround";else if((g||!L)&&T==b)g&&w(y,d)?o="both":C.indexOf(b)>=0&&y.getRange(d,A(d.line,d.ch+3))==b+b+b?o="skipThree":o="skip";else if(g&&d.ch>1&&C.indexOf(b)>=0&&y.getRange(A(d.line,d.ch-2),d)==b+b){if(d.ch>2&&/\bstring/.test(y.getTokenTypeAt(A(d.line,d.ch-2))))return Q.Pass;o="addFour"}else if(g){var E=d.ch==0?" ":y.getRange(A(d.line,d.ch-1),d);if(!Q.isWordChar(T)&&E!=b&&!Q.isWordChar(E))o="both";else return Q.Pass}else if(L&&(T.length===0||/\s/.test(T)||u.indexOf(T)>-1))o="both";else return Q.Pass;if(!x)x=o;else if(x!=o)return Q.Pass}var v=s%2?a.charAt(s-1):b,R=s%2?b:a.charAt(s+1);y.operation(function(){if(x=="skip")y.execCommand("goCharRight");else if(x=="skipThree")for(var N=0;N<3;N++)y.execCommand("goCharRight");else if(x=="surround"){for(var B=y.getSelections(),N=0;N<B.length;N++)B[N]=v+B[N]+R;y.replaceSelections(B,"around"),B=y.listSelections().slice();for(var N=0;N<B.length;N++)B[N]=c(B[N]);y.setSelections(B)}else x=="both"?(y.replaceSelection(v+R,null),y.triggerElectric(v+R),y.execCommand("goCharLeft")):x=="addFour"&&(y.replaceSelection(v+v+v+v,"before"),y.execCommand("goCharRight"))})}function D(y,b){var l=y.getRange(A(b.line,b.ch-1),A(b.line,b.ch+1));return l.length==2?l:null}function w(y,b){var l=y.getTokenAt(A(b.line,b.ch+1));return/\bstring/.test(l.type)&&l.start==b.ch&&(b.ch==0||!/\bstring/.test(y.getTokenTypeAt(b)))}})},F8wB:function(Je,je,J){Je.exports={loading:"loading___1SIOG"}},Gytx:function(Je,je){Je.exports=function(Q,K,A,W){var M=A?A.call(W,Q,K):void 0;if(M!==void 0)return!!M;if(Q===K)return!0;if(typeof Q!="object"||!Q||typeof K!="object"||!K)return!1;var P=Object.keys(Q),I=Object.keys(K);if(P.length!==I.length)return!1;for(var k=Object.prototype.hasOwnProperty.bind(K),O=0;O<P.length;O++){var _=P[O];if(!k(_))return!1;var c=Q[_],p=K[_];if(M=A?A.call(W,c,p,_):void 0,M===!1||M===void 0&&c!==p)return!1}return!0}},H38U:function(Je,je,J){var Q=J("f4xo"),K=J("rcnY"),A=J("wU8J"),W=J("Iq15"),M=J("dWSS");function P(k,O){this.typeNumber=k,this.errorCorrectLevel=O,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var I=P.prototype;I.addData=function(k){var O=new Q(k);this.dataList.push(O),this.dataCache=null},I.isDark=function(k,O){if(k<0||this.moduleCount<=k||O<0||this.moduleCount<=O)throw new Error(k+","+O);return this.modules[k][O]},I.getModuleCount=function(){return this.moduleCount},I.make=function(){if(this.typeNumber<1){var k=1;for(k=1;k<40;k++){for(var O=K.getRSBlocks(k,this.errorCorrectLevel),_=new A,c=0,p=0;p<O.length;p++)c+=O[p].dataCount;for(var p=0;p<this.dataList.length;p++){var D=this.dataList[p];_.put(D.mode,4),_.put(D.getLength(),W.getLengthInBits(D.mode,k)),D.write(_)}if(_.getLengthInBits()<=c*8)break}this.typeNumber=k}this.makeImpl(!1,this.getBestMaskPattern())},I.makeImpl=function(k,O){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var _=0;_<this.moduleCount;_++){this.modules[_]=new Array(this.moduleCount);for(var c=0;c<this.moduleCount;c++)this.modules[_][c]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(k,O),this.typeNumber>=7&&this.setupTypeNumber(k),this.dataCache==null&&(this.dataCache=P.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,O)},I.setupPositionProbePattern=function(k,O){for(var _=-1;_<=7;_++){if(k+_<=-1||this.moduleCount<=k+_)continue;for(var c=-1;c<=7;c++){if(O+c<=-1||this.moduleCount<=O+c)continue;0<=_&&_<=6&&(c==0||c==6)||0<=c&&c<=6&&(_==0||_==6)||2<=_&&_<=4&&2<=c&&c<=4?this.modules[k+_][O+c]=!0:this.modules[k+_][O+c]=!1}}},I.getBestMaskPattern=function(){for(var k=0,O=0,_=0;_<8;_++){this.makeImpl(!0,_);var c=W.getLostPoint(this);(_==0||k>c)&&(k=c,O=_)}return O},I.createMovieClip=function(k,O,_){var c=k.createEmptyMovieClip(O,_),p=1;this.make();for(var D=0;D<this.modules.length;D++)for(var w=D*p,y=0;y<this.modules[D].length;y++){var b=y*p,l=this.modules[D][y];l&&(c.beginFill(0,100),c.moveTo(b,w),c.lineTo(b+p,w),c.lineTo(b+p,w+p),c.lineTo(b,w+p),c.endFill())}return c},I.setupTimingPattern=function(){for(var k=8;k<this.moduleCount-8;k++){if(this.modules[k][6]!=null)continue;this.modules[k][6]=k%2==0}for(var O=8;O<this.moduleCount-8;O++){if(this.modules[6][O]!=null)continue;this.modules[6][O]=O%2==0}},I.setupPositionAdjustPattern=function(){for(var k=W.getPatternPosition(this.typeNumber),O=0;O<k.length;O++)for(var _=0;_<k.length;_++){var c=k[O],p=k[_];if(this.modules[c][p]!=null)continue;for(var D=-2;D<=2;D++)for(var w=-2;w<=2;w++)D==-2||D==2||w==-2||w==2||D==0&&w==0?this.modules[c+D][p+w]=!0:this.modules[c+D][p+w]=!1}},I.setupTypeNumber=function(k){for(var O=W.getBCHTypeNumber(this.typeNumber),_=0;_<18;_++){var c=!k&&(O>>_&1)==1;this.modules[Math.floor(_/3)][_%3+this.moduleCount-8-3]=c}for(var _=0;_<18;_++){var c=!k&&(O>>_&1)==1;this.modules[_%3+this.moduleCount-8-3][Math.floor(_/3)]=c}},I.setupTypeInfo=function(k,O){for(var _=this.errorCorrectLevel<<3|O,c=W.getBCHTypeInfo(_),p=0;p<15;p++){var D=!k&&(c>>p&1)==1;p<6?this.modules[p][8]=D:p<8?this.modules[p+1][8]=D:this.modules[this.moduleCount-15+p][8]=D}for(var p=0;p<15;p++){var D=!k&&(c>>p&1)==1;p<8?this.modules[8][this.moduleCount-p-1]=D:p<9?this.modules[8][15-p-1+1]=D:this.modules[8][15-p-1]=D}this.modules[this.moduleCount-8][8]=!k},I.mapData=function(k,O){for(var _=-1,c=this.moduleCount-1,p=7,D=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var y=0;y<2;y++)if(this.modules[c][w-y]==null){var b=!1;D<k.length&&(b=(k[D]>>>p&1)==1);var l=W.getMask(O,c,w-y);l&&(b=!b),this.modules[c][w-y]=b,p--,p==-1&&(D++,p=7)}if(c+=_,c<0||this.moduleCount<=c){c-=_,_=-_;break}}},P.PAD0=236,P.PAD1=17,P.createData=function(k,O,_){for(var c=K.getRSBlocks(k,O),p=new A,D=0;D<_.length;D++){var w=_[D];p.put(w.mode,4),p.put(w.getLength(),W.getLengthInBits(w.mode,k)),w.write(p)}for(var y=0,D=0;D<c.length;D++)y+=c[D].dataCount;if(p.getLengthInBits()>y*8)throw new Error("code length overflow. ("+p.getLengthInBits()+">"+y*8+")");for(p.getLengthInBits()+4<=y*8&&p.put(0,4);p.getLengthInBits()%8!=0;)p.putBit(!1);for(;!(p.getLengthInBits()>=y*8);){if(p.put(P.PAD0,8),p.getLengthInBits()>=y*8)break;p.put(P.PAD1,8)}return P.createBytes(p,c)},P.createBytes=function(k,O){for(var _=0,c=0,p=0,D=new Array(O.length),w=new Array(O.length),y=0;y<O.length;y++){var b=O[y].dataCount,l=O[y].totalCount-b;c=Math.max(c,b),p=Math.max(p,l),D[y]=new Array(b);for(var a=0;a<D[y].length;a++)D[y][a]=255&k.buffer[a+_];_+=b;var s=W.getErrorCorrectPolynomial(l),u=new M(D[y],s.getLength()-1),C=u.mod(s);w[y]=new Array(s.getLength()-1);for(var a=0;a<w[y].length;a++){var g=a+C.getLength()-w[y].length;w[y][a]=g>=0?C.get(g):0}}for(var m=0,a=0;a<O.length;a++)m+=O[a].totalCount;for(var L=new Array(m),x=0,a=0;a<c;a++)for(var y=0;y<O.length;y++)a<D[y].length&&(L[x++]=D[y][a]);for(var a=0;a<p;a++)for(var y=0;y<O.length;y++)a<w[y].length&&(L[x++]=w[y][a]);return L},Je.exports=P},HV1I:function(Je,je,J){Je.exports={flex_box_center:"flex_box_center___1nEOe",flex_space_between:"flex_space_between___21gJ7",flex_box_vertical_center:"flex_box_vertical_center___2iHIq",flex_box_center_end:"flex_box_center_end___19LSZ",flex_box_column:"flex_box_column___2zG50",bg:"bg___u_uqy",formWrap:"formWrap___3rl8w"}},HmJG:function(Je,je,J){},Iq15:function(Je,je,J){var Q=J("nVVt"),K=J("dWSS"),A=J("dQei"),W={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},M={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(P){for(var I=P<<10;M.getBCHDigit(I)-M.getBCHDigit(M.G15)>=0;)I^=M.G15<<M.getBCHDigit(I)-M.getBCHDigit(M.G15);return(P<<10|I)^M.G15_MASK},getBCHTypeNumber:function(P){for(var I=P<<12;M.getBCHDigit(I)-M.getBCHDigit(M.G18)>=0;)I^=M.G18<<M.getBCHDigit(I)-M.getBCHDigit(M.G18);return P<<12|I},getBCHDigit:function(P){for(var I=0;P!=0;)I++,P>>>=1;return I},getPatternPosition:function(P){return M.PATTERN_POSITION_TABLE[P-1]},getMask:function(P,I,k){switch(P){case W.PATTERN000:return(I+k)%2==0;case W.PATTERN001:return I%2==0;case W.PATTERN010:return k%3==0;case W.PATTERN011:return(I+k)%3==0;case W.PATTERN100:return(Math.floor(I/2)+Math.floor(k/3))%2==0;case W.PATTERN101:return I*k%2+I*k%3==0;case W.PATTERN110:return(I*k%2+I*k%3)%2==0;case W.PATTERN111:return(I*k%3+(I+k)%2)%2==0;default:throw new Error("bad maskPattern:"+P)}},getErrorCorrectPolynomial:function(P){for(var I=new K([1],0),k=0;k<P;k++)I=I.multiply(new K([1,A.gexp(k)],0));return I},getLengthInBits:function(P,I){if(1<=I&&I<10)switch(P){case Q.MODE_NUMBER:return 10;case Q.MODE_ALPHA_NUM:return 9;case Q.MODE_8BIT_BYTE:return 8;case Q.MODE_KANJI:return 8;default:throw new Error("mode:"+P)}else if(I<27)switch(P){case Q.MODE_NUMBER:return 12;case Q.MODE_ALPHA_NUM:return 11;case Q.MODE_8BIT_BYTE:return 16;case Q.MODE_KANJI:return 10;default:throw new Error("mode:"+P)}else if(I<41)switch(P){case Q.MODE_NUMBER:return 14;case Q.MODE_ALPHA_NUM:return 13;case Q.MODE_8BIT_BYTE:return 16;case Q.MODE_KANJI:return 12;default:throw new Error("mode:"+P)}else throw new Error("type:"+I)},getLostPoint:function(P){for(var I=P.getModuleCount(),k=0,O=0;O<I;O++)for(var _=0;_<I;_++){for(var c=0,p=P.isDark(O,_),D=-1;D<=1;D++){if(O+D<0||I<=O+D)continue;for(var w=-1;w<=1;w++){if(_+w<0||I<=_+w)continue;if(D==0&&w==0)continue;p==P.isDark(O+D,_+w)&&c++}}c>5&&(k+=3+c-5)}for(var O=0;O<I-1;O++)for(var _=0;_<I-1;_++){var y=0;P.isDark(O,_)&&y++,P.isDark(O+1,_)&&y++,P.isDark(O,_+1)&&y++,P.isDark(O+1,_+1)&&y++,(y==0||y==4)&&(k+=3)}for(var O=0;O<I;O++)for(var _=0;_<I-6;_++)P.isDark(O,_)&&!P.isDark(O,_+1)&&P.isDark(O,_+2)&&P.isDark(O,_+3)&&P.isDark(O,_+4)&&!P.isDark(O,_+5)&&P.isDark(O,_+6)&&(k+=40);for(var _=0;_<I;_++)for(var O=0;O<I-6;O++)P.isDark(O,_)&&!P.isDark(O+1,_)&&P.isDark(O+2,_)&&P.isDark(O+3,_)&&P.isDark(O+4,_)&&!P.isDark(O+5,_)&&P.isDark(O+6,_)&&(k+=40);for(var b=0,_=0;_<I;_++)for(var O=0;O<I;O++)P.isDark(O,_)&&b++;var l=Math.abs(100*b/I/I-50)/5;return k+=l*10,k}};Je.exports=M},LdHM:function(Je,je,J){"use strict";J.d(je,"b",function(){return u}),J.d(je,"a",function(){return g});var Q=J("1OyB"),K=J("vuIU"),A=J("Ji7U"),W=J("LK+K"),M=J("cDcd"),P=J("rePB"),I=J("Ff2n"),k=J("ODXe"),O=J("4IlW"),_=J("bX4T"),c=J("YrtM"),p=J("TSYQ"),D=J.n(p),w=J("+nKL"),y=J("8OUc"),b=function(X,q){var ne=X.prefixCls,ue=X.id,Ee=X.flattenOptions,pe=X.childrenAsData,fe=X.values,de=X.searchValue,ce=X.multiple,re=X.defaultActiveFirstOption,se=X.height,be=X.itemHeight,Me=X.notFoundContent,Ie=X.open,Ge=X.menuItemSelectedIcon,He=X.virtual,Se=X.onSelect,De=X.onToggleOpen,ke=X.onActiveValue,Ke=X.onScroll,Fe=X.onMouseEnter,_e="".concat(ne,"-item"),Le=Object(c.a)(function(){return Ee},[Ie,Ee],function(Ae,le){return le[0]&&Ae[1]!==le[1]}),rt=M.useRef(null),qe=function(le){le.preventDefault()},Ye=function(le){rt.current&&rt.current.scrollTo({index:le})},We=function(le){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,oe=Le.length,Y=0;Y<oe;Y+=1){var $=(le+Y*ae+oe)%oe,Z=Le[$],te=Z.group,ge=Z.data;if(!te&&!ge.disabled)return $}return-1},et=M.useState(function(){return We(0)}),ze=Object(k.a)(et,2),Ve=ze[0],ve=ze[1],Ze=function(le){ve(le);var ae=Le[le];if(!ae){ke(null,-1);return}ke(ae.data.value,le)};M.useEffect(function(){Ze(re!==!1?We(0):-1)},[Le.length,de]),M.useEffect(function(){var Ae=setTimeout(function(){if(!ce&&Ie&&fe.size===1){var le=Array.from(fe)[0],ae=Le.findIndex(function(oe){var Y=oe.data;return Y.value===le});Ze(ae),Ye(ae)}});return function(){return clearTimeout(Ae)}},[Ie]);var Xe=function(le){le!==void 0&&Se(le,{selected:!fe.has(le)}),ce||De(!1)};if(M.useImperativeHandle(q,function(){return{onKeyDown:function(le){var ae=le.which;switch(ae){case O.a.UP:case O.a.DOWN:{var oe=0;if(ae===O.a.UP?oe=-1:ae===O.a.DOWN&&(oe=1),oe!==0){var Y=We(Ve+oe,oe);Ye(Y),Ze(Y)}break}case O.a.ENTER:{var $=Le[Ve];$&&!$.data.disabled?Xe($.data.value):Xe(void 0),Ie&&le.preventDefault();break}case O.a.ESC:De(!1)}},onKeyUp:function(){},scrollTo:function(le){Ye(le)}}}),Le.length===0)return M.createElement("div",{role:"listbox",id:"".concat(ue,"_list"),className:"".concat(_e,"-empty"),onMouseDown:qe},Me);function ye(Ae){var le=Le[Ae];if(!le)return null;var ae=le.data||{},oe=ae.value,Y=ae.label,$=ae.children,Z=Object(_.a)(ae,!0),te=pe?$:Y;return le?M.createElement("div",Object.assign({"aria-label":typeof te=="string"?te:null},Z,{key:Ae,role:"option",id:"".concat(ue,"_list_").concat(Ae),"aria-selected":fe.has(oe)}),oe):null}return M.createElement(M.Fragment,null,M.createElement("div",{role:"listbox",id:"".concat(ue,"_list"),style:{height:0,width:0,overflow:"hidden"}},ye(Ve-1),ye(Ve),ye(Ve+1)),M.createElement(w.a,{itemKey:"key",ref:rt,data:Le,height:se,itemHeight:be,fullHeight:!1,onMouseDown:qe,onScroll:Ke,virtual:He,onMouseEnter:Fe},function(Ae,le){var ae,oe=Ae.group,Y=Ae.groupOption,$=Ae.data,Z=$.label,te=$.key;if(oe)return M.createElement("div",{className:D()(_e,"".concat(_e,"-group"))},Z!==void 0?Z:te);var ge=$.disabled,xe=$.value,Pe=$.title,st=$.children,vt=$.style,we=$.className,yt=Object(I.a)($,["disabled","value","title","children","style","className"]),it=fe.has(xe),Qe="".concat(_e,"-option"),xt=D()(_e,Qe,we,(ae={},Object(P.a)(ae,"".concat(Qe,"-grouped"),Y),Object(P.a)(ae,"".concat(Qe,"-active"),Ve===le&&!ge),Object(P.a)(ae,"".concat(Qe,"-disabled"),ge),Object(P.a)(ae,"".concat(Qe,"-selected"),it),ae)),ct=pe?st:Z,ft=!Ge||typeof Ge=="function"||it;return M.createElement("div",Object.assign({},yt,{"aria-selected":it,className:xt,title:Pe,onMouseMove:function(){if(Ve===le||ge)return;Ze(le)},onClick:function(){ge||Xe(xe)},style:vt}),M.createElement("div",{className:"".concat(Qe,"-content")},ct||xe),M.isValidElement(Ge)||it,ft&&M.createElement(y.a,{className:"".concat(_e,"-option-state"),customizeIcon:Ge,customizeIconProps:{isSelected:it}},it?"\u2713":null))}))},l=M.forwardRef(b);l.displayName="OptionList";var a=l,s=function(){return null};s.isSelectOption=!0;var u=s,C=function(){return null};C.isSelectOptGroup=!0;var g=C,m=J("VTBJ"),L=J("Zm9Q");function x(F){var X=F.key,q=F.props,ne=q.children,ue=q.value,Ee=Object(I.a)(q,["children","value"]);return Object(m.a)({key:X,value:ue!==void 0?ue:X,children:ne},Ee)}function f(F){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(F).map(function(q,ne){if(!M.isValidElement(q)||!q.type)return null;var ue=q.type.isSelectOptGroup,Ee=q.key,pe=q.props,fe=pe.children,de=Object(I.a)(pe,["children"]);return X||!ue?x(q):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Ee===null?ne:Ee,"__"),label:Ee},de),{},{options:f(fe)})}).filter(function(q){return q})}var h=J("2Qr1"),d=J("qNPg"),o=J("U8pU"),T=J("Kwbf"),E=J("WKfj");function v(F){var X=F.mode,q=F.options,ne=F.children,ue=F.backfill,Ee=F.allowClear,pe=F.placeholder,fe=F.getInputElement,de=F.showSearch,ce=F.onSearch,re=F.defaultOpen,se=F.autoFocus,be=F.labelInValue,Me=F.value,Ie=F.inputValue,Ge=F.optionLabelProp,He=X==="multiple"||X==="tags",Se=de!==void 0?de:He||X==="combobox",De=q||f(ne);if(Object(T.a)(X!=="tags"||De.every(function(_e){return!_e.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var ke=De.some(function(_e){return _e.options?_e.options.some(function(Le){return typeof("value"in Le?Le.value:Le.key)=="number"}):typeof("value"in _e?_e.value:_e.key)=="number"});Object(T.a)(!ke,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(T.a)(X!=="combobox"||!Ge,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(T.a)(X==="combobox"||!ue,"`backfill` only works with `combobox` mode."),Object(T.a)(X==="combobox"||!fe,"`getInputElement` only work with `combobox` mode."),Object(T.b)(X!=="combobox"||!fe||!Ee||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ce&&!Se&&X!=="combobox"&&X!=="tags"&&Object(T.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(T.b)(!re||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Me!=null){var Ke=Object(E.d)(Me);Object(T.a)(!be||Ke.every(function(_e){return Object(o.a)(_e)==="object"&&("key"in _e||"value"in _e)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(T.a)(!He||Array.isArray(Me),"`value` should be array when `mode` is `multiple` or `tags`")}if(ne){var Fe=null;Object(L.a)(ne).some(function(_e){if(!M.isValidElement(_e)||!_e.type)return!1;var Le=_e.type;if(Le.isSelectOption)return!1;if(Le.isSelectOptGroup){var rt=Object(L.a)(_e.props.children).every(function(qe){return!M.isValidElement(qe)||!_e.type||qe.type.isSelectOption?!0:(Fe=qe.type,!1)});return!rt}return Fe=Le,!0}),Fe&&Object(T.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(T.a)(Ie===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var R=v,N=Object(d.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:f,flattenOptions:h.d,getLabeledValue:h.e,filterOptions:h.b,isValueDisabled:h.g,findValueOption:h.c,warningProps:R,fillOptionsWithMissingValue:h.a}),B=function(F){Object(A.a)(q,F);var X=Object(W.a)(q);function q(){var ne;return Object(Q.a)(this,q),ne=X.apply(this,arguments),ne.selectRef=M.createRef(),ne.focus=function(){ne.selectRef.current.focus()},ne.blur=function(){ne.selectRef.current.blur()},ne}return Object(K.a)(q,[{key:"render",value:function(){return M.createElement(N,Object.assign({ref:this.selectRef},this.props))}}]),q}(M.Component);B.Option=u,B.OptGroup=g;var z=B,j=je.c=z},Ly88:function(Je,je,J){"use strict";J.r(je);var Q=J("14J3"),K=J("BMrR"),A=J("jCWc"),W=J("kPKH"),M=J("OaEy"),P=J("2fM7"),I=J("7Kak"),k=J("9yH6"),O=J("5NDa"),_=J("5rEg"),c=J("2qtc"),p=J("kLXV"),D=J("miYZ"),w=J("tsqr"),y=J("9og8"),b=J("k1fw"),l=J("y8nQ"),a=J("Vl3Y"),s=J("tJVT"),u=J("PpiC"),C=J("WmNS"),g=J.n(C),m=J("cDcd"),L=J.n(m),x=J("9kvl"),f=J("Ot1p"),h=J("HBuW"),d=J("HV1I"),o=J.n(d),T=J("LvDl"),E=J.n(T),v=J("9ZNV"),R=J("nuEh"),N=J("fnXi"),B=J("UqFu"),z=J("2RCv"),j={1:[100,200],2:[300,400,500,600],3:[700,800,900,1e3]},F=function(q){var ne,ue,Ee,pe=q.shixunsDetail,fe=q.dispatch,de=q.match,ce=q.practiceSetting,re=Object(u.a)(q,["shixunsDetail","dispatch","match","practiceSetting"]),se=a.a.useForm(),be=Object(s.a)(se,1),Me=be[0],Ie=Object(m.useState)({}),Ge=Object(s.a)(Ie,2),He=Ge[0],Se=Ge[1],De=Object(m.useState)([100,200]),ke=Object(s.a)(De,2),Ke=ke[0],Fe=ke[1],_e=pe.challengesNew,Le=Object(m.useState)(),rt=Object(s.a)(Le,2),qe=rt[0],Ye=rt[1],We=Object(m.useState)(),et=Object(s.a)(We,2),ze=et[0],Ve=et[1],ve=Object(m.useState)(!0),Ze=Object(s.a)(ve,2),Xe=Ze[0],ye=Ze[1],Ae=Object(m.useState)(1),le=Object(s.a)(Ae,2),ae=le[0],oe=le[1],Y=Object(m.useRef)({subject:"",difficulty:1,score:100,task_pass:Object(B.a)(_e.task_pass_default)}),$=Object(m.useRef)(null),Z=ce.selectQuestionParams,te=ce.id,ge=ce.newQuestion;Object(m.useEffect)(function(){de.params.challengesId?(Ve(!0),xe()):(ye(!0),Ve(!1),fe({type:"shixunsDetail/getChallengesNew",payload:Object(b.a)({},de.params)}),ye(!1)),setTimeout(function(){document.getElementById("practice-scroll").scrollTo(0,0)},300)},[de.params]),Object(m.useEffect)(function(){return it(),function(){clearTimeout($.current)}},[He]);var xe=function(){var ct=Object(y.a)(g.a.mark(function ft(){var ht,nt;return g.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return ye(!0),Ct.next=3,Object(h.H)({id:de.params.id,challengeId:de.params.challengesId,tab:0});case 3:ht=Ct.sent,ht&&(nt=Object(b.a)(Object(b.a)({},ht),{},{task_pass:Object(B.a)(ht.task_pass)}),Ye(nt),Pe(nt),ye(!1),Y.current={subject:nt.subject,difficulty:nt.difficulty,score:nt.score,task_pass:nt.task_pass});case 5:case"end":return Ct.stop()}},ft)}));return function(){return ct.apply(this,arguments)}}(),Pe=function(ft){var ht={subject:ft.name,difficulty:ft.difficulty,score:ft.score,challenge_tag:ft.tags,task_pass:ft.task_pass},nt=j[ft.difficulty];Fe(nt),Me.setFieldsValue(Object(b.a)({},ht)),Se(Object(b.a)({},ht))},st=function(ft){var ht=j[ft],nt=ht==null?void 0:ht[0];Fe(ht),Me.setFieldsValue({score:nt}),Se(Object(b.a)(Object(b.a)({},Me.getFieldsValue()),{score:nt}))},vt=function(ft,ht){Se(Object(b.a)({},Me.getFieldsValue())),"difficulty"in ft&&st(ft.difficulty)},we=function(){var ct=Object(y.a)(g.a.mark(function ft(){var ht,nt,Ht,Ct,Mt,lr=arguments;return g.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:if(nt=lr.length>0&&lr[0]!==void 0?lr[0]:{},!(!ze&&((ht=pe.detail)===null||ht===void 0?void 0:ht.shixun_status)===2)){qt.next=4;break}return w.b.info("\u8BE5\u5B9E\u8BAD\u5DF2\u7ECF\u53D1\u5E03\u4E0D\u80FD\u65B0\u5EFA"),qt.abrupt("return");case 4:if(!ze){qt.next=10;break}return qt.next=7,Object(h.Mb)(Object(b.a)(Object(b.a)({},de.params),{},{tab:0,challenge:Object(b.a)({},nt),challenge_tag:nt.challenge_tag}));case 7:return Ht=qt.sent,Ht&&(fe({type:"practiceSetting/setUpdateIndex"}),x.d.replace("/shixuns/".concat(de.params.id,"/edit/").concat(de.params.challengesId,"/tab=2"))),qt.abrupt("return");case 10:return Ct=Object(b.a)({},He),Ct.identifier=de.params.id,Ct.st=0,qt.next=15,Object(h.b)(Object(b.a)({},Ct));case 15:Mt=qt.sent,Mt.status===1&&(x.d.replace("/shixuns/".concat(de.params.id,"/edit/").concat(Mt.challenge_id,"/tab=2")),setTimeout(function(){fe({type:"practiceSetting/setParams",payload:{newQuestion:null}}),fe({type:"practiceSetting/setUpdateIndex"})},200));case 17:case"end":return qt.stop()}},ft)}));return function(){return ct.apply(this,arguments)}}(),yt=function(){xt()},it=function(){clearTimeout($.current),$.current=setTimeout(Qe,500)},Qe=function(){"subject"in He&&ge&&fe({type:"practiceSetting/setParams",payload:{newQuestion:{st:0,name:He==null?void 0:He.subject}}});var ft=["subject","difficulty","score","task_pass"],ht=ft.some(function(nt){var Ht=Object(T.isNumber)(He[nt])?String(He[nt]):He[nt],Ct=Object(T.isNumber)(Y.current[nt])?String(Y.current[nt]):Y.current[nt];return!Object(T.isEqual)(Ht,Ct)});fe(ht?{type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!0}}:{type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})},xt=function(){var ft,ht=function(){x.d.push("/shixuns/".concat(te,"/challenges")),fe({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})};ce!=null&&(ft=ce.sideBar)!==null&&ft!==void 0&&ft.confirmLeave?p.a.confirm({title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",onOk:function(){ht()}}):ht()};return L.a.createElement(L.a.Fragment,null,L.a.createElement("section",{key:1,className:o.a.bg,id:"practice-scroll"},L.a.createElement(a.a,{key:ae,form:Me,className:o.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:vt,onFinish:we},L.a.createElement(N.a,{activeIndex:0,isEdit:ze}),L.a.createElement(a.a.Item,{initialValue:"",name:"subject",label:"\u4EFB\u52A1\u540D\u79F0:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0"}]},L.a.createElement(_.a,{bordered:!1,maxLength:60,suffix:"".concat(((ne=He.subject)===null||ne===void 0?void 0:ne.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"})),L.a.createElement(a.a.Item,{name:"task_pass",label:"\u4EFB\u52A1\u8981\u6C42:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:35e3,message:"\u8FC7\u5173\u4EFB\u52A1\u7B80\u4ECB\u6700\u5927\u9650\u523635000\u4E2A\u5B57\u7B26"}]},L.a.createElement(f.a,{key:de.params.challengesId||"3",watch:!0,defaultValue:ze?qe==null?void 0:qe.task_pass:_e.task_pass_default})),L.a.createElement(a.a.Item,{initialValue:1,name:"difficulty",label:"\u96BE\u5EA6\u7CFB\u6570:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6\u7CFB\u6570"}]},L.a.createElement(k.a.Group,{disabled:((ue=pe.detail)===null||ue===void 0?void 0:ue.shixun_status)===2},L.a.createElement(k.a,{value:1},"\u7B80\u5355"),L.a.createElement(k.a,{style:{marginLeft:70},value:2},"\u4E2D\u7B49"),L.a.createElement(k.a,{style:{marginLeft:70},value:3},"\u56F0\u96BE"))),L.a.createElement(a.a.Item,{name:"challenge_tag",label:L.a.createElement("div",null,"\u6280\u80FD\u6807\u7B7E ",L.a.createElement("span",{className:"pl20 font12 c-light-black"},"\u5B66\u5458\u7B54\u9898\u6B63\u786E\u5C06\u83B7\u5F97\u6280\u80FD\uFF0C\u5426\u5219\u4E0D\u80FD\u83B7\u5F97\u6280\u80FD\uFF08\u56DE\u8F66\u6DFB\u52A0\u6807\u7B7E\uFF09")),rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6280\u80FD\u6807\u7B7E"}]},L.a.createElement(z.a,{placeholder:"\u6DFB\u52A0\u6807\u7B7E",style:{width:"260px"},InputRight:L.a.createElement("span",{className:"ml5"},"(\u56DE\u8F66\u6DFB\u52A0\u6807\u7B7E)")})),L.a.createElement(K.a,{className:"customItemSelect"},L.a.createElement(W.a,null,L.a.createElement(a.a.Item,{name:"score",initialValue:100,label:"\u5956\u52B1\u91D1\u5E01:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u5956\u52B1\u7ECF\u9A8C\u503C"}]},L.a.createElement(P.a,{disabled:((Ee=pe.detail)===null||Ee===void 0?void 0:Ee.shixun_status)===2,bordered:!1,style:{width:260}},Ke==null?void 0:Ke.map(function(ct,ft){return L.a.createElement(P.a.Option,{key:ft,value:ct},ct)})))),L.a.createElement(W.a,{flex:1},L.a.createElement("div",{style:{marginTop:88},className:"font12 c-light-black ml10"}," \u5B66\u5458\u6B63\u786E\u7B54\u9898\u65F6\u83B7\u5F97\u91D1\u5E01\uFF0C\u5E76\u4E14\u83B7\u5F97\u7B49\u91CF\u7684\u7ECF\u9A8C\u503C\u3002\u5982\uFF1A+100\u91D1\u5E01\u3001+100\u7ECF\u9A8C\u503C"))))),L.a.createElement(v.a,{key:2,onOk:function(){return Me.submit()},className:"customFixedButton",onCancel:yt}),L.a.createElement(R.a,{loading:Xe}))};je.default=Object(x.a)(function(X){var q=X.shixunsDetail,ne=X.newCourse,ue=X.globalSetting,Ee=X.practiceSetting;return{shixunsDetail:q,newCourse:ne,globalSetting:ue,practiceSetting:Ee}})(F)},M8RZ:function(Je,je,J){"use strict";J.d(je,"a",function(){return O});var Q=J("fWQN"),K=J("mtLc"),A=J("yKVA"),W=J("879j"),M=J("cDcd"),P=J.n(M),I=J("faye"),k=J.n(I),O=function(_){Object(A.a)(p,_);var c=Object(W.a)(p);function p(D){var w;Object(Q.a)(this,p),w=c.call(this,D);var y=window.document;return w.node=y.createElement("div"),y.body.appendChild(w.node),w}return Object(K.a)(p,[{key:"render",value:function(){var w=this.props.children;return Object(I.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(P.a.Component)},OLES:function(Je,je,J){"use strict";var Q=J("U8pU"),K=J("VTBJ"),A=J("Ff2n"),W=J("cDcd"),M=J("uciX"),P=J("7ixt"),I=function(D){var w=D.overlay,y=D.prefixCls,b=D.id,l=D.overlayInnerStyle;return W.createElement("div",{className:"".concat(y,"-inner"),id:b,role:"tooltip",style:l},typeof w=="function"?w():w)},k=I,O=function(D,w){var y=D.overlayClassName,b=D.trigger,l=b===void 0?["hover"]:b,a=D.mouseEnterDelay,s=a===void 0?0:a,u=D.mouseLeaveDelay,C=u===void 0?.1:u,g=D.overlayStyle,m=D.prefixCls,L=m===void 0?"rc-tooltip":m,x=D.children,f=D.onVisibleChange,h=D.afterVisibleChange,d=D.transitionName,o=D.animation,T=D.placement,E=T===void 0?"right":T,v=D.align,R=v===void 0?{}:v,N=D.destroyTooltipOnHide,B=N===void 0?!1:N,z=D.defaultVisible,j=D.getTooltipContainer,F=D.overlayInnerStyle,X=Object(A.a)(D,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),q=Object(W.useRef)(null);Object(W.useImperativeHandle)(w,function(){return q.current});var ne=Object(K.a)({},X);"visible"in D&&(ne.popupVisible=D.visible);var ue=function(){var ce=D.arrowContent,re=ce===void 0?null:ce,se=D.overlay,be=D.id;return[W.createElement("div",{className:"".concat(L,"-arrow"),key:"arrow"},re),W.createElement(k,{key:"content",prefixCls:L,id:be,overlay:se,overlayInnerStyle:F})]},Ee=!1,pe=!1;if(typeof B=="boolean")Ee=B;else if(B&&Object(Q.a)(B)==="object"){var fe=B.keepParent;Ee=fe===!0,pe=fe===!1}return W.createElement(M.a,Object.assign({popupClassName:y,prefixCls:L,popup:ue,action:l,builtinPlacements:P.a,popupPlacement:E,ref:q,popupAlign:R,getPopupContainer:j,onPopupVisibleChange:f,afterPopupVisibleChange:h,popupTransitionName:d,popupAnimation:o,defaultPopupVisible:z,destroyPopupOnHide:Ee,autoDestroy:pe,mouseLeaveDelay:C,popupStyle:g,mouseEnterDelay:s},ne),x)},_=Object(W.forwardRef)(O),c=je.a=_},Ot1p:function(Je,je,J){"use strict";var Q=J("2qtc"),K=J("kLXV"),A=J("rAM+"),W=J("miYZ"),M=J("tsqr"),P=J("9og8"),I=J("tJVT"),k=J("jrin"),O=J("WmNS"),_=J.n(O),c=J("cDcd"),p=J.n(c),D=J("VrN/"),w=J.n(D),y=J("bdgK"),b=J("p77/"),l=J("Bd2K"),a=J("ELLl"),s=J("19Vz"),u=J("lZu9"),C=J("+NIl"),g=J("kSUc"),m=J("9Bee"),L=function(we){var yt=we.value,it=yt===void 0?"":yt,Qe=we.className,xt=we.showTextOnly,ct=we.showLines,ft=we.style,ht=ft===void 0?{}:ft,nt=Object(c.useMemo)(function(){return""},[it]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:nt}}))},x=J("Q9mQ"),f=J("diRs"),h=J("0Owb"),d=J("dejd"),o=J("C+DQ"),T=J("D1Df"),E=J.n(T),v=J("1vsH"),R=J("m3rI"),N=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function B(we){var yt=we.onActionCallback,it=we.title,Qe=we.icon,xt=we.actionName,ct=we.className,ft=ct===void 0?"":ct,ht=we.children;function nt(){yt(xt)}return p.a.createElement("a",{title:it,className:ft,onClick:nt},p.a.createElement("i",{className:"md-iconfont ".concat(Qe)}),ht)}var z=function(we){var yt=we.watch,it=we.showNullButton,Qe=we.onActionCallback,xt=we.fullScreen,ct=we.insertTemp,ft=we.hidetoolBar,ht=we.uuid,nt=we.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(v.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(v.G)("_educoder_session"),"&key=").concat(ht,"&api=").concat(encodeURIComponent(R.a.PROXY_SERVER)));var Ht=[].concat(N,[{title:"".concat(yt?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(yt?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!ft&&Ht.map(function(Ct,Mt){return p.a.createElement("li",{key:Mt},Ct.actionName?p.a.createElement(B,Object(h.a)({},Ct,{onActionCallback:Qe})):p.a.createElement("span",{className:"v-line"}))}),it?p.a.createElement("li",null,p.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Qe},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ct&&p.a.createElement("li",null,p.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ct),onActionCallback:Qe},p.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),p.a.createElement("li",null,p.a.createElement(f.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:p.a.createElement("div",null,p.a.createElement(E.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(v.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(v.G)("_educoder_session"),"&key=").concat(ht,"&api=").concat(encodeURIComponent(R.a.PROXY_SERVER))}))},p.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return nt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),p.a.createElement("li",{className:"btn-full-screen"},p.a.createElement(B,{icon:"".concat(xt?"icon-shrink":"icon-enlarge"),title:xt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Qe})))},j=J("M8RZ"),F=J("+L6B"),X=J("2/Rp"),q=J("y8nQ"),ne=J("Vl3Y"),ue=J("5NDa"),Ee=J("5rEg"),pe={labelCol:{span:4},wrapperCol:{span:20}},fe=function(we){var yt=we.callback,it=we.onCancel;function Qe(xt){yt(xt)}return p.a.createElement(ne.a,Object(h.a)({},pe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Qe}),p.a.createElement(ne.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(Ee.a,null)),p.a.createElement(ne.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(Ee.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(X.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},de=J("7ahc"),ce=J("k1fw"),re=J("HmJG"),se=J("BjJ7"),be=ne.a.useForm,Me={width:280,marginRight:10},Ie={labelCol:{span:5},wrapperCol:{span:19}},Ge=function(we){var yt=we.callback,it=we.onCancel,Qe=be(),xt=Object(I.a)(Qe,1),ct=xt[0],ft=useRef();function ht(Ct){yt(Object(ce.a)(Object(ce.a)({},Ct),{},{name:ft.current}))}function nt(Ct,Mt){if(Ct.status===-1){M.b.error(Ct.message);return}ct.setFieldsValue({src:"/api/attachments/".concat(Ct.id),type:Mt.type})}function Ht(Ct){var Mt=Ct.target.files[0];ft.current=Mt.name,Se(Mt,nt)}return p.a.createElement(ne.a,Object(h.a)({form:ct},Ie,{className:"upload-image-panel",onFinish:ht}),p.a.createElement(ne.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(ne.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},p.a.createElement(Ee.a,{style:Me})),p.a.createElement(He,{onFileChange:Ht}))),p.a.createElement(ne.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(Ee.a,{style:{width:264}})),p.a.createElement(ne.a.Item,{style:{textAlign:"right"}},p.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(X.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))};function He(we){var yt=we.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:yt}))}function Se(we,yt){if(!we)throw new String("\u6CA1\u6709\u6587\u4EF6");var it=new FormData;it.append("editormd-image-file",we),it.append("file_param_name","editormd-image-file"),it.append("byxhr","true");var Qe=new window.XMLHttpRequest;Qe.withCredentials=!0,Qe.addEventListener("load",function(xt){yt(JSON.parse(xt.target.responseText),we)},!1),Qe.addEventListener("error",function(xt){console.error(xt)},!1),Qe.open("POST","".concat(se.a,"/api/attachments.json")),Qe.send(it)}var De=J("giR+"),ke=J("fyUT"),Ke=J("7Kak"),Fe=J("9yH6"),_e=Fe.a.Group,Le={margin:"0 8px"},rt=function(we){var yt=we.callback,it=we.onCancel;function Qe(xt){yt(xt)}return p.a.createElement(ne.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Qe},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:Le},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:Le},"\u884C\u6570"),p.a.createElement(ne.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(ke.a,null)),p.a.createElement("span",{style:Le},"\u5217\u6570"),p.a.createElement(ne.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(ke.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:Le},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(ne.a.Item,{name:"align"},p.a.createElement(_e,null,p.a.createElement(Fe.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(Fe.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(Fe.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(Fe.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(X.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},qe=J("ErOA"),Ye=J("7Cbv"),We="link",et="upload-image",ze="code-block",Ve="add-table",ve="------------",Ze={default:ve,left:":".concat(ve),center:":".concat(ve,":"),right:"".concat(ve,":")},Xe=J("9VGf"),ye,Ae;function le(){}var ae=0,oe=1e4,Y="\u2581",$=`
|
|
**\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 Z(we){return/^\d+$/.test(we)?"".concat(we,"px"):we}var te=navigator.platform.toUpperCase().indexOf("MAC")>=0,ge=te?"Cmd":"Ctrl",xe=["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"],Pe=(ye={},Object(k.a)(ye,ge+"-B","bold"),Object(k.a)(ye,ge+"-I","italic"),ye),st=(Ae={},Object(k.a)(Ae,We,"\u6DFB\u52A0\u94FE\u63A5"),Object(k.a)(Ae,ze,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(k.a)(Ae,et,"\u6DFB\u52A0\u6587\u4EF6"),Object(k.a)(Ae,Ve,"\u6DFB\u52A0\u8868\u683C"),Ae),vt=je.a=function(we){var yt=we.defaultValue,it=yt===void 0?"":yt,Qe=we.onChange,xt=we.width,ct=xt===void 0?"100%":xt,ft=we.height,ht=ft===void 0?400:ft,nt=we.miniToolbar,Ht=nt===void 0?!1:nt,Ct=we.isFocus,Mt=Ct===void 0?!1:Ct,lr=we.watch,gr=we.insertTemp,qt=we.mode,vr=qt===void 0?"markdown":qt,yn=we.id,Zr=yn===void 0?"markdown-editor-id":yn,It=we.showResizeBar,ot=It===void 0?!1:It,wr=we.noStorage,Xn=wr===void 0?!1:wr,hr=we.showNullButton,Lt=hr===void 0?!1:hr,Cr=we.hidetoolBar,qr=Cr===void 0?!1:Cr,bn=we.fullScreen,Oe=bn===void 0?!1:bn,mt=we.onBlur,en=we.onCMBeforeChange,tn=we.onFullScreen,rn=we.className,En=rn===void 0?"":rn,Yn=we.disablePaste,gt=Yn===void 0?!1:Yn,Ci=we.placeholder,Li=Ci===void 0?"":Ci,nn=we.values,ur=nn===void 0?"":nn,Ai=Object(c.useState)(null),$n=Object(I.a)(Ai,2),Re=$n[0],Qn=$n[1],Di=Object(c.useState)(it),xn=Object(I.a)(Di,2),an=xn[0],Fr=xn[1],_i=Object(c.useState)(lr),Jn=Object(I.a)(_i,2),Or=Jn[0],Oi=Jn[1],Ri=Object(c.useState)(Oe),yr=Object(I.a)(Ri,2),Lr=yr[0],Pi=yr[1],Tn=Object(c.useState)(""),Nr=Object(I.a)(Tn,2),Br=Nr[0],jr=Nr[1],aa=Object(c.useState)(0),Mi=Object(I.a)(aa,2),Rr=Mi[0],Sn=Mi[1],oa=Object(c.useState)(ht),Zn=Object(I.a)(oa,2),qn=Zn[0],on=Zn[1],wn=Object(c.useState)(!1),Cn=Object(I.a)(wn,2),sa=Cn[0],Ln=Cn[1],sn=Object(c.useRef)(Object(Ye.a)()),ki=Object(c.useRef)(!1),ei=Object(c.useRef)(),Qt=Object(c.useRef)(),Wr=Object(c.useRef)(),An=Object(c.useRef)(),Hr=Object(c.useRef)(),Ii=function(){var at=Object(P.a)(_.a.mark(function pt(){var ut,Et;return _.a.wrap(function(Rt){for(;;)switch(Rt.prev=Rt.next){case 0:return Rt.next=2,Object(qe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:sn.current}});case 2:Et=Rt.sent,Et!=null&&(ut=Et.attachments)!==null&&ut!==void 0&&ut.length&&(console.log("cm:",Re,Qt),Et.attachments.map(function(Tt){Tt.content_type.indexOf("image")>-1?Re.replaceSelection(".concat(Tt.content_type,")")):Tt.content_type.indexOf("video")>-1?Re.replaceSelection('<video width="100%" controls src="'.concat(R.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Tt.content_type.indexOf("pdf")>-1?Re.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Tt.id,"?type=").concat(Tt.content_type,'&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):Re.replaceSelection("[".concat(Tt.name,"](").concat(R.a.API_SERVER,"/api/attachments/").concat(Tt.id,"?type=").concat(Tt.content_type,")"))}));case 4:case"end":return Rt.stop()}},pt)}));return function(){return at.apply(this,arguments)}}();Object(c.useEffect)(function(){Fr(ur),Re==null||Re.setValue(ur)},[ur]),Object(c.useEffect)(function(){tn==null||tn(Lr)},[Lr]),Object(c.useEffect)(function(){if(Qt.current){var at=w.a.fromTextArea(Qt.current,{mode:vr,lineNumbers:!Ht,lineWrapping:!0,value:it,autoCloseTags:!0,autoCloseBrackets:!0});Mt&&at.focus();function pt(ut,Et){if(gt){Et.preventDefault();return}var wt=Et.clipboardData;if(wt){var Rt=wt.types.toString(),Tt=wt.items;if(Rt==="Files"||wt.types.indexOf("Files")>-1){if(Et.preventDefault(),vr=="stex")return;try{var Ft,Kt=Tt[1];((Ft=Tt[0])===null||Ft===void 0?void 0:Ft.kind)==="file"&&(Kt=Tt[0]);var St=Kt.getAsFile(),Mr=St.name.split(".").pop();Se(St,function(Dt){if(Dt.id){var er,Ot,br;(St==null||((er=St.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?at.replaceSelection(".concat(Dt.content_type,")")):(St==null||((Ot=St.type)===null||Ot===void 0)?void 0:Ot.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Dt.id,'"></video>')):(St==null||((br=St.type)===null||br===void 0)?void 0:br.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(St.type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):xe.includes(Mr)?at.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Dt.id,'?type=office&disposition=inline" target="_blank">').concat(St.name,"</a>")):at.replaceSelection("[".concat(St.name,"](").concat(R.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(Dt.content_type,")"))}else(Dt==null?void 0:Dt.status)===401&&(document.location.href="/user/login")})}catch(Dt){M.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return at.on("paste",pt),at.on("dragleave",function(ut,Et){Wr.current.classList.remove("mouse-hover-md")}),at.on("dragover",function(ut,Et){Wr.current.classList.add("mouse-hover-md")}),at.on("drop",function(ut,Et){Wr.current.classList.add("mouse-hover-md");var wt;if(wt=Et.dataTransfer.files,wt.length>0){Et.preventDefault(),Et.stopPropagation();for(var Rt=function(Kt){var St=wt[Kt],Mr=St.name.split(".").pop();Se(St,function(Dt){if(Dt.id){var er,Ot,br;(St==null||((er=St.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?at.replaceSelection(".concat(Dt.content_type,")")):(St==null||((Ot=St.type)===null||Ot===void 0)?void 0:Ot.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Dt.id,'"></video>')):(St==null||((br=St.type)===null||br===void 0)?void 0:br.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(St.type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):xe.includes(Mr)?at.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Dt.id,'?type=office&disposition=inline" target="_blank">').concat(St.name,"</a>")):at.replaceSelection("[".concat(St.name,"](").concat(R.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(Dt.content_type,")"))}else(Dt==null?void 0:Dt.status)===401&&(document.location.href="/user/login")})},Tt=0;Tt<wt.length;Tt++)Rt(Tt)}}),Qn(at),function(){at.off("paste",pt)}}},[]);var Er=Object(c.useCallback)(function(){if(Wr.current)try{}catch(at){console.log(at,"---- to set md editor body height")}},[qn,Wr,Lr]);Object(c.useEffect)(function(){function at(){var ut=new y.default(function(Et){var wt=Object(A.a)(Et),Rt;try{for(wt.s();!(Rt=wt.n()).done;){var Tt=Rt.value;(Tt.target.offsetHeight>0||Tt.target.offsetWidth>0)&&(Er(),Re.setSize("100%","100%"),Re.refresh())}}catch(Ft){wt.e(Ft)}finally{wt.f()}});return ut.observe(Qt.current.parentElement),ut}if(Re){var pt=at();return function(){pt.unobserve(Qt.current.parentElement)}}},[Re,Er]),Object(c.useEffect)(function(){if(Re){for(var at=[],pt=function(){var Tt=Et[ut];wt=Object(I.a)(Tt,2);var Ft=wt[0],Kt=wt[1],St=Object(k.a)({},Ft,function(){Dn(Kt)});at.push(St),Re.addKeyMap(St)},ut=0,Et=Object.entries(Pe);ut<Et.length;ut++){var wt;pt()}return ei.current=setInterval(function(){ki.current&&Ii()},4e3),function(){clearInterval(ei.current);var Rt=Object(A.a)(at),Tt;try{for(Rt.s();!(Tt=Rt.n()).done;){var Ft=Tt.value;Re.removeKeyMap(Ft)}}catch(Kt){Rt.e(Kt)}finally{Rt.f()}}}},[Re]),Object(c.useEffect)(function(){Oe!==Lr&&Pi(Oe)},[Oe]),Object(Xe.a)(function(){if(!Xn&&Rr>0){var at=new Date().getTime(),pt=window.sessionStorage.getItem(Zr);at>=Rr+oe&&(!pt||pt!==an)&&(window.sessionStorage.setItem(Zr,an),Ln(!0))}},oe),Object(c.useEffect)(function(){Oi(lr)},[Re,lr]),Object(c.useEffect)(function(){Re&&(Mt&&Re.focus())},[Re,Mt]),Object(c.useEffect)(function(){if(Or&&Re){var at=Re.getScrollerElement();function pt(ut){var Et=ut.target;if(Hr.current){var wt=Et.scrollTop/Et.scrollHeight;Hr.current.scrollTop=Hr.current.scrollHeight*wt}}return at.addEventListener("scroll",pt),function(){at.removeEventListener("scroll",pt)}}},[Re,Or]),Object(c.useEffect)(function(){if(Re&&en){function at(pt,ut){en(pt,ut)}return Re.on("beforeChange",at),function(){Re.off("beforeChange",at)}}},[Re,en]),Object(c.useEffect)(function(){if(Re&&mt){function at(){mt(Re.getValue())}return Re.on("blur",at),function(){Re.off("blur",at)}}},[Re,mt]),Object(c.useEffect)(function(){if(Re){function at(pt){var ut=pt.getValue();Fr(ut),Sn(new Date().getTime()),pt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Qe&&Qe(ut)}return Re.on("change",at),function(){Re.off("change",at)}}},[Re,Qe]),Object(c.useEffect)(function(){Re&&(it==null?(Re.setValue(""),Fr("")):it!==Re.getValue()&&(Re.setValue(it),Fr(it),Re.setCursor(Re.lineCount(),0)))},[Re,it]);var Dn=Object(c.useCallback)(function(at){var pt=Re.getCursor(),ut=Re.getSelection(),Et=ut.split(`
|
|
`);switch(at){case"bold":return Re.replaceSelection("**"+ut+"**"),ut===""&&Re.setCursor(pt.line,pt.ch+2),Re.focus();case"italic":return Re.replaceSelection("*"+ut+"*"),ut===""&&Re.setCursor(pt.line,pt.ch+1),Re.focus();case"code":return Re.replaceSelection("`"+ut+"`"),ut===""&&Re.setCursor(pt.line,pt.ch+1),Re.focus();case"inline-latex":return Re.replaceSelection("`$$"+ut+"$$`"),ut===""&&Re.setCursor(pt.line,pt.ch+3),Re.focus();case"latex":return Re.replaceSelection("```latex\n"+ut+"\n```"),Re.setCursor(pt.line+1,ut.length+1),Re.focus();case"line-break":return Re.replaceSelection(`<br/>
|
|
`),Re.focus();case"list-ul":return ut===""?Re.replaceSelection("- "+ut):Re.replaceSelection(Et.map(function(wt){return wt===""?"":"- ".concat(wt)}).join(`
|
|
`)),Re.focus();case"list-ol":return ut===""?Re.replaceSelection("1. "+ut):Re.replaceSelection(Et.map(function(wt,Rt){return wt===""?"":"".concat(Rt+1,". ").concat(wt)}).join(`
|
|
`)),Re.focus();case"add-null-ch":return ut===""&&Re.setCursor(pt.line,pt.ch+1),Re.replaceSelection(Y),Re.focus();case"inster-template-1":return ut===""&&Re.setCursor(pt.line,pt.ch),Re.replaceSelection($),Re.focus();case"eraser":return Re.setValue(""),Re.focus();case"trigger-watch":return Oi(!Or),Re.focus();case"trigger-full-screen":return Pi(!Lr),Re.focus();case We:jr(We);return;case ze:jr(ze);return;case et:jr(et);return;case Ve:jr(Ve);return;default:throw new Error}},[Re,Or,Lr]),dr=Object(c.useCallback)(function(at){jr("");switch(Br){case We:var pt=at.title,ut=at.link;return Re.replaceSelection("[".concat(pt,"](").concat(ut,")")),Re.focus();case ze:var Et=at.language,wt=at.content;return Re.replaceSelection(["```"+Et,wt,"```"].join(`
|
|
`)),Re.focus();case et:var Rt=at.src,Tt=at.alt;return Tt?Re.replaceSelection(".concat(Rt,' "').concat(Tt,'" )')):Re.replaceSelection("")),Re.focus();case Ve:for(var Ft=at.row,Kt=at.col,St=at.align,Mr=`
|
|
`,Dt=0;Dt<Ft;Dt++){for(var er=[],Ot=[],br=0;br<Kt;br++)Dt===1&&Ot.push(Ze[St]),er.push(" ");Dt===1&&(Mr+="| ".concat(Ot.join(" | "),` |
|
|
`)),Mr+="| ".concat(er.join(Kt===1?"":" | "),` |
|
|
`)}return Re.replaceSelection(Mr+`
|
|
`),Re.focus();default:throw new Error}},[Re,Br]),_n=Object(c.useMemo)(function(){switch(Br){case We:return p.a.createElement(fe,{callback:dr,onCancel:Pr});case ze:return p.a.createElement(de.b,{callback:dr,onCancel:Pr});case et:return p.a.createElement(Ge,{callback:dr,onCancel:Pr});case Ve:return p.a.createElement(rt,{callback:dr,onCancel:Pr});default:return null}},[Br]);function Pr(){jr("")}Object(c.useEffect)(function(){if(An.current){var at=An.current,pt=!1,ut=0;function Et(Tt){pt=!0,ut=Tt.pageY}function wt(){pt=!1}function Rt(Tt){if(pt){var Ft=Tt.pageY-ut;Ft<0&&(Ft=0),Ft>300&&(Ft=300);var Kt=ht+Ft+"px";on(Kt)}}return at.addEventListener("mousedown",Et),document.addEventListener("mousemove",Rt),document.addEventListener("mouseup",wt),function(){at.removeEventListener("mousedown",Et),document.removeEventListener("mousemove",Rt),document.removeEventListener("mouseup",wt)}}},[Re,An]),Object(c.useEffect)(function(){on(ht)},[ht]);var Kr=Z(ct),la=Z(qn),ua={width:Kr,height:la},$a=Object(c.useMemo)(function(){if(Rr){var at=new Date(Rr),pt=at.getHours(),ut=at.getMinutes(),Et=at.getSeconds();return pt=pt<10?"0"+pt:pt,ut=ut<10?"0"+ut:ut,Et=Et<10?"0"+Et:Et,"".concat(pt,":").concat(ut,":").concat(Et)}return 0},[Rr]);function Qa(){window.sessionStorage.removeItem(Zr),Ln(!1),Sn(0)}function da(){Ln(!1),Sn(0),Re.setValue(window.sessionStorage.getItem(Zr))}function Ui(at,pt){var ut=Re.getValue();ut=ut.replace(at,pt),Fr(ut),Re==null||Re.setValue(ut)}return p.a.createElement(c.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:Wr},p.a.createElement("div",{className:"markdown-editor-container ".concat(En," ").concat(Or?"on-preview":""," ").concat(Ht?"mini":""," ").concat(Lr?"full-screen":""),style:ua},p.a.createElement(z,{insertTemp:gr,watch:Or,fullScreen:Lr,showNullButton:Lt,onActionCallback:Dn,hidetoolBar:qr,uuid:sn.current,setOpenPhones:function(){ki.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Qt,placeholder:Li})),Or?p.a.createElement("div",{ref:Hr,className:"preview-container"},vr==="stex"&&p.a.createElement(L,{value:an}),vr!=="stex"&&p.a.createElement(m.a,{edit:!0,value:an,replaces:Ui})):null))),ot?p.a.createElement("a",{ref:An,className:"editor-resize"}):null,p.a.createElement(j.a,null,st[Br]?p.a.createElement(K.a,{centered:!0,title:st[Br],visible:!0,onCancel:Pr,footer:null,className:"markdown-popup-form"},_n):null))}},SJMd:function(Je,je){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var J,Q,K,A=!1,W,M;window.PR_SHOULD_USE_CONTINUATION=!0;var P,I;(function(){var k=window,O=["break,continue,do,else,for,if,return,while"],_=[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"],c=[_,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[c,"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"],D=[c,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[c,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],y="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",b=[c,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[O,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],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"],u=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[p,w,D,b,l,a,s,u],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",L="kwd",x="com",f="typ",h="lit",d="pun",o="pln",T="tag",E="dec",v="src",R="atn",N="atv",B="nocode",z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function j(Se){for(var De=0,ke=!1,Ke=!1,Fe=0,_e=Se.length;Fe<_e;++Fe){var Le=Se[Fe];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,""))){ke=!0,Ke=!1;break}}var rt={b:8,t:9,n:10,v:11,f:12,r:13};function qe(Ve){var ve=Ve.charCodeAt(0);if(ve!==92)return ve;var Ze=Ve.charAt(1);return ve=rt[Ze],ve||("0"<=Ze&&Ze<="7"?parseInt(Ve.substring(1),8):Ze==="u"||Ze==="x"?parseInt(Ve.substring(2),16):Ve.charCodeAt(1))}function Ye(Ve){if(Ve<32)return(Ve<16?"\\x0":"\\x")+Ve.toString(16);var ve=String.fromCharCode(Ve);return ve==="\\"||ve==="-"||ve==="]"||ve==="^"?"\\"+ve:ve}function We(Ve){var ve=Ve.substring(1,Ve.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Ze=[],Xe=ve[0]==="^",ye=["["];Xe&&ye.push("^");for(var Ae=Xe?1:0,le=ve.length;Ae<le;++Ae){var ae=ve[Ae];if(/\\[bdsw]/i.test(ae))ye.push(ae);else{var oe=qe(ae),Y;Ae+2<le&&ve[Ae+1]==="-"?(Y=qe(ve[Ae+2]),Ae+=2):Y=oe,Ze.push([oe,Y]),Y<65||oe>122||(Y<65||oe>90||Ze.push([Math.max(65,oe)|32,Math.min(Y,90)|32]),Y<97||oe>122||Ze.push([Math.max(97,oe)&~32,Math.min(Y,122)&~32]))}}Ze.sort(function(ge,xe){return ge[0]-xe[0]||xe[1]-ge[1]});for(var $=[],Z=[],Ae=0;Ae<Ze.length;++Ae){var te=Ze[Ae];te[0]<=Z[1]+1?Z[1]=Math.max(Z[1],te[1]):$.push(Z=te)}for(var Ae=0;Ae<$.length;++Ae){var te=$[Ae];ye.push(Ye(te[0])),te[1]>te[0]&&(te[1]+1>te[0]&&ye.push("-"),ye.push(Ye(te[1])))}return ye.push("]"),ye.join("")}function et(Ve){for(var ve=Ve.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Ze=ve.length,Xe=[],ye=0,Ae=0;ye<Ze;++ye){var le=ve[ye];if(le==="(")++Ae;else if(le.charAt(0)==="\\"){var ae=+le.substring(1);ae&&(ae<=Ae?Xe[ae]=-1:ve[ye]=Ye(ae))}}for(var ye=1;ye<Xe.length;++ye)Xe[ye]===-1&&(Xe[ye]=++De);for(var ye=0,Ae=0;ye<Ze;++ye){var le=ve[ye];if(le==="(")++Ae,Xe[Ae]||(ve[ye]="(?:");else if(le.charAt(0)==="\\"){var ae=+le.substring(1);ae&&ae<=Ae&&(ve[ye]="\\"+Xe[ae])}}for(var ye=0;ye<Ze;++ye)ve[ye]==="^"&&ve[ye+1]!=="^"&&(ve[ye]="");if(Ve.ignoreCase&&ke)for(var ye=0;ye<Ze;++ye){var le=ve[ye],oe=le.charAt(0);le.length>=2&&oe==="["?ve[ye]=We(le):oe!=="\\"&&(ve[ye]=le.replace(/[a-zA-Z]/g,function(Z){var te=Z.charCodeAt(0);return"["+String.fromCharCode(te&~32,te|32)+"]"}))}return ve.join("")}for(var ze=[],Fe=0,_e=Se.length;Fe<_e;++Fe){var Le=Se[Fe];if(Le.global||Le.multiline)throw new Error(""+Le);ze.push("(?:"+et(Le)+")")}return new RegExp(ze.join("|"),Ke?"gi":"g")}function F(Se,De){var ke=/(?:^|\s)nocode(?:\s|$)/,Ke=[],Fe=0,_e=[],Le=0;function rt(qe){var Ye=qe.nodeType;if(Ye==1){if(ke.test(qe.className))return;for(var We=qe.firstChild;We;We=We.nextSibling)rt(We);var et=qe.nodeName.toLowerCase();(et==="br"||et==="li")&&(Ke[Le]=`
|
|
`,_e[Le<<1]=Fe++,_e[Le++<<1|1]=qe)}else if(Ye==3||Ye==4){var ze=qe.nodeValue;ze.length&&(De?ze=ze.replace(/\r\n?/g,`
|
|
`):ze=ze.replace(/[ \t\r\n]+/g," "),Ke[Le]=ze,_e[Le<<1]=Fe,Fe+=ze.length,_e[Le++<<1|1]=qe)}}return rt(Se),{sourceCode:Ke.join("").replace(/\n$/,""),spans:_e}}function X(Se,De,ke,Ke,Fe){if(!ke)return;var _e={sourceNode:Se,pre:1,langExtension:null,numberLines:null,sourceCode:ke,spans:null,basePos:De,decorations:null};Ke(_e),Fe.push.apply(Fe,_e.decorations)}var q=/\S/;function ne(Se){for(var De=void 0,ke=Se.firstChild;ke;ke=ke.nextSibling){var Ke=ke.nodeType;De=Ke===1?De?Se:ke:Ke===3&&q.test(ke.nodeValue)?Se:De}return De===Se?void 0:De}function ue(Se,De){var ke={},Ke;(function(){for(var Le=Se.concat(De),rt=[],qe={},Ye=0,We=Le.length;Ye<We;++Ye){var et=Le[Ye],ze=et[3];if(ze)for(var Ve=ze.length;--Ve>=0;)ke[ze.charAt(Ve)]=et;var ve=et[1],Ze=""+ve;qe.hasOwnProperty(Ze)||(rt.push(ve),qe[Ze]=null)}rt.push(/[\0-\uffff]/),Ke=j(rt)})();var Fe=De.length,_e=function(Le){for(var rt=Le.sourceCode,qe=Le.basePos,Ye=Le.sourceNode,We=[qe,o],et=0,ze=rt.match(Ke)||[],Ve={},ve=0,Ze=ze.length;ve<Ze;++ve){var Xe=ze[ve],ye=Ve[Xe],Ae=void 0,le;if(typeof ye=="string")le=!1;else{var ae=ke[Xe.charAt(0)];if(ae)Ae=Xe.match(ae[1]),ye=ae[0];else{for(var oe=0;oe<Fe;++oe)if(ae=De[oe],Ae=Xe.match(ae[1]),Ae){ye=ae[0];break}Ae||(ye=o)}le=ye.length>=5&&ye.substring(0,5)==="lang-",le&&!(Ae&&typeof Ae[1]=="string")&&(le=!1,ye=v),le||(Ve[Xe]=ye)}var Y=et;if(et+=Xe.length,!le)We.push(qe+Y,ye);else{var $=Ae[1],Z=Xe.indexOf($),te=Z+$.length;Ae[2]&&(te=Xe.length-Ae[2].length,Z=te-$.length);var ge=ye.substring(5);X(Ye,qe+Y,Xe.substring(0,Z),_e,We),X(Ye,qe+Y+Z,$,se(ge,$),We),X(Ye,qe+Y+te,Xe.substring(te),_e,We)}}Le.decorations=We};return _e}function Ee(Se){var De=[],ke=[];Se.tripleQuotedStrings?De.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Se.multiLineStrings?De.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):De.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Se.verbatimStrings&&ke.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ke=Se.hashComments;Ke&&(Se.cStyleComments?(Ke>1?De.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):De.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),ke.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):De.push([x,/^#[^\r\n]*/,null,"#"])),Se.cStyleComments&&(ke.push([x,/^\/\/[^\r\n]*/,null]),ke.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=Se.regexLiterals;if(Fe){var _e=Fe>1?"":`
|
|
\r`,Le=_e?".":"[\\S\\s]",rt="/(?=[^/*"+_e+"])(?:[^/\\x5B\\x5C"+_e+"]|\\x5C"+Le+"|\\x5B(?:[^\\x5C\\x5D"+_e+"]|\\x5C"+Le+")*(?:\\x5D|$))+/";ke.push(["lang-regex",RegExp("^"+z+"("+rt+")")])}var qe=Se.types;qe&&ke.push([f,qe]);var Ye=(""+Se.keywords).replace(/^ | $/g,"");Ye.length&&ke.push([L,new RegExp("^(?:"+Ye.replace(/[\s,]+/g,"|")+")\\b"),null]),De.push([o,/^\s+/,null,` \r
|
|
\xA0`]);var We="^.[^\\s\\w.$@'\"`/\\\\]*";return Se.regexLiterals&&(We+="(?!s*/)"),ke.push([h,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[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"],[o,/^\\[\s\S]?/,null],[d,new RegExp(We),null]),ue(De,ke)}var pe=Ee({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function fe(Se,De,ke){for(var Ke=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,_e=Se.ownerDocument,Le=_e.createElement("li");Se.firstChild;)Le.appendChild(Se.firstChild);var rt=[Le];function qe(ve){var Ze=ve.nodeType;if(Ze==1&&!Ke.test(ve.className))if(ve.nodeName==="br")Ye(ve),ve.parentNode&&ve.parentNode.removeChild(ve);else for(var Xe=ve.firstChild;Xe;Xe=Xe.nextSibling)qe(Xe);else if((Ze==3||Ze==4)&&ke){var ye=ve.nodeValue,Ae=ye.match(Fe);if(Ae){var le=ye.substring(0,Ae.index);ve.nodeValue=le;var ae=ye.substring(Ae.index+Ae[0].length);if(ae){var oe=ve.parentNode;oe.insertBefore(_e.createTextNode(ae),ve.nextSibling)}Ye(ve),le||ve.parentNode.removeChild(ve)}}}function Ye(ve){for(;!ve.nextSibling;)if(ve=ve.parentNode,!ve)return;function Ze(Ae,le){var ae=le?Ae.cloneNode(!1):Ae,oe=Ae.parentNode;if(oe){var Y=Ze(oe,1),$=Ae.nextSibling;Y.appendChild(ae);for(var Z=$;Z;Z=$)$=Z.nextSibling,Y.appendChild(Z)}return ae}for(var Xe=Ze(ve.nextSibling,0),ye;(ye=Xe.parentNode)&&ye.nodeType===1;)Xe=ye;rt.push(Xe)}for(var We=0;We<rt.length;++We)qe(rt[We]);De===(De|0)&&rt[0].setAttribute("value",De);var et=_e.createElement("ol");et.className="linenums";for(var ze=Math.max(0,De-1|0)||0,We=0,Ve=rt.length;We<Ve;++We)Le=rt[We],Le.className="L"+(We+ze)%10,Le.firstChild||Le.appendChild(_e.createTextNode("\xA0")),et.appendChild(Le);Se.appendChild(et)}function de(Se){var De=/\bMSIE\s(\d+)/.exec(navigator.userAgent);De=De&&+De[1]<=8;var ke=/\n/g,Ke=Se.sourceCode,Fe=Ke.length,_e=0,Le=Se.spans,rt=Le.length,qe=0,Ye=Se.decorations,We=Ye.length,et=0;Ye[We]=Fe;var ze,Ve;for(Ve=ze=0;Ve<We;)Ye[Ve]!==Ye[Ve+2]?(Ye[ze++]=Ye[Ve++],Ye[ze++]=Ye[Ve++]):Ve+=2;for(We=ze,Ve=ze=0;Ve<We;){for(var ve=Ye[Ve],Ze=Ye[Ve+1],Xe=Ve+2;Xe+2<=We&&Ye[Xe+1]===Ze;)Xe+=2;Ye[ze++]=ve,Ye[ze++]=Ze,Ve=Xe}We=Ye.length=ze;var ye=Se.sourceNode,Ae="";ye&&(Ae=ye.style.display,ye.style.display="none");try{for(var le=null;qe<rt;){var ae=Le[qe],oe=Le[qe+2]||Fe,Y=Ye[et+2]||Fe,Xe=Math.min(oe,Y),$=Le[qe+1],Z;if($.nodeType!==1&&(Z=Ke.substring(_e,Xe))){De&&(Z=Z.replace(ke,"\r")),$.nodeValue=Z;var te=$.ownerDocument,ge=te.createElement("span");ge.className=Ye[et+1];var xe=$.parentNode;xe.replaceChild(ge,$),ge.appendChild($),_e<oe&&(Le[qe+1]=$=te.createTextNode(Ke.substring(Xe,oe)),xe.insertBefore($,ge.nextSibling))}_e=Xe,_e>=oe&&(qe+=2),_e>=Y&&(et+=2)}}finally{ye&&(ye.style.display=Ae)}}var ce={};function re(Se,De){for(var ke=De.length;--ke>=0;){var Ke=De[ke];ce.hasOwnProperty(Ke)?k.console&&console.warn("cannot override language handler %s",Ke):ce[Ke]=Se}}function se(Se,De){return Se&&ce.hasOwnProperty(Se)||(Se=/^\s*</.test(De)?"default-markup":"default-code"),ce[Se]}re(pe,["default-code"]),re(ue([],[[o,/^[^<?]+/],[E,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\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"]),re(ue([[o,/^[\s]+/,null,` \r
|
|
`],[N,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[T,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!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"]),re(ue([],[[N,/^[\s\S]+/]]),["uq.val"]),re(Ee({keywords:p,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),re(Ee({keywords:"null,true,false"}),["json"]),re(Ee({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),re(Ee({keywords:D,cStyleComments:!0}),["java"]),re(Ee({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),re(Ee({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),re(Ee({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),re(Ee({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),re(Ee({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),re(Ee({keywords:y,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),re(ue([],[[m,/^[\s\S]+/]]),["regex"]);function be(Se){var De=Se.langExtension;try{var ke=F(Se.sourceNode,Se.pre),Ke=ke.sourceCode;Se.sourceCode=Ke,Se.spans=ke.spans,Se.basePos=0,se(De,Ke)(Se),de(Se)}catch(Fe){k.console&&console.log(Fe&&Fe.stack||Fe)}}function Me(Se,De,ke){var Ke=ke||!1,Fe=De||null,_e=document.createElement("div");_e.innerHTML="<pre>"+Se+"</pre>",_e=_e.firstChild,Ke&&fe(_e,Ke,!0);var Le={langExtension:Fe,numberLines:Ke,sourceNode:_e,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return be(Le),_e.innerHTML}function Ie(Se,De){var ke=De||document.body,Ke=ke.ownerDocument||document;function Fe(ae){return ke.getElementsByTagName(ae)}for(var _e=[Fe("pre"),Fe("code"),Fe("xmp")],Le=[],rt=0;rt<_e.length;++rt)for(var qe=0,Ye=_e[rt].length;qe<Ye;++qe)Le.push(_e[rt][qe]);_e=null;var We=Date;We.now||(We={now:function(){return+new Date}});var et=0,ze=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ve=/\bprettyprint\b/,ve=/\bprettyprinted\b/,Ze=/pre|xmp/i,Xe=/^code$/i,ye=/^(?:pre|code|xmp)$/i,Ae={};function le(){for(var ae=k.PR_SHOULD_USE_CONTINUATION?We.now()+250:Infinity;et<Le.length&&We.now()<ae;et++){for(var oe=Le[et],Y=Ae,$=oe;$=$.previousSibling;){var Z=$.nodeType,te=(Z===7||Z===8)&&$.nodeValue;if(te?!/^\??prettify\b/.test(te):Z!==3||/\S/.test($.nodeValue))break;if(te){Y={},te.replace(/\b(\w+)=([\w:.%+-]+)/g,function(ht,nt,Ht){Y[nt]=Ht});break}}var ge=oe.className;if((Y!==Ae||Ve.test(ge))&&!ve.test(ge)){for(var xe=!1,Pe=oe.parentNode;Pe;Pe=Pe.parentNode){var st=Pe.tagName;if(ye.test(st)&&Pe.className&&Ve.test(Pe.className)){xe=!0;break}}if(!xe){oe.className+=" prettyprinted";var vt=Y.lang;if(!vt){vt=ge.match(ze);var we;!vt&&(we=ne(oe))&&Xe.test(we.tagName)&&(vt=we.className.match(ze)),vt&&(vt=vt[1])}var yt;if(Ze.test(oe.tagName))yt=1;else{var it=oe.currentStyle,Qe=Ke.defaultView,xt=it?it.whiteSpace:Qe&&Qe.getComputedStyle?Qe.getComputedStyle(oe,null).getPropertyValue("white-space"):0;yt=xt&&xt.substring(0,3)==="pre"}var ct=Y.linenums;(ct=ct==="true"||+ct)||(ct=ge.match(/\blinenums\b(?::(\d+))?/),ct=ct?ct[1]&&ct[1].length?+ct[1]:!0:!1),ct&&fe(oe,ct,yt);var ft={langExtension:vt,sourceNode:oe,numberLines:ct,pre:yt,sourceCode:null,basePos:null,spans:null,decorations:null};be(ft)}}}et<Le.length?k.setTimeout(le,250):typeof Se=="function"&&Se()}le()}var Ge=k.PR={createSimpleLexer:ue,registerLangHandler:re,sourceDecorator:Ee,PR_ATTRIB_NAME:R,PR_ATTRIB_VALUE:N,PR_COMMENT:x,PR_DECLARATION:E,PR_KEYWORD:L,PR_LITERAL:h,PR_NOCODE:B,PR_PLAIN:o,PR_PUNCTUATION:d,PR_SOURCE:v,PR_STRING:m,PR_TAG:T,PR_TYPE:f,prettyPrintOne:A?k.prettyPrintOne=Me:P=Me,prettyPrint:I=A?k.prettyPrint=Ie:I=Ie},He=k.define;typeof He=="function"&&He.amd&&He("google-code-prettify",[],function(){return Ge})})()},UUDw:function(Je,je,J){Je.exports={buttonFixed:"buttonFixed___2zLVJ",button:"button___-JgFH",buttonWrap:"buttonWrap___aZhhk"}},UqFu:function(Je,je,J){"use strict";J.d(je,"a",function(){return Q});var Q=function(A){var W=document.createElement("textarea");return W.value=A,W.value}},"VrN/":function(Je,je,J){(function(Q,K){Je.exports=K()})(this,function(){"use strict";var Q=navigator.userAgent,K=navigator.platform,A=/gecko\/\d/i.test(Q),W=/MSIE \d/.test(Q),M=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Q),P=/Edge\/(\d+)/.exec(Q),I=W||M||P,k=I&&(W?document.documentMode||6:+(P||M)[1]),O=!P&&/WebKit\//.test(Q),_=O&&/Qt\/\d+\.\d+/.test(Q),c=!P&&/Chrome\//.test(Q),p=/Opera\//.test(Q),D=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Q),y=/PhantomJS/.test(Q),b=!P&&/AppleWebKit/.test(Q)&&/Mobile\/\w+/.test(Q),l=/Android/.test(Q),a=b||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Q),s=b||/Mac/.test(K),u=/\bCrOS\b/.test(Q),C=/win/i.test(K),g=p&&Q.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(p=!1,O=!0);var m=s&&(_||p&&(g==null||g<12.11)),L=A||I&&k>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var n=e.className,r=x(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function 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 o(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var S=0;S<t.length;++S)i.appendChild(t[S]);return i}function T(e,t,n,r){var i=o(e,t,n,r);return i.setAttribute("role","presentation"),i}var E;document.createRange?E=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:E=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function v(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function R(){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 N(e,t){var n=e.className;x(t).test(n)||(e.className+=(n?" ":"")+t)}function B(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!x(n[r]).test(t)&&(t+=" "+n[r]);return t}var z=function(e){e.select()};b?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:I&&(z=function(e){try{e.select()}catch(t){}});function j(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function X(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var S=r||0,U=i||0;;){var H=e.indexOf(" ",S);if(H<0||H>=t)return U+(t-S);U+=H-S,U+=n-U%n,S=H+1}}var q=function(){this.id=null,this.f=null,this.time=0,this.handler=j(this.onTimeout,this)};q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},q.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function ne(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ue=50,Ee={toString:function(){return"CodeMirror.Pass"}},pe={scroll:!1},fe={origin:"*mouse"},de={origin:"+move"};function ce(e,t,n){for(var r=0,i=0;;){var S=e.indexOf(" ",r);S==-1&&(S=e.length);var U=S-r;if(S==e.length||i+U>=t)return r+Math.min(U,t-i);if(i+=S-r,i+=n-i%n,r=S+1,i>=t)return r}}var re=[""];function se(e){for(;re.length<=e;)re.push(be(re)+" ");return re[e]}function be(e){return e[e.length-1]}function Me(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Ie(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 He(e,t){var n;return Object.create?n=Object.create(e):(Ge.prototype=e,n=new Ge),t&&F(t,n),n}var Se=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function De(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Se.test(e))}function ke(e,t){return t?t.source.indexOf("\\w")>-1&&De(e)?!0:t.test(e):De(e)}function Ke(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\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 _e(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Le(e,t,n){for(;(n<0?t>0:t<e.length)&&_e(e.charAt(t));)t+=n;return t}function rt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,S=r<0?Math.ceil(i):Math.floor(i);if(S==t)return e(S)?t:n;e(S)?n=S:t=S+r}}function qe(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,S=0;S<e.length;++S){var U=e[S];(U.from<n&&U.to>t||t==n&&U.to==t)&&(r(Math.max(U.from,t),Math.min(U.to,n),U.level==1?"rtl":"ltr",S),i=!0)}i||r(t,n,"ltr")}var Ye=null;function We(e,t,n){var r;Ye=null;for(var i=0;i<e.length;++i){var S=e[i];if(S.from<t&&S.to>t)return i;S.to==t&&(S.from!=S.to&&n=="before"?r=i:Ye=i),S.from==t&&(S.from!=S.to&&n!="before"?r=i:Ye=i)}return r!=null?r:Ye}var et=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(V){return V<=247?e.charAt(V):1424<=V&&V<=1524?"R":1536<=V&&V<=1785?t.charAt(V-1536):1774<=V&&V<=2220?"r":8192<=V&&V<=8203?"w":V==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,S=/[LRr]/,U=/[Lb1n]/,H=/[1n]/;function G(V,ee,ie){this.level=V,this.from=ee,this.to=ie}return function(V,ee){var ie=ee=="ltr"?"L":"R";if(V.length==0||ee=="ltr"&&!r.test(V))return!1;for(var me=V.length,he=[],Te=0;Te<me;++Te)he.push(n(V.charCodeAt(Te)));for(var Ce=0,Ue=ie;Ce<me;++Ce){var Ne=he[Ce];Ne=="m"?he[Ce]=Ue:Ue=Ne}for(var $e=0,Be=ie;$e<me;++$e){var tt=he[$e];tt=="1"&&Be=="r"?he[$e]="n":S.test(tt)&&(Be=tt,tt=="r"&&(he[$e]="R"))}for(var dt=1,lt=he[0];dt<me-1;++dt){var bt=he[dt];bt=="+"&<=="1"&&he[dt+1]=="1"?he[dt]="1":bt==","&<==he[dt+1]&&(lt=="1"||lt=="n")&&(he[dt]=lt),lt=bt}for(var Pt=0;Pt<me;++Pt){var Xt=he[Pt];if(Xt==",")he[Pt]="N";else if(Xt=="%"){var Ut=void 0;for(Ut=Pt+1;Ut<me&&he[Ut]=="%";++Ut);for(var fr=Pt&&he[Pt-1]=="!"||Ut<me&&he[Ut]=="1"?"1":"N",ar=Pt;ar<Ut;++ar)he[ar]=fr;Pt=Ut-1}}for(var jt=0,or=ie;jt<me;++jt){var $t=he[jt];or=="L"&&$t=="1"?he[jt]="L":S.test($t)&&(or=$t)}for(var Gt=0;Gt<me;++Gt)if(i.test(he[Gt])){var Wt=void 0;for(Wt=Gt+1;Wt<me&&i.test(he[Wt]);++Wt);for(var Nt=(Gt?he[Gt-1]:ie)=="L",sr=(Wt<me?he[Wt]:ie)=="L",zn=Nt==sr?Nt?"L":"R":ie,Jr=Gt;Jr<Wt;++Jr)he[Jr]=zn;Gt=Wt-1}for(var Zt=[],_r,Yt=0;Yt<me;)if(U.test(he[Yt])){var Xa=Yt;for(++Yt;Yt<me&&U.test(he[Yt]);++Yt);Zt.push(new G(0,Xa,Yt))}else{var Ur=Yt,gn=Zt.length,vn=ee=="rtl"?1:0;for(++Yt;Yt<me&&he[Yt]!="L";++Yt);for(var rr=Ur;rr<Yt;)if(H.test(he[rr])){Ur<rr&&(Zt.splice(gn,0,new G(1,Ur,rr)),gn+=vn);var Vn=rr;for(++rr;rr<Yt&&H.test(he[rr]);++rr);Zt.splice(gn,0,new G(2,Vn,rr)),gn+=vn,Ur=rr}else++rr;Ur<Yt&&Zt.splice(gn,0,new G(1,Ur,Yt))}return ee=="ltr"&&(Zt[0].level==1&&(_r=V.match(/^\s+/))&&(Zt[0].from=_r[0].length,Zt.unshift(new G(0,0,_r[0].length))),be(Zt).level==1&&(_r=V.match(/\s+$/))&&(be(Zt).to-=_r[0].length,Zt.push(new G(0,me-_r[0].length,me)))),ee=="rtl"?Zt.reverse():Zt}}();function ze(e,t){var n=e.order;return n==null&&(n=e.order=et(e.text,t)),n}var Ve=[],ve=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]||Ve).concat(n)}};function Ze(e,t){return e._handlers&&e._handlers[t]||Ve}function Xe(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var S=ne(i,n);S>-1&&(r[t]=i.slice(0,S).concat(i.slice(S+1)))}}}function ye(e,t){var n=Ze(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ae(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),ye(e,n||t.type,e,t),Z(t)||t.codemirrorIgnore}function le(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ne(n,t[r])==-1&&n.push(t[r])}function ae(e,t){return Ze(e,t).length>0}function oe(e){e.prototype.on=function(t,n){ve(this,t,n)},e.prototype.off=function(t,n){Xe(this,t,n)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function $(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Z(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function te(e){Y(e),$(e)}function ge(e){return e.target||e.srcElement}function xe(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Pe=function(){if(I&&k<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),st;function vt(e){if(st==null){var t=o("span","\u200B");d(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(st=t.offsetWidth<=1&&t.offsetHeight>2&&!(I&&k<8))}var n=st?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var we;function yt(e){if(we!=null)return we;var t=d(e,document.createTextNode("A\u062EA")),n=E(t,0,1).getBoundingClientRect(),r=E(t,1,2).getBoundingClientRect();return h(e),!n||n.left==n.right?!1:we=r.right-n.right<3}var it=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var S=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),U=S.indexOf("\r");U!=-1?(n.push(S.slice(0,U)),t+=U+1):(n.push(S),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Qe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},xt=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ct=null;function ft(e){if(ct!=null)return ct;var t=d(e,o("span","x")),n=t.getBoundingClientRect(),r=E(t,0,1).getBoundingClientRect();return ct=Math.abs(n.left-r.left)>1}var ht={},nt={};function Ht(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),ht[e]=t}function Ct(e,t){nt[e]=t}function Mt(e){if(typeof e=="string"&&nt.hasOwnProperty(e))e=nt[e];else if(e&&typeof e.name=="string"&&nt.hasOwnProperty(e.name)){var t=nt[e.name];typeof t=="string"&&(t={name:t}),e=He(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Mt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Mt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function lr(e,t){t=Mt(t);var n=ht[t.name];if(!n)return lr(e,"text/plain");var r=n(e,t);if(gr.hasOwnProperty(t.name)){var i=gr[t.name];for(var S in i){if(!i.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=i[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var U in t.modeProps)r[U]=t.modeProps[U];return r}var gr={};function qt(e,t){var n=gr.hasOwnProperty(e)?gr[e]:gr[e]={};F(t,n)}function vr(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 yn(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 Zr(e,t,n){return e.startState?e.startState(t,n):!0}var It=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};It.prototype.eol=function(){return this.pos>=this.string.length},It.prototype.sol=function(){return this.pos==this.lineStart},It.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},It.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},It.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},It.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},It.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},It.prototype.skipToEnd=function(){this.pos=this.string.length},It.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},It.prototype.backUp=function(e){this.pos-=e},It.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},It.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},It.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(U){return n?U.toLowerCase():U},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var S=this.string.slice(this.pos).match(e);return S&&S.index>0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},It.prototype.current=function(){return this.string.slice(this.start,this.pos)},It.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},It.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},It.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ot(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],S=i.chunkSize();if(t<S){n=i;break}t-=S}return n.lines[t]}function wr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(S){var U=S.text;i==n.line&&(U=U.slice(0,n.ch)),i==t.line&&(U=U.slice(t.ch)),r.push(U),++i}),r}function Xn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function hr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Lt(e){if(e.parent==null)return null;for(var t=e.parent,n=ne(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Cr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],S=i.height;if(t<S){e=i;continue e}t-=S,n+=i.chunkSize()}return n}while(!e.lines);for(var U=0;U<e.lines.length;++U){var H=e.lines[U],G=H.height;if(t<G)break;t-=G}return n+U}function qr(e,t){return t>=e.first&&t<e.first+e.size}function bn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Oe(e,t,n){if(n===void 0&&(n=null),!(this instanceof Oe))return new Oe(e,t,n);this.line=e,this.ch=t,this.sticky=n}function mt(e,t){return e.line-t.line||e.ch-t.ch}function en(e,t){return e.sticky==t.sticky&&mt(e,t)==0}function tn(e){return Oe(e.line,e.ch)}function rn(e,t){return mt(e,t)<0?t:e}function En(e,t){return mt(e,t)<0?e:t}function Yn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function gt(e,t){if(t.line<e.first)return Oe(e.first,0);var n=e.first+e.size-1;return t.line>n?Oe(n,ot(e,n).text.length):Ci(t,ot(e,t.line).text.length)}function Ci(e,t){var n=e.ch;return n==null||n>t?Oe(e.line,t):n<0?Oe(e.line,0):e}function Li(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=gt(e,t[r]);return n}var nn=function(e,t){this.state=e,this.lookAhead=t},ur=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};ur.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ur.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}},ur.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ur.fromSaved=function(e,t,n){return t instanceof nn?new ur(e,vr(e.mode,t.state),n,t.lookAhead):new ur(e,vr(e.mode,t),n)},ur.prototype.save=function(e){var t=e!==!1?vr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new nn(t,this.maxLookAhead):t};function Ai(e,t,n,r){var i=[e.state.modeGen],S={};Jn(e,t.text,e.doc.mode,n,function(V,ee){return i.push(V,ee)},S,r);for(var U=n.state,H=function(V){n.baseTokens=i;var ee=e.state.overlays[V],ie=1,me=0;n.state=!0,Jn(e,t.text,ee.mode,n,function(he,Te){for(var Ce=ie;me<he;){var Ue=i[ie];Ue>he&&i.splice(ie,1,he,i[ie+1],Ue),ie+=2,me=Math.min(he,Ue)}if(!Te)return;if(ee.opaque)i.splice(Ce,ie-Ce,he,"overlay "+Te),ie=Ce+2;else for(;Ce<ie;Ce+=2){var Ne=i[Ce+1];i[Ce+1]=(Ne?Ne+" ":"")+"overlay "+Te}},S),n.state=U,n.baseTokens=null,n.baseTokenPos=1},G=0;G<e.state.overlays.length;++G)H(G);return{styles:i,classes:S.bgClass||S.textClass?S:null}}function $n(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Re(e,Lt(t)),i=t.text.length>e.options.maxHighlightLength&&vr(e.doc.mode,r.state),S=Ai(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=S.styles,S.classes?t.styleClasses=S.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Re(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ur(r,!0,t);var S=Or(e,t,n),U=S>r.first&&ot(r,S-1).stateAfter,H=U?ur.fromSaved(r,U,S):new ur(r,Zr(r.mode),S);return r.iter(S,t,function(G){Qn(e,G.text,H);var V=H.line;G.stateAfter=V==t-1||V%5==0||V>=i.viewFrom&&V<i.viewTo?H.save():null,H.nextLine()}),n&&(r.modeFrontier=H.line),H}function Qn(e,t,n,r){var i=e.doc.mode,S=new It(t,e.options.tabSize,n);for(S.start=S.pos=r||0,t==""&&Di(i,n.state);!S.eol();)xn(i,S,n.state),S.start=S.pos}function Di(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=yn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function xn(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=yn(e,n).mode);var S=e.token(t,n);if(t.pos>t.start)return S}throw new Error("Mode "+e.name+" failed to advance stream.")}var an=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Fr(e,t,n,r){var i=e.doc,S=i.mode,U;t=gt(i,t);var H=ot(i,t.line),G=Re(e,t.line,n),V=new It(H.text,e.options.tabSize,G),ee;for(r&&(ee=[]);(r||V.pos<t.ch)&&!V.eol();)V.start=V.pos,U=xn(S,V,G.state),r&&ee.push(new an(V,U,vr(i.mode,G.state)));return r?ee:new an(V,U,G.state)}function _i(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Jn(e,t,n,r,i,S,U){var H=n.flattenSpans;H==null&&(H=e.options.flattenSpans);var G=0,V=null,ee=new It(t,e.options.tabSize,r),ie,me=e.options.addModeClass&&[null];for(t==""&&_i(Di(n,r.state),S);!ee.eol();){if(ee.pos>e.options.maxHighlightLength?(H=!1,U&&Qn(e,t,r,ee.pos),ee.pos=t.length,ie=null):ie=_i(xn(n,ee,r.state,me),S),me){var he=me[0].name;he&&(ie="m-"+(ie?he+" "+ie:he))}if(!H||V!=ie){for(;G<ee.start;)G=Math.min(ee.start,G+5e3),i(G,V);V=ie}ee.start=ee.pos}for(;G<ee.pos;){var Te=Math.min(ee.pos,G+5e3);i(Te,V),G=Te}}function Or(e,t,n){for(var r,i,S=e.doc,U=n?-1:t-(e.doc.mode.innerMode?1e3:100),H=t;H>U;--H){if(H<=S.first)return S.first;var G=ot(S,H-1),V=G.stateAfter;if(V&&(!n||H+(V instanceof nn?V.lookAhead:0)<=S.modeFrontier))return H;var ee=X(G.text,null,e.options.tabSize);(i==null||r>ee)&&(i=H-1,r=ee)}return i}function Oi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=ot(e,r).stateAfter;if(i&&(!(i instanceof nn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ri=!1,yr=!1;function Lr(){Ri=!0}function Pi(){yr=!0}function Tn(e,t,n){this.marker=e,this.from=t,this.to=n}function Nr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Br(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function jr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function aa(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],U=S.marker,H=S.from==null||(U.inclusiveLeft?S.from<=t:S.from<t);if(H||S.from==t&&U.type=="bookmark"&&(!n||!S.marker.insertLeft)){var G=S.to==null||(U.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new Tn(U,S.from,G?null:S.to))}}return r}function Mi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],U=S.marker,H=S.to==null||(U.inclusiveRight?S.to>=t:S.to>t);if(H||S.from==t&&U.type=="bookmark"&&(!n||S.marker.insertLeft)){var G=S.from==null||(U.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new Tn(U,G?null:S.from-t,S.to==null?null:S.to-t))}}return r}function Rr(e,t){if(t.full)return null;var n=qr(e,t.from.line)&&ot(e,t.from.line).markedSpans,r=qr(e,t.to.line)&&ot(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,S=t.to.ch,U=mt(t.from,t.to)==0,H=aa(n,i,U),G=Mi(r,S,U),V=t.text.length==1,ee=be(t.text).length+(V?i:0);if(H)for(var ie=0;ie<H.length;++ie){var me=H[ie];if(me.to==null){var he=Nr(G,me.marker);he?V&&(me.to=he.to==null?null:he.to+ee):me.to=i}}if(G)for(var Te=0;Te<G.length;++Te){var Ce=G[Te];if(Ce.to!=null&&(Ce.to+=ee),Ce.from==null){var Ue=Nr(H,Ce.marker);Ue||(Ce.from=ee,V&&(H||(H=[])).push(Ce))}else Ce.from+=ee,V&&(H||(H=[])).push(Ce)}H&&(H=Sn(H)),G&&G!=H&&(G=Sn(G));var Ne=[H];if(!V){var $e=t.text.length-2,Be;if($e>0&&H)for(var tt=0;tt<H.length;++tt)H[tt].to==null&&(Be||(Be=[])).push(new Tn(H[tt].marker,null,null));for(var dt=0;dt<$e;++dt)Ne.push(Be);Ne.push(G)}return Ne}function Sn(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function oa(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(he){if(he.markedSpans)for(var Te=0;Te<he.markedSpans.length;++Te){var Ce=he.markedSpans[Te].marker;Ce.readOnly&&(!r||ne(r,Ce)==-1)&&(r||(r=[])).push(Ce)}}),!r)return null;for(var i=[{from:t,to:n}],S=0;S<r.length;++S)for(var U=r[S],H=U.find(0),G=0;G<i.length;++G){var V=i[G];if(mt(V.to,H.from)<0||mt(V.from,H.to)>0)continue;var ee=[G,1],ie=mt(V.from,H.from),me=mt(V.to,H.to);(ie<0||!U.inclusiveLeft&&!ie)&&ee.push({from:V.from,to:H.from}),(me>0||!U.inclusiveRight&&!me)&&ee.push({from:H.to,to:V.to}),i.splice.apply(i,ee),G+=ee.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 qn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function on(e){return e.inclusiveLeft?-1:0}function wn(e){return e.inclusiveRight?1:0}function Cn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),S=mt(r.from,i.from)||on(e)-on(t);if(S)return-S;var U=mt(r.to,i.to)||wn(e)-wn(t);return U||t.id-e.id}function sa(e,t){var n=yr&&e.markedSpans,r;if(n)for(var i=void 0,S=0;S<n.length;++S)i=n[S],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Cn(r,i.marker)<0)&&(r=i.marker);return r}function Ln(e){return sa(e,!0)}function sn(e){return sa(e,!1)}function ki(e,t){var n=yr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var S=n[i];S.marker.collapsed&&(S.from==null||S.from<t)&&(S.to==null||S.to>t)&&(!r||Cn(r,S.marker)<0)&&(r=S.marker)}return r}function ei(e,t,n,r,i){var S=ot(e,t),U=yr&&S.markedSpans;if(U)for(var H=0;H<U.length;++H){var G=U[H];if(!G.marker.collapsed)continue;var V=G.marker.find(0),ee=mt(V.from,n)||on(G.marker)-on(i),ie=mt(V.to,r)||wn(G.marker)-wn(i);if(ee>=0&&ie<=0||ee<=0&&ie>=0)continue;if(ee<=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?mt(V.to,n)>=0:mt(V.to,n)>0)||ee>=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?mt(V.from,r)<=0:mt(V.from,r)<0))return!0}}function Qt(e){for(var t;t=Ln(e);)e=t.find(-1,!0).line;return e}function Wr(e){for(var t;t=sn(e);)e=t.find(1,!0).line;return e}function An(e){for(var t,n;t=sn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Hr(e,t){var n=ot(e,t),r=Qt(n);return n==r?t:Lt(r)}function Ii(e,t){if(t>e.lastLine())return t;var n=ot(e,t),r;if(!Er(e,n))return t;for(;r=sn(n);)n=r.find(1,!0).line;return Lt(n)+1}function Er(e,t){var n=yr&&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&&Dn(e,t,r))return!0}}function Dn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Dn(e,r.line,Nr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,S=0;S<t.markedSpans.length;++S)if(i=t.markedSpans[S],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Dn(e,t,i))return!0}function dr(e){e=Qt(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var S=n.parent;S;n=S,S=n.parent)for(var U=0;U<S.children.length;++U){var H=S.children[U];if(H==n)break;t+=H.height}return t}function _n(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ln(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=sn(r);){var S=n.find(0,!0);t-=r.text.length-S.from.ch,r=S.to.line,t+=r.text.length-S.to.ch}return t}function Pr(e){var t=e.display,n=e.doc;t.maxLine=ot(n,n.first),t.maxLineLength=_n(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=_n(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Kr=function(e,t,n){this.text=e,qn(this,t),this.height=n?n(this):1};Kr.prototype.lineNo=function(){return Lt(this)},oe(Kr);function la(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Zn(e),qn(e,n);var i=r?r(e):1;i!=e.height&&hr(e,i)}function ua(e){e.parent=null,Zn(e)}var $a={},Qa={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Qa:$a;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ui(e,t){var n=T("span",null,null,O?"padding-right: .1px":null),r={pre:T("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var S=i?t.rest[i-1]:t.line,U=void 0;r.pos=0,r.addToken=pt,yt(e.display.measure)&&(U=ze(S,e.doc.direction))&&(r.addToken=Et(r.addToken,U)),r.map=[];var H=t!=e.display.externalMeasured&&Lt(S);Rt(S,r,$n(e,S,H)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=B(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=B(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(vt(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 ye(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=B(r.pre.className,r.textClass||"")),r}function at(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function pt(e,t,n,r,i,S,U){if(!t)return;var H=e.splitSpaces?ut(t,e.trailingSpace):t,G=e.cm.state.specialChars,V=!1,ee;if(!G.test(t))e.col+=t.length,ee=document.createTextNode(H),e.map.push(e.pos,e.pos+t.length,ee),I&&k<9&&(V=!0),e.pos+=t.length;else{ee=document.createDocumentFragment();for(var ie=0;;){G.lastIndex=ie;var me=G.exec(t),he=me?me.index-ie:t.length-ie;if(he){var Te=document.createTextNode(H.slice(ie,ie+he));I&&k<9?ee.appendChild(o("span",[Te])):ee.appendChild(Te),e.map.push(e.pos,e.pos+he,Te),e.col+=he,e.pos+=he}if(!me)break;ie+=he+1;var Ce=void 0;if(me[0]==" "){var Ue=e.cm.options.tabSize,Ne=Ue-e.col%Ue;Ce=ee.appendChild(o("span",se(Ne),"cm-tab")),Ce.setAttribute("role","presentation"),Ce.setAttribute("cm-text"," "),e.col+=Ne}else me[0]=="\r"||me[0]==`
|
|
`?(Ce=ee.appendChild(o("span",me[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ce.setAttribute("cm-text",me[0]),e.col+=1):(Ce=e.cm.options.specialCharPlaceholder(me[0]),Ce.setAttribute("cm-text",me[0]),I&&k<9?ee.appendChild(o("span",[Ce])):ee.appendChild(Ce),e.col+=1);e.map.push(e.pos,e.pos+1,Ce),e.pos++}}if(e.trailingSpace=H.charCodeAt(t.length-1)==32,n||r||i||V||S||U){var $e=n||"";r&&($e+=r),i&&($e+=i);var Be=o("span",[ee],$e,S);if(U)for(var tt in U)U.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&Be.setAttribute(tt,U[tt]);return e.content.appendChild(Be)}e.content.appendChild(ee)}function ut(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var S=e.charAt(i);S==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(S="\xA0"),r+=S,n=S==" "}return r}function Et(e,t){return function(n,r,i,S,U,H,G){i=i?i+" cm-force-border":"cm-force-border";for(var V=n.pos,ee=V+r.length;;){for(var ie=void 0,me=0;me<t.length&&!(ie=t[me],ie.to>V&&ie.from<=V);me++);if(ie.to>=ee)return e(n,r,i,S,U,H,G);e(n,r.slice(0,ie.to-V),i,S,null,H,G),S=null,r=r.slice(ie.to-V),V=ie.to}}}function wt(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 Rt(e,t,n){var r=e.markedSpans,i=e.text,S=0;if(!r){for(var U=1;U<n.length;U+=2)t.addToken(t,i.slice(S,S=n[U]),da(n[U+1],t.cm.options));return}for(var H=i.length,G=0,V=1,ee="",ie,me,he=0,Te,Ce,Ue,Ne,$e;;){if(he==G){Te=Ce=Ue=me="",$e=null,Ne=null,he=Infinity;for(var Be=[],tt=void 0,dt=0;dt<r.length;++dt){var lt=r[dt],bt=lt.marker;if(bt.type=="bookmark"&<.from==G&&bt.widgetNode)Be.push(bt);else if(lt.from<=G&&(lt.to==null||lt.to>G||bt.collapsed&<.to==G&<.from==G)){if(lt.to!=null&<.to!=G&&he>lt.to&&(he=lt.to,Ce=""),bt.className&&(Te+=" "+bt.className),bt.css&&(me=(me?me+";":"")+bt.css),bt.startStyle&<.from==G&&(Ue+=" "+bt.startStyle),bt.endStyle&<.to==he&&(tt||(tt=[])).push(bt.endStyle,lt.to),bt.title&&(($e||($e={})).title=bt.title),bt.attributes)for(var Pt in bt.attributes)($e||($e={}))[Pt]=bt.attributes[Pt];bt.collapsed&&(!Ne||Cn(Ne.marker,bt)<0)&&(Ne=lt)}else lt.from>G&&he>lt.from&&(he=lt.from)}if(tt)for(var Xt=0;Xt<tt.length;Xt+=2)tt[Xt+1]==he&&(Ce+=" "+tt[Xt]);if(!Ne||Ne.from==G)for(var Ut=0;Ut<Be.length;++Ut)wt(t,0,Be[Ut]);if(Ne&&(Ne.from||0)==G){if(wt(t,(Ne.to==null?H+1:Ne.to)-G,Ne.marker,Ne.from==null),Ne.to==null)return;Ne.to==G&&(Ne=!1)}}if(G>=H)break;for(var fr=Math.min(H,he);;){if(ee){var ar=G+ee.length;if(!Ne){var jt=ar>fr?ee.slice(0,fr-G):ee;t.addToken(t,jt,ie?ie+Te:Te,Ue,G+jt.length==he?Ce:"",me,$e)}if(ar>=fr){ee=ee.slice(fr-G),G=fr;break}G=ar,Ue=""}ee=i.slice(S,S=n[V++]),ie=da(n[V++],t.cm.options)}}}function Tt(e,t,n){this.line=t,this.rest=An(t),this.size=this.rest?Lt(be(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Er(e,t)}function Ft(e,t,n){for(var r=[],i,S=t;S<n;S=i){var U=new Tt(e.doc,ot(e.doc,S),S);i=S+U.size,r.push(U)}return r}var Kt=null;function St(e){Kt?Kt.ops.push(e):e.ownsGroup=Kt={ops:[e],delayedCallbacks:[]}}function Mr(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 Dt(e,t){var n=e.ownsGroup;if(!n)return;try{Mr(n)}finally{Kt=null,t(n)}}var er=null;function Ot(e,t){var n=Ze(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Kt?i=Kt.delayedCallbacks:er?i=er:(i=er=[],setTimeout(br,0));for(var S=function(H){i.push(function(){return n[H].apply(null,r)})},U=0;U<n.length;++U)S(U)}function br(){var e=er;er=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var i=0;i<t.changes.length;i++){var S=t.changes[i];S=="text"?ks(e,t):S=="gutter"?qa(e,t,n,r):S=="class"?ca(e,t):S=="widget"&&Is(e,t,r)}t.changes=null}function ti(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),I&&k<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=ti(t);t.background=r.insertBefore(o("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ui(e,t)}function ks(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ca(e,t)):n&&(t.text.className=n)}function ca(e,t){Ms(e,t),t.line.wrapClass?ti(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function qa(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ti(t);t.gutterBackground=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var S=t.line.gutterMarkers;if(e.options.lineNumbers||S){var U=ti(t),H=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(H),U.insertBefore(H,t.text),t.line.gutterClass&&(H.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!S||!S["CodeMirror-linenumbers"])&&(t.lineNumber=H.appendChild(o("div",bn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),S)for(var G=0;G<e.display.gutterSpecs.length;++G){var V=e.display.gutterSpecs[G].className,ee=S.hasOwnProperty(V)&&S[V];ee&&H.appendChild(o("div",[ee],"CodeMirror-gutter-elt","left: "+r.gutterLeft[V]+"px; width: "+r.gutterWidth[V]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=x("CodeMirror-linewidget"),i=t.node.firstChild,S=void 0;i;i=S)S=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);eo(e,t,n)}function Us(e,t,n,r){var i=Za(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ca(e,t),qa(e,t,n,r),eo(e,t,r),t.node}function eo(e,t,n){if(to(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,n,!1)}function to(e,t,n,r,i){if(!t.widgets)return;for(var S=ti(n),U=0,H=t.widgets;U<H.length;++U){var G=H[U],V=o("div",[G.node],"CodeMirror-linewidget"+(G.className?" "+G.className:""));G.handleMouseEvents||V.setAttribute("cm-ignore-events","true"),Fs(G,V,n,r),e.display.input.setUneditable(V),i&&G.above?S.insertBefore(V,n.gutter||n.text):S.appendChild(V),Ot(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 ri(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!v(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),d(t.display.measure,o("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function kr(e,t){for(var n=ge(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Fi(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,o("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Ar(e){return ue-e.display.nativeBarWidth}function ln(e){return e.display.scroller.clientWidth-Ar(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-Ar(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&ln(e);if(!t.measure.heights||r&&t.measure.width!=i){var S=t.measure.heights=[];if(r){t.measure.width=i;for(var U=t.text.firstChild.getClientRects(),H=0;H<U.length-1;H++){var G=U[H],V=U[H+1];Math.abs(G.bottom-V.bottom)>2&&S.push((G.bottom+V.top)/2-n.top)}}S.push(n.bottom-n.top)}}function no(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Lt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=Qt(t);var n=Lt(t),r=e.display.externalMeasured=new Tt(e.doc,t,n);r.lineN=n;var i=r.built=Ui(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return Dr(e,On(e,t),n,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[cn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function On(e,t){var n=Lt(t),r=ma(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=no(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Dr(e,t,n,r,i){t.before&&(n=-1);var S=n+(r||""),U;return t.cache.hasOwnProperty(S)?U=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),U=Ws(e,t,n,r),U.bogus||(t.cache[S]=U)),{left:U.left,right:U.right,top:i?U.rtop:U.top,bottom:i?U.rbottom:U.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,n){for(var r,i,S,U,H,G,V=0;V<e.length;V+=3)if(H=e[V],G=e[V+1],t<H?(i=0,S=1,U="left"):t<G?(i=t-H,S=i+1):(V==e.length-3||t==G&&e[V+3]>t)&&(S=G-H,i=S-1,t>=G&&(U="right")),i!=null){if(r=e[V+2],H==G&&n==(r.insertLeft?"left":"right")&&(U=n),n=="left"&&i==0)for(;V&&e[V-2]==e[V-3]&&e[V-1].insertLeft;)r=e[(V-=3)+2],U="left";if(n=="right"&&i==G-H)for(;V<e.length-3&&e[V+3]==e[V+4]&&!e[V+5].insertLeft;)r=e[(V+=3)+2],U="right";break}return{node:r,start:i,end:S,collapse:U,coverStart:H,coverEnd:G}}function js(e,t){var n=ao;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=oo(t.map,n,r),S=i.node,U=i.start,H=i.end,G=i.collapse,V;if(S.nodeType==3){for(var ee=0;ee<4;ee++){for(;U&&_e(t.line.text.charAt(i.coverStart+U));)--U;for(;i.coverStart+H<i.coverEnd&&_e(t.line.text.charAt(i.coverStart+H));)++H;if(I&&k<9&&U==0&&H==i.coverEnd-i.coverStart?V=S.parentNode.getBoundingClientRect():V=js(E(S,U,H).getClientRects(),r),V.left||V.right||U==0)break;H=U,U=U-1,G="right"}I&&k<11&&(V=Hs(e.display.measure,V))}else{U>0&&(G=r="right");var ie;e.options.lineWrapping&&(ie=S.getClientRects()).length>1?V=ie[r=="right"?ie.length-1:0]:V=S.getBoundingClientRect()}if(I&&k<9&&!U&&(!V||!V.left&&!V.right)){var me=S.parentNode.getClientRects()[0];me?V={left:me.left,right:me.left+Pn(e.display),top:me.top,bottom:me.bottom}:V=ao}for(var he=V.top-t.rect.top,Te=V.bottom-t.rect.top,Ce=(he+Te)/2,Ue=t.view.measure.heights,Ne=0;Ne<Ue.length-1&&!(Ce<Ue[Ne]);Ne++);var $e=Ne?Ue[Ne-1]:0,Be=Ue[Ne],tt={left:(G=="right"?V.right:V.left)-t.rect.left,right:(G=="left"?V.left:V.right)-t.rect.left,top:$e,bottom:Be};return!V.left&&!V.right&&(tt.bogus=!0),e.options.singleCursorHeightPerLine||(tt.rtop=he,tt.rbottom=Te),tt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!ft(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function so(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lo(e){e.display.externalMeasure=null,h(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function ni(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return c&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function co(){return c&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ri(e.widgets[n]));return t}function Ni(e,t,n,r,i){if(!i){var S=pa(t);n.top+=S,n.bottom+=S}if(r=="line")return n;r||(r="local");var U=dr(t);if(r=="local"?U+=Fi(e.display):U-=e.display.viewOffset,r=="page"||r=="window"){var H=e.display.lineSpace.getBoundingClientRect();U+=H.top+(r=="window"?0:co());var G=H.left+(r=="window"?0:uo());n.left+=G,n.right+=G}return n.top+=U,n.bottom+=U,n}function fo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=uo(),i-=co();else if(n=="local"||!n){var S=e.display.sizer.getBoundingClientRect();r+=S.left,i+=S.top}var U=e.display.lineSpace.getBoundingClientRect();return{left:r-U.left,top:i-U.top}}function ga(e,t,n,r,i){return r||(r=ot(e.doc,t.line)),Ni(e,r,io(e,r,t.ch,i),n)}function xr(e,t,n,r,i,S){r=r||ot(e.doc,t.line),i||(i=On(e,r));function U(Te,Ce){var Ue=Dr(e,i,Te,Ce?"right":"left",S);return Ce?Ue.left=Ue.right:Ue.right=Ue.left,Ni(e,r,Ue,n)}var H=ze(r,e.doc.direction),G=t.ch,V=t.sticky;if(G>=r.text.length?(G=r.text.length,V="before"):G<=0&&(G=0,V="after"),!H)return U(V=="before"?G-1:G,V=="before");function ee(Te,Ce,Ue){var Ne=H[Ce],$e=Ne.level==1;return U(Ue?Te-1:Te,$e!=Ue)}var ie=We(H,G,V),me=Ye,he=ee(G,ie,V=="before");return me!=null&&(he.other=ee(G,me,V!="before")),he}function ho(e,t){var n=0;t=gt(e.doc,t),e.options.lineWrapping||(n=Pn(e.display)*t.ch);var r=ot(e.doc,t.line),i=dr(r)+Fi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function va(e,t,n,r,i){var S=Oe(e,t,n);return S.xRel=i,r&&(S.outside=r),S}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var i=Cr(r,n),S=r.first+r.size-1;if(i>S)return va(r.first+r.size-1,ot(r,S).text.length,null,1,1);t<0&&(t=0);for(var U=ot(r,i);;){var H=Ks(e,U,i,t,n),G=ki(U,H.ch+(H.xRel>0||H.outside>0?1:0));if(!G)return H;var V=G.find(1);if(V.line==i)return V;U=ot(r,i=V.line)}}function mo(e,t,n,r){r-=pa(t);var i=t.text.length,S=rt(function(U){return Dr(e,n,U-1).bottom<=r},i,0);return i=rt(function(U){return Dr(e,n,U).top>r},S,i),{begin:S,end:i}}function po(e,t,n,r){n||(n=On(e,t));var i=Ni(e,t,Dr(e,n,r),"line").top;return mo(e,t,n,i)}function ba(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=dr(t);var S=On(e,t),U=pa(t),H=0,G=t.text.length,V=!0,ee=ze(t,e.doc.direction);if(ee){var ie=(e.options.lineWrapping?zs:Gs)(e,t,n,S,ee,r,i);V=ie.level!=1,H=V?ie.from:ie.to-1,G=V?ie.to:ie.from-1}var me=null,he=null,Te=rt(function(dt){var lt=Dr(e,S,dt);return lt.top+=U,lt.bottom+=U,ba(lt,r,i,!1)?(lt.top<=i&<.left<=r&&(me=dt,he=lt),!0):!1},H,G),Ce,Ue,Ne=!1;if(he){var $e=r-he.left<he.right-r,Be=$e==V;Te=me+(Be?0:1),Ue=Be?"after":"before",Ce=$e?he.left:he.right}else{!V&&(Te==G||Te==H)&&Te++,Ue=Te==0?"after":Te==t.text.length?"before":Dr(e,S,Te-(V?1:0)).bottom+U<=i==V?"after":"before";var tt=xr(e,Oe(n,Te,Ue),"line",t,S);Ce=tt.left,Ne=i<tt.top?-1:i>=tt.bottom?1:0}return Te=Le(t.text,Te,1),va(n,Te,Ue,Ne,r-Ce)}function Gs(e,t,n,r,i,S,U){var H=rt(function(ie){var me=i[ie],he=me.level!=1;return ba(xr(e,Oe(n,he?me.to:me.from,he?"before":"after"),"line",t,r),S,U,!0)},0,i.length-1),G=i[H];if(H>0){var V=G.level!=1,ee=xr(e,Oe(n,V?G.from:G.to,V?"after":"before"),"line",t,r);ba(ee,S,U,!0)&&ee.top>U&&(G=i[H-1])}return G}function zs(e,t,n,r,i,S,U){var H=mo(e,t,r,U),G=H.begin,V=H.end;/\s/.test(t.text.charAt(V-1))&&V--;for(var ee=null,ie=null,me=0;me<i.length;me++){var he=i[me];if(he.from>=V||he.to<=G)continue;var Te=he.level!=1,Ce=Dr(e,r,Te?Math.min(V,he.to)-1:Math.max(G,he.from)).right,Ue=Ce<S?S-Ce+1e9:Ce-S;(!ee||ie>Ue)&&(ee=he,ie=Ue)}return ee||(ee=i[i.length-1]),ee.from<G&&(ee={from:G,to:ee.to,level:ee.level}),ee.to>V&&(ee={from:ee.from,to:V,level:ee.level}),ee}var un;function Rn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(un==null){un=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)un.appendChild(document.createTextNode("x")),un.appendChild(o("br"));un.appendChild(document.createTextNode("x"))}d(e.measure,un);var n=un.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),h(e.measure),n||1}function Pn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),n=o("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 Ea(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,S=t.gutters.firstChild,U=0;S;S=S.nextSibling,++U){var H=e.display.gutterSpecs[U].className;n[H]=S.offsetLeft+S.clientLeft+i,r[H]=S.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=Rn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Pn(e.display)-3);return function(i){if(Er(e.doc,i))return 0;var S=0;if(i.widgets)for(var U=0;U<i.widgets.length;U++)i.widgets[U].height&&(S+=i.widgets[U].height);return n?S+(Math.ceil(i.text.length/r)||1)*t:S+t}}function Ta(e){var t=e.doc,n=go(e);t.iter(function(r){var i=n(r);i!=r.height&&hr(r,i)})}function dn(e,t,n,r){var i=e.display;if(!n&&ge(t).getAttribute("cm-not-content")=="true")return null;var S,U,H=i.lineSpace.getBoundingClientRect();try{S=t.clientX-H.left,U=t.clientY-H.top}catch(ie){return null}var G=ya(e,S,U),V;if(r&&G.xRel>0&&(V=ot(e.doc,G.line).text).length==G.ch){var ee=X(V,V.length,e.options.tabSize)-V.length;G=Oe(G.line,Math.max(0,Math.round((S-ro(e.display).left)/Pn(e.display))-ee))}return G}function cn(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 nr(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)yr&&Hr(e.doc,t)<i.viewTo&&zr(e);else if(n<=i.viewFrom)yr&&Ii(e.doc,n+r)>i.viewFrom?zr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)zr(e);else if(t<=i.viewFrom){var S=Bi(e,n,n+r,1);S?(i.view=i.view.slice(S.index),i.viewFrom=S.lineN,i.viewTo+=r):zr(e)}else if(n>=i.viewTo){var U=Bi(e,t,t,-1);U?(i.view=i.view.slice(0,U.index),i.viewTo=U.lineN):zr(e)}else{var H=Bi(e,t,t,-1),G=Bi(e,n,n+r,1);H&&G?(i.view=i.view.slice(0,H.index).concat(Ft(e,H.lineN,G.lineN)).concat(i.view.slice(G.index)),i.viewTo+=r):zr(e)}var V=i.externalMeasured;V&&(n<V.lineN?V.lineN+=r:t<V.lineN+V.size&&(i.externalMeasured=null))}function Gr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var S=r.view[cn(e,t)];if(S.node==null)return;var U=S.changes||(S.changes=[]);ne(U,n)==-1&&U.push(n)}function zr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bi(e,t,n,r){var i=cn(e,t),S,U=e.display.view;if(!yr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var H=e.display.viewFrom,G=0;G<i;G++)H+=U[G].size;if(H!=t){if(r>0){if(i==U.length-1)return null;S=H+U[i].size-t,i++}else S=H-t;t+=S,n+=S}for(;Hr(e.doc,n)!=n;){if(i==(r<0?0:U.length-1))return null;n+=r*U[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=Ft(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Ft(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(cn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Ft(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,cn(e,n)))),r.viewTo=n}function vo(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function ii(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),S=r.selection=document.createDocumentFragment(),U=0;U<n.sel.ranges.length;U++){if(!t&&U==n.sel.primIndex)continue;var H=n.sel.ranges[U];if(H.from().line>=e.display.viewTo||H.to().line<e.display.viewFrom)continue;var G=H.empty();(G||e.options.showCursorWhenSelecting)&&bo(e,H.head,i),G||Xs(e,H,S)}return r}function bo(e,t,n){var r=xr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(o("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var S=n.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));S.style.display="",S.style.left=r.other.left+"px",S.style.top=r.other.top+"px",S.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ji(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,S=document.createDocumentFragment(),U=ro(e.display),H=U.left,G=Math.max(r.sizerWidth,ln(e)-r.sizer.offsetLeft)-U.right,V=i.direction=="ltr";function ee(Be,tt,dt,lt){tt<0&&(tt=0),tt=Math.round(tt),lt=Math.round(lt),S.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+Be+`px;
|
|
top: `+tt+"px; width: "+(dt==null?G-Be:dt)+`px;
|
|
height: `+(lt-tt)+"px"))}function ie(Be,tt,dt){var lt=ot(i,Be),bt=lt.text.length,Pt,Xt;function Ut(jt,or){return ga(e,Oe(Be,jt),"div",lt,or)}function fr(jt,or,$t){var Gt=po(e,lt,null,jt),Wt=or=="ltr"==($t=="after")?"left":"right",Nt=$t=="after"?Gt.begin:Gt.end-(/\s/.test(lt.text.charAt(Gt.end-1))?2:1);return Ut(Nt,Wt)[Wt]}var ar=ze(lt,i.direction);return qe(ar,tt||0,dt==null?bt:dt,function(jt,or,$t,Gt){var Wt=$t=="ltr",Nt=Ut(jt,Wt?"left":"right"),sr=Ut(or-1,Wt?"right":"left"),zn=tt==null&&jt==0,Jr=dt==null&&or==bt,Zt=Gt==0,_r=!ar||Gt==ar.length-1;if(sr.top-Nt.top<=3){var Yt=(V?zn:Jr)&&Zt,Xa=(V?Jr:zn)&&_r,Ur=Yt?H:(Wt?Nt:sr).left,gn=Xa?G:(Wt?sr:Nt).right;ee(Ur,Nt.top,gn-Ur,Nt.bottom)}else{var vn,rr,Vn,Ya;Wt?(vn=V&&zn&&Zt?H:Nt.left,rr=V?G:fr(jt,$t,"before"),Vn=V?H:fr(or,$t,"after"),Ya=V&&Jr&&_r?G:sr.right):(vn=V?fr(jt,$t,"before"):H,rr=!V&&zn&&Zt?G:Nt.right,Vn=!V&&Jr&&_r?H:sr.left,Ya=V?fr(or,$t,"after"):G),ee(vn,Nt.top,rr-vn,Nt.bottom),Nt.bottom<sr.top&&ee(H,Nt.bottom,null,sr.top),ee(Vn,sr.top,Ya-Vn,sr.bottom)}(!Pt||ji(Nt,Pt)<0)&&(Pt=Nt),ji(sr,Pt)<0&&(Pt=sr),(!Xt||ji(Nt,Xt)<0)&&(Xt=Nt),ji(sr,Xt)<0&&(Xt=sr)}),{start:Pt,end:Xt}}var me=t.from(),he=t.to();if(me.line==he.line)ie(me.line,me.ch,he.ch);else{var Te=ot(i,me.line),Ce=ot(i,he.line),Ue=Qt(Te)==Qt(Ce),Ne=ie(me.line,me.ch,Ue?Te.text.length+1:null).end,$e=ie(he.line,Ue?0:null,he.ch).start;Ue&&(Ne.top<$e.top-2?(ee(Ne.right,Ne.top,null,Ne.bottom),ee(H,$e.top,$e.left,$e.bottom)):ee(Ne.right,Ne.top,$e.left-Ne.right,Ne.bottom)),Ne.bottom<$e.top&&ee(H,Ne.bottom,null,$e.top)}n.appendChild(S)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Mn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),wa(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Mn(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(ye(e,"focus",e,t),e.state.focused=!0,N(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),O&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Mn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(ye(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 Wi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],S=e.options.lineWrapping,U=void 0,H=0;if(i.hidden)continue;if(I&&k<8){var G=i.node.offsetTop+i.node.offsetHeight;U=G-n,n=G}else{var V=i.node.getBoundingClientRect();U=V.bottom-V.top,!S&&i.text.firstChild&&(H=i.text.firstChild.getBoundingClientRect().right-V.left-1)}var ee=i.line.height-U;if((ee>.005||ee<-.005)&&(hr(i.line,U),To(i.line),i.rest))for(var ie=0;ie<i.rest.length;ie++)To(i.rest[ie]);if(H>e.display.sizerWidth){var me=Math.ceil(H/Pn(e.display));me>e.display.maxLineLength&&(e.display.maxLineLength=me,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function To(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Hi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Fi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,S=Cr(t,r),U=Cr(t,i);if(n&&n.ensure){var H=n.ensure.from.line,G=n.ensure.to.line;H<S?(S=H,U=Cr(t,dr(ot(t,H))+e.wrapper.clientHeight)):Math.min(G,t.lastLine())>=U&&(S=Cr(t,dr(ot(t,G))-e.wrapper.clientHeight),U=G)}return{from:S,to:Math.max(U,S+1)}}function Ys(e,t){if(Ae(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!y){var S=o("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Fi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Ar(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(i),e.display.lineSpace.removeChild(S)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Oe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Oe(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var U=!1,H=xr(e,t),G=!n||n==t?H:xr(e,n);i={left:Math.min(H.left,G.left),top:Math.min(H.top,G.top)-r,right:Math.max(H.left,G.left),bottom:Math.max(H.bottom,G.bottom)+r};var V=Ca(e,i),ee=e.doc.scrollTop,ie=e.doc.scrollLeft;if(V.scrollTop!=null&&(oi(e,V.scrollTop),Math.abs(e.doc.scrollTop-ee)>1&&(U=!0)),V.scrollLeft!=null&&(fn(e,V.scrollLeft),Math.abs(e.doc.scrollLeft-ie)>1&&(U=!0)),!U)break}return i}function Qs(e,t){var n=Ca(e,t);n.scrollTop!=null&&oi(e,n.scrollTop),n.scrollLeft!=null&&fn(e,n.scrollLeft)}function Ca(e,t){var n=e.display,r=Rn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,S=ha(e),U={};t.bottom-t.top>S&&(t.bottom=t.top+S);var H=e.doc.height+fa(n),G=t.top<r,V=t.bottom>H-r;if(t.top<i)U.scrollTop=G?0:t.top;else if(t.bottom>i+S){var ee=Math.min(t.top,(V?H:t.bottom)-S);ee!=i&&(U.scrollTop=ee)}var ie=e.options.fixedGutter?0:n.gutters.offsetWidth,me=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ie,he=ln(e)-n.gutters.offsetWidth,Te=t.right-t.left>he;return Te&&(t.right=t.left+he),t.left<10?U.scrollLeft=0:t.left<me?U.scrollLeft=Math.max(0,t.left+ie-(Te?0:10)):t.right>he+me-3&&(U.scrollLeft=t.right+(Te?0:10)-he),U}function La(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function kn(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ai(e,t,n){(t!=null||n!=null)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ho(e,t.from),r=ho(e,t.to);So(e,n,r,t.margin)}}function So(e,t,n,r){var i=Ca(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});ai(e,i.scrollLeft,i.scrollTop)}function oi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;A||Da(e,{top:t}),wo(e,t,!0),A&&Da(e),ui(e,100)}function wo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function fn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,_o(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function si(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ar(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var hn=function(e,t,n){this.cm=n;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),ve(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ve(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,I&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};hn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var S=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},hn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},hn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},hn.prototype.zeroWidthHack=function(){var e=s&&!w?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new q,this.disableVert=new q},hn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),S=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},hn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var li=function(){};li.prototype.update=function(){return{bottom:0,right:0}},li.prototype.setScrollLeft=function(){},li.prototype.setScrollTop=function(){},li.prototype.clear=function(){};function In(e,t){t||(t=si(e));var n=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Wi(e),Co(e,si(e)),n=e.display.barWidth,r=e.display.barHeight}function Co(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Lo={native:hn,null:li};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Lo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ve(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"?fn(e,t):oi(e,t)},e),e.display.scrollbars.addClass&&N(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function mn(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},St(e.curOp)}function pn(e){var t=e.curOp;t&&Dt(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var S=0;S<t.length;S++)nl(t[S]);for(var U=0;U<t.length;U++)il(t[U])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Pr(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Gi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Wi(t),e.barMeasure=si(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ar(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-ln(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&&fn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==R();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&In(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Eo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Do(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&wo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&fn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,gt(r,e.scrollToPos.from),gt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var S=e.maybeHiddenMarkers,U=e.maybeUnhiddenMarkers;if(S)for(var H=0;H<S.length;++H)S[H].lines.length||ye(S[H],"hide");if(U)for(var G=0;G<U.length;++G)U[G].lines.length&&ye(U[G],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&ye(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function cr(e,t){if(e.curOp)return t();mn(e);try{return t()}finally{pn(e)}}function zt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);mn(e);try{return t.apply(e,arguments)}finally{pn(e)}}}function tr(e){return function(){if(this.curOp)return e.apply(this,arguments);mn(this);try{return e.apply(this,arguments)}finally{pn(this)}}}function Vt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);mn(t);try{return e.apply(this,arguments)}finally{pn(t)}}}function ui(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,j(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Re(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var U=S.styles,H=S.text.length>e.options.maxHighlightLength?vr(t.mode,r.state):null,G=Ai(e,S,r,!0);H&&(r.state=H),S.styles=G.styles;var V=S.styleClasses,ee=G.classes;ee?S.styleClasses=ee:V&&(S.styleClasses=null);for(var ie=!U||U.length!=S.styles.length||V!=ee&&(!V||!ee||V.bgClass!=ee.bgClass||V.textClass!=ee.textClass),me=0;!ie&&me<U.length;++me)ie=U[me]!=S.styles[me];ie&&i.push(r.line),S.stateAfter=r.save(),r.nextLine()}else S.text.length<=e.options.maxHighlightLength&&Qn(e,S.text,r),S.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ui(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&cr(e,function(){for(var S=0;S<i.length;S++)Gr(e,i[S],"text")})}var Gi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Hi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=ln(e),this.force=n,this.dims=Ea(e),this.events=[]};Gi.prototype.signal=function(e,t){ae(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)ye.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=Ar(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ar(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=R();if(!t||!v(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&v(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==R())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&v(document.body,e.anchorNode)&&v(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Aa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return zr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&vo(e)==0)return!1;Oo(e)&&(zr(e),t.dims=Ea(e));var i=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),U=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<S&&S-n.viewFrom<20&&(S=Math.max(r.first,n.viewFrom)),n.viewTo>U&&n.viewTo-U<20&&(U=Math.min(i,n.viewTo)),yr&&(S=Hr(e.doc,S),U=Ii(e.doc,U));var H=S!=n.viewFrom||U!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,S,U),n.viewOffset=dr(ot(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var G=vo(e);if(!H&&G==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var V=sl(e);return G>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),G>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(V),h(n.cursorDiv),h(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,H&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ui(e,400)),n.updateLineNumbers=null,!0}function Do(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==ln(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+fa(e.display)-ha(e),n.top)}),t.visible=Hi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hi(e.display,e.doc,n));if(!Aa(e,t))break;Wi(e);var i=si(e);ii(e),In(e,i),Oa(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Da(e,t){var n=new Gi(e,t);if(Aa(e,n)){Wi(e),Do(e,n);var r=si(e);ii(e),In(e,r),Oa(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,S=r.lineDiv,U=S.firstChild;function H(Te){var Ce=Te.nextSibling;return O&&s&&e.display.currentWheelTarget==Te?Te.style.display="none":Te.parentNode.removeChild(Te),Ce}for(var G=r.view,V=r.viewFrom,ee=0;ee<G.length;ee++){var ie=G[ee];if(!ie.hidden)if(!ie.node||ie.node.parentNode!=S){var me=Us(e,ie,V,n);S.insertBefore(me,U)}else{for(;U!=ie.node;)U=H(U);var he=i&&t!=null&&t<=V&&ie.lineNumber;ie.changes&&(ne(ie.changes,"gutter")>-1&&(he=!1),Ja(e,ie,V,n)),he&&(h(ie.lineNumber),ie.lineNumber.appendChild(document.createTextNode(bn(e.options,V)))),U=ie.node.nextSibling}V+=ie.size}for(;U;)U=H(U)}function _a(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ar(e)+"px"}function _o(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,S=r+"px",U=0;U<n.length;U++)if(!n[U].hidden){e.options.fixedGutter&&(n[U].gutter&&(n[U].gutter.style.left=S),n[U].gutterBackground&&(n[U].gutterBackground.style.left=S));var H=n[U].alignable;if(H)for(var G=0;G<H.length;G++)H[G].style.left=S}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Oo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=bn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(o("div",[o("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),S=i.firstChild.offsetWidth,U=i.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-U)+1,r.lineNumWidth=r.lineNumInnerWidth+U,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",_a(e.display),!0}return!1}function Ra(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var S=e[i],U=null;if(typeof S!="string"&&(U=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:S,style:U})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Ro(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],S=i.className,U=i.style,H=t.appendChild(o("div",null,"CodeMirror-gutter "+S));U&&(H.style.cssText=U),S=="CodeMirror-linenumbers"&&(e.lineGutter=H,H.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",_a(e)}function di(e){Ro(e.display),nr(e),_o(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=T("div",null,"CodeMirror-code"),i.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=o("div",null,"CodeMirror-cursors"),i.measure=o("div",null,"CodeMirror-measure"),i.lineMeasure=o("div",null,"CodeMirror-measure"),i.lineSpace=T("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var S=T("div",[i.lineSpace],"CodeMirror-lines");i.mover=o("div",[S],null,"position: relative"),i.sizer=o("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=o("div",null,null,"position: absolute; height: "+ue+"px; width: 1px;"),i.gutters=o("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=o("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=o("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),I&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!O&&!(A&&a)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Ra(r.gutters,r.lineNumbers),Ro(i),n.init(i)}var zi=0,mr=null;I?mr=-.53:A?mr=15:c?mr=-.7:D&&(mr=-1/3);function Po(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Po(e);return t.x*=mr,t.y*=mr,t}function Mo(e,t){var n=Po(t),r=n.x,i=n.y,S=e.display,U=S.scroller,H=U.scrollWidth>U.clientWidth,G=U.scrollHeight>U.clientHeight;if(!(r&&H||i&&G))return;if(i&&s&&O){e:for(var V=t.target,ee=S.view;V!=U;V=V.parentNode)for(var ie=0;ie<ee.length;ie++)if(ee[ie].node==V){e.display.currentWheelTarget=V;break e}}if(r&&!A&&!p&&mr!=null){i&&G&&oi(e,Math.max(0,U.scrollTop+i*mr)),fn(e,Math.max(0,U.scrollLeft+r*mr)),(!i||i&&G)&&Y(t),S.wheelStartX=null;return}if(i&&mr!=null){var me=i*mr,he=e.doc.scrollTop,Te=he+S.wrapper.clientHeight;me<0?he=Math.max(0,he+me-50):Te=Math.min(e.doc.height,Te+me+50),Da(e,{top:he,bottom:Te})}zi<20&&(S.wheelStartX==null?(S.wheelStartX=U.scrollLeft,S.wheelStartY=U.scrollTop,S.wheelDX=r,S.wheelDY=i,setTimeout(function(){if(S.wheelStartX==null)return;var Ce=U.scrollLeft-S.wheelStartX,Ue=U.scrollTop-S.wheelStartY,Ne=Ue&&S.wheelDY&&Ue/S.wheelDY||Ce&&S.wheelDX&&Ce/S.wheelDX;if(S.wheelStartX=S.wheelStartY=null,!Ne)return;mr=(mr*zi+Ne)/(zi+1),++zi},200)):(S.wheelDX+=r,S.wheelDY+=i))}var pr=function(e,t){this.ranges=e,this.primIndex=t};pr.prototype.primary=function(){return this.ranges[this.primIndex]},pr.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(!en(n.anchor,r.anchor)||!en(n.head,r.head))return!1}return!0},pr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new At(tn(this.ranges[t].anchor),tn(this.ranges[t].head));return new pr(e,this.primIndex)},pr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},pr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(mt(t,r.from())>=0&&mt(e,r.to())<=0)return n}return-1};var At=function(e,t){this.anchor=e,this.head=t};At.prototype.from=function(){return En(this.anchor,this.head)},At.prototype.to=function(){return rn(this.anchor,this.head)},At.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Tr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(me,he){return mt(me.from(),he.from())}),n=ne(t,i);for(var S=1;S<t.length;S++){var U=t[S],H=t[S-1],G=mt(H.to(),U.from());if(r&&!U.empty()?G>0:G>=0){var V=En(H.from(),U.from()),ee=rn(H.to(),U.to()),ie=H.empty()?U.from()==U.head:H.from()==H.head;S<=n&&--n,t.splice(--S,2,new At(ie?ee:V,ie?V:ee))}}return new pr(t,n)}function Vr(e,t){return new pr([new At(e,t||e)],0)}function Xr(e){return e.text?Oe(e.from.line+e.text.length-1,be(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ko(e,t){if(mt(e,t.from)<0)return e;if(mt(e,t.to)<=0)return Xr(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+=Xr(t).ch-t.to.ch),Oe(n,r)}function Pa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new At(ko(i.anchor,t),ko(i.head,t)))}return Tr(e.cm,n,e.sel.primIndex)}function Io(e,t,n){return e.line==t.line?Oe(n.line,e.ch-t.ch+n.ch):Oe(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Oe(e.first,0),S=i,U=0;U<t.length;U++){var H=t[U],G=Io(H.from,i,S),V=Io(Xr(H),i,S);if(i=H.to,S=V,n=="around"){var ee=e.sel.ranges[U],ie=mt(ee.head,ee.anchor)<0;r[U]=new At(ie?V:G,ie?G:V)}else r[U]=new At(G,G)}return new pr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=lr(e.options,e.doc.modeOption),ci(e)}function ci(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ui(e,100),e.state.modeGen++,e.curOp&&nr(e)}function Uo(e,t){return t.from.ch==0&&t.to.ch==0&&be(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ka(e,t,n,r){function i($e){return n?n[$e]:null}function S($e,Be,tt){la($e,Be,tt,r),Ot($e,"change",$e,t)}function U($e,Be){for(var tt=[],dt=$e;dt<Be;++dt)tt.push(new Kr(V[dt],i(dt),r));return tt}var H=t.from,G=t.to,V=t.text,ee=ot(e,H.line),ie=ot(e,G.line),me=be(V),he=i(V.length-1),Te=G.line-H.line;if(t.full)e.insert(0,U(0,V.length)),e.remove(V.length,e.size-V.length);else if(Uo(e,t)){var Ce=U(0,V.length-1);S(ie,ie.text,he),Te&&e.remove(H.line,Te),Ce.length&&e.insert(H.line,Ce)}else if(ee==ie)if(V.length==1)S(ee,ee.text.slice(0,H.ch)+me+ee.text.slice(G.ch),he);else{var Ue=U(1,V.length-1);Ue.push(new Kr(me+ee.text.slice(G.ch),he,r)),S(ee,ee.text.slice(0,H.ch)+V[0],i(0)),e.insert(H.line+1,Ue)}else if(V.length==1)S(ee,ee.text.slice(0,H.ch)+V[0]+ie.text.slice(G.ch),i(0)),e.remove(H.line+1,Te);else{S(ee,ee.text.slice(0,H.ch)+V[0],i(0)),S(ie,me+ie.text.slice(G.ch),he);var Ne=U(1,V.length-1);Te>1&&e.remove(H.line+1,Te-1),e.insert(H.line+1,Ne)}Ot(e,"change",e,t)}function Yr(e,t,n){function r(i,S,U){if(i.linked)for(var H=0;H<i.linked.length;++H){var G=i.linked[H];if(G.doc==S)continue;var V=U&&G.sharedHist;if(n&&!V)continue;t(G.doc,V),r(G.doc,i,V)}}r(e,null,!0)}function Fo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ta(e),Ma(e),No(e),e.options.lineWrapping||Pr(e),e.options.mode=t.modeOption,nr(e)}function No(e){(e.doc.direction=="rtl"?N:f)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){cr(e,function(){No(e),nr(e)})}function Vi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ia(e,t){var n={from:tn(t.from),to:Xr(t),text:wr(e,t.from,t.to)};return Wo(e,n,t.from.line,t.to.line+1),Yr(e,function(r){return Wo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=be(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Bo(e.done),be(e.done);if(e.done.length&&!be(e.done).ranges)return be(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),be(e.done)}function jo(e,t,n,r){var i=e.history;i.undone.length=0;var S=+new Date,U,H;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(U=ml(i,i.lastOp==r)))H=be(U.changes),mt(t.from,t.to)==0&&mt(t.from,H.to)==0?H.to=Xr(t):U.changes.push(Ia(e,t));else{var G=be(i.done);for((!G||!G.ranges)&&Xi(e.sel,i.done),U={changes:[Ia(e,t)],generation:i.generation},i.done.push(U);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=S,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,H||ye(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,S=r&&r.origin;n==i.lastSelOp||S&&i.lastSelOrigin==S&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==S||pl(e,S,be(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=S,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function Xi(e,t){var n=be(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(U){U.markedSpans&&((i||(i=t["spans_"+e.id]={}))[S]=U.markedSpans),++S})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Ho(e,t){var n=yl(e,t),r=Rr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var S=n[i],U=r[i];if(S&&U){e:for(var H=0;H<U.length;++H){for(var G=U[H],V=0;V<S.length;++V)if(S[V].marker==G.marker)continue e;S.push(G)}}else U&&(n[i]=U)}return n}function Un(e,t,n){for(var r=[],i=0;i<e.length;++i){var S=e[i];if(S.ranges){r.push(n?pr.prototype.deepCopy.call(S):S);continue}var U=S.changes,H=[];r.push({changes:H});for(var G=0;G<U.length;++G){var V=U[G],ee=void 0;if(H.push({from:V.from,to:V.to,text:V.text}),t)for(var ie in V)(ee=ie.match(/^spans_(\d+)$/))&&(ne(t,Number(ee[1]))>-1&&(be(H)[ie]=V[ie],delete V[ie]))}}return r}function Ua(e,t,n,r){if(r){var i=e.anchor;if(n){var S=mt(t,i)<0;S!=mt(n,i)<0?(i=t,t=n):S!=mt(t,n)<0&&(t=n)}return new At(i,t)}else return new At(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Jt(e,new pr([Ua(e.sel.primary(),t,n,i)],0),r)}function Ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),S=0;S<e.sel.ranges.length;S++)r[S]=Ua(e.sel.ranges[S],t[S],null,i);var U=Tr(e.cm,r,e.sel.primIndex);Jt(e,U,n)}function Fa(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Jt(e,Tr(e.cm,i,e.sel.primIndex),r)}function Go(e,t,n,r){Jt(e,Vr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var S=0;S<i.length;S++)this.ranges[S]=new At(gt(e,i[S].anchor),gt(e,i[S].head))},origin:n&&n.origin};return ye(e,"beforeSelectionChange",e,r),e.cm&&ye(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Tr(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,i=be(r);i&&i.ranges?(r[r.length-1]=t,$i(e,t,n)):Jt(e,t,n)}function Jt(e,t,n){$i(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function $i(e,t,n){(ae(e,"beforeSelectionChange")||e.cm&&ae(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(mt(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&kn(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,le(e.cm)),Ot(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,n,r){for(var i,S=0;S<t.ranges.length;S++){var U=t.ranges[S],H=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],G=Qi(e,U.anchor,H&&H.anchor,n,r),V=Qi(e,U.head,H&&H.head,n,r);(i||G!=U.anchor||V!=U.head)&&(i||(i=t.ranges.slice(0,S)),i[S]=new At(G,V))}return i?Tr(e.cm,i,t.primIndex):t}function Fn(e,t,n,r,i){var S=ot(e,t.line);if(S.markedSpans)for(var U=0;U<S.markedSpans.length;++U){var H=S.markedSpans[U],G=H.marker,V="selectLeft"in G?!G.selectLeft:G.inclusiveLeft,ee="selectRight"in G?!G.selectRight:G.inclusiveRight;if((H.from==null||(V?H.from<=t.ch:H.from<t.ch))&&(H.to==null||(ee?H.to>=t.ch:H.to>t.ch))){if(i&&(ye(G,"beforeCursorEnter"),G.explicitlyCleared))if(S.markedSpans){--U;continue}else break;if(!G.atomic)continue;if(n){var ie=G.find(r<0?1:-1),me=void 0;if((r<0?ee:V)&&(ie=$o(e,ie,-r,ie&&ie.line==t.line?S:null)),ie&&ie.line==t.line&&(me=mt(ie,n))&&(r<0?me<0:me>0))return Fn(e,ie,t,r,i)}var he=G.find(r<0?-1:1);return(r<0?V:ee)&&(he=$o(e,he,r,he.line==t.line?S:null)),he?Fn(e,he,t,r,i):null}}return t}function Qi(e,t,n,r,i){var S=r||1,U=Fn(e,t,n,S,i)||!i&&Fn(e,t,n,S,!0)||Fn(e,t,n,-S,i)||!i&&Fn(e,t,n,-S,!0);return U||(e.cantEdit=!0,Oe(e.first,0))}function $o(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?gt(e,Oe(t.line-1)):null:n>0&&t.ch==(r||ot(e,t.line)).text.length?t.line<e.first+e.size-1?Oe(t.line+1,0):null:new Oe(t.line,t.ch+n)}function Qo(e){e.setSelection(Oe(e.firstLine(),0),Oe(e.lastLine()),pe)}function Jo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,S,U,H){i&&(r.from=gt(e,i)),S&&(r.to=gt(e,S)),U&&(r.text=U),H!==void 0&&(r.origin=H)}),ye(e,"beforeChange",e,r),e.cm&&ye(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 Nn(e,t,n){if(e.cm){if(!e.cm.curOp)return zt(e.cm,Nn)(e,t,n);if(e.cm.state.suppressEdits)return}if((ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Ri&&!n&&oa(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Zo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&mt(t.from,t.to)==0)return;var n=Pa(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),fi(e,t,n,Rr(e,t));var r=[];Yr(e,function(i,S){!S&&ne(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),fi(i,t,null,Rr(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,S,U=e.sel,H=t=="undo"?i.done:i.undone,G=t=="undo"?i.undone:i.done,V=0;V<H.length&&!(S=H[V],n?S.ranges&&!S.equals(e.sel):!S.ranges);V++);if(V==H.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(S=H.pop(),S.ranges){if(Xi(S,G),n&&!S.equals(e.sel)){Jt(e,S,{clearRedo:!1});return}U=S}else if(r){H.push(S);return}else break;var ee=[];Xi(U,G),G.push({changes:ee,generation:i.generation}),i.generation=S.generation||++i.maxGeneration;for(var ie=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),me=function(Ce){var Ue=S.changes[Ce];if(Ue.origin=t,ie&&!Jo(e,Ue,!1))return H.length=0,{};ee.push(Ia(e,Ue));var Ne=Ce?Pa(e,Ue):be(H);fi(e,Ue,Ne,Ho(e,Ue)),!Ce&&e.cm&&e.cm.scrollIntoView({from:Ue.from,to:Xr(Ue)});var $e=[];Yr(e,function(Be,tt){!tt&&ne($e,Be.history)==-1&&(rs(Be.history,Ue),$e.push(Be.history)),fi(Be,Ue,null,Ho(Be,Ue))})},he=S.changes.length-1;he>=0;--he){var Te=me(he);if(Te)return Te.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new pr(Me(e.sel.ranges,function(i){return new At(Oe(i.anchor.line+t,i.anchor.ch),Oe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){nr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Gr(e.cm,r,"gutter")}}function fi(e,t,n,r){if(e.cm&&!e.cm.curOp)return zt(e.cm,fi)(e,t,n,r);if(t.to.line<e.first){qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);qo(e,i),t={from:Oe(e.first,0),to:Oe(t.to.line+i,t.to.ch),text:[be(t.text)],origin:t.origin}}var S=e.lastLine();t.to.line>S&&(t={from:t.from,to:Oe(S,ot(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=wr(e,t.from,t.to),n||(n=Pa(e,t)),e.cm?El(e.cm,t,r):ka(e,t,r),$i(e,n,pe),e.cantEdit&&Qi(e,Oe(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,S=t.from,U=t.to,H=!1,G=S.line;e.options.lineWrapping||(G=Lt(Qt(ot(r,S.line))),r.iter(G,U.line+1,function(he){if(he==i.maxLine)return H=!0,!0})),r.sel.contains(t.from,t.to)>-1&&le(e),ka(r,t,n,go(e)),e.options.lineWrapping||(r.iter(G,S.line+t.text.length,function(he){var Te=_n(he);Te>i.maxLineLength&&(i.maxLine=he,i.maxLineLength=Te,i.maxLineChanged=!0,H=!1)}),H&&(e.curOp.updateMaxLine=!0)),Oi(r,S.line),ui(e,400);var V=t.text.length-(U.line-S.line)-1;t.full?nr(e):S.line==U.line&&t.text.length==1&&!Uo(e.doc,t)?Gr(e,S.line,"text"):nr(e,S.line,U.line+1,V);var ee=ae(e,"changes"),ie=ae(e,"change");if(ie||ee){var me={from:S,to:U,text:t.text,removed:t.removed,origin:t.origin};ie&&Ot(e,"change",e,me),ee&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(me)}e.display.selForContextMenu=null}function Bn(e,t,n,r,i){var S;r||(r=n),mt(r,n)<0&&(S=[r,n],n=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),Nn(e,{from:n,to:r,text:t,origin:i})}function es(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,n,r){for(var i=0;i<e.length;++i){var S=e[i],U=!0;if(S.ranges){S.copied||(S=e[i]=S.deepCopy(),S.copied=!0);for(var H=0;H<S.ranges.length;H++)es(S.ranges[H].anchor,t,n,r),es(S.ranges[H].head,t,n,r);continue}for(var G=0;G<S.changes.length;++G){var V=S.changes[G];if(n<V.from.line)V.from=Oe(V.from.line+r,V.from.ch),V.to=Oe(V.to.line+r,V.to.ch);else if(t<=V.to.line){U=!1;break}}U||(e.splice(0,i+1),i=0)}}function rs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ts(e.done,n,r,i),ts(e.undone,n,r,i)}function hi(e,t,n,r){var i=t,S=t;return typeof t=="number"?S=ot(e,Yn(e,t)):i=Lt(t),i==null?null:(r(S,i)&&e.cm&&Gr(e.cm,i,n),S)}function mi(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}mi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,ua(i),Ot(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function pi(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}pi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var S=Math.min(t,i-e),U=r.height;if(r.removeInner(e,S),this.height-=U-r.height,i==S&&(this.children.splice(n--,1),r.parent=null),(t-=S)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof mi))){var H=[];this.collapse(H),this.children=[new mi(H)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],S=i.chunkSize();if(e<=S){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var U=i.lines.length%25+25,H=U;H<i.lines.length;){var G=new mi(i.lines.slice(H,H+=25));i.height-=G.height,this.children.splice(++r,0,G),G.parent=this}i.lines=i.lines.slice(0,U),this.maybeSpill()}break}e-=S}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new pi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ne(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new pi(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],S=i.chunkSize();if(e<S){var U=Math.min(t,S-e);if(i.iterN(e,U,n))return!0;if((t-=U)==0)break;e=0}else e-=S}}};var gi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};gi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Lt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var S=ri(this);hr(n,Math.max(0,n.height-S)),e&&(cr(e,function(){ns(e,n,-S),Gr(e,r,"widget")}),Ot(e,"lineWidgetCleared",e,this,r))},gi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ri(this)-t;if(!i)return;Er(this.doc,r)||hr(r,r.height+i),n&&cr(n,function(){n.curOp.forceUpdate=!0,ns(n,r,i),Ot(n,"lineWidgetChanged",n,e,Lt(r))})},oe(gi);function ns(e,t,n){dr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&La(e,n)}function xl(e,t,n,r){var i=new gi(e,n,r),S=e.cm;return S&&i.noHScroll&&(S.display.alignWidgets=!0),hi(e,t,"widget",function(U){var H=U.widgets||(U.widgets=[]);if(i.insertAt==null?H.push(i):H.splice(Math.min(H.length-1,Math.max(0,i.insertAt)),0,i),i.line=U,S&&!Er(e,U)){var G=dr(U)<e.scrollTop;hr(U,U.height+ri(i)),G&&La(S,i.height),S.curOp.forceUpdate=!0}return!0}),S&&Ot(S,"lineWidgetAdded",S,i,typeof t=="number"?t:Lt(t)),i}var is=0,$r=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};$r.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&mn(e),ae(this,"clear")){var n=this.find();n&&Ot(this,"clear",n.from,n.to)}for(var r=null,i=null,S=0;S<this.lines.length;++S){var U=this.lines[S],H=Nr(U.markedSpans,this);e&&!this.collapsed?Gr(e,Lt(U),"text"):e&&(H.to!=null&&(i=Lt(U)),H.from!=null&&(r=Lt(U))),U.markedSpans=Br(U.markedSpans,H),H.from==null&&this.collapsed&&!Er(this.doc,U)&&e&&hr(U,Rn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var G=0;G<this.lines.length;++G){var V=Qt(this.lines[G]),ee=_n(V);ee>e.display.maxLineLength&&(e.display.maxLine=V,e.display.maxLineLength=ee,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&nr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&Ot(e,"markerCleared",e,this,r,i),t&&pn(e),this.parent&&this.parent.clear()},$r.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var S=this.lines[i],U=Nr(S.markedSpans,this);if(U.from!=null&&(n=Oe(t?S:Lt(S),U.from),e==-1))return n;if(U.to!=null&&(r=Oe(t?S:Lt(S),U.to),e==1))return r}return n&&{from:n,to:r}},$r.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;cr(r,function(){var i=t.line,S=Lt(t.line),U=ma(r,S);if(U&&(so(U),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Er(n.doc,i)&&n.height!=null){var H=n.height;n.height=null;var G=ri(n)-H;G&&hr(i,i.height+G)}Ot(r,"markerChanged",r,e)})},$r.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ne(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},$r.prototype.detachLine=function(e){if(this.lines.splice(ne(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},oe($r);function jn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return zt(e.cm,jn)(e,t,n,r,i);var S=new $r(e,i),U=mt(t,n);if(r&&F(r,S,!1),U>0||U==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=T("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(ei(e,t.line,t,n,S)||t.line!=n.line&&ei(e,n.line,t,n,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");Pi()}S.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var H=t.line,G=e.cm,V;if(e.iter(H,n.line+1,function(ie){G&&S.collapsed&&!G.options.lineWrapping&&Qt(ie)==G.display.maxLine&&(V=!0),S.collapsed&&H!=t.line&&hr(ie,0),jr(ie,new Tn(S,H==t.line?t.ch:null,H==n.line?n.ch:null)),++H}),S.collapsed&&e.iter(t.line,n.line+1,function(ie){Er(e,ie)&&hr(ie,0)}),S.clearOnEnter&&ve(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Lr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++is,S.atomic=!0),G){if(V&&(G.curOp.updateMaxLine=!0),S.collapsed)nr(G,t.line,n.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var ee=t.line;ee<=n.line;ee++)Gr(G,ee,"text");S.atomic&&Xo(G.doc),Ot(G,"markerAdded",G,S)}return S}var vi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};vi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Ot(this,"clear")},vi.prototype.find=function(e,t){return this.primary.find(e,t)},oe(vi);function Tl(e,t,n,r,i){r=F(r),r.shared=!1;var S=[jn(e,t,n,r,i)],U=S[0],H=r.widgetNode;return Yr(e,function(G){H&&(r.widgetNode=H.cloneNode(!0)),S.push(jn(G,gt(G,t),gt(G,n),r,i));for(var V=0;V<G.linked.length;++V)if(G.linked[V].isParent)return;U=be(S)}),new vi(S,U)}function as(e){return e.findMarks(Oe(e.first,0),e.clipPos(Oe(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),S=e.clipPos(i.from),U=e.clipPos(i.to);if(mt(S,U)){var H=jn(e,S,U,r.primary,r.primary.type);r.markers.push(H),H.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],S=[i.primary.doc];Yr(i.primary.doc,function(G){return S.push(G)});for(var U=0;U<i.markers.length;U++){var H=i.markers[U];ne(S,H.doc)==-1&&(H.parent=null,i.markers.splice(U--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,ir=function(e,t,n,r,i){if(!(this instanceof ir))return new ir(e,t,n,r,i);n==null&&(n=0),pi.call(this,[new mi([new Kr("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var S=Oe(n,0);this.sel=Vr(S),this.history=new Vi(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ka(this,{from:S,to:S,text:e}),Jt(this,Vr(S),pe)};ir.prototype=He(pi.prototype,{constructor:ir,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=Xn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Vt(function(e){var t=Oe(this.first,0),n=this.first+this.size-1;Nn(this,{from:t,to:Oe(n,ot(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ai(this.cm,0,0),Jt(this,Vr(t),pe)}),replaceRange:function(e,t,n,r){t=gt(this,t),n=n?gt(this,n):t,Bn(this,e,t,n,r)},getRange:function(e,t,n){var r=wr(this,gt(this,e),gt(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(qr(this,e))return ot(this,e)},getLineNumber:function(e){return Lt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ot(this,e)),Qt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return gt(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:Vt(function(e,t,n){Go(this,gt(this,typeof e=="number"?Oe(e,t||0):e),null,n)}),setSelection:Vt(function(e,t,n){Go(this,gt(this,e),gt(this,t||e),n)}),extendSelection:Vt(function(e,t,n){Yi(this,gt(this,e),t&>(this,t),n)}),extendSelections:Vt(function(e,t){Ko(this,Li(this,e),t)}),extendSelectionsBy:Vt(function(e,t){var n=Me(this.sel.ranges,e);Ko(this,Li(this,n),t)}),setSelections:Vt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new At(gt(this,e[i].anchor),gt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Jt(this,Tr(this.cm,r,t),n)}),addSelection:Vt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new At(gt(this,e),gt(this,t||e))),Jt(this,Tr(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=wr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=wr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Vt(function(e,t,n){for(var r=[],i=this.sel,S=0;S<i.ranges.length;S++){var U=i.ranges[S];r[S]={from:U.from(),to:U.to(),text:this.splitLines(e[S]),origin:n}}for(var H=t&&t!="end"&&fl(this,r,t),G=r.length-1;G>=0;G--)Nn(this,r[G]);H?zo(this,H):this.cm&&kn(this.cm)}),undo:Vt(function(){Ji(this,"undo")}),redo:Vt(function(){Ji(this,"redo")}),undoSelection:Vt(function(){Ji(this,"undo",!0)}),redoSelection:Vt(function(){Ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Vi(this.history.maxGeneration),Yr(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:Un(this.history.done),undone:Un(this.history.undone)}},setHistory:function(e){var t=this.history=new Vi(this.history.maxGeneration);t.done=Un(e.done.slice(0),null,!0),t.undone=Un(e.undone.slice(0),null,!0)},setGutterMarker:Vt(function(e,t,n){return hi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Ke(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Vt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&hi(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(!qr(this,e))return null;if(t=e,e=ot(this,e),!e)return null}else if(t=Lt(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:Vt(function(e,t,n){return hi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(x(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Vt(function(e,t,n){return hi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",S=r[i];if(S)if(n==null)r[i]=null;else{var U=S.match(x(n));if(!U)return!1;var H=U.index+U[0].length;r[i]=S.slice(0,U.index)+(!U.index||H==S.length?"":" ")+S.slice(H)||null}else return!1;return!0})}),addLineWidget:Vt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return jn(this,gt(this,e),gt(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=gt(this,e),jn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=gt(this,e);var t=[],n=ot(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=gt(this,e),t=gt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(S){var U=S.markedSpans;if(U)for(var H=0;H<U.length;H++){var G=U[H];!(G.to!=null&&i==e.line&&e.ch>=G.to||G.from==null&&i!=e.line||G.from!=null&&i==t.line&&G.from>=t.ch)&&(!n||n(G.marker))&&r.push(G.marker.parent||G.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var S=i.text.length+r;if(S>e)return t=e,!0;e-=S,++n}),gt(this,Oe(n,t))},indexFromPos:function(e){e=gt(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 ir(Xn(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 ir(Xn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,as(this)),r},unlinkDoc:function(e){if(e instanceof kt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(as(this));break}if(e.history==this.history){var r=[e.id];Yr(e,function(i){return r.push(i.id)},!0),e.history=new Vi(null),e.history.done=Un(this.history.done,r),e.history.undone=Un(this.history.undone,r)}},iterLinkedDocs:function(e){Yr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):it(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Vt(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)})}),ir.prototype.eachLine=ir.prototype.iter;var os=0;function Ll(e){var t=this;if(ss(t),Ae(t,e)||kr(t.display,e))return;Y(e),I&&(os=+new Date);var n=dn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,S=Array(i),U=0,H=function(){++U==i&&zt(t,function(){n=gt(t.doc,n);var he={from:n,to:n,text:t.doc.splitLines(S.filter(function(Te){return Te!=null}).join(t.doc.lineSeparator())),origin:"paste"};Nn(t.doc,he),zo(t.doc,Vr(gt(t.doc,n),gt(t.doc,Xr(he))))})()},G=function(he,Te){if(t.options.allowDropFileTypes&&ne(t.options.allowDropFileTypes,he.type)==-1){H();return}var Ce=new FileReader;Ce.onerror=function(){return H()},Ce.onload=function(){var Ue=Ce.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ue)){H();return}S[Te]=Ue,H()},Ce.readAsText(he)},V=0;V<r.length;V++)G(r[V],V);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ee=e.dataTransfer.getData("Text");if(ee){var ie;if(t.state.draggingText&&!t.state.draggingText.copy&&(ie=t.listSelections()),$i(t.doc,Vr(n,n)),ie)for(var me=0;me<ie.length;++me)Bn(t.doc,"",ie[me].anchor,ie[me].head,"drag");t.replaceSelection(ee,"around","paste"),t.display.input.focus()}}catch(he){}}}function Al(e,t){if(I&&(!e.state.draggingText||+new Date-os<100)){te(t);return}if(Ae(e,t)||kr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!D){var n=o("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),p&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=dn(e,t);if(!n)return;var r=document.createDocumentFragment();bo(e,n,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var S=0;S<n.length;S++)e(n[S])})}var us=!1;function _l(){if(us)return;Ol(),us=!0}function Ol(){var e;ve(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Rl)},100))}),ve(window,"blur",function(){return ls(Mn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Qr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},yi=0;yi<10;yi++)Qr[yi+48]=Qr[yi+96]=String(yi);for(var Zi=65;Zi<=90;Zi++)Qr[Zi]=String.fromCharCode(Zi);for(var bi=1;bi<=12;bi++)Qr[bi+111]=Qr[bi+63235]="F"+bi;var Ir={};Ir.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"},Ir.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"},Ir.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"},Ir.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"]},Ir.default=s?Ir.macDefault:Ir.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,S,U=0;U<t.length-1;U++){var H=t[U];if(/^(cmd|meta|m)$/i.test(H))S=!0;else if(/^a(lt)?$/i.test(H))n=!0;else if(/^(c|ctrl|control)$/i.test(H))r=!0;else if(/^s(hift)?$/i.test(H))i=!0;else throw new Error("Unrecognized modifier name: "+H)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),S&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=Me(n.split(" "),Pl),S=0;S<i.length;S++){var U=void 0,H=void 0;S==i.length-1?(H=i.join(" "),U=r):(H=i.slice(0,S+1).join(" "),U="...");var G=t[H];if(!G)t[H]=U;else if(G!=U)throw new Error("Inconsistent bindings for "+H)}delete e[n]}for(var V in t)e[V]=t[V];return e}function Wn(e,t,n,r){t=qi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Wn(e,t.fallthrough,n,r);for(var S=0;S<t.fallthrough.length;S++){var U=Wn(e,t.fallthrough[S],n,r);if(U)return U}}}function ds(e){var t=typeof e=="string"?e:Qr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(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 fs(e,t){if(p&&e.keyCode==34&&e.char)return!1;var n=Qr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),cs(n,e,t))}function qi(e){return typeof e=="string"?Ir[e]:e}function Hn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var S=t(n[i]);r.length&&mt(S.from,be(r).to)<=0;){var U=r.pop();if(mt(U.from,S.from)<0){S.from=U.from;break}}r.push(S)}cr(e,function(){for(var H=r.length-1;H>=0;H--)Bn(e.doc,"",r[H].from,r[H].to,"+delete");kn(e)})}function Na(e,t,n){var r=Le(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Na(e,t.ch,n);return r==null?null:new Oe(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var S=ze(n,t.doc.direction);if(S){var U=i<0?be(S):S[0],H=i<0==(U.level==1),G=H?"after":"before",V;if(U.level>0||t.doc.direction=="rtl"){var ee=On(t,n);V=i<0?n.text.length-1:0;var ie=Dr(t,ee,V).top;V=rt(function(me){return Dr(t,ee,me).top==ie},i<0==(U.level==1)?U.from:U.to-1,V),G=="before"&&(V=Na(n,V,1))}else V=i<0?U.to:U.from;return new Oe(r,V,G)}}return new Oe(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=ze(t,e.doc.direction);if(!i)return Ba(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var S=We(i,n.ch,n.sticky),U=i[S];if(e.doc.direction=="ltr"&&U.level%2==0&&(r>0?U.to>n.ch:U.from<n.ch))return Ba(t,n,r);var H=function(Ne,$e){return Na(t,Ne instanceof Oe?Ne.ch:Ne,$e)},G,V=function(Ne){return e.options.lineWrapping?(G=G||On(e,t),po(e,t,G,Ne)):{begin:0,end:t.text.length}},ee=V(n.sticky=="before"?H(n,-1):n.ch);if(e.doc.direction=="rtl"||U.level==1){var ie=U.level==1==r<0,me=H(n,ie?1:-1);if(me!=null&&(ie?me<=U.to&&me<=ee.end:me>=U.from&&me>=ee.begin)){var he=ie?"before":"after";return new Oe(n.line,me,he)}}var Te=function(Ne,$e,Be){for(var tt=function(Pt,Xt){return Xt?new Oe(n.line,H(Pt,1),"before"):new Oe(n.line,Pt,"after")};Ne>=0&&Ne<i.length;Ne+=$e){var dt=i[Ne],lt=$e>0==(dt.level!=1),bt=lt?Be.begin:H(Be.end,-1);if(dt.from<=bt&&bt<dt.to)return tt(bt,lt);if(bt=lt?dt.from:H(dt.to,-1),Be.begin<=bt&&bt<Be.end)return tt(bt,lt)}},Ce=Te(S+r,r,ee);if(Ce)return Ce;var Ue=r>0?ee.end:H(ee.begin,-1);return Ue!=null&&!(r>0&&Ue==t.text.length)&&(Ce=Te(r>0?0:i.length-1,r,V(Ue)),Ce)?Ce:null}var Ei={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),pe)},killLine:function(e){return Hn(e,function(t){if(t.empty()){var n=ot(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Oe(t.head.line+1,0)}:{from:t.head,to:Oe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Hn(e,function(t){return{from:Oe(t.from().line,0),to:gt(e.doc,Oe(t.to().line+1,0))}})},delLineLeft:function(e){return Hn(e,function(t){return{from:Oe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Hn(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 Hn(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(Oe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Oe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ms(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},de)},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")},de)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?ms(e,t.head):r},de)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var S=n[i].from(),U=X(e.getLine(S.line),S.ch,r);t.push(se(r-U%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return cr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,S=ot(e.doc,i.line).text;if(S){if(i.ch==S.length&&(i=new Oe(i.line,i.ch-1)),i.ch>0)i=new Oe(i.line,i.ch+1),e.replaceRange(S.charAt(i.ch-1)+S.charAt(i.ch-2),Oe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var U=ot(e.doc,i.line-1).text;U&&(i=new Oe(i.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+U.charAt(U.length-1),Oe(i.line-1,U.length-1),i,"+transpose"))}}n.push(new At(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return cr(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);kn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var n=ot(e.doc,t),r=Qt(n);return r!=n&&(t=Lt(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=ot(e.doc,t),r=Wr(n);return r!=n&&(t=Lt(r)),ja(!0,e,n,t,-1)}function ms(e,t){var n=hs(e,t.line),r=ot(e.doc,n.line),i=ze(r,e.doc.direction);if(!i||i[0].level==0){var S=Math.max(n.ch,r.text.search(/\S/)),U=t.line==n.line&&t.ch<=S&&t.ch;return Oe(n.line,U?0:S,n.sticky)}return n}function ea(e,t,n){if(typeof t=="string"&&(t=Ei[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=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=Wn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Wn(t,e.options.extraKeys,n,e)||Wn(t,e.options.keyMap,n,e)}var Fl=new q;function xi(e,t,n,r){var i=e.state.keySeq;if(i){if(ds(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())}),ps(e,i+" "+t,n,r))return!0}return ps(e,t,n,r)}function ps(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Ot(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),Sa(e)),!!i}function gs(e,t){var n=fs(t,!0);return n?t.shiftKey&&!e.state.keySeq?xi(e,"Shift-"+n,t,function(r){return ea(e,r,!0)})||xi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):xi(e,n,t,function(r){return ea(e,r)}):!1}function Nl(e,t,n){return xi(e,"'"+n+"'",t,function(r){return ea(e,r,!0)})}var Wa=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=R(),Ae(t,e))return;I&&k<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=gs(t,e);p&&(Wa=r?n:null,!r&&n==88&&!xt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),A&&!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;N(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(f(t,"CodeMirror-crosshair"),Xe(document,"keyup",n),Xe(document,"mouseover",n))}ve(document,"keyup",n),ve(document,"mouseover",n)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ae(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(kr(t.display,e)||Ae(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(p&&n==Wa){Wa=null,Y(e);return}if(p&&(!e.which||e.which<10)&&gs(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,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&mt(t,this.pos)==0&&n==this.button};var Ti,Si;function Wl(e,t){var n=+new Date;return Si&&Si.compare(n,e,t)?(Ti=Si=null,"triple"):Ti&&Ti.compare(n,e,t)?(Si=new Ha(n,e,t),Ti=null,"double"):(Ti=new Ha(n,e,t),Si=null,"single")}function Es(e){var t=this,n=t.display;if(Ae(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,kr(n,e)){O||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=dn(t,e),i=xe(e),S=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,S,e))return;i==1?r?Gl(t,r,S,e):ge(e)==n.scroller&&Y(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(L?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,i){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,xi(e,cs(S,i),i,function(U){if(typeof U=="string"&&(U=Ei[U]),!U)return!1;var H=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),H=U(e,n)!=Ee}finally{e.state.suppressEdits=!1}return H})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var S=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=S?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){I?setTimeout(j(Eo,e),0):e.curOp.focus=R();var i=Kl(e,n,r),S=e.doc.sel,U;e.options.dragDrop&&Pe&&!e.isReadOnly()&&n=="single"&&(U=S.contains(t))>-1&&(mt((U=S.ranges[U]).from(),t)<0||t.xRel>0)&&(mt(U.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,S=!1,U=zt(e,function(V){O&&(i.scroller.draggable=!1),e.state.draggingText=!1,Xe(i.wrapper.ownerDocument,"mouseup",U),Xe(i.wrapper.ownerDocument,"mousemove",H),Xe(i.scroller,"dragstart",G),Xe(i.scroller,"drop",U),S||(Y(V),r.addNew||Yi(e.doc,n,null,null,r.extend),O&&!D||I&&k==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),H=function(V){S=S||Math.abs(t.clientX-V.clientX)+Math.abs(t.clientY-V.clientY)>=10},G=function(){return S=!0};O&&(i.scroller.draggable=!0),e.state.draggingText=U,U.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),ve(i.wrapper.ownerDocument,"mouseup",U),ve(i.wrapper.ownerDocument,"mousemove",H),ve(i.scroller,"dragstart",G),ve(i.scroller,"drop",U),xo(e),setTimeout(function(){return i.input.focus()},20)}function xs(e,t,n){if(n=="char")return new At(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new At(Oe(t.line,0),gt(e.doc,Oe(t.line+1,0)));var r=n(e,t);return new At(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,S=e.doc;Y(t);var U,H,G=S.sel,V=G.ranges;if(r.addNew&&!r.extend?(H=S.sel.contains(n),H>-1?U=V[H]:U=new At(n,n)):(U=S.sel.primary(),H=S.sel.primIndex),r.unit=="rectangle")r.addNew||(U=new At(n,n)),n=dn(e,t,!0,!0),H=-1;else{var ee=xs(e,n,r.unit);r.extend?U=Ua(U,ee.anchor,ee.head,r.extend):U=ee}r.addNew?H==-1?(H=V.length,Jt(S,Tr(e,V.concat([U]),H),{scroll:!1,origin:"*mouse"})):V.length>1&&V[H].empty()&&r.unit=="char"&&!r.extend?(Jt(S,Tr(e,V.slice(0,H).concat(V.slice(H+1)),0),{scroll:!1,origin:"*mouse"}),G=S.sel):Fa(S,H,U,fe):(H=0,Jt(S,new pr([U],0),fe),G=S.sel);var ie=n;function me(Be){if(mt(ie,Be)==0)return;if(ie=Be,r.unit=="rectangle"){for(var tt=[],dt=e.options.tabSize,lt=X(ot(S,n.line).text,n.ch,dt),bt=X(ot(S,Be.line).text,Be.ch,dt),Pt=Math.min(lt,bt),Xt=Math.max(lt,bt),Ut=Math.min(n.line,Be.line),fr=Math.min(e.lastLine(),Math.max(n.line,Be.line));Ut<=fr;Ut++){var ar=ot(S,Ut).text,jt=ce(ar,Pt,dt);Pt==Xt?tt.push(new At(Oe(Ut,jt),Oe(Ut,jt))):ar.length>jt&&tt.push(new At(Oe(Ut,jt),Oe(Ut,ce(ar,Xt,dt))))}tt.length||tt.push(new At(n,n)),Jt(S,Tr(e,G.ranges.slice(0,H).concat(tt),H),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Be)}else{var or=U,$t=xs(e,Be,r.unit),Gt=or.anchor,Wt;mt($t.anchor,Gt)>0?(Wt=$t.head,Gt=En(or.from(),$t.anchor)):(Wt=$t.anchor,Gt=rn(or.to(),$t.head));var Nt=G.ranges.slice(0);Nt[H]=Xl(e,new At(gt(S,Gt),Wt)),Jt(S,Tr(e,Nt,H),fe)}}var he=i.wrapper.getBoundingClientRect(),Te=0;function Ce(Be){var tt=++Te,dt=dn(e,Be,!0,r.unit=="rectangle");if(!dt)return;if(mt(dt,ie)!=0){e.curOp.focus=R(),me(dt);var lt=Hi(i,S);(dt.line>=lt.to||dt.line<lt.from)&&setTimeout(zt(e,function(){Te==tt&&Ce(Be)}),150)}else{var bt=Be.clientY<he.top?-20:Be.clientY>he.bottom?20:0;bt&&setTimeout(zt(e,function(){if(Te!=tt)return;i.scroller.scrollTop+=bt,Ce(Be)}),50)}}function Ue(Be){e.state.selectingText=!1,Te=Infinity,Be&&(Y(Be),i.input.focus()),Xe(i.wrapper.ownerDocument,"mousemove",Ne),Xe(i.wrapper.ownerDocument,"mouseup",$e),S.history.lastSelOrigin=null}var Ne=zt(e,function(Be){Be.buttons===0||!xe(Be)?Ue(Be):Ce(Be)}),$e=zt(e,Ue);e.state.selectingText=$e,ve(i.wrapper.ownerDocument,"mousemove",Ne),ve(i.wrapper.ownerDocument,"mouseup",$e)}function Xl(e,t){var n=t.anchor,r=t.head,i=ot(e.doc,n.line);if(mt(n,r)==0&&n.sticky==r.sticky)return t;var S=ze(i);if(!S)return t;var U=We(S,n.ch,n.sticky),H=S[U];if(H.from!=n.ch&&H.to!=n.ch)return t;var G=U+(H.from==n.ch==(H.level!=1)?0:1);if(G==0||G==S.length)return t;var V;if(r.line!=n.line)V=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ee=We(S,r.ch,r.sticky),ie=ee-U||(r.ch-n.ch)*(H.level==1?-1:1);ee==G-1||ee==G?V=ie<0:V=ie>0}var me=S[G+(V?-1:0)],he=V==(me.level==1),Te=he?me.from:me.to,Ce=he?"after":"before";return n.ch==Te&&n.sticky==Ce?t:new At(new Oe(n.line,Te,Ce),r)}function Ts(e,t,n,r){var i,S;if(t.touches)i=t.touches[0].clientX,S=t.touches[0].clientY;else try{i=t.clientX,S=t.clientY}catch(me){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Y(t);var U=e.display,H=U.lineDiv.getBoundingClientRect();if(S>H.bottom||!ae(e,n))return Z(t);S-=H.top-U.viewOffset;for(var G=0;G<e.display.gutterSpecs.length;++G){var V=U.gutters.childNodes[G];if(V&&V.getBoundingClientRect().right>=i){var ee=Cr(e.doc,S),ie=e.display.gutterSpecs[G];return ye(e,n,e,ee,ie.className,t),Z(t)}}}function Ka(e,t){return Ts(e,t,"gutterClick",!0)}function Ss(e,t){if(kr(e.display,t)||Yl(e,t))return;if(Ae(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ae(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function ws(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ni(e)}var Kn={toString:function(){return"CodeMirror.Init"}},Cs={},ta={};function $l(e){var t=e.optionHandlers;function n(r,i,S,U){e.defaults[r]=i,S&&(t[r]=U?function(H,G,V){V!=Kn&&S(H,G,V)}:S)}e.defineOption=n,e.Init=Kn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ma(r)},!0),n("indentUnit",2,Ma,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){ci(r),ni(r),nr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var S=[],U=r.doc.first;r.doc.iter(function(G){for(var V=0;;){var ee=G.text.indexOf(i,V);if(ee==-1)break;V=ee+i.length,S.push(Oe(U,ee))}U++});for(var H=S.length-1;H>=0;H--)Bn(r.doc,i,S[H],Oe(S[H].line,S[H].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,S){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),S!=Kn&&r.refresh()}),n("specialCharPlaceholder",at,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!C),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ws(r),di(r)},!0),n("keyMap","default",function(r,i,S){var U=qi(i),H=S!=Kn&&qi(S);H&&H.detach&&H.detach(r,U),U.attach&&U.attach(r,H||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Ra(i,r.options.lineNumbers),di(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return In(r)},!0),n("scrollbarStyle","native",function(r){Ao(r),In(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Ra(r.options.gutters,i),di(r)},!0),n("firstLineNumber",1,di,!0),n("lineNumberFormatter",function(r){return r},di,!0),n("showCursorWhenSelecting",!1,ii,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Mn(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,ii,!0),n("singleCursorHeightPerLine",!0,ii,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ci,!0),n("addModeClass",!1,ci,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,ci,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Kn;if(!t!=!r){var i=e.display.dragFunctions,S=t?ve:Xe;S(e.display.scroller,"dragstart",i.start),S(e.display.scroller,"dragenter",i.enter),S(e.display.scroller,"dragover",i.over),S(e.display.scroller,"dragleave",i.leave),S(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(N(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),Pr(e)),Ta(e),nr(e),ni(e),setTimeout(function(){return In(e)},100)}function kt(e,t){var n=this;if(!(this instanceof kt))return new kt(e,t);this.options=t=t?F(t):{},F(Cs,t,!1);var r=t.value;typeof r=="string"?r=new ir(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new kt.inputStyles[t.inputStyle](this),S=this.display=new dl(e,r,i,t);S.wrapper.CodeMirror=this,ws(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new q,keySeq:null,specialChars:null},t.autofocus&&!a&&S.input.focus(),I&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),_l(),mn(this),this.curOp.forceUpdate=!0,Fo(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&wa(n)},20):Mn(this);for(var U in ta)ta.hasOwnProperty(U)&&ta[U](this,t[U],Kn);Oo(this),t.finishInit&&t.finishInit(this);for(var H=0;H<Ga.length;++H)Ga[H](this);pn(this),O&&t.lineWrapping&&getComputedStyle(S.lineDiv).textRendering=="optimizelegibility"&&(S.lineDiv.style.textRendering="auto")}kt.defaults=Cs,kt.optionHandlers=ta;function Zl(e){var t=e.display;ve(t.scroller,"mousedown",zt(e,Es)),I&&k<11?ve(t.scroller,"dblclick",zt(e,function(G){if(Ae(e,G))return;var V=dn(e,G);if(!V||Ka(e,G)||kr(e.display,G))return;Y(G);var ee=e.findWordAt(V);Yi(e.doc,ee.anchor,ee.head)})):ve(t.scroller,"dblclick",function(G){return Ae(e,G)||Y(G)}),ve(t.scroller,"contextmenu",function(G){return Ss(e,G)}),ve(t.input.getField(),"contextmenu",function(G){t.scroller.contains(G.target)||Ss(e,G)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function S(G){if(G.touches.length!=1)return!1;var V=G.touches[0];return V.radiusX<=1&&V.radiusY<=1}function U(G,V){if(V.left==null)return!0;var ee=V.left-G.left,ie=V.top-G.top;return ee*ee+ie*ie>20*20}ve(t.scroller,"touchstart",function(G){if(!Ae(e,G)&&!S(G)&&!Ka(e,G)){t.input.ensurePolled(),clearTimeout(n);var V=+new Date;t.activeTouch={start:V,moved:!1,prev:V-r.end<=300?r:null},G.touches.length==1&&(t.activeTouch.left=G.touches[0].pageX,t.activeTouch.top=G.touches[0].pageY)}}),ve(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ve(t.scroller,"touchend",function(G){var V=t.activeTouch;if(V&&!kr(t,G)&&V.left!=null&&!V.moved&&new Date-V.start<300){var ee=e.coordsChar(t.activeTouch,"page"),ie;!V.prev||U(V,V.prev)?ie=new At(ee,ee):!V.prev.prev||U(V,V.prev.prev)?ie=e.findWordAt(ee):ie=new At(Oe(ee.line,0),gt(e.doc,Oe(ee.line+1,0))),e.setSelection(ie.anchor,ie.head),e.focus(),Y(G)}i()}),ve(t.scroller,"touchcancel",i),ve(t.scroller,"scroll",function(){t.scroller.clientHeight&&(oi(e,t.scroller.scrollTop),fn(e,t.scroller.scrollLeft,!0),ye(e,"scroll",e))}),ve(t.scroller,"mousewheel",function(G){return Mo(e,G)}),ve(t.scroller,"DOMMouseScroll",function(G){return Mo(e,G)}),ve(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(G){Ae(e,G)||te(G)},over:function(G){Ae(e,G)||(Dl(e,G),te(G))},start:function(G){return Al(e,G)},drop:zt(e,Ll),leave:function(G){Ae(e,G)||ss(e)}};var H=t.input.getField();ve(H,"keyup",function(G){return ys.call(e,G)}),ve(H,"keydown",zt(e,vs)),ve(H,"keypress",zt(e,bs)),ve(H,"focus",function(G){return wa(e,G)}),ve(H,"blur",function(G){return Mn(e,G)})}var Ga=[];kt.defineInitHook=function(e){return Ga.push(e)};function wi(e,t,n,r){var i=e.doc,S;n==null&&(n="add"),n=="smart"&&(i.mode.indent?S=Re(e,t).state:n="prev");var U=e.options.tabSize,H=ot(i,t),G=X(H.text,null,U);H.stateAfter&&(H.stateAfter=null);var V=H.text.match(/^\s*/)[0],ee;if(!r&&!/\S/.test(H.text))ee=0,n="not";else if(n=="smart"&&(ee=i.mode.indent(S,H.text.slice(V.length),H.text),ee==Ee||ee>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ee=X(ot(i,t-1).text,null,U):ee=0:n=="add"?ee=G+e.options.indentUnit:n=="subtract"?ee=G-e.options.indentUnit:typeof n=="number"&&(ee=G+n),ee=Math.max(0,ee);var ie="",me=0;if(e.options.indentWithTabs)for(var he=Math.floor(ee/U);he;--he)me+=U,ie+=" ";if(me<ee&&(ie+=se(ee-me)),ie!=V)return Bn(i,ie,Oe(t,0),Oe(t,V.length),"+input"),H.stateAfter=null,!0;for(var Te=0;Te<i.sel.ranges.length;Te++){var Ce=i.sel.ranges[Te];if(Ce.head.line==t&&Ce.head.ch<V.length){var Ue=Oe(t,V.length);Fa(i,Te,new At(Ue,Ue));break}}}var Sr=null;function ra(e){Sr=e}function za(e,t,n,r,i){var S=e.doc;e.display.shift=!1,r||(r=S.sel);var U=+new Date-200,H=i=="paste"||e.state.pasteIncoming>U,G=it(t),V=null;if(H&&r.ranges.length>1)if(Sr&&Sr.text.join(`
|
|
`)==t){if(r.ranges.length%Sr.text.length==0){V=[];for(var ee=0;ee<Sr.text.length;ee++)V.push(S.splitLines(Sr.text[ee]))}}else G.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(V=Me(G,function(Ne){return[Ne]}));for(var ie=e.curOp.updateInput,me=r.ranges.length-1;me>=0;me--){var he=r.ranges[me],Te=he.from(),Ce=he.to();he.empty()&&(n&&n>0?Te=Oe(Te.line,Te.ch-n):e.state.overwrite&&!H?Ce=Oe(Ce.line,Math.min(ot(S,Ce.line).text.length,Ce.ch+be(G).length)):H&&Sr&&Sr.lineWise&&Sr.text.join(`
|
|
`)==G.join(`
|
|
`)&&(Te=Ce=Oe(Te.line,0)));var Ue={from:Te,to:Ce,text:V?V[me%V.length]:G,origin:i||(H?"paste":e.state.cutIncoming>U?"cut":"+input")};Nn(e.doc,Ue),Ot(e,"inputRead",e,Ue)}t&&!H&&As(e,t),kn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ie),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ls(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&cr(t,function(){return za(t,n,0,null,"paste")}),!0}function As(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var S=e.getModeAt(i.head),U=!1;if(S.electricChars){for(var H=0;H<S.electricChars.length;H++)if(t.indexOf(S.electricChars.charAt(H))>-1){U=wi(e,i.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(ot(e.doc,i.head.line).text.slice(0,i.head.ch))&&(U=wi(e,i.head.line,"smart")));U&&Ot(e,"electricInput",e,i.head.line)}}function Ds(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,S={anchor:Oe(i,0),head:Oe(i+1,0)};n.push(S),t.push(e.getRange(S.anchor,S.head))}return{text:t,ranges:n}}function _s(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Os(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return O?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),_s(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var S=this.options,U=S[r];if(S[r]==i&&r!="mode")return;S[r]=i,t.hasOwnProperty(r)&&zt(this,t[r])(this,i,U),ye(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](qi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,S=0;S<i.length;++S)if(i[S]==r||i[S].name==r)return i.splice(S,1),!0},addOverlay:tr(function(r,i){var S=r.token?r:e.getMode(this.options,r);if(S.startState)throw new Error("Overlays may not be stateful.");Ie(this.state.overlays,{mode:S,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(U){return U.priority}),this.state.modeGen++,nr(this)}),removeOverlay:tr(function(r){for(var i=this.state.overlays,S=0;S<i.length;++S){var U=i[S].modeSpec;if(U==r||typeof r=="string"&&U.name==r){i.splice(S,1),this.state.modeGen++,nr(this);return}}}),indentLine:tr(function(r,i,S){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),qr(this.doc,r)&&wi(this,r,i,S)}),indentSelection:tr(function(r){for(var i=this.doc.sel.ranges,S=-1,U=0;U<i.length;U++){var H=i[U];if(H.empty())H.head.line>S&&(wi(this,H.head.line,r,!0),S=H.head.line,U==this.doc.sel.primIndex&&kn(this));else{var G=H.from(),V=H.to(),ee=Math.max(S,G.line);S=Math.min(this.lastLine(),V.line-(V.ch?0:1))+1;for(var ie=ee;ie<S;++ie)wi(this,ie,r);var me=this.doc.sel.ranges;G.ch==0&&i.length==me.length&&me[U].from().ch>0&&Fa(this.doc,U,new At(G,me[U].to()),pe)}}}),getTokenAt:function(r,i){return Fr(this,r,i)},getLineTokens:function(r,i){return Fr(this,Oe(r),i,!0)},getTokenTypeAt:function(r){r=gt(this.doc,r);var i=$n(this,ot(this.doc,r.line)),S=0,U=(i.length-1)/2,H=r.ch,G;if(H==0)G=i[2];else for(;;){var V=S+U>>1;if((V?i[V*2-1]:0)>=H)U=V;else if(i[V*2+1]<H)S=V+1;else{G=i[V*2+2];break}}var ee=G?G.indexOf("overlay "):-1;return ee<0?G:ee==0?null:G.slice(0,ee-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var S=[];if(!n.hasOwnProperty(i))return S;var U=n[i],H=this.getModeAt(r);if(typeof H[i]=="string")U[H[i]]&&S.push(U[H[i]]);else if(H[i])for(var G=0;G<H[i].length;G++){var V=U[H[i][G]];V&&S.push(V)}else H.helperType&&U[H.helperType]?S.push(U[H.helperType]):U[H.name]&&S.push(U[H.name]);for(var ee=0;ee<U._global.length;ee++){var ie=U._global[ee];ie.pred(H,this)&&ne(S,ie.val)==-1&&S.push(ie.val)}return S},getStateAfter:function(r,i){var S=this.doc;return r=Yn(S,r==null?S.first+S.size-1:r),Re(this,r+1,i).state},cursorCoords:function(r,i){var S,U=this.doc.sel.primary();return r==null?S=U.head:typeof r=="object"?S=gt(this.doc,r):S=r?U.from():U.to(),xr(this,S,i||"page")},charCoords:function(r,i){return ga(this,gt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=fo(this,r,i||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,i){return r=fo(this,{top:r,left:0},i||"page").top,Cr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,S){var U=!1,H;if(typeof r=="number"){var G=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>G&&(r=G,U=!0),H=ot(this.doc,r)}else H=r;return Ni(this,H,{top:0,left:0},i||"page",S||U).top+(U?this.doc.height-dr(H):0)},defaultTextHeight:function(){return Rn(this.display)},defaultCharWidth:function(){return Pn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,S,U,H){var G=this.display;r=xr(this,gt(this.doc,r));var V=r.bottom,ee=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),G.sizer.appendChild(i),U=="over")V=r.top;else if(U=="above"||U=="near"){var ie=Math.max(G.wrapper.clientHeight,this.doc.height),me=Math.max(G.sizer.clientWidth,G.lineSpace.clientWidth);(U=="above"||r.bottom+i.offsetHeight>ie)&&r.top>i.offsetHeight?V=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ie&&(V=r.bottom),ee+i.offsetWidth>me&&(ee=me-i.offsetWidth)}i.style.top=V+"px",i.style.left=i.style.right="",H=="right"?(ee=G.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(H=="left"?ee=0:H=="middle"&&(ee=(G.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ee+"px"),S&&Qs(this,{left:ee,top:V,right:ee+i.offsetWidth,bottom:V+i.offsetHeight})},triggerOnKeyDown:tr(vs),triggerOnKeyPress:tr(bs),triggerOnKeyUp:ys,triggerOnMouseDown:tr(Es),execCommand:function(r){if(Ei.hasOwnProperty(r))return Ei[r].call(null,this)},triggerElectric:tr(function(r){As(this,r)}),findPosH:function(r,i,S,U){var H=1;i<0&&(H=-1,i=-i);for(var G=gt(this.doc,r),V=0;V<i&&!(G=Va(this.doc,G,H,S,U),G.hitSide);++V);return G},moveH:tr(function(r,i){var S=this;this.extendSelectionsBy(function(U){return S.display.shift||S.doc.extend||U.empty()?Va(S.doc,U.head,r,i,S.options.rtlMoveVisually):r<0?U.from():U.to()},de)}),deleteH:tr(function(r,i){var S=this.doc.sel,U=this.doc;S.somethingSelected()?U.replaceSelection("",null,"+delete"):Hn(this,function(H){var G=Va(U,H.head,r,i,!1);return r<0?{from:G,to:H.head}:{from:H.head,to:G}})}),findPosV:function(r,i,S,U){var H=1,G=U;i<0&&(H=-1,i=-i);for(var V=gt(this.doc,r),ee=0;ee<i;++ee){var ie=xr(this,V,"div");if(G==null?G=ie.left:ie.left=G,V=Rs(this,ie,H,S),V.hitSide)break}return V},moveV:tr(function(r,i){var S=this,U=this.doc,H=[],G=!this.display.shift&&!U.extend&&U.sel.somethingSelected();if(U.extendSelectionsBy(function(ee){if(G)return r<0?ee.from():ee.to();var ie=xr(S,ee.head,"div");ee.goalColumn!=null&&(ie.left=ee.goalColumn),H.push(ie.left);var me=Rs(S,ie,r,i);return i=="page"&&ee==U.sel.primary()&&La(S,ga(S,me,"div").top-ie.top),me},de),H.length)for(var V=0;V<U.sel.ranges.length;V++)U.sel.ranges[V].goalColumn=H[V]}),findWordAt:function(r){var i=this.doc,S=ot(i,r.line).text,U=r.ch,H=r.ch;if(S){var G=this.getHelper(r,"wordChars");(r.sticky=="before"||H==S.length)&&U?--U:++H;for(var V=S.charAt(U),ee=ke(V,G)?function(ie){return ke(ie,G)}:/\s/.test(V)?function(ie){return/\s/.test(ie)}:function(ie){return!/\s/.test(ie)&&!ke(ie)};U>0&&ee(S.charAt(U-1));)--U;for(;H<S.length&&ee(S.charAt(H));)++H}return new At(Oe(r.line,U),Oe(r.line,H))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?N(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),ye(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==R()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:tr(function(r,i){ai(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Ar(this)-this.display.barHeight,width:r.scrollWidth-Ar(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:ln(this)}},scrollIntoView:tr(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:Oe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Js(this,r):So(this,r.from,r.to,r.margin)}),setSize:tr(function(r,i){var S=this,U=function(G){return typeof G=="number"||/^\d+$/.test(String(G))?G+"px":G};r!=null&&(this.display.wrapper.style.width=U(r)),i!=null&&(this.display.wrapper.style.height=U(i)),this.options.lineWrapping&&lo(this);var H=this.display.viewFrom;this.doc.iter(H,this.display.viewTo,function(G){if(G.widgets){for(var V=0;V<G.widgets.length;V++)if(G.widgets[V].noHScroll){Gr(S,H,"widget");break}}++H}),this.curOp.forceUpdate=!0,ye(this,"refresh",this)}),operation:function(r){return cr(this,r)},startOperation:function(){return mn(this)},endOperation:function(){return pn(this)},refresh:tr(function(){var r=this.display.cachedTextHeight;nr(this),this.curOp.forceUpdate=!0,ni(this),ai(this,this.doc.scrollLeft,this.doc.scrollTop),_a(this.display),(r==null||Math.abs(r-Rn(this.display))>.5||this.options.lineWrapping)&&Ta(this),ye(this,"refresh",this)}),swapDoc:tr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Fo(this,r),ni(this),this.display.input.reset(),ai(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ot(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}},oe(e),e.registerHelper=function(r,i,S){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=S},e.registerGlobalHelper=function(r,i,S,U){e.registerHelper(r,i,U),n[r]._global.push({pred:S,val:U})}}function Va(e,t,n,r,i){var S=t,U=n,H=ot(e,t.line),G=i&&e.direction=="rtl"?-n:n;function V(){var $e=t.line+G;return $e<e.first||$e>=e.first+e.size?!1:(t=new Oe($e,t.ch,t.sticky),H=ot(e,$e))}function ee($e){var Be;if(r=="codepoint"){var tt=H.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?Be=null:Be=new Oe(t.line,Math.max(0,Math.min(H.text.length,t.ch+n*(tt>=55296&&tt<56320?2:1))),-n)}else i?Be=kl(e.cm,H,t,n):Be=Ba(H,t,n);if(Be==null)if(!$e&&V())t=ja(i,e.cm,H,t.line,G);else return!1;else t=Be;return!0}if(r=="char"||r=="codepoint")ee();else if(r=="column")ee(!0);else if(r=="word"||r=="group")for(var ie=null,me=r=="group",he=e.cm&&e.cm.getHelper(t,"wordChars"),Te=!0;!(n<0&&!ee(!Te));Te=!1){var Ce=H.text.charAt(t.ch)||`
|
|
`,Ue=ke(Ce,he)?"w":me&&Ce==`
|
|
`?"n":!me||/\s/.test(Ce)?null:"p";if(me&&!Te&&!Ue&&(Ue="s"),ie&&ie!=Ue){n<0&&(n=1,ee(),t.sticky="after");break}if(Ue&&(ie=Ue),n>0&&!ee(!Te))break}var Ne=Qi(e,t,S,U,!0);return en(S,Ne)&&(Ne.hitSide=!0),Ne}function Rs(e,t,n,r){var i=e.doc,S=t.left,U;if(r=="page"){var H=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),G=Math.max(H-.5*Rn(e.display),3);U=(n>0?t.bottom:t.top)+n*G}else r=="line"&&(U=n>0?t.bottom+3:t.top-3);for(var V;!(V=ya(e,S,U),!V.outside);){if(n<0?U<=0:U>=i.height){V.hitSide=!0;break}U+=n*5}return V}var _t=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};_t.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;_s(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(H){for(var G=H.target;G;G=G.parentNode){if(G==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(G.className))break}return!1}ve(i,"paste",function(H){if(!S(H)||Ae(r,H)||Ls(H,r))return;k<=11&&setTimeout(zt(r,function(){return t.updateFromDOM()}),20)}),ve(i,"compositionstart",function(H){t.composing={data:H.data,done:!1}}),ve(i,"compositionupdate",function(H){t.composing||(t.composing={data:H.data,done:!1})}),ve(i,"compositionend",function(H){t.composing&&(H.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ve(i,"touchstart",function(){return n.forceCompositionEnd()}),ve(i,"input",function(){t.composing||t.readFromDOMSoon()});function U(H){if(!S(H)||Ae(r,H))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),H.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var G=Ds(r);ra({lineWise:!0,text:G.text}),H.type=="cut"&&r.operation(function(){r.setSelections(G.ranges,0,pe),r.replaceSelection("",null,"cut")})}else return;if(H.clipboardData){H.clipboardData.clearData();var V=Sr.text.join(`
|
|
`);if(H.clipboardData.setData("Text",V),H.clipboardData.getData("Text")==V){H.preventDefault();return}}var ee=Os(),ie=ee.firstChild;r.display.lineSpace.insertBefore(ee,r.display.lineSpace.firstChild),ie.value=Sr.text.join(`
|
|
`);var me=document.activeElement;z(ie),setTimeout(function(){r.display.lineSpace.removeChild(ee),me.focus(),me==i&&n.showPrimarySelection()},50)}ve(i,"copy",U),ve(i,"cut",U)},_t.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},_t.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},_t.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},_t.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},_t.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var S=na(t,e.anchorNode,e.anchorOffset),U=na(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&U&&!U.bad&&mt(En(S,U),r)==0&&mt(rn(S,U),i)==0)return;var H=t.display.view,G=r.line>=t.display.viewFrom&&Ps(t,r)||{node:H[0].measure.map[2],offset:0},V=i.line<t.display.viewTo&&Ps(t,i);if(!V){var ee=H[H.length-1].measure,ie=ee.maps?ee.maps[ee.maps.length-1]:ee.map;V={node:ie[ie.length-1],offset:ie[ie.length-2]-ie[ie.length-3]}}if(!G||!V){e.removeAllRanges();return}var me=e.rangeCount&&e.getRangeAt(0),he;try{he=E(G.node,G.offset,V.offset,V.node)}catch(Te){}he&&(!A&&t.state.focused?(e.collapse(G.node,G.offset),he.collapsed||(e.removeAllRanges(),e.addRange(he))):(e.removeAllRanges(),e.addRange(he)),me&&e.anchorNode==null?e.addRange(me):A&&this.startGracePeriod()),this.rememberSelection()},_t.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)},_t.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},_t.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},_t.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return v(this.div,t)},_t.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},_t.prototype.blur=function(){this.div.blur()},_t.prototype.getField=function(){return this.div},_t.prototype.supportsTouch=function(){return!0},_t.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():cr(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)},_t.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},_t.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&c&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=na(t,e.anchorNode,e.anchorOffset),r=na(t,e.focusNode,e.focusOffset);n&&r&&cr(t,function(){Jt(t.doc,Vr(n,r),pe),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},_t.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=Oe(r.line-1,ot(e.doc,r.line-1).length)),i.ch==ot(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Oe(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var S,U,H;r.line==t.viewFrom||(S=cn(e,r.line))==0?(U=Lt(t.view[0].line),H=t.view[0].node):(U=Lt(t.view[S].line),H=t.view[S-1].node.nextSibling);var G=cn(e,i.line),V,ee;if(G==t.view.length-1?(V=t.viewTo-1,ee=t.lineDiv.lastChild):(V=Lt(t.view[G+1].line)-1,ee=t.view[G+1].node.previousSibling),!H)return!1;for(var ie=e.doc.splitLines(tu(e,H,ee,U,V)),me=wr(e.doc,Oe(U,0),Oe(V,ot(e.doc,V).text.length));ie.length>1&&me.length>1;)if(be(ie)==be(me))ie.pop(),me.pop(),V--;else if(ie[0]==me[0])ie.shift(),me.shift(),U++;else break;for(var he=0,Te=0,Ce=ie[0],Ue=me[0],Ne=Math.min(Ce.length,Ue.length);he<Ne&&Ce.charCodeAt(he)==Ue.charCodeAt(he);)++he;for(var $e=be(ie),Be=be(me),tt=Math.min($e.length-(ie.length==1?he:0),Be.length-(me.length==1?he:0));Te<tt&&$e.charCodeAt($e.length-Te-1)==Be.charCodeAt(Be.length-Te-1);)++Te;if(ie.length==1&&me.length==1&&U==r.line)for(;he&&he>r.ch&&$e.charCodeAt($e.length-Te-1)==Be.charCodeAt(Be.length-Te-1);)he--,Te++;ie[ie.length-1]=$e.slice(0,$e.length-Te).replace(/^\u200b+/,""),ie[0]=ie[0].slice(he).replace(/\u200b+$/,"");var dt=Oe(U,he),lt=Oe(V,me.length?be(me).length-Te:0);if(ie.length>1||ie[0]||mt(dt,lt))return Bn(e.doc,ie,dt,lt,"+input"),!0},_t.prototype.ensurePolled=function(){this.forceCompositionEnd()},_t.prototype.reset=function(){this.forceCompositionEnd()},_t.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},_t.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)},_t.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&cr(this.cm,function(){return nr(e.cm)})},_t.prototype.setUneditable=function(e){e.contentEditable="false"},_t.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||zt(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},_t.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},_t.prototype.onContextMenu=function(){},_t.prototype.resetPosition=function(){},_t.prototype.needsContentAttribute=!0;function Ps(e,t){var n=ma(e,t.line);if(!n||n.hidden)return null;var r=ot(e.doc,t.line),i=no(n,r,t.line),S=ze(r,e.doc.direction),U="left";if(S){var H=We(S,t.ch);U=H%2?"right":"left"}var G=oo(i.map,t.ch,U);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 Gn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var S="",U=!1,H=e.doc.lineSeparator(),G=!1;function V(he){return function(Te){return Te.id==he}}function ee(){U&&(S+=H,G&&(S+=H),U=G=!1)}function ie(he){he&&(ee(),S+=he)}function me(he){if(he.nodeType==1){var Te=he.getAttribute("cm-text");if(Te){ie(Te);return}var Ce=he.getAttribute("cm-marker"),Ue;if(Ce){var Ne=e.findMarks(Oe(r,0),Oe(i+1,0),V(+Ce));Ne.length&&(Ue=Ne[0].find(0))&&ie(wr(e.doc,Ue.from,Ue.to).join(H));return}if(he.getAttribute("contenteditable")=="false")return;var $e=/^(pre|div|p|li|table|br)$/i.test(he.nodeName);if(!/^br$/i.test(he.nodeName)&&he.textContent.length==0)return;$e&&ee();for(var Be=0;Be<he.childNodes.length;Be++)me(he.childNodes[Be]);/^(pre|p)$/i.test(he.nodeName)&&(G=!0),$e&&(U=!0)}else he.nodeType==3&&ie(he.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(me(t),t==n);)t=t.nextSibling,G=!1;return S}function na(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Gn(e.clipPos(Oe(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var S=e.display.view[i];if(S.node==r)return ru(S,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!v(r,t))return Gn(Oe(Lt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var S=e.rest?be(e.rest):e.line;return Gn(Oe(Lt(S),S.text.length),i)}var U=t.nodeType==3?t:null,H=t;for(!U&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(U=t.firstChild,n&&(n=U.nodeValue.length));H.parentNode!=r;)H=H.parentNode;var G=e.measure,V=G.maps;function ee(Ue,Ne,$e){for(var Be=-1;Be<(V?V.length:0);Be++)for(var tt=Be<0?G.map:V[Be],dt=0;dt<tt.length;dt+=3){var lt=tt[dt+2];if(lt==Ue||lt==Ne){var bt=Lt(Be<0?e.line:e.rest[Be]),Pt=tt[dt]+$e;return($e<0||lt!=Ue)&&(Pt=tt[dt+($e?1:0)]),Oe(bt,Pt)}}}var ie=ee(U,H,n);if(ie)return Gn(ie,i);for(var me=H.nextSibling,he=U?U.nodeValue.length-n:0;me;me=me.nextSibling){if(ie=ee(me,me.firstChild,0),ie)return Gn(Oe(ie.line,ie.ch-he),i);he+=me.textContent.length}for(var Te=H.previousSibling,Ce=n;Te;Te=Te.previousSibling){if(ie=ee(Te,Te.firstChild,-1),ie)return Gn(Oe(ie.line,ie.ch+Ce),i);Ce+=Te.textContent.length}}var Bt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new q,this.hasSelection=!1,this.composing=null};Bt.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),b&&(i.style.width="0px"),ve(i,"input",function(){I&&k>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ve(i,"paste",function(U){if(Ae(r,U)||Ls(U,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function S(U){if(Ae(r,U))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var H=Ds(r);ra({lineWise:!0,text:H.text}),U.type=="cut"?r.setSelections(H.ranges,null,pe):(n.prevInput="",i.value=H.text.join(`
|
|
`),z(i))}else return;U.type=="cut"&&(r.state.cutIncoming=+new Date)}ve(i,"cut",S),ve(i,"copy",S),ve(e.scroller,"paste",function(U){if(kr(e,U)||Ae(r,U))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var H=new Event("paste");H.clipboardData=U.clipboardData,i.dispatchEvent(H)}),ve(e.lineSpace,"selectstart",function(U){kr(e,U)||Y(U)}),ve(i,"compositionstart",function(){var U=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:U,range:r.markText(U,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ve(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Bt.prototype.createField=function(e){this.wrapper=Os(),this.textarea=this.wrapper.firstChild},Bt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Bt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var i=xr(e,n.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),U=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+U.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+U.left-S.left))}return r},Bt.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")},Bt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&z(this.textarea),I&&k>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",I&&k>=9&&(this.hasSelection=null))},Bt.prototype.getField=function(){return this.textarea},Bt.prototype.supportsTouch=function(){return!1},Bt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||R()!=this.textarea))try{this.textarea.focus()}catch(e){}},Bt.prototype.blur=function(){this.textarea.blur()},Bt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Bt.prototype.receivedFocus=function(){this.slowPoll()},Bt.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()})},Bt.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)},Bt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Qe(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(I&&k>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var S=i.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var U=0,H=Math.min(r.length,i.length);U<H&&r.charCodeAt(U)==i.charCodeAt(U);)++U;return cr(t,function(){za(t,i.slice(U),r.length-U,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},Bt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Bt.prototype.onKeyPress=function(){I&&k>=9&&(this.hasSelection=null),this.fastPoll()},Bt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=dn(n,e),U=r.scroller.scrollTop;if(!S||p)return;var H=n.options.resetSelectionOnContextMenu;H&&n.doc.sel.contains(S)==-1&&zt(n,Jt)(n.doc,Vr(S),pe);var G=i.style.cssText,V=t.wrapper.style.cssText,ee=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ee.top-5)+"px; left: "+(e.clientX-ee.left-5)+`px;
|
|
z-index: 1000; background: `+(I?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ie;O&&(ie=window.scrollY),r.input.focus(),O&&window.scrollTo(null,ie),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=he,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function me(){if(i.selectionStart!=null){var Ce=n.somethingSelected(),Ue="\u200B"+(Ce?i.value:"");i.value="\u21DA",i.value=Ue,t.prevInput=Ce?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ue.length,r.selForContextMenu=n.doc.sel}}function he(){if(t.contextMenuPending!=he)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=V,i.style.cssText=G,I&&k<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=U),i.selectionStart!=null){(!I||I&&k<9)&&me();var Ce=0,Ue=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?zt(n,Qo)(n):Ce++<10?r.detectingSelectAll=setTimeout(Ue,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ue,200)}}if(I&&k>=9&&me(),L){te(e);var Te=function(){Xe(window,"mouseup",Te),setTimeout(he,20)};ve(window,"mouseup",Te)}else setTimeout(he,50)},Bt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Bt.prototype.setUneditable=function(){},Bt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?F(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=R();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=H.getValue()}var i;if(e.form&&(ve(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;i=S.submit;try{var U=S.submit=function(){r(),S.submit=i,S.submit(),S.submit=U}}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&&(Xe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var H=kt(function(G){return e.parentNode.insertBefore(G,e.nextSibling)},t);return H}function iu(e){e.off=Xe,e.on=ve,e.wheelEventPixels=cl,e.Doc=ir,e.splitLines=it,e.countColumn=X,e.findColumn=ce,e.isWordChar=De,e.Pass=Ee,e.signal=ye,e.Line=Kr,e.changeEnd=Xr,e.scrollbarModel=Lo,e.Pos=Oe,e.cmpPos=mt,e.modes=ht,e.mimeModes=nt,e.resolveMode=Mt,e.getMode=lr,e.modeExtensions=gr,e.extendMode=qt,e.copyState=vr,e.startState=Zr,e.innerMode=yn,e.commands=Ei,e.keyMap=Ir,e.keyName=fs,e.isModifierKey=ds,e.lookupKey=Wn,e.normalizeKeyMap=Ml,e.StringStream=It,e.SharedTextMarker=vi,e.TextMarker=$r,e.LineWidget=gi,e.e_preventDefault=Y,e.e_stopPropagation=$,e.e_stop=te,e.addClass=N,e.contains=v,e.rmClass=f,e.keyNames=Qr}$l(kt),ql(kt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in ir.prototype)ir.prototype.hasOwnProperty(ia)&&ne(au,ia)<0&&(kt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(ir.prototype[ia]));return oe(ir),kt.inputStyles={textarea:Bt,contenteditable:_t},kt.defineMode=function(e){!kt.defaults.mode&&e!="null"&&(kt.defaults.mode=e),Ht.apply(this,arguments)},kt.defineMIME=Ct,kt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),kt.defineMIME("text/plain","null"),kt.defineExtension=function(e,t){kt.prototype[e]=t},kt.defineDocExtension=function(e,t){ir.prototype[e]=t},kt.fromTextArea=nu,iu(kt),kt.version="5.58.2",kt})},Y1PL:function(Je,je,J){"use strict";J.r(je),J.d(je,"ResizableTextArea",function(){return ne});var Q=J("wx14"),K=J("1OyB"),A=J("vuIU"),W=J("Ji7U"),M=J("LK+K"),P=J("cDcd"),I=J("VTBJ"),k=J("rePB"),O=J("Zm9Q"),_=J("Kwbf"),c=J("c+Xe"),p=J("m+aA"),D=J("bdgK"),w=new Map;function y(pe){pe.forEach(function(fe){var de,ce=fe.target;(de=w.get(ce))===null||de===void 0||de.forEach(function(re){return re(ce)})})}var b=new D.default(y),l=null,a=null;function s(pe,fe){w.has(pe)||(w.set(pe,new Set),b.observe(pe)),w.get(pe).add(fe)}function u(pe,fe){w.has(pe)&&(w.get(pe).delete(fe),w.get(pe).size||(b.unobserve(pe),w.delete(pe)))}var C=function(pe){Object(W.a)(de,pe);var fe=Object(M.a)(de);function de(){return Object(K.a)(this,de),fe.apply(this,arguments)}return Object(A.a)(de,[{key:"render",value:function(){return this.props.children}}]),de}(P.Component),g=P.createContext(null);function m(pe){var fe=pe.children,de=pe.onBatchResize,ce=P.useRef(0),re=P.useRef([]),se=P.useContext(g),be=P.useCallback(function(Me,Ie,Ge){ce.current+=1;var He=ce.current;re.current.push({size:Me,element:Ie,data:Ge}),Promise.resolve().then(function(){He===ce.current&&(de==null||de(re.current),re.current=[])}),se==null||se(Me,Ie,Ge)},[de,se]);return P.createElement(g.Provider,{value:be},fe)}function L(pe){var fe=pe.children,de=pe.disabled,ce=P.useRef(null),re=P.useRef(null),se=P.useContext(g),be=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Me=P.isValidElement(fe)&&Object(c.c)(fe),Ie=Me?fe.ref:null,Ge=P.useMemo(function(){return Object(c.a)(Ie,ce)},[Ie,ce]),He=P.useRef(pe);He.current=pe;var Se=P.useCallback(function(De){var ke=He.current,Ke=ke.onResize,Fe=ke.data,_e=De.getBoundingClientRect(),Le=_e.width,rt=_e.height,qe=De.offsetWidth,Ye=De.offsetHeight,We=Math.floor(Le),et=Math.floor(rt);if(be.current.width!==We||be.current.height!==et||be.current.offsetWidth!==qe||be.current.offsetHeight!==Ye){var ze={width:We,height:et,offsetWidth:qe,offsetHeight:Ye};be.current=ze;var Ve=qe===Math.round(Le)?Le:qe,ve=Ye===Math.round(rt)?rt:Ye,Ze=Object(I.a)(Object(I.a)({},ze),{},{offsetWidth:Ve,offsetHeight:ve});se==null||se(Ze,De,Fe),Ke&&Promise.resolve().then(function(){Ke(Ze,De)})}},[]);return P.useEffect(function(){var De=Object(p.a)(ce.current)||Object(p.a)(re.current);return De&&!de&&s(De,Se),function(){return u(De,Se)}},[ce.current,de]),P.createElement(C,{ref:re},Me?P.cloneElement(fe,{ref:Ge}):fe)}var x="rc-observer-key";function f(pe){var fe=pe.children,de=Object(O.a)(fe);return de.map(function(ce,re){var se=(ce==null?void 0:ce.key)||"".concat(x,"-").concat(re);return P.createElement(L,Object(Q.a)({},pe,{key:se}),ce)})}f.Collection=m;var h=f,d=J("bT9E"),o=J("TSYQ"),T=J.n(o),E=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,v=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],R={},N;function B(pe){var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,de=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(fe&&R[de])return R[de];var ce=window.getComputedStyle(pe),re=ce.getPropertyValue("box-sizing")||ce.getPropertyValue("-moz-box-sizing")||ce.getPropertyValue("-webkit-box-sizing"),se=parseFloat(ce.getPropertyValue("padding-bottom"))+parseFloat(ce.getPropertyValue("padding-top")),be=parseFloat(ce.getPropertyValue("border-bottom-width"))+parseFloat(ce.getPropertyValue("border-top-width")),Me=v.map(function(Ge){return"".concat(Ge,":").concat(ce.getPropertyValue(Ge))}).join(";"),Ie={sizingStyle:Me,paddingSize:se,borderSize:be,boxSizing:re};return fe&&de&&(R[de]=Ie),Ie}function z(pe){var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,de=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;N||(N=document.createElement("textarea"),N.setAttribute("tab-index","-1"),N.setAttribute("aria-hidden","true"),document.body.appendChild(N)),pe.getAttribute("wrap")?N.setAttribute("wrap",pe.getAttribute("wrap")):N.removeAttribute("wrap");var re=B(pe,fe),se=re.paddingSize,be=re.borderSize,Me=re.boxSizing,Ie=re.sizingStyle;N.setAttribute("style","".concat(Ie,";").concat(E)),N.value=pe.value||pe.placeholder||"";var Ge=Number.MIN_SAFE_INTEGER,He=Number.MAX_SAFE_INTEGER,Se=N.scrollHeight,De;if(Me==="border-box"?Se+=be:Me==="content-box"&&(Se-=se),de!==null||ce!==null){N.value=" ";var ke=N.scrollHeight-se;de!==null&&(Ge=ke*de,Me==="border-box"&&(Ge=Ge+se+be),Se=Math.max(Ge,Se)),ce!==null&&(He=ke*ce,Me==="border-box"&&(He=He+se+be),De=Se>He?"":"hidden",Se=Math.min(He,Se))}return{height:Se,minHeight:Ge,maxHeight:He,overflowY:De,resize:"none"}}var j=J("Gytx"),F=J.n(j),X;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})(X||(X={}));var q=function(pe){Object(W.a)(de,pe);var fe=Object(M.a)(de);function de(ce){var re;return Object(K.a)(this,de),re=fe.call(this,ce),re.nextFrameActionId=void 0,re.resizeFrameId=void 0,re.textArea=void 0,re.saveTextArea=function(se){re.textArea=se},re.handleResize=function(se){var be=re.state.resizeStatus,Me=re.props,Ie=Me.autoSize,Ge=Me.onResize;if(be!==X.NONE)return;typeof Ge=="function"&&Ge(se),Ie&&re.resizeOnNextFrame()},re.resizeOnNextFrame=function(){cancelAnimationFrame(re.nextFrameActionId),re.nextFrameActionId=requestAnimationFrame(re.resizeTextarea)},re.resizeTextarea=function(){var se=re.props.autoSize;if(!se||!re.textArea)return;var be=se.minRows,Me=se.maxRows,Ie=z(re.textArea,!1,be,Me);re.setState({textareaStyles:Ie,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(re.resizeFrameId),re.resizeFrameId=requestAnimationFrame(function(){re.setState({resizeStatus:X.RESIZED},function(){re.resizeFrameId=requestAnimationFrame(function(){re.setState({resizeStatus:X.NONE}),re.fixFirefoxAutoScroll()})})})})},re.renderTextArea=function(){var se=re.props,be=se.prefixCls,Me=be===void 0?"rc-textarea":be,Ie=se.autoSize,Ge=se.onResize,He=se.className,Se=se.disabled,De=re.state,ke=De.textareaStyles,Ke=De.resizeStatus,Fe=Object(d.a)(re.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),_e=T()(Me,He,Object(k.a)({},"".concat(Me,"-disabled"),Se));"value"in Fe&&(Fe.value=Fe.value||"");var Le=Object(I.a)(Object(I.a)(Object(I.a)({},re.props.style),ke),Ke===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(h,{onResize:re.handleResize,disabled:!(Ie||Ge)},P.createElement("textarea",Object(Q.a)({},Fe,{className:_e,style:Le,ref:re.saveTextArea})))},re.state={textareaStyles:{},resizeStatus:X.NONE},re}return Object(A.a)(de,[{key:"componentDidUpdate",value:function(re){(re.value!==this.props.value||!F()(re.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 re=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(re,se)}}catch(be){}}},{key:"render",value:function(){return this.renderTextArea()}}]),de}(P.Component),ne=q,ue=function(pe){Object(W.a)(de,pe);var fe=Object(M.a)(de);function de(ce){var re;Object(K.a)(this,de),re=fe.call(this,ce),re.resizableTextArea=void 0,re.focus=function(){re.resizableTextArea.textArea.focus()},re.saveTextArea=function(be){re.resizableTextArea=be},re.handleChange=function(be){var Me=re.props.onChange;re.setValue(be.target.value,function(){re.resizableTextArea.resizeTextarea()}),Me&&Me(be)},re.handleKeyDown=function(be){var Me=re.props,Ie=Me.onPressEnter,Ge=Me.onKeyDown;be.keyCode===13&&Ie&&Ie(be),Ge&&Ge(be)};var se=typeof ce.value=="undefined"||ce.value===null?ce.defaultValue:ce.value;return re.state={value:se},re}return Object(A.a)(de,[{key:"setValue",value:function(re,se){"value"in this.props||this.setState({value:re},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(ne,Object(Q.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(re){return"value"in re?{value:re.value}:null}}]),de}(P.Component),Ee=je.default=ue},ZpRC:function(Je,je,J){"use strict";function Q(c){return typeof c=="object"&&c!=null&&c.nodeType===1}function K(c,p){return(!p||c!=="hidden")&&c!=="visible"&&c!=="clip"}function A(c,p){if(c.clientHeight<c.scrollHeight||c.clientWidth<c.scrollWidth){var D=getComputedStyle(c,null);return K(D.overflowY,p)||K(D.overflowX,p)||function(w){var y=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(l){return null}}(w);return!!y&&(y.clientHeight<w.scrollHeight||y.clientWidth<w.scrollWidth)}(c)}return!1}function W(c,p,D,w,y,b,l,a){return b<c&&l>p||b>c&&l<p?0:b<=c&&a<=D||l>=p&&a>=D?b-c-w:l>p&&a<D||b<c&&a>D?l-p+y:0}var M=function(c,p){var D=window,w=p.scrollMode,y=p.block,b=p.inline,l=p.boundary,a=p.skipOverflowHiddenElements,s=typeof l=="function"?l:function(ke){return ke!==l};if(!Q(c))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,C=[],g=c;Q(g)&&s(g);){if((g=g.parentElement)===u){C.push(g);break}g!=null&&g===document.body&&A(g)&&!A(document.documentElement)||g!=null&&A(g,a)&&C.push(g)}for(var m=D.visualViewport?D.visualViewport.width:innerWidth,L=D.visualViewport?D.visualViewport.height:innerHeight,x=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,h=c.getBoundingClientRect(),d=h.height,o=h.width,T=h.top,E=h.right,v=h.bottom,R=h.left,N=y==="start"||y==="nearest"?T:y==="end"?v:T+d/2,B=b==="center"?R+o/2:b==="end"?E:R,z=[],j=0;j<C.length;j++){var F=C[j],X=F.getBoundingClientRect(),q=X.height,ne=X.width,ue=X.top,Ee=X.right,pe=X.bottom,fe=X.left;if(w==="if-needed"&&T>=0&&R>=0&&v<=L&&E<=m&&T>=ue&&v<=pe&&R>=fe&&E<=Ee)return z;var de=getComputedStyle(F),ce=parseInt(de.borderLeftWidth,10),re=parseInt(de.borderTopWidth,10),se=parseInt(de.borderRightWidth,10),be=parseInt(de.borderBottomWidth,10),Me=0,Ie=0,Ge="offsetWidth"in F?F.offsetWidth-F.clientWidth-ce-se:0,He="offsetHeight"in F?F.offsetHeight-F.clientHeight-re-be:0;if(u===F)Me=y==="start"?N:y==="end"?N-L:y==="nearest"?W(f,f+L,L,re,be,f+N,f+N+d,d):N-L/2,Ie=b==="start"?B:b==="center"?B-m/2:b==="end"?B-m:W(x,x+m,m,ce,se,x+B,x+B+o,o),Me=Math.max(0,Me+f),Ie=Math.max(0,Ie+x);else{Me=y==="start"?N-ue-re:y==="end"?N-pe+be+He:y==="nearest"?W(ue,pe,q,re,be+He,N,N+d,d):N-(ue+q/2)+He/2,Ie=b==="start"?B-fe-ce:b==="center"?B-(fe+ne/2)+Ge/2:b==="end"?B-Ee+se+Ge:W(fe,Ee,ne,ce,se+Ge,B,B+o,o);var Se=F.scrollLeft,De=F.scrollTop;N+=De-(Me=Math.max(0,Math.min(De+Me,F.scrollHeight-q+He))),B+=Se-(Ie=Math.max(0,Math.min(Se+Ie,F.scrollWidth-ne+Ge)))}z.push({el:F,top:Me,left:Ie})}return z};function P(c){return c===Object(c)&&Object.keys(c).length!==0}function I(c,p){p===void 0&&(p="auto");var D="scrollBehavior"in document.body.style;c.forEach(function(w){var y=w.el,b=w.top,l=w.left;y.scroll&&D?y.scroll({top:b,left:l,behavior:p}):(y.scrollTop=b,y.scrollLeft=l)})}function k(c){return c===!1?{block:"end",inline:"nearest"}:P(c)?c:{block:"start",inline:"nearest"}}function O(c,p){var D=!c.ownerDocument.documentElement.contains(c);if(P(p)&&typeof p.behavior=="function")return p.behavior(D?[]:M(c,p));if(D)return;var w=k(p);return I(M(c,w),w.behavior)}var _=je.a=O},aRTE:function(Je,je){Je.exports={L:1,M:0,Q:3,H:2}},bT9E:function(Je,je,J){"use strict";J.d(je,"a",function(){return K});var Q=J("VTBJ");function K(A,W){var M=Object(Q.a)({},A);return Array.isArray(W)&&W.forEach(function(P){delete M[P]}),M}},c5Ni:function(Je,je,J){},dQei:function(Je,je){for(var J={glog:function(K){if(K<1)throw new Error("glog("+K+")");return J.LOG_TABLE[K]},gexp:function(K){for(;K<0;)K+=255;for(;K>=256;)K-=255;return J.EXP_TABLE[K]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},Q=0;Q<8;Q++)J.EXP_TABLE[Q]=1<<Q;for(var Q=8;Q<256;Q++)J.EXP_TABLE[Q]=J.EXP_TABLE[Q-4]^J.EXP_TABLE[Q-5]^J.EXP_TABLE[Q-6]^J.EXP_TABLE[Q-8];for(var Q=0;Q<255;Q++)J.LOG_TABLE[J.EXP_TABLE[Q]]=Q;Je.exports=J},dWSS:function(Je,je,J){var Q=J("dQei");function K(A,W){if(A.length==null)throw new Error(A.length+"/"+W);for(var M=0;M<A.length&&A[M]==0;)M++;this.num=new Array(A.length-M+W);for(var P=0;P<A.length-M;P++)this.num[P]=A[P+M]}K.prototype={get:function(A){return this.num[A]},getLength:function(){return this.num.length},multiply:function(A){for(var W=new Array(this.getLength()+A.getLength()-1),M=0;M<this.getLength();M++)for(var P=0;P<A.getLength();P++)W[M+P]^=Q.gexp(Q.glog(this.get(M))+Q.glog(A.get(P)));return new K(W,0)},mod:function(A){if(this.getLength()-A.getLength()<0)return this;for(var W=Q.glog(this.get(0))-Q.glog(A.get(0)),M=new Array(this.getLength()),P=0;P<this.getLength();P++)M[P]=this.get(P);for(var P=0;P<A.getLength();P++)M[P]^=Q.gexp(Q.glog(A.get(P))+W);return new K(M,0).mod(A)}},Je.exports=K},dejd:function(Je,je,J){},dmUQ:function(Je,je,J){"use strict";var Q=J("Ff2n"),K=J("rePB"),A=J("1OyB"),W=J("vuIU"),M=J("Ji7U"),P=J("md7G"),I=J("foSv"),k=J("cDcd"),O=J.n(k),_=J("TSYQ"),c=J.n(_),p=J("4IlW");function D(d,o){var T=Object.keys(d);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(d);o&&(E=E.filter(function(v){return Object.getOwnPropertyDescriptor(d,v).enumerable})),T.push.apply(T,E)}return T}function w(d){for(var o=1;o<arguments.length;o++){var T=arguments[o]!=null?arguments[o]:{};o%2?D(Object(T),!0).forEach(function(E){Object(K.a)(d,E,T[E])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(T)):D(Object(T)).forEach(function(E){Object.defineProperty(d,E,Object.getOwnPropertyDescriptor(T,E))})}return d}function y(d){var o=b();return function(){var E=Object(I.a)(d),v;if(o){var R=Object(I.a)(this).constructor;v=Reflect.construct(E,arguments,R)}else v=E.apply(this,arguments);return Object(P.a)(this,v)}}function b(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(d){return!1}}function l(){}function a(d){d.preventDefault()}var s=function(o){return o.replace(/[^\w.-]+/g,"")},u=200,C=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(o){return o!=null},L=function(o,T){return T===o||typeof T=="number"&&typeof o=="number"&&isNaN(T)&&isNaN(o)},x=function(d){Object(M.a)(T,d);var o=y(T);function T(E){var v;Object(A.a)(this,T),v=o.call(this,E),v.onKeyDown=function(B){var z=v.props,j=z.onKeyDown,F=z.onPressEnter;if(B.keyCode===p.a.UP){var X=v.getRatio(B);v.up(B,X,null),v.stop()}else if(B.keyCode===p.a.DOWN){var q=v.getRatio(B);v.down(B,q,null),v.stop()}else B.keyCode===p.a.ENTER&&F&&F(B);if(v.recordCursorPosition(),v.lastKeyCode=B.keyCode,j){for(var ne=arguments.length,ue=new Array(ne>1?ne-1:0),Ee=1;Ee<ne;Ee++)ue[Ee-1]=arguments[Ee];j.apply(void 0,[B].concat(ue))}},v.onKeyUp=function(B){var z=v.props.onKeyUp;if(v.stop(),v.recordCursorPosition(),z){for(var j=arguments.length,F=new Array(j>1?j-1:0),X=1;X<j;X++)F[X-1]=arguments[X];z.apply(void 0,[B].concat(F))}},v.onChange=function(B){var z=v.props.onChange;v.state.focused&&(v.inputting=!0),v.rawInput=v.props.parser(v.getValueFromEvent(B)),v.setState({inputValue:v.rawInput}),z(v.toNumber(v.rawInput))},v.onMouseUp=function(){var B=v.props.onMouseUp;v.recordCursorPosition(),B&&B.apply(void 0,arguments)},v.onFocus=function(){var B;v.setState({focused:!0}),(B=v.props).onFocus.apply(B,arguments)},v.onBlur=function(){var B=v.props.onBlur;v.inputting=!1,v.setState({focused:!1});var z=v.getCurrentValidValue(v.state.inputValue),j=v.setValue(z,l);if(B){var F=v.input.value,X=v.getInputDisplayValue({focus:!1,value:j});v.input.value=X&&Number(X),B.apply(void 0,arguments),v.input.value=F}},v.getRatio=function(B){var z=1;return B.metaKey||B.ctrlKey?z=.1:B.shiftKey&&(z=10),z},v.getFullNum=function(B){return isNaN(B)?B:/e/i.test(String(B))?Number(B).toFixed(18).replace(/\.?0+$/,""):B},v.getPrecision=function(B){if(m(v.props.precision))return v.props.precision;var z=String(B);if(z.indexOf("e-")>=0)return parseInt(z.slice(z.indexOf("e-")+2),10);var j=0;return z.indexOf(".")>=0&&(j=z.length-z.indexOf(".")-1),j},v.getInputDisplayValue=function(B){var z=B||v.state,j=z.focused,F=z.inputValue,X=z.value,q;j?q=F:q=v.toPrecisionAsStep(X),q==null&&(q="");var ne=v.formatWrapper(q);return m(v.props.decimalSeparator)&&(ne=ne.toString().replace(".",v.props.decimalSeparator)),ne},v.recordCursorPosition=function(){try{v.cursorStart=v.input.selectionStart,v.cursorEnd=v.input.selectionEnd,v.currentValue=v.input.value,v.cursorBefore=v.input.value.substring(0,v.cursorStart),v.cursorAfter=v.input.value.substring(v.cursorEnd)}catch(B){}},v.restoreByAfter=function(B){if(B===void 0)return!1;var z=v.input.value,j=z.lastIndexOf(B);if(j===-1)return!1;var F=v.cursorBefore.length;return v.lastKeyCode===p.a.DELETE&&v.cursorBefore.charAt(F-1)===B[0]?(v.fixCaret(F,F),!0):j+B.length===z.length?(v.fixCaret(j,j),!0):!1},v.partRestoreByAfter=function(B){return B===void 0?!1:Array.prototype.some.call(B,function(z,j){var F=B.substring(j);return v.restoreByAfter(F)})},v.isNotCompleteNumber=function(B){return isNaN(B)||B===""||B===null||B&&B.toString().indexOf(".")===B.toString().length-1},v.stop=function(){v.autoStepTimer&&clearTimeout(v.autoStepTimer)},v.down=function(B,z,j){v.pressingUpOrDown=!0,v.step("down",B,z,j)},v.up=function(B,z,j){v.pressingUpOrDown=!0,v.step("up",B,z,j)},v.saveInput=function(B){v.input=B};var R=E.value;R===void 0&&(R=E.defaultValue),v.state={focused:E.autoFocus};var N=v.getValidValue(v.toNumber(R));return v.state=w(w({},v.state),{},{inputValue:v.toPrecisionAsStep(N),value:N}),v}return Object(W.a)(T,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(v){var R=this.props,N=R.value,B=R.onChange,z=R.max,j=R.min,F=this.state.focused;if(v){if(!L(v.value,N)||!L(v.max,z)||!L(v.min,j)){var X=F?N:this.getValidValue(N),q;this.pressingUpOrDown?q=X:this.inputting?q=this.rawInput:q=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:q})}var ne="value"in this.props?N:this.state.value;"max"in this.props&&v.max!==z&&typeof ne=="number"&&ne>z&&B&&B(z),"min"in this.props&&v.min!==j&&typeof ne=="number"&&ne<j&&B&&B(j)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ue=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?ue=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(ue=this.cursorStart):ue=this.input.value.length,this.fixCaret(ue,ue)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case p.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case p.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ee){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(v){var R=v;return R===""?R="":this.isNotCompleteNumber(parseFloat(R))?R=this.state.value:R=this.getValidValue(R),this.toNumber(R)}},{key:"getValueFromEvent",value:function(v){var R=v.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(R=R.replace(this.props.decimalSeparator,".")),R}},{key:"getValidValue",value:function(v){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,B=parseFloat(v);return isNaN(B)?v:(B<R&&(B=R),B>N&&(B=N),B)}},{key:"setValue",value:function(v,R){var N=this.props.precision,B=this.isNotCompleteNumber(parseFloat(v))?null:parseFloat(v),z=this.state.value,j=z===void 0?null:z,F=this.state.inputValue,X=F===void 0?null:F,q=typeof B=="number"?B.toFixed(N):"".concat(B),ne=B!==j||q!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},R)):this.setState({value:B,inputValue:this.toPrecisionAsStep(v)},R),ne&&this.props.onChange(B),B}},{key:"getMaxPrecision",value:function(v){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.props,B=N.precision,z=N.step;if(m(B))return B;var j=this.getPrecision(R),F=this.getPrecision(z),X=this.getPrecision(v);return v?Math.max(X,j+F):j+F}},{key:"getPrecisionFactor",value:function(v){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.getMaxPrecision(v,R);return Math.pow(10,N)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(v){return this.props.formatter?this.props.formatter(v):v}},{key:"toPrecisionAsStep",value:function(v){if(this.isNotCompleteNumber(v)||v==="")return v;var R=Math.abs(this.getMaxPrecision(v));return isNaN(R)?v.toString():Number(v).toFixed(R)}},{key:"toNumber",value:function(v){var R=this.props.precision,N=this.state.focused,B=v&&v.length>16&&N;return this.isNotCompleteNumber(v)||B?v:m(R)?Math.round(v*Math.pow(10,R))/Math.pow(10,R):Number(v)}},{key:"upStep",value:function(v,R){var N=this.props.step,B=this.getPrecisionFactor(v,R),z=Math.abs(this.getMaxPrecision(v,R)),j=((B*v+B*N*R)/B).toFixed(z);return this.toNumber(j)}},{key:"downStep",value:function(v,R){var N=this.props.step,B=this.getPrecisionFactor(v,R),z=Math.abs(this.getMaxPrecision(v,R)),j=((B*v-B*N*R)/B).toFixed(z);return this.toNumber(j)}},{key:"step",value:function(v,R){var N=this,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,z=arguments.length>3?arguments[3]:void 0;this.stop(),R&&(R.persist(),R.preventDefault());var j=this.props;if(j.disabled)return;var F=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(F))return;var X=this["".concat(v,"Step")](F,B),q=X>j.max||X<j.min;if(X>j.max?X=j.max:X<j.min&&(X=j.min),this.setValue(X,null),this.setState({focused:!0},function(){N.pressingUpOrDown=!1}),q)return;this.autoStepTimer=setTimeout(function(){N[v](R,B,!0)},z?u:C)}},{key:"fixCaret",value:function(v,R){if(v===void 0||R===void 0||!this.input||!this.input.value)return;try{var N=this.input.selectionStart,B=this.input.selectionEnd;(v!==N||R!==B)&&this.input.setSelectionRange(v,R)}catch(z){}}},{key:"render",value:function(){var v,R=this.props,N=R.prefixCls,B=R.disabled,z=R.readOnly,j=R.useTouch,F=R.autoComplete,X=R.upHandler,q=R.downHandler,ne=R.className,ue=R.max,Ee=R.min,pe=R.style,fe=R.title,de=R.onMouseEnter,ce=R.onMouseLeave,re=R.onMouseOver,se=R.onMouseOut,be=R.required,Me=R.onClick,Ie=R.tabIndex,Ge=R.type,He=R.placeholder,Se=R.id,De=R.inputMode,ke=R.pattern,Ke=R.step,Fe=R.maxLength,_e=R.autoFocus,Le=R.name,rt=R.onPaste,qe=R.onInput,Ye=Object(Q.a)(R,["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"]),We=this.state,et=We.value,ze=We.focused,Ve=c()(N,(v={},Object(K.a)(v,ne,!!ne),Object(K.a)(v,"".concat(N,"-disabled"),B),Object(K.a)(v,"".concat(N,"-focused"),ze),v)),ve={};Object.keys(Ye).forEach(function(te){(te.substr(0,5)==="data-"||te.substr(0,5)==="aria-"||te==="role")&&(ve[te]=Ye[te])});var Ze=!z&&!B,Xe=this.getInputDisplayValue(null),ye=(et||et===0)&&(isNaN(et)||Number(et)>=ue),Ae=(et||et===0)&&(isNaN(et)||Number(et)<=Ee),le=ye||B||z,ae=Ae||B||z,oe=c()("".concat(N,"-handler"),"".concat(N,"-handler-up"),Object(K.a)({},"".concat(N,"-handler-up-disabled"),le)),Y=c()("".concat(N,"-handler"),"".concat(N,"-handler-down"),Object(K.a)({},"".concat(N,"-handler-down-disabled"),ae)),$=j?{onTouchStart:le?l:this.up,onTouchEnd:this.stop}:{onMouseDown:le?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},Z=j?{onTouchStart:ae?l:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:Ve,style:pe,title:fe,onMouseEnter:de,onMouseLeave:ce,onMouseOver:re,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},O.a.createElement("div",{className:"".concat(N,"-handler-wrap")},O.a.createElement("span",Object.assign({unselectable:"on"},$,{role:"button","aria-label":"Increase Value","aria-disabled":le,className:oe}),X||O.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-up-inner"),onClick:a})),O.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,className:Y}),q||O.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-down-inner"),onClick:a}))),O.a.createElement("div",{className:"".concat(N,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ee,"aria-valuemax":ue,"aria-valuenow":et,required:be,type:Ge,placeholder:He,onPaste:rt,onClick:Me,onMouseUp:this.onMouseUp,className:"".concat(N,"-input"),tabIndex:Ie,autoComplete:F,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:l,onKeyUp:Ze?this.onKeyUp:l,autoFocus:_e,maxLength:Fe,readOnly:z,disabled:B,max:ue,min:Ee,step:Ke,name:Le,title:fe,id:Se,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Xe),pattern:ke,inputMode:De,onInput:qe},ve))))}}]),T}(O.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:s,required:!1,autoComplete:"off"};var f=x,h=je.a=f},f4xo:function(Je,je,J){var Q=J("nVVt");function K(A){this.mode=Q.MODE_8BIT_BYTE,this.data=A}K.prototype={getLength:function(A){return this.data.length},write:function(A){for(var W=0;W<this.data.length;W++)A.put(this.data.charCodeAt(W),8)}},Je.exports=K},fnXi:function(Je,je,J){"use strict";var Q=J("2qtc"),K=J("kLXV"),A=J("cDcd"),W=J.n(A),M=J("Ty5D"),P=J("9kvl"),I=J("93VE"),k=J.n(I),O=function(c){var p=c.activeIndex,D=c.isEdit,w=D===void 0?!0:D,y=c.dispatch,b=c.practiceSetting,l=Object(M.i)(),a=l.id,s=l.challengesId,u=Object(A.useMemo)(function(){return[{name:"\u672C\u5173\u4EFB\u52A1",url:"/shixuns/".concat(a,"/edit/").concat(s,"/editcheckpoint")},{name:"\u8BC4\u6D4B\u8BBE\u7F6E",url:"/shixuns/".concat(a,"/edit/").concat(s,"/tab=2")},{name:"\u53C2\u8003\u7B54\u6848",url:"/shixuns/".concat(a,"/edit/").concat(s,"/tab=3")},{name:"\u5173\u5361\u6392\u884C\u699C",url:"/shixuns/".concat(a,"/edit/").concat(s,"/tab=4")}]},[a,s]),C=function(m){var L,x=function(){P.d.push(m),y({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})};b!=null&&(L=b.sideBar)!==null&&L!==void 0&&L.confirmLeave?K.a.confirm({title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",onOk:function(){x()}}):x()};return W.a.createElement("ul",{className:"challenge-nav"},w?u.map(function(g,m){return p===m?W.a.createElement("li",{key:g.url}," ",W.a.createElement("a",{className:"active"},g.name)," "):W.a.createElement("li",{key:g.url}," ",W.a.createElement("a",{onClick:function(){return C(g.url)}},g.name)," ")}):W.a.createElement("li",{key:u[0].url}," ",W.a.createElement("a",{className:"active"},u[0].name)," "))};je.a=Object(P.a)(function(_){var c=_.globalSetting,p=_.practiceSetting;return{globalSetting:c,practiceSetting:p}})(O)},kSUc:function(Je,je,J){},lZu9:function(Je,je,J){(function(Q){Q(J("VrN/"),J("1eCo"),J("8EBN"))})(function(Q){"use strict";Q.defineMode("markdown",function(K,A){var W=Q.getMode(K,"text/html"),M=W.name=="null";function P(j){if(Q.findModeByName){var F=Q.findModeByName(j);F&&(j=F.mime||F.mimes[0])}var X=Q.getMode(K,j);return X.name=="null"?null:X}A.highlightFormatting===void 0&&(A.highlightFormatting=!1),A.maxBlockquoteDepth===void 0&&(A.maxBlockquoteDepth=0),A.taskLists===void 0&&(A.taskLists=!1),A.strikethrough===void 0&&(A.strikethrough=!1),A.emoji===void 0&&(A.emoji=!1),A.fencedCodeBlockHighlighting===void 0&&(A.fencedCodeBlockHighlighting=!0),A.fencedCodeBlockDefaultMode===void 0&&(A.fencedCodeBlockDefaultMode="text/plain"),A.xml===void 0&&(A.xml=!0),A.tokenTypeOverrides===void 0&&(A.tokenTypeOverrides={});var I={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var k in I)I.hasOwnProperty(k)&&A.tokenTypeOverrides[k]&&(I[k]=A.tokenTypeOverrides[k]);var O=/^([*\-_])(?:\s*\1){2,}\s*$/,_=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,c=/^\[(x| )\](?=\s)/i,p=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,D=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,y=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,a=" ";function s(j,F,X){return F.f=F.inline=X,X(j,F)}function u(j,F,X){return F.f=F.block=X,X(j,F)}function C(j){return!j||!/\S/.test(j.string)}function g(j){if(j.linkTitle=!1,j.linkHref=!1,j.linkText=!1,j.em=!1,j.strong=!1,j.strikethrough=!1,j.quote=0,j.indentedCode=!1,j.f==L){var F=M;if(!F){var X=Q.innerMode(W,j.htmlState);F=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}F&&(j.f=d,j.block=m,j.htmlState=null)}return j.trailingSpace=0,j.trailingSpaceNewLine=!1,j.prevLine=j.thisLine,j.thisLine={stream:null},null}function m(j,F){var X=j.column()===F.indentation,q=C(F.prevLine.stream),ne=F.indentedCode,ue=F.prevLine.hr,Ee=F.list!==!1,pe=(F.listStack[F.listStack.length-1]||0)+3;F.indentedCode=!1;var fe=F.indentation;if(F.indentationDiff===null&&(F.indentationDiff=F.indentation,Ee)){for(F.list=null;fe<F.listStack[F.listStack.length-1];)F.listStack.pop(),F.listStack.length?F.indentation=F.listStack[F.listStack.length-1]:F.list=!1;F.list!==!1&&(F.indentationDiff=fe-F.listStack[F.listStack.length-1])}var de=!q&&!ue&&!F.prevLine.header&&(!Ee||!ne)&&!F.prevLine.fencedCodeEnd,ce=(F.list===!1||ue||q)&&F.indentation<=pe&&j.match(O),re=null;if(F.indentationDiff>=4&&(ne||F.prevLine.fencedCodeEnd||F.prevLine.header||q))return j.skipToEnd(),F.indentedCode=!0,I.code;if(j.eatSpace())return null;if(X&&F.indentation<=pe&&(re=j.match(p))&&re[1].length<=6)return F.quote=0,F.header=re[1].length,F.thisLine.header=!0,A.highlightFormatting&&(F.formatting="header"),F.f=F.inline,f(F);if(F.indentation<=pe&&j.eat(">"))return F.quote=X?1:F.quote+1,A.highlightFormatting&&(F.formatting="quote"),j.eatSpace(),f(F);if(!ce&&!F.setext&&X&&F.indentation<=pe&&(re=j.match(_))){var se=re[1]?"ol":"ul";return F.indentation=fe+j.current().length,F.list=!0,F.quote=0,F.listStack.push(F.indentation),F.em=!1,F.strong=!1,F.code=!1,F.strikethrough=!1,A.taskLists&&j.match(c,!1)&&(F.taskList=!0),F.f=F.inline,A.highlightFormatting&&(F.formatting=["list","list-"+se]),f(F)}else{if(X&&F.indentation<=pe&&(re=j.match(y,!0)))return F.quote=0,F.fencedEndRE=new RegExp(re[1]+"+ *$"),F.localMode=A.fencedCodeBlockHighlighting&&P(re[2]||A.fencedCodeBlockDefaultMode),F.localMode&&(F.localState=Q.startState(F.localMode)),F.f=F.block=x,A.highlightFormatting&&(F.formatting="code-block"),F.code=-1,f(F);if(F.setext||(!de||!Ee)&&!F.quote&&F.list===!1&&!F.code&&!ce&&!b.test(j.string)&&(re=j.lookAhead(1))&&(re=re.match(D)))return F.setext?(F.header=F.setext,F.setext=0,j.skipToEnd(),A.highlightFormatting&&(F.formatting="header")):(F.header=re[0].charAt(0)=="="?1:2,F.setext=F.header),F.thisLine.header=!0,F.f=F.inline,f(F);if(ce)return j.skipToEnd(),F.hr=!0,F.thisLine.hr=!0,I.hr;if(j.peek()==="[")return s(j,F,R)}return s(j,F,F.inline)}function L(j,F){var X=W.token(j,F.htmlState);if(!M){var q=Q.innerMode(W,F.htmlState);(q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText||F.md_inside&&j.current().indexOf(">")>-1)&&(F.f=d,F.block=m,F.htmlState=null)}return X}function x(j,F){var X=F.listStack[F.listStack.length-1]||0,q=F.indentation<X,ne=X+3;if(F.fencedEndRE&&F.indentation<=ne&&(q||j.match(F.fencedEndRE))){A.highlightFormatting&&(F.formatting="code-block");var ue;return q||(ue=f(F)),F.localMode=F.localState=null,F.block=m,F.f=d,F.fencedEndRE=null,F.code=0,F.thisLine.fencedCodeEnd=!0,q?u(j,F,F.block):ue}else return F.localMode?F.localMode.token(j,F.localState):(j.skipToEnd(),I.code)}function f(j){var F=[];if(j.formatting){F.push(I.formatting),typeof j.formatting=="string"&&(j.formatting=[j.formatting]);for(var X=0;X<j.formatting.length;X++)F.push(I.formatting+"-"+j.formatting[X]),j.formatting[X]==="header"&&F.push(I.formatting+"-"+j.formatting[X]+"-"+j.header),j.formatting[X]==="quote"&&(!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=j.quote?F.push(I.formatting+"-"+j.formatting[X]+"-"+j.quote):F.push("error"))}if(j.taskOpen)return F.push("meta"),F.length?F.join(" "):null;if(j.taskClosed)return F.push("property"),F.length?F.join(" "):null;if(j.linkHref?F.push(I.linkHref,"url"):(j.strong&&F.push(I.strong),j.em&&F.push(I.em),j.strikethrough&&F.push(I.strikethrough),j.emoji&&F.push(I.emoji),j.linkText&&F.push(I.linkText),j.code&&F.push(I.code),j.image&&F.push(I.image),j.imageAltText&&F.push(I.imageAltText,"link"),j.imageMarker&&F.push(I.imageMarker)),j.header&&F.push(I.header,I.header+"-"+j.header),j.quote&&(F.push(I.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=j.quote?F.push(I.quote+"-"+j.quote):F.push(I.quote+"-"+A.maxBlockquoteDepth)),j.list!==!1){var q=(j.listStack.length-1)%3;q?q===1?F.push(I.list2):F.push(I.list3):F.push(I.list1)}return j.trailingSpaceNewLine?F.push("trailing-space-new-line"):j.trailingSpace&&F.push("trailing-space-"+(j.trailingSpace%2?"a":"b")),F.length?F.join(" "):null}function h(j,F){return j.match(w,!0)?f(F):void 0}function d(j,F){var X=F.text(j,F);if(typeof X!="undefined")return X;if(F.list)return F.list=null,f(F);if(F.taskList){var q=j.match(c,!0)[1]===" ";return q?F.taskOpen=!0:F.taskClosed=!0,A.highlightFormatting&&(F.formatting="task"),F.taskList=!1,f(F)}if(F.taskOpen=!1,F.taskClosed=!1,F.header&&j.match(/^#+$/,!0))return A.highlightFormatting&&(F.formatting="header"),f(F);var ne=j.next();if(F.linkTitle){F.linkTitle=!1;var ue=ne;ne==="("&&(ue=")"),ue=(ue+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ee="^\\s*(?:[^"+ue+"\\\\]+|\\\\\\\\|\\\\.)"+ue;if(j.match(new RegExp(Ee),!0))return I.linkHref}if(ne==="`"){var pe=F.formatting;A.highlightFormatting&&(F.formatting="code"),j.eatWhile("`");var fe=j.current().length;if(F.code==0&&(!F.quote||fe==1))return F.code=fe,f(F);if(fe==F.code){var de=f(F);return F.code=0,de}else return F.formatting=pe,f(F)}else if(F.code)return f(F);if(ne==="\\"&&(j.next(),A.highlightFormatting)){var ce=f(F),re=I.formatting+"-escape";return ce?ce+" "+re:re}if(ne==="!"&&j.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return F.imageMarker=!0,F.image=!0,A.highlightFormatting&&(F.formatting="image"),f(F);if(ne==="["&&F.imageMarker&&j.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return F.imageMarker=!1,F.imageAltText=!0,A.highlightFormatting&&(F.formatting="image"),f(F);if(ne==="]"&&F.imageAltText){A.highlightFormatting&&(F.formatting="image");var ce=f(F);return F.imageAltText=!1,F.image=!1,F.inline=F.f=T,ce}if(ne==="["&&!F.image)return F.linkText&&j.match(/^.*?\]/)||(F.linkText=!0,A.highlightFormatting&&(F.formatting="link")),f(F);if(ne==="]"&&F.linkText){A.highlightFormatting&&(F.formatting="link");var ce=f(F);return F.linkText=!1,F.inline=F.f=j.match(/\(.*?\)| ?\[.*?\]/,!1)?T:d,ce}if(ne==="<"&&j.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=o,A.highlightFormatting&&(F.formatting="link");var ce=f(F);return ce?ce+=" ":ce="",ce+I.linkInline}if(ne==="<"&&j.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=o,A.highlightFormatting&&(F.formatting="link");var ce=f(F);return ce?ce+=" ":ce="",ce+I.linkEmail}if(A.xml&&ne==="<"&&j.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=j.string.indexOf(">",j.pos);if(se!=-1){var be=j.string.substring(j.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(be)&&(F.md_inside=!0)}return j.backUp(1),F.htmlState=Q.startState(W),u(j,F,L)}if(A.xml&&ne==="<"&&j.match(/^\/\w*?>/))return F.md_inside=!1,"tag";if(ne==="*"||ne==="_"){for(var Me=1,Ie=j.pos==1?" ":j.string.charAt(j.pos-2);Me<3&&j.eat(ne);)Me++;var Ge=j.peek()||" ",He=!/\s/.test(Ge)&&(!l.test(Ge)||/\s/.test(Ie)||l.test(Ie)),Se=!/\s/.test(Ie)&&(!l.test(Ie)||/\s/.test(Ge)||l.test(Ge)),De=null,ke=null;if(Me%2&&(!F.em&&He&&(ne==="*"||!Se||l.test(Ie))?De=!0:F.em==ne&&Se&&(ne==="*"||!He||l.test(Ge))&&(De=!1)),Me>1&&(!F.strong&&He&&(ne==="*"||!Se||l.test(Ie))?ke=!0:F.strong==ne&&Se&&(ne==="*"||!He||l.test(Ge))&&(ke=!1)),ke!=null||De!=null){A.highlightFormatting&&(F.formatting=De==null?"strong":ke==null?"em":"strong em"),De===!0&&(F.em=ne),ke===!0&&(F.strong=ne);var de=f(F);return De===!1&&(F.em=!1),ke===!1&&(F.strong=!1),de}}else if(ne===" "&&(j.eat("*")||j.eat("_"))){if(j.peek()===" ")return f(F);j.backUp(1)}if(A.strikethrough){if(ne==="~"&&j.eatWhile(ne)){if(F.strikethrough){A.highlightFormatting&&(F.formatting="strikethrough");var de=f(F);return F.strikethrough=!1,de}else if(j.match(/^[^\s]/,!1))return F.strikethrough=!0,A.highlightFormatting&&(F.formatting="strikethrough"),f(F)}else if(ne===" "&&j.match(/^~~/,!0)){if(j.peek()===" ")return f(F);j.backUp(2)}}if(A.emoji&&ne===":"&&j.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){F.emoji=!0,A.highlightFormatting&&(F.formatting="emoji");var Ke=f(F);return F.emoji=!1,Ke}return ne===" "&&(j.match(/^ +$/,!1)?F.trailingSpace++:F.trailingSpace&&(F.trailingSpaceNewLine=!0)),f(F)}function o(j,F){var X=j.next();if(X===">"){F.f=F.inline=d,A.highlightFormatting&&(F.formatting="link");var q=f(F);return q?q+=" ":q="",q+I.linkInline}return j.match(/^[^>]+/,!0),I.linkInline}function T(j,F){if(j.eatSpace())return null;var X=j.next();return X==="("||X==="["?(F.f=F.inline=v(X==="("?")":"]"),A.highlightFormatting&&(F.formatting="link-string"),F.linkHref=!0,f(F)):"error"}var E={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function v(j){return function(F,X){var q=F.next();if(q===j){X.f=X.inline=d,A.highlightFormatting&&(X.formatting="link-string");var ne=f(X);return X.linkHref=!1,ne}return F.match(E[j]),X.linkHref=!0,f(X)}}function R(j,F){return j.match(/^([^\]\\]|\\.)*\]:/,!1)?(F.f=N,j.next(),A.highlightFormatting&&(F.formatting="link"),F.linkText=!0,f(F)):s(j,F,d)}function N(j,F){if(j.match(/^\]:/,!0)){F.f=F.inline=B,A.highlightFormatting&&(F.formatting="link");var X=f(F);return F.linkText=!1,X}return j.match(/^([^\]\\]|\\.)+/,!0),I.linkText}function B(j,F){return j.eatSpace()?null:(j.match(/^[^\s]+/,!0),j.peek()===void 0?F.linkTitle=!0:j.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),F.f=F.inline=d,I.linkHref+" url")}var z={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(j){return{f:j.f,prevLine:j.prevLine,thisLine:j.thisLine,block:j.block,htmlState:j.htmlState&&Q.copyState(W,j.htmlState),indentation:j.indentation,localMode:j.localMode,localState:j.localMode?Q.copyState(j.localMode,j.localState):null,inline:j.inline,text:j.text,formatting:!1,linkText:j.linkText,linkTitle:j.linkTitle,linkHref:j.linkHref,code:j.code,em:j.em,strong:j.strong,strikethrough:j.strikethrough,emoji:j.emoji,header:j.header,setext:j.setext,hr:j.hr,taskList:j.taskList,list:j.list,listStack:j.listStack.slice(0),quote:j.quote,indentedCode:j.indentedCode,trailingSpace:j.trailingSpace,trailingSpaceNewLine:j.trailingSpaceNewLine,md_inside:j.md_inside,fencedEndRE:j.fencedEndRE}},token:function(j,F){if(F.formatting=!1,j!=F.thisLine.stream){if(F.header=0,F.hr=!1,j.match(/^\s*$/,!0))return g(F),null;if(F.prevLine=F.thisLine,F.thisLine={stream:j},F.taskList=!1,F.trailingSpace=0,F.trailingSpaceNewLine=!1,!F.localState&&(F.f=F.block,F.f!=L)){var X=j.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(F.indentation=X,F.indentationDiff=null,X>0)return null}}return F.f(j,F)},innerMode:function(j){return j.block==L?{state:j.htmlState,mode:W}:j.localState?{state:j.localState,mode:j.localMode}:{state:j,mode:z}},indent:function(j,F,X){return j.block==L&&W.indent?W.indent(j.htmlState,F,X):j.localState&&j.localMode.indent?j.localMode.indent(j.localState,F,X):Q.Pass},blankLine:g,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return z},"xml"),Q.defineMIME("text/markdown","markdown"),Q.defineMIME("text/x-markdown","markdown")})},nVVt:function(Je,je){Je.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},nuEh:function(Je,je,J){"use strict";var Q=J("T2oS"),K=J("W9HT"),A=J("cDcd"),W=J.n(A),M=J("F8wB"),P=J.n(M),I=function(O){var _=O.loading;return _?W.a.createElement("div",{className:P.a.loading},W.a.createElement(K.a,null)):W.a.createElement(W.a.Fragment,null)};je.a=I},osHv:function(Je,je,J){(function(Q){Q(J("VrN/"))})(function(Q){"use strict";var K=Q.Pos;function A(l,a){return l.line-a.line||l.ch-a.ch}var W="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",M=W+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+W+"]["+M+"]*)","g");function I(l,a,s,u){this.line=a,this.ch=s,this.cm=l,this.text=l.getLine(a),this.min=u?Math.max(u.from,l.firstLine()):l.firstLine(),this.max=u?Math.min(u.to-1,l.lastLine()):l.lastLine()}function k(l,a){var s=l.cm.getTokenTypeAt(K(l.line,a));return s&&/\btag\b/.test(s)}function O(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function _(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function c(l){for(;;){var a=l.text.indexOf(">",l.ch);if(a==-1){if(O(l))continue;return}if(!k(l,a+1)){l.ch=a+1;continue}var s=l.text.lastIndexOf("/",a),u=s>-1&&!/\S/.test(l.text.slice(s+1,a));return l.ch=a+1,u?"selfClose":"regular"}}function p(l){for(;;){var a=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(a==-1){if(_(l))continue;return}if(!k(l,a+1)){l.ch=a;continue}P.lastIndex=a,l.ch=a;var s=P.exec(l.text);if(s&&s.index==a)return s}}function D(l){for(;;){P.lastIndex=l.ch;var a=P.exec(l.text);if(!a){if(O(l))continue;return}if(!k(l,a.index+1)){l.ch=a.index+1;continue}return l.ch=a.index+a[0].length,a}}function w(l){for(;;){var a=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(a==-1){if(_(l))continue;return}if(!k(l,a+1)){l.ch=a;continue}var s=l.text.lastIndexOf("/",a),u=s>-1&&!/\S/.test(l.text.slice(s+1,a));return l.ch=a+1,u?"selfClose":"regular"}}function y(l,a){for(var s=[];;){var u=D(l),C,g=l.line,m=l.ch-(u?u[0].length:0);if(!u||!(C=c(l)))return;if(C=="selfClose")continue;if(u[1]){for(var L=s.length-1;L>=0;--L)if(s[L]==u[2]){s.length=L;break}if(L<0&&(!a||a==u[2]))return{tag:u[2],from:K(g,m),to:K(l.line,l.ch)}}else s.push(u[2])}}function b(l,a){for(var s=[];;){var u=w(l);if(!u)return;if(u=="selfClose"){p(l);continue}var C=l.line,g=l.ch,m=p(l);if(!m)return;if(m[1])s.push(m[2]);else{for(var L=s.length-1;L>=0;--L)if(s[L]==m[2]){s.length=L;break}if(L<0&&(!a||a==m[2]))return{tag:m[2],from:K(l.line,l.ch),to:K(C,g)}}}}Q.registerHelper("fold","xml",function(l,a){for(var s=new I(l,a.line,0);;){var u=D(s);if(!u||s.line!=a.line)return;var C=c(s);if(!C)return;if(!u[1]&&C!="selfClose"){var g=K(s.line,s.ch),m=y(s,u[2]);return m&&A(m.from,g)>0?{from:g,to:m.from}:null}}}),Q.findMatchingTag=function(l,a,s){var u=new I(l,a.line,a.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var C=c(u),g=C&&K(u.line,u.ch),m=C&&p(u);if(!C||!m||A(u,a)>0)return;var L={from:K(u.line,u.ch),to:g,tag:m[2]};return C=="selfClose"?{open:L,close:null,at:"open"}:m[1]?{open:b(u,m[2]),close:L,at:"close"}:(u=new I(l,g.line,g.ch,s),{open:L,close:y(u,m[2]),at:"open"})},Q.findEnclosingTag=function(l,a,s,u){for(var C=new I(l,a.line,a.ch,s);;){var g=b(C,u);if(!g)break;var m=new I(l,a.line,a.ch,s),L=y(m,g.tag);if(L)return{open:g,close:L}}},Q.scanForClosingTag=function(l,a,s,u){var C=new I(l,a.line,a.ch,u?{from:0,to:u}:null);return y(C,s)}})},"p77/":function(Je,je,J){},rUJ1:function(Je,je){const J=/[&<>"']/,Q=/[&<>"']/g,K=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,W={"&":"&","<":"<",">":">",'"':""","'":"'"},M=x=>W[x];function P(x,f){if(f){if(J.test(x))return x.replace(Q,M)}else if(K.test(x))return x.replace(A,M);return x}const I=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(x){return x.replace(I,(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 _(x,f){x=x.source||x,f=f||"";const h={replace:(d,o)=>(o=o.source||o,o=o.replace(O,"$1"),x=x.replace(d,o),h),getRegex:()=>new RegExp(x,f)};return h}const c=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(x,f,h){if(x){let d;try{d=decodeURIComponent(k(h)).replace(c,"").toLowerCase()}catch(o){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}f&&!p.test(h)&&(h=a(f,h));try{h=encodeURI(h).replace(/%25/g,"%")}catch(d){return null}return h}const w={},y=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(x,f){w[" "+x]||(y.test(x)?w[" "+x]=x+"/":w[" "+x]=g(x,"/",!0)),x=w[" "+x];const h=x.indexOf(":")===-1;return f.substring(0,2)==="//"?h?f:x.replace(b,"$1")+f:f.charAt(0)==="/"?h?f:x.replace(l,"$1")+f:x+f}const s={exec:function(){}};function u(x){let f=1,h,d;for(;f<arguments.length;f++){h=arguments[f];for(d in h)Object.prototype.hasOwnProperty.call(h,d)&&(x[d]=h[d])}return x}function C(x,f){const h=x.replace(/\|/g,(T,E,v)=>{let R=!1,N=E;for(;--N>=0&&v[N]==="\\";)R=!R;return R?"|":" |"}),d=h.split(/ \|/);let o=0;if(d.length>f)d.splice(f);else for(;d.length<f;)d.push("");for(;o<d.length;o++)d[o]=d[o].trim().replace(/\\\|/g,"|");return d}function g(x,f,h){const d=x.length;if(d===0)return"";let o=0;for(;o<d;){const T=x.charAt(d-o-1);if(T===f&&!h)o++;else if(T!==f&&h)o++;else break}return x.substr(0,d-o)}function m(x,f){if(x.indexOf(f[1])===-1)return-1;const h=x.length;let d=0,o=0;for(;o<h;o++)if(x[o]==="\\")o++;else if(x[o]===f[0])d++;else if(x[o]===f[1]&&(d--,d<0))return o;return-1}function L(x){x&&x.sanitize&&!x.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}Je.exports={escape:P,unescape:k,edit:_,cleanUrl:D,resolveUrl:a,noopTest:s,merge:u,splitCells:C,rtrim:g,findClosingBracket:m,checkSanitizeDeprecation:L}},rcnY:function(Je,je,J){var Q=J("aRTE");function K(A,W){this.totalCount=A,this.dataCount=W}K.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],K.getRSBlocks=function(A,W){var M=K.getRsBlockTable(A,W);if(M==null)throw new Error("bad rs block @ typeNumber:"+A+"/errorCorrectLevel:"+W);for(var P=M.length/3,I=new Array,k=0;k<P;k++)for(var O=M[k*3+0],_=M[k*3+1],c=M[k*3+2],p=0;p<O;p++)I.push(new K(_,c));return I},K.getRsBlockTable=function(A,W){switch(W){case Q.L:return K.RS_BLOCK_TABLE[(A-1)*4+0];case Q.M:return K.RS_BLOCK_TABLE[(A-1)*4+1];case Q.Q:return K.RS_BLOCK_TABLE[(A-1)*4+2];case Q.H:return K.RS_BLOCK_TABLE[(A-1)*4+3];default:return}},Je.exports=K},ulZh:function(Je,je,J){typeof window!="undefined"&&function(K,A){Je.exports=A()}(this,function(){return function(Q){var K={};function A(W){if(K[W])return K[W].exports;var M=K[W]={i:W,l:!1,exports:{}};return Q[W].call(M.exports,M,M.exports,A),M.l=!0,M.exports}return A.m=Q,A.c=K,A.d=function(W,M,P){A.o(W,M)||Object.defineProperty(W,M,{enumerable:!0,get:P})},A.r=function(W){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(W,"__esModule",{value:!0})},A.t=function(W,M){if(M&1&&(W=A(W)),M&8)return W;if(M&4&&typeof W=="object"&&W&&W.__esModule)return W;var P=Object.create(null);if(A.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:W}),M&2&&typeof W!="string")for(var I in W)A.d(P,I,function(k){return W[k]}.bind(null,I));return P},A.n=function(W){var M=W&&W.__esModule?function(){return W.default}:function(){return W};return A.d(M,"a",M),M},A.o=function(W,M){return Object.prototype.hasOwnProperty.call(W,M)},A.p="/dist/",A(A.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(Q,K,A){"use strict";var W=Object.prototype.hasOwnProperty,M="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(M=!1));function I(c,p,D){this.fn=c,this.context=p,this.once=D||!1}function k(c,p,D,w,y){if(typeof D!="function")throw new TypeError("The listener must be a function");var b=new I(D,w||c,y),l=M?M+p:p;return c._events[l]?c._events[l].fn?c._events[l]=[c._events[l],b]:c._events[l].push(b):(c._events[l]=b,c._eventsCount++),c}function O(c,p){--c._eventsCount===0?c._events=new P:delete c._events[p]}function _(){this._events=new P,this._eventsCount=0}_.prototype.eventNames=function(){var p=[],D,w;if(this._eventsCount===0)return p;for(w in D=this._events)W.call(D,w)&&p.push(M?w.slice(1):w);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(D)):p},_.prototype.listeners=function(p){var D=M?M+p:p,w=this._events[D];if(!w)return[];if(w.fn)return[w.fn];for(var y=0,b=w.length,l=new Array(b);y<b;y++)l[y]=w[y].fn;return l},_.prototype.listenerCount=function(p){var D=M?M+p:p,w=this._events[D];return w?w.fn?1:w.length:0},_.prototype.emit=function(p,D,w,y,b,l){var a=M?M+p:p;if(!this._events[a])return!1;var s=this._events[a],u=arguments.length,C,g;if(s.fn){s.once&&this.removeListener(p,s.fn,void 0,!0);switch(u){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,D),!0;case 3:return s.fn.call(s.context,D,w),!0;case 4:return s.fn.call(s.context,D,w,y),!0;case 5:return s.fn.call(s.context,D,w,y,b),!0;case 6:return s.fn.call(s.context,D,w,y,b,l),!0}for(g=1,C=new Array(u-1);g<u;g++)C[g-1]=arguments[g];s.fn.apply(s.context,C)}else{var m=s.length,L;for(g=0;g<m;g++){s[g].once&&this.removeListener(p,s[g].fn,void 0,!0);switch(u){case 1:s[g].fn.call(s[g].context);break;case 2:s[g].fn.call(s[g].context,D);break;case 3:s[g].fn.call(s[g].context,D,w);break;case 4:s[g].fn.call(s[g].context,D,w,y);break;default:if(!C)for(L=1,C=new Array(u-1);L<u;L++)C[L-1]=arguments[L];s[g].fn.apply(s[g].context,C)}}}return!0},_.prototype.on=function(p,D,w){return k(this,p,D,w,!1)},_.prototype.once=function(p,D,w){return k(this,p,D,w,!0)},_.prototype.removeListener=function(p,D,w,y){var b=M?M+p:p;if(!this._events[b])return this;if(!D)return O(this,b),this;var l=this._events[b];if(l.fn)l.fn===D&&(!y||l.once)&&(!w||l.context===w)&&O(this,b);else{for(var a=0,s=[],u=l.length;a<u;a++)(l[a].fn!==D||y&&!l[a].once||w&&l[a].context!==w)&&s.push(l[a]);s.length?this._events[b]=s.length===1?s[0]:s:O(this,b)}return this},_.prototype.removeAllListeners=function(p){var D;return p?(D=M?M+p:p,this._events[D]&&O(this,D)):(this._events=new P,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=M,_.EventEmitter=_,Q.exports=_},"./node_modules/url-toolkit/src/url-toolkit.js":function(Q,K,A){(function(W){var M=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,I=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(_,c,p){if(p=p||{},_=_.trim(),c=c.trim(),!c){if(!p.alwaysNormalize)return _;var D=O.parseURL(_);if(!D)throw new Error("Error trying to parse base URL.");return D.path=O.normalizePath(D.path),O.buildURLFromParts(D)}var w=O.parseURL(c);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return p.alwaysNormalize?(w.path=O.normalizePath(w.path),O.buildURLFromParts(w)):c;var y=O.parseURL(_);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var b=P.exec(y.path);y.netLoc=b[1],y.path=b[2]}y.netLoc&&!y.path&&(y.path="/");var l={scheme:y.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(l.netLoc=y.netLoc,w.path[0]!=="/"))if(!w.path)l.path=y.path,w.params||(l.params=y.params,w.query||(l.query=y.query));else{var a=y.path,s=a.substring(0,a.lastIndexOf("/")+1)+w.path;l.path=O.normalizePath(s)}return l.path===null&&(l.path=p.alwaysNormalize?O.normalizePath(w.path):w.path),O.buildURLFromParts(l)},parseURL:function(_){var c=M.exec(_);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(I,"");_.length!==(_=_.replace(k,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};Q.exports=O})(this)},"./node_modules/webworkify-webpack/index.js":function(Q,K,A){function W(p){var D={};function w(b){if(D[b])return D[b].exports;var l=D[b]={i:b,l:!1,exports:{}};return p[b].call(l.exports,l,l.exports,w),l.l=!0,l.exports}w.m=p,w.c=D,w.i=function(b){return b},w.d=function(b,l,a){w.o(b,l)||Object.defineProperty(b,l,{configurable:!1,enumerable:!0,get:a})},w.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},w.n=function(b){var l=b&&b.__esModule?function(){return b.default}:function(){return b};return w.d(l,"a",l),l},w.o=function(b,l){return Object.prototype.hasOwnProperty.call(b,l)},w.p="/",w.oe=function(b){throw console.error(b),b};var y=w(w.s=ENTRY_MODULE);return y.default||y}var M="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+M+").*?\\)";function I(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(p){return!isNaN(1*p)}function O(p,D,w){var y={};y[w]=[];var b=D.toString(),l=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return y;for(var a=l[1],s=new RegExp("(\\\\n|\\W)"+I(a)+P,"g"),u;u=s.exec(b);){if(u[3]==="dll-reference")continue;y[w].push(u[3])}for(s=new RegExp("\\("+I(a)+'\\("(dll-reference\\s('+M+'))"\\)\\)'+P,"g");u=s.exec(b);)p[u[2]]||(y[w].push(u[1]),p[u[2]]=A(u[1]).m),y[u[2]]=y[u[2]]||[],y[u[2]].push(u[4]);for(var C=Object.keys(y),g=0;g<C.length;g++)for(var m=0;m<y[C[g]].length;m++)k(y[C[g]][m])&&(y[C[g]][m]=1*y[C[g]][m]);return y}function _(p){var D=Object.keys(p);return D.reduce(function(w,y){return w||p[y].length>0},!1)}function c(p,D){for(var w={main:[D]},y={main:[]},b={main:{}};_(w);)for(var l=Object.keys(w),a=0;a<l.length;a++){var s=l[a],u=w[s],C=u.pop();if(b[s]=b[s]||{},b[s][C]||!p[s][C])continue;b[s][C]=!0,y[s]=y[s]||[],y[s].push(C);for(var g=O(p,p[s][C],s),m=Object.keys(g),L=0;L<m.length;L++)w[m[L]]=w[m[L]]||[],w[m[L]]=w[m[L]].concat(g[m[L]])}return y}Q.exports=function(p,D){D=D||{};var w={main:A.m},y=D.all?{main:Object.keys(w.main)}:c(w,p),b="";Object.keys(y).filter(function(C){return C!=="main"}).forEach(function(C){for(var g=0;y[C][g];)g++;y[C].push(g),w[C][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+C+" = ("+W.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+y[C].map(function(m){return""+JSON.stringify(m)+": "+w[C][m].toString()}).join(",")+`});
|
|
`}),b=b+"new (("+W.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+y.main.map(function(C){return""+JSON.stringify(C)+": "+w.main[C].toString()}).join(",")+"}))(self);";var l=new window.Blob([b],{type:"text/javascript"});if(D.bare)return l;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,s=a.createObjectURL(l),u=new window.Worker(s);return u.objectURL=s,u}},"./src/config.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"hlsDefaultConfig",function(){return L}),A.d(K,"mergeConfig",function(){return f}),A.d(K,"enableStreamingMode",function(){return h});var W=A("./src/controller/abr-controller.ts"),M=A("./src/controller/audio-stream-controller.ts"),P=A("./src/controller/audio-track-controller.ts"),I=A("./src/controller/subtitle-stream-controller.ts"),k=A("./src/controller/subtitle-track-controller.ts"),O=A("./src/controller/buffer-controller.ts"),_=A("./src/controller/timeline-controller.ts"),c=A("./src/controller/cap-level-controller.ts"),p=A("./src/controller/fps-controller.ts"),D=A("./src/controller/eme-controller.ts"),w=A("./src/controller/cmcd-controller.ts"),y=A("./src/utils/xhr-loader.ts"),b=A("./src/utils/fetch-loader.ts"),l=A("./src/utils/cues.ts"),a=A("./src/utils/mediakeys-helper.ts"),s=A("./src/utils/logger.ts");function u(){return u=Object.assign||function(d){for(var o=1;o<arguments.length;o++){var T=arguments[o];for(var E in T)Object.prototype.hasOwnProperty.call(T,E)&&(d[E]=T[E])}return d},u.apply(this,arguments)}function C(d,o){var T=Object.keys(d);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(d);o&&(E=E.filter(function(v){return Object.getOwnPropertyDescriptor(d,v).enumerable})),T.push.apply(T,E)}return T}function g(d){for(var o=1;o<arguments.length;o++){var T=arguments[o]!=null?arguments[o]:{};o%2?C(Object(T),!0).forEach(function(E){m(d,E,T[E])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(T)):C(Object(T)).forEach(function(E){Object.defineProperty(d,E,Object.getOwnPropertyDescriptor(T,E))})}return d}function m(d,o,T){return o in d?Object.defineProperty(d,o,{value:T,enumerable:!0,configurable:!0,writable:!0}):d[o]=T,d}var L=g(g({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:y.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:W.default,bufferController:O.default,capLevelController:c.default,fpsController:p.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:I.SubtitleStreamController,subtitleTrackController:k.default,timelineController:_.TimelineController,audioStreamController:M.default,audioTrackController:P.default,emeController:D.default,cmcdController:w.default});function x(){return{cueHandler:l.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function f(d,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},d,o)}function h(d){var o=d.loader;if(o!==b.default&&o!==y.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var T=Object(b.fetchSupported)();T&&(d.loader=b.default,d.progressive=!0,d.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/utils/ewma-bandwidth-estimator.ts"),P=A("./src/events.ts"),I=A("./src/utils/buffer-helper.ts"),k=A("./src/errors.ts"),O=A("./src/types/loader.ts"),_=A("./src/utils/logger.ts");function c(w,y){for(var b=0;b<y.length;b++){var l=y[b];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(w,l.key,l)}}function p(w,y,b){return y&&c(w.prototype,y),b&&c(w,b),w}var D=function(){function w(b){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=b;var l=b.config;this.bwEstimator=new M.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var y=w.prototype;return y.registerListeners=function(){var l=this.hls;l.on(P.Events.FRAG_LOADING,this.onFragLoading,this),l.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(P.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var l=this.hls;l.off(P.Events.FRAG_LOADING,this.onFragLoading,this),l.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(P.Events.ERROR,this.onError,this)},y.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},y.onFragLoading=function(l,a){var s=a.frag;if(s.type===O.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=s,this.partCurrent=(u=a.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},y.onLevelLoaded=function(l,a){var s=this.hls.config;a.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},y._abandonRulesCheck=function(){var l=this.fragCurrent,a=this.partCurrent,s=this.hls,u=s.autoLevelEnabled,C=s.config,g=s.media;if(!l||!g)return;var m=a?a.stats:l.stats,L=a?a.duration:l.duration;if(m.aborted){_.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||g.paused||!g.playbackRate||!g.readyState)return;var x=performance.now()-m.loading.start,f=Math.abs(g.playbackRate);if(x<=500*L/f)return;var h=s.levels,d=s.minAutoLevel,o=h[l.level],T=m.total||Math.max(m.loaded,Math.round(L*o.maxBitrate/8)),E=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/x),v=(T-m.loaded)/E,R=g.currentTime,N=(I.BufferHelper.bufferInfo(g,R,C.maxBufferHole).end-R)/f;if(N>=2*L/f||v<=N)return;var B=Number.POSITIVE_INFINITY,z;for(z=l.level-1;z>d;z--){var j=h[z].maxBitrate;if(B=L*j/(8*.8*E),B<N)break}if(B>=v)return;var F=this.bwEstimator.getEstimate();_.logger.warn("Fragment "+l.sn+(a?" part "+a.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+z+`
|
|
Current BW estimate: `+(Object(W.isFiniteNumber)(F)?(F/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+v.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+B.toFixed(3)+` s
|
|
Time to underbuffer: `+N.toFixed(3)+" s"),s.nextLoadLevel=z,this.bwEstimator.sample(x,m.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:a,stats:m})},y.onFragLoaded=function(l,a){var s=a.frag,u=a.part;if(s.type===O.PlaylistLevelType.MAIN&&Object(W.isFiniteNumber)(s.sn)){var C=u?u.stats:s.stats,g=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[s.level],L=(m.loaded?m.loaded.bytes:0)+C.loaded,x=(m.loaded?m.loaded.duration:0)+g;m.loaded={bytes:L,duration:x},m.realBitrate=Math.round(8*L/x)}if(s.bitrateTest){var f={stats:C,frag:s,part:u,id:s.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,f),s.bitrateTest=!1}}},y.onFragBuffered=function(l,a){var s=a.frag,u=a.part,C=u?u.stats:s.stats;if(C.aborted)return;if(s.type!==O.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var g=C.parsing.end-C.loading.start;this.bwEstimator.sample(g,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},y.onError=function(l,a){switch(a.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},y.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},y.getNextABRAutoLevel=function(){var l=this.fragCurrent,a=this.partCurrent,s=this.hls,u=s.maxAutoLevel,C=s.config,g=s.minAutoLevel,m=s.media,L=a?a.duration:l?l.duration:0,x=m?m.currentTime:0,f=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,h=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,d=(I.BufferHelper.bufferInfo(m,x,C.maxBufferHole).end-x)/f,o=this.findBestLevel(h,g,u,d,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(o>=0)return o;_.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var T=L?Math.min(L,C.maxStarvationDelay):C.maxStarvationDelay,E=C.abrBandWidthFactor,v=C.abrBandWidthUpFactor;if(!d){var R=this.bitrateTestDelay;if(R){var N=L?Math.min(L,C.maxLoadingDelay):C.maxLoadingDelay;T=N-R,_.logger.trace("bitrate test took "+Math.round(1e3*R)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*T)+" ms"),E=v=1}}return o=this.findBestLevel(h,g,u,d+T,E,v),Math.max(o,0)},y.findBestLevel=function(l,a,s,u,C,g){for(var m,L=this.fragCurrent,x=this.partCurrent,f=this.lastLoadedFragLevel,h=this.hls.levels,d=h[f],o=!!(d!=null&&(m=d.details)!==null&&m!==void 0&&m.live),T=d==null?void 0:d.codecSet,E=x?x.duration:L?L.duration:0,v=s;v>=a;v--){var R=h[v];if(!R||T&&R.codecSet!==T)continue;var N=R.details,B=(x?N==null?void 0:N.partTarget:N==null?void 0:N.averagetargetduration)||E,z=void 0;v<=f?z=C*l:z=g*l;var j=h[v].maxBitrate,F=j*B/z;if(_.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(z)+"/"+j+"/"+B+"/"+u+"/"+F),z>j&&(!F||o&&!this.bitrateTestDelay||F<u))return v}return-1},p(w,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,a=this.bwEstimator;if(l!==-1&&(!a||!a.canEstimate()))return l;var s=this.getNextABRAutoLevel();return l!==-1&&(s=Math.min(l,s)),s},set:function(l){this._nextAutoLevel=l}}]),w}();K.default=D},"./src/controller/audio-stream-controller.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/controller/base-stream-controller.ts"),P=A("./src/events.ts"),I=A("./src/utils/buffer-helper.ts"),k=A("./src/controller/fragment-tracker.ts"),O=A("./src/types/level.ts"),_=A("./src/types/loader.ts"),c=A("./src/loader/fragment.ts"),p=A("./src/demux/chunk-cache.ts"),D=A("./src/demux/transmuxer-interface.ts"),w=A("./src/types/transmuxer.ts"),y=A("./src/controller/fragment-finders.ts"),b=A("./src/utils/discontinuities.ts"),l=A("./src/errors.ts"),a=A("./src/utils/logger.ts");function s(){return s=Object.assign||function(L){for(var x=1;x<arguments.length;x++){var f=arguments[x];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(L[h]=f[h])}return L},s.apply(this,arguments)}function u(L,x){L.prototype=Object.create(x.prototype),L.prototype.constructor=L,C(L,x)}function C(L,x){return C=Object.setPrototypeOf||function(h,d){return h.__proto__=d,h},C(L,x)}var g=100,m=function(L){u(x,L);function x(h,d){var o;return o=L.call(this,h,d,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var f=x.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var d=this.hls;d.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(P.Events.ERROR,this.onError,this),d.on(P.Events.BUFFER_RESET,this.onBufferReset,this),d.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var d=this.hls;d.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(P.Events.ERROR,this.onError,this),d.off(P.Events.BUFFER_RESET,this.onBufferReset,this),d.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(d,o){var T=o.frag,E=o.id,v=o.initPTS;if(E==="main"){var R=T.cc;this.initPTS[T.cc]=v,this.log("InitPTS for cc: "+R+" found from main: "+v),this.videoTrackCC=R,this.state===M.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=M.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,o>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=M.State.IDLE):(this.loadedmetadata=!1,this.state=M.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},f.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_TRACK:{var d,o=this.levels,T=this.trackId,E=o==null||((d=o[T])===null||d===void 0)?void 0:d.details;if(E){if(this.waitForCdnTuneIn(E))break;this.state=M.State.WAITING_INIT_PTS}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var v,R=performance.now(),N=this.retryDate;(!N||R>=N||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=M.State.IDLE);break}case M.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var z=B.frag,j=B.part,F=B.cache,X=B.complete;if(this.initPTS[z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.FRAG_LOADING;var q=F.flush(),ne={frag:z,part:j,payload:q,networkDetails:null};this._handleFragmentLoadProgress(ne),X&&L.prototype._handleFragmentLoadComplete.call(this,ne)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ue=this.getLoadPosition(),Ee=I.BufferHelper.bufferInfo(this.mediaBuffer,ue,this.config.maxBufferHole),pe=Object(y.fragmentWithinToleranceTest)(Ee.end,this.config.maxFragLookUpTolerance,z);pe<0&&(a.logger.log("Waiting fragment cc ("+z.cc+") @ "+z.start+" cancelled because another fragment at "+Ee.end+" is needed"),this.clearWaitingFragment())}}else this.state=M.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=M.State.IDLE)},f.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:d,T=o.buffered;!this.loadedmetadata&&T.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},f.doTickIdle=function(){var d,o,T=this.hls,E=this.levels,v=this.media,R=this.trackId,N=T.config;if(!E||!E[R])return;if(!v&&(this.startFragRequested||!N.startFragPrefetch))return;var B=E[R],z=B.details;if(!z||z.live&&this.levelLastLoaded!==R||this.waitForCdnTuneIn(z)){this.state=M.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,c.ElementaryStreamTypes.AUDIO,_.PlaylistLevelType.AUDIO));var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,_.PlaylistLevelType.AUDIO);if(j===null)return;var F=j.len,X=this.getMaxBufferLength(),q=this.audioSwitch;if(F>=X&&!q)return;if(!q&&this._streamEnded(j,z)){T.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=M.State.ENDED;return}var ne=z.fragments,ue=ne[0].start,Ee=j.end;if(q){var pe=this.getLoadPosition();Ee=pe,z.PTSKnown&&pe<ue&&((j.end>ue||j.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),v.currentTime=ue+.05))}var fe=this.getNextFragment(Ee,z);if(!fe){this.bufferFlushed=!0;return}((d=fe.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((o=fe.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(fe,z):this.loadFragment(fe,z,Ee)},f.getMaxBufferLength=function(){var d=L.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,_.PlaylistLevelType.MAIN);return o===null?d:Math.max(d,o.len)},f.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(d,o){var T=o.audioTracks;this.resetTransmuxer(),this.levels=T.map(function(E){return new O.Level(E)})},f.onAudioTrackSwitching=function(d,o){var T=!!o.url;this.trackId=o.id;var E=this.fragCurrent;E!=null&&E.loader&&E.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),T?this.setInterval(g):this.resetTransmuxer(),T?(this.audioSwitch=!0,this.state=M.State.IDLE):this.state=M.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,o){this.mainDetails=o.details},f.onAudioTrackLoaded=function(d,o){var T,E=this.levels,v=o.details,R=o.id;if(!E){this.warn("Audio tracks were reset while loading level "+R);return}this.log("Track "+R+" loaded ["+v.startSN+","+v.endSN+"],duration:"+v.totalduration);var N=E[R],B=0;if(v.live||(T=N.details)!==null&&T!==void 0&&T.live){var z=this.mainDetails;if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed||!z)return;!N.details&&v.hasProgramDateTime&&z.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(v,z),B=v.fragments[0].start):B=this.alignPlaylists(v,N.details)}N.details=v,this.levelLastLoaded=R,!this.startFragRequested&&(this.mainDetails||!v.live)&&this.setStartPosition(N.details,B),this.state===M.State.WAITING_TRACK&&!this.waitForCdnTuneIn(v)&&(this.state=M.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(d){var o,T=d.frag,E=d.part,v=d.payload,R=this.config,N=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+T.sn+" of level "+T.level+" will not be buffered");return}var z=B[N];console.assert(z,"Audio track is defined on fragment load progress");var j=z.details;console.assert(j,"Audio track details are defined on fragment load progress");var F=R.defaultAudioCodec||z.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new D.default(this.hls,_.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var q=this.initPTS[T.cc],ne=(o=T.initSegment)===null||o===void 0?void 0:o.data;if(q!==void 0){var ue=!1,Ee=E?E.index:-1,pe=Ee!==-1,fe=new w.ChunkMetadata(T.level,T.sn,T.stats.chunkCount,v.byteLength,Ee,pe);X.push(v,ne,F,"",T,E,j.totalduration,ue,fe,q)}else{a.logger.log("Unknown video PTS for cc "+T.cc+", waiting for video PTS before demuxing audio frag "+T.sn+" of ["+j.startSN+" ,"+j.endSN+"],track "+N);var de=this.waitingData=this.waitingData||{frag:T,part:E,cache:new p.default,complete:!1},ce=de.cache;ce.push(new Uint8Array(v)),this.waitingVideoCC=this.videoTrackCC,this.state=M.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,d)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(d,o){var T=o.tracks.audio;T&&(this.mediaBuffer=T.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},f.onFragBuffered=function(d,o){var T=o.frag,E=o.part;if(T.type!==_.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(T)){this.warn("Fragment "+T.sn+(E?" p: "+E.index:"")+" of level "+T.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}T.sn!=="initSegment"&&(this.fragPrevious=T,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(T,E)},f.onError=function(d,o){switch(o.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.AUDIO,o);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==M.State.ERROR&&this.state!==M.State.STOPPED&&(this.state=o.fatal?M.State.ERROR:M.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var T=!0,E=this.getFwdBufferInfo(this.mediaBuffer,_.PlaylistLevelType.AUDIO);E&&E.len>.5&&(T=!this.reduceMaxBufferLength(E.len)),T&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(d,o){var T=o.type;T===c.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(d){var o,T="audio",E=this.hls,v=d.remuxResult,R=d.chunkMeta,N=this.getCurrentContext(R);if(!N){this.warn("The loading context changed while buffering fragment "+R.sn+" of level "+R.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(R.level);return}var B=N.frag,z=N.part,j=v.audio,F=v.text,X=v.id3,q=v.initSegment;if(this.fragContextChanged(B))return;if(this.state=M.State.PARSING,this.audioSwitch&&j&&this.completeAudioSwitch(),q!=null&&q.tracks&&(this._bufferInitSegment(q.tracks,B,R),E.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:T,tracks:q.tracks})),j){var ne=j.startPTS,ue=j.endPTS,Ee=j.startDTS,pe=j.endDTS;z&&(z.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:ne,endPTS:ue,startDTS:Ee,endDTS:pe}),B.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,ne,ue,Ee,pe),this.bufferFragmentData(j,B,z,R)}if(X!=null&&(o=X.samples)!==null&&o!==void 0&&o.length){var fe=s({frag:B,id:T},X);E.trigger(P.Events.FRAG_PARSING_METADATA,fe)}if(F){var de=s({frag:B,id:T},F);E.trigger(P.Events.FRAG_PARSING_USERDATA,de)}},f._bufferInitSegment=function(d,o,T){if(this.state!==M.State.PARSING)return;d.video&&delete d.video;var E=d.audio;if(!E)return;E.levelCodec=E.codec,E.id="audio",this.log("Init audio buffer, container:"+E.container+", codecs[parsed]=["+E.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,d);var v=E.initSegment;if(v!=null&&v.byteLength){var R={type:"audio",frag:o,part:null,chunkMeta:T,parent:o.type,data:v};this.hls.trigger(P.Events.BUFFER_APPENDING,R)}this.tick()},f.loadFragment=function(d,o,T){var E=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||E===k.FragmentState.NOT_LOADED||E===k.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):o.live&&!Object(W.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=M.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,d,o,T)))},f.completeAudioSwitch=function(){var d=this.hls,o=this.media,T=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:T})},x}(M.default);K.default=m},"./src/controller/audio-track-controller.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/controller/base-playlist-controller.ts"),I=A("./src/types/loader.ts");function k(D,w){for(var y=0;y<w.length;y++){var b=w[y];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(D,b.key,b)}}function O(D,w,y){return w&&k(D.prototype,w),y&&k(D,y),D}function _(D,w){D.prototype=Object.create(w.prototype),D.prototype.constructor=D,c(D,w)}function c(D,w){return c=Object.setPrototypeOf||function(b,l){return b.__proto__=l,b},c(D,w)}var p=function(D){_(w,D);function w(b){var l;return l=D.call(this,b,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var y=w.prototype;return y.registerListeners=function(){var l=this.hls;l.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(W.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var l=this.hls;l.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(W.Events.ERROR,this.onError,this)},y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,D.prototype.destroy.call(this)},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},y.onManifestParsed=function(l,a){this.tracks=a.audioTracks||[]},y.onAudioTrackLoaded=function(l,a){var s=a.id,u=a.details,C=this.tracksInGroup[s];if(!C){this.warn("Invalid audio track id "+s);return}var g=C.details;C.details=a.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,a,g))},y.onLevelLoading=function(l,a){this.switchLevel(a.level)},y.onLevelSwitching=function(l,a){this.switchLevel(a.level)},y.switchLevel=function(l){var a=this.hls.levels[l];if(!(a!=null&&a.audioGroupIds))return;var s=a.audioGroupIds[a.urlId];if(this.groupId!==s){this.groupId=s;var u=this.tracks.filter(function(g){return!s||g.groupId===s});this.selectDefaultTrack&&!u.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var C={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(W.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},y.onError=function(l,a){if(D.prototype.onError.call(this,l,a),a.fatal||!a.context)return;a.context.type===I.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},y.setAudioTrack=function(l){var a=this.tracksInGroup;if(l<0||l>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=a[this.trackId];this.log("Now switching to audio-track index "+l);var u=a[l],C=u.id,g=u.groupId,m=g===void 0?"":g,L=u.name,x=u.type,f=u.url;if(this.trackId=l,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(W.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:m,name:L,type:x,url:f}),u.details&&!u.details.live)return;var h=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(h)},y.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,s=this.findTrackId(a)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},y.findTrackId=function(l){for(var a=this.tracksInGroup,s=0;s<a.length;s++){var u=a[s];if((!this.selectDefaultTrack||u.default)&&(!l||l===u.name))return u.id}return-1},y.loadPlaylist=function(l){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var s=a.id,u=a.groupId,C=a.url;if(l)try{C=l.addDirectives(C)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(W.Events.AUDIO_TRACK_LOADING,{url:C,id:s,groupId:u,deliveryDirectives:l||null})}},O(w,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),w}(P.default);K.default=p},"./src/controller/base-playlist-controller.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return O});var W=A("./src/polyfills/number.ts"),M=A("./src/types/level.ts"),P=A("./src/controller/level-helper.ts"),I=A("./src/utils/logger.ts"),k=A("./src/errors.ts"),O=function(){function _(p,D){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=I.logger.log.bind(I.logger,D+":"),this.warn=I.logger.warn.bind(I.logger,D+":"),this.hls=p}var c=_.prototype;return c.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},c.onError=function(D,w){w.fatal&&w.type===k.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},c.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},c.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},c.stopLoad=function(){this.canLoad=!1,this.clearTimer()},c.switchParams=function(D,w){var y=w==null?void 0:w.renditionReports;if(y)for(var b=0;b<y.length;b++){var l=y[b],a=""+l.URI;if(a===D.substr(-a.length)){var s=parseInt(l["LAST-MSN"]),u=parseInt(l["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var C=Math.min(w.age-w.partTarget,w.targetduration);u!==void 0&&C>w.partTarget&&(u+=1)}if(Object(W.isFiniteNumber)(s))return new M.HlsUrlParameters(s,Object(W.isFiniteNumber)(u)?u:void 0,M.HlsSkip.No)}}},c.loadPlaylist=function(D){},c.shouldLoadTrack=function(D){return this.canLoad&&D&&!!D.url&&(!D.details||D.details.live)},c.playlistLoaded=function(D,w,y){var b=this,l=w.details,a=w.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||y!=null&&y.live){if(l.reloaded(y),y&&this.log("live playlist "+D+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),y&&l.fragments.length>0&&Object(P.mergeDetails)(y,l),!this.canLoad||!l.live)return;var u,C=void 0,g=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var m=this.hls.config.lowLatencyMode,L=l.lastPartSn,x=l.endSN,f=l.lastPartIndex,h=f!==-1,d=L===x,o=m?0:f;h?(C=d?x+1:L,g=d?o:f+1):C=x+1;var T=l.age,E=T+l.ageHeader,v=Math.min(E-l.partTarget,l.targetduration*1.5);if(v>0){if(y&&v>y.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+y.tuneInGoal+" to: "+v+" with playlist age: "+l.age),v=0;else{var R=Math.floor(v/l.targetduration);if(C+=R,g!==void 0){var N=Math.round(v%l.targetduration/l.partTarget);g+=N}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+T.toFixed(2)+"s goal: "+v+" skip sn "+R+" to part "+g)}l.tuneInGoal=v}if(u=this.getDeliveryDirectives(l,w.deliveryDirectives,C,g),m||!d){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(l,w.deliveryDirectives,C,g);var B=Object(P.computeReloadInterval)(l,a);C!==void 0&&l.canBlockReload&&(B-=l.partTarget||1),this.log("reload live playlist "+D+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(u)},B)}else this.clearTimer()},c.getDeliveryDirectives=function(D,w,y,b){var l=Object(M.getSkipValue)(D,y);return w!=null&&w.skip&&D.deltaUpdateFailed&&(y=w.msn,b=w.part,l=M.HlsSkip.No),new M.HlsUrlParameters(y,b,l)},c.retryLoadingOrFail=function(D){var w=this,y=this.hls.config,b=this.retryCount<y.levelLoadingMaxRetry;if(b){var l;if(this.retryCount++,D.details.indexOf("LoadTimeOut")>-1&&(l=D.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+D.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*y.levelLoadingRetryDelay,y.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+D.details+'"')}}else this.warn('cannot recover from error "'+D.details+'"'),this.clearTimer(),D.fatal=!0;return b},_}()},"./src/controller/base-stream-controller.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"State",function(){return x}),A.d(K,"default",function(){return f});var W=A("./src/polyfills/number.ts"),M=A("./src/task-loop.ts"),P=A("./src/controller/fragment-tracker.ts"),I=A("./src/utils/buffer-helper.ts"),k=A("./src/utils/logger.ts"),O=A("./src/events.ts"),_=A("./src/errors.ts"),c=A("./src/types/transmuxer.ts"),p=A("./src/utils/mp4-tools.ts"),D=A("./src/utils/discontinuities.ts"),w=A("./src/controller/fragment-finders.ts"),y=A("./src/controller/level-helper.ts"),b=A("./src/loader/fragment-loader.ts"),l=A("./src/crypt/decrypter.ts"),a=A("./src/utils/time-ranges.ts"),s=A("./src/types/loader.ts");function u(h,d){for(var o=0;o<d.length;o++){var T=d[o];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(h,T.key,T)}}function C(h,d,o){return d&&u(h.prototype,d),o&&u(h,o),h}function g(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,L(h,d)}function L(h,d){return L=Object.setPrototypeOf||function(T,E){return T.__proto__=E,T},L(h,d)}var x={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},f=function(h){m(d,h);function d(T,E,v){var R;return R=h.call(this)||this,R.hls=void 0,R.fragPrevious=null,R.fragCurrent=null,R.fragmentTracker=void 0,R.transmuxer=null,R._state=x.STOPPED,R.media=void 0,R.mediaBuffer=void 0,R.config=void 0,R.bitrateTest=!1,R.lastCurrentTime=0,R.nextLoadPosition=0,R.startPosition=0,R.loadedmetadata=!1,R.fragLoadError=0,R.retryDate=0,R.levels=null,R.fragmentLoader=void 0,R.levelLastLoaded=null,R.startFragRequested=!1,R.decrypter=void 0,R.initPTS=[],R.onvseeking=null,R.onvended=null,R.logPrefix="",R.log=void 0,R.warn=void 0,R.logPrefix=v,R.log=k.logger.log.bind(k.logger,v+":"),R.warn=k.logger.warn.bind(k.logger,v+":"),R.hls=T,R.fragmentLoader=new b.default(T.config),R.fragmentTracker=E,R.config=T.config,R.decrypter=new l.default(T,T.config),T.on(O.Events.KEY_LOADED,R.onKeyLoaded,g(R)),R}var o=d.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(E){},o.stopLoad=function(){this.fragmentLoader.abort();var E=this.fragCurrent;E&&this.fragmentTracker.removeFragment(E),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},o._streamEnded=function(E,v){var R=this.fragCurrent,N=this.fragmentTracker;if(!v.live&&R&&R.sn===v.endSN&&!E.nextStart){var B=N.getState(R);return B===P.FragmentState.PARTIAL||B===P.FragmentState.OK}return!1},o.onMediaAttached=function(E,v){var R=this.media=this.mediaBuffer=v.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),R.addEventListener("seeking",this.onvseeking),R.addEventListener("ended",this.onvended);var N=this.config;this.levels&&N.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(N.startPosition)},o.onMediaDetaching=function(){var E=this.media;E!=null&&E.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),E&&(E.removeEventListener("seeking",this.onvseeking),E.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var E=this.config,v=this.fragCurrent,R=this.media,N=this.mediaBuffer,B=this.state,z=R?R.currentTime:0,j=I.BufferHelper.bufferInfo(N||R,z,E.maxBufferHole);if(this.log("media seeking to "+(Object(W.isFiniteNumber)(z)?z.toFixed(3):z)+", state: "+B),B===x.ENDED)this.resetLoadingState();else if(v&&!j.len){var F=E.maxFragLookUpTolerance,X=v.start-F,q=v.start+v.duration+F,ne=z>q;(z<X||ne)&&(ne&&v.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),v.loader.abort()),this.resetLoadingState())}R&&(this.lastCurrentTime=z),!this.loadedmetadata&&!j.len&&(this.nextLoadPosition=this.startPosition=z),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(E,v){if(this.state!==x.KEY_LOADING||v.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var R=this.levels[v.frag.level].details;R&&this.loadFragment(v.frag,R,v.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),h.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=x.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)},o.loadKey=function(E,v){this.log("Loading key for "+E.sn+" of ["+v.startSN+"-"+v.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+E.level),this.state=x.KEY_LOADING,this.fragCurrent=E,this.hls.trigger(O.Events.KEY_LOADING,{frag:E})},o.loadFragment=function(E,v,R){this._loadFragForPlayback(E,v,R)},o._loadFragForPlayback=function(E,v,R){var N=this,B=function(j){if(N.fragContextChanged(E)){N.warn("Fragment "+E.sn+(j.part?" p: "+j.part.index:"")+" of level "+E.level+" was dropped during download."),N.fragmentTracker.removeFragment(E);return}E.stats.chunkCount++,N._handleFragmentLoadProgress(j)};this._doFragLoad(E,v,R,B).then(function(z){if(!z)return;N.fragLoadError=0;var j=N.state;if(N.fragContextChanged(E)){(j===x.FRAG_LOADING||j===x.BACKTRACKING||!N.fragCurrent&&j===x.PARSING)&&(N.fragmentTracker.removeFragment(E),N.state=x.IDLE);return}if("payload"in z&&(N.log("Loaded fragment "+E.sn+" of level "+E.level),N.hls.trigger(O.Events.FRAG_LOADED,z),N.state===x.BACKTRACKING)){N.fragmentTracker.backtrack(E,z),N.resetFragmentLoading(E);return}N._handleFragmentLoadComplete(z)}).catch(function(z){N.warn(z),N.resetFragmentLoading(E)})},o.flushMainBuffer=function(E,v,R){if(R===void 0&&(R=null),!(E-v))return;var N={startOffset:E,endOffset:v,type:R};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,N)},o._loadInitSegment=function(E){var v=this;this._doFragLoad(E).then(function(R){if(!R||v.fragContextChanged(E)||!v.levels)throw new Error("init load aborted");return R}).then(function(R){var N=v.hls,B=R.payload,z=E.decryptdata;if(B&&B.byteLength>0&&z&&z.key&&z.iv&&z.method==="AES-128"){var j=self.performance.now();return v.decrypter.webCryptoDecrypt(new Uint8Array(B),z.key.buffer,z.iv.buffer).then(function(F){var X=self.performance.now();return N.trigger(O.Events.FRAG_DECRYPTED,{frag:E,payload:F,stats:{tstart:j,tdecrypt:X}}),R.payload=F,R})}return R}).then(function(R){var N=v.fragCurrent,B=v.hls,z=v.levels;if(!z)throw new Error("init load aborted, missing levels");var j=z[E.level].details;console.assert(j,"Level details are defined when init segment is loaded");var F=E.stats;v.state=x.IDLE,v.fragLoadError=0,E.data=new Uint8Array(R.payload),F.parsing.start=F.buffering.start=self.performance.now(),F.parsing.end=F.buffering.end=self.performance.now(),R.frag===N&&B.trigger(O.Events.FRAG_BUFFERED,{stats:F,frag:N,part:null,id:E.type}),v.tick()}).catch(function(R){v.warn(R),v.resetFragmentLoading(E)})},o.fragContextChanged=function(E){var v=this.fragCurrent;return!E||!v||E.level!==v.level||E.sn!==v.sn||E.urlId!==v.urlId},o.fragBufferedComplete=function(E,v){var R=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+E.type+" sn: "+E.sn+(v?" part: "+v.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+E.level+" "+a.default.toString(I.BufferHelper.getBuffered(R))),this.state=x.IDLE,this.tick()},o._handleFragmentLoadComplete=function(E){var v=this.transmuxer;if(!v)return;var R=E.frag,N=E.part,B=E.partsLoaded,z=!B||B.length===0||B.some(function(F){return!F}),j=new c.ChunkMetadata(R.level,R.sn,R.stats.chunkCount+1,0,N?N.index:-1,!z);v.flush(j)},o._handleFragmentLoadProgress=function(E){},o._doFragLoad=function(E,v,R,N){var B=this;if(R===void 0&&(R=null),!this.levels)throw new Error("frag load aborted, missing levels");if(R=Math.max(E.start,R||0),this.config.lowLatencyMode&&v){var z=v.partList;if(z&&N){R>E.end&&v.fragmentHint&&(E=v.fragmentHint);var j=this.getNextPart(z,E,R);if(j>-1){var F=z[j];return this.log("Loading part sn: "+E.sn+" p: "+F.index+" cc: "+E.cc+" of playlist ["+v.startSN+"-"+v.endSN+"] parts [0-"+j+"-"+(z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+E.level+", target: "+parseFloat(R.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=x.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:E,part:z[j],targetBufferTime:R}),this.doFragPartsLoad(E,z,j,N).catch(function(X){return B.handleFragLoadError(X)})}else if(!E.url||this.loadedEndOfParts(z,R))return Promise.resolve(null)}}return this.log("Loading fragment "+E.sn+" cc: "+E.cc+" "+(v?"of ["+v.startSN+"-"+v.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+E.level+", target: "+parseFloat(R.toFixed(3))),Object(W.isFiniteNumber)(E.sn)&&!this.bitrateTest&&(this.nextLoadPosition=E.start+E.duration),this.state=x.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:E,targetBufferTime:R}),this.fragmentLoader.load(E,N).catch(function(X){return B.handleFragLoadError(X)})},o.doFragPartsLoad=function(E,v,R,N){var B=this;return new Promise(function(z,j){var F=[],X=function q(ne){var ue=v[ne];B.fragmentLoader.loadPart(E,ue,N).then(function(Ee){F[ue.index]=Ee;var pe=Ee.part;B.hls.trigger(O.Events.FRAG_LOADED,Ee);var fe=v[ne+1];if(fe&&fe.fragment===E)q(ne+1);else return z({frag:E,part:pe,partsLoaded:F})}).catch(j)};X(R)})},o.handleFragLoadError=function(E){var v=E.data;return v&&v.details===_.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(v.frag,v.part):this.hls.trigger(O.Events.ERROR,v),null},o._handleTransmuxerFlush=function(E){var v=this.getCurrentContext(E);if(!v||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var R=v.frag,N=v.part,B=v.level,z=self.performance.now();R.stats.parsing.end=z,N&&(N.stats.parsing.end=z),this.updateLevelTiming(R,N,B,E.partial)},o.getCurrentContext=function(E){var v=this.levels,R=E.level,N=E.sn,B=E.part;if(!v||!v[R])return this.warn("Levels object was unset while buffering fragment "+N+" of level "+R+". The current chunk will not be buffered."),null;var z=v[R],j=B>-1?Object(y.getPartWith)(z,N,B):null,F=j?j.fragment:Object(y.getFragmentWithSN)(z,N,this.fragCurrent);return F?{frag:F,part:j,level:z}:null},o.bufferFragmentData=function(E,v,R,N){if(!E||this.state!==x.PARSING)return;var B=E.data1,z=E.data2,j=B;if(B&&z&&(j=Object(p.appendUint8Array)(B,z)),!j||!j.length)return;var F={type:E.type,frag:v,part:R,chunkMeta:N,parent:v.type,data:j};this.hls.trigger(O.Events.BUFFER_APPENDING,F),E.dropped&&E.independent&&!R&&this.flushBufferGap(v)},o.flushBufferGap=function(E){var v=this.media;if(!v)return;if(!I.BufferHelper.isBuffered(v,v.currentTime)){this.flushMainBuffer(0,E.start);return}var R=v.currentTime,N=I.BufferHelper.bufferInfo(v,R,0),B=E.duration,z=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),j=Math.max(Math.min(E.start-z,N.end-z),R+z);E.start-j>z&&this.flushMainBuffer(j,E.start)},o.getFwdBufferInfo=function(E,v){var R=this.config,N=this.getLoadPosition();if(!Object(W.isFiniteNumber)(N))return null;var B=I.BufferHelper.bufferInfo(E,N,R.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var z=this.fragmentTracker.getBufferedFrag(N,v);if(z&&B.nextStart<z.end)return I.BufferHelper.bufferInfo(E,N,Math.max(B.nextStart,R.maxBufferHole))}return B},o.getMaxBufferLength=function(E){var v=this.config,R;return E?R=Math.max(8*v.maxBufferSize/E,v.maxBufferLength):R=v.maxBufferLength,Math.min(R,v.maxMaxBufferLength)},o.reduceMaxBufferLength=function(E){var v=this.config,R=E||v.maxBufferLength;return v.maxMaxBufferLength>=R?(v.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+v.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(E,v){var R,N,B=v.fragments,z=B.length;if(!z)return null;var j=this.config,F=B[0].start,X;if(v.live){var q=j.initialLiveManifestSize;if(z<q)return this.warn("Not enough fragments to start playback (have: "+z+", need: "+q+")"),null;!v.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(v,B),this.startPosition=X?this.hls.liveSyncPosition||X.start:E)}else E<=F&&(X=B[0]);if(!X){var ne=j.lowLatencyMode?v.partEnd:v.fragmentEnd;X=this.getFragmentAtPosition(E,ne,v)}return(R=X)!==null&&R!==void 0&&R.initSegment&&!((N=X)!==null&&N!==void 0&&N.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},o.getNextPart=function(E,v,R){for(var N=-1,B=!1,z=!0,j=0,F=E.length;j<F;j++){var X=E[j];if(z=z&&!X.independent,N>-1&&R<X.start)break;var q=X.loaded;!q&&(B||X.independent||z)&&X.fragment===v&&(N=j),B=q}return N},o.loadedEndOfParts=function(E,v){var R=E[E.length-1];return R&&v>R.start&&R.loaded},o.getInitialLiveFragment=function(E,v){var R=this.fragPrevious,N=null;if(R){if(E.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+R.programDateTime),N=Object(w.findFragmentByPDT)(v,R.endProgramDateTime,this.config.maxFragLookUpTolerance)),!N){var B=R.sn+1;if(B>=E.startSN&&B<=E.endSN){var z=v[B-E.startSN];R.cc===z.cc&&(N=z,this.log("Live playlist, switching playlist, load frag with next SN: "+N.sn))}N||(N=Object(w.findFragWithCC)(v,R.cc),N&&this.log("Live playlist, switching playlist, load frag with same CC: "+N.sn))}}else{var j=this.hls.liveSyncPosition;j!==null&&(N=this.getFragmentAtPosition(j,this.bitrateTest?E.fragmentEnd:E.edge,E))}return N},o.getFragmentAtPosition=function(E,v,R){var N=this.config,B=this.fragPrevious,z=R.fragments,j=R.endSN,F=R.fragmentHint,X=N.maxFragLookUpTolerance,q=!!(N.lowLatencyMode&&R.partList&&F);q&&F&&!this.bitrateTest&&(z=z.concat(F),j=F.sn);var ne;if(E<v){var ue=E>v-X?0:X;ne=Object(w.findFragmentByPTS)(B,z,E,ue)}else ne=z[z.length-1];if(ne){var Ee=ne.sn-R.startSN,pe=B&&ne.level===B.level,fe=z[Ee+1],de=this.fragmentTracker.getState(ne);if(de===P.FragmentState.BACKTRACKED){ne=null;for(var ce=Ee;z[ce]&&this.fragmentTracker.getState(z[ce])===P.FragmentState.BACKTRACKED;)B?ne=z[ce--]:ne=z[--ce];ne||(ne=fe)}else B&&ne.sn===B.sn&&!q&&(pe&&(ne.sn<j&&this.fragmentTracker.getState(fe)!==P.FragmentState.OK?(this.log("SN "+ne.sn+" just loaded, load next one: "+fe.sn),ne=fe):ne=null))}return ne},o.synchronizeToLiveEdge=function(E){var v=this.config,R=this.media;if(!R)return;var N=this.hls.liveSyncPosition,B=R.currentTime,z=E.fragments[0].start,j=E.edge,F=B>=z-v.maxFragLookUpTolerance&&B<=j;if(N!==null&&R.duration>N&&(B<N||!F)){var X=v.liveMaxLatencyDuration!==void 0?v.liveMaxLatencyDuration:v.liveMaxLatencyDurationCount*E.targetduration;(!F&&R.readyState<4||B<j-X)&&(this.loadedmetadata||(this.nextLoadPosition=N),R.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+j+", reset currentTime to : "+N.toFixed(3)),R.currentTime=N))}},o.alignPlaylists=function(E,v){var R=this.levels,N=this.levelLastLoaded,B=this.fragPrevious,z=N!==null?R[N]:null,j=E.fragments.length;if(!j)return this.warn("No fragments in live playlist"),0;var F=E.fragments[0].start,X=!v,q=E.alignedSliding&&Object(W.isFiniteNumber)(F);if(X||!q&&!F){Object(D.alignStream)(B,z,E);var ne=E.fragments[0].start;return this.log("Live playlist sliding: "+ne.toFixed(2)+" start-sn: "+(v?v.startSN:"na")+"->"+E.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+j),ne}return F},o.waitForCdnTuneIn=function(E){var v=3;return E.live&&E.canBlockReload&&E.tuneInGoal>Math.max(E.partHoldBack,E.partTarget*v)},o.setStartPosition=function(E,v){var R=this.startPosition;if(R<v&&(R=-1),R===-1||this.lastCurrentTime===-1){var N=E.startTimeOffset;Object(W.isFiniteNumber)(N)?(R=v+N,N<0&&(R+=E.totalduration),R=Math.min(Math.max(v,R),v+E.totalduration),this.log("Start time offset "+N+" found in playlist, adjust startPosition to "+R),this.startPosition=R):E.live?R=this.hls.liveSyncPosition||v:this.startPosition=R=0,this.lastCurrentTime=R}this.nextLoadPosition=R},o.getLoadPosition=function(){var E=this.media,v=0;return this.loadedmetadata&&E?v=E.currentTime:this.nextLoadPosition&&(v=this.nextLoadPosition),v},o.handleFragLoadAborted=function(E,v){this.transmuxer&&E.sn!=="initSegment"&&E.stats.aborted&&(this.warn("Fragment "+E.sn+(v?" part"+v.index:"")+" of level "+E.level+" was aborted"),this.resetFragmentLoading(E))},o.resetFragmentLoading=function(E){(!this.fragCurrent||!this.fragContextChanged(E))&&(this.state=x.IDLE)},o.onFragmentOrKeyLoadError=function(E,v){if(v.fatal)return;var R=v.frag;if(!R||R.type!==E)return;var N=this.fragCurrent;console.assert(N&&R.sn===N.sn&&R.level===N.level&&R.urlId===N.urlId,"Frag load error must match current frag to retry");var B=this.config;if(this.fragLoadError+1<=B.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(R.level))return;var z=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+R.sn+" of "+E+" "+R.level+" failed to load, retrying in "+z+"ms"),this.retryDate=self.performance.now()+z,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else v.levelRetry?(E===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(k.logger.error(v.details+" reaches max retry, redispatch as fatal ..."),v.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},o.afterBufferFlushed=function(E,v,R){if(!E)return;var N=I.BufferHelper.getBuffered(E);this.fragmentTracker.detectEvictedFragments(v,N,R),this.state===x.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},o.resetLiveStartWhenNotLoaded=function(E){if(!this.loadedmetadata){this.startFragRequested=!1;var v=this.levels?this.levels[E].details:null;if(v!=null&&v.live)return this.startPosition=-1,this.setStartPosition(v,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(E,v,R,N){var B=this,z=R.details;console.assert(!!z,"level.details must be defined");var j=Object.keys(E.elementaryStreams).reduce(function(F,X){var q=E.elementaryStreams[X];if(q){var ne=q.endPTS-q.startPTS;if(ne<=0)return B.warn("Could not parse fragment "+E.sn+" "+X+" duration reliably ("+ne+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),F||!1;var ue=N?0:Object(y.updateFragPTSDTS)(z,E,q.startPTS,q.endPTS,q.startDTS,q.endDTS);return B.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:z,level:R,drift:ue,type:X,frag:E,start:q.startPTS,end:q.endPTS}),!0}return F},!1);j?(this.state=x.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:E,part:v})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(d,[{key:"state",get:function(){return this._state},set:function(E){var v=this._state;v!==E&&(this._state=E,this.log(v+"->"+E))}}]),d}(M.default)},"./src/controller/buffer-controller.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return w});var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts"),I=A("./src/errors.ts"),k=A("./src/utils/buffer-helper.ts"),O=A("./src/utils/mediasource-helper.ts"),_=A("./src/loader/fragment.ts"),c=A("./src/controller/buffer-operation-queue.ts"),p=Object(O.getMediaSource)(),D=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function y(l){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=a.hls,u=a.media,C=a.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),u&&(a.updateMediaElementDuration(),s.trigger(M.Events.MEDIA_ATTACHED,{media:u})),C&&C.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var b=y.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.registerListeners=function(){var a=this.hls;a.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(M.Events.BUFFER_RESET,this.onBufferReset,this),a.on(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(M.Events.BUFFER_EOS,this.onBufferEos,this),a.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(M.Events.FRAG_PARSED,this.onFragParsed,this),a.on(M.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var a=this.hls;a.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(M.Events.BUFFER_RESET,this.onBufferReset,this),a.off(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(M.Events.BUFFER_EOS,this.onBufferEos,this),a.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(M.Events.FRAG_PARSED,this.onFragParsed,this),a.off(M.Events.FRAG_CHANGED,this.onFragChanged,this)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new c.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(a,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(a,s){var u=this.media=s.media;if(u&&p){var C=this.mediaSource=new p;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(C),this._objectUrl=u.src}},b.onMediaDetaching=function(){var a=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(P.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(C){P.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(u&&self.URL.revokeObjectURL(u),a.src===u?(a.removeAttribute("src"),a.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(M.Events.MEDIA_DETACHED,void 0)},b.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(s){var u=a.sourceBuffer[s];try{u&&(a.removeBufferListeners(s),a.mediaSource&&a.mediaSource.removeSourceBuffer(u),a.sourceBuffer[s]=void 0)}catch(C){P.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",C)}}),this._initSourceBuffer()},b.onBufferCodecs=function(a,s){var u=this,C=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(g){if(C){var m=u.tracks[g];if(m&&typeof m.buffer.changeType=="function"){var L=s[g],x=L.codec,f=L.levelCodec,h=L.container,d=(m.levelCodec||m.codec).replace(D,"$1"),o=(f||x).replace(D,"$1");if(d!==o){var T=h+";codecs="+(f||x);u.appendChangeType(g,T)}}}else u.pendingTracks[g]=s[g]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(a,s){var u=this,C=this.operationQueue,g={execute:function(){var L=u.sourceBuffer[a];L&&(P.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+s),L.changeType(s)),C.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(L){P.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",L)}};C.append(g,a)},b.onBufferAppending=function(a,s){var u=this,C=this.hls,g=this.operationQueue,m=this.tracks,L=s.data,x=s.type,f=s.frag,h=s.part,d=s.chunkMeta,o=d.buffering[x],T=self.performance.now();o.start=T;var E=f.stats.buffering,v=h?h.stats.buffering:null;E.start===0&&(E.start=T),v&&v.start===0&&(v.start=T);var R=m.audio,N=x==="audio"&&d.id===1&&(R==null?void 0:R.container)==="audio/mpeg",B={execute:function(){if(o.executeStart=self.performance.now(),N){var j=u.sourceBuffer[x];if(j){var F=f.start-j.timestampOffset;Math.abs(F)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+F+") sn: "+f.sn+")"),j.timestampOffset=f.start)}}u.appendExecutor(L,x)},onStart:function(){},onComplete:function(){var j=self.performance.now();o.executeEnd=o.end=j,E.first===0&&(E.first=j),v&&v.first===0&&(v.first=j);var F=u.sourceBuffer,X={};for(var q in F)X[q]=k.BufferHelper.getBuffered(F[q]);u.appendError=0,u.hls.trigger(M.Events.BUFFER_APPENDED,{type:x,frag:f,part:h,chunkMeta:d,parent:f.type,timeRanges:X})},onError:function(j){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",j);var F={type:I.ErrorTypes.MEDIA_ERROR,parent:f.type,details:I.ErrorDetails.BUFFER_APPEND_ERROR,err:j,fatal:!1};j.code===DOMException.QUOTA_EXCEEDED_ERR?F.details=I.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,F.details=I.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>C.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),F.fatal=!0)),C.trigger(M.Events.ERROR,F)}};g.append(B,x)},b.onBufferFlushing=function(a,s){var u=this,C=this.operationQueue,g=function(L){return{execute:u.removeExecutor.bind(u,L,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(M.Events.BUFFER_FLUSHED,{type:L})},onError:function(f){P.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",f)}}};s.type?C.append(g(s.type),s.type):this.getSourceBufferTypes().forEach(function(m){C.append(g(m),m)})},b.onFragParsed=function(a,s){var u=this,C=s.frag,g=s.part,m=[],L=g?g.elementaryStreams:C.elementaryStreams;L[_.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(L[_.ElementaryStreamTypes.AUDIO]&&m.push("audio"),L[_.ElementaryStreamTypes.VIDEO]&&m.push("video"));var x=function(){var h=self.performance.now();C.stats.buffering.end=h,g&&(g.stats.buffering.end=h);var d=g?g.stats:C.stats;u.hls.trigger(M.Events.FRAG_BUFFERED,{frag:C,part:g,stats:d,id:C.type})};m.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(x,m)},b.onFragChanged=function(a,s){this.flushBackBuffer()},b.onBufferEos=function(a,s){var u=this,C=this.getSourceBufferTypes().reduce(function(g,m){var L=u.sourceBuffer[m];return(!s.type||s.type===m)&&(L&&!L.ended&&(L.ended=!0,P.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),g&&!!(!L||L.ended)},!0);C&&this.blockBuffers(function(){var g=u.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},b.onLevelUpdated=function(a,s){var u=s.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var a=this.hls,s=this.details,u=this.media,C=this.sourceBuffer;if(!u||s===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var m=s.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(W.isFiniteNumber)(m)||m<0)return;var L=u.currentTime,x=s.levelTargetDuration,f=Math.max(m,x),h=Math.floor(L/x)*x-f;g.forEach(function(d){var o=C[d];if(o){var T=k.BufferHelper.getBuffered(o);T.length>0&&h>T.start(0)&&(a.trigger(M.Events.BACK_BUFFER_REACHED,{bufferEnd:h}),s.live&&a.trigger(M.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:h}),a.trigger(M.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:h,type:d}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,s=this.hls,u=this.media,C=this.mediaSource,g=a.fragments[0].start+a.totalduration,m=u.duration,L=Object(W.isFiniteNumber)(C.duration)?C.duration:0;a.live&&s.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(a)):(g>L&&g>m||!Object(W.isFiniteNumber)(m))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),C.duration=g)},b.updateSeekableRange=function(a){var s=this.mediaSource,u=a.fragments,C=u.length;if(C&&a.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var g=Math.max(0,u[0].start),m=Math.max(g,g+a.totalduration);s.setLiveSeekableRange(g,m)}},b.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,C=Object.keys(u).length;if(C&&!a||C===2){this.createSourceBuffers(u),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(M.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(m){s.executeNext(m)})}},b.createSourceBuffers=function(a){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var g in a)if(!s[g]){var m=a[g];if(!m)throw Error("source buffer exists for track "+g+", however track does not");var L=m.levelCodec||m.codec,x=m.container+";codecs="+L;P.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var f=s[g]=u.addSourceBuffer(x),h=g;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[g]={buffer:f,codec:L,container:m.container,levelCodec:m.levelCodec,id:m.id},C++}catch(d){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(M.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:x})}}C&&this.hls.trigger(M.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(a){var s=this.operationQueue,u=s.current(a);u.onStart()},b._onSBUpdateEnd=function(a){var s=this.operationQueue,u=s.current(a);u.onComplete(),s.shiftAndExecuteNext(a)},b._onSBUpdateError=function(a,s){P.logger.error("[buffer-controller]: "+a+" SourceBuffer error",s),this.hls.trigger(M.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(a);u&&u.onError(s)},b.removeExecutor=function(a,s,u){var C=this.media,g=this.mediaSource,m=this.operationQueue,L=this.sourceBuffer,x=L[a];if(!C||!g||!x){P.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(a);return}var f=Object(W.isFiniteNumber)(C.duration)?C.duration:Infinity,h=Object(W.isFiniteNumber)(g.duration)?g.duration:Infinity,d=Math.max(0,s),o=Math.min(u,f,h);o>d?(P.logger.log("[buffer-controller]: Removing ["+d+","+o+"] from the "+a+" SourceBuffer"),console.assert(!x.updating,a+" sourceBuffer must not be updating"),x.remove(d,o)):m.shiftAndExecuteNext(a)},b.appendExecutor=function(a,s){var u=this.operationQueue,C=this.sourceBuffer,g=C[s];if(!g){P.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}g.ended=!1,console.assert(!g.updating,s+" sourceBuffer must not be updating"),g.appendBuffer(a)},b.blockBuffers=function(a,s){var u=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var C=this.operationQueue,g=s.map(function(m){return C.appendBlocker(m)});Promise.all(g).then(function(){a(),s.forEach(function(m){var L=u.sourceBuffer[m];(!L||!L.updating)&&C.shiftAndExecuteNext(m)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(a,s,u){var C=this.sourceBuffer[a];if(!C)return;var g=u.bind(this,a);this.listeners[a].push({event:s,listener:g}),C.addEventListener(s,g)},b.removeBufferListeners=function(a){var s=this.sourceBuffer[a];if(!s)return;this.listeners[a].forEach(function(u){s.removeEventListener(u.event,u.listener)})},y}()},"./src/controller/buffer-operation-queue.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return M});var W=A("./src/utils/logger.ts"),M=function(){function P(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var I=P.prototype;return I.append=function(O,_){var c=this.queues[_];c.push(O),c.length===1&&this.buffers[_]&&this.executeNext(_)},I.insertAbort=function(O,_){var c=this.queues[_];c.unshift(O),this.executeNext(_)},I.appendBlocker=function(O){var _,c=new Promise(function(D){_=D}),p={execute:_,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,O),c},I.executeNext=function(O){var _=this.buffers,c=this.queues,p=_[O],D=c[O];if(D.length){var w=D[0];try{w.execute()}catch(y){W.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(y),(!p||!p.updating)&&(D.shift(),this.executeNext(O))}}},I.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},I.current=function(O){return this.queues[O][0]},P}()},"./src/controller/cap-level-controller.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/events.ts");function M(k,O){for(var _=0;_<O.length;_++){var c=O[_];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(k,c.key,c)}}function P(k,O,_){return O&&M(k.prototype,O),_&&M(k,_),k}var I=function(){function k(_){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=_,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var O=k.prototype;return O.setStreamController=function(c){this.streamController=c},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 c=this.hls;c.on(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),c.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),c.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.unregisterListener=function(){var c=this.hls;c.off(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),c.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),c.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.onFpsDropLevelCapping=function(c,p){k.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},O.onMediaAttaching=function(c,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},O.onManifestParsed=function(c,p){var D=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,D.config.capLevelToPlayerSize&&p.video&&this.startCapping()},O.onBufferCodecs=function(c,p){var D=this.hls;D.config.capLevelToPlayerSize&&p.video&&this.startCapping()},O.onMediaDetaching=function(){this.stopCapping()},O.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var c=this.hls.levels;if(c.length){var p=this.hls;p.autoLevelCapping=this.getMaxLevel(c.length-1),p.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=p.autoLevelCapping}}},O.getMaxLevel=function(c){var p=this,D=this.hls.levels;if(!D.length)return-1;var w=D.filter(function(y,b){return k.isLevelAllowed(b,p.restrictedLevels)&&b<=c});return this.clientRect=null,k.getMaxLevelByMediaSize(w,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 c=this.media,p={width:0,height:0};if(c){var D=c.getBoundingClientRect();p.width=D.width,p.height=D.height,!p.width&&!p.height&&(p.width=D.right-D.left||c.width||0,p.height=D.bottom-D.top||c.height||0)}return this.clientRect=p,p},k.isLevelAllowed=function(c,p){return p===void 0&&(p=[]),p.indexOf(c)===-1},k.getMaxLevelByMediaSize=function(c,p,D){if(!c||!c.length)return-1;for(var w=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},y=c.length-1,b=0;b<c.length;b+=1){var l=c[b];if((l.width>=p||l.height>=D)&&w(l,c[b+1])){y=b;break}}return y},P(k,[{key:"mediaWidth",get:function(){return this.getDimensions().width*k.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*k.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var c=1;try{c=self.devicePixelRatio}catch(p){}return c}}]),k}();K.default=I},"./src/controller/cmcd-controller.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return w});var W=A("./src/events.ts"),M=A("./src/types/cmcd.ts"),P=A("./src/utils/buffer-helper.ts"),I=A("./src/utils/logger.ts");function k(y,b){for(var l=0;l<b.length;l++){var a=b[l];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(y,a.key,a)}}function O(y,b,l){return b&&k(y.prototype,b),l&&k(y,l),y}function _(y,b){var l=typeof Symbol!="undefined"&&y[Symbol.iterator]||y["@@iterator"];if(l)return(l=l.call(y)).next.bind(l);if(Array.isArray(y)||(l=c(y))||b&&y&&typeof y.length=="number"){l&&(y=l);var a=0;return function(){return a>=y.length?{done:!0}:{done:!1,value:y[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c(y,b){if(!y)return;if(typeof y=="string")return p(y,b);var l=Object.prototype.toString.call(y).slice(8,-1);if(l==="Object"&&y.constructor&&(l=y.constructor.name),l==="Map"||l==="Set")return Array.from(y);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return p(y,b)}function p(y,b){(b==null||b>y.length)&&(b=y.length);for(var l=0,a=new Array(b);l<b;l++)a[l]=y[l];return a}function D(){return D=Object.assign||function(y){for(var b=1;b<arguments.length;b++){var l=arguments[b];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(y[a]=l[a])}return y},D.apply(this,arguments)}var w=function(){function y(l){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(C){try{a.apply(C,{ot:M.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(g){I.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(C){try{var g=C.frag,m=a.hls.levels[g.level],L=a.getObjectType(g),x={d:g.duration*1e3,ot:L};(L===M.CMCDObjectType.VIDEO||L===M.CMCDObjectType.AUDIO||L==M.CMCDObjectType.MUXED)&&(x.br=m.bitrate/1e3,x.tb=a.getTopBandwidth(L),x.bl=a.getBufferLength(L)),a.apply(C,x)}catch(f){I.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=l;var s=this.config=l.config,u=s.cmcd;u!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||y.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var b=y.prototype;return b.registerListeners=function(){var a=this.hls;a.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var a=this.hls;a.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(a,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(a,s){var u,C;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(C=s.tracks.video)===null||C===void 0?void 0:C.buffer},b.createData=function(){var a;return{v:M.CMCDVersion,sf:M.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(a,s){s===void 0&&(s={}),D(s,this.createData());var u=s.ot===M.CMCDObjectType.INIT||s.ot===M.CMCDObjectType.VIDEO||s.ot===M.CMCDObjectType.MUXED;if(this.starved&&u&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var C=y.toHeaders(s);if(!Object.keys(C).length)return;a.headers||(a.headers={}),D(a.headers,C)}else{var g=y.toQuery(s);if(!g)return;a.url=y.appendQueryToUri(a.url,g)}},b.getObjectType=function(a){var s=a.type;return s==="subtitle"?M.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?M.CMCDObjectType.INIT:s==="audio"?M.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?M.CMCDObjectType.VIDEO:M.CMCDObjectType.MUXED:void 0},b.getTopBandwidth=function(a){for(var s=0,u=a===M.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=_(u),g;!(g=C()).done;){var m=g.value;m.bitrate>s&&(s=m.bitrate)}return s>0?s:NaN},b.getBufferLength=function(a){var s=this.hls.media,u=a===M.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var C=P.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return C.len*1e3},b.createPlaylistLoader=function(){var a=this.config.pLoader,s=this.applyPlaylistData,u=a||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new u(m)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(L,x,f){s(L),this.loader.load(L,x,f)},O(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},b.createFragmentLoader=function(){var a=this.config.fLoader,s=this.applyFragmentData,u=a||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new u(m)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(L,x,f){s(L),this.loader.load(L,x,f)},O(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},y.uuid=function(){var a=URL.createObjectURL(new Blob),s=a.toString();return URL.revokeObjectURL(a),s.substr(s.lastIndexOf("/")+1)},y.serialize=function(a){for(var s=[],u=function(N){return!Number.isNaN(N)&&N!=null&&N!==""&&N!==!1},C=function(N){return Math.round(N)},g=function(N){return C(N/100)*100},m=function(N){return encodeURIComponent(N)},L={br:C,d:C,bl:g,dl:g,mtp:g,nor:m,rtp:g,tb:C},x=Object.keys(a||{}).sort(),f=_(x),h;!(h=f()).done;){var d=h.value,o=a[d];if(!u(o))continue;if(d==="v"&&o===1)continue;if(d=="pr"&&o===1)continue;var T=L[d];T&&(o=T(o));var E=typeof o,v=void 0;d==="ot"||d==="sf"||d==="st"?v=d+"="+o:E==="boolean"?v=d:E==="number"?v=d+"="+o:v=d+"="+JSON.stringify(o),s.push(v)}return s.join(",")},y.toHeaders=function(a){for(var s=Object.keys(a),u={},C=["Object","Request","Session","Status"],g=[{},{},{},{}],m={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},L=0,x=s;L<x.length;L++){var f=x[L],h=m[f]!=null?m[f]:1;g[h][f]=a[f]}for(var d=0;d<g.length;d++){var o=y.serialize(g[d]);o&&(u["CMCD-"+C[d]]=o)}return u},y.toQuery=function(a){return"CMCD="+encodeURIComponent(y.serialize(a))},y.appendQueryToUri=function(a,s){if(!s)return a;var u=a.includes("?")?"&":"?";return""+a+u+s},y}()},"./src/controller/eme-controller.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/utils/logger.ts"),I=A("./src/utils/mediakeys-helper.ts");function k(w,y){for(var b=0;b<y.length;b++){var l=y[b];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(w,l.key,l)}}function O(w,y,b){return y&&k(w.prototype,y),b&&k(w,b),w}var _=3,c=function(y,b,l){var a={audioCapabilities:[],videoCapabilities:[]};return y.forEach(function(s){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:l.audioRobustness||""})}),b.forEach(function(s){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:l.videoRobustness||""})}),[a]},p=function(y,b,l,a){switch(y){case I.KeySystems.WIDEVINE:return c(b,l,a);default:throw new Error("Unknown key-system: "+y)}},D=function(){function w(b){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=b,this._config=b.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var y=w.prototype;return y.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},y._registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this)},y._unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this)},y.getLicenseServerUrl=function(l){switch(l){case I.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},y._attemptKeySystemAccess=function(l,a,s){var u=this,C=p(l,a,s,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(l,C);this.mediaKeysPromise=g.then(function(m){return u._onMediaKeySystemAccessObtained(l,m)}),g.catch(function(m){P.logger.error('Failed to obtain key-system "'+l+'" access:',m)})},y._onMediaKeySystemAccessObtained=function(l,a){var s=this;P.logger.log('Access for key-system "'+l+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:l};this._mediaKeysList.push(u);var C=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(g){return u.mediaKeys=g,P.logger.log('Media-keys created for key-system "'+l+'"'),s._onMediaKeysCreated(),g});return C.catch(function(g){P.logger.error("Failed to create media-keys:",g)}),C},y._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),l._onNewMediaKeySession(a.mediaKeysSession))})},y._onNewMediaKeySession=function(l){var a=this;P.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(s){a._onKeySessionMessage(l,s.message)},!1)},y._onKeySessionMessage=function(l,a){P.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(s){P.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),l.update(s)})},y.onMediaEncrypted=function(l){var a=this;if(P.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(C){if(!a._media)return;a._attemptSetMediaKeys(C),a._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(s).catch(s)},y._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},y._generateRequestWithPreferredKeySession=function(l,a){var s=this,u=this._mediaKeysList[0];if(!u){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var C=u.mediaKeysSession;if(!C){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+l+'" init data type'),u.mediaKeysSessionInitialized=!0,C.generateRequest(l,a).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(g){P.logger.error("Error generating key-session request:",g),s.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},y._createLicenseXhr=function(l,a,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,l,a,s);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,u,l),C=void 0}catch(g){P.logger.error(g)}try{u.readyState||u.open("POST",l,!0),C&&C.call(this.hls,u,l)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return u},y._onLicenseRequestReadyStageChange=function(l,a,s,u){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var C=l.response,g=this._licenseResponseCallback;if(g)try{C=g.call(this.hls,l,a)}catch(L){P.logger.error(L)}u(C)}else{if(P.logger.error("License Request XHR failed ("+a+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>_){this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=_-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(s,u)}break}},y._generateLicenseRequestChallenge=function(l,a){switch(l.mediaKeySystemDomain){case I.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},y._requestLicense=function(l,a){P.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(s.mediaKeySystemDomain),C=this._createLicenseXhr(u,l,a);P.logger.log("Sending license request to URL: "+u);var g=this._generateLicenseRequestChallenge(s,l);C.send(g)}catch(m){P.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},y.onMediaAttached=function(l,a){if(!this._emeEnabled)return;var s=a.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},y.onMediaDetached=function(){var l=this._media,a=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},y.onManifestParsed=function(l,a){if(!this._emeEnabled)return;var s=a.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),u=a.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(I.KeySystems.WIDEVINE,s,u)},O(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();K.default=D},"./src/controller/fps-controller.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/utils/logger.ts"),P=function(){function I(O){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=O,this.registerListeners()}var k=I.prototype;return k.setStreamController=function(_){this.streamController=_},k.registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},k.unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching)},k.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},k.onMediaAttaching=function(_,c){var p=this.hls.config;if(p.capLevelOnFPSDrop){var D=c.media instanceof self.HTMLVideoElement?c.media:null;this.media=D,D&&typeof D.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),p.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(_,c,p){var D=performance.now();if(c){if(this.lastTime){var w=D-this.lastTime,y=p-this.lastDroppedFrames,b=c-this.lastDecodedFrames,l=1e3*y/w,a=this.hls;if(a.trigger(W.Events.FPS_DROP,{currentDropped:y,currentDecoded:b,totalDroppedFrames:p}),l>0&&y>a.config.fpsDroppedMonitoringThreshold*b){var s=a.currentLevel;M.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=s)&&(s=s-1,a.trigger(W.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:a.currentLevel}),a.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=D,this.lastDroppedFrames=p,this.lastDecodedFrames=c}},k.checkFPSInterval=function(){var _=this.media;if(_)if(this.isVideoPlaybackQualityAvailable){var c=_.getVideoPlaybackQuality();this.checkFPS(_,c.totalVideoFrames,c.droppedVideoFrames)}else this.checkFPS(_,_.webkitDecodedFrameCount,_.webkitDroppedFrameCount)},I}();K.default=P},"./src/controller/fragment-finders.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"findFragmentByPDT",function(){return P}),A.d(K,"findFragmentByPTS",function(){return I}),A.d(K,"fragmentWithinToleranceTest",function(){return k}),A.d(K,"pdtWithinToleranceTest",function(){return O}),A.d(K,"findFragWithCC",function(){return _});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/binary-search.ts");function P(c,p,D){if(p===null||!Array.isArray(c)||!c.length||!Object(W.isFiniteNumber)(p))return null;var w=c[0].programDateTime;if(p<(w||0))return null;var y=c[c.length-1].endProgramDateTime;if(p>=(y||0))return null;D=D||0;for(var b=0;b<c.length;++b){var l=c[b];if(O(p,D,l))return l}return null}function I(c,p,D,w){D===void 0&&(D=0),w===void 0&&(w=0);var y=null;if(c?y=p[c.sn-p[0].sn+1]||null:D===0&&p[0].start===0&&(y=p[0]),y&&k(D,w,y)===0)return y;var b=M.default.search(p,k.bind(null,D,w));return b||y}function k(c,p,D){c===void 0&&(c=0),p===void 0&&(p=0);var w=Math.min(p,D.duration+(D.deltaPTS?D.deltaPTS:0));return D.start+D.duration-w<=c?1:D.start-w>c&&D.start?-1:0}function O(c,p,D){var w=Math.min(p,D.duration+(D.deltaPTS?D.deltaPTS:0))*1e3,y=D.endProgramDateTime||0;return y-w>c}function _(c,p){return M.default.search(c,function(D){return D.cc<p?1:D.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"FragmentState",function(){return P}),A.d(K,"FragmentTracker",function(){return I});var W=A("./src/events.ts"),M=A("./src/types/loader.ts"),P;(function(_){_.NOT_LOADED="NOT_LOADED",_.BACKTRACKED="BACKTRACKED",_.APPENDING="APPENDING",_.PARTIAL="PARTIAL",_.OK="OK"})(P||(P={}));var I=function(){function _(p){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=p,this._registerListeners()}var c=_.prototype;return c._registerListeners=function(){var D=this.hls;D.on(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),D.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),D.on(W.Events.FRAG_LOADED,this.onFragLoaded,this)},c._unregisterListeners=function(){var D=this.hls;D.off(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),D.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),D.off(W.Events.FRAG_LOADED,this.onFragLoaded,this)},c.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},c.getAppendedFrag=function(D,w){if(w===M.PlaylistLevelType.MAIN){var y=this.activeFragment,b=this.activeParts;if(!y)return null;if(b)for(var l=b.length;l--;){var a=b[l],s=a?a.end:y.appendedPTS;if(a.start<=D&&s!==void 0&&D<=s)return l>9&&(this.activeParts=b.slice(l-9)),a}else if(y.start<=D&&y.appendedPTS!==void 0&&D<=y.appendedPTS)return y}return this.getBufferedFrag(D,w)},c.getBufferedFrag=function(D,w){for(var y=this.fragments,b=Object.keys(y),l=b.length;l--;){var a=y[b[l]];if((a==null?void 0:a.body.type)===w&&a.buffered){var s=a.body;if(s.start<=D&&D<=s.end)return s}}return null},c.detectEvictedFragments=function(D,w,y){var b=this;Object.keys(this.fragments).forEach(function(l){var a=b.fragments[l];if(!a)return;if(!a.buffered){a.body.type===y&&b.removeFragment(a.body);return}var s=a.range[D];if(!s)return;s.time.some(function(u){var C=!b.isTimeBuffered(u.startPTS,u.endPTS,w);return C&&b.removeFragment(a.body),C})})},c.detectPartialFragments=function(D){var w=this,y=this.timeRanges,b=D.frag,l=D.part;if(!y||b.sn==="initSegment")return;var a=O(b),s=this.fragments[a];if(!s)return;Object.keys(y).forEach(function(u){var C=b.elementaryStreams[u];if(!C)return;var g=y[u],m=l!==null||C.partial===!0;s.range[u]=w.getBufferedTimes(b,l,m,g)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},c.fragBuffered=function(D){var w=O(D),y=this.fragments[w];y&&(y.backtrack=y.loaded=null,y.buffered=!0)},c.getBufferedTimes=function(D,w,y,b){for(var l={time:[],partial:y},a=w?w.start:D.start,s=w?w.end:D.end,u=D.minEndPTS||s,C=D.maxStartPTS||a,g=0;g<b.length;g++){var m=b.start(g)-this.bufferPadding,L=b.end(g)+this.bufferPadding;if(C>=m&&u<=L){l.time.push({startPTS:Math.max(a,b.start(g)),endPTS:Math.min(s,b.end(g))});break}else if(a<L&&s>m)l.partial=!0,l.time.push({startPTS:Math.max(a,b.start(g)),endPTS:Math.min(s,b.end(g))});else if(s<=m)break}return l},c.getPartialFragment=function(D){var w=null,y,b,l,a=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(C){var g=u[C];if(!g)return;k(g)&&(b=g.body.start-s,l=g.body.end+s,D>=b&&D<=l&&(y=Math.min(D-b,l-D),a<=y&&(w=g.body,a=y)))}),w},c.getState=function(D){var w=O(D),y=this.fragments[w];return y?y.buffered?k(y)?P.PARTIAL:P.OK:y.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},c.backtrack=function(D,w){var y=O(D),b=this.fragments[y];if(!b||b.backtrack)return null;var l=b.backtrack=w||b.loaded;return b.loaded=null,l},c.getBacktrackData=function(D){var w=O(D),y=this.fragments[w];if(y){var b,l=y.backtrack;if(l!=null&&(b=l.payload)!==null&&b!==void 0&&b.byteLength)return l;this.removeFragment(D)}return null},c.isTimeBuffered=function(D,w,y){for(var b,l,a=0;a<y.length;a++){if(b=y.start(a)-this.bufferPadding,l=y.end(a)+this.bufferPadding,D>=b&&w<=l)return!0;if(w<=b)return!1}return!1},c.onFragLoaded=function(D,w){var y=w.frag,b=w.part;if(y.sn==="initSegment"||y.bitrateTest||b)return;var l=O(y);this.fragments[l]={body:y,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},c.onBufferAppended=function(D,w){var y=this,b=w.frag,l=w.part,a=w.timeRanges;if(b.type===M.PlaylistLevelType.MAIN)if(this.activeFragment=b,l){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(l)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(u){var C=a[u];if(y.detectEvictedFragments(u,C),!l)for(var g=0;g<C.length;g++)b.appendedPTS=Math.max(C.end(g),b.appendedPTS||0)})},c.onFragBuffered=function(D,w){this.detectPartialFragments(w)},c.hasFragment=function(D){var w=O(D);return!!this.fragments[w]},c.removeFragmentsInRange=function(D,w,y){var b=this;Object.keys(this.fragments).forEach(function(l){var a=b.fragments[l];if(!a)return;if(a.buffered){var s=a.body;s.type===y&&s.start<w&&s.end>D&&b.removeFragment(s)}})},c.removeFragment=function(D){var w=O(D);D.stats.loaded=0,D.clearElementaryStreamInfo(),delete this.fragments[w]},c.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},_}();function k(_){var c,p;return _.buffered&&(((c=_.range.video)===null||c===void 0?void 0:c.partial)||((p=_.range.audio)===null||p===void 0?void 0:p.partial))}function O(_){return _.type+"_"+_.level+"_"+_.urlId+"_"+_.sn}},"./src/controller/gap-controller.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"STALL_MINIMUM_DURATION_MS",function(){return k}),A.d(K,"MAX_START_GAP_JUMP",function(){return O}),A.d(K,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return _}),A.d(K,"SKIP_BUFFER_RANGE_START",function(){return c}),A.d(K,"default",function(){return p});var W=A("./src/utils/buffer-helper.ts"),M=A("./src/errors.ts"),P=A("./src/events.ts"),I=A("./src/utils/logger.ts"),k=250,O=2,_=.1,c=.05,p=function(){function D(y,b,l,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=y,this.media=b,this.fragmentTracker=l,this.hls=a}var w=D.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(b){var l=this.config,a=this.media,s=this.stalled,u=a.currentTime,C=a.seeking,g=this.seeking&&!C,m=!this.seeking&&C;if(this.seeking=C,u!==b){if(this.moved=!0,s!==null){if(this.stallReported){var L=self.performance.now()-s;I.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||g)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!W.BufferHelper.getBuffered(a).length)return;var x=W.BufferHelper.bufferInfo(a,u,0),f=x.len>0,h=x.nextStart||0;if(!f&&!h)return;if(C){var d=x.len>O,o=!h||h-u>O&&!this.fragmentTracker.getPartialFragment(u);if(d||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var T,E=Math.max(h,x.start||0)-u,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,R=v==null||((T=v.details)===null||T===void 0)?void 0:T.live,N=R?v.details.targetduration*2:O;if(E>0&&E<=N){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(s===null){this.stalled=B;return}var z=B-s;!C&&z>=k&&this._reportStall(x.len);var j=W.BufferHelper.bufferInfo(a,u,l.maxBufferHole);this._tryFixBufferStall(j,z)},w._tryFixBufferStall=function(b,l){var a=this.config,s=this.fragmentTracker,u=this.media,C=u.currentTime,g=s.getPartialFragment(C);if(g){var m=this._trySkipBufferHole(g);if(m)return}b.len>a.maxBufferHole&&l>a.highBufferWatchdogPeriod*1e3&&(I.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(b){var l=this.hls,a=this.media,s=this.stallReported;s||(this.stallReported=!0,I.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+b+")"),l.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},w._trySkipBufferHole=function(b){for(var l=this.config,a=this.hls,s=this.media,u=s.currentTime,C=0,g=W.BufferHelper.getBuffered(s),m=0;m<g.length;m++){var L=g.start(m);if(u+l.maxBufferHole>=C&&u<L){var x=Math.max(L+c,s.currentTime+_);return I.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+x),this.moved=!0,this.stalled=null,s.currentTime=x,b&&a.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+x,frag:b}),x}C=g.end(m)}return 0},w._tryNudgeBuffer=function(){var b=this.config,l=this.hls,a=this.media,s=a.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<b.nudgeMaxRetry){var C=s+u*b.nudgeOffset;I.logger.warn("Nudging 'currentTime' from "+s+" to "+C),a.currentTime=C,l.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else I.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+b.nudgeMaxRetry+" nudges"),l.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},D}()},"./src/controller/id3-track-controller.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/utils/texttrack-utils.ts"),P=A("./src/demux/id3.ts"),I=.25,k=function(){function O(c){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=c,this._registerListeners()}var _=O.prototype;return _.destroy=function(){this._unregisterListeners()},_._registerListeners=function(){var p=this.hls;p.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_._unregisterListeners=function(){var p=this.hls;p.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_.onMediaAttached=function(p,D){this.media=D.media},_.onMediaDetaching=function(){if(!this.id3Track)return;Object(M.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},_.getID3Track=function(p){if(!this.media)return;for(var D=0;D<p.length;D++){var w=p[D];if(w.kind==="metadata"&&w.label==="id3")return Object(M.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},_.onFragParsingMetadata=function(p,D){if(!this.media)return;var w=D.frag,y=D.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<y.length;l++){var a=P.getID3Frames(y[l].data);if(a){var s=y[l].pts,u=l<y.length-1?y[l+1].pts:w.end,C=u-s;C<=0&&(u=s+I);for(var g=0;g<a.length;g++){var m=a[g];if(!P.isTimeStampFrame(m)){var L=new b(s,u,"");L.value=m,this.id3Track.addCue(L)}}}}},_.onBufferFlushing=function(p,D){var w=D.startOffset,y=D.endOffset,b=D.type;if(!b||b==="audio"){var l=this.id3Track;l&&Object(M.removeCuesInRange)(l,w,y)}},O}();K.default=k},"./src/controller/latency-controller.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return O});var W=A("./src/errors.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts");function I(_,c){for(var p=0;p<c.length;p++){var D=c[p];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(_,D.key,D)}}function k(_,c,p){return c&&I(_.prototype,c),p&&I(_,p),_}var O=function(){function _(p){var D=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 D.timeupdate()},this.hls=p,this.config=p.config,this.registerListeners()}var c=_.prototype;return c.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},c.registerListeners=function(){this.hls.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(M.Events.ERROR,this.onError,this)},c.unregisterListeners=function(){this.hls.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(M.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(M.Events.ERROR,this.onError)},c.onMediaAttached=function(D,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},c.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},c.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},c.onLevelUpdated=function(D,w){var y=w.details;this.levelDetails=y,y.advanced&&this.timeupdate(),!y.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},c.onError=function(D,w){if(w.details!==W.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},c.timeupdate=function(){var D=this.media,w=this.levelDetails;if(!D||!w)return;this.currentTime=D.currentTime;var y=this.computeLatency();if(y===null)return;this._latency=y;var b=this.config,l=b.lowLatencyMode,a=b.maxLiveSyncPlaybackRate;if(!l||a===1)return;var s=this.targetLatency;if(s===null)return;var u=y-s,C=Math.min(this.maxLatency,s+w.targetduration),g=u<C;if(w.live&&g&&u>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,a)),L=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;D.playbackRate=Math.min(m,Math.max(1,L))}else D.playbackRate!==1&&D.playbackRate!==0&&(D.playbackRate=1)},c.estimateLiveEdge=function(){var D=this.levelDetails;return D===null?null:D.edge+D.age},c.computeLatency=function(){var D=this.estimateLiveEdge();return D===null?null:D-this.currentTime},k(_,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var D=this.config,w=this.levelDetails;return D.liveMaxLatencyDuration!==void 0?D.liveMaxLatencyDuration:w?D.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var D=this.levelDetails;if(D===null)return null;var w=D.holdBack,y=D.partHoldBack,b=D.targetduration,l=this.config,a=l.liveSyncDuration,s=l.liveSyncDurationCount,u=l.lowLatencyMode,C=this.hls.userConfig,g=u&&y||w;(C.liveSyncDuration||C.liveSyncDurationCount||g===0)&&(g=a!==void 0?a:s*b);var m=b,L=1;return g+Math.min(this.stallCount*L,m)}},{key:"liveSyncPosition",get:function(){var D=this.estimateLiveEdge(),w=this.targetLatency,y=this.levelDetails;if(D===null||w===null||y===null)return null;var b=y.edge,l=D-w-this.edgeStalled,a=b-y.totalduration,s=b-(this.config.lowLatencyMode&&y.partTarget||y.targetduration);return Math.min(Math.max(a,l),s)}},{key:"drift",get:function(){var D=this.levelDetails;return D===null?1:D.drift}},{key:"edgeStalled",get:function(){var D=this.levelDetails;if(D===null)return 0;var w=(this.config.lowLatencyMode&&D.partTarget||D.targetduration)*3;return Math.max(D.age-w,0)}},{key:"forwardBufferLength",get:function(){var D=this.media,w=this.levelDetails;if(!D||!w)return 0;var y=D.buffered.length;return y?D.buffered.end(y-1):w.edge-this.currentTime}}]),_}()},"./src/controller/level-controller.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return l});var W=A("./src/types/level.ts"),M=A("./src/events.ts"),P=A("./src/errors.ts"),I=A("./src/utils/codecs.ts"),k=A("./src/controller/level-helper.ts"),O=A("./src/controller/base-playlist-controller.ts"),_=A("./src/types/loader.ts");function c(){return c=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var C in u)Object.prototype.hasOwnProperty.call(u,C)&&(a[C]=u[C])}return a},c.apply(this,arguments)}function p(a,s){for(var u=0;u<s.length;u++){var C=s[u];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(a,C.key,C)}}function D(a,s,u){return s&&p(a.prototype,s),u&&p(a,u),a}function w(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,y(a,s)}function y(a,s){return y=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},y(a,s)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(a){w(s,a);function s(C){var g;return g=a.call(this,C,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var u=s.prototype;return u._registerListeners=function(){var g=this.hls;g.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(M.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var g=this.hls;g.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(M.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},u.startLoad=function(){var g=this._levels;g.forEach(function(m){m.loadError=0}),a.prototype.startLoad.call(this)},u.onManifestLoaded=function(g,m){var L=[],x=[],f=[],h,d={},o,T=!1,E=!1,v=!1;if(m.levels.forEach(function(z){var j=z.attrs;T=T||!!(z.width&&z.height),E=E||!!z.videoCodec,v=v||!!z.audioCodec,b&&z.audioCodec&&z.audioCodec.indexOf("mp4a.40.34")!==-1&&(z.audioCodec=void 0);var F=z.bitrate+"-"+z.attrs.RESOLUTION+"-"+z.attrs.CODECS;o=d[F],o?o.url.push(z.url):(o=new W.Level(z),d[F]=o,L.push(o)),j&&(j.AUDIO&&Object(k.addGroupId)(o,"audio",j.AUDIO),j.SUBTITLES&&Object(k.addGroupId)(o,"text",j.SUBTITLES))}),(T||E)&&v&&(L=L.filter(function(z){var j=z.videoCodec,F=z.width,X=z.height;return!!j||!!(F&&X)})),L=L.filter(function(z){var j=z.audioCodec,F=z.videoCodec;return(!j||Object(I.isCodecSupportedInMp4)(j,"audio"))&&(!F||Object(I.isCodecSupportedInMp4)(F,"video"))}),m.audioTracks&&(x=m.audioTracks.filter(function(z){return!z.audioCodec||Object(I.isCodecSupportedInMp4)(z.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(x)),m.subtitles&&(f=m.subtitles,Object(k.assignTrackIdsByGroup)(f)),L.length>0){h=L[0].bitrate,L.sort(function(z,j){return z.bitrate-j.bitrate}),this._levels=L;for(var R=0;R<L.length;R++)if(L[R].bitrate===h){this._firstLevel=R,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+h);break}var N=v&&!E,B={levels:L,audioTracks:x,subtitleTracks:f,firstLevel:this._firstLevel,stats:m.stats,audio:v,video:E,altAudio:!N&&x.some(function(z){return!!z.url})};this.hls.trigger(M.Events.MANIFEST_PARSED,B),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(g,m){if(a.prototype.onError.call(this,g,m),m.fatal)return;var L=m.context,x=this._levels[this.currentLevelIndex];if(L&&(L.type===_.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&L.groupId===x.audioGroupIds[x.urlId]||L.type===_.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&L.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,h=!0,d;switch(m.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var o=this._levels[m.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=m.frag.level)):d=m.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(h=!1),d=L.level),f=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:d=m.level,f=!0;break}d!==void 0&&this.recoverLevel(m,d,f,h)},u.recoverLevel=function(g,m,L,x){var f=g.details,h=this._levels[m];if(h.loadError++,L){var d=this.retryLoadingOrFail(g);if(d)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var o=h.url.length;if(o>1&&h.loadError<o)g.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var T=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==T&&this._levels[T].loadError===0&&(this.warn(f+": switch to "+T),g.levelRetry=!0,this.hls.nextAutoLevel=T)}}},u.redundantFailover=function(g){var m=this._levels[g],L=m.url.length;if(L>1){var x=(m.urlId+1)%L;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(f){f.urlId=x}),this.level=g}},u.onFragLoaded=function(g,m){var L=m.frag;if(L!==void 0&&L.type===_.PlaylistLevelType.MAIN){var x=this._levels[L.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},u.onLevelLoaded=function(g,m){var L,x=m.level,f=m.details,h=this._levels[x];if(!h){var d;this.warn("Invalid level index "+x),(d=m.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(f.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(h.fragmentError===0&&(h.loadError=0,this.retryCount=0),this.playlistLoaded(x,m,h.details)):(L=m.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(f.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(g,m){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var x=-1,f=this.hls.audioTracks[m.id].groupId,h=0;h<L.audioGroupIds.length;h++)if(L.audioGroupIds[h]===f){x=h;break}x!==L.urlId&&(L.urlId=x,this.startLoad())}},u.loadPlaylist=function(g){var m=this.currentLevelIndex,L=this._levels[m];if(this.canLoad&&L&&L.url.length>0){var x=L.urlId,f=L.url[x];if(g)try{f=g.addDirectives(f)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Attempt loading level index "+m+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+x+" "+f),this.clearTimer(),this.hls.trigger(M.Events.LEVEL_LOADING,{url:f,level:m,id:x,deliveryDirectives:g||null})}},u.removeLevel=function(g,m){var L=function(h,d){return d!==m},x=this._levels.filter(function(f,h){return h!==g?!0:f.url.length>1&&m!==void 0?(f.url=f.url.filter(L),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(L)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(L)),f.urlId=0,!0):!1}).map(function(f,h){var d=f.details;return d!=null&&d.fragments&&d.fragments.forEach(function(o){o.level=h}),f});this._levels=x,this.hls.trigger(M.Events.LEVELS_UPDATED,{levels:x})},D(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var m,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===g&&(m=L[g])!==null&&m!==void 0&&m.details)return;if(g<0||g>=L.length){var x=g<0;if(this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:x,reason:"invalid level idx"}),x)return;g=Math.min(g,L.length-1)}this.clearTimer();var f=this.currentLevelIndex,h=L[f],d=L[g];this.log("switching to level "+g+" from "+f),this.currentLevelIndex=g;var o=c({},d,{level:g,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete o._urlId,this.hls.trigger(M.Events.LEVEL_SWITCHING,o);var T=d.details;if(!T||T.live){var E=this.switchParams(d.uri,h==null?void 0:h.details);this.loadPlaylist(E)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),s}(O.default)},"./src/controller/level-helper.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"addGroupId",function(){return P}),A.d(K,"assignTrackIdsByGroup",function(){return I}),A.d(K,"updatePTS",function(){return k}),A.d(K,"updateFragPTSDTS",function(){return _}),A.d(K,"mergeDetails",function(){return c}),A.d(K,"mapPartIntersection",function(){return p}),A.d(K,"mapFragmentIntersection",function(){return D}),A.d(K,"adjustSliding",function(){return w}),A.d(K,"addSliding",function(){return y}),A.d(K,"computeReloadInterval",function(){return b}),A.d(K,"getFragmentWithSN",function(){return l}),A.d(K,"getPartWith",function(){return a});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/logger.ts");function P(s,u,C){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(C);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(C);break}}function I(s){var u={};s.forEach(function(C){var g=C.groupId||"";C.id=u[g]=u[g]||0,u[g]++})}function k(s,u,C){var g=s[u],m=s[C];O(g,m)}function O(s,u){var C=u.startPTS;if(Object(W.isFiniteNumber)(C)){var g=0,m;u.sn>s.sn?(g=C-s.start,m=s):(g=s.start-C,m=u),m.duration!==g&&(m.duration=g)}else if(u.sn>s.sn){var L=s.cc===u.cc;L&&s.minEndPTS?u.start=s.start+(s.minEndPTS-s.start):u.start=s.start+s.duration}else u.start=Math.max(s.start-u.duration,0)}function _(s,u,C,g,m,L){var x=g-C;x<=0&&(M.logger.warn("Fragment should have a positive duration",u),g=C+u.duration,L=m+u.duration);var f=C,h=g,d=u.startPTS,o=u.endPTS;if(Object(W.isFiniteNumber)(d)){var T=Math.abs(d-C);Object(W.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(T,u.deltaPTS):u.deltaPTS=T,f=Math.max(C,d),C=Math.min(C,d),m=Math.min(m,u.startDTS),h=Math.min(g,o),g=Math.max(g,o),L=Math.max(L,u.endDTS)}u.duration=g-C;var E=C-u.start;u.appendedPTS=g,u.start=u.startPTS=C,u.maxStartPTS=f,u.startDTS=m,u.endPTS=g,u.minEndPTS=h,u.endDTS=L;var v=u.sn;if(!s||v<s.startSN||v>s.endSN)return 0;var R,N=v-s.startSN,B=s.fragments;for(B[N]=u,R=N;R>0;R--)O(B[R],B[R-1]);for(R=N;R<B.length-1;R++)O(B[R],B[R+1]);return s.fragmentHint&&O(B[B.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,E}function c(s,u){for(var C=null,g=s.fragments,m=g.length-1;m>=0;m--){var L=g[m].initSegment;if(L){C=L;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var x=0,f;if(D(s,u,function(R,N){R.relurl&&(x=R.cc-N.cc),Object(W.isFiniteNumber)(R.startPTS)&&Object(W.isFiniteNumber)(R.endPTS)&&(N.start=N.startPTS=R.startPTS,N.startDTS=R.startDTS,N.appendedPTS=R.appendedPTS,N.maxStartPTS=R.maxStartPTS,N.endPTS=R.endPTS,N.endDTS=R.endDTS,N.minEndPTS=R.minEndPTS,N.duration=R.endPTS-R.startPTS,N.duration&&(f=N),u.PTSKnown=u.alignedSliding=!0),N.elementaryStreams=R.elementaryStreams,N.loader=R.loader,N.stats=R.stats,N.urlId=R.urlId,R.initSegment&&(N.initSegment=R.initSegment,C=R.initSegment)}),C){var h=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;h.forEach(function(R){var N;(!R.initSegment||R.initSegment.relurl===((N=C)===null||N===void 0?void 0:N.relurl))&&(R.initSegment=C)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(R){return!R}),u.deltaUpdateFailed)){M.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=u.skippedSegments;d--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var o=u.fragments;if(x){M.logger.warn("discontinuity sliding from playlist, take drift into account");for(var T=0;T<o.length;T++)o[T].cc+=x}u.skippedSegments&&(u.startCC=u.fragments[0].cc),p(s.partList,u.partList,function(R,N){N.elementaryStreams=R.elementaryStreams,N.stats=R.stats}),f?_(u,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):w(s,u),o.length&&(u.totalduration=u.edge-o[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var E=u.advancedDateTime;if(u.advanced&&E){var v=u.edge;u.driftStart||(u.driftStartTime=E,u.driftStart=v),u.driftEndTime=E,u.driftEnd=v}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function p(s,u,C){if(s&&u)for(var g=0,m=0,L=s.length;m<=L;m++){var x=s[m],f=u[m+g];x&&f&&x.index===f.index&&x.fragment.sn===f.fragment.sn?C(x,f):g--}}function D(s,u,C){for(var g=u.skippedSegments,m=Math.max(s.startSN,u.startSN)-u.startSN,L=(s.fragmentHint?1:0)+(g?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,x=u.startSN-s.startSN,f=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,h=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=m;d<=L;d++){var o=h[x+d],T=f[d];g&&!T&&d<g&&(T=u.fragments[d]=o),o&&T&&C(o,T)}}function w(s,u){var C=u.startSN+u.skippedSegments-s.startSN,g=s.fragments;if(C<0||C>=g.length)return;y(u,g[C].start)}function y(s,u){if(u){for(var C=s.fragments,g=s.skippedSegments;g<C.length;g++)C[g].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function b(s,u){var C=1e3*s.levelTargetDuration,g=C/2,m=s.age,L=m>0&&m<C*3,x=u.loading.end-u.loading.start,f,h=s.availabilityDelay;if(s.updated===!1)if(L){var d=333*s.misses;f=Math.max(Math.min(g,x*2),d),s.availabilityDelay=(s.availabilityDelay||0)+f}else f=g;else L?(h=Math.min(h||C/2,m),s.availabilityDelay=h,f=h+C-m):f=C-x;return Math.round(f)}function l(s,u,C){if(!s||!s.details)return null;var g=s.details,m=g.fragments[u-g.startSN];return m||(m=g.fragmentHint,m&&m.sn===u?m:u<g.startSN&&C&&C.sn===u?C:null)}function a(s,u,C){if(!s||!s.details)return null;var g=s.details.partList;if(g)for(var m=g.length;m--;){var L=g[m];if(L.index===C&&L.fragment.sn===u)return L}return null}},"./src/controller/stream-controller.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return g});var W=A("./src/polyfills/number.ts"),M=A("./src/controller/base-stream-controller.ts"),P=A("./src/is-supported.ts"),I=A("./src/events.ts"),k=A("./src/utils/buffer-helper.ts"),O=A("./src/controller/fragment-tracker.ts"),_=A("./src/types/loader.ts"),c=A("./src/loader/fragment.ts"),p=A("./src/demux/transmuxer-interface.ts"),D=A("./src/types/transmuxer.ts"),w=A("./src/controller/gap-controller.ts"),y=A("./src/errors.ts"),b=A("./src/utils/logger.ts");function l(m,L){for(var x=0;x<L.length;x++){var f=L[x];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function a(m,L,x){return L&&l(m.prototype,L),x&&l(m,x),m}function s(m,L){m.prototype=Object.create(L.prototype),m.prototype.constructor=m,u(m,L)}function u(m,L){return u=Object.setPrototypeOf||function(f,h){return f.__proto__=h,f},u(m,L)}var C=100,g=function(m){s(L,m);function L(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 x=L.prototype;return x._registerListeners=function(){var h=this.hls;h.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.on(I.Events.ERROR,this.onError,this),h.on(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(I.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var h=this.hls;h.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.off(I.Events.ERROR,this.onError,this),h.off(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(I.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(h){if(this.levels){var d=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var T=o.startLevel;T===-1&&(o.config.testBandwidth?(T=0,this.bitrateTest=!0):T=o.nextAutoLevel),this.level=o.nextLoadLevel=T,this.loadedmetadata=!1}d>0&&h===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),h=d),this.state=M.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()}else this._forceStartLoad=!0,this.state=M.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_LEVEL:{var h,d=this.levels,o=this.level,T=d==null||((h=d[o])===null||h===void 0)?void 0:h.details;if(T&&(!T.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(T))break;this.state=M.State.IDLE;break}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var E,v=self.performance.now(),R=this.retryDate;(!R||v>=R||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=M.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var h,d,o=this.hls,T=this.levelLastLoaded,E=this.levels,v=this.media,R=o.config,N=o.nextLoadLevel;if(T===null||!v&&(this.startFragRequested||!R.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!E||!E[N])return;var B=E[N];this.level=o.nextLoadLevel=N;var z=B.details;if(!z||this.state===M.State.WAITING_LEVEL||z.live&&this.levelLastLoaded!==N){this.state=M.State.WAITING_LEVEL;return}var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:v,_.PlaylistLevelType.MAIN);if(j===null)return;var F=j.len,X=this.getMaxBufferLength(B.maxBitrate);if(F>=X)return;if(this._streamEnded(j,z)){var q={};this.altAudio&&(q.type="video"),this.hls.trigger(I.Events.BUFFER_EOS,q),this.state=M.State.ENDED;return}var ne=j.end,ue=this.getNextFragment(ne,z);if(this.couldBacktrack&&!this.fragPrevious&&ue&&ue.sn!=="initSegment"){var Ee=ue.sn-z.startSN;Ee>1&&(ue=z.fragments[Ee-1],this.fragmentTracker.removeFragment(ue))}if(ue&&this.fragmentTracker.getState(ue)===O.FragmentState.OK&&this.nextLoadPosition>ne){var pe=this.audioOnly&&!this.altAudio?c.ElementaryStreamTypes.AUDIO:c.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(v,pe,_.PlaylistLevelType.MAIN),ue=this.getNextFragment(this.nextLoadPosition,z)}if(!ue)return;ue.initSegment&&!ue.initSegment.data&&!this.bitrateTest&&(ue=ue.initSegment),((h=ue.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((d=ue.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(ue,z):this.loadFragment(ue,z,ne)},x.loadFragment=function(h,d,o){var T,E=this.fragmentTracker.getState(h);if(this.fragCurrent=h,E===O.FragmentState.BACKTRACKED){var v=this.fragmentTracker.getBacktrackData(h);if(v){this._handleFragmentLoadProgress(v),this._handleFragmentLoadComplete(v);return}else E=O.FragmentState.NOT_LOADED}E===O.FragmentState.NOT_LOADED||E===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,o)):E===O.FragmentState.APPENDING?this.reduceMaxBufferLength(h.duration)&&this.fragmentTracker.removeFragment(h):((T=this.media)===null||T===void 0?void 0:T.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(h){var d=this.fragmentTracker.getAppendedFrag(h,_.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},x.getBufferedFrag=function(h){return this.fragmentTracker.getBufferedFrag(h,_.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(h){return h?this.getBufferedFrag(h.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var h=this.levels,d=this.media;if(d!=null&&d.readyState){var o,T=this.getAppendedFrag(d.currentTime);if(T&&T.start>1&&this.flushMainBuffer(0,T.start-1),!d.paused&&h){var E=this.hls.nextLoadLevel,v=h[E],R=this.fragLastKbps;R&&this.fragCurrent?o=this.fragCurrent.duration*v.maxBitrate/(1e3*R)+1:o=0}else o=0;var N=this.getBufferedFrag(d.currentTime+o);if(N){var B=this.followingBufferedFrag(N);if(B){this.abortCurrentFrag();var z=B.maxStartPTS?B.maxStartPTS:B.start,j=B.duration,F=Math.max(N.end,z+Math.min(Math.max(j-this.config.maxFragLookUpTolerance,j*.5),j*.75));this.flushMainBuffer(F,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var h=this.fragCurrent;this.fragCurrent=null,h!=null&&h.loader&&h.loader.abort(),this.state===M.State.KEY_LOADING&&(this.state=M.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(h,d){m.prototype.flushMainBuffer.call(this,h,d,this.altAudio?"video":null)},x.onMediaAttached=function(h,d){m.prototype.onMediaAttached.call(this,h,d);var o=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new w.default(this.config,o,this.fragmentTracker,this.hls)},x.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)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var h=this.media,d=h?h.currentTime:null;Object(W.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},x.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(I.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},x.onManifestParsed=function(h,d){var o=!1,T=!1,E;d.levels.forEach(function(v){E=v.audioCodec,E&&(E.indexOf("mp4a.40.2")!==-1&&(o=!0),E.indexOf("mp4a.40.5")!==-1&&(T=!0))}),this.audioCodecSwitch=o&&T&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},x.onLevelLoading=function(h,d){var o=this.levels;if(!o||this.state!==M.State.IDLE)return;var T=o[d.level];(!T.details||T.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(T.details))&&(this.state=M.State.WAITING_LEVEL)},x.onLevelLoaded=function(h,d){var o,T=this.levels,E=d.level,v=d.details,R=v.totalduration;if(!T){this.warn("Levels were reset while loading level "+E);return}this.log("Level "+E+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+R);var N=this.fragCurrent;N&&(this.state===M.State.FRAG_LOADING||this.state===M.State.FRAG_LOADING_WAITING_RETRY)&&(N.level!==d.level&&N.loader&&(this.state=M.State.IDLE,N.loader.abort()));var B=T[E],z=0;if(v.live||(o=B.details)!==null&&o!==void 0&&o.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;z=this.alignPlaylists(v,B.details)}if(B.details=v,this.levelLastLoaded=E,this.hls.trigger(I.Events.LEVEL_UPDATED,{details:v,level:E}),this.state===M.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(v))return;this.state=M.State.IDLE}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,z),this.tick()},x._handleFragmentLoadProgress=function(h){var d,o=h.frag,T=h.part,E=h.payload,v=this.levels;if(!v){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var R=v[o.level],N=R.details;if(!N){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var B=R.videoCodec,z=N.PTSKnown||!N.live,j=(d=o.initSegment)===null||d===void 0?void 0:d.data,F=this._getAudioCodec(R),X=this.transmuxer=this.transmuxer||new p.default(this.hls,_.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),q=T?T.index:-1,ne=q!==-1,ue=new D.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,E.byteLength,q,ne),Ee=this.initPTS[o.cc];X.push(E,j,F,B,o,T,N.totalduration,z,ue,Ee)},x.onAudioTrackSwitching=function(h,d){var o=this.altAudio,T=!!d.url,E=d.id;if(!T){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var v=this.fragCurrent;v!=null&&v.loader&&(this.log("Switching to main audio track, cancel main fragment load"),v.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var R=this.hls;o&&R.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),R.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:E})}},x.onAudioTrackSwitched=function(h,d){var o=d.id,T=!!this.hls.audioTracks[o].url;if(T){var E=this.videoBuffer;E&&this.mediaBuffer!==E&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=E)}this.altAudio=T,this.tick()},x.onBufferCreated=function(h,d){var o=d.tracks,T,E,v=!1;for(var R in o){var N=o[R];if(N.id==="main"){if(E=R,T=N,R==="video"){var B=o[R];B&&(this.videoBuffer=B.buffer)}}else v=!0}v&&T?(this.log("Alternate track found, use "+E+".buffered to schedule main fragment loading"),this.mediaBuffer=T.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(h,d){var o=d.frag,T=d.part;if(o&&o.type!==_.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(T?" p: "+T.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===M.State.PARSED&&(this.state=M.State.IDLE);return}var E=T?T.stats:o.stats;this.fragLastKbps=Math.round(8*E.total/(E.buffering.end-E.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,T)},x.onError=function(h,d){switch(d.details){case y.ErrorDetails.FRAG_LOAD_ERROR:case y.ErrorDetails.FRAG_LOAD_TIMEOUT:case y.ErrorDetails.KEY_LOAD_ERROR:case y.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.MAIN,d);break;case y.ErrorDetails.LEVEL_LOAD_ERROR:case y.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==M.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=M.State.ERROR):!d.levelRetry&&this.state===M.State.WAITING_LEVEL&&(this.state=M.State.IDLE));break;case y.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var o=!0,T=this.getFwdBufferInfo(this.media,_.PlaylistLevelType.MAIN);T&&T.len>.5&&(o=!this.reduceMaxBufferLength(T.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var h=this.media,d=this.gapController;if(!h||!d||!h.readyState)return;var o=k.BufferHelper.getBuffered(h);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=h.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=M.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(h,d){var o=d.type;if(o!==c.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var T=(o===c.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(T,o,_.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(h,d){this.levels=d.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var h=this.media,d=h.currentTime,o=this.startPosition;if(o>=0&&d<o){if(h.seeking){b.logger.log("could not seek to "+o+", already seeking at "+d);return}var T=k.BufferHelper.getBuffered(h),E=T.length?T.start(0):0,v=E-o;v>0&&(v<this.config.maxBufferHole||v<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+v+" to match buffer start"),o+=v,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+d),h.currentTime=o}},x._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},x._loadBitrateTestFrag=function(h){var d=this;this._doFragLoad(h).then(function(o){var T=d.hls;if(!o||T.nextLoadLevel||d.fragContextChanged(h))return;d.fragLoadError=0,d.state=M.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var E=h.stats;E.parsing.start=E.parsing.end=E.buffering.start=E.buffering.end=self.performance.now(),T.trigger(I.Events.FRAG_LOADED,o)})},x._handleTransmuxComplete=function(h){var d,o="main",T=this.hls,E=h.remuxResult,v=h.chunkMeta,R=this.getCurrentContext(v);if(!R){this.warn("The loading context changed while buffering fragment "+v.sn+" of level "+v.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(v.level);return}var N=R.frag,B=R.part,z=R.level,j=E.video,F=E.text,X=E.id3,q=E.initSegment,ne=this.altAudio?void 0:E.audio;if(this.fragContextChanged(N))return;if(this.state=M.State.PARSING,q){q.tracks&&(this._bufferInitSegment(z,q.tracks,N,v),T.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:o,tracks:q.tracks}));var ue=q.initPTS,Ee=q.timescale;Object(W.isFiniteNumber)(ue)&&(this.initPTS[N.cc]=ue,T.trigger(I.Events.INIT_PTS_FOUND,{frag:N,id:o,initPTS:ue,timescale:Ee}))}if(j&&E.independent!==!1){if(z.details){var pe=j.startPTS,fe=j.endPTS,de=j.startDTS,ce=j.endDTS;if(B)B.elementaryStreams[j.type]={startPTS:pe,endPTS:fe,startDTS:de,endDTS:ce};else if(j.firstKeyFrame&&j.independent&&(this.couldBacktrack=!0),j.dropped&&j.independent){var re=this.getLoadPosition()+this.config.maxBufferHole;if(re<pe){this.backtrack(N);return}N.setElementaryStreamInfo(j.type,N.start,fe,N.start,ce,!0)}N.setElementaryStreamInfo(j.type,pe,fe,de,ce),this.bufferFragmentData(j,N,B,v)}}else if(E.independent===!1){this.backtrack(N);return}if(ne){var se=ne.startPTS,be=ne.endPTS,Me=ne.startDTS,Ie=ne.endDTS;B&&(B.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:be,startDTS:Me,endDTS:Ie}),N.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,se,be,Me,Ie),this.bufferFragmentData(ne,N,B,v)}if(X!=null&&(d=X.samples)!==null&&d!==void 0&&d.length){var Ge={frag:N,id:o,samples:X.samples};T.trigger(I.Events.FRAG_PARSING_METADATA,Ge)}if(F){var He={frag:N,id:o,samples:F.samples};T.trigger(I.Events.FRAG_PARSING_USERDATA,He)}},x._bufferInitSegment=function(h,d,o,T){var E=this;if(this.state!==M.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var v=d.audio,R=d.video,N=d.audiovideo;if(v){var B=h.audioCodec,z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),v.metadata.channelCount!==1&&z.indexOf("firefox")===-1&&(B="mp4a.40.5")),z.indexOf("android")!==-1&&v.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),h.audioCodec&&h.audioCodec!==B&&this.log('Swapping manifest audio codec "'+h.audioCodec+'" for "'+B+'"'),v.levelCodec=B,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(h.audioCodec||"")+"/"+v.codec+"]")}R&&(R.levelCodec=h.videoCodec,R.id="main",this.log("Init video buffer, container:"+R.container+", codecs[level/parsed]=["+(h.videoCodec||"")+"/"+R.codec+"]")),N&&this.log("Init audiovideo buffer, container:"+N.container+", codecs[level/parsed]=["+(h.attrs.CODECS||"")+"/"+N.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(j){var F=d[j],X=F.initSegment;X!=null&&X.byteLength&&E.hls.trigger(I.Events.BUFFER_APPENDING,{type:j,data:X,frag:o,part:null,chunkMeta:T,parent:o.type})}),this.tick()},x.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=M.State.BACKTRACKING},x.checkFragmentChanged=function(){var h=this.media,d=null;if(h&&h.readyState>1&&h.seeking===!1){var o=h.currentTime;if(k.BufferHelper.isBuffered(h,o)?d=this.getAppendedFrag(o):k.BufferHelper.isBuffered(h,o+.1)&&(d=this.getAppendedFrag(o+.1)),d){var T=this.fragPlaying,E=d.level;(!T||d.sn!==T.sn||T.level!==E||d.urlId!==T.urlId)&&(this.hls.trigger(I.Events.FRAG_CHANGED,{frag:d}),(!T||T.level!==E)&&this.hls.trigger(I.Events.LEVEL_SWITCHED,{level:E}),this.fragPlaying=d)}}},a(L,[{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}}]),L}(M.default)},"./src/controller/subtitle-stream-controller.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"SubtitleStreamController",function(){return s});var W=A("./src/events.ts"),M=A("./src/utils/logger.ts"),P=A("./src/utils/buffer-helper.ts"),I=A("./src/controller/fragment-finders.ts"),k=A("./src/utils/discontinuities.ts"),O=A("./src/controller/level-helper.ts"),_=A("./src/controller/fragment-tracker.ts"),c=A("./src/controller/base-stream-controller.ts"),p=A("./src/types/loader.ts"),D=A("./src/types/level.ts");function w(u,C){for(var g=0;g<C.length;g++){var m=C[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}function y(u,C,g){return C&&w(u.prototype,C),g&&w(u,g),u}function b(u,C){u.prototype=Object.create(C.prototype),u.prototype.constructor=u,l(u,C)}function l(u,C){return l=Object.setPrototypeOf||function(m,L){return m.__proto__=L,m},l(u,C)}var a=500,s=function(u){b(C,u);function C(m,L){var x;return x=u.call(this,m,L,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var g=C.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var L=this.hls;L.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(W.Events.ERROR,this.onError,this),L.on(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var L=this.hls;L.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(W.Events.ERROR,this.onError,this),L.off(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=c.State.IDLE,this.setInterval(a),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(L,x){this.mainDetails=x.details},g.onSubtitleFragProcessed=function(L,x){var f=x.frag,h=x.success;if(this.fragPrevious=f,this.state=c.State.IDLE,!h)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var o,T=f.start,E=0;E<d.length;E++)if(T>=d[E].start&&T<=d[E].end){o=d[E];break}var v=f.start+f.duration;o?o.end=v:(o={start:T,end:v},d.push(o)),this.fragmentTracker.fragBuffered(f)},g.onBufferFlushing=function(L,x){var f=x.startOffset,h=x.endOffset;if(f===0&&h!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,o=this.levels;if(!o.length||!o[d]||!o[d].details)return;var T=o[d].details,E=T.targetduration,v=h-E;if(v<=0)return;x.endOffsetSubtitles=Math.max(0,v),this.tracksBuffered.forEach(function(R){for(var N=0;N<R.length;){if(R[N].end<=v){R.shift();continue}else if(R[N].start<v)R[N].start=v;else break;N++}}),this.fragmentTracker.removeFragmentsInRange(f,v,p.PlaylistLevelType.SUBTITLE)}},g.onError=function(L,x){var f,h=x.frag;if(!h||h.type!==p.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=c.State.IDLE},g.onSubtitleTracksUpdated=function(L,x){var f=this,h=x.subtitleTracks;this.tracksBuffered=[],this.levels=h.map(function(d){return new D.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){f.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(L,x){if(this.currentTrackId=x.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(a)},g.onSubtitleTrackLoaded=function(L,x){var f,h=x.details,d=x.id,o=this.currentTrackId,T=this.levels;if(!T.length)return;var E=T[o];if(d>=T.length||d!==o||!E)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,h.live||(f=E.details)!==null&&f!==void 0&&f.live){var v=this.mainDetails;if(h.deltaUpdateFailed||!v)return;var R=v.fragments[0];if(!E.details)h.hasProgramDateTime&&v.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(h,v):R&&Object(O.addSliding)(h,R.start);else{var N=this.alignPlaylists(h,E.details);N===0&&R&&Object(O.addSliding)(h,R.start)}}if(E.details=h,this.levelLastLoaded=d,this.tick(),h.live&&!this.fragCurrent&&this.media&&this.state===c.State.IDLE){var B=Object(I.findFragmentByPTS)(null,h.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),E.details=void 0)}},g._handleFragmentLoadComplete=function(L){var x=L.frag,f=L.payload,h=x.decryptdata,d=this.hls;if(this.fragContextChanged(x))return;if(f&&f.byteLength>0&&h&&h.key&&h.iv&&h.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),h.key.buffer,h.iv.buffer).then(function(T){var E=performance.now();d.trigger(W.Events.FRAG_DECRYPTED,{frag:x,payload:T,stats:{tstart:o,tdecrypt:E}})})}},g.doTick=function(){if(!this.media){this.state=c.State.IDLE;return}if(this.state===c.State.IDLE){var L,x=this.currentTrackId,f=this.levels;if(!f.length||!f[x]||!f[x].details)return;var h=f[x].details,d=h.targetduration,o=this.config,T=this.media,E=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,T.currentTime-d,o.maxBufferHole),v=E.end,R=E.len,N=this.getMaxBufferLength()+d;if(R>N)return;console.assert(h,"Subtitle track details are defined on idle subtitle stream controller tick");var B=h.fragments,z=B.length,j=h.edge,F,X=this.fragPrevious;if(v<j){var q=o.maxFragLookUpTolerance;X&&h.hasProgramDateTime&&(F=Object(I.findFragmentByPDT)(B,X.endProgramDateTime,q)),F||(F=Object(I.findFragmentByPTS)(X,B,v,q),!F&&X&&X.start<B[0].start&&(F=B[0]))}else F=B[z-1];(L=F)!==null&&L!==void 0&&L.encrypted?(M.logger.log("Loading key for "+F.sn),this.state=c.State.KEY_LOADING,this.hls.trigger(W.Events.KEY_LOADING,{frag:F})):F&&this.fragmentTracker.getState(F)===_.FragmentState.NOT_LOADED&&this.loadFragment(F,h,v)}},g.loadFragment=function(L,x,f){this.fragCurrent=L,u.prototype.loadFragment.call(this,L,x,f)},y(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(c.default)},"./src/controller/subtitle-track-controller.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/utils/texttrack-utils.ts"),P=A("./src/controller/base-playlist-controller.ts"),I=A("./src/types/loader.ts");function k(w,y){for(var b=0;b<y.length;b++){var l=y[b];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(w,l.key,l)}}function O(w,y,b){return y&&k(w.prototype,y),b&&k(w,b),w}function _(w,y){w.prototype=Object.create(y.prototype),w.prototype.constructor=w,c(w,y)}function c(w,y){return c=Object.setPrototypeOf||function(l,a){return l.__proto__=a,l},c(w,y)}var p=function(w){_(y,w);function y(l){var a;return a=w.call(this,l,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var b=y.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},b.registerListeners=function(){var a=this.hls;a.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(W.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var a=this.hls;a.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(W.Events.ERROR,this.onError,this)},b.onMediaAttached=function(a,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)},b.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},b.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=D(this.media.textTracks);a.forEach(function(s){Object(M.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(a,s){this.tracks=s.subtitleTracks},b.onSubtitleTrackLoaded=function(a,s){var u=s.id,C=s.details,g=this.trackId,m=this.tracksInGroup[g];if(!m){this.warn("Invalid subtitle track id "+u);return}var L=m.details;m.details=s.details,this.log("subtitle track "+u+" loaded ["+C.startSN+"-"+C.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,L))},b.onLevelLoading=function(a,s){this.switchLevel(s.level)},b.onLevelSwitching=function(a,s){this.switchLevel(s.level)},b.switchLevel=function(a){var s=this.hls.levels[a];if(!(s!=null&&s.textGroupIds))return;var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(x){return!u||x.groupId===u});this.tracksInGroup=g;var m=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=u;var L={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(W.Events.SUBTITLE_TRACKS_UPDATED,L),m!==-1&&this.setSubtitleTrack(m,C)}},b.findTrackId=function(a){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var C=s[u];if((!this.selectDefaultTrack||C.default)&&(!a||a===C.name))return C.id}return-1},b.onError=function(a,s){if(w.prototype.onError.call(this,a,s),s.fatal||!s.context)return;s.context.type===I.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},b.loadPlaylist=function(a){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,C=s.groupId,g=s.url;if(a)try{g=a.addDirectives(g)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(W.Events.SUBTITLE_TRACK_LOADING,{url:g,id:u,groupId:C,deliveryDirectives:a||null})}},b.toggleTrackModes=function(a){var s=this,u=this.media,C=this.subtitleDisplay,g=this.trackId;if(!u)return;var m=D(u.textTracks),L=m.filter(function(h){return h.groupId===s.groupId});if(a===-1)[].slice.call(m).forEach(function(h){h.mode="disabled"});else{var x=L[g];x&&(x.mode="disabled")}var f=L[a];f&&(f.mode=C?"showing":"hidden")},b.setSubtitleTrack=function(a,s){var u,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(u=C[a])!==null&&u!==void 0&&u.details)||a<-1||a>=C.length)return;this.clearTimer();var g=C[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,g){var m=g.id,L=g.groupId,x=L===void 0?"":L,f=g.name,h=g.type,d=g.url;this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:x,name:f,type:h,url:d});var o=this.switchParams(g.url,s==null?void 0:s.details);this.loadPlaylist(o)}else this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:a})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,s=D(this.media.textTracks),u=0;u<s.length;u++)if(s[u].mode==="hidden")a=u;else if(s[u].mode==="showing"){a=u;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},O(y,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,s)}}]),y}(P.default);function D(w){for(var y=[],b=0;b<w.length;b++){var l=w[b];l.kind==="subtitles"&&l.label&&y.push(w[b])}return y}K.default=p},"./src/controller/timeline-controller.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"TimelineController",function(){return D});var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/utils/cea-608-parser.ts"),I=A("./src/utils/output-filter.ts"),k=A("./src/utils/webvtt-parser.ts"),O=A("./src/utils/texttrack-utils.ts"),_=A("./src/utils/imsc1-ttml-parser.ts"),c=A("./src/types/loader.ts"),p=A("./src/utils/logger.ts"),D=function(){function l(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var u=new I.default(this,"textTrack1"),C=new I.default(this,"textTrack2"),g=new I.default(this,"textTrack3"),m=new I.default(this,"textTrack4");this.cea608Parser1=new P.default(1,u,C),this.cea608Parser2=new P.default(3,g,m)}s.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(M.Events.FRAG_LOADING,this.onFragLoading,this),s.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=l.prototype;return a.destroy=function(){var u=this.hls;u.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(M.Events.FRAG_LOADING,this.onFragLoading,this),u.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(u,C,g,m,L){for(var x=!1,f=L.length;f--;){var h=L[f],d=y(h[0],h[1],C,g);if(d>=0&&(h[0]=Math.min(h[0],C),h[1]=Math.max(h[1],g),x=!0,d/(g-C)>.5))return}if(x||L.push([C,g]),this.config.renderTextTracksNatively){var o=this.captionsTracks[u];this.Cues.newCue(o,C,g,m)}else{var T=this.Cues.newCue(null,C,g,m);this.hls.trigger(M.Events.CUES_PARSED,{type:"captions",cues:T,track:u})}},a.onInitPtsFound=function(u,C){var g=this,m=C.frag,L=C.id,x=C.initPTS,f=C.timescale,h=this.unparsedVttFrags;L==="main"&&(this.initPTS[m.cc]=x,this.timescale[m.cc]=f),h.length&&(this.unparsedVttFrags=[],h.forEach(function(d){g.onFragLoaded(M.Events.FRAG_LOADED,d)}))},a.getExistingTrack=function(u){var C=this.media;if(C)for(var g=0;g<C.textTracks.length;g++){var m=C.textTracks[g];if(m[u])return m}return null},a.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},a.createNativeTrack=function(u){if(this.captionsTracks[u])return;var C=this.captionsProperties,g=this.captionsTracks,m=this.media,L=C[u],x=L.label,f=L.languageCode,h=this.getExistingTrack(u);if(h)g[u]=h,Object(O.clearCurrentCues)(g[u]),Object(O.sendAddTrackEvent)(g[u],m);else{var d=this.createTextTrack("captions",x,f);d&&(d[u]=!0,g[u]=d)}},a.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var C=this.captionsProperties[u];if(!C)return;var g=C.label,m={_id:u,label:g,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[u]=m,this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},a.createTextTrack=function(u,C,g){var m=this.media;return m?m.addTextTrack(u,C,g):void 0},a.onMediaAttaching=function(u,C){this.media=C.media,this._cleanTracks()},a.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(C){Object(O.clearCurrentCues)(u[C]),delete u[C]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var u=this.media;if(!u)return;var C=u.textTracks;if(C)for(var g=0;g<C.length;g++)Object(O.clearCurrentCues)(C[g])},a.onSubtitleTracksUpdated=function(u,C){var g=this;this.textTracks=[];var m=C.subtitleTracks||[],L=m.some(function(d){return d.textCodec===_.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var x=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,o){var T;if(o<f.length){for(var E=null,v=0;v<f.length;v++)if(w(f[v],d)){E=f[v];break}E&&(T=E)}T?Object(O.clearCurrentCues)(T):(T=g.createTextTrack("subtitles",d.name,d.lang),T&&(T.mode="disabled")),T&&(T.groupId=d.groupId,g.textTracks.push(T))})}else if(!x&&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(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}},a.onManifestLoaded=function(u,C){var g=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(m){var L=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!L)return;var x="textTrack"+L[1],f=g.captionsProperties[x];if(!f)return;f.label=m.name,m.lang&&(f.languageCode=m.lang),f.media=m})},a.onFragLoading=function(u,C){var g=this.cea608Parser1,m=this.cea608Parser2,L=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(g&&m))return;if(C.frag.type===c.PlaylistLevelType.MAIN){var f,h,d=C.frag.sn,o=(f=C==null||((h=C.part)===null||h===void 0)?void 0:h.index)!=null?f:-1;d===L+1||d===L&&o===x+1||(g.reset(),m.reset()),this.lastSn=d,this.lastPartIndex=o}},a.onFragLoaded=function(u,C){var g=C.frag,m=C.payload,L=this.initPTS,x=this.unparsedVttFrags;if(g.type===c.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(W.isFiniteNumber)(L[g.cc])){x.push(C),L.length&&this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var f=g.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var h=this.tracks[g.level],d=this.vttCCs;d[g.cc]||(d[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),h&&h.textCodec===_.IMSC1_CODEC?this._parseIMSC1(g,m):this._parseVTTs(g,m,d)}}else this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(u,C){var g=this,m=this.hls;Object(_.parseIMSC1)(C,this.initPTS[u.cc],this.timescale[u.cc],function(L){g._appendCues(L,u.level),m.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(L){p.logger.log("Failed to parse IMSC1: "+L),m.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:L})})},a._parseVTTs=function(u,C,g){var m=this,L=this.hls;Object(k.parseWebVTT)(C,this.initPTS[u.cc],this.timescale[u.cc],g,u.cc,u.start,function(x){m._appendCues(x,u.level),L.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(x){m._fallbackToIMSC1(u,C),p.logger.log("Failed to parse VTT cue: "+x),L.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:x})})},a._fallbackToIMSC1=function(u,C){var g=this,m=this.tracks[u.level];m.textCodec||Object(_.parseIMSC1)(C,this.initPTS[u.cc],this.timescale[u.cc],function(){m.textCodec=_.IMSC1_CODEC,g._parseIMSC1(u,C)},function(){m.textCodec="wvtt"})},a._appendCues=function(u,C){var g=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[C];if(m.mode==="disabled")return;u.forEach(function(f){return Object(O.addCueToTrack)(m,f)})}else{var L=this.tracks[C],x=L.default?"default":"subtitles"+C;g.trigger(M.Events.CUES_PARSED,{type:"subtitles",cues:u,track:x})}},a.onFragDecrypted=function(u,C){var g=C.frag;if(g.type===c.PlaylistLevelType.SUBTITLE){if(!Object(W.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(M.Events.FRAG_LOADED,C)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(u,C){var g=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(g&&m))return;for(var L=0;L<C.samples.length;L++){var x=C.samples[L].bytes;if(x){var f=this.extractCea608Data(x);g.addData(C.samples[L].pts,f[0]),m.addData(C.samples[L].pts,f[1])}}},a.onBufferFlushing=function(u,C){var g=C.startOffset,m=C.endOffset,L=C.endOffsetSubtitles,x=C.type,f=this.media;if(!f||f.currentTime<m)return;if(!x||x==="video"){var h=this.captionsTracks;Object.keys(h).forEach(function(o){return Object(O.removeCuesInRange)(h[o],g,m)})}if(this.config.renderTextTracksNatively&&(g===0&&L!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(o){return Object(O.removeCuesInRange)(d[o],g,L)})}},a.extractCea608Data=function(u){for(var C=u[0]&31,g=2,m=[[],[]],L=0;L<C;L++){var x=u[g++],f=127&u[g++],h=127&u[g++],d=(4&x)!==0,o=3&x;if(f===0&&h===0)continue;d&&((o===0||o===1)&&(m[o].push(f),m[o].push(h)))}return m},l}();function w(l,a){return l&&l.label===a.name&&!(l.textTrack1||l.textTrack2)}function y(l,a,s,u){return Math.min(a,u)-Math.max(l,s)}function b(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function M(I,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=I,this.aesIV=k}var P=M.prototype;return P.decrypt=function(k,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,k)},M}()},"./src/crypt/aes-decryptor.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"removePadding",function(){return M}),A.d(K,"default",function(){return P});var W=A("./src/utils/typed-array.ts");function M(I){var k=I.byteLength,O=k&&new DataView(I.buffer).getUint8(k-1);return O?Object(W.sliceUint8)(I,0,k-O):I}var P=function(){function I(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var k=I.prototype;return k.uint8ArrayToUint32Array_=function(_){for(var c=new DataView(_),p=new Uint32Array(4),D=0;D<4;D++)p[D]=c.getUint32(D*4);return p},k.initTable=function(){var _=this.sBox,c=this.invSBox,p=this.subMix,D=p[0],w=p[1],y=p[2],b=p[3],l=this.invSubMix,a=l[0],s=l[1],u=l[2],C=l[3],g=new Uint32Array(256),m=0,L=0,x=0;for(x=0;x<256;x++)x<128?g[x]=x<<1:g[x]=x<<1^283;for(x=0;x<256;x++){var f=L^L<<1^L<<2^L<<3^L<<4;f=f>>>8^f&255^99,_[m]=f,c[f]=m;var h=g[m],d=g[h],o=g[d],T=g[f]*257^f*16843008;D[m]=T<<24|T>>>8,w[m]=T<<16|T>>>16,y[m]=T<<8|T>>>24,b[m]=T,T=o*16843009^d*65537^h*257^m*16843008,a[f]=T<<24|T>>>8,s[f]=T<<16|T>>>16,u[f]=T<<8|T>>>24,C[f]=T,m?(m=h^g[g[g[o^h]]],L^=g[g[L]]):m=L=1}},k.expandKey=function(_){for(var c=this.uint8ArrayToUint32Array_(_),p=!0,D=0;D<c.length&&p;)p=c[D]===this.key[D],D++;if(p)return;this.key=c;var w=this.keySize=c.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var y=this.ksRows=(w+6+1)*4,b,l,a=this.keySchedule=new Uint32Array(y),s=this.invKeySchedule=new Uint32Array(y),u=this.sBox,C=this.rcon,g=this.invSubMix,m=g[0],L=g[1],x=g[2],f=g[3],h,d;for(b=0;b<y;b++){if(b<w){h=a[b]=c[b];continue}d=h,b%w===0?(d=d<<8|d>>>24,d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255],d^=C[b/w|0]<<24):w>6&&b%w===4&&(d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255]),a[b]=h=(a[b-w]^d)>>>0}for(l=0;l<y;l++)b=y-l,l&3?d=a[b]:d=a[b-4],l<4||b<=4?s[l]=d:s[l]=m[u[d>>>24]]^L[u[d>>>16&255]]^x[u[d>>>8&255]]^f[u[d&255]],s[l]=s[l]>>>0},k.networkToHostOrderSwap=function(_){return _<<24|(_&65280)<<8|(_&16711680)>>8|_>>>24},k.decrypt=function(_,c,p){for(var D=this.keySize+6,w=this.invKeySchedule,y=this.invSBox,b=this.invSubMix,l=b[0],a=b[1],s=b[2],u=b[3],C=this.uint8ArrayToUint32Array_(p),g=C[0],m=C[1],L=C[2],x=C[3],f=new Int32Array(_),h=new Int32Array(f.length),d,o,T,E,v,R,N,B,z,j,F,X,q,ne,ue=this.networkToHostOrderSwap;c<f.length;){for(z=ue(f[c]),j=ue(f[c+1]),F=ue(f[c+2]),X=ue(f[c+3]),v=z^w[0],R=X^w[1],N=F^w[2],B=j^w[3],q=4,ne=1;ne<D;ne++)d=l[v>>>24]^a[R>>16&255]^s[N>>8&255]^u[B&255]^w[q],o=l[R>>>24]^a[N>>16&255]^s[B>>8&255]^u[v&255]^w[q+1],T=l[N>>>24]^a[B>>16&255]^s[v>>8&255]^u[R&255]^w[q+2],E=l[B>>>24]^a[v>>16&255]^s[R>>8&255]^u[N&255]^w[q+3],v=d,R=o,N=T,B=E,q=q+4;d=y[v>>>24]<<24^y[R>>16&255]<<16^y[N>>8&255]<<8^y[B&255]^w[q],o=y[R>>>24]<<24^y[N>>16&255]<<16^y[B>>8&255]<<8^y[v&255]^w[q+1],T=y[N>>>24]<<24^y[B>>16&255]<<16^y[v>>8&255]<<8^y[R&255]^w[q+2],E=y[B>>>24]<<24^y[v>>16&255]<<16^y[R>>8&255]<<8^y[N&255]^w[q+3],h[c]=ue(d^g),h[c+1]=ue(E^m),h[c+2]=ue(T^L),h[c+3]=ue(o^x),g=z,m=j,L=F,x=X,c=c+4}return h.buffer},I}()},"./src/crypt/decrypter.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return c});var W=A("./src/crypt/aes-crypto.ts"),M=A("./src/crypt/fast-aes-key.ts"),P=A("./src/crypt/aes-decryptor.ts"),I=A("./src/utils/logger.ts"),k=A("./src/utils/mp4-tools.ts"),O=A("./src/utils/typed-array.ts"),_=16,c=function(){function p(w,y,b){var l=b===void 0?{}:b,a=l.removePKCS7Padding,s=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=w,this.config=y,this.removePKCS7Padding=s,s)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var D=p.prototype;return D.destroy=function(){this.observer=null},D.isSync=function(){return this.config.enableSoftwareAES},D.flush=function(){var y=this.currentResult;if(!y){this.reset();return}var b=new Uint8Array(y);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(b):b},D.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},D.decrypt=function(y,b,l,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(y),b,l);var s=this.flush();s&&a(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(y),b,l).then(a)},D.softwareDecrypt=function(y,b,l){var a=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(y=Object(k.appendUint8Array)(u,y),this.remainderData=null);var C=this.getValidChunk(y);if(!C.length)return null;a&&(l=a);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new P.default),g.expandKey(b);var m=s;return this.currentResult=g.decrypt(C.buffer,0,l),this.currentIV=Object(O.sliceUint8)(C,-16).buffer,m||null},D.webCryptoDecrypt=function(y,b,l){var a=this,s=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new M.default(s,b)),this.fastAesKey.expandKey().then(function(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var C=new W.default(s,l);return C.decrypt(y.buffer,u)}).catch(function(u){return a.onWebCryptoError(u,y,b,l)})},D.onWebCryptoError=function(y,b,l,a){return I.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",y),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,l,a)},D.getValidChunk=function(y){var b=y,l=y.length-y.length%_;return l!==y.length&&(b=Object(O.sliceUint8)(y,0,l),this.remainderData=Object(O.sliceUint8)(y,l)),b},D.logOnce=function(y){if(!this.logEnabled)return;I.logger.log("[decrypter.ts]: "+y),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function M(I,k){this.subtle=void 0,this.key=void 0,this.subtle=I,this.key=k}var P=M.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},M}()},"./src/demux/aacdemuxer.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/demux/base-audio-demuxer.ts"),M=A("./src/demux/adts.ts"),P=A("./src/utils/logger.ts"),I=A("./src/demux/id3.ts");function k(c,p){c.prototype=Object.create(p.prototype),c.prototype.constructor=c,O(c,p)}function O(c,p){return O=Object.setPrototypeOf||function(w,y){return w.__proto__=y,w},O(c,p)}var _=function(c){k(p,c);function p(w,y){var b;return b=c.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=w,b.config=y,b}var D=p.prototype;return D.resetInitSegment=function(y,b,l){c.prototype.resetInitSegment.call(this,y,b,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:y,duration:l,inputTimeScale:9e4,dropped:0}},p.probe=function(y){if(!y)return!1;for(var b=I.getID3Data(y,0)||[],l=b.length,a=y.length;l<a;l++)if(M.probe(y,l))return P.logger.log("ADTS sync word found !"),!0;return!1},D.canParse=function(y,b){return M.canParse(y,b)},D.appendFrame=function(y,b,l){M.initTrackConfig(y,this.observer,b,l,y.manifestCodec);var a=M.appendFrame(y,b,l,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},p}(W.default);_.minProbeByteLength=9,K.default=_},"./src/demux/adts.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"getAudioConfig",function(){return I}),A.d(K,"isHeaderPattern",function(){return k}),A.d(K,"getHeaderLength",function(){return O}),A.d(K,"getFullFrameLength",function(){return _}),A.d(K,"canGetFrameLength",function(){return c}),A.d(K,"isHeader",function(){return p}),A.d(K,"canParse",function(){return D}),A.d(K,"probe",function(){return w}),A.d(K,"initTrackConfig",function(){return y}),A.d(K,"getFrameDuration",function(){return b}),A.d(K,"parseFrameHeader",function(){return l}),A.d(K,"appendFrame",function(){return a});var W=A("./src/utils/logger.ts"),M=A("./src/errors.ts"),P=A("./src/events.ts");function I(s,u,C,g){var m,L,x,f,h=navigator.userAgent.toLowerCase(),d=g,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((u[C+2]&192)>>>6)+1;var T=(u[C+2]&60)>>>2;if(T>o.length-1){s.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+T});return}return x=(u[C+2]&1)<<2,x|=(u[C+3]&192)>>>6,W.logger.log("manifest codec:"+g+", ADTS type:"+m+", samplingIndex:"+T),/firefox/i.test(h)?T>=6?(m=5,f=new Array(4),L=T-3):(m=2,f=new Array(2),L=T):h.indexOf("android")!==-1?(m=2,f=new Array(2),L=T):(m=5,f=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&T>=6?L=T-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(T>=6&&x===1||/vivaldi/i.test(h))||!g&&x===1)&&(m=2,f=new Array(2)),L=T)),f[0]=m<<3,f[0]|=(T&14)>>1,f[1]|=(T&1)<<7,f[1]|=x<<3,m===5&&(f[1]|=(L&14)>>1,f[2]=(L&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:o[T],channelCount:x,codec:"mp4a.40."+m,manifestCodec:d}}function k(s,u){return s[u]===255&&(s[u+1]&246)===240}function O(s,u){return s[u+1]&1?7:9}function _(s,u){return(s[u+3]&3)<<11|s[u+4]<<3|(s[u+5]&224)>>>5}function c(s,u){return u+5<s.length}function p(s,u){return u+1<s.length&&k(s,u)}function D(s,u){return c(s,u)&&k(s,u)&&_(s,u)<=s.length-u}function w(s,u){if(p(s,u)){var C=O(s,u);if(u+C>=s.length)return!1;var g=_(s,u);if(g<=C)return!1;var m=u+g;return m===s.length||p(s,m)}return!1}function y(s,u,C,g,m){if(!s.samplerate){var L=I(u,C,g,m);if(!L)return;s.config=L.config,s.samplerate=L.samplerate,s.channelCount=L.channelCount,s.codec=L.codec,s.manifestCodec=L.manifestCodec,W.logger.log("parsed codec:"+s.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function b(s){return 1024*9e4/s}function l(s,u,C,g,m){var L=O(s,u),x=_(s,u);if(x-=L,x>0){var f=C+g*m;return{headerLength:L,frameLength:x,stamp:f}}}function a(s,u,C,g,m){var L=b(s.samplerate),x=l(u,C,g,m,L);if(x){var f=x.frameLength,h=x.headerLength,d=x.stamp,o=h+f,T=Math.max(0,C+o-u.length),E;T?(E=new Uint8Array(o-h),E.set(u.subarray(C+h,u.length),0)):E=u.subarray(C+h,C+o);var v={unit:E,pts:d};return T||s.samples.push(v),{sample:v,length:o,missing:T}}}},"./src/demux/base-audio-demuxer.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"initPTSFn",function(){return _});var W=A("./src/polyfills/number.ts"),M=A("./src/demux/id3.ts"),P=A("./src/demux/dummy-demuxed-track.ts"),I=A("./src/utils/mp4-tools.ts"),k=A("./src/utils/typed-array.ts"),O=function(){function c(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var p=c.prototype;return p.resetInitSegment=function(w,y,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(w,y){return!1},p.appendFrame=function(w,y,b){},p.demux=function(w,y){this.cachedData&&(w=Object(I.appendUint8Array)(this.cachedData,w),this.cachedData=null);var b=M.getID3Data(w,0),l=b?b.length:0,a,s,u=this._audioTrack,C=this._id3Track,g=b?M.getTimeStamp(b):void 0,m=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=_(g,y)),b&&b.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),s=this.initPTS;l<m;){if(this.canParse(w,l)){var L=this.appendFrame(u,w,l);L?(this.frameIndex++,s=L.sample.pts,l+=L.length,a=l):l=m}else M.canParse(w,l)?(b=M.getID3Data(w,l),C.samples.push({pts:s,dts:s,data:b}),l+=b.length,a=l):l++;if(l===m&&a!==m){var x=Object(k.sliceUint8)(w,a);this.cachedData?this.cachedData=Object(I.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:u,avcTrack:Object(P.dummyTrack)(),id3Track:C,textTrack:Object(P.dummyTrack)()}},p.demuxSampleAes=function(w,y,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(w){var y=this.cachedData;return y&&(this.cachedData=null,this.demux(y,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},p.destroy=function(){},c}(),_=function(p,D){return Object(W.isFiniteNumber)(p)?p*90:D*9e4};K.default=O},"./src/demux/chunk-cache.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function P(){this.chunks=[],this.dataLength=0}var I=P.prototype;return I.push=function(O){this.chunks.push(O),this.dataLength+=O.length},I.flush=function(){var O=this.chunks,_=this.dataLength,c;if(O.length)O.length===1?c=O[0]:c=M(O,_);else return new Uint8Array(0);return this.reset(),c},I.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function M(P,I){for(var k=new Uint8Array(I),O=0,_=0;_<P.length;_++){var c=P[_];k.set(c,O),O+=c.length}return k}},"./src/demux/dummy-demuxed-track.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"dummyTrack",function(){return W});function W(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/utils/logger.ts"),M=function(){function P(k){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=k,this.bytesAvailable=k.byteLength,this.word=0,this.bitsAvailable=0}var I=P.prototype;return I.loadWord=function(){var O=this.data,_=this.bytesAvailable,c=O.byteLength-_,p=new Uint8Array(4),D=Math.min(4,_);if(D===0)throw new Error("no bytes available");p.set(O.subarray(c,c+D)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=D*8,this.bytesAvailable-=D},I.skipBits=function(O){var _;this.bitsAvailable>O?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,_=O>>3,O-=_>>3,this.bytesAvailable-=_,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},I.readBits=function(O){var _=Math.min(this.bitsAvailable,O),c=this.word>>>32-_;return O>32&&W.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=_,this.bitsAvailable>0?this.word<<=_:this.bytesAvailable>0&&this.loadWord(),_=O-_,_>0&&this.bitsAvailable?c<<_|this.readBits(_):c},I.skipLZ=function(){var O;for(O=0;O<this.bitsAvailable;++O)if((this.word&2147483648>>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},I.skipUEG=function(){this.skipBits(1+this.skipLZ())},I.skipEG=function(){this.skipBits(1+this.skipLZ())},I.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},I.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},I.readBoolean=function(){return this.readBits(1)===1},I.readUByte=function(){return this.readBits(8)},I.readUShort=function(){return this.readBits(16)},I.readUInt=function(){return this.readBits(32)},I.skipScalingList=function(O){for(var _=8,c=8,p,D=0;D<O;D++)c!==0&&(p=this.readEG(),c=(_+p+256)%256),_=c===0?_:c},I.readSPS=function(){var O=0,_=0,c=0,p=0,D,w,y,b=this.readUByte.bind(this),l=this.readBits.bind(this),a=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),C=this.skipEG.bind(this),g=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);b();var L=b();if(l(5),u(3),b(),g(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var x=a();if(x===3&&u(1),g(),g(),u(1),s())for(w=x!==3?8:12,y=0;y<w;y++)s()&&(y<6?m(16):m(64))}g();var f=a();if(f===0)a();else if(f===1)for(u(1),C(),C(),D=a(),y=0;y<D;y++)C();g(),u(1);var h=a(),d=a(),o=l(1);o===0&&u(1),u(1),s()&&(O=a(),_=a(),c=a(),p=a());var T=[1,1];if(s()&&s()){var E=b();switch(E){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((h+1)*16-O*2-_*2),height:(2-o)*(d+1)*16-(o?2:4)*(c+p),pixelRatio:T}},I.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();K.default=M},"./src/demux/id3.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"isHeader",function(){return W}),A.d(K,"isFooter",function(){return M}),A.d(K,"getID3Data",function(){return P}),A.d(K,"canParse",function(){return k}),A.d(K,"getTimeStamp",function(){return O}),A.d(K,"isTimeStampFrame",function(){return _}),A.d(K,"getID3Frames",function(){return p}),A.d(K,"decodeFrame",function(){return D}),A.d(K,"utf8ArrayToStr",function(){return a}),A.d(K,"testables",function(){return s});var W=function(m,L){return L+10<=m.length&&(m[L]===73&&m[L+1]===68&&m[L+2]===51&&(m[L+3]<255&&m[L+4]<255&&(m[L+6]<128&&m[L+7]<128&&m[L+8]<128&&m[L+9]<128)))},M=function(m,L){return L+10<=m.length&&(m[L]===51&&m[L+1]===68&&m[L+2]===73&&(m[L+3]<255&&m[L+4]<255&&(m[L+6]<128&&m[L+7]<128&&m[L+8]<128&&m[L+9]<128)))},P=function(m,L){for(var x=L,f=0;W(m,L);){f+=10;var h=I(m,L+6);f+=h,M(m,L+10)&&(f+=10),L+=f}return f>0?m.subarray(x,x+f):void 0},I=function(m,L){var x=0;return x=(m[L]&127)<<21,x|=(m[L+1]&127)<<14,x|=(m[L+2]&127)<<7,x|=m[L+3]&127,x},k=function(m,L){return W(m,L)&&I(m,L+6)+10<=m.length-L},O=function(m){for(var L=p(m),x=0;x<L.length;x++){var f=L[x];if(_(f))return l(f)}return},_=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},c=function(m){var L=String.fromCharCode(m[0],m[1],m[2],m[3]),x=I(m,4),f=10;return{type:L,size:x,data:m.subarray(f,f+x)}},p=function(m){for(var L=0,x=[];W(m,L);){var f=I(m,L+6);L+=10;for(var h=L+f;L+8<h;){var d=c(m.subarray(L)),o=D(d);o&&x.push(o),L+=d.size+10}M(m,L)&&(L+=10)}return x},D=function(m){return m.type==="PRIV"?w(m):m.type[0]==="W"?b(m):y(m)},w=function(m){if(m.size<2)return;var L=a(m.data,!0),x=new Uint8Array(m.data.subarray(L.length+1));return{key:m.type,info:L,data:x.buffer}},y=function(m){if(m.size<2)return;if(m.type==="TXXX"){var L=1,x=a(m.data.subarray(L),!0);L+=x.length+1;var f=a(m.data.subarray(L));return{key:m.type,info:x,data:f}}var h=a(m.data.subarray(1));return{key:m.type,data:h}},b=function(m){if(m.type==="WXXX"){if(m.size<2)return;var L=1,x=a(m.data.subarray(L),!0);L+=x.length+1;var f=a(m.data.subarray(L));return{key:m.type,info:x,data:f}}var h=a(m.data);return{key:m.type,data:h}},l=function(m){if(m.data.byteLength===8){var L=new Uint8Array(m.data),x=L[3]&1,f=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return f/=45,x&&(f+=4772185884e-2),Math.round(f)}return},a=function(m,L){L===void 0&&(L=!1);var x=C();if(x){var f=x.decode(m);if(L){var h=f.indexOf("\0");return h!==-1?f.substring(0,h):f}return f.replace(/\0/g,"")}for(var d=m.length,o,T,E,v="",R=0;R<d;){if(o=m[R++],o===0&&L)return v;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:v+=String.fromCharCode(o);break;case 12:case 13:T=m[R++],v+=String.fromCharCode((o&31)<<6|T&63);break;case 14:T=m[R++],E=m[R++],v+=String.fromCharCode((o&15)<<12|(T&63)<<6|(E&63)<<0);break;default:}}return v},s={decodeTextFrame:y},u;function C(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/demux/base-audio-demuxer.ts"),M=A("./src/demux/id3.ts"),P=A("./src/utils/logger.ts"),I=A("./src/demux/mpegaudio.ts");function k(c,p){c.prototype=Object.create(p.prototype),c.prototype.constructor=c,O(c,p)}function O(c,p){return O=Object.setPrototypeOf||function(w,y){return w.__proto__=y,w},O(c,p)}var _=function(c){k(p,c);function p(){return c.apply(this,arguments)||this}var D=p.prototype;return D.resetInitSegment=function(y,b,l){c.prototype.resetInitSegment.call(this,y,b,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:y,duration:l,inputTimeScale:9e4,dropped:0}},p.probe=function(y){if(!y)return!1;for(var b=M.getID3Data(y,0)||[],l=b.length,a=y.length;l<a;l++)if(I.probe(y,l))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},D.canParse=function(y,b){return I.canParse(y,b)},D.appendFrame=function(y,b,l){return this.initPTS===null?void 0:I.appendFrame(y,b,l,this.initPTS,this.frameIndex)},p}(W.default);_.minProbeByteLength=4,K.default=_},"./src/demux/mp4demuxer.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/utils/mp4-tools.ts"),M=A("./src/demux/dummy-demuxed-track.ts"),P=function(){function I(O,_){this.remainderData=null,this.config=void 0,this.config=_}var k=I.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},I.probe=function(_){return Object(W.findBox)({data:_,start:0,end:Math.min(_.length,16384)},["moof"]).length>0},k.demux=function(_){var c=_,p=Object(M.dummyTrack)();if(this.config.progressive){this.remainderData&&(c=Object(W.appendUint8Array)(this.remainderData,_));var D=Object(W.segmentValidRange)(c);this.remainderData=D.remainder,p.samples=D.valid||new Uint8Array}else p.samples=c;return{audioTrack:Object(M.dummyTrack)(),avcTrack:p,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.flush=function(){var _=Object(M.dummyTrack)();return _.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(M.dummyTrack)(),avcTrack:_,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.demuxSampleAes=function(_,c,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},I}();P.minProbeByteLength=1024,K.default=P},"./src/demux/mpegaudio.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"appendFrame",function(){return O}),A.d(K,"parseHeader",function(){return _}),A.d(K,"isHeaderPattern",function(){return c}),A.d(K,"isHeader",function(){return p}),A.d(K,"canParse",function(){return D}),A.d(K,"probe",function(){return w});var W=null,M=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],I=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k=[0,1,1,4];function O(y,b,l,a,s){if(l+24>b.length)return;var u=_(b,l);if(u&&l+u.frameLength<=b.length){var C=u.samplesPerFrame*9e4/u.sampleRate,g=a+s*C,m={unit:b.subarray(l,l+u.frameLength),pts:g,dts:g};return y.config=[],y.channelCount=u.channelCount,y.samplerate=u.sampleRate,y.samples.push(m),{sample:m,length:u.frameLength,missing:0}}}function _(y,b){var l=y[b+1]>>3&3,a=y[b+1]>>1&3,s=y[b+2]>>4&15,u=y[b+2]>>2&3;if(l!==1&&s!==0&&s!==15&&u!==3){var C=y[b+2]>>1&1,g=y[b+3]>>6,m=l===3?3-a:a===3?3:4,L=M[m*14+s-1]*1e3,x=l===3?0:l===2?1:2,f=P[x*3+u],h=g===3?1:2,d=I[l][a],o=k[a],T=d*8*o,E=Math.floor(d*L/f+C)*o;if(W===null){var v=navigator.userAgent||"",R=v.match(/Chrome\/(\d+)/i);W=R?parseInt(R[1]):0}var N=!!W&&W<=87;return N&&a===2&&L>=224e3&&g===0&&(y[b+3]=y[b+3]|128),{sampleRate:f,channelCount:h,frameLength:E,samplesPerFrame:T}}}function c(y,b){return y[b]===255&&(y[b+1]&224)===224&&(y[b+1]&6)!==0}function p(y,b){return b+1<y.length&&c(y,b)}function D(y,b){var l=4;return c(y,b)&&l<=y.length-b}function w(y,b){if(b+1<y.length&&c(y,b)){var l=4,a=_(y,b),s=l;a!=null&&a.frameLength&&(s=a.frameLength);var u=b+s;return u===y.length||p(y,u)}return!1}},"./src/demux/sample-aes.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/crypt/decrypter.ts"),M=A("./src/demux/tsdemuxer.ts"),P=function(){function I(O,_,c){this.keyData=void 0,this.decrypter=void 0,this.keyData=c,this.decrypter=new W.default(O,_,{removePKCS7Padding:!1})}var k=I.prototype;return k.decryptBuffer=function(_,c){this.decrypter.decrypt(_,this.keyData.key.buffer,this.keyData.iv.buffer,c)},k.decryptAacSample=function(_,c,p,D){var w=_[c].unit,y=w.subarray(16,w.length-w.length%16),b=y.buffer.slice(y.byteOffset,y.byteOffset+y.length),l=this;this.decryptBuffer(b,function(a){var s=new Uint8Array(a);w.set(s,16),D||l.decryptAacSamples(_,c+1,p)})},k.decryptAacSamples=function(_,c,p){for(;;c++){if(c>=_.length){p();return}if(_[c].unit.length<32)continue;var D=this.decrypter.isSync();if(this.decryptAacSample(_,c,p,D),!D)return}},k.getAvcEncryptedData=function(_){for(var c=Math.floor((_.length-48)/160)*16+16,p=new Int8Array(c),D=0,w=32;w<=_.length-16;w+=160,D+=16)p.set(_.subarray(w,w+16),D);return p},k.getAvcDecryptedUnit=function(_,c){for(var p=new Uint8Array(c),D=0,w=32;w<=_.length-16;w+=160,D+=16)_.set(p.subarray(D,D+16),w);return _},k.decryptAvcSample=function(_,c,p,D,w,y){var b=Object(M.discardEPB)(w.data),l=this.getAvcEncryptedData(b),a=this;this.decryptBuffer(l.buffer,function(s){w.data=a.getAvcDecryptedUnit(b,s),y||a.decryptAvcSamples(_,c,p+1,D)})},k.decryptAvcSamples=function(_,c,p,D){if(_ instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;c++,p=0){if(c>=_.length){D();return}for(var w=_[c].units;!(p>=w.length);p++){var y=w[p];if(y.data.length<=48||y.type!==1&&y.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(_,c,p,D,y,b),!b)return}}},I}();K.default=P},"./src/demux/transmuxer-interface.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return w});var W=A("./node_modules/webworkify-webpack/index.js"),M=A.n(W),P=A("./src/events.ts"),I=A("./src/demux/transmuxer.ts"),k=A("./src/utils/logger.ts"),O=A("./src/errors.ts"),_=A("./src/utils/mediasource-helper.ts"),c=A("./node_modules/eventemitter3/index.js"),p=A.n(c),D=Object(_.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function y(l,a,s,u){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=a,this.onTransmuxComplete=s,this.onFlush=u;var g=l.config,m=function(d,o){o=o||{},o.frag=C.frag,o.id=C.id,l.trigger(d,o)};this.observer=new c.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,m),this.observer.on(P.Events.ERROR,m);var L={mp4:D.isTypeSupported("video/mp4"),mpeg:D.isTypeSupported("audio/mpeg"),mp3:D.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var f;try{f=this.worker=W("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(h){l.trigger(P.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:L,vendor:x,id:a,config:JSON.stringify(g)})}catch(h){k.logger.warn("Error in worker:",h),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new I.default(this.observer,L,g,x,a),this.worker=null}}else this.transmuxer=new I.default(this.observer,L,g,x,a)}var b=y.prototype;return b.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},b.push=function(a,s,u,C,g,m,L,x,f,h){var d=this;f.transmuxing.start=self.performance.now();var o=this.transmuxer,T=this.worker,E=m?m.start:g.start,v=g.decryptdata,R=this.frag,N=!(R&&g.cc===R.cc),B=!(R&&f.level===R.level),z=R?f.sn-R.sn:-1,j=this.part?f.part-this.part.index:1,F=!B&&(z===1||z===0&&j===1),X=self.performance.now();(B||z||g.stats.parsing.start===0)&&(g.stats.parsing.start=X),m&&(j||!F)&&(m.stats.parsing.start=X);var q=new I.TransmuxState(N,F,x,B,E);if(!F||N){k.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
|
|
discontinuity: `+N+`
|
|
trackSwitch: `+B+`
|
|
contiguous: `+F+`
|
|
accurateTimeOffset: `+x+`
|
|
timeOffset: `+E);var ne=new I.TransmuxConfig(u,C,s,L,h);this.configureTransmuxer(ne)}if(this.frag=g,this.part=m,T)T.postMessage({cmd:"demux",data:a,decryptdata:v,chunkMeta:f,state:q},a instanceof ArrayBuffer?[a]:[]);else if(o){var ue=o.push(a,v,f,q);Object(I.isPromise)(ue)?ue.then(function(Ee){d.handleTransmuxComplete(Ee)}):this.handleTransmuxComplete(ue)}},b.flush=function(a){var s=this;a.transmuxing.start=self.performance.now();var u=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:a});else if(u){var g=u.flush(a);Object(I.isPromise)(g)?g.then(function(m){s.handleFlushResult(m,a)}):this.handleFlushResult(g,a)}},b.handleFlushResult=function(a,s){var u=this;a.forEach(function(C){u.handleTransmuxComplete(C)}),this.onFlush(s)},b.onWorkerMessage=function(a){var s=a.data,u=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,u.trigger(s.event,s.data);break}}},b.configureTransmuxer=function(a){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:a}):u&&u.configure(a)},b.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},y}()},"./src/demux/transmuxer-worker.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return O});var W=A("./src/demux/transmuxer.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts"),I=A("./node_modules/eventemitter3/index.js"),k=A.n(I);function O(w){var y=new I.EventEmitter,b=function(a,s){w.postMessage({event:a,data:s})};y.on(M.Events.FRAG_DECRYPTED,b),y.on(M.Events.ERROR,b),w.addEventListener("message",function(l){var a=l.data;switch(a.cmd){case"init":{var s=JSON.parse(a.config);w.transmuxer=new W.default(y,a.typeSupported,s,a.vendor,a.id),Object(P.enableLogs)(s.debug),b("init",null);break}case"configure":{w.transmuxer.configure(a.config);break}case"demux":{var u=w.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(W.isPromise)(u)?u.then(function(m){_(w,m)}):_(w,u);break}case"flush":{var C=a.chunkMeta,g=w.transmuxer.flush(C);Object(W.isPromise)(g)?g.then(function(m){p(w,m,C)}):p(w,g,C);break}default:break}})}function _(w,y){if(D(y.remuxResult))return;var b=[],l=y.remuxResult,a=l.audio,s=l.video;a&&c(b,a),s&&c(b,s),w.postMessage({event:"transmuxComplete",data:y},b)}function c(w,y){y.data1&&w.push(y.data1.buffer),y.data2&&w.push(y.data2.buffer)}function p(w,y,b){y.forEach(function(l){_(w,l)}),w.postMessage({event:"flush",data:b})}function D(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return s}),A.d(K,"isPromise",function(){return g}),A.d(K,"TransmuxConfig",function(){return m}),A.d(K,"TransmuxState",function(){return L});var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/crypt/decrypter.ts"),I=A("./src/demux/aacdemuxer.ts"),k=A("./src/demux/mp4demuxer.ts"),O=A("./src/demux/tsdemuxer.ts"),_=A("./src/demux/mp3demuxer.ts"),c=A("./src/remux/mp4-remuxer.ts"),p=A("./src/remux/passthrough-remuxer.ts"),D=A("./src/demux/chunk-cache.ts"),w=A("./src/utils/mp4-tools.ts"),y=A("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(x){y.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var l=[{demux:O.default,remux:c.default},{demux:k.default,remux:p.default},{demux:I.default,remux:c.default},{demux:_.default,remux:c.default}],a=1024;l.forEach(function(x){var f=x.demux;a=Math.max(a,f.minProbeByteLength)});var s=function(){function x(h,d,o,T,E){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 D.default,this.observer=h,this.typeSupported=d,this.config=o,this.vendor=T,this.id=E}var f=x.prototype;return f.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},f.push=function(d,o,T,E){var v=this,R=T.transmuxing;R.executeStart=b();var N=new Uint8Array(d),B=this.cache,z=this.config,j=this.currentTransmuxState,F=this.transmuxConfig;E&&(this.currentTransmuxState=E);var X=u(N,o);if(X&&X.method==="AES-128"){var q=this.getDecrypter();if(z.enableSoftwareAES){var ne=q.softwareDecrypt(N,X.key.buffer,X.iv.buffer);if(!ne)return R.executeEnd=b(),C(T);N=new Uint8Array(ne)}else return this.decryptionPromise=q.webCryptoDecrypt(N,X.key.buffer,X.iv.buffer).then(function(De){var ke=v.push(De,null,T);return v.decryptionPromise=null,ke}),this.decryptionPromise}var ue=E||j,Ee=ue.contiguous,pe=ue.discontinuity,fe=ue.trackSwitch,de=ue.accurateTimeOffset,ce=ue.timeOffset,re=F.audioCodec,se=F.videoCodec,be=F.defaultInitPts,Me=F.duration,Ie=F.initSegmentData;if((pe||fe)&&this.resetInitSegment(Ie,re,se,Me),pe&&this.resetInitialTimestamp(be),Ee||this.resetContiguity(),this.needsProbing(N,pe,fe)){if(B.dataLength){var Ge=B.flush();N=Object(w.appendUint8Array)(Ge,N)}this.configureTransmuxer(N,F)}var He=this.transmux(N,X,ce,de,T),Se=this.currentTransmuxState;return Se.contiguous=!0,Se.discontinuity=!1,Se.trackSwitch=!1,R.executeEnd=b(),He},f.flush=function(d){var o=this,T=d.transmuxing;T.executeStart=b();var E=this.decrypter,v=this.cache,R=this.currentTransmuxState,N=this.decryptionPromise;if(N)return N.then(function(){return o.flush(d)});var B=[],z=R.timeOffset;if(E){var j=E.flush();j&&B.push(this.push(j,null,d))}var F=v.dataLength;v.reset();var X=this.demuxer,q=this.remuxer;if(!X||!q)return F>=a&&this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),T.executeEnd=b(),[C(d)];var ne=X.flush(z);return g(ne)?ne.then(function(ue){return o.flushRemux(B,ue,d),B}):(this.flushRemux(B,ne,d),B)},f.flushRemux=function(d,o,T){var E=o.audioTrack,v=o.avcTrack,R=o.id3Track,N=o.textTrack,B=this.currentTransmuxState,z=B.accurateTimeOffset,j=B.timeOffset;y.logger.log("[transmuxer.ts]: Flushed fragment "+T.sn+(T.part>-1?" p: "+T.part:"")+" of level "+T.level);var F=this.remuxer.remux(E,v,R,N,j,z,!0,this.id);d.push({remuxResult:F,chunkMeta:T}),T.transmuxing.executeEnd=b()},f.resetInitialTimestamp=function(d){var o=this.demuxer,T=this.remuxer;if(!o||!T)return;o.resetTimeStamp(d),T.resetTimeStamp(d)},f.resetContiguity=function(){var d=this.demuxer,o=this.remuxer;if(!d||!o)return;d.resetContiguity(),o.resetNextTimestamp()},f.resetInitSegment=function(d,o,T,E){var v=this.demuxer,R=this.remuxer;if(!v||!R)return;v.resetInitSegment(o,T,E),R.resetInitSegment(d,o,T)},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,o,T,E,v){var R;return o&&o.method==="SAMPLE-AES"?R=this.transmuxSampleAes(d,o,T,E,v):R=this.transmuxUnencrypted(d,T,E,v),R},f.transmuxUnencrypted=function(d,o,T,E){var v=this.demuxer.demux(d,o,!1,!this.config.progressive),R=v.audioTrack,N=v.avcTrack,B=v.id3Track,z=v.textTrack,j=this.remuxer.remux(R,N,B,z,o,T,!1,this.id);return{remuxResult:j,chunkMeta:E}},f.transmuxSampleAes=function(d,o,T,E,v){var R=this;return this.demuxer.demuxSampleAes(d,o,T).then(function(N){var B=R.remuxer.remux(N.audioTrack,N.avcTrack,N.id3Track,N.textTrack,T,E,!1,R.id);return{remuxResult:B,chunkMeta:v}})},f.configureTransmuxer=function(d,o){for(var T=this.config,E=this.observer,v=this.typeSupported,R=this.vendor,N=o.audioCodec,B=o.defaultInitPts,z=o.duration,j=o.initSegmentData,F=o.videoCodec,X,q=0,ne=l.length;q<ne;q++)if(l[q].demux.probe(d)){X=l[q];break}X||(y.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:k.default,remux:p.default});var ue=this.demuxer,Ee=this.remuxer,pe=X.remux,fe=X.demux;(!Ee||!(Ee instanceof pe))&&(this.remuxer=new pe(E,T,v,R)),(!ue||!(ue instanceof fe))&&(this.demuxer=new fe(E,T,v),this.probe=fe.probe),this.resetInitSegment(j,N,F,z),this.resetInitialTimestamp(B)},f.needsProbing=function(d,o,T){return!this.demuxer||!this.remuxer||o||T},f.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new P.default(this.observer,this.config)),d},x}();function u(x,f){var h=null;return x.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(h=f),h}var C=function(f){return{remuxResult:{},chunkMeta:f}};function g(x){return"then"in x&&x.then instanceof Function}var m=function(f,h,d,o,T){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=o,this.defaultInitPts=T},L=function(f,h,d,o,T){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=o,this.timeOffset=T}},"./src/demux/tsdemuxer.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"discardEPB",function(){return C});var W=A("./src/demux/adts.ts"),M=A("./src/demux/mpegaudio.ts"),P=A("./src/demux/exp-golomb.ts"),I=A("./src/demux/id3.ts"),k=A("./src/demux/sample-aes.ts"),O=A("./src/events.ts"),_=A("./src/utils/mp4-tools.ts"),c=A("./src/utils/logger.ts"),p=A("./src/errors.ts"),D={video:1,audio:2,id3:3,text:4},w=function(){function g(L,x,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=L,this.config=x,this.typeSupported=f}g.probe=function(x){var f=g.syncOffset(x);return f<0?!1:(f&&c.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},g.syncOffset=function(x){for(var f=Math.min(1e3,x.length-3*188),h=0;h<f;){if(x[h]===71&&x[h+188]===71&&x[h+2*188]===71)return h;h++}return-1},g.createTrack=function(x,f){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:D[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?f:void 0}};var m=g.prototype;return m.resetInitSegment=function(x,f,h){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",h),this._audioTrack=g.createTrack("audio",h),this._id3Track=g.createTrack("id3",h),this._txtTrack=g.createTrack("text",h),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=f,this._duration=h},m.resetTimeStamp=function(){},m.resetContiguity=function(){var x=this._audioTrack,f=this._avcTrack,h=this._id3Track;x&&(x.pesData=null),f&&(f.pesData=null),h&&(h.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(x,f,h,d){h===void 0&&(h=!1),d===void 0&&(d=!1),h||(this.sampleAes=null);var o,T=this._avcTrack,E=this._audioTrack,v=this._id3Track,R=T.pid,N=T.pesData,B=E.pid,z=v.pid,j=E.pesData,F=v.pesData,X=!1,q=this.pmtParsed,ne=this._pmtId,ue=x.length;if(this.remainderData&&(x=Object(_.appendUint8Array)(this.remainderData,x),ue=x.length,this.remainderData=null),ue<188&&!d)return this.remainderData=x,{audioTrack:E,avcTrack:T,id3Track:v,textTrack:this._txtTrack};var Ee=Math.max(0,g.syncOffset(x));ue-=(ue+Ee)%188,ue<x.byteLength&&!d&&(this.remainderData=new Uint8Array(x.buffer,ue,x.buffer.byteLength-ue));for(var pe=Ee;pe<ue;pe+=188)if(x[pe]===71){var fe=!!(x[pe+1]&64),de=((x[pe+1]&31)<<8)+x[pe+2],ce=(x[pe+3]&48)>>4,re=void 0;if(ce>1){if(re=pe+5+x[pe+4],re===pe+188)continue}else re=pe+4;switch(de){case R:fe&&(N&&(o=a(N))&&this.parseAVCPES(o,!1),N={data:[],size:0}),N&&(N.data.push(x.subarray(re,pe+188)),N.size+=pe+188-re);break;case B:fe&&(j&&(o=a(j))&&(E.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),j={data:[],size:0}),j&&(j.data.push(x.subarray(re,pe+188)),j.size+=pe+188-re);break;case z:fe&&(F&&(o=a(F))&&this.parseID3PES(o),F={data:[],size:0}),F&&(F.data.push(x.subarray(re,pe+188)),F.size+=pe+188-re);break;case 0:fe&&(re+=x[re]+1),ne=this._pmtId=b(x,re);break;case ne:{fe&&(re+=x[re]+1);var se=l(x,re,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,h);R=se.avc,R>0&&(T.pid=R),B=se.audio,B>0&&(E.pid=B,E.isAAC=se.isAAC),z=se.id3,z>0&&(v.pid=z),X&&!q&&(c.logger.log("reparse from beginning"),X=!1,pe=Ee-188),q=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});T.pesData=N,E.pesData=j,v.pesData=F;var be={audioTrack:E,avcTrack:T,id3Track:v,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(be),be},m.flush=function(){var x=this.remainderData;this.remainderData=null;var f;return x?f=this.demux(x,-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(x){var f=x.audioTrack,h=x.avcTrack,d=x.id3Track,o=h.pesData,T=f.pesData,E=d.pesData,v;o&&(v=a(o))?(this.parseAVCPES(v,!0),h.pesData=null):h.pesData=o,T&&(v=a(T))?(f.isAAC?this.parseAACPES(v):this.parseMPEGPES(v),f.pesData=null):(T!=null&&T.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=T),E&&(v=a(E))?(this.parseID3PES(v),d.pesData=null):d.pesData=E},m.demuxSampleAes=function(x,f,h){var d=this.demux(x,h,!0,!this.config.progressive),o=this.sampleAes=new k.default(this.observer,this.config,f);return this.decrypt(d,o)},m.decrypt=function(x,f){return new Promise(function(h){var d=x.audioTrack,o=x.avcTrack;d.samples&&d.isAAC?f.decryptAacSamples(d.samples,0,function(){o.samples?f.decryptAvcSamples(o.samples,0,0,function(){h(x)}):h(x)}):o.samples&&f.decryptAvcSamples(o.samples,0,0,function(){h(x)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(x,f){var h=this,d=this._avcTrack,o=this.parseAVCNALu(x.data),T=!1,E=this.avcSample,v,R=!1;x.data=null,E&&o.length&&!d.audFound&&(s(E,d),E=this.avcSample=y(!1,x.pts,x.dts,"")),o.forEach(function(N){switch(N.type){case 1:{v=!0,E||(E=h.avcSample=y(!0,x.pts,x.dts,"")),T&&(E.debug+="NDR "),E.frame=!0;var B=N.data;if(R&&B.length>4){var z=new P.default(B).readSliceType();(z===2||z===4||z===7||z===9)&&(E.key=!0)}break}case 5:v=!0,E||(E=h.avcSample=y(!0,x.pts,x.dts,"")),T&&(E.debug+="IDR "),E.key=!0,E.frame=!0;break;case 6:{v=!0,T&&E&&(E.debug+="SEI ");var j=new P.default(C(N.data));j.readUByte();for(var F=0,X=0,q=!1,ne=0;!q&&j.bytesAvailable>1;){F=0;do ne=j.readUByte(),F+=ne;while(ne===255);X=0;do ne=j.readUByte(),X+=ne;while(ne===255);if(F===4&&j.bytesAvailable!==0){q=!0;var ue=j.readUByte();if(ue===181){var Ee=j.readUShort();if(Ee===49){var pe=j.readUInt();if(pe===1195456820){var fe=j.readUByte();if(fe===3){for(var de=j.readUByte(),ce=j.readUByte(),re=31&de,se=[de,ce],be=0;be<re;be++)se.push(j.readUByte()),se.push(j.readUByte()),se.push(j.readUByte());u(h._txtTrack.samples,{type:3,pts:x.pts,bytes:se})}}}}}else if(F===5&&j.bytesAvailable!==0){if(q=!0,X>16){for(var Me=[],Ie=0;Ie<16;Ie++)Me.push(j.readUByte().toString(16)),(Ie===3||Ie===5||Ie===7||Ie===9)&&Me.push("-");for(var Ge=X-16,He=new Uint8Array(Ge),Se=0;Se<Ge;Se++)He[Se]=j.readUByte();u(h._txtTrack.samples,{pts:x.pts,payloadType:F,uuid:Me.join(""),userData:Object(I.utf8ArrayToStr)(He),userDataBytes:He})}}else if(X<j.bytesAvailable)for(var De=0;De<X;De++)j.readUByte()}break}case 7:if(v=!0,R=!0,T&&E&&(E.debug+="SPS "),!d.sps){var ke=new P.default(N.data),Ke=ke.readSPS();d.width=Ke.width,d.height=Ke.height,d.pixelRatio=Ke.pixelRatio,d.sps=[N.data],d.duration=h._duration;for(var Fe=N.data.subarray(1,4),_e="avc1.",Le=0;Le<3;Le++){var rt=Fe[Le].toString(16);rt.length<2&&(rt="0"+rt),_e+=rt}d.codec=_e}break;case 8:v=!0,T&&E&&(E.debug+="PPS "),d.pps||(d.pps=[N.data]);break;case 9:v=!1,d.audFound=!0,E&&s(E,d),E=h.avcSample=y(!1,x.pts,x.dts,T?"AUD ":"");break;case 12:v=!1;break;default:v=!1,E&&(E.debug+="unknown NAL "+N.type+" ");break}if(E&&v){var qe=E.units;qe.push(N)}}),f&&E&&(s(E,d),this.avcSample=null)},m.getLastNalUnit=function(){var x,f=this.avcSample,h;if(!f||f.units.length===0){var d=this._avcTrack.samples;f=d[d.length-1]}if((x=f)!==null&&x!==void 0&&x.units){var o=f.units;h=o[o.length-1]}return h},m.parseAVCNALu=function(x){var f=x.byteLength,h=this._avcTrack,d=h.naluState||0,o=d,T=[],E=0,v,R,N,B=-1,z=0;for(d===-1&&(B=0,z=x[0]&31,d=0,E=1);E<f;){if(v=x[E++],!d){d=v?0:1;continue}if(d===1){d=v?0:2;continue}if(!v)d=3;else if(v===1){if(B>=0){var j={data:x.subarray(B,E-d-1),type:z};T.push(j)}else{var F=this.getLastNalUnit();if(F&&(o&&E<=4-o&&(F.state&&(F.data=F.data.subarray(0,F.data.byteLength-o))),R=E-d-1,R>0)){var X=new Uint8Array(F.data.byteLength+R);X.set(F.data,0),X.set(x.subarray(0,R),F.data.byteLength),F.data=X,F.state=0}}E<f?(N=x[E]&31,B=E,z=N,d=0):d=-1}else d=0}if(B>=0&&d>=0){var q={data:x.subarray(B,f),type:z,state:d};T.push(q)}if(T.length===0){var ne=this.getLastNalUnit();if(ne){var ue=new Uint8Array(ne.data.byteLength+x.byteLength);ue.set(ne.data,0),ue.set(x,ne.data.byteLength),ne.data=ue}}return h.naluState=d,T},m.parseAACPES=function(x){var f=0,h=this._audioTrack,d=this.aacOverFlow,o=x.data;if(d){this.aacOverFlow=null;var T=d.sample.unit.byteLength,E=Math.min(d.missing,T),v=T-E;d.sample.unit.set(o.subarray(0,E),v),h.samples.push(d.sample),f=d.missing}var R,N;for(R=f,N=o.length;R<N-1&&!W.isHeader(o,R);R++);if(R!==f){var B,z;if(R<N-1?(B="AAC PES did not start with ADTS header,offset:"+R,z=!1):(B="no ADTS header found in AAC PES",z=!0),c.logger.warn("parsing error:"+B),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:z,reason:B}),z)return}W.initTrackConfig(h,this.observer,o,R,this.audioCodec);var j;if(x.pts!==void 0)j=x.pts;else if(d){var F=W.getFrameDuration(h.samplerate);j=d.sample.pts+F}else{c.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;R<N;)if(W.isHeader(o,R)){if(R+5<N){var q=W.appendFrame(h,o,R,j,X);if(q)if(q.missing)this.aacOverFlow=q;else{R+=q.length,X++;continue}}break}else R++},m.parseMPEGPES=function(x){var f=x.data,h=f.length,d=0,o=0,T=x.pts;if(T===void 0){c.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<h;)if(M.isHeader(f,o)){var E=M.appendFrame(this._audioTrack,f,o,T,d);if(E)o+=E.length,d++;else break}else o++},m.parseID3PES=function(x){if(x.pts===void 0){c.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},g}();w.minProbeByteLength=188;function y(g,m,L,x){return{key:g,frame:!1,pts:m,dts:L,units:[],debug:x,length:0}}function b(g,m){return(g[m+10]&31)<<8|g[m+11]}function l(g,m,L,x){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},h=(g[m+1]&15)<<8|g[m+2],d=m+3+h-4,o=(g[m+10]&15)<<8|g[m+11];for(m+=12+o;m<d;){var T=(g[m+1]&31)<<8|g[m+2];switch(g[m]){case 207:if(!x){c.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=T);break;case 21:f.id3===-1&&(f.id3=T);break;case 219:if(!x){c.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=T);break;case 3:case 4:L?f.audio===-1&&(f.audio=T,f.isAAC=!1):c.logger.log("MPEG audio found, not supported in this browser");break;case 36:c.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((g[m+3]&15)<<8|g[m+4])+5}return f}function a(g){var m=0,L,x,f,h,d,o=g.data;if(!g||g.size===0)return null;for(;o[0].length<19&&o.length>1;){var T=new Uint8Array(o[0].length+o[1].length);T.set(o[0]),T.set(o[1],o[0].length),o[0]=T,o.splice(1,1)}L=o[0];var E=(L[0]<<16)+(L[1]<<8)+L[2];if(E===1){if(x=(L[4]<<8)+L[5],x&&x>g.size-6)return null;var v=L[7];v&192&&(h=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,v&64?(d=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,h-d>60*9e4&&(c.logger.warn(Math.round((h-d)/9e4)+"s delta between PTS and DTS, align them"),h=d)):d=h),f=L[8];var R=f+9;if(g.size<=R)return null;g.size-=R;for(var N=new Uint8Array(g.size),B=0,z=o.length;B<z;B++){L=o[B];var j=L.byteLength;if(R)if(R>j){R-=j;continue}else L=L.subarray(R),j-=R,R=0;N.set(L,m),m+=j}return x&&(x-=f+3),{data:N,pts:h,dts:d,len:x}}return null}function s(g,m){if(g.units.length&&g.frame){if(g.pts===void 0){var L=m.samples,x=L.length;if(x){var f=L[x-1];g.pts=f.pts,g.dts=f.dts}else{m.dropped++;return}}m.samples.push(g)}g.debug.length&&c.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function u(g,m){var L=g.length;if(L>0){if(m.pts>=g[L-1].pts)g.push(m);else for(var x=L-1;x>=0;x--)if(m.pts<g[x].pts){g.splice(x,0,m);break}}else g.push(m)}function C(g){for(var m=g.byteLength,L=[],x=1;x<m-2;)g[x]===0&&g[x+1]===0&&g[x+2]===3?(L.push(x+2),x+=2):x++;if(L.length===0)return g;var f=m-L.length,h=new Uint8Array(f),d=0;for(x=0;x<f;d++,x++)d===L[0]&&(d++,L.shift()),h[x]=g[d];return h}K.default=w},"./src/errors.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"ErrorTypes",function(){return W}),A.d(K,"ErrorDetails",function(){return M});var W;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(W||(W={}));var M;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(M||(M={}))},"./src/events.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"Events",function(){return W});var W;(function(M){M.MEDIA_ATTACHING="hlsMediaAttaching",M.MEDIA_ATTACHED="hlsMediaAttached",M.MEDIA_DETACHING="hlsMediaDetaching",M.MEDIA_DETACHED="hlsMediaDetached",M.BUFFER_RESET="hlsBufferReset",M.BUFFER_CODECS="hlsBufferCodecs",M.BUFFER_CREATED="hlsBufferCreated",M.BUFFER_APPENDING="hlsBufferAppending",M.BUFFER_APPENDED="hlsBufferAppended",M.BUFFER_EOS="hlsBufferEos",M.BUFFER_FLUSHING="hlsBufferFlushing",M.BUFFER_FLUSHED="hlsBufferFlushed",M.MANIFEST_LOADING="hlsManifestLoading",M.MANIFEST_LOADED="hlsManifestLoaded",M.MANIFEST_PARSED="hlsManifestParsed",M.LEVEL_SWITCHING="hlsLevelSwitching",M.LEVEL_SWITCHED="hlsLevelSwitched",M.LEVEL_LOADING="hlsLevelLoading",M.LEVEL_LOADED="hlsLevelLoaded",M.LEVEL_UPDATED="hlsLevelUpdated",M.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",M.LEVELS_UPDATED="hlsLevelsUpdated",M.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",M.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",M.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",M.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",M.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",M.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",M.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",M.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",M.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",M.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",M.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",M.CUES_PARSED="hlsCuesParsed",M.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",M.INIT_PTS_FOUND="hlsInitPtsFound",M.FRAG_LOADING="hlsFragLoading",M.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",M.FRAG_LOADED="hlsFragLoaded",M.FRAG_DECRYPTED="hlsFragDecrypted",M.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",M.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",M.FRAG_PARSING_METADATA="hlsFragParsingMetadata",M.FRAG_PARSED="hlsFragParsed",M.FRAG_BUFFERED="hlsFragBuffered",M.FRAG_CHANGED="hlsFragChanged",M.FPS_DROP="hlsFpsDrop",M.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",M.ERROR="hlsError",M.DESTROYING="hlsDestroying",M.KEY_LOADING="hlsKeyLoading",M.KEY_LOADED="hlsKeyLoaded",M.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",M.BACK_BUFFER_REACHED="hlsBackBufferReached"})(W||(W={}))},"./src/hls.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return g});var W=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(W),P=A("./src/loader/playlist-loader.ts"),I=A("./src/loader/key-loader.ts"),k=A("./src/controller/id3-track-controller.ts"),O=A("./src/controller/latency-controller.ts"),_=A("./src/controller/level-controller.ts"),c=A("./src/controller/fragment-tracker.ts"),p=A("./src/controller/stream-controller.ts"),D=A("./src/is-supported.ts"),w=A("./src/utils/logger.ts"),y=A("./src/config.ts"),b=A("./node_modules/eventemitter3/index.js"),l=A.n(b),a=A("./src/events.ts"),s=A("./src/errors.ts");function u(m,L){for(var x=0;x<L.length;x++){var f=L[x];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function C(m,L,x){return L&&u(m.prototype,L),x&&u(m,x),m}var g=function(){m.isSupported=function(){return Object(D.isSupported)()};function m(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var f=this.config=Object(y.mergeConfig)(m.DefaultConfig,x);this.userConfig=x,Object(w.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(y.enableStreamingMode)(f);var h=f.abrController,d=f.bufferController,o=f.capLevelController,T=f.fpsController,E=this.abrController=new h(this),v=this.bufferController=new d(this),R=this.capLevelController=new o(this),N=new T(this),B=new P.default(this),z=new I.default(this),j=new k.default(this),F=this.levelController=new _.default(this),X=new c.FragmentTracker(this),q=this.streamController=new p.default(this,X);R.setStreamController(q),N.setStreamController(q);var ne=[F,q];this.networkControllers=ne;var ue=[B,z,E,v,R,N,j,X];this.audioTrackController=this.createController(f.audioTrackController,null,ne),this.createController(f.audioStreamController,X,ne),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,ne),this.createController(f.subtitleStreamController,X,ne),this.createController(f.timelineController,null,ue),this.emeController=this.createController(f.emeController,null,ue),this.cmcdController=this.createController(f.cmcdController,null,ue),this.latencyController=this.createController(O.default,null,ue),this.coreComponents=ue}var L=m.prototype;return L.createController=function(f,h,d){if(f){var o=h?new f(this,h):new f(this);return d&&d.push(o),o}return null},L.on=function(f,h,d){d===void 0&&(d=this),this._emitter.on(f,h,d)},L.once=function(f,h,d){d===void 0&&(d=this),this._emitter.once(f,h,d)},L.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},L.off=function(f,h,d,o){d===void 0&&(d=this),this._emitter.off(f,h,d,o)},L.listeners=function(f){return this._emitter.listeners(f)},L.emit=function(f,h,d){return this._emitter.emit(f,h,d)},L.trigger=function(f,h){if(this.config.debug)return this.emit(f,f,h);try{return this.emit(f,f,h)}catch(d){w.logger.error("An internal error happened while handling event "+f+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(a.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:d})}return!1},L.listenerCount=function(f){return this._emitter.listenerCount(f)},L.destroy=function(){w.logger.log("destroy"),this.trigger(a.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},L.attachMedia=function(f){w.logger.log("attachMedia"),this._media=f,this.trigger(a.Events.MEDIA_ATTACHING,{media:f})},L.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(f){this.stopLoad();var h=this.media,d=this.url,o=this.url=W.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});w.logger.log("loadSource:"+o),h&&d&&d!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(h)),this.trigger(a.Events.MANIFEST_LOADING,{url:f})},L.startLoad=function(f){f===void 0&&(f=-1),w.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(h){h.startLoad(f)})},L.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},L.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){w.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},L.removeLevel=function(f,h){h===void 0&&(h=0),this.levelController.removeLevel(f,h)},C(m,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){w.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){w.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){w.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){w.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){w.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&&(w.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,o=0;o<d;o++)if(f[o].maxBitrate>h)return o;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 a.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:y.hlsDefaultConfig},set:function(f){m.defaultConfig=f}}]),m}();g.defaultConfig=void 0},"./src/is-supported.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"isSupported",function(){return P}),A.d(K,"changeTypeSupported",function(){return I});var W=A("./src/utils/mediasource-helper.ts");function M(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var k=Object(W.getMediaSource)();if(!k)return!1;var O=M(),_=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),c=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!_&&!!c}function I(){var k,O=M();return typeof(O==null||((k=O.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return w}),A.d(K,"LoadError",function(){return b});var W=A("./src/polyfills/number.ts"),M=A("./src/errors.ts");function P(l,a){l.prototype=Object.create(a.prototype),l.prototype.constructor=l,c(l,a)}function I(l){var a=typeof Map=="function"?new Map:void 0;return I=function(u){if(u===null||!_(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(u))return a.get(u);a.set(u,C)}function C(){return k(u,arguments,p(this).constructor)}return C.prototype=Object.create(u.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),c(C,u)},I(l)}function k(l,a,s){return O()?k=Reflect.construct:k=function(C,g,m){var L=[null];L.push.apply(L,g);var x=Function.bind.apply(C,L),f=new x;return m&&c(f,m.prototype),f},k.apply(null,arguments)}function O(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function _(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function c(l,a){return c=Object.setPrototypeOf||function(u,C){return u.__proto__=C,u},c(l,a)}function p(l){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},p(l)}var D=Math.pow(2,17),w=function(){function l(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var a=l.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(u,C){var g=this,m=u.url;if(!m)return Promise.reject(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var L=this.config,x=L.fLoader,f=L.loader;return new Promise(function(h,d){g.loader&&g.loader.destroy();var o=g.loader=u.loader=x?new x(L):new f(L),T=y(u),E={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:D};u.stats=o.stats,o.load(T,E,{onSuccess:function(R,N,B,z){g.resetLoader(u,o),h({frag:u,part:null,payload:R.data,networkDetails:z})},onError:function(R,N,B){g.resetLoader(u,o),d(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:R,networkDetails:B}))},onAbort:function(R,N,B){g.resetLoader(u,o),d(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:B}))},onTimeout:function(R,N,B){g.resetLoader(u,o),d(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:B}))},onProgress:function(R,N,B,z){C&&C({frag:u,part:null,payload:B,networkDetails:z})}})})},a.loadPart=function(u,C,g){var m=this;this.abort();var L=this.config,x=L.fLoader,f=L.loader;return new Promise(function(h,d){m.loader&&m.loader.destroy();var o=m.loader=u.loader=x?new x(L):new f(L),T=y(u,C),E={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:D};C.stats=o.stats,o.load(T,E,{onSuccess:function(R,N,B,z){m.resetLoader(u,o),m.updateStatsFromPart(u,C);var j={frag:u,part:C,payload:R.data,networkDetails:z};g(j),h(j)},onError:function(R,N,B){m.resetLoader(u,o),d(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:C,response:R,networkDetails:B}))},onAbort:function(R,N,B){u.stats.aborted=C.stats.aborted,m.resetLoader(u,o),d(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:C,networkDetails:B}))},onTimeout:function(R,N,B){m.resetLoader(u,o),d(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:C,networkDetails:B}))}})})},a.updateStatsFromPart=function(u,C){var g=u.stats,m=C.stats,L=m.total;if(g.loaded+=m.loaded,L){var x=Math.round(u.duration/C.duration),f=Math.min(Math.round(g.loaded/L),x),h=x-f,d=h*Math.round(g.loaded/f);g.total=g.loaded+d}else g.total=Math.max(g.loaded,g.total);var o=g.loading,T=m.loading;o.start?o.first+=T.first-T.start:(o.start=T.start,o.first=T.first),o.end=T.end},a.resetLoader=function(u,C){u.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},l}();function y(l,a){a===void 0&&(a=null);var s=a||l,u={frag:l,part:a,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},C=s.byteRangeStartOffset,g=s.byteRangeEndOffset;return Object(W.isFiniteNumber)(C)&&Object(W.isFiniteNumber)(g)&&(u.rangeStart=C,u.rangeEnd=g),u}var b=function(l){P(a,l);function a(s){for(var u,C=arguments.length,g=new Array(C>1?C-1:0),m=1;m<C;m++)g[m-1]=arguments[m];return u=l.call.apply(l,[this].concat(g))||this,u.data=void 0,u.data=s,u}return a}(I(Error))},"./src/loader/fragment.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"ElementaryStreamTypes",function(){return w}),A.d(K,"BaseSegment",function(){return y}),A.d(K,"Fragment",function(){return b}),A.d(K,"Part",function(){return l});var W=A("./src/polyfills/number.ts"),M=A("./node_modules/url-toolkit/src/url-toolkit.js"),P=A.n(M),I=A("./src/utils/logger.ts"),k=A("./src/loader/level-key.ts"),O=A("./src/loader/load-stats.ts");function _(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,c(a,s)}function c(a,s){return c=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},c(a,s)}function p(a,s){for(var u=0;u<s.length;u++){var C=s[u];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(a,C.key,C)}}function D(a,s,u){return s&&p(a.prototype,s),u&&p(a,u),a}var w;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(w||(w={}));var y=function(){function a(u){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[w.AUDIO]=null,C[w.VIDEO]=null,C[w.AUDIOVIDEO]=null,C),this.baseurl=u}var s=a.prototype;return s.setByteRange=function(C,g){var m=C.split("@",2),L=[];m.length===1?L[0]=g?g.byteRangeEndOffset:0:L[0]=parseInt(m[1]),L[1]=parseInt(m[0])+L[0],this._byteRange=L},D(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(M.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),a}(),b=function(a){_(s,a);function s(C,g){var m;return m=a.call(this,g)||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=C,m}var u=s.prototype;return u.createInitializationVector=function(g){for(var m=new Uint8Array(16),L=12;L<16;L++)m[L]=g>>8*(15-L)&255;return m},u.setDecryptDataFromLevelKey=function(g,m){var L=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(L=k.LevelKey.fromURI(g.uri),L.method=g.method,L.iv=this.createInitializationVector(m),L.keyFormat="identity"),L},u.setElementaryStreamInfo=function(g,m,L,x,f,h){h===void 0&&(h=!1);var d=this.elementaryStreams,o=d[g];if(!o){d[g]={startPTS:m,endPTS:L,startDTS:x,endDTS:f,partial:h};return}o.startPTS=Math.min(o.startPTS,m),o.endPTS=Math.max(o.endPTS,L),o.startDTS=Math.min(o.startDTS,x),o.endDTS=Math.max(o.endDTS,f)},u.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[w.AUDIO]=null,g[w.VIDEO]=null,g[w.AUDIOVIDEO]=null},D(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&I.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(W.isFiniteNumber)(this.programDateTime))return null;var g=Object(W.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),s}(y),l=function(a){_(s,a);function s(u,C,g,m,L){var x;x=a.call(this,g)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new O.LoadStats,x.duration=u.decimalFloatingPoint("DURATION"),x.gap=u.bool("GAP"),x.independent=u.bool("INDEPENDENT"),x.relurl=u.enumeratedString("URI"),x.fragment=C,x.index=m;var f=u.enumeratedString("BYTERANGE");return f&&x.setByteRange(f,L),L&&(x.fragOffset=L.fragOffset+L.duration),x}return D(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 C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),s}(y)},"./src/loader/key-loader.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return I});var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/utils/logger.ts"),I=function(){function k(_){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=_,this._registerListeners()}var O=k.prototype;return O._registerListeners=function(){this.hls.on(W.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(W.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var c in this.loaders){var p=this.loaders[c];p&&p.destroy()}this.loaders={}},O.onKeyLoading=function(c,p){var D=p.frag,w=D.type,y=this.loaders[w];if(!D.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=D.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(y&&(P.logger.warn("abort previous key loader for type:"+w),y.abort()),!b){P.logger.warn("key uri is falsy");return}var a=l.loader,s=D.loader=this.loaders[w]=new a(l);this.decrypturl=b,this.decryptkey=null;var u={url:b,frag:D,responseType:"arraybuffer"},C={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,C,g)}else this.decryptkey&&(D.decryptdata.key=this.decryptkey,this.hls.trigger(W.Events.KEY_LOADED,{frag:D}))},O.loadsuccess=function(c,p,D){var w=D.frag;if(!w.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(c.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(W.Events.KEY_LOADED,{frag:w})},O.loaderror=function(c,p){var D=p.frag,w=D.loader;w&&w.abort(),delete this.loaders[D.type],this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:D,response:c})},O.loadtimeout=function(c,p){var D=p.frag,w=D.loader;w&&w.abort(),delete this.loaders[D.type],this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:D})},k}()},"./src/loader/level-details.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"LevelDetails",function(){return k});var W=A("./src/polyfills/number.ts");function M(O,_){for(var c=0;c<_.length;c++){var p=_[c];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(O,p.key,p)}}function P(O,_,c){return _&&M(O.prototype,_),c&&M(O,c),O}var I=10,k=function(){function O(c){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=c}var _=O.prototype;return _.reloaded=function(p){if(!p){this.advanced=!0,this.updated=!0;return}var D=this.lastPartSn-p.lastPartSn,w=this.lastPartIndex-p.lastPartIndex;this.updated=this.endSN!==p.endSN||!!w||!!D,this.advanced=this.endSN>p.endSN||D>0||D===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},P(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(W.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||I}},{key:"drift",get:function(){var p=this.driftEndTime-this.driftStartTime;if(p>0){var D=this.driftEnd-this.driftStart;return D*1e3/p}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var p;return(p=this.fragments)!==null&&p!==void 0&&p.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 p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"LevelKey",function(){return k});var W=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(W);function P(O,_){for(var c=0;c<_.length;c++){var p=_[c];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(O,p.key,p)}}function I(O,_,c){return _&&P(O.prototype,_),c&&P(O,c),O}var k=function(){O.fromURL=function(c,p){return new O(c,p)},O.fromURI=function(c){return new O(c)};function O(_,c){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,c?this._uri=Object(W.buildAbsoluteURL)(_,c,{alwaysNormalize:!0}):this._uri=_}return I(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"LoadStats",function(){return W});var W=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return s});var W=A("./src/polyfills/number.ts"),M=A("./node_modules/url-toolkit/src/url-toolkit.js"),P=A.n(M),I=A("./src/loader/fragment.ts"),k=A("./src/loader/level-details.ts"),O=A("./src/loader/level-key.ts"),_=A("./src/utils/attr-list.ts"),c=A("./src/utils/logger.ts"),p=A("./src/utils/codecs.ts"),D=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,w=/#EXT-X-MEDIA:(.*)/g,y=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),b=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function a(L){var x,f;return l.test((x=(f=M.parseURL(L))===null||f===void 0?void 0:f.path)!=null?x:"")}var s=function(){function L(){}return L.findGroup=function(f,h){for(var d=0;d<f.length;d++){var o=f[d];if(o.id===h)return o}},L.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},L.resolve=function(f,h){return M.buildAbsoluteURL(h,f,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(f,h){var d=[],o={},T=!1;D.lastIndex=0;for(var E;(E=D.exec(f))!=null;)if(E[1]){var v=new _.AttrList(E[1]),R={attrs:v,bitrate:v.decimalInteger("AVERAGE-BANDWIDTH")||v.decimalInteger("BANDWIDTH"),name:v.NAME,url:L.resolve(E[2],h)},N=v.decimalResolution("RESOLUTION");N&&(R.width=N.width,R.height=N.height),u((v.CODECS||"").split(/[ ,]+/).filter(function(z){return z}),R),R.videoCodec&&R.videoCodec.indexOf("avc1")!==-1&&(R.videoCodec=L.convertAVC1ToAVCOTI(R.videoCodec)),d.push(R)}else if(E[3]){var B=new _.AttrList(E[3]);B["DATA-ID"]&&(T=!0,o[B["DATA-ID"]]=B)}return{levels:d,sessionData:T?o:null}},L.parseMasterPlaylistMedia=function(f,h,d,o){o===void 0&&(o=[]);var T,E=[],v=0;for(w.lastIndex=0;(T=w.exec(f))!==null;){var R=new _.AttrList(T[1]);if(R.TYPE===d){var N={attrs:R,bitrate:0,id:v++,groupId:R["GROUP-ID"],instreamId:R["INSTREAM-ID"],name:R.NAME||R.LANGUAGE||"",type:d,default:R.bool("DEFAULT"),autoselect:R.bool("AUTOSELECT"),forced:R.bool("FORCED"),lang:R.LANGUAGE,url:R.URI?L.resolve(R.URI,h):""};if(o.length){var B=L.findGroup(o,N.groupId)||o[0];C(N,B,"audioCodec"),C(N,B,"textCodec")}E.push(N)}}return E},L.parseLevelPlaylist=function(f,h,d,o,T){var E=new k.LevelDetails(h),v=E.fragments,R=null,N=0,B=0,z=0,j=0,F=null,X=new I.Fragment(o,h),q,ne,ue,Ee=-1,pe=!1;for(y.lastIndex=0,E.m3u8=f;(q=y.exec(f))!==null;){pe&&(pe=!1,X=new I.Fragment(o,h),X.start=z,X.sn=N,X.cc=j,X.level=d,R&&(X.initSegment=R,X.rawProgramDateTime=R.rawProgramDateTime));var fe=q[1];if(fe){X.duration=parseFloat(fe);var de=(" "+q[2]).slice(1);X.title=de||null,X.tagList.push(de?["INF",fe,de]:["INF",fe])}else if(q[3])Object(W.isFiniteNumber)(X.duration)&&(X.start=z,ue&&(X.levelkey=ue),X.sn=N,X.level=d,X.cc=j,X.urlId=T,v.push(X),X.relurl=(" "+q[3]).slice(1),m(X,F),F=X,z+=X.duration,N++,B=0,pe=!0);else if(q[4]){var ce=(" "+q[4]).slice(1);F?X.setByteRange(ce,F):X.setByteRange(ce)}else if(q[5])X.rawProgramDateTime=(" "+q[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),Ee===-1&&(Ee=v.length);else{if(q=q[0].match(b),!q){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(ne=1;ne<q.length&&!(typeof q[ne]!="undefined");ne++);var re=(" "+q[ne]).slice(1),se=(" "+q[ne+1]).slice(1),be=q[ne+2]?(" "+q[ne+2]).slice(1):"";switch(re){case"PLAYLIST-TYPE":E.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":N=E.startSN=parseInt(se);break;case"SKIP":{var Me=new _.AttrList(se),Ie=Me.decimalInteger("SKIPPED-SEGMENTS");if(Object(W.isFiniteNumber)(Ie)){E.skippedSegments=Ie;for(var Ge=Ie;Ge--;)v.unshift(null);N+=Ie}var He=Me.enumeratedString("RECENTLY-REMOVED-DATERANGES");He&&(E.recentlyRemovedDateranges=He.split(" "));break}case"TARGETDURATION":E.targetduration=parseFloat(se);break;case"VERSION":E.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":E.live=!1;break;case"#":(se||be)&&X.tagList.push(be?[se,be]:[se]);break;case"DIS":j++;case"GAP":X.tagList.push([re]);break;case"BITRATE":X.tagList.push([re,se]);break;case"DISCONTINUITY-SEQ":j=parseInt(se);break;case"KEY":{var Se,De=new _.AttrList(se),ke=De.enumeratedString("METHOD"),Ke=De.URI,Fe=De.hexadecimalInteger("IV"),_e=De.enumeratedString("KEYFORMATVERSIONS"),Le=De.enumeratedString("KEYID"),rt=(Se=De.enumeratedString("KEYFORMAT"))!=null?Se:"identity",qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(qe.indexOf(rt)>-1){c.logger.warn("Keyformat "+rt+" is not supported from the manifest");continue}else if(rt!=="identity")continue;ke&&(ue=O.LevelKey.fromURL(h,Ke),Ke&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(ke)>=0&&(ue.method=ke,ue.keyFormat=rt,Le&&(ue.keyID=Le),_e&&(ue.keyFormatVersions=_e),ue.iv=Fe));break}case"START":{var Ye=new _.AttrList(se),We=Ye.decimalFloatingPoint("TIME-OFFSET");Object(W.isFiniteNumber)(We)&&(E.startTimeOffset=We);break}case"MAP":{var et=new _.AttrList(se);X.relurl=et.URI,et.BYTERANGE&&X.setByteRange(et.BYTERANGE),X.level=d,X.sn="initSegment",ue&&(X.levelkey=ue),X.initSegment=null,R=X,pe=!0;break}case"SERVER-CONTROL":{var ze=new _.AttrList(se);E.canBlockReload=ze.bool("CAN-BLOCK-RELOAD"),E.canSkipUntil=ze.optionalFloat("CAN-SKIP-UNTIL",0),E.canSkipDateRanges=E.canSkipUntil>0&&ze.bool("CAN-SKIP-DATERANGES"),E.partHoldBack=ze.optionalFloat("PART-HOLD-BACK",0),E.holdBack=ze.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ve=new _.AttrList(se);E.partTarget=Ve.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ve=E.partList;ve||(ve=E.partList=[]);var Ze=B>0?ve[ve.length-1]:void 0,Xe=B++,ye=new I.Part(new _.AttrList(se),X,h,Xe,Ze);ve.push(ye),X.duration+=ye.duration;break}case"PRELOAD-HINT":{var Ae=new _.AttrList(se);E.preloadHint=Ae;break}case"RENDITION-REPORT":{var le=new _.AttrList(se);E.renditionReports=E.renditionReports||[],E.renditionReports.push(le);break}default:c.logger.warn("line parsed but not handled: "+q);break}}}F&&!F.relurl?(v.pop(),z-=F.duration,E.partList&&(E.fragmentHint=F)):E.partList&&(m(X,F),X.cc=j,E.fragmentHint=X);var ae=v.length,oe=v[0],Y=v[ae-1];if(z+=E.skippedSegments*E.targetduration,z>0&&ae&&Y){E.averagetargetduration=z/ae;var $=Y.sn;E.endSN=$!=="initSegment"?$:0,oe&&(E.startCC=oe.cc,oe.initSegment||E.fragments.every(function(Z){return Z.relurl&&a(Z.relurl)})&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new I.Fragment(o,h),X.relurl=Y.relurl,X.level=d,X.sn="initSegment",oe.initSegment=X,E.needSidxRanges=!0))}else E.endSN=0,E.startCC=0;return E.fragmentHint&&(z+=E.fragmentHint.duration),E.totalduration=z,E.endCC=j,Ee>0&&g(v,Ee),E},L}();function u(L,x){["video","audio","text"].forEach(function(f){var h=L.filter(function(o){return Object(p.isCodecType)(o,f)});if(h.length){var d=h.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});x[f+"Codec"]=d.length>0?d[0]:h[0],L=L.filter(function(o){return h.indexOf(o)===-1})}}),x.unknownCodecs=L}function C(L,x,f){var h=x[f];h&&(L[f]=h)}function g(L,x){for(var f=L[x],h=x;h--;){var d=L[h];if(!d)return;d.programDateTime=f.programDateTime-d.duration*1e3,f=d}}function m(L,x){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):x!=null&&x.programDateTime&&(L.programDateTime=x.endProgramDateTime),Object(W.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/errors.ts"),I=A("./src/utils/logger.ts"),k=A("./src/utils/mp4-tools.ts"),O=A("./src/loader/m3u8-parser.ts"),_=A("./src/types/loader.ts"),c=A("./src/utils/attr-list.ts");function p(y){var b=y.type;switch(b){case _.PlaylistContextType.AUDIO_TRACK:return _.PlaylistLevelType.AUDIO;case _.PlaylistContextType.SUBTITLE_TRACK:return _.PlaylistLevelType.SUBTITLE;default:return _.PlaylistLevelType.MAIN}}function D(y,b){var l=y.url;return(l===void 0||l.indexOf("data:")===0)&&(l=b.url),l}var w=function(){function y(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var b=y.prototype;return b.registerListeners=function(){var a=this.hls;a.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(M.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var a=this.hls;a.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(M.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(a){var s=this.hls.config,u=s.pLoader,C=s.loader,g=u||C,m=new g(s);return a.loader=m,this.loaders[a.type]=m,m},b.getInternalLoader=function(a){return this.loaders[a.type]},b.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},b.destroyInternalLoaders=function(){for(var a in this.loaders){var s=this.loaders[a];s&&s.destroy(),this.resetInternalLoader(a)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(a,s){var u=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:_.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},b.onLevelLoading=function(a,s){var u=s.id,C=s.level,g=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:null,level:C,responseType:"text",type:_.PlaylistContextType.LEVEL,url:g,deliveryDirectives:m})},b.onAudioTrackLoading=function(a,s){var u=s.id,C=s.groupId,g=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:_.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:m})},b.onSubtitleTrackLoading=function(a,s){var u=s.id,C=s.groupId,g=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:_.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:m})},b.load=function(a){var s,u=this.hls.config,C=this.getInternalLoader(a);if(C){var g=C.context;if(g&&g.url===a.url){I.logger.trace("[playlist-loader]: playlist request ongoing");return}I.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),C.abort()}var m,L,x,f;switch(a.type){case _.PlaylistContextType.MANIFEST:m=u.manifestLoadingMaxRetry,L=u.manifestLoadingTimeOut,x=u.manifestLoadingRetryDelay,f=u.manifestLoadingMaxRetryTimeout;break;case _.PlaylistContextType.LEVEL:case _.PlaylistContextType.AUDIO_TRACK:case _.PlaylistContextType.SUBTITLE_TRACK:m=0,L=u.levelLoadingTimeOut;break;default:m=u.levelLoadingMaxRetry,L=u.levelLoadingTimeOut,x=u.levelLoadingRetryDelay,f=u.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(a),(s=a.deliveryDirectives)!==null&&s!==void 0&&s.part){var h;if(a.type===_.PlaylistContextType.LEVEL&&a.level!==null?h=this.hls.levels[a.level].details:a.type===_.PlaylistContextType.AUDIO_TRACK&&a.id!==null?h=this.hls.audioTracks[a.id].details:a.type===_.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(h=this.hls.subtitleTracks[a.id].details),h){var d=h.partTarget,o=h.targetduration;d&&o&&(L=Math.min(Math.max(d*3,o*.8)*1e3,L))}}var T={timeout:L,maxRetry:m,retryDelay:x,maxRetryDelay:f,highWaterMark:0},E={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(a,T,E)},b.loadsuccess=function(a,s,u,C){if(C===void 0&&(C=null),u.isSidxRequest){this.handleSidxRequest(a,u),this.handlePlaylistLoaded(a,s,u,C);return}this.resetInternalLoader(u.type);var g=a.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,u,"no EXTM3U delimiter",C);return}s.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,s,u,C):this.handleMasterPlaylist(a,s,u,C)},b.loaderror=function(a,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,a)},b.loadtimeout=function(a,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},b.handleMasterPlaylist=function(a,s,u,C){var g=this.hls,m=a.data,L=D(a,u),x=O.default.parseMasterPlaylist(m,L),f=x.levels,h=x.sessionData;if(!f.length){this.handleManifestParsingError(a,u,"no level found in manifest",C);return}var d=f.map(function(N){return{id:N.attrs.AUDIO,audioCodec:N.audioCodec}}),o=f.map(function(N){return{id:N.attrs.SUBTITLES,textCodec:N.textCodec}}),T=O.default.parseMasterPlaylistMedia(m,L,"AUDIO",d),E=O.default.parseMasterPlaylistMedia(m,L,"SUBTITLES",o),v=O.default.parseMasterPlaylistMedia(m,L,"CLOSED-CAPTIONS");if(T.length){var R=T.some(function(N){return!N.url});!R&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(I.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),T.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new c.AttrList({}),bitrate:0,url:""}))}g.trigger(M.Events.MANIFEST_LOADED,{levels:f,audioTracks:T,subtitles:E,captions:v,url:L,stats:s,networkDetails:C,sessionData:h})},b.handleTrackOrLevelPlaylist=function(a,s,u,C){var g=this.hls,m=u.id,L=u.level,x=u.type,f=D(a,u),h=Object(W.isFiniteNumber)(m)?m:0,d=Object(W.isFiniteNumber)(L)?L:h,o=p(u),T=O.default.parseLevelPlaylist(a.data,f,d,o,h);if(!T.fragments.length){g.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(x===_.PlaylistContextType.MANIFEST){var E={attrs:new c.AttrList({}),bitrate:0,details:T,name:"",url:f};g.trigger(M.Events.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:f,stats:s,networkDetails:C,sessionData:null})}if(s.parsing.end=performance.now(),T.needSidxRanges){var v,R=(v=T.fragments[0].initSegment)===null||v===void 0?void 0:v.url;this.load({url:R,isSidxRequest:!0,type:x,level:L,levelDetails:T,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=T,this.handlePlaylistLoaded(a,s,u,C)},b.handleSidxRequest=function(a,s){var u=Object(k.parseSegmentIndex)(new Uint8Array(a.data));if(!u)return;var C=u.references,g=s.levelDetails;C.forEach(function(m,L){var x=m.info,f=g.fragments[L];f.byteRange.length===0&&f.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),f.initSegment&&f.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(a,s,u,C){this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===_.PlaylistContextType.MANIFEST,url:a.url,reason:u,response:a,context:s,networkDetails:C})},b.handleNetworkError=function(a,s,u,C){u===void 0&&(u=!1),I.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var g=P.ErrorDetails.UNKNOWN,m=!1,L=this.getInternalLoader(a);switch(a.type){case _.PlaylistContextType.MANIFEST:g=u?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case _.PlaylistContextType.LEVEL:g=u?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case _.PlaylistContextType.AUDIO_TRACK:g=u?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case _.PlaylistContextType.SUBTITLE_TRACK:g=u?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}L&&this.resetInternalLoader(a.type);var x={type:P.ErrorTypes.NETWORK_ERROR,details:g,fatal:m,url:a.url,loader:L,context:a,networkDetails:s};C&&(x.response=C),this.hls.trigger(M.Events.ERROR,x)},b.handlePlaylistLoaded=function(a,s,u,C){var g=u.type,m=u.level,L=u.id,x=u.groupId,f=u.loader,h=u.levelDetails,d=u.deliveryDirectives;if(!(h!=null&&h.targetduration)){this.handleManifestParsingError(a,u,"invalid target duration",C);return}if(!f)return;h.live&&(f.getCacheAge&&(h.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(h.ageHeader))&&(h.ageHeader=0));switch(g){case _.PlaylistContextType.MANIFEST:case _.PlaylistContextType.LEVEL:this.hls.trigger(M.Events.LEVEL_LOADED,{details:h,level:m||0,id:L||0,stats:s,networkDetails:C,deliveryDirectives:d});break;case _.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(M.Events.AUDIO_TRACK_LOADED,{details:h,id:L||0,groupId:x||"",stats:s,networkDetails:C,deliveryDirectives:d});break;case _.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(M.Events.SUBTITLE_TRACK_LOADED,{details:h,id:L||0,groupId:x||"",stats:s,networkDetails:C,deliveryDirectives:d});break}},y}();K.default=w},"./src/polyfills/number.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"isFiniteNumber",function(){return W}),A.d(K,"MAX_SAFE_INTEGER",function(){return M});var W=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},M=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(Q,K,A){"use strict";A.r(K);var W=function(){function M(){}return M.getSilentFrame=function(I,k){switch(I){case"mp4a.40.2":if(k===1)return new Uint8Array([0,200,0,128,35,128]);if(k===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(k===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(k===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(k===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(k===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(k===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(k===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(k===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},M}();K.default=W},"./src/remux/mp4-generator.ts":function(Q,K,A){"use strict";A.r(K);var W=Math.pow(2,32)-1,M=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var k;for(k in P.types)P.types.hasOwnProperty(k)&&(P.types[k]=[k.charCodeAt(0),k.charCodeAt(1),k.charCodeAt(2),k.charCodeAt(3)]);var O=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),_=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:O,audio:_};var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),p=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=p,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var D=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),y=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,D,y,D,w),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,c))},P.box=function(k){for(var O=8,_=arguments.length,c=new Array(_>1?_-1:0),p=1;p<_;p++)c[p-1]=arguments[p];for(var D=c.length,w=D;D--;)O+=c[D].byteLength;var y=new Uint8Array(O);for(y[0]=O>>24&255,y[1]=O>>16&255,y[2]=O>>8&255,y[3]=O&255,y.set(k,4),D=0,O=8;D<w;D++)y.set(c[D],O),O+=c[D].byteLength;return y},P.hdlr=function(k){return P.box(P.types.hdlr,P.HDLR_TYPES[k])},P.mdat=function(k){return P.box(P.types.mdat,k)},P.mdhd=function(k,O){O*=k;var _=Math.floor(O/(W+1)),c=Math.floor(O%(W+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,_>>24,_>>16&255,_>>8&255,_&255,c>>24,c>>16&255,c>>8&255,c&255,85,196,0,0]))},P.mdia=function(k){return P.box(P.types.mdia,P.mdhd(k.timescale,k.duration),P.hdlr(k.type),P.minf(k))},P.mfhd=function(k){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255]))},P.minf=function(k){return k.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(k)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(k))},P.moof=function(k,O,_){return P.box(P.types.moof,P.mfhd(k),P.traf(_,O))},P.moov=function(k){for(var O=k.length,_=[];O--;)_[O]=P.trak(k[O]);return P.box.apply(null,[P.types.moov,P.mvhd(k[0].timescale,k[0].duration)].concat(_).concat(P.mvex(k)))},P.mvex=function(k){for(var O=k.length,_=[];O--;)_[O]=P.trex(k[O]);return P.box.apply(null,[P.types.mvex].concat(_))},P.mvhd=function(k,O){O*=k;var _=Math.floor(O/(W+1)),c=Math.floor(O%(W+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,_>>24,_>>16&255,_>>8&255,_&255,c>>24,c>>16&255,c>>8&255,c&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,p)},P.sdtp=function(k){var O=k.samples||[],_=new Uint8Array(4+O.length),c,p;for(c=0;c<O.length;c++)p=O[c].flags,_[c+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return P.box(P.types.sdtp,_)},P.stbl=function(k){return P.box(P.types.stbl,P.stsd(k),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(k){var O=[],_=[],c,p,D;for(c=0;c<k.sps.length;c++)p=k.sps[c],D=p.byteLength,O.push(D>>>8&255),O.push(D&255),O=O.concat(Array.prototype.slice.call(p));for(c=0;c<k.pps.length;c++)p=k.pps[c],D=p.byteLength,_.push(D>>>8&255),_.push(D&255),_=_.concat(Array.prototype.slice.call(p));var w=P.box(P.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|k.sps.length].concat(O).concat([k.pps.length]).concat(_))),y=k.width,b=k.height,l=k.pixelRatio[0],a=k.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,y>>8&255,y&255,b>>8&255,b&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),w,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,a>>24,a>>16&255,a>>8&255,a&255])))},P.esds=function(k){var O=k.config.length;return new Uint8Array([0,0,0,0,3,23+O,0,1,0,4,15+O,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([O]).concat(k.config).concat([6,1,2]))},P.mp4a=function(k){var O=k.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),P.box(P.types.esds,P.esds(k)))},P.mp3=function(k){var O=k.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},P.stsd=function(k){return k.type==="audio"?!k.isAAC&&k.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(k)):P.box(P.types.stsd,P.STSD,P.mp4a(k)):P.box(P.types.stsd,P.STSD,P.avc1(k))},P.tkhd=function(k){var O=k.id,_=k.duration*k.timescale,c=k.width,p=k.height,D=Math.floor(_/(W+1)),w=Math.floor(_%(W+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,w>>24,w>>16&255,w>>8&255,w&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,c>>8&255,c&255,0,0,p>>8&255,p&255,0,0]))},P.traf=function(k,O){var _=P.sdtp(k),c=k.id,p=Math.floor(O/(W+1)),D=Math.floor(O%(W+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,c>>24,c>>16&255,c>>8&255,c&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,D>>24,D>>16&255,D>>8&255,D&255])),P.trun(k,_.length+16+20+8+16+8+8),_)},P.trak=function(k){return k.duration=k.duration||4294967295,P.box(P.types.trak,P.tkhd(k),P.mdia(k))},P.trex=function(k){var O=k.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(k,O){var _=k.samples||[],c=_.length,p=12+16*c,D=new Uint8Array(p),w,y,b,l,a,s;for(O+=8+p,D.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,c&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),w=0;w<c;w++)y=_[w],b=y.duration,l=y.size,a=y.flags,s=y.cts,D.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*w);return P.box(P.types.trun,D)},P.initSegment=function(k){P.types||P.init();var O=P.moov(k),_=new Uint8Array(P.FTYP.byteLength+O.byteLength);return _.set(P.FTYP),_.set(O,P.FTYP.byteLength),_},P}();M.types=void 0,M.HDLR_TYPES=void 0,M.STTS=void 0,M.STSC=void 0,M.STCO=void 0,M.STSZ=void 0,M.VMHD=void 0,M.SMHD=void 0,M.STSD=void 0,M.FTYP=void 0,M.DINF=void 0,K.default=M},"./src/remux/mp4-remuxer.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return s}),A.d(K,"normalizePts",function(){return u});var W=A("./src/polyfills/number.ts"),M=A("./src/remux/aac-helper.ts"),P=A("./src/remux/mp4-generator.ts"),I=A("./src/events.ts"),k=A("./src/errors.ts"),O=A("./src/utils/logger.ts"),_=A("./src/types/loader.ts"),c=A("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(L){for(var x=1;x<arguments.length;x++){var f=arguments[x];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(L[h]=f[h])}return L},p.apply(this,arguments)}var D=10*1e3,w=1024,y=1152,b=null,l=null,a=!1,s=function(){function L(f,h,d,o){if(o===void 0&&(o=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=f,this.config=h,this.typeSupported=d,this.ISGenerated=!1,b===null){var T=navigator.userAgent||"",E=T.match(/Chrome\/(\d+)/i);b=E?parseInt(E[1]):0}if(l===null){var v=navigator.userAgent.match(/Safari\/(\d+)/i);l=v?parseInt(v[1]):0}a=!!b&&b<75||!!l&&l<600}var x=L.prototype;return x.destroy=function(){},x.resetTimeStamp=function(h){O.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=h},x.resetNextTimestamp=function(){O.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){O.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(h){var d=!1,o=h.reduce(function(T,E){var v=E.pts-T;return v<-4294967296?(d=!0,u(T,E.pts)):v>0?T:E.pts},h[0].pts);return d&&O.logger.debug("PTS rollover detected"),o},x.remux=function(h,d,o,T,E,v,R,N){var B,z,j,F,X,q,ne=E,ue=E,Ee=h.pid>-1,pe=d.pid>-1,fe=d.samples.length,de=h.samples.length>0,ce=fe>1,re=(!Ee||de)&&(!pe||ce)||this.ISGenerated||R;if(re){this.ISGenerated||(j=this.generateIS(h,d,E));var se=this.isVideoContiguous,be=-1;if(ce&&(be=C(d.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(q=!0,be>0){O.logger.warn("[mp4-remuxer]: Dropped "+be+" out of "+fe+" video samples due to a missing keyframe");var Me=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(be),d.dropped+=be,ue+=(d.samples[0].pts-Me)/(d.timescale||9e4)}else be===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+fe+" video samples"),q=!1);if(this.ISGenerated){if(de&&ce){var Ie=this.getVideoStartPts(d.samples),Ge=u(h.samples[0].pts,Ie)-Ie,He=Ge/d.inputTimeScale;ne+=Math.max(0,He),ue+=Math.max(0,-He)}if(de){if(h.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),j=this.generateIS(h,d,E)),z=this.remuxAudio(h,ne,this.isAudioContiguous,v,pe||ce||N===_.PlaylistLevelType.AUDIO?ue:void 0),ce){var Se=z?z.endPTS-z.startPTS:0;d.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),j=this.generateIS(h,d,E)),B=this.remuxVideo(d,ue,se,Se)}}else ce&&(B=this.remuxVideo(d,ue,se,0));B&&(B.firstKeyFrame=be,B.independent=be!==-1)}}return this.ISGenerated&&(o.samples.length&&(X=this.remuxID3(o,E)),T.samples.length&&(F=this.remuxText(T,E))),{audio:z,video:B,initSegment:j,independent:q,text:F,id3:X}},x.generateIS=function(h,d,o){var T=h.samples,E=d.samples,v=this.typeSupported,R={},N=!Object(W.isFiniteNumber)(this._initPTS),B="audio/mp4",z,j,F;if(N&&(z=j=Infinity),h.config&&T.length&&(h.timescale=h.samplerate,h.isAAC||(v.mpeg?(B="audio/mpeg",h.codec=""):v.mp3&&(h.codec="mp3")),R.audio={id:"audio",container:B,codec:h.codec,initSegment:!h.isAAC&&v.mpeg?new Uint8Array(0):P.default.initSegment([h]),metadata:{channelCount:h.channelCount}},N&&(F=h.inputTimeScale,z=j=T[0].pts-Math.round(F*o))),d.sps&&d.pps&&E.length&&(d.timescale=d.inputTimeScale,R.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:P.default.initSegment([d]),metadata:{width:d.width,height:d.height}},N)){F=d.inputTimeScale;var X=this.getVideoStartPts(E),q=Math.round(F*o);j=Math.min(j,u(E[0].dts,X)-q),z=Math.min(z,X-q)}if(Object.keys(R).length)return this.ISGenerated=!0,N&&(this._initPTS=z,this._initDTS=j),{tracks:R,initPTS:z,timescale:F}},x.remuxVideo=function(h,d,o,T){var E=h.inputTimeScale,v=h.samples,R=[],N=v.length,B=this._initPTS,z=this.nextAvcDts,j=8,F,X,q,ne=Number.POSITIVE_INFINITY,ue=Number.NEGATIVE_INFINITY,Ee=0,pe=!1;if(!o||z===null){var fe=d*E,de=v[0].pts-u(v[0].dts,v[0].pts);z=fe-de}for(var ce=0;ce<N;ce++){var re=v[ce];if(re.pts=u(re.pts-B,z),re.dts=u(re.dts-B,z),re.dts>re.pts){var se=9e4*.2;Ee=Math.max(Math.min(Ee,re.pts-re.dts),-1*se)}re.dts<v[ce>0?ce-1:ce].dts&&(pe=!0)}pe&&v.sort(function(yt,it){var Qe=yt.dts-it.dts,xt=yt.pts-it.pts;return Qe||xt}),X=v[0].dts,q=v[v.length-1].dts;var be=Math.round((q-X)/(N-1));if(Ee<0){if(Ee<be*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(c.toMsFromMpegTsClock)(-be,!0)+" ms");for(var Me=Ee,Ie=0;Ie<N;Ie++)v[Ie].dts=Me=Math.max(Me,v[Ie].pts-be),v[Ie].pts=Math.max(Me,v[Ie].pts)}else{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(c.toMsFromMpegTsClock)(Ee,!0)+" ms to overcome this issue");for(var Ge=0;Ge<N;Ge++)v[Ge].dts=v[Ge].dts+Ee}X=v[0].dts}if(o){var He=X-z,Se=He>be,De=He<-1;if(Se||De){Se?O.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(He,!0)+" ms ("+He+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(-He,!0)+" ms ("+He+"dts) overlapping between fragments detected"),X=z;var ke=v[0].pts-He;v[0].dts=X,v[0].pts=ke,O.logger.log("Video: First PTS/DTS adjusted: "+Object(c.toMsFromMpegTsClock)(ke,!0)+"/"+Object(c.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(c.toMsFromMpegTsClock)(He,!0)+" ms")}}a&&(X=Math.max(0,X));for(var Ke=0,Fe=0,_e=0;_e<N;_e++){for(var Le=v[_e],rt=Le.units,qe=rt.length,Ye=0,We=0;We<qe;We++)Ye+=rt[We].data.length;Fe+=Ye,Ke+=qe,Le.length=Ye,Le.dts=Math.max(Le.dts,X),Le.pts=Math.max(Le.pts,Le.dts,0),ne=Math.min(Le.pts,ne),ue=Math.max(Le.pts,ue)}q=v[N-1].dts;var et=Fe+4*Ke+8,ze;try{ze=new Uint8Array(et)}catch(yt){this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:et,reason:"fail allocating video mdat "+et});return}var Ve=new DataView(ze.buffer);Ve.setUint32(0,et),ze.set(P.default.types.mdat,4);for(var ve=0;ve<N;ve++){for(var Ze=v[ve],Xe=Ze.units,ye=0,Ae=0,le=Xe.length;Ae<le;Ae++){var ae=Xe[Ae],oe=ae.data,Y=ae.data.byteLength;Ve.setUint32(j,Y),j+=4,ze.set(oe,j),j+=Y,ye+=4+Y}if(ve<N-1)F=v[ve+1].dts-Ze.dts;else{var $=this.config,Z=Ze.dts-v[ve>0?ve-1:ve].dts;if($.stretchShortVideoTrack&&this.nextAudioPts!==null){var te=Math.floor($.maxBufferHole*E),ge=(T?ne+T*E:this.nextAudioPts)-Ze.pts;ge>te?(F=ge-Z,F<0&&(F=Z),O.logger.log("[mp4-remuxer]: It is approximately "+ge/90+" ms to the next segment; using duration "+F/90+" ms for the last video frame.")):F=Z}else F=Z}var xe=Math.round(Ze.pts-Ze.dts);R.push(new g(Ze.key,F,ye,xe))}if(R.length&&b&&b<70){var Pe=R[0].flags;Pe.dependsOn=2,Pe.isNonSync=0}console.assert(F!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=z=q+F,this.isVideoContiguous=!0;var st=P.default.moof(h.sequenceNumber++,X,p({},h,{samples:R})),vt="video",we={data1:st,data2:ze,startPTS:ne/E,endPTS:(ue+F)/E,startDTS:X/E,endDTS:z/E,type:vt,hasAudio:!1,hasVideo:!0,nb:R.length,dropped:h.dropped};return h.samples=[],h.dropped=0,console.assert(ze.length,"MDAT length must not be zero"),we},x.remuxAudio=function(h,d,o,T,E){var v=h.inputTimeScale,R=h.samplerate?h.samplerate:v,N=v/R,B=h.isAAC?w:y,z=B*N,j=this._initPTS,F=!h.isAAC&&this.typeSupported.mpeg,X=[],q=h.samples,ne=F?0:8,ue=this.nextAudioPts||-1,Ee=d*v;if(this.isAudioContiguous=o=o||q.length&&ue>0&&(T&&Math.abs(Ee-ue)<9e3||Math.abs(u(q[0].pts-j,Ee)-ue)<20*z),q.forEach(function(oe){oe.pts=u(oe.pts-j,Ee)}),!o||ue<0){if(q=q.filter(function(oe){return oe.pts>=0}),!q.length)return;E===0?ue=0:T?ue=Math.max(0,Ee):ue=q[0].pts}if(h.isAAC)for(var pe=E!==void 0,fe=this.config.maxAudioFramesDrift,de=0,ce=ue;de<q.length;de++){var re=q[de],se=re.pts,be=se-ce,Me=Math.abs(1e3*be/v);if(be<=-fe*z&&pe)de===0&&(O.logger.warn("Audio frame @ "+(se/v).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*be/v)+" ms."),this.nextAudioPts=ue=ce=se);else if(be>=fe*z&&Me<D&&pe){var Ie=Math.round(be/z);ce=se-Ie*z,ce<0&&(Ie--,ce+=z),de===0&&(this.nextAudioPts=ue=ce),O.logger.warn("[mp4-remuxer]: Injecting "+Ie+" audio frame @ "+(ce/v).toFixed(3)+"s due to "+Math.round(1e3*be/v)+" ms gap.");for(var Ge=0;Ge<Ie;Ge++){var He=Math.max(ce,0),Se=M.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);Se||(O.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Se=re.unit.subarray()),q.splice(de,0,{unit:Se,pts:He}),ce+=z,de++}}re.pts=ce,ce+=z}for(var De=null,ke=null,Ke,Fe=0,_e=q.length;_e--;)Fe+=q[_e].unit.byteLength;for(var Le=0,rt=q.length;Le<rt;Le++){var qe=q[Le],Ye=qe.unit,We=qe.pts;if(ke!==null){var et=X[Le-1];et.duration=Math.round((We-ke)/N)}else if(o&&h.isAAC&&(We=ue),De=We,Fe>0){Fe+=ne;try{Ke=new Uint8Array(Fe)}catch(oe){this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!F){var ze=new DataView(Ke.buffer);ze.setUint32(0,Fe),Ke.set(P.default.types.mdat,4)}}else return;Ke.set(Ye,ne);var Ve=Ye.byteLength;ne+=Ve,X.push(new g(!0,B,Ve,0)),ke=We}var ve=X.length;if(!ve)return;var Ze=X[X.length-1];this.nextAudioPts=ue=ke+N*Ze.duration;var Xe=F?new Uint8Array(0):P.default.moof(h.sequenceNumber++,De/N,p({},h,{samples:X}));h.samples=[];var ye=De/v,Ae=ue/v,le="audio",ae={data1:Xe,data2:Ke,startPTS:ye,endPTS:Ae,startDTS:ye,endDTS:Ae,type:le,hasAudio:!0,hasVideo:!1,nb:ve};return this.isAudioContiguous=!0,console.assert(Ke.length,"MDAT length must not be zero"),ae},x.remuxEmptyAudio=function(h,d,o,T){var E=h.inputTimeScale,v=h.samplerate?h.samplerate:E,R=E/v,N=this.nextAudioPts,B=(N!==null?N:T.startDTS*E)+this._initDTS,z=T.endDTS*E+this._initDTS,j=R*w,F=Math.ceil((z-B)/j),X=M.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var q=[],ne=0;ne<F;ne++){var ue=B+ne*j;q.push({unit:X,pts:ue,dts:ue})}return h.samples=q,this.remuxAudio(h,d,o,!1)},x.remuxID3=function(h,d){var o=h.samples.length;if(!o)return;for(var T=h.inputTimeScale,E=this._initPTS,v=this._initDTS,R=0;R<o;R++){var N=h.samples[R];N.pts=u(N.pts-E,d*T)/T,N.dts=u(N.dts-v,d*T)/T}var B=h.samples;return h.samples=[],{samples:B}},x.remuxText=function(h,d){var o=h.samples.length;if(!o)return;for(var T=h.inputTimeScale,E=this._initPTS,v=0;v<o;v++){var R=h.samples[v];R.pts=u(R.pts-E,d*T)/T}h.samples.sort(function(B,z){return B.pts-z.pts});var N=h.samples;return h.samples=[],{samples:N}},L}();function u(L,x){var f;if(x===null)return L;for(x<L?f=-8589934592:f=8589934592;Math.abs(L-x)>4294967296;)L+=f;return L}function C(L){for(var x=0;x<L.length;x++)if(L[x].key)return x;return-1}var g=function(x,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(x)},m=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/utils/mp4-tools.ts"),P=A("./src/loader/fragment.ts"),I=A("./src/utils/logger.ts"),k=function(){function c(){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 p=c.prototype;return p.destroy=function(){},p.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},p.resetNextTimestamp=function(){this.lastEndDTS=null},p.resetInitSegment=function(w,y,b){this.audioCodec=y,this.videoCodec=b,this.generateInitSegment(w),this.emitInitSegment=!0},p.generateInitSegment=function(w){var y=this.audioCodec,b=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(M.parseInitSegment)(w);y||(y=_(l.audio,P.ElementaryStreamTypes.AUDIO)),b||(b=_(l.video,P.ElementaryStreamTypes.VIDEO));var a={};l.audio&&l.video?a.audiovideo={container:"video/mp4",codec:y+","+b,initSegment:w,id:"main"}:l.audio?a.audio={container:"audio/mp4",codec:y,initSegment:w,id:"audio"}:l.video?a.video={container:"video/mp4",codec:b,initSegment:w,id:"main"}:I.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},p.remux=function(w,y,b,l,a){var s=this.initPTS,u=this.lastEndDTS,C={audio:void 0,video:void 0,text:l,id3:b,initSegment:void 0};Object(W.isFiniteNumber)(u)||(u=this.lastEndDTS=a||0);var g=y.samples;if(!g||!g.length)return C;var m={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(g),L=this.initData),!L||!L.length)return I.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(W.isFiniteNumber)(s)||(this.initPTS=m.initPTS=s=O(L,g,u));var x=Object(M.getDuration)(g,L),f=u,h=x+f;Object(M.offsetStartDTS)(L,g,s),x>0?this.lastEndDTS=h:(I.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!L.audio,o=!!L.video,T="";d&&(T+="audio"),o&&(T+="video");var E={data1:g,startPTS:f,startDTS:f,endPTS:h,endDTS:h,type:T,hasAudio:d,hasVideo:o,nb:1,dropped:0};return C.audio=E.type==="audio"?E:void 0,C.video=E.type!=="audio"?E:void 0,C.text=l,C.id3=b,C.initSegment=m,C},c}(),O=function(p,D,w){return Object(M.getStartDTS)(p,D)-w};function _(c,p){var D=c==null?void 0:c.codec;return D&&D.length>4?D:D==="hvc1"?"hvc1.1.c.L120.90":D==="av01"?"av01.0.04M.08":D==="avc1"||p===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}K.default=k},"./src/task-loop.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function M(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=M.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(k){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,k),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},M}()},"./src/types/cmcd.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"CMCDVersion",function(){return W}),A.d(K,"CMCDObjectType",function(){return M}),A.d(K,"CMCDStreamingFormat",function(){return P}),A.d(K,"CMCDStreamType",function(){return I});var W=1,M;(function(k){k.MANIFEST="m",k.AUDIO="a",k.VIDEO="v",k.MUXED="av",k.INIT="i",k.CAPTION="c",k.TIMED_TEXT="tt",k.KEY="k",k.OTHER="o"})(M||(M={}));var P;(function(k){k.DASH="d",k.HLS="h",k.SMOOTH="s",k.OTHER="o"})(P||(P={}));var I;(function(k){k.VOD="v",k.LIVE="l"})(I||(I={}))},"./src/types/level.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"HlsSkip",function(){return P}),A.d(K,"getSkipValue",function(){return I}),A.d(K,"HlsUrlParameters",function(){return k}),A.d(K,"Level",function(){return O});function W(_,c){for(var p=0;p<c.length;p++){var D=c[p];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(_,D.key,D)}}function M(_,c,p){return c&&W(_.prototype,c),p&&W(_,p),_}var P;(function(_){_.No="",_.Yes="YES",_.v2="v2"})(P||(P={}));function I(_,c){var p=_.canSkipUntil,D=_.canSkipDateRanges,w=_.endSN,y=c!==void 0?c-w:0;return p&&y<p?D?P.v2:P.Yes:P.No}var k=function(){function _(p,D,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=p,this.part=D,this.skip=w}var c=_.prototype;return c.addDirectives=function(D){var w=new self.URL(D);return this.msn!==void 0&&w.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&w.searchParams.set("_HLS_part",this.part.toString()),this.skip&&w.searchParams.set("_HLS_skip",this.skip),w.toString()},_}(),O=function(){function _(c){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=[c.url],this.attrs=c.attrs,this.bitrate=c.bitrate,c.details&&(this.details=c.details),this.id=c.id||0,this.name=c.name,this.width=c.width||0,this.height=c.height||0,this.audioCodec=c.audioCodec,this.videoCodec=c.videoCodec,this.unknownCodecs=c.unknownCodecs,this.codecSet=[c.videoCodec,c.audioCodec].filter(function(p){return p}).join(",").replace(/\.[^.,]+/g,"")}return M(_,[{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(p){var D=p%this.url.length;this._urlId!==D&&(this.details=void 0,this._urlId=D)}}]),_}()},"./src/types/loader.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"PlaylistContextType",function(){return W}),A.d(K,"PlaylistLevelType",function(){return M});var W;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(W||(W={}));var M;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(M||(M={}))},"./src/types/transmuxer.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"ChunkMetadata",function(){return W});var W=function(I,k,O,_,c,p){_===void 0&&(_=0),c===void 0&&(c=-1),p===void 0&&(p=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=M(),this.buffering={audio:M(),video:M(),audiovideo:M()},this.level=I,this.sn=k,this.id=O,this.size=_,this.part=c,this.partial=p};function M(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"AttrList",function(){return P});var W=/^(\d+)x(\d+)$/,M=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function I(O){typeof O=="string"&&(O=I.parseAttrList(O));for(var _ in O)O.hasOwnProperty(_)&&(this[_]=O[_])}var k=I.prototype;return k.decimalInteger=function(_){var c=parseInt(this[_],10);return c>Number.MAX_SAFE_INTEGER?Infinity:c},k.hexadecimalInteger=function(_){if(this[_]){var c=(this[_]||"0x").slice(2);c=(c.length&1?"0":"")+c;for(var p=new Uint8Array(c.length/2),D=0;D<c.length/2;D++)p[D]=parseInt(c.slice(D*2,D*2+2),16);return p}else return null},k.hexadecimalIntegerAsNumber=function(_){var c=parseInt(this[_],16);return c>Number.MAX_SAFE_INTEGER?Infinity:c},k.decimalFloatingPoint=function(_){return parseFloat(this[_])},k.optionalFloat=function(_,c){var p=this[_];return p?parseFloat(p):c},k.enumeratedString=function(_){return this[_]},k.bool=function(_){return this[_]==="YES"},k.decimalResolution=function(_){var c=W.exec(this[_]);return c===null?void 0:{width:parseInt(c[1],10),height:parseInt(c[2],10)}},I.parseAttrList=function(_){var c,p={},D='"';for(M.lastIndex=0;(c=M.exec(_))!==null;){var w=c[2];w.indexOf(D)===0&&w.lastIndexOf(D)===w.length-1&&(w=w.slice(1,-1)),p[c[1]]=w}return p},I}()},"./src/utils/binary-search.ts":function(Q,K,A){"use strict";A.r(K);var W={search:function(P,I){for(var k=0,O=P.length-1,_=null,c=null;k<=O;){_=(k+O)/2|0,c=P[_];var p=I(c);if(p>0)k=_+1;else if(p<0)O=_-1;else return c}return null}};K.default=W},"./src/utils/buffer-helper.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"BufferHelper",function(){return P});var W=A("./src/utils/logger.ts"),M={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function I(){}return I.isBuffered=function(O,_){try{if(O){for(var c=I.getBuffered(O),p=0;p<c.length;p++)if(_>=c.start(p)&&_<=c.end(p))return!0}}catch(D){}return!1},I.bufferInfo=function(O,_,c){try{if(O){var p=I.getBuffered(O),D=[],w;for(w=0;w<p.length;w++)D.push({start:p.start(w),end:p.end(w)});return this.bufferedInfo(D,_,c)}}catch(y){}return{len:0,start:_,end:_,nextStart:void 0}},I.bufferedInfo=function(O,_,c){_=Math.max(0,_),O.sort(function(m,L){var x=m.start-L.start;return x||L.end-m.end});var p=[];if(c)for(var D=0;D<O.length;D++){var w=p.length;if(w){var y=p[w-1].end;O[D].start-y<c?O[D].end>y&&(p[w-1].end=O[D].end):p.push(O[D])}else p.push(O[D])}else p=O;for(var b=0,l,a=_,s=_,u=0;u<p.length;u++){var C=p[u].start,g=p[u].end;if(_+c>=C&&_<g)a=C,s=g,b=s-_;else if(_+c<C){l=C;break}}return{len:b,start:a||0,end:s||0,nextStart:l}},I.getBuffered=function(O){try{return O.buffered}catch(_){return W.logger.log("failed to get media.buffered",_),M}},I}()},"./src/utils/cea-608-parser.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"Row",function(){return s}),A.d(K,"CaptionScreen",function(){return u});var W=A("./src/utils/logger.ts"),M={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},P=function(h){var d=h;return M.hasOwnProperty(h)&&(d=M[h]),String.fromCharCode(d)},I=15,k=100,O={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_={17:2,18:4,21:6,22:8,23:10,19:13,20:15},c={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},D=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(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"})(w||(w={}));var y=function(){function f(){this.time=null,this.verboseLevel=w.ERROR}var h=f.prototype;return h.log=function(o,T){this.verboseLevel>=o&&W.logger.log(this.time+" ["+o+"] "+T)},f}(),b=function(h){for(var d=[],o=0;o<h.length;o++)d.push(h[o].toString(16));return d},l=function(){function f(d,o,T,E,v){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=o||!1,this.italics=T||!1,this.background=E||"black",this.flash=v||!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(o){for(var T=["foreground","underline","italics","background","flash"],E=0;E<T.length;E++){var v=T[E];o.hasOwnProperty(v)&&(this[v]=o[v])}},h.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},h.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},h.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},h.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),a=function(){function f(d,o,T,E,v,R){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new l(o,T,E,v,R)}var h=f.prototype;return h.reset=function(){this.uchar=" ",this.penState.reset()},h.setChar=function(o,T){this.uchar=o,this.penState.copy(T)},h.setPenState=function(o){this.penState.copy(o)},h.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},h.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.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 o=0;o<k;o++)this.chars.push(new a);this.logger=d,this.pos=0,this.currPenState=new l}var h=f.prototype;return h.equals=function(o){for(var T=!0,E=0;E<k;E++)if(!this.chars[E].equals(o.chars[E])){T=!1;break}return T},h.copy=function(o){for(var T=0;T<k;T++)this.chars[T].copy(o.chars[T])},h.isEmpty=function(){for(var o=!0,T=0;T<k;T++)if(!this.chars[T].isEmpty()){o=!1;break}return o},h.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},h.moveCursor=function(o){var T=this.pos+o;if(o>1)for(var E=this.pos+1;E<T+1;E++)this.chars[E].setPenState(this.currPenState);this.setCursor(T)},h.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},h.insertChar=function(o){o>=144&&this.backSpace();var T=P(o);if(this.pos>=k){this.logger.log(w.ERROR,"Cannot insert "+o.toString(16)+" ("+T+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(T,this.currPenState),this.moveCursor(1)},h.clearFromPos=function(o){var T;for(T=o;T<k;T++)this.chars[T].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 o=[],T=!0,E=0;E<k;E++){var v=this.chars[E].uchar;v!==" "&&(T=!1),o.push(v)}return T?"":o.join("")},h.setPenStyles=function(o){this.currPenState.setStyles(o);var T=this.chars[this.pos];T.setPenState(this.currPenState)},f}(),u=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 o=0;o<I;o++)this.rows.push(new s(d));this.logger=d,this.currRow=I-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var h=f.prototype;return h.reset=function(){for(var o=0;o<I;o++)this.rows[o].clear();this.currRow=I-1},h.equals=function(o){for(var T=!0,E=0;E<I;E++)if(!this.rows[E].equals(o.rows[E])){T=!1;break}return T},h.copy=function(o){for(var T=0;T<I;T++)this.rows[T].copy(o.rows[T])},h.isEmpty=function(){for(var o=!0,T=0;T<I;T++)if(!this.rows[T].isEmpty()){o=!1;break}return o},h.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},h.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},h.insertChar=function(o){var T=this.rows[this.currRow];T.insertChar(o)},h.setPen=function(o){var T=this.rows[this.currRow];T.setPenStyles(o)},h.moveCursor=function(o){var T=this.rows[this.currRow];T.moveCursor(o)},h.setCursor=function(o){this.logger.log(w.INFO,"setCursor: "+o);var T=this.rows[this.currRow];T.setCursor(o)},h.setPAC=function(o){this.logger.log(w.INFO,"pacData = "+JSON.stringify(o));var T=o.row-1;if(this.nrRollUpRows&&T<this.nrRollUpRows-1&&(T=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==T){for(var E=0;E<I;E++)this.rows[E].clear();var v=this.currRow+1-this.nrRollUpRows,R=this.lastOutputScreen;if(R){var N=R.rows[v].cueStartTime,B=this.logger.time;if(N&&B!==null&&N<B)for(var z=0;z<this.nrRollUpRows;z++)this.rows[T-this.nrRollUpRows+z+1].copy(R.rows[v+z])}}this.currRow=T;var j=this.rows[this.currRow];if(o.indent!==null){var F=o.indent,X=Math.max(F-1,0);j.setCursor(o.indent),o.color=j.chars[X].penState.foreground}var q={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(q)},h.setBkgData=function(o){this.logger.log(w.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},h.setRollUpRows=function(o){this.nrRollUpRows=o},h.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(w.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(w.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,T=this.rows.splice(o,1)[0];T.clear(),this.rows.splice(this.currRow,0,T),this.logger.log(w.INFO,"Rolling up")},h.getDisplayText=function(o){o=o||!1;for(var T=[],E="",v=-1,R=0;R<I;R++){var N=this.rows[R].getTextString();N&&(v=R+1,o?T.push("Row "+v+": '"+N+"'"):T.push(N.trim()))}return T.length>0&&(o?E="["+T.join(" | ")+"]":E=T.join(`
|
|
`)),E},h.getTextAndFormat=function(){return this.rows},f}(),C=function(){function f(d,o,T){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=o,this.mode=null,this.verbose=0,this.displayedMemory=new u(T),this.nonDisplayedMemory=new u(T),this.lastOutputScreen=new u(T),this.currRollUpRow=this.displayedMemory.rows[I-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=T}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[I-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},h.getHandler=function(){return this.outputFilter},h.setHandler=function(o){this.outputFilter=o},h.setPAC=function(o){this.writeScreen.setPAC(o)},h.setBkgData=function(o){this.writeScreen.setBkgData(o)},h.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(w.INFO,"MODE="+o),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=o},h.insertChars=function(o){for(var T=0;T<o.length;T++)this.writeScreen.insertChar(o[T]);var E=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,E+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(w.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},h.ccRCL=function(){this.logger.log(w.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},h.ccBS=function(){if(this.logger.log(w.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(w.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},h.ccRU=function(o){this.logger.log(w.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},h.ccFON=function(){this.logger.log(w.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},h.ccRDC=function(){this.logger.log(w.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},h.ccTR=function(){this.logger.log(w.INFO,"TR"),this.setMode("MODE_TEXT")},h.ccRTD=function(){this.logger.log(w.INFO,"RTD"),this.setMode("MODE_TEXT")},h.ccEDM=function(){this.logger.log(w.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},h.ccCR=function(){this.logger.log(w.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},h.ccENM=function(){this.logger.log(w.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},h.ccEOC=function(){if(this.logger.log(w.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},h.ccTO=function(o){this.logger.log(w.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},h.ccMIDROW=function(o){var T={flash:!1};if(T.underline=o%2===1,T.italics=o>=46,T.italics)T.foreground="white";else{var E=Math.floor(o/2)-16,v=["white","green","blue","cyan","red","yellow","magenta"];T.foreground=v[E]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(T)),this.writeScreen.setPen(T)},h.outputDataUpdate=function(o){o===void 0&&(o=!1);var T=this.logger.time;if(T===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=T:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,T,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:T),this.lastOutputScreen.copy(this.displayedMemory))},h.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},f}(),g=function(){function f(d,o,T){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var E=new y;this.channels=[null,new C(d,o,E),new C(d+1,T,E)],this.cmdHistory=x(),this.logger=E}var h=f.prototype;return h.getHandler=function(o){return this.channels[o].getHandler()},h.setHandler=function(o,T){this.channels[o].setHandler(T)},h.addData=function(o,T){var E,v,R,N=!1;this.logger.time=o;for(var B=0;B<T.length;B+=2){if(v=T[B]&127,R=T[B+1]&127,v===0&&R===0)continue;if(this.logger.log(w.DATA,"["+b([T[B],T[B+1]])+"] -> ("+b([v,R])+")"),E=this.parseCmd(v,R),E||(E=this.parseMidrow(v,R)),E||(E=this.parsePAC(v,R)),E||(E=this.parseBackgroundAttributes(v,R)),!E&&(N=this.parseChars(v,R),N)){var z=this.currentChannel;if(z&&z>0){var j=this.channels[z];j.insertChars(N)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!E&&!N&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+b([v,R])+" orig: "+b([T[B],T[B+1]]))}},h.parseCmd=function(o,T){var E=this.cmdHistory,v=(o===20||o===28||o===21||o===29)&&T>=32&&T<=47,R=(o===23||o===31)&&T>=33&&T<=35;if(!(v||R))return!1;if(L(o,T,E))return m(null,null,E),this.logger.log(w.DEBUG,"Repeated command ("+b([o,T])+") is dropped"),!0;var N=o===20||o===21||o===23?1:2,B=this.channels[N];return o===20||o===21||o===28||o===29?T===32?B.ccRCL():T===33?B.ccBS():T===34?B.ccAOF():T===35?B.ccAON():T===36?B.ccDER():T===37?B.ccRU(2):T===38?B.ccRU(3):T===39?B.ccRU(4):T===40?B.ccFON():T===41?B.ccRDC():T===42?B.ccTR():T===43?B.ccRTD():T===44?B.ccEDM():T===45?B.ccCR():T===46?B.ccENM():T===47&&B.ccEOC():B.ccTO(T-32),m(o,T,E),this.currentChannel=N,!0},h.parseMidrow=function(o,T){var E=0;if((o===17||o===25)&&T>=32&&T<=47){if(o===17?E=1:E=2,E!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var v=this.channels[E];return v?(v.ccMIDROW(T),this.logger.log(w.DEBUG,"MIDROW ("+b([o,T])+")"),!0):!1}return!1},h.parsePAC=function(o,T){var E,v=this.cmdHistory,R=(o>=17&&o<=23||o>=25&&o<=31)&&T>=64&&T<=127,N=(o===16||o===24)&&T>=64&&T<=95;if(!(R||N))return!1;if(L(o,T,v))return m(null,null,v),!0;var B=o<=23?1:2;T>=64&&T<=95?E=B===1?O[o]:c[o]:E=B===1?_[o]:p[o];var z=this.channels[B];return z?(z.setPAC(this.interpretPAC(E,T)),m(o,T,v),this.currentChannel=B,!0):!1},h.interpretPAC=function(o,T){var E,v={color:null,italics:!1,indent:null,underline:!1,row:o};return T>95?E=T-96:E=T-64,v.underline=(E&1)===1,E<=13?v.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(E/2)]:E<=15?(v.italics=!0,v.color="white"):v.indent=Math.floor((E-16)/2)*4,v},h.parseChars=function(o,T){var E,v=null,R=null;if(o>=25?(E=2,R=o-8):(E=1,R=o),R>=17&&R<=19){var N;R===17?N=T+80:R===18?N=T+112:N=T+144,this.logger.log(w.INFO,"Special char '"+P(N)+"' in channel "+E),v=[N]}else o>=32&&o<=127&&(v=T===0?[o]:[o,T]);if(v){var B=b(v);this.logger.log(w.DEBUG,"Char codes = "+B.join(",")),m(o,T,this.cmdHistory)}return v},h.parseBackgroundAttributes=function(o,T){var E=(o===16||o===24)&&T>=32&&T<=47,v=(o===23||o===31)&&T>=45&&T<=47;if(!(E||v))return!1;var R,N={};o===16||o===24?(R=Math.floor((T-32)/2),N.background=D[R],T%2===1&&(N.background=N.background+"_semi")):T===45?N.background="transparent":(N.foreground="black",T===47&&(N.underline=!0));var B=o<=23?1:2,z=this.channels[B];return z.setBkgData(N),m(o,T,this.cmdHistory),!0},h.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var T=this.channels[o];T&&T.reset()}this.cmdHistory=x()},h.cueSplitAtTime=function(o){for(var T=0;T<this.channels.length;T++){var E=this.channels[T];E&&E.cueSplitAtTime(o)}},f}();function m(f,h,d){d.a=f,d.b=h}function L(f,h,d){return d.a===f&&d.b===h}function x(){return{a:null,b:null}}K.default=g},"./src/utils/codecs.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"isCodecType",function(){return M}),A.d(K,"isCodecSupportedInMp4",function(){return P});var W={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function M(I,k){var O=W[k];return!!O&&O[I.slice(0,4)]===!0}function P(I,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+I+'"')}},"./src/utils/cues.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/utils/vttparser.ts"),M=A("./src/utils/webvtt-parser.ts"),P=A("./src/utils/texttrack-utils.ts"),I=/\s/,k={newCue:function(_,c,p,D){for(var w=[],y,b,l,a,s,u=self.VTTCue||self.TextTrackCue,C=0;C<D.rows.length;C++)if(y=D.rows[C],l=!0,a=0,s="",!y.isEmpty()){for(var g=0;g<y.chars.length;g++)I.test(y.chars[g].uchar)&&l?a++:(s+=y.chars[g].uchar,l=!1);y.cueStartTime=c,c===p&&(p+=1e-4),a>=16?a--:a++;var m=Object(W.fixLineBreaks)(s.trim()),L=Object(M.generateCueId)(c,p,m);(!_||!_.cues||!_.cues.getCueById(L))&&(b=new u(c,p,m),b.id=L,b.line=C+1,b.align="left",b.position=10+Math.min(80,Math.floor(a*8/32)*10),w.push(b))}return _&&w.length&&(w.sort(function(x,f){return x.line==="auto"||f.line==="auto"?0:x.line>8&&f.line>8?f.line-x.line:x.line-f.line}),w.forEach(function(x){return Object(P.addCueToTrack)(_,x)})),w}};K.default=k},"./src/utils/discontinuities.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"findFirstFragWithCC",function(){return I}),A.d(K,"shouldAlignOnDiscontinuities",function(){return k}),A.d(K,"findDiscontinuousReferenceFrag",function(){return O}),A.d(K,"adjustSlidingStart",function(){return c}),A.d(K,"alignStream",function(){return p}),A.d(K,"alignPDT",function(){return w}),A.d(K,"alignFragmentByPDTDelta",function(){return y}),A.d(K,"alignMediaPlaylistByPDT",function(){return b});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/logger.ts"),P=A("./src/controller/level-helper.ts");function I(l,a){for(var s=null,u=0,C=l.length;u<C;u++){var g=l[u];if(g&&g.cc===a){s=g;break}}return s}function k(l,a,s){return!!(a.details&&(s.endCC>s.startCC||l&&l.cc<s.startCC))}function O(l,a){var s=l.fragments,u=a.fragments;if(!u.length||!s.length){M.logger.log("No fragments to align");return}var C=I(s,u[0].cc);if(!C||C&&!C.startPTS){M.logger.log("No frag in previous level to align on");return}return C}function _(l,a){if(l){var s=l.start+a;l.start=l.startPTS=s,l.endPTS=s+l.duration}}function c(l,a){for(var s=a.fragments,u=0,C=s.length;u<C;u++)_(s[u],l);a.fragmentHint&&_(a.fragmentHint,l),a.alignedSliding=!0}function p(l,a,s){if(!a)return;D(l,s,a),!s.alignedSliding&&a.details&&w(s,a.details),!s.alignedSliding&&a.details&&!s.skippedSegments&&Object(P.adjustSliding)(a.details,s)}function D(l,a,s){if(k(l,s,a)){var u=O(s.details,a);u&&Object(W.isFiniteNumber)(u.start)&&(M.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),c(u.start,a))}}function w(l,a){if(!a.fragments.length||!l.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,u=l.fragments[0].programDateTime,C=(u-s)/1e3+a.fragments[0].start;C&&Object(W.isFiniteNumber)(C)&&(M.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+C.toFixed(3)+" "+l.url+" "),c(C,l))}function y(l,a){var s=l.programDateTime;if(!s)return;var u=(s-a)/1e3;l.start=l.startPTS=u,l.endPTS=u+l.duration}function b(l,a){if(!a.fragments.length||!l.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,u=a.fragments[0].start,C=s-u*1e3;l.fragments.forEach(function(g){y(g,C)}),l.fragmentHint&&y(l.fragmentHint,C),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/utils/ewma.ts"),M=function(){function P(k,O,_){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=_,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new W.default(k),this.fast_=new W.default(O)}var I=P.prototype;return I.update=function(O,_){var c=this.slow_,p=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new W.default(O,c.getEstimate(),c.getTotalWeight())),this.fast_.halfLife!==_&&(this.fast_=new W.default(_,p.getEstimate(),p.getTotalWeight()))},I.sample=function(O,_){O=Math.max(O,this.minDelayMs_);var c=8*_,p=O/1e3,D=c/p;this.fast_.sample(p,D),this.slow_.sample(p,D)},I.canEstimate=function(){var O=this.fast_;return O&&O.getTotalWeight()>=this.minWeight_},I.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},I.destroy=function(){},P}();K.default=M},"./src/utils/ewma.ts":function(Q,K,A){"use strict";A.r(K);var W=function(){function M(I,k,O){k===void 0&&(k=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=I,this.alpha_=I?Math.exp(Math.log(.5)/I):0,this.estimate_=k,this.totalWeight_=O}var P=M.prototype;return P.sample=function(k,O){var _=Math.pow(this.alpha_,k);this.estimate_=O*(1-_)+_*this.estimate_,this.totalWeight_+=k},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var k=1-Math.pow(this.alpha_,this.totalWeight_);if(k)return this.estimate_/k}return this.estimate_},M}();K.default=W},"./src/utils/fetch-loader.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"fetchSupported",function(){return y});var W=A("./src/polyfills/number.ts"),M=A("./src/loader/load-stats.ts"),P=A("./src/demux/chunk-cache.ts");function I(u,C){u.prototype=Object.create(C.prototype),u.prototype.constructor=u,p(u,C)}function k(u){var C=typeof Map=="function"?new Map:void 0;return k=function(m){if(m===null||!c(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(m))return C.get(m);C.set(m,L)}function L(){return O(m,arguments,D(this).constructor)}return L.prototype=Object.create(m.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),p(L,m)},k(u)}function O(u,C,g){return _()?O=Reflect.construct:O=function(L,x,f){var h=[null];h.push.apply(h,x);var d=Function.bind.apply(L,h),o=new d;return f&&p(o,f.prototype),o},O.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function c(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function p(u,C){return p=Object.setPrototypeOf||function(m,L){return m.__proto__=L,m},p(u,C)}function D(u){return D=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},D(u)}function w(){return w=Object.assign||function(u){for(var C=1;C<arguments.length;C++){var g=arguments[C];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(u[m]=g[m])}return u},w.apply(this,arguments)}function y(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var b=function(){function u(g){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=g.fetchSetup||a,this.controller=new self.AbortController,this.stats=new M.LoadStats}var C=u.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(m,L,x){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=l(m,this.controller.signal),o=x.onProgress,T=m.responseType==="arraybuffer",E=T?"byteLength":"length";this.context=m,this.config=L,this.callbacks=x,this.request=this.fetchSetup(m,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),x.onTimeout(h,m,f.response)},L.timeout),self.fetch(this.request).then(function(v){if(f.response=f.loader=v,!v.ok){var R=v.status,N=v.statusText;throw new s(N||"fetch, bad network response",R,v)}return h.loading.first=Math.max(self.performance.now(),h.loading.start),h.total=parseInt(v.headers.get("Content-Length")||"0"),o&&Object(W.isFiniteNumber)(L.highWaterMark)?f.loadProgressively(v,h,m,L.highWaterMark,o):T?v.arrayBuffer():v.text()}).then(function(v){var R=f.response;self.clearTimeout(f.requestTimeout),h.loading.end=Math.max(self.performance.now(),h.loading.first),h.loaded=h.total=v[E];var N={url:R.url,data:v};o&&!Object(W.isFiniteNumber)(L.highWaterMark)&&o(h,m,v,R),x.onSuccess(N,h,m,R)}).catch(function(v){if(self.clearTimeout(f.requestTimeout),h.aborted)return;var R=v.code||0;x.onError({code:R,text:v.message},m,v.details)})},C.getCacheAge=function(){var m=null;if(this.response){var L=this.response.headers.get("age");m=L?parseFloat(L):null}return m},C.loadProgressively=function(m,L,x,f,h){f===void 0&&(f=0);var d=new P.default,o=m.body.getReader(),T=function E(){return o.read().then(function(v){if(v.done)return d.dataLength&&h(L,x,d.flush(),m),Promise.resolve(new ArrayBuffer(0));var R=v.value,N=R.length;return L.loaded+=N,N<f||d.dataLength?(d.push(R),d.dataLength>=f&&h(L,x,d.flush(),m)):h(L,x,R,m),E()}).catch(function(){return Promise.reject()})};return T()},u}();function l(u,C){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(w({},u.headers))};return u.rangeEnd&&g.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),g}function a(u,C){return new self.Request(u.url,C)}var s=function(u){I(C,u);function C(g,m,L){var x;return x=u.call(this,g)||this,x.code=void 0,x.details=void 0,x.code=m,x.details=L,x}return C}(k(Error));K.default=b},"./src/utils/imsc1-ttml-parser.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"IMSC1_CODEC",function(){return c}),A.d(K,"parseIMSC1",function(){return y});var W=A("./src/utils/mp4-tools.ts"),M=A("./src/utils/vttparser.ts"),P=A("./src/utils/vttcue.ts"),I=A("./src/demux/id3.ts"),k=A("./src/utils/timescale-conversion.ts"),O=A("./src/utils/webvtt-parser.ts");function _(){return _=Object.assign||function(f){for(var h=1;h<arguments.length;h++){var d=arguments[h];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(f[o]=d[o])}return f},_.apply(this,arguments)}var c="stpp.ttml.im1t",p=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,D=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function y(f,h,d,o,T){var E=Object(W.findBox)(new Uint8Array(f),["mdat"]);if(E.length===0){T(new Error("Could not parse IMSC1 mdat"));return}var v=E[0],R=Object(I.utf8ArrayToStr)(new Uint8Array(f,v.start,v.end-v.start)),N=Object(k.toTimescaleFromScale)(h,1,d);try{o(b(R,N))}catch(B){T(B)}}function b(f,h){var d=new DOMParser,o=d.parseFromString(f,"text/xml"),T=o.getElementsByTagName("tt")[0];if(!T)throw new Error("Invalid ttml");var E={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},v=Object.keys(E).reduce(function(j,F){return j[F]=T.getAttribute("ttp:"+F)||E[F],j},{}),R=T.getAttribute("xml:space")!=="preserve",N=a(l(T,"styling","style")),B=a(l(T,"layout","region")),z=l(T,"body","[begin]");return[].map.call(z,function(j){var F=s(j,R);if(!F||!j.hasAttribute("begin"))return null;var X=m(j.getAttribute("begin"),v),q=m(j.getAttribute("dur"),v),ne=m(j.getAttribute("end"),v);if(X===null)throw g(j);if(ne===null){if(q===null)throw g(j);ne=X+q}var ue=new P.default(X-h,ne-h,F);ue.id=Object(O.generateCueId)(ue.startTime,ue.endTime,ue.text);var Ee=B[j.getAttribute("region")],pe=N[j.getAttribute("style")];ue.position=10,ue.size=80;var fe=u(Ee,pe),de=fe.textAlign;if(de){var ce=w[de];ce&&(ue.lineAlign=ce),ue.align=de}return _(ue,fe),ue}).filter(function(j){return j!==null})}function l(f,h,d){var o=f.getElementsByTagName(h)[0];return o?[].slice.call(o.querySelectorAll(d)):[]}function a(f){return f.reduce(function(h,d){var o=d.getAttribute("xml:id");return o&&(h[o]=d),h},{})}function s(f,h){return[].slice.call(f.childNodes).reduce(function(d,o,T){var E;return o.nodeName==="br"&&T?d+`
|
|
`:(E=o.childNodes)!==null&&E!==void 0&&E.length?s(o,h):h?d+o.textContent.trim().replace(/\s+/g," "):d+o.textContent},"")}function u(f,h){var d="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(T,E){var v=C(h,d,E)||C(f,d,E);return v&&(T[E]=v),T},{})}function C(f,h,d){return f.hasAttributeNS(h,d)?f.getAttributeNS(h,d):null}function g(f){return new Error("Could not parse ttml timestamp "+f)}function m(f,h){if(!f)return null;var d=Object(M.parseTimeStamp)(f);return d===null&&(p.test(f)?d=L(f,h):D.test(f)&&(d=x(f,h))),d}function L(f,h){var d=p.exec(f),o=(d[4]|0)+(d[5]|0)/h.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+o/h.frameRate}function x(f,h){var d=D.exec(f),o=Number(d[1]),T=d[2];switch(T){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/h.frameRate;case"t":return o/h.tickRate}return o}},"./src/utils/logger.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"enableLogs",function(){return O}),A.d(K,"logger",function(){return _});var W=function(){},M={trace:W,debug:W,log:W,warn:W,info:W,error:W},P=M;function I(c){var p=self.console[c];return p?p.bind(self.console,"["+c+"] >"):W}function k(c){for(var p=arguments.length,D=new Array(p>1?p-1:0),w=1;w<p;w++)D[w-1]=arguments[w];D.forEach(function(y){P[y]=c[y]?c[y].bind(c):I(y)})}function O(c){if(self.console&&c===!0||typeof c=="object"){k(c,"debug","log","info","warn","error");try{P.log()}catch(p){P=M}}else P=M}var _=P},"./src/utils/mediakeys-helper.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"KeySystems",function(){return W}),A.d(K,"requestMediaKeySystemAccess",function(){return M});var W;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(W||(W={}));var M=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"getMediaSource",function(){return W});function W(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"bin2str",function(){return k}),A.d(K,"readUint16",function(){return O}),A.d(K,"readUint32",function(){return _}),A.d(K,"writeUint32",function(){return c}),A.d(K,"findBox",function(){return p}),A.d(K,"parseSegmentIndex",function(){return D}),A.d(K,"parseInitSegment",function(){return w}),A.d(K,"getStartDTS",function(){return y}),A.d(K,"getDuration",function(){return b}),A.d(K,"computeRawDurationFromSamples",function(){return l}),A.d(K,"offsetStartDTS",function(){return a}),A.d(K,"segmentValidRange",function(){return s}),A.d(K,"appendUint8Array",function(){return u});var W=A("./src/utils/typed-array.ts"),M=A("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,I=[].push;function k(C){return String.fromCharCode.apply(null,C)}function O(C,g){"data"in C&&(g+=C.start,C=C.data);var m=C[g]<<8|C[g+1];return m<0?65536+m:m}function _(C,g){"data"in C&&(g+=C.start,C=C.data);var m=C[g]<<24|C[g+1]<<16|C[g+2]<<8|C[g+3];return m<0?4294967296+m:m}function c(C,g,m){"data"in C&&(g+=C.start,C=C.data),C[g]=m>>24,C[g+1]=m>>16&255,C[g+2]=m>>8&255,C[g+3]=m&255}function p(C,g){var m=[];if(!g.length)return m;var L,x,f;"data"in C?(L=C.data,x=C.start,f=C.end):(L=C,x=0,f=L.byteLength);for(var h=x;h<f;){var d=_(L,h),o=k(L.subarray(h+4,h+8)),T=d>1?h+d:f;if(o===g[0])if(g.length===1)m.push({data:L,start:h+8,end:T});else{var E=p({data:L,start:h+8,end:T},g.slice(1));E.length&&I.apply(m,E)}h=T}return m}function D(C){var g=p(C,["moov"]),m=g[0],L=m?m.end:null,x=p(C,["sidx"]);if(!x||!x[0])return null;var f=[],h=x[0],d=h.data[0],o=d===0?8:16,T=_(h,o);o+=4;var E=0,v=0;d===0?o+=8:o+=16,o+=2;var R=h.end+v,N=O(h,o);o+=2;for(var B=0;B<N;B++){var z=o,j=_(h,z);z+=4;var F=j&2147483647,X=(j&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var q=_(h,z);z+=4,f.push({referenceSize:F,subsegmentDuration:q,info:{duration:q/T,start:R,end:R+F-1}}),R+=F,z+=4,o=z}return{earliestPresentationTime:E,timescale:T,version:d,referencesCount:N,references:f,moovEndOffset:L}}function w(C){for(var g=[],m=p(C,["moov","trak"]),L=0;L<m.length;L++){var x=m[L],f=p(x,["tkhd"])[0];if(f){var h=f.data[f.start],d=h===0?12:20,o=_(f,d),T=p(x,["mdia","mdhd"])[0];if(T){h=T.data[T.start],d=h===0?12:20;var E=_(T,d),v=p(x,["mdia","hdlr"])[0];if(v){var R=k(v.data.subarray(v.start+8,v.start+12)),N={soun:M.ElementaryStreamTypes.AUDIO,vide:M.ElementaryStreamTypes.VIDEO}[R];if(N){var B=p(x,["mdia","minf","stbl","stsd"])[0],z=void 0;B&&(z=k(B.data.subarray(B.start+12,B.start+16))),g[o]={timescale:E,type:N},g[N]={timescale:E,id:o,codec:z}}}}}}var j=p(C,["moov","mvex","trex"]);return j.forEach(function(F){var X=_(F,4),q=g[X];q&&(q.default={duration:_(F,12),flags:_(F,20)})}),g}function y(C,g){return p(g,["moof","traf"]).reduce(function(m,L){var x=p(L,["tfdt"])[0],f=x.data[x.start],h=p(L,["tfhd"]).reduce(function(d,o){var T=_(o,4),E=C[T];if(E){var v=_(x,4);f===1&&(v*=Math.pow(2,32),v+=_(x,8));var R=E.timescale||9e4,N=v/R;if(isFinite(N)&&(d===null||N<d))return N}return d},null);return h!==null&&isFinite(h)&&(m===null||h<m)?h:m},null)||0}function b(C,g){for(var m=0,L=0,x=0,f=p(C,["moof","traf"]),h=0;h<f.length;h++){var d=f[h],o=p(d,["tfhd"])[0],T=_(o,4),E=g[T];if(!E)continue;var v=E.default,R=_(o,0)|(v==null?void 0:v.flags),N=v==null?void 0:v.duration;R&8&&(R&2?N=_(o,12):N=_(o,8));for(var B=E.timescale||9e4,z=p(d,["trun"]),j=0;j<z.length;j++){if(N){var F=_(z[j],4);m=N*F}else m=l(z[j]);E.type===M.ElementaryStreamTypes.VIDEO?L+=m/B:E.type===M.ElementaryStreamTypes.AUDIO&&(x+=m/B)}}if(L===0&&x===0){var X=D(C);if(X!=null&&X.references)return X.references.reduce(function(q,ne){return q+ne.info.duration||0},0)}return L||x}function l(C){var g=_(C,0),m=8;g&1&&(m+=4),g&4&&(m+=4);for(var L=0,x=_(C,4),f=0;f<x;f++){if(g&256){var h=_(C,m);L+=h,m+=4}g&512&&(m+=4),g&1024&&(m+=4),g&2048&&(m+=4)}return L}function a(C,g,m){p(g,["moof","traf"]).forEach(function(L){p(L,["tfhd"]).forEach(function(x){var f=_(x,4),h=C[f];if(!h)return;var d=h.timescale||9e4;p(L,["tfdt"]).forEach(function(o){var T=o.data[o.start],E=_(o,4);if(T===0)c(o,4,E-m*d);else{E*=Math.pow(2,32),E+=_(o,8),E-=m*d,E=Math.max(E,0);var v=Math.floor(E/(P+1)),R=Math.floor(E%(P+1));c(o,4,v),c(o,8,R)}})})})}function s(C){var g={valid:null,remainder:null},m=p(C,["moof"]);if(m){if(m.length<2)return g.remainder=C,g}else return g;var L=m[m.length-1];return g.valid=Object(W.sliceUint8)(C,0,L.start-8),g.remainder=Object(W.sliceUint8)(C,L.start-8),g}function u(C,g){var m=new Uint8Array(C.length+g.length);return m.set(C),m.set(g,C.length),m}},"./src/utils/output-filter.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function M(I,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=I,this.trackName=k}var P=M.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(k,O,_){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=O,this.screen=_,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},M}()},"./src/utils/texttrack-utils.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"sendAddTrackEvent",function(){return M}),A.d(K,"addCueToTrack",function(){return P}),A.d(K,"clearCurrentCues",function(){return I}),A.d(K,"removeCuesInRange",function(){return k}),A.d(K,"getCuesInRange",function(){return _});var W=A("./src/utils/logger.ts");function M(c,p){var D;try{D=new Event("addtrack")}catch(w){D=document.createEvent("Event"),D.initEvent("addtrack",!1,!1)}D.track=c,p.dispatchEvent(D)}function P(c,p){var D=c.mode;if(D==="disabled"&&(c.mode="hidden"),c.cues&&!c.cues.getCueById(p.id))try{if(c.addCue(p),!c.cues.getCueById(p.id))throw new Error("addCue is failed for: "+p)}catch(y){W.logger.debug("[texttrack-utils]: "+y);var w=new self.TextTrackCue(p.startTime,p.endTime,p.text);w.id=p.id,c.addCue(w)}D==="disabled"&&(c.mode=D)}function I(c){var p=c.mode;if(p==="disabled"&&(c.mode="hidden"),c.cues)for(var D=c.cues.length;D--;)c.removeCue(c.cues[D]);p==="disabled"&&(c.mode=p)}function k(c,p,D){var w=c.mode;if(w==="disabled"&&(c.mode="hidden"),c.cues&&c.cues.length>0)for(var y=_(c.cues,p,D),b=0;b<y.length;b++)c.removeCue(y[b]);w==="disabled"&&(c.mode=w)}function O(c,p){if(p<c[0].startTime)return 0;var D=c.length-1;if(p>c[D].endTime)return-1;for(var w=0,y=D;w<=y;){var b=Math.floor((y+w)/2);if(p<c[b].startTime)y=b-1;else if(p>c[b].startTime&&w<D)w=b+1;else return b}return c[w].startTime-p<p-c[y].startTime?w:y}function _(c,p,D){var w=[],y=O(c,p);if(y>-1)for(var b=y,l=c.length;b<l;b++){var a=c[b];if(a.startTime>=p&&a.endTime<=D)w.push(a);else if(a.startTime>D)return w}return w}},"./src/utils/time-ranges.ts":function(Q,K,A){"use strict";A.r(K);var W={toString:function(P){for(var I="",k=P.length,O=0;O<k;O++)I+="["+P.start(O).toFixed(3)+","+P.end(O).toFixed(3)+"]";return I}};K.default=W},"./src/utils/timescale-conversion.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"toTimescaleFromBase",function(){return M}),A.d(K,"toTimescaleFromScale",function(){return P}),A.d(K,"toMsFromMpegTsClock",function(){return I}),A.d(K,"toMpegTsClockFromTimescale",function(){return k});var W=9e4;function M(O,_,c,p){c===void 0&&(c=1),p===void 0&&(p=!1);var D=O*_*c;return p?Math.round(D):D}function P(O,_,c,p){return c===void 0&&(c=1),p===void 0&&(p=!1),M(O,_,1/c,p)}function I(O,_){return _===void 0&&(_=!1),M(O,1e3,1/W,_)}function k(O,_){return _===void 0&&(_=1),M(O,W,1/_)}},"./src/utils/typed-array.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"sliceUint8",function(){return W});function W(M,P,I){return Uint8Array.prototype.slice?M.slice(P,I):new Uint8Array(Array.prototype.slice.call(M,P,I))}},"./src/utils/vttcue.ts":function(Q,K,A){"use strict";A.r(K),K.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var W=["","lr","rl"],M=["start","middle","end","left","right"];function P(c,p){if(typeof p!="string")return!1;if(!Array.isArray(c))return!1;var D=p.toLowerCase();return~c.indexOf(D)?D:!1}function I(c){return P(W,c)}function k(c){return P(M,c)}function O(c){for(var p=arguments.length,D=new Array(p>1?p-1:0),w=1;w<p;w++)D[w-1]=arguments[w];for(var y=1;y<arguments.length;y++){var b=arguments[y];for(var l in b)c[l]=b[l]}return c}function _(c,p,D){var w=this,y={enumerable:!0};w.hasBeenReset=!1;var b="",l=!1,a=c,s=p,u=D,C=null,g="",m=!0,L="auto",x="start",f=50,h="middle",d=50,o="middle";Object.defineProperty(w,"id",O({},y,{get:function(){return b},set:function(E){b=""+E}})),Object.defineProperty(w,"pauseOnExit",O({},y,{get:function(){return l},set:function(E){l=!!E}})),Object.defineProperty(w,"startTime",O({},y,{get:function(){return a},set:function(E){if(typeof E!="number")throw new TypeError("Start time must be set to a number.");a=E,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",O({},y,{get:function(){return s},set:function(E){if(typeof E!="number")throw new TypeError("End time must be set to a number.");s=E,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",O({},y,{get:function(){return u},set:function(E){u=""+E,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",O({},y,{get:function(){return C},set:function(E){C=E,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",O({},y,{get:function(){return g},set:function(E){var v=I(E);if(v===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=v,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",O({},y,{get:function(){return m},set:function(E){m=!!E,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",O({},y,{get:function(){return L},set:function(E){if(typeof E!="number"&&E!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=E,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",O({},y,{get:function(){return x},set:function(E){var v=k(E);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");x=v,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",O({},y,{get:function(){return f},set:function(E){if(E<0||E>100)throw new Error("Position must be between 0 and 100.");f=E,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",O({},y,{get:function(){return h},set:function(E){var v=k(E);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");h=v,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",O({},y,{get:function(){return d},set:function(E){if(E<0||E>100)throw new Error("Size must be between 0 and 100.");d=E,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",O({},y,{get:function(){return o},set:function(E){var v=k(E);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");o=v,this.hasBeenReset=!0}})),w.displayState=void 0}return _.prototype.getCueAsHTML=function(){var c=self.WebVTT;return c.convertCueToDOMTree(self,this.text)},_}()},"./src/utils/vttparser.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"parseTimeStamp",function(){return P}),A.d(K,"fixLineBreaks",function(){return p}),A.d(K,"VTTParser",function(){return D});var W=A("./src/utils/vttcue.ts"),M=function(){function w(){}var y=w.prototype;return y.decode=function(l,a){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},w}();function P(w){function y(l,a,s,u){return(l|0)*3600+(a|0)*60+(s|0)+parseFloat(u||0)}var b=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?y(b[2],b[3],0,b[4]):y(b[1],b[2],b[3],b[4]):null}var I=function(){function w(){this.values=Object.create(null)}var y=w.prototype;return y.set=function(l,a){!this.get(l)&&a!==""&&(this.values[l]=a)},y.get=function(l,a,s){return s?this.has(l)?this.values[l]:a[s]:this.has(l)?this.values[l]:a},y.has=function(l){return l in this.values},y.alt=function(l,a,s){for(var u=0;u<s.length;++u)if(a===s[u]){this.set(l,a);break}},y.integer=function(l,a){/^-?\d+$/.test(a)&&this.set(l,parseInt(a,10))},y.percent=function(l,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var s=parseFloat(a);if(s>=0&&s<=100)return this.set(l,s),!0}return!1},w}();function k(w,y,b,l){var a=l?w.split(l):[w];for(var s in a){if(typeof a[s]!="string")continue;var u=a[s].split(b);if(u.length!==2)continue;var C=u[0],g=u[1];y(C,g)}}var O=new W.default(0,0,""),_=O.align==="middle"?"middle":"center";function c(w,y,b){var l=w;function a(){var C=P(w);if(C===null)throw new Error("Malformed timestamp: "+l);return w=w.replace(/^[^\sa-zA-Z-]+/,""),C}function s(C,g){var m=new I;k(C,function(f,h){var d;switch(f){case"region":for(var o=b.length-1;o>=0;o--)if(b[o].id===h){m.set(f,b[o].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",_,"end"]);break;case"position":d=h.split(","),m.percent(f,d[0]),d.length===2&&m.alt("positionAlign",d[1],["start",_,"end","line-left","line-right","auto"]);break;case"size":m.percent(f,h);break;case"align":m.alt(f,h,["start",_,"end","left","right"]);break}},/:/,/\s/),g.region=m.get("region",null),g.vertical=m.get("vertical","");var L=m.get("line","auto");L==="auto"&&O.line===-1&&(L=-1),g.line=L,g.lineAlign=m.get("lineAlign","start"),g.snapToLines=m.get("snapToLines",!0),g.size=m.get("size",100),g.align=m.get("align",_);var x=m.get("position","auto");x==="auto"&&O.position===50&&(x=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=x}function u(){w=w.replace(/^\s+/,"")}if(u(),y.startTime=a(),u(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);w=w.substr(3),u(),y.endTime=a(),u(),s(w,y)}function p(w){return w.replace(/<br(?: \/)?>/gi,`
|
|
`)}var D=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new M,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var y=w.prototype;return y.parse=function(l){var a=this;l&&(a.buffer+=a.decoder.decode(l,{stream:!0}));function s(){var x=a.buffer,f=0;for(x=p(x);f<x.length&&x[f]!=="\r"&&x[f]!==`
|
|
`;)++f;var h=x.substr(0,f);return x[f]==="\r"&&++f,x[f]===`
|
|
`&&++f,a.buffer=x.substr(f),h}function u(x){k(x,function(f,h){},/:/)}try{var C="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;C=s();var g=C.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var m=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;m?m=!1:C=s();switch(a.state){case"HEADER":/:/.test(C)?u(C):C||(a.state="ID");continue;case"NOTE":C||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){a.state="NOTE";break}if(!C)continue;if(a.cue=new W.default(0,0,""),a.state="CUE",C.indexOf("-->")===-1){a.cue.id=C;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{c(C,a.cue,a.regionList)}catch(x){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var L=C.indexOf("-->")!==-1;if(!C||L&&(m=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
|
|
`),a.cue.text+=C}continue;case"BADCUE":C||(a.state="ID")}}}catch(x){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},y.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
|
|
|
|
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){l.onparsingerror&&l.onparsingerror(a)}return l.onflush&&l.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(Q,K,A){"use strict";A.r(K),A.d(K,"generateCueId",function(){return D}),A.d(K,"parseWebVTT",function(){return y});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/vttparser.ts"),P=A("./src/demux/id3.ts"),I=A("./src/utils/timescale-conversion.ts"),k=A("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,_=function(l,a,s){return s===void 0&&(s=0),l.substr(s,a.length)===a},c=function(l){var a=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),u=parseInt(l.substr(-9,2)),C=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(W.isFiniteNumber)(a)||!Object(W.isFiniteNumber)(s)||!Object(W.isFiniteNumber)(u)||!Object(W.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return a+=1e3*s,a+=60*1e3*u,a+=60*60*1e3*C,a},p=function(l){for(var a=5381,s=l.length;s;)a=a*33^l.charCodeAt(--s);return(a>>>0).toString()};function D(b,l,a){return p(b.toString())+p(l.toString())+p(a)}var w=function(l,a,s){var u=l[a],C=l[u.prevCC];if(!C||!C.new&&u.new){l.ccOffset=l.presentationOffset=u.start,u.new=!1;return}for(;(g=C)!==null&&g!==void 0&&g.new;){var g;l.ccOffset+=u.start-C.start,u.new=!1,u=C,C=l[u.prevCC]}l.presentationOffset=s};function y(b,l,a,s,u,C,g,m){var L=new M.VTTParser,x=Object(P.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(O,`
|
|
`).split(`
|
|
`),f=[],h=Object(I.toMpegTsClockFromTimescale)(l,a),d="00:00.000",o=0,T=0,E,v=!0,R=!1;L.oncue=function(N){var B=s[u],z=s.ccOffset,j=(o-h)/9e4;if(B!=null&&B.new&&(T!==void 0?z=s.ccOffset=B.start:w(s,u,j)),j&&(z=j-s.presentationOffset),R){var F=N.endTime-N.startTime,X=Object(k.normalizePts)((N.startTime+z-T)*9e4,C*9e4)/9e4;N.startTime=X,N.endTime=X+F}var q=N.text.trim();N.text=decodeURIComponent(encodeURIComponent(q)),N.id||(N.id=D(N.startTime,N.endTime,q)),N.endTime>0&&f.push(N)},L.onparsingerror=function(N){E=N},L.onflush=function(){if(E){m(E);return}g(f)},x.forEach(function(N){if(v)if(_(N,"X-TIMESTAMP-MAP=")){v=!1,R=!0,N.substr(16).split(",").forEach(function(B){_(B,"LOCAL:")?d=B.substr(6):_(B,"MPEGTS:")&&(o=parseInt(B.substr(7)))});try{T=c(d)/1e3}catch(B){R=!1,E=B}return}else N===""&&(v=!1);L.parse(N+`
|
|
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(Q,K,A){"use strict";A.r(K);var W=A("./src/utils/logger.ts"),M=A("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,I=function(){function k(_){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=_?_.xhrSetup:null,this.stats=new M.LoadStats,this.retryDelay=0}var O=k.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var c=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),c&&(c.onreadystatechange=null,c.onprogress=null,c.readyState!==4&&(this.stats.aborted=!0,c.abort()))},O.abort=function(){var c;this.abortInternal(),(c=this.callbacks)!==null&&c!==void 0&&c.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(c,p,D){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=c,this.config=p,this.callbacks=D,this.retryDelay=p.retryDelay,this.loadInternal()},O.loadInternal=function(){var c=this.config,p=this.context;if(!c)return;var D=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var y=this.xhrSetup;try{if(y)try{y(D,p.url)}catch(a){D.open("GET",p.url,!0),y(D,p.url)}D.readyState||D.open("GET",p.url,!0);var b=this.context.headers;if(b)for(var l in b)D.setRequestHeader(l,b[l])}catch(a){this.callbacks.onError({code:D.status,text:a.message},p,D);return}p.rangeEnd&&D.setRequestHeader("Range","bytes="+p.rangeStart+"-"+(p.rangeEnd-1)),D.onreadystatechange=this.readystatechange.bind(this),D.onprogress=this.loadprogress.bind(this),D.responseType=p.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),c.timeout),D.send()},O.readystatechange=function(){var c=this.context,p=this.loader,D=this.stats;if(!c||!p)return;var w=p.readyState,y=this.config;if(D.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),D.loading.first===0&&(D.loading.first=Math.max(self.performance.now(),D.loading.start)),w===4){p.onreadystatechange=null,p.onprogress=null;var b=p.status;if(b>=200&&b<300){D.loading.end=Math.max(self.performance.now(),D.loading.first);var l,a;if(c.responseType==="arraybuffer"?(l=p.response,a=l.byteLength):(l=p.responseText,a=l.length),D.loaded=D.total=a,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(D,c,l,p),!this.callbacks)return;var u={url:p.responseURL,data:l};this.callbacks.onSuccess(u,D,c,p)}else D.retry>=y.maxRetry||b>=400&&b<499?(W.logger.error(b+" while loading "+c.url),this.callbacks.onError({code:b,text:p.statusText},c,p)):(W.logger.warn(b+" while loading "+c.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,y.maxRetryDelay),D.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout)},O.loadtimeout=function(){W.logger.warn("timeout while loading "+this.context.url);var c=this.callbacks;c&&(this.abortInternal(),c.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(c){var p=this.stats;p.loaded=c.loaded,c.lengthComputable&&(p.total=c.total)},O.getCacheAge=function(){var c=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");c=p?parseFloat(p):null}return c},k}();K.default=I}}).default})},wU8J:function(Je,je){function J(){this.buffer=new Array,this.length=0}J.prototype={get:function(Q){var K=Math.floor(Q/8);return(this.buffer[K]>>>7-Q%8&1)==1},put:function(Q,K){for(var A=0;A<K;A++)this.putBit((Q>>>K-A-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(Q){var K=Math.floor(this.length/8);this.buffer.length<=K&&this.buffer.push(0),Q&&(this.buffer[K]|=128>>>this.length%8),this.length++}},Je.exports=J}}]);
|