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.
203 lines
870 KiB
203 lines
870 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[160,5,7],{"+NIl":function(st,Qe,Q){(function(ee){ee(Q("VrN/"))})(function(ee){"use strict";ee.defineMode("stex",function(V,I){"use strict";function H(d,a){d.cmdState.push(a)}function k(d){return d.cmdState.length>0?d.cmdState[d.cmdState.length-1]:null}function C(d){var a=d.cmdState.pop();a&&a.closeBracket()}function B(d){for(var a=d.cmdState,c=a.length-1;c>=0;c--){var o=a[c];if(o.name=="DEFAULT")continue;return o}return{styleIdentifier:function(){return null}}}function U(d,a,c){return function(){this.name=d,this.bracketNo=0,this.style=a,this.styles=c,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var D={};D.importmodule=U("importmodule","tag",["string","builtin"]),D.documentclass=U("documentclass","tag",["","atom"]),D.usepackage=U("usepackage","tag",["atom"]),D.begin=U("begin","tag",["atom"]),D.end=U("end","tag",["atom"]),D.label=U("label","tag",["atom"]),D.ref=U("ref","tag",["atom"]),D.eqref=U("eqref","tag",["atom"]),D.cite=U("cite","tag",["atom"]),D.bibitem=U("bibitem","tag",["atom"]),D.Bibitem=U("Bibitem","tag",["atom"]),D.RBibitem=U("RBibitem","tag",["atom"]),D.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(d,a){d.f=a}function g(d,a){var c;if(d.match(/^\\[a-zA-Z@]+/)){var o=d.current().slice(1);return c=D.hasOwnProperty(o)?D[o]:D.DEFAULT,c=new c,H(a,c),L(a,f),c.style}if(d.match(/^\\[$&%#{}_]/))return"tag";if(d.match(/^\\[,;!\/\\]/))return"tag";if(d.match("\\["))return L(a,function(l,h){return p(l,h,"\\]")}),"keyword";if(d.match("\\("))return L(a,function(l,h){return p(l,h,"\\)")}),"keyword";if(d.match("$$"))return L(a,function(l,h){return p(l,h,"$$")}),"keyword";if(d.match("$"))return L(a,function(l,h){return p(l,h,"$")}),"keyword";var s=d.next();if(s=="%")return d.skipToEnd(),"comment";if(s=="}"||s=="]"){if(c=k(a),c)c.closeBracket(s),L(a,f);else return"error";return"bracket"}else return s=="{"||s=="["?(c=D.DEFAULT,c=new c,H(a,c),"bracket"):/\d/.test(s)?(d.eatWhile(/[\w.%]/),"atom"):(d.eatWhile(/[\w\-_]/),c=B(a),c.name=="begin"&&(c.argument=d.current()),c.styleIdentifier())}function p(d,a,c){if(d.eatSpace())return null;if(c&&d.match(c))return L(a,g),"keyword";if(d.match(/^\\[a-zA-Z@]+/))return"tag";if(d.match(/^[a-zA-Z]+/))return"variable-2";if(d.match(/^\\[$&%#{}_]/))return"tag";if(d.match(/^\\[,;!\/]/))return"tag";if(d.match(/^[\^_&]/))return"tag";if(d.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(d.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var o=d.next();return o=="{"||o=="}"||o=="["||o=="]"||o=="("||o==")"?"bracket":o=="%"?(d.skipToEnd(),"comment"):"error"}function f(d,a){var c=d.peek(),o;return c=="{"||c=="["?(o=k(a),o.openBracket(c),d.eat(c),L(a,g),"bracket"):/[ \t\r]/.test(c)?(d.eat(c),null):(L(a,g),C(a),g(d,a))}return{startState:function(){var d=I.inMathMode?function(a,c){return p(a,c)}:g;return{cmdState:[],f:d}},copyState:function(d){return{cmdState:d.cmdState.slice(),f:d.f}},token:function(d,a){return a.f(d,a)},blankLine:function(d){d.f=g,d.cmdState.length=0},lineComment:"%"}}),ee.defineMIME("text/x-stex","stex"),ee.defineMIME("text/x-latex","stex")})},"+ua5":function(st,Qe,Q){},"19Vz":function(st,Qe,Q){(function(ee){ee(Q("VrN/"))})(function(ee){ee.defineOption("placeholder","",function(U,D,L){var g=L&&L!=ee.Init;if(D&&!g)U.on("blur",k),U.on("change",C),U.on("swapDoc",C),ee.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){H(U)}),C(U);else if(!D&&g){U.off("blur",k),U.off("change",C),U.off("swapDoc",C),ee.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),V(U);var p=U.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}D&&!U.hasFocus()&&k(U)});function V(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function I(U){V(U);var D=U.state.placeholder=document.createElement("pre");D.style.cssText="height: 0; overflow: visible",D.style.direction=U.getOption("direction"),D.className="CodeMirror-placeholder CodeMirror-line-like";var L=U.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),D.appendChild(L),U.display.lineSpace.insertBefore(D,U.display.lineSpace.firstChild)}function H(U){setTimeout(function(){var D=!1,L=U.getInputField();L.nodeName=="TEXTAREA"?D=!L.value:U.lineCount()==1&&(D=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),D?I(U):V(U)},20)}function k(U){B(U)&&I(U)}function C(U){var D=U.getWrapperElement(),L=B(U);D.className=D.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?I(U):V(U)}function B(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(st,Qe,Q){(function(ee){ee(Q("VrN/"))})(function(ee){"use strict";var V={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},I={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ee.defineMode("xml",function(H,k){var C=H.indentUnit,B={},U=k.htmlMode?V:I;for(var D in U)B[D]=U[D];for(var D in k)B[D]=k[D];var L,g;function p(u,_){function m(M){return _.tokenize=M,M(u,_)}var y=u.next();if(y=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?m(a("atom","]]>")):null:u.match("--")?m(a("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),m(c(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),_.tokenize=a("meta","?>"),"meta"):(L=u.eat("/")?"closeTag":"openTag",_.tokenize=f,"tag bracket");if(y=="&"){var P;return u.eat("#")?u.eat("x")?P=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):P=u.eatWhile(/[\d]/)&&u.eat(";"):P=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),P?"atom":"error"}else return u.eatWhile(/[^&<]/),null}p.isInText=!0;function f(u,_){var m=u.next();if(m==">"||m=="/"&&u.eat(">"))return _.tokenize=p,L=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return L="equals",null;if(m=="<"){_.tokenize=p,_.state=h,_.tagName=_.tagStart=null;var y=_.tokenize(u,_);return y?y+" tag error":"tag error"}else return/[\'\"]/.test(m)?(_.tokenize=d(m),_.stringStartCol=u.column(),_.tokenize(u,_)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function d(u){var _=function(m,y){for(;!m.eol();)if(m.next()==u){y.tokenize=f;break}return"string"};return _.isInAttribute=!0,_}function a(u,_){return function(m,y){for(;!m.eol();){if(m.match(_)){y.tokenize=p;break}m.next()}return u}}function c(u){return function(_,m){for(var y;(y=_.next())!=null;){if(y=="<")return m.tokenize=c(u+1),m.tokenize(_,m);if(y==">")if(u==1){m.tokenize=p;break}else return m.tokenize=c(u-1),m.tokenize(_,m)}return"meta"}}function o(u,_,m){this.prev=u.context,this.tagName=_,this.indent=u.indented,this.startOfLine=m,(B.doNotIndent.hasOwnProperty(_)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function s(u){u.context&&(u.context=u.context.prev)}function l(u,_){for(var m;;){if(!u.context)return;if(m=u.context.tagName,!B.contextGrabbers.hasOwnProperty(m)||!B.contextGrabbers[m].hasOwnProperty(_))return;s(u)}}function h(u,_,m){return u=="openTag"?(m.tagStart=_.column(),R):u=="closeTag"?x:h}function R(u,_,m){return u=="word"?(m.tagName=_.current(),g="tag",S):B.allowMissingTagName&&u=="endTag"?(g="tag bracket",S(u,_,m)):(g="error",R)}function x(u,_,m){if(u=="word"){var y=_.current();return m.context&&m.context.tagName!=y&&B.implicitlyClosed.hasOwnProperty(m.context.tagName)&&s(m),m.context&&m.context.tagName==y||B.matchClosing===!1?(g="tag",T):(g="tag error",O)}else return B.allowMissingTagName&&u=="endTag"?(g="tag bracket",T(u,_,m)):(g="error",O)}function T(u,_,m){return u!="endTag"?(g="error",T):(s(m),h)}function O(u,_,m){return g="error",T(u,_,m)}function S(u,_,m){if(u=="word")return g="attribute",E;if(u=="endTag"||u=="selfcloseTag"){var y=m.tagName,P=m.tagStart;return m.tagName=m.tagStart=null,u=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(y)?l(m,y):(l(m,y),m.context=new o(m,y,P==m.indented)),h}return g="error",S}function E(u,_,m){return u=="equals"?b:(B.allowMissing||(g="error"),S(u,_,m))}function b(u,_,m){return u=="string"?v:u=="word"&&B.allowUnquoted?(g="string",S):(g="error",S(u,_,m))}function v(u,_,m){return u=="string"?v:S(u,_,m)}return{startState:function(u){var _={tokenize:p,state:h,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(_.baseIndent=u),_},token:function(u,_){if(!_.tagName&&u.sol()&&(_.indented=u.indentation()),u.eatSpace())return null;L=null;var m=_.tokenize(u,_);return(m||L)&&m!="comment"&&(g=null,_.state=_.state(L||m,u,_),g&&(m=g=="error"?m+" error":g)),m},indent:function(u,_,m){var y=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+C;if(y&&y.noIndent)return ee.Pass;if(u.tokenize!=f&&u.tokenize!=p)return m?m.match(/^(\s*)/)[0].length:0;if(u.tagName)return B.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+C*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(_))return 0;var P=_&&/^<(\/)?([\w_:\.-]*)/.exec(_);if(P&&P[1])for(;y;)if(y.tagName==P[2]){y=y.prev;break}else if(B.implicitlyClosed.hasOwnProperty(y.tagName))y=y.prev;else break;else if(P)for(;y;){var M=B.contextGrabbers[y.tagName];if(M&&M.hasOwnProperty(P[2]))y=y.prev;else break}for(;y&&y.prev&&!y.startOfLine;)y=y.prev;return y?y.indent+C:u.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(u){u.state==b&&(u.state=S)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var _=[],m=u.context;m;m=m.prev)m.tagName&&_.push(m.tagName);return _.reverse()}}}),ee.defineMIME("text/xml","xml"),ee.defineMIME("application/xml","xml"),ee.mimeModes.hasOwnProperty("text/html")||ee.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(st,Qe,Q){"use strict";Q.d(Qe,"a",function(){return l});var ee=Q("Ty5D"),V=Q("dI71"),I=Q("cDcd"),H=Q.n(I),k=Q("YS25"),C=Q("17x9"),B=Q.n(C),U=Q("wx14"),D=Q("zLVn"),L=Q("9R94"),g=function(b){Object(V.a)(v,b);function v(){for(var _,m=arguments.length,y=new Array(m),P=0;P<m;P++)y[P]=arguments[P];return _=b.call.apply(b,[this].concat(y))||this,_.history=Object(k.a)(_.props),_}var u=v.prototype;return u.render=function(){return H.a.createElement(ee.c,{history:this.history,children:this.props.children})},v}(H.a.Component),p=function(b){Object(V.a)(v,b);function v(){for(var _,m=arguments.length,y=new Array(m),P=0;P<m;P++)y[P]=arguments[P];return _=b.call.apply(b,[this].concat(y))||this,_.history=Object(k.b)(_.props),_}var u=v.prototype;return u.render=function(){return H.a.createElement(ee.c,{history:this.history,children:this.props.children})},v}(H.a.Component),f=function(v,u){return typeof v=="function"?v(u):v},d=function(v,u){return typeof v=="string"?Object(k.c)(v,null,null,u):v},a=function(v){return v},c=H.a.forwardRef;typeof c=="undefined"&&(c=a);function o(b){return!!(b.metaKey||b.altKey||b.ctrlKey||b.shiftKey)}var s=c(function(b,v){var u=b.innerRef,_=b.navigate,m=b.onClick,y=Object(D.a)(b,["innerRef","navigate","onClick"]),P=y.target,M=Object(U.a)({},y,{onClick:function(W){try{m&&m(W)}catch(N){throw W.preventDefault(),N}!W.defaultPrevented&&W.button===0&&(!P||P==="_self")&&!o(W)&&(W.preventDefault(),_())}});return a!==c?M.ref=v||u:M.ref=u,H.a.createElement("a",M)}),l=c(function(b,v){var u=b.component,_=u===void 0?s:u,m=b.replace,y=b.to,P=b.innerRef,M=Object(D.a)(b,["component","replace","to","innerRef"]);return H.a.createElement(ee.e.Consumer,null,function(j){j||Object(L.a)(!1);var W=j.history,N=d(f(y,j.location),j.location),w=N?W.createHref(N):"",G=Object(U.a)({},M,{href:w,navigate:function(){var Z=f(y,j.location),ae=m?W.replace:W.push;ae(Z)}});return a!==c?G.ref=v||P:G.innerRef=P,H.a.createElement(_,G)})});if(!1)var h,R;var x=function(v){return v},T=H.a.forwardRef;typeof T=="undefined"&&(T=x);function O(){for(var b=arguments.length,v=new Array(b),u=0;u<b;u++)v[u]=arguments[u];return v.filter(function(_){return _}).join(" ")}var S=T(function(b,v){var u=b["aria-current"],_=u===void 0?"page":u,m=b.activeClassName,y=m===void 0?"active":m,P=b.activeStyle,M=b.className,j=b.exact,W=b.isActive,N=b.location,w=b.sensitive,G=b.strict,J=b.style,Z=b.to,ae=b.innerRef,_e=Object(D.a)(b,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return H.a.createElement(ee.e.Consumer,null,function(ce){ce||Object(L.a)(!1);var he=N||ce.location,fe=d(f(Z,he),he),pe=fe.pathname,se=pe&&pe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),de=se?Object(ee.f)(he.pathname,{path:se,exact:j,sensitive:w,strict:G}):null,Ee=!!(W?W(de,he):de),Pe=Ee?O(M,y):M,Se=Ee?Object(U.a)({},J,{},P):J,Je=Object(U.a)({"aria-current":Ee&&_||null,className:Pe,style:Se,to:fe},_e);return x!==T?Je.ref=v||ae:Je.innerRef=ae,H.a.createElement(l,Je)})});if(!1)var E},"5VLF":function(st,Qe,Q){"use strict";var ee,V;function I(H,k,C){var B=function(U,D){return H.js_beautify(U,D)};return B.js=H.js_beautify,B.css=k.css_beautify,B.html=C.html_beautify,B.js_beautify=H.js_beautify,B.css_beautify=k.css_beautify,B.html_beautify=C.html_beautify,B}!(ee=[Q("6UM0"),Q("TXwP"),Q("psGv")],V=function(H,k,C){return I(H,k,C)}.apply(Qe,ee),V!==void 0&&(st.exports=V))},"6UM0":function(st,Qe,Q){var ee,V;(function(){var I;(function(){"use strict";var k=[function(D,L,g){var p=g(1).Beautifier,f=g(5).Options;function d(a,c){var o=new p(a,c);return o.beautify()}D.exports=d,D.exports.defaultOptions=function(){return new f}},function(D,L,g){var p=g(2).Output,f=g(3).Token,d=g(4),a=g(5).Options,c=g(7).Tokenizer,o=g(7).line_starters,s=g(7).positionable_operators,l=g(7).TOKEN;function h(w,G){return G.indexOf(w)!==-1}function R(w){return w.replace(/^\s+/g,"")}function x(w){for(var G={},J=0;J<w.length;J++)G[w[J].replace(/-/g,"_")]=w[J];return G}function T(w,G){return w&&w.type===l.RESERVED&&w.text===G}function O(w,G){return w&&w.type===l.RESERVED&&h(w.text,G)}var S=["case","return","do","if","throw","else","await","break","continue","async"],E=["before-newline","after-newline","preserve-newline"],b=x(E),v=[b.before_newline,b.preserve_newline],u={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function _(w,G){if(G.multiline_frame||G.mode===u.ForInitializer||G.mode===u.Conditional)return;w.remove_indent(G.start_line_index)}function m(w){w=w.replace(d.allLineBreaks,`
|
|
`);for(var G=[],J=w.indexOf(`
|
|
`);J!==-1;)G.push(w.substring(0,J)),w=w.substring(J+1),J=w.indexOf(`
|
|
`);return w.length&&G.push(w),G}function y(w){return w===u.ArrayLiteral}function P(w){return h(w,[u.Expression,u.ForInitializer,u.Conditional])}function M(w,G){for(var J=0;J<w.length;J++){var Z=w[J].trim();if(Z.charAt(0)!==G)return!1}return!0}function j(w,G){for(var J=0,Z=w.length,ae;J<Z;J++)if(ae=w[J],ae&&ae.indexOf(G)!==0)return!1;return!0}function W(w,G){G=G||{},this._source_text=w||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new a(G)}W.prototype.create_flags=function(w,G){var J=0;w&&(J=w.indentation_level,!this._output.just_added_newline()&&w.line_indent_level>J&&(J=w.line_indent_level));var Z={mode:G,parent:w,last_token:w?w.last_token:new f(l.START_BLOCK,""),last_word:w?w.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:J,alignment:0,line_indent_level:w?w.line_indent_level:J,start_line_index:this._output.get_line_number(),ternary_depth:0};return Z},W.prototype._reset=function(w){var G=w.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new p(this._options,G),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(u.BlockStatement);var J=new c(w,this._options);return this._tokens=J.tokenize(),w},W.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var w,G=this._reset(this._source_text),J=this._options.eol;this._options.eol==="auto"&&(J=`
|
|
`,G&&d.lineBreak.test(G||"")&&(J=G.match(d.lineBreak)[0]));for(var Z=this._tokens.next();Z;)this.handle_token(Z),this._last_last_text=this._flags.last_token.text,this._flags.last_token=Z,Z=this._tokens.next();return w=this._output.get_code(J),w},W.prototype.handle_token=function(w,G){w.type===l.START_EXPR?this.handle_start_expr(w):w.type===l.END_EXPR?this.handle_end_expr(w):w.type===l.START_BLOCK?this.handle_start_block(w):w.type===l.END_BLOCK?this.handle_end_block(w):w.type===l.WORD?this.handle_word(w):w.type===l.RESERVED?this.handle_word(w):w.type===l.SEMICOLON?this.handle_semicolon(w):w.type===l.STRING?this.handle_string(w):w.type===l.EQUALS?this.handle_equals(w):w.type===l.OPERATOR?this.handle_operator(w):w.type===l.COMMA?this.handle_comma(w):w.type===l.BLOCK_COMMENT?this.handle_block_comment(w,G):w.type===l.COMMENT?this.handle_comment(w,G):w.type===l.DOT?this.handle_dot(w):w.type===l.EOF?this.handle_eof(w):w.type===l.UNKNOWN?this.handle_unknown(w,G):this.handle_unknown(w,G)},W.prototype.handle_whitespace_and_comments=function(w,G){var J=w.newlines,Z=this._options.keep_array_indentation&&y(this._flags.mode);if(w.comments_before)for(var ae=w.comments_before.next();ae;)this.handle_whitespace_and_comments(ae,G),this.handle_token(ae,G),ae=w.comments_before.next();if(Z)for(var _e=0;_e<J;_e+=1)this.print_newline(_e>0,G);else if(this._options.max_preserve_newlines&&J>this._options.max_preserve_newlines&&(J=this._options.max_preserve_newlines),this._options.preserve_newlines&&J>1){this.print_newline(!1,G);for(var ce=1;ce<J;ce+=1)this.print_newline(!0,G)}};var N=["async","break","continue","return","throw","yield"];W.prototype.allow_wrap_or_preserved_newline=function(w,G){if(G=G===void 0?!1:G,this._output.just_added_newline())return;var J=this._options.preserve_newlines&&w.newlines||G,Z=h(this._flags.last_token.text,s)||h(w.text,s);if(Z){var ae=h(this._flags.last_token.text,s)&&h(this._options.operator_position,v)||h(w.text,s);J=J&&ae}if(J)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(O(this._flags.last_token,N))return;this._output.set_wrap_point()}},W.prototype.print_newline=function(w,G){if(!G&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==l.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var J=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&T(J,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(w)&&(this._flags.multiline_frame=!0)},W.prototype.print_token_line_indentation=function(w){this._output.just_added_newline()&&(this._options.keep_array_indentation&&w.newlines&&(w.text==="["||y(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(w.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},W.prototype.print_token=function(w){if(this._output.raw){this._output.add_raw_token(w);return}if(this._options.comma_first&&w.previous&&w.previous.type===l.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var G=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(G),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(w),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(w),this._output.non_breaking_space=!0,this._output.add_token(w.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},W.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},W.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},W.prototype.set_mode=function(w){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,w),this._flags=this.create_flags(this._previous_flags,w),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},W.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===u.Statement&&_(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},W.prototype.start_of_object_property=function(){return this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"]))},W.prototype.start_of_statement=function(w){var G=!1;return G=G||O(this._flags.last_token,["var","let","const"])&&w.type===l.WORD,G=G||T(this._flags.last_token,"do"),G=G||!(this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement)&&O(this._flags.last_token,N)&&!w.newlines,G=G||T(this._flags.last_token,"else")&&!(T(w,"if")&&!w.comments_before),G=G||this._flags.last_token.type===l.END_EXPR&&(this._previous_flags.mode===u.ForInitializer||this._previous_flags.mode===u.Conditional),G=G||this._flags.last_token.type===l.WORD&&this._flags.mode===u.BlockStatement&&!this._flags.in_case&&!(w.text==="--"||w.text==="++")&&this._last_last_text!=="function"&&w.type!==l.WORD&&w.type!==l.RESERVED,G=G||this._flags.mode===u.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"])),G?(this.set_mode(u.Statement),this.indent(),this.handle_whitespace_and_comments(w,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(w,O(w,["do","for","if","while"])),!0):!1},W.prototype.handle_start_expr=function(w){this.start_of_statement(w)||this.handle_whitespace_and_comments(w);var G=u.Expression;if(w.text==="["){if(this._flags.last_token.type===l.WORD||this._flags.last_token.text===")"){O(this._flags.last_token,o)&&(this._output.space_before_token=!0),this.print_token(w),this.set_mode(G),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}G=u.ArrayLiteral,y(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),h(this._flags.last_token.type,[l.START_EXPR,l.END_EXPR,l.WORD,l.OPERATOR,l.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===l.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,G=u.ForInitializer):h(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,G=u.Conditional):h(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&w.whitespace_before===""?this._output.space_before_token=!1:(h(this._flags.last_token.text,o)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(w);else if(this._flags.last_token.type===l.WORD){this._output.space_before_token=!1;var J=this._tokens.peek(-3);if(this._options.space_after_named_function&&J){var Z=this._tokens.peek(-4);O(J,["async","function"])||J.text==="*"&&O(Z,["async","function"])?this._output.space_before_token=!0:this._flags.mode===u.ObjectLiteral?(J.text==="{"||J.text===","||J.text==="*"&&(Z.text==="{"||Z.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(w);(this._flags.last_token.type===l.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(h(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&h(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===l.START_BLOCK?this.print_newline():(this._flags.last_token.type===l.END_EXPR||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===l.COMMA)&&this.allow_wrap_or_preserved_newline(w,w.newlines),this.print_token(w),this.set_mode(G),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},W.prototype.handle_end_expr=function(w){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(w),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(w,w.text==="]"&&y(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===l.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(w),this.restore_mode(),_(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===u.Conditional&&(this._previous_flags.mode=u.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},W.prototype.handle_start_block=function(w){this.handle_whitespace_and_comments(w);var G=this._tokens.peek(),J=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===l.END_EXPR?(this.set_mode(u.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(u.BlockStatement):J&&(h(J.text,[":",","])&&h(G.type,[l.STRING,l.WORD,l.RESERVED])||h(G.text,["get","set","..."])&&h(J.type,[l.WORD,l.RESERVED]))?h(this._last_last_text,["class","interface"])&&!h(J.text,[":",","])?this.set_mode(u.BlockStatement):this.set_mode(u.ObjectLiteral):this._flags.last_token.type===l.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(u.BlockStatement):h(this._flags.last_token.type,[l.EQUALS,l.START_EXPR,l.COMMA,l.OPERATOR])||O(this._flags.last_token,["return","throw","import","default"])?this.set_mode(u.ObjectLiteral):this.set_mode(u.BlockStatement),this._flags.last_token&&(O(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var Z=!G.comments_before&&G.text==="}",ae=Z&&this._flags.last_word==="function"&&this._flags.last_token.type===l.END_EXPR;if(this._options.brace_preserve_inline){var _e=0,ce=null;this._flags.inline_frame=!0;do if(_e+=1,ce=this._tokens.peek(_e-1),ce.newlines){this._flags.inline_frame=!1;break}while(ce.type!==l.EOF&&!(ce.type===l.END_BLOCK&&ce.opened===w))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&w.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==l.OPERATOR&&(ae||this._flags.last_token.type===l.EQUALS||O(this._flags.last_token,S)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(y(this._previous_flags.mode)&&(this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.COMMA)&&((this._flags.last_token.type===l.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(w),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==l.OPERATOR&&this._flags.last_token.type!==l.START_EXPR&&(this._flags.last_token.type===l.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(w),this.indent(),!Z&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},W.prototype.handle_end_block=function(w){for(this.handle_whitespace_and_comments(w);this._flags.mode===u.Statement;)this.restore_mode();var G=this._flags.last_token.type===l.START_BLOCK;this._flags.inline_frame&&!G?this._output.space_before_token=!0:this._options.brace_style==="expand"?G||this.print_newline():G||(y(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(w)},W.prototype.handle_word=function(w){if(w.type===l.RESERVED){if(h(w.text,["set","get"])&&this._flags.mode!==u.ObjectLiteral)w.type=l.WORD;else if(w.text==="import"&&h(this._tokens.peek().text,["(","."]))w.type=l.WORD;else if(h(w.text,["as","from"])&&!this._flags.import_block)w.type=l.WORD;else if(this._flags.mode===u.ObjectLiteral){var G=this._tokens.peek();G.text===":"&&(w.type=l.WORD)}}if(this.start_of_statement(w)?O(this._flags.last_token,["var","let","const"])&&w.type===l.WORD&&(this._flags.declaration_statement=!0):w.newlines&&!P(this._flags.mode)&&(this._flags.last_token.type!==l.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==l.EQUALS&&(this._options.preserve_newlines||!O(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(w),this.print_newline()):this.handle_whitespace_and_comments(w),this._flags.do_block&&!this._flags.do_while)if(T(w,"while")){this._output.space_before_token=!0,this.print_token(w),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&T(w,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===u.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&O(w,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(w),this._flags.in_case=!0;return}if((this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(w)),T(w,"function")){(h(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(h(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===l.OPERATOR))&&(!this._output.just_added_blankline()&&!w.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD?O(this._flags.last_token,["get","set","new","export"])||O(this._flags.last_token,N)?this._output.space_before_token=!0:T(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===l.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(P(this._flags.mode)||y(this._flags.mode))||this.print_newline(),this.print_token(w),this._flags.last_word=w.text;return}var J="NONE";if(this._flags.last_token.type===l.END_BLOCK?this._previous_flags.inline_frame?J="SPACE":O(w,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&w.newlines?J="NEWLINE":(J="SPACE",this._output.space_before_token=!0):J="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&this._flags.mode===u.BlockStatement?J="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&P(this._flags.mode)?J="SPACE":this._flags.last_token.type===l.STRING?J="NEWLINE":this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD||this._flags.last_token.text==="*"&&(h(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&h(this._last_last_text,["{",","]))?J="SPACE":this._flags.last_token.type===l.START_BLOCK?this._flags.inline_frame?J="SPACE":J="NEWLINE":this._flags.last_token.type===l.END_EXPR&&(this._output.space_before_token=!0,J="NEWLINE"),O(w,o)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?J="SPACE":J="NEWLINE"),O(w,["else","catch","finally"]))if((!(this._flags.last_token.type===l.END_BLOCK&&this._previous_flags.mode===u.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&w.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var Z=this._output.current_line;Z.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else J==="NEWLINE"?O(this._flags.last_token,S)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&O(w,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==l.END_EXPR?(this._flags.last_token.type!==l.START_EXPR||!O(w,["var","let","const"]))&&this._flags.last_token.text!==":"&&(T(w,"if")&&T(w.previous,"else")?this._output.space_before_token=!0:this.print_newline()):O(w,o)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&y(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():J==="SPACE"&&(this._output.space_before_token=!0);w.previous&&(w.previous.type===l.WORD||w.previous.type===l.RESERVED)&&(this._output.space_before_token=!0),this.print_token(w),this._flags.last_word=w.text,w.type===l.RESERVED&&(w.text==="do"?this._flags.do_block=!0:w.text==="if"?this._flags.if_block=!0:w.text==="import"?this._flags.import_block=!0:this._flags.import_block&&T(w,"from")&&(this._flags.import_block=!1))},W.prototype.handle_semicolon=function(w){this.start_of_statement(w)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(w);for(var G=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&T(G,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(w)},W.prototype.handle_string=function(w){w.text.startsWith("`")&&w.newlines===0&&w.whitespace_before===""&&(w.previous.text===")"||this._flags.last_token.type===l.WORD)||(this.start_of_statement(w)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(w),this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(w):w.text.startsWith("`")&&this._flags.last_token.type===l.END_EXPR&&(w.previous.text==="]"||w.previous.text===")")&&w.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(w)},W.prototype.handle_equals=function(w){this.start_of_statement(w)||this.handle_whitespace_and_comments(w),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(w),this._output.space_before_token=!0},W.prototype.handle_comma=function(w){this.handle_whitespace_and_comments(w,!0),this.print_token(w),this._output.space_before_token=!0,this._flags.declaration_statement?(P(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(w)):this._flags.mode===u.ObjectLiteral||this._flags.mode===u.Statement&&this._flags.parent.mode===u.ObjectLiteral?(this._flags.mode===u.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(w)},W.prototype.handle_operator=function(w){var G=w.text==="*"&&(O(this._flags.last_token,["function","yield"])||h(this._flags.last_token.type,[l.START_BLOCK,l.COMMA,l.END_BLOCK,l.SEMICOLON])),J=h(w.text,["-","+"])&&(h(this._flags.last_token.type,[l.START_BLOCK,l.START_EXPR,l.EQUALS,l.OPERATOR])||h(this._flags.last_token.text,o)||this._flags.last_token.text===",");if(!this.start_of_statement(w)){var Z=!G;this.handle_whitespace_and_comments(w,Z)}if(w.text==="*"&&this._flags.last_token.type===l.DOT){this.print_token(w);return}if(w.text==="::"){this.print_token(w);return}if(this._flags.last_token.type===l.OPERATOR&&h(this._options.operator_position,v)&&this.allow_wrap_or_preserved_newline(w),w.text===":"&&this._flags.in_case){this.print_token(w),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==l.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var ae=!0,_e=!0,ce=!1;if(w.text===":"?this._flags.ternary_depth===0?ae=!1:(this._flags.ternary_depth-=1,ce=!0):w.text==="?"&&(this._flags.ternary_depth+=1),!J&&!G&&this._options.preserve_newlines&&h(w.text,s)){var he=w.text===":",fe=he&&ce,pe=he&&!ce;switch(this._options.operator_position){case b.before_newline:this._output.space_before_token=!pe,this.print_token(w),(!he||fe)&&this.allow_wrap_or_preserved_newline(w),this._output.space_before_token=!0;return;case b.after_newline:this._output.space_before_token=!0,!he||fe?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(w):this._output.space_before_token=!1,this.print_token(w),this._output.space_before_token=!0;return;case b.preserve_newline:pe||this.allow_wrap_or_preserved_newline(w),ae=!(this._output.just_added_newline()||pe),this._output.space_before_token=ae,this.print_token(w),this._output.space_before_token=!0;return}}if(G){this.allow_wrap_or_preserved_newline(w),ae=!1;var se=this._tokens.peek();_e=se&&h(se.type,[l.WORD,l.RESERVED])}else if(w.text==="...")this.allow_wrap_or_preserved_newline(w),ae=this._flags.last_token.type===l.START_BLOCK,_e=!1;else if(h(w.text,["--","++","!","~"])||J){if((this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR)&&this.allow_wrap_or_preserved_newline(w),ae=!1,_e=!1,w.newlines&&(w.text==="--"||w.text==="++"||w.text==="~")){var de=O(this._flags.last_token,S)&&w.newlines;de&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(de,!0)}this._flags.last_token.text===";"&&P(this._flags.mode)&&(ae=!0),this._flags.last_token.type===l.RESERVED?ae=!0:this._flags.last_token.type===l.END_EXPR?ae=!(this._flags.last_token.text==="]"&&(w.text==="--"||w.text==="++")):this._flags.last_token.type===l.OPERATOR&&(ae=h(w.text,["--","-","++","+"])&&h(this._flags.last_token.text,["--","-","++","+"]),h(w.text,["+","-"])&&h(this._flags.last_token.text,["--","++"])&&(_e=!0)),(this._flags.mode===u.BlockStatement&&!this._flags.inline_frame||this._flags.mode===u.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||ae,this.print_token(w),this._output.space_before_token=_e},W.prototype.handle_block_comment=function(w,G){if(this._output.raw){this._output.add_raw_token(w),w.directives&&w.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(w.directives){this.print_newline(!1,G),this.print_token(w),w.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!d.newline.test(w.text)&&!w.newlines){this._output.space_before_token=!0,this.print_token(w),this._output.space_before_token=!0;return}else this.print_block_commment(w,G)},W.prototype.print_block_commment=function(w,G){var J=m(w.text),Z,ae=!1,_e=!1,ce=w.whitespace_before,he=ce.length;if(this.print_newline(!1,G),this.print_token_line_indentation(w),this._output.add_token(J[0]),this.print_newline(!1,G),J.length>1){for(J=J.slice(1),ae=M(J,"*"),_e=j(J,ce),ae&&(this._flags.alignment=1),Z=0;Z<J.length;Z++)ae?(this.print_token_line_indentation(w),this._output.add_token(R(J[Z]))):_e&&J[Z]?(this.print_token_line_indentation(w),this._output.add_token(J[Z].substring(he))):(this._output.current_line.set_indent(-1),this._output.add_token(J[Z])),this.print_newline(!1,G);this._flags.alignment=0}},W.prototype.handle_comment=function(w,G){w.newlines?this.print_newline(!1,G):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(w),this.print_newline(!1,G)},W.prototype.handle_dot=function(w){this.start_of_statement(w)||this.handle_whitespace_and_comments(w,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),O(this._flags.last_token,S)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(w,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(w)},W.prototype.handle_unknown=function(w,G){this.print_token(w),w.text[w.text.length-1]===`
|
|
`&&this.print_newline(!1,G)},W.prototype.handle_eof=function(w){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(w)},D.exports.Beautifier=W},function(D){function L(f){this.__parent=f,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}L.prototype.clone_empty=function(){var f=new L(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},L.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},L.prototype.has_match=function(f){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(f))return!0;return!1},L.prototype.set_indent=function(f,d){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},L.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},L.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},L.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},L.prototype.is_empty=function(){return this.__items.length===0},L.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},L.prototype.push=function(f){this.__items.push(f);var d=f.lastIndexOf(`
|
|
`);d!==-1?this.__character_count=f.length-d:this.__character_count+=f.length},L.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},L.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},L.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},L.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},L.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function g(f,d){this.__cache=[""],this.__indent_size=f.indent_size,this.__indent_string=f.indent_char,f.indent_with_tabs||(this.__indent_string=new Array(f.indent_size+1).join(f.indent_char)),d=d||"",f.indent_level>0&&(d=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}g.prototype.get_indent_size=function(f,d){var a=this.__base_string_length;return d=d||0,f<0&&(a=0),a+=f*this.__indent_size,a+=d,a},g.prototype.get_indent_string=function(f,d){var a=this.__base_string;return d=d||0,f<0&&(f=0,a=""),d+=f*this.__indent_size,this.__ensure_cache(d),a+=this.__cache[d],a},g.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var f=this.__cache.length,d=0,a="";this.__indent_size&&f>=this.__indent_size&&(d=Math.floor(f/this.__indent_size),f-=d*this.__indent_size,a=new Array(d+1).join(this.__indent_string)),f&&(a+=new Array(f+1).join(" ")),this.__cache.push(a)};function p(f,d){this.__indent_cache=new g(f,d),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new L(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,d){return this.__indent_cache.get_indent_string(f,d)},p.prototype.get_indent_size=function(f,d){return this.__indent_cache.get_indent_size(f,d)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(f){this.trim(!0);var d=this.current_line.pop();d&&(d[d.length-1]===`
|
|
`&&(d=d.replace(/\n+$/g,"")),this.current_line.push(d)),this._end_with_newline&&this.__add_outputline();var a=this.__lines.join(`
|
|
`);return f!==`
|
|
`&&(a=a.replace(/[\n]/g,f)),a},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,d){return f=f||0,d=d||0,this.next_line.set_indent(f,d),this.__lines.length>1?(this.current_line.set_indent(f,d),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var d=0;d<f.newlines;d++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(f.whitespace_before),this.current_line.push(f.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(f){this.__add_space_before_token(),this.current_line.push(f),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(f){for(var d=this.__lines.length;f<d;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(f){for(f=f===void 0?!1:f,this.current_line.trim();f&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,d){for(var a=this.__lines.length-2;a>=0;){var c=this.__lines[a];if(c.is_empty())break;if(c.item(0).indexOf(f)!==0&&c.item(-1)!==d){this.__lines.splice(a+1,0,new L(this)),this.previous_line=this.__lines[this.__lines.length-2];break}a--}},D.exports.Output=p},function(D){function L(g,p,f,d){this.type=g,this.text=p,this.comments_before=null,this.newlines=f||0,this.whitespace_before=d||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}D.exports.Token=L},function(D,L){var g="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",f="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",d="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",a="(?:\\\\u[0-9a-fA-F]{4}|["+g+f+"])",c="(?:\\\\u[0-9a-fA-F]{4}|["+p+f+d+"])*";L.identifier=new RegExp(a+c,"g"),L.identifierStart=new RegExp(a),L.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+f+d+"])+");var o=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;L.newline=/[\n\r\u2028\u2029]/,L.lineBreak=new RegExp(`\r
|
|
|`+L.newline.source),L.allLineBreaks=new RegExp(L.lineBreak.source,"g")},function(D,L,g){var p=g(6).Options,f=["before-newline","after-newline","preserve-newline"];function d(a){p.call(this,a,"js");var c=this.raw_options.brace_style||null;c==="expand-strict"?this.raw_options.brace_style="expand":c==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var o=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var s=0;s<o.length;s++)o[s]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=o[s];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",f),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}d.prototype=new p,D.exports.Options=d},function(D){function L(f,d){this.raw_options=g(f,d),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}L.prototype._get_array=function(f,d){var a=this.raw_options[f],c=d||[];return typeof a=="object"?a!==null&&typeof a.concat=="function"&&(c=a.concat()):typeof a=="string"&&(c=a.split(/[^a-zA-Z0-9_\/\-]+/)),c},L.prototype._get_boolean=function(f,d){var a=this.raw_options[f],c=a===void 0?!!d:!!a;return c},L.prototype._get_characters=function(f,d){var a=this.raw_options[f],c=d||"";return typeof a=="string"&&(c=a.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),c},L.prototype._get_number=function(f,d){var a=this.raw_options[f];d=parseInt(d,10),isNaN(d)&&(d=0);var c=parseInt(a,10);return isNaN(c)&&(c=d),c},L.prototype._get_selection=function(f,d,a){var c=this._get_selection_list(f,d,a);if(c.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[f]+"'");return c[0]},L.prototype._get_selection_list=function(f,d,a){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(a=a||[d[0]],!this._is_valid_selection(a,d))throw new Error("Invalid Default Value!");var c=this._get_array(f,a);if(!this._is_valid_selection(c,d))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[f]+"'");return c},L.prototype._is_valid_selection=function(f,d){return f.length&&d.length&&!f.some(function(a){return d.indexOf(a)===-1})};function g(f,d){var a={};f=p(f);var c;for(c in f)c!==d&&(a[c]=f[c]);if(d&&f[d])for(c in f[d])a[c]=f[d][c];return a}function p(f){var d={},a;for(a in f){var c=a.replace(/-/g,"_");d[c]=f[a]}return d}D.exports.Options=L,D.exports.normalizeOpts=p,D.exports.mergeOpts=g},function(D,L,g){var p=g(8).InputScanner,f=g(9).Tokenizer,d=g(9).TOKEN,a=g(13).Directives,c=g(4),o=g(12).Pattern,s=g(14).TemplatablePattern;function l(M,j){return j.indexOf(M)!==-1}var h={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:d.START,RAW:d.RAW,EOF:d.EOF},R=new a(/\/\*/,/\*\//),x=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,T=/[0-9]/,O=/[^\d\.]/,S=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),E=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";E=E.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),E="\\?\\.(?!\\d) "+E,E=E.replace(/ /g,"|");var b=new RegExp(E),v="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),u=v.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),_=new RegExp("^(?:"+u.join("|")+")$"),m,y=function(M,j){f.call(this,M,j),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var W=new o(this._input),N=new s(this._input).read_options(this._options);this.__patterns={template:N,identifier:N.starting_with(c.identifier).matching(c.identifierMatch),number:W.matching(x),punct:W.matching(b),comment:W.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:W.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:W.matching(/<!--/),html_comment_end:W.matching(/-->/),include:W.starting_with(/#include/).until_after(c.lineBreak),shebang:W.starting_with(/#!/).until_after(c.lineBreak),xml:W.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:N.until(/['\\\n\r\u2028\u2029]/),double_quote:N.until(/["\\\n\r\u2028\u2029]/),template_text:N.until(/[`\\$]/),template_expression:N.until(/[`}\\]/)}};y.prototype=new f,y.prototype._is_comment=function(M){return M.type===h.COMMENT||M.type===h.BLOCK_COMMENT||M.type===h.UNKNOWN},y.prototype._is_opening=function(M){return M.type===h.START_BLOCK||M.type===h.START_EXPR},y.prototype._is_closing=function(M,j){return(M.type===h.END_BLOCK||M.type===h.END_EXPR)&&j&&(M.text==="]"&&j.text==="["||M.text===")"&&j.text==="("||M.text==="}"&&j.text==="{")},y.prototype._reset=function(){m=!1},y.prototype._get_next_token=function(M,j){var W=null;this._readWhitespace();var N=this._input.peek();return N===null?this._create_token(h.EOF,""):(W=W||this._read_non_javascript(N),W=W||this._read_string(N),W=W||this._read_word(M),W=W||this._read_singles(N),W=W||this._read_comment(N),W=W||this._read_regexp(N,M),W=W||this._read_xml(N,M),W=W||this._read_punctuation(),W=W||this._create_token(h.UNKNOWN,this._input.next()),W)},y.prototype._read_word=function(M){var j;if(j=this.__patterns.identifier.read(),j!=="")return j=j.replace(c.allLineBreaks,`
|
|
`),!(M.type===h.DOT||M.type===h.RESERVED&&(M.text==="set"||M.text==="get"))&&_.test(j)?(j==="in"||j==="of")&&(M.type===h.WORD||M.type===h.STRING)?this._create_token(h.OPERATOR,j):this._create_token(h.RESERVED,j):this._create_token(h.WORD,j);if(j=this.__patterns.number.read(),j!=="")return this._create_token(h.WORD,j)},y.prototype._read_singles=function(M){var j=null;return M==="("||M==="["?j=this._create_token(h.START_EXPR,M):M===")"||M==="]"?j=this._create_token(h.END_EXPR,M):M==="{"?j=this._create_token(h.START_BLOCK,M):M==="}"?j=this._create_token(h.END_BLOCK,M):M===";"?j=this._create_token(h.SEMICOLON,M):M==="."&&O.test(this._input.peek(1))?j=this._create_token(h.DOT,M):M===","&&(j=this._create_token(h.COMMA,M)),j&&this._input.next(),j},y.prototype._read_punctuation=function(){var M=this.__patterns.punct.read();if(M!=="")return M==="="?this._create_token(h.EQUALS,M):M==="?."?this._create_token(h.DOT,M):this._create_token(h.OPERATOR,M)},y.prototype._read_non_javascript=function(M){var j="";if(M==="#"){if(this._is_first_token()&&(j=this.__patterns.shebang.read(),j))return this._create_token(h.UNKNOWN,j.trim()+`
|
|
`);if(j=this.__patterns.include.read(),j)return this._create_token(h.UNKNOWN,j.trim()+`
|
|
`);M=this._input.next();var W="#";if(this._input.hasNext()&&this._input.testChar(T)){do M=this._input.next(),W+=M;while(this._input.hasNext()&&M!=="#"&&M!=="=");return M==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(W+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(W+="{}",this._input.next(),this._input.next())),this._create_token(h.WORD,W)}this._input.back()}else if(M==="<"&&this._is_first_token()){if(j=this.__patterns.html_comment_start.read(),j){for(;this._input.hasNext()&&!this._input.testChar(c.newline);)j+=this._input.next();return m=!0,this._create_token(h.COMMENT,j)}}else if(m&&M==="-"&&(j=this.__patterns.html_comment_end.read(),j))return m=!1,this._create_token(h.COMMENT,j);return null},y.prototype._read_comment=function(M){var j=null;if(M==="/"){var W="";if(this._input.peek(1)==="*"){W=this.__patterns.block_comment.read();var N=R.get_directives(W);N&&N.ignore==="start"&&(W+=R.readIgnored(this._input)),W=W.replace(c.allLineBreaks,`
|
|
`),j=this._create_token(h.BLOCK_COMMENT,W),j.directives=N}else this._input.peek(1)==="/"&&(W=this.__patterns.comment.read(),j=this._create_token(h.COMMENT,W))}return j},y.prototype._read_string=function(M){if(M==="`"||M==="'"||M==='"'){var j=this._input.next();return this.has_char_escapes=!1,M==="`"?j+=this._read_string_recursive("`",!0,"${"):j+=this._read_string_recursive(M),this.has_char_escapes&&this._options.unescape_strings&&(j=P(j)),this._input.peek()===M&&(j+=this._input.next()),j=j.replace(c.allLineBreaks,`
|
|
`),this._create_token(h.STRING,j)}return null},y.prototype._allow_regexp_or_xml=function(M){return M.type===h.RESERVED&&l(M.text,["return","case","throw","else","do","typeof","yield"])||M.type===h.END_EXPR&&M.text===")"&&M.opened.previous.type===h.RESERVED&&l(M.opened.previous.text,["if","while","for"])||l(M.type,[h.COMMENT,h.START_EXPR,h.START_BLOCK,h.START,h.END_BLOCK,h.OPERATOR,h.EQUALS,h.EOF,h.SEMICOLON,h.COMMA])},y.prototype._read_regexp=function(M,j){if(M==="/"&&this._allow_regexp_or_xml(j)){for(var W=this._input.next(),N=!1,w=!1;this._input.hasNext()&&(N||w||this._input.peek()!==M)&&!this._input.testChar(c.newline);)W+=this._input.peek(),N?N=!1:(N=this._input.peek()==="\\",this._input.peek()==="["?w=!0:this._input.peek()==="]"&&(w=!1)),this._input.next();return this._input.peek()===M&&(W+=this._input.next(),W+=this._input.read(c.identifier)),this._create_token(h.STRING,W)}return null},y.prototype._read_xml=function(M,j){if(this._options.e4x&&M==="<"&&this._allow_regexp_or_xml(j)){var W="",N=this.__patterns.xml.read_match();if(N){for(var w=N[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),G=w.indexOf("{")===0,J=0;N;){var Z=!!N[1],ae=N[2],_e=!!N[N.length-1]||ae.slice(0,8)==="![CDATA[";if(!_e&&(ae===w||G&&ae.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(Z?--J:++J),W+=N[0],J<=0)break;N=this.__patterns.xml.read_match()}return N||(W+=this._input.match(/[\s\S]*/g)[0]),W=W.replace(c.allLineBreaks,`
|
|
`),this._create_token(h.STRING,W)}}return null};function P(M){for(var j="",W=0,N=new p(M),w=null;N.hasNext();)if(w=N.match(/([\s]|[^\\]|\\\\)+/g),w&&(j+=w[0]),N.peek()==="\\"){if(N.next(),N.peek()==="x")w=N.match(/x([0-9A-Fa-f]{2})/g);else if(N.peek()==="u")w=N.match(/u([0-9A-Fa-f]{4})/g);else{j+="\\",N.hasNext()&&(j+=N.next());continue}if(!w)return M;if(W=parseInt(w[1],16),W>126&&W<=255&&w[0].indexOf("x")===0)return M;if(W>=0&&W<32){j+="\\"+w[0];continue}else W===34||W===39||W===92?j+="\\"+String.fromCharCode(W):j+=String.fromCharCode(W)}return j}y.prototype._read_string_recursive=function(M,j,W){var N,w;M==="'"?w=this.__patterns.single_quote:M==='"'?w=this.__patterns.double_quote:M==="`"?w=this.__patterns.template_text:M==="}"&&(w=this.__patterns.template_expression);for(var G=w.read(),J="";this._input.hasNext();){if(J=this._input.next(),J===M||!j&&c.newline.test(J)){this._input.back();break}else J==="\\"&&this._input.hasNext()?(N=this._input.peek(),N==="x"||N==="u"?this.has_char_escapes=!0:N==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),J+=this._input.next()):W&&(W==="${"&&J==="$"&&this._input.peek()==="{"&&(J+=this._input.next()),W===J&&(M==="`"?J+=this._read_string_recursive("}",j,"`"):J+=this._read_string_recursive("`",j,"${"),this._input.hasNext()&&(J+=this._input.next())));J+=w.read(),G+=J}return G},D.exports.Tokenizer=y,D.exports.TOKEN=h,D.exports.positionable_operators=S.slice(),D.exports.line_starters=v.slice()},function(D){var L=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},g.prototype.peek=function(p){var f=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(f=this.__input.charAt(p)),f},g.prototype.__match=function(p,f){p.lastIndex=f;var d=p.exec(this.__input);return d&&!(L&&p.sticky)&&(d.index!==f&&(d=null)),d},g.prototype.test=function(p,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(p,f):!1},g.prototype.testChar=function(p,f){var d=this.peek(f);return p.lastIndex=0,d!==null&&p.test(d)},g.prototype.match=function(p){var f=this.__match(p,this.__position);return f?this.__position+=f[0].length:f=null,f},g.prototype.read=function(p,f,d){var a="",c;return p&&(c=this.match(p),c&&(a+=c[0])),f&&(c||!p)&&(a+=this.readUntil(f,d)),a},g.prototype.readUntil=function(p,f){var d="",a=this.__position;p.lastIndex=this.__position;var c=p.exec(this.__input);return c?(a=c.index,f&&(a+=c[0].length)):a=this.__input_length,d=this.__input.substring(this.__position,a),this.__position=a,d},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var d=null,a="g";return f&&L&&(a="y"),typeof p=="string"&&p!==""?d=new RegExp(p,a):p&&(d=new RegExp(p.source,a)),d},g.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(p){var f=this.__position,d=this.readUntilAfter(p);return this.__position=f,d},g.prototype.lookBack=function(p){var f=this.__position-1;return f>=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},D.exports.InputScanner=g},function(D,L,g){var p=g(8).InputScanner,f=g(3).Token,d=g(10).TokenStream,a=g(11).WhitespacePattern,c={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},o=function(s,l){this._input=new p(s),this._options=l||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new a(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var s,l=new f(c.START,""),h=null,R=[],x=new d;l.type!==c.EOF;){for(s=this._get_next_token(l,h);this._is_comment(s);)x.add(s),s=this._get_next_token(l,h);x.isEmpty()||(s.comments_before=x,x=new d),s.parent=h,this._is_opening(s)?(R.push(h),h=s):h&&this._is_closing(s,h)&&(s.opened=h,h.closed=s,h=R.pop(),s.parent=h),s.previous=l,l.next=s,this.__tokens.add(s),l=s}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(s,l){this._readWhitespace();var h=this._input.read(/.+/g);return h?this._create_token(c.RAW,h):this._create_token(c.EOF,"")},o.prototype._is_comment=function(s){return!1},o.prototype._is_opening=function(s){return!1},o.prototype._is_closing=function(s,l){return!1},o.prototype._create_token=function(s,l){var h=new f(s,l,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return h},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},D.exports.Tokenizer=o,D.exports.TOKEN=c},function(D){function L(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}L.prototype.restart=function(){this.__position=0},L.prototype.isEmpty=function(){return this.__tokens_length===0},L.prototype.hasNext=function(){return this.__position<this.__tokens_length},L.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__tokens[this.__position],this.__position+=1),g},L.prototype.peek=function(g){var p=null;return g=g||0,g+=this.__position,g>=0&&g<this.__tokens_length&&(p=this.__tokens[g]),p},L.prototype.add=function(g){this.__parent_token&&(g.parent=this.__parent_token),this.__tokens.push(g),this.__tokens_length+=1},D.exports.TokenStream=L},function(D,L,g){var p=g(12).Pattern;function f(d,a){p.call(this,d,a),a?this._line_regexp=this._input.get_regexp(a._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}f.prototype=new p,f.prototype.__set_whitespace_patterns=function(d,a){d+="\\t ",a+="\\n\\r",this._match_pattern=this._input.get_regexp("["+d+a+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+a+"]")},f.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var d=this._input.read(this._match_pattern);if(d===" ")this.whitespace_before_token=" ";else if(d){var a=this.__split(this._newline_regexp,d);this.newline_count=a.length-1,this.whitespace_before_token=a[this.newline_count]}return d},f.prototype.matching=function(d,a){var c=this._create();return c.__set_whitespace_patterns(d,a),c._update(),c},f.prototype._create=function(){return new f(this._input,this)},f.prototype.__split=function(d,a){d.lastIndex=0;for(var c=0,o=[],s=d.exec(a);s;)o.push(a.substring(c,s.index)),c=s.index+s[0].length,s=d.exec(a);return c<a.length?o.push(a.substring(c,a.length)):o.push(""),o},D.exports.WhitespacePattern=f},function(D){function L(g,p){this._input=g,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,p&&(this._starting_pattern=this._input.get_regexp(p._starting_pattern,!0),this._match_pattern=this._input.get_regexp(p._match_pattern,!0),this._until_pattern=this._input.get_regexp(p._until_pattern),this._until_after=p._until_after)}L.prototype.read=function(){var g=this._input.read(this._starting_pattern);return(!this._starting_pattern||g)&&(g+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),g},L.prototype.read_match=function(){return this._input.match(this._match_pattern)},L.prototype.until_after=function(g){var p=this._create();return p._until_after=!0,p._until_pattern=this._input.get_regexp(g),p._update(),p},L.prototype.until=function(g){var p=this._create();return p._until_after=!1,p._until_pattern=this._input.get_regexp(g),p._update(),p},L.prototype.starting_with=function(g){var p=this._create();return p._starting_pattern=this._input.get_regexp(g,!0),p._update(),p},L.prototype.matching=function(g){var p=this._create();return p._match_pattern=this._input.get_regexp(g,!0),p._update(),p},L.prototype._create=function(){return new L(this._input,this)},L.prototype._update=function(){},D.exports.Pattern=L},function(D){function L(g,p){g=typeof g=="string"?g:g.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+p,"g")}L.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(g);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(g);return p},L.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},D.exports.Directives=L},function(D,L,g){var p=g(12).Pattern,f={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function d(a,c){p.call(this,a,c),this.__template_pattern=null,this._disabled=Object.assign({},f),this._excluded=Object.assign({},f),c&&(this.__template_pattern=this._input.get_regexp(c.__template_pattern),this._excluded=Object.assign(this._excluded,c._excluded),this._disabled=Object.assign(this._disabled,c._disabled));var o=new p(a);this.__patterns={handlebars_comment:o.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:o.starting_with(/{{{/).until_after(/}}}/),handlebars:o.starting_with(/{{/).until_after(/}}/),php:o.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:o.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:o.starting_with(/{%/).until_after(/%}/),django_value:o.starting_with(/{{/).until_after(/}}/),django_comment:o.starting_with(/{#/).until_after(/#}/),smarty:o.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:o.starting_with(/{\*/).until_after(/\*}/),smarty_literal:o.starting_with(/{literal}/).until_after(/{\/literal}/)}}d.prototype=new p,d.prototype._create=function(){return new d(this._input,this)},d.prototype._update=function(){this.__set_templated_pattern()},d.prototype.disable=function(a){var c=this._create();return c._disabled[a]=!0,c._update(),c},d.prototype.read_options=function(a){var c=this._create();for(var o in f)c._disabled[o]=a.templating.indexOf(o)===-1;return c._update(),c},d.prototype.exclude=function(a){var c=this._create();return c._excluded[a]=!0,c._update(),c},d.prototype.read=function(){var a="";this._match_pattern?a=this._input.read(this._starting_pattern):a=this._input.read(this._starting_pattern,this.__template_pattern);for(var c=this._read_template();c;)this._match_pattern?c+=this._input.read(this._match_pattern):c+=this._input.readUntil(this.__template_pattern),a+=c,c=this._read_template();return this._until_after&&(a+=this._input.readUntilAfter(this._until_pattern)),a},d.prototype.__set_templated_pattern=function(){var a=[];this._disabled.php||a.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||a.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||a.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(a.push(this.__patterns.django._starting_pattern.source),a.push(this.__patterns.django_value._starting_pattern.source),a.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||a.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&a.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+a.join("|")+")")},d.prototype._read_template=function(){var a="",c=this._input.peek();if(c==="<"){var o=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&o==="?"&&(a=a||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&o==="%"&&(a=a||this.__patterns.erb.read())}else c==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(a=a||this.__patterns.handlebars_comment.read(),a=a||this.__patterns.handlebars_unescaped.read(),a=a||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(a=a||this.__patterns.django_value.read()),this._excluded.django||(a=a||this.__patterns.django_comment.read(),a=a||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(a=a||this.__patterns.smarty_comment.read(),a=a||this.__patterns.smarty_literal.read(),a=a||this.__patterns.smarty.read()));return a},D.exports.TemplatablePattern=d}],C={};function B(D){var L=C[D];if(L!==void 0)return L.exports;var g=C[D]={exports:{}};return k[D](g,g.exports,B),g.exports}var U=B(0);I=U})();var H=I;!(ee=[],V=function(){return{js_beautify:H}}.apply(Qe,ee),V!==void 0&&(st.exports=V))})()},"7Cbv":function(st,Qe,Q){"use strict";var ee=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),V=new Uint8Array(16);function I(){if(!ee)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ee(V)}var H=/^(?:[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 k(f){return typeof f=="string"&&H.test(f)}for(var C=k,B=[],U=0;U<256;++U)B.push((U+256).toString(16).substr(1));function D(f){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=(B[f[d+0]]+B[f[d+1]]+B[f[d+2]]+B[f[d+3]]+"-"+B[f[d+4]]+B[f[d+5]]+"-"+B[f[d+6]]+B[f[d+7]]+"-"+B[f[d+8]]+B[f[d+9]]+"-"+B[f[d+10]]+B[f[d+11]]+B[f[d+12]]+B[f[d+13]]+B[f[d+14]]+B[f[d+15]]).toLowerCase();if(!C(a))throw TypeError("Stringified UUID is invalid");return a}var L=D;function g(f,d,a){f=f||{};var c=f.random||(f.rng||I)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,d){a=a||0;for(var o=0;o<16;++o)d[a+o]=c[o];return d}return L(c)}var p=Qe.a=g},"7ahc":function(st,Qe,Q){"use strict";Q.d(Qe,"a",function(){return R});var ee=Q("k1fw"),V=Q("0Owb"),I=Q("+L6B"),H=Q("2/Rp"),k=Q("y8nQ"),C=Q("Vl3Y"),B=Q("tJVT"),U=Q("OaEy"),D=Q("2fM7"),L=Q("cDcd"),g=Q.n(L),p=Q("VrN/"),f=Q.n(p),d=Q("p77/"),a=Q.n(d),c=Q("c5Ni"),o=Q.n(c),s=D.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},h={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Qe.b=function(x){var T=x.callback,O=x.onCancel,S=Object(L.useState)("python"),E=Object(B.a)(S,2),b=E[0],v=E[1];function u(m){v(h[m][1])}function _(m){T(m)}return g.a.createElement(C.a,Object(V.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:_}),g.a.createElement(C.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(D.a,{onChange:u},Object.keys(h).map(function(m){return g.a.createElement(s,{key:m,value:m},h[m][0])}))),g.a.createElement(C.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(R,{mode:b})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(H.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function R(x){var T=x.value,O=x.onChange,S=x.mode,E=x.options,b=E===void 0?{}:E,v=Object(L.useRef)(),u=Object(L.useState)(),_=Object(B.a)(u,2),m=_[0],y=_[1];return Object(L.useEffect)(function(){if(m){function P(M){var j=M.getValue();O&&O(j)}return m.on("change",P),function(){m.off("change",P)}}},[m,O]),Object(L.useEffect)(function(){m&&m.setOption("mode",S)},[m,S]),Object(L.useEffect)(function(){m&&((T!==m.getValue()||T==="")&&setTimeout(function(){m.setValue(T||" ")},300))},[m,T]),Object(L.useEffect)(function(){if(v.current&&!m){var P=f.a.fromTextArea(v.current,Object(ee.a)({mode:S,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},b));y(P)}},[v.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:v}))}},"8EBN":function(st,Qe,Q){(function(ee){ee(Q("VrN/"))})(function(ee){"use strict";ee.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var V=0;V<ee.modeInfo.length;V++){var I=ee.modeInfo[V];I.mimes&&(I.mime=I.mimes[0])}ee.findModeByMIME=function(H){H=H.toLowerCase();for(var k=0;k<ee.modeInfo.length;k++){var C=ee.modeInfo[k];if(C.mime==H)return C;if(C.mimes){for(var B=0;B<C.mimes.length;B++)if(C.mimes[B]==H)return C}}if(/\+xml$/.test(H))return ee.findModeByMIME("application/xml");if(/\+json$/.test(H))return ee.findModeByMIME("application/json")},ee.findModeByExtension=function(H){H=H.toLowerCase();for(var k=0;k<ee.modeInfo.length;k++){var C=ee.modeInfo[k];if(C.ext){for(var B=0;B<C.ext.length;B++)if(C.ext[B]==H)return C}}},ee.findModeByFileName=function(H){for(var k=0;k<ee.modeInfo.length;k++){var C=ee.modeInfo[k];if(C.file&&C.file.test(H))return C}var B=H.lastIndexOf("."),U=B>-1&&H.substring(B+1,H.length);if(U)return ee.findModeByExtension(U)},ee.findModeByName=function(H){H=H.toLowerCase();for(var k=0;k<ee.modeInfo.length;k++){var C=ee.modeInfo[k];if(C.name.toLowerCase()==H)return C;if(C.alias){for(var B=0;B<C.alias.length;B++)if(C.alias[B].toLowerCase()==H)return C}}}})},"8JLL":function(st,Qe,Q){st.exports={flex_box_center:"flex_box_center___15KPT",flex_space_between:"flex_space_between___1QiSE",flex_box_vertical_center:"flex_box_vertical_center___3bNXy",flex_box_center_end:"flex_box_center_end___1hLE4",flex_box_column:"flex_box_column___3CCm3",reply:"reply___eY1t0",replyList:"replyList___3g6Og",comment:"comment___LHpQl",content:"content___XWl90",commentItem:"commentItem___2Y_u_"}},"8hTe":function(st,Qe,Q){st.exports={button:"button___1wy9m"}},"9Bee":function(st,Qe,Q){"use strict";var ee=Q("DYRE"),V=Q("zeV3"),I=Q("+L6B"),H=Q("2/Rp"),k=Q("k1fw"),C=Q("tJVT"),B=Q("cDcd"),U=Q.n(B),D=Q("vg9a"),L=Q("DlQD"),g=Q.n(L),p=Q("rUJ1");function f(he,fe){var pe=he.match(/^(\s+)(?:```)/);if(pe===null)return fe;var se=pe[1];return fe.split(`
|
|
`).map(function(de){var Ee=de.match(/^\s+/);if(Ee===null)return de;var Pe=Object(C.a)(Ee,1),Se=Pe[0];return Se.length>=se.length?de.slice(se.length):de}).join(`
|
|
`)}var d=[],a=["<ul>"],c=new g.a.Renderer,o=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function s(){d.length=0,a=["<ul>"]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function h(he,fe,pe,se){if(fe>=he.length||he[fe].level<=pe)return fe;var de=he[fe];se.push("<li><a href='#"+de.anchor+"'>"+de.text+"</a>"),fe++;var Ee=[];return fe=h(he,fe,de.level,Ee),Ee.length>0&&(se.push("<ul>"),Ee.forEach(function(Pe){se.push(Pe)}),se.push("</ul>")),se.push("</li>"),fe=h(he,fe,pe,se),fe}function R(){return h(d,0,0,a),a.push("</ul>"),a.join("")}var x={heading:function(fe){var pe=o.exec(fe);if(pe)return{type:"heading",raw:pe[0],depth:pe[1].length,text:pe[2]}},fences:function(fe){var pe=this.rules.block.fences.exec(fe);if(pe){var se=pe[0],de=f(se,pe[3]||""),Ee=pe[2]?pe[2].trim():pe[2];if(["latex","katex","math"].indexOf(Ee)>=0){var Pe=S(),Se=de;de=Pe,E[Pe]={type:"block",expression:Se}}return{type:"code",raw:se,lang:Ee,text:de}}}},T=/(?:\${2})([^\n`]+?)(?:\${2})/gi,O=0,S=function(){return"__special_katext_id_".concat(O++,"__")},E={};function b(){return E}function v(){O=0,E={}}function u(he){return he=he.replace(T,function(fe,pe){var se=S();return E[se]={type:"inline",expression:pe},se}),he}var _=c.listitem;c.listitem=function(he){return _(u(he))};var m=c.paragraph;c.paragraph=function(he){return m(u(he))};var y=c.tablecell;c.tablecell=function(he,fe){return y(u(he),fe)},c.code=function(he,fe,pe){var se=(fe||"").match(/\S*/)[0];return se?["latex","katex","math"].indexOf(se)>=0?"<p class='editormd-tex'>".concat(he,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(fe,'">').concat(pe?he:Object(p.escape)(he,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(pe?he:Object(p.escape)(he,!0))+"</code></pre>"},c.heading=function(he,fe,pe){var se=this.options.headerPrefix+pe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:se,level:fe,text:he}),"<h"+fe+' id="'+se+'">'+he+"</h"+fe+">"},g.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),g.a.use({tokenizer:x,renderer:c});var P=g.a,M=Q("SJMd"),j=Q("ulZh"),W=Q.n(j),N=Q("m3rI"),w=Q("Oy/b"),G=Q("p5ED"),J=Q("8hTe"),Z=Q.n(J),ae=/<pre[^>]*>/g;function _e(he){var fe=document.createElement("div");return fe.innerHTML=he,fe.childNodes.length===0?"":fe.childNodes[0].nodeValue}var ce=Qe.a=function(he){var fe=he.value,pe=fe===void 0?"":fe,se=he.edit,de=se===void 0?!1:se,Ee=he.className,Pe=he.showTextOnly,Se=he.showLines,Je=he.replaces,qe=he.zoomImg,Ae=he.hasMask,we=he.style,De=we===void 0?{}:we,Xe=he.stylesPrev,We=Xe===void 0?{}:Xe,Ce=String(pe),Oe=Object(B.useRef)(),et=Object(B.useRef)(),Me=Object(B.useState)(""),Le=Object(C.a)(Me,2),Ue=Le[0],Ge=Le[1],Fe=Object(B.useState)("office"),ze=Object(C.a)(Fe,2),be=ze[0],Ke=ze[1],He=Object(B.useMemo)(function(){try{var te=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,$=/\"\/api\/attachments\/|\"\/attachments\/download\//g,X=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ce=Ce.replace(te,"("+N.a.API_SERVER+"/api/attachments/").replace($,'"'+N.a.API_SERVER+"/api/attachments/").replace(X,'"'+N.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(ye){}var q=P(Ce),ne=b();if(Ce.match(/\[TOC\]/)&&(q=q.replace("<p>[TOC]</p>",R()),s()),q=q.replace(/(__special_katext_id_\d+__)/g,function(ye,Te){var ke=ne[Te],rt=ke.type,nt=ke.expression;return Object(w.renderToString)(_e(nt)||"",{displayMode:rt==="block",throwOnError:!1,output:"html"})}),q=q.replace(/▁/g,"\u2581\u2581\u2581"),v(),Pe){var le=document.createElement("div");return le.innerHTML=q,le.innerText}return setTimeout(function(){return ue()},500),q},[Ce]),ve=Object(B.useRef)();l.WebkitLineClamp=Se,Se&&(De=Object(k.a)(Object(k.a)({},De),l));function Re(te){var $=te.target;if($.tagName.toUpperCase()==="IMG"){if(qe){var X=$.getAttribute("src");Ge(X),Ke("image")}}else if($.tagName.toUpperCase()==="A"){var q=$.getAttribute("href");if(q.indexOf("office")>-1)te.preventDefault(),Ge(q),Ke("office");else if(q.indexOf("application/pdf")>-1)te.preventDefault(),Ge(q),Ke("pdf");else if(q.indexOf("text/html")>-1)te.preventDefault(),Ge(q),Ke("html");else if(q.startsWith("#")){te.preventDefault();var ne=document.getElementById(q.replace("#",""));ne&&ne.scrollIntoView(!0)}}}var ue=function(){var $,X=($=ve.current)===null||$===void 0?void 0:$.querySelectorAll("video");X==null||X.forEach(function(q){if(q.oncontextmenu=function(){return!1},q.src.indexOf(".m3u8")>-1&&!q.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var ne=new W.a;ne.loadSource(q.src),ne.attachMedia(q)}}})};Object(B.useEffect)(function(){if(ve.current&&He&&(He.match(ae)&&window.PR.prettyPrint()),ve.current)return ve.current.addEventListener("click",Re),function(){ve.current.removeEventListener("click",Re),v(),s()}},[He,ve.current,Re]);var ie=function($){if(!de)return;$.target.nodeName==="IMG"?(Oe.current.style.display="flex",Oe.current.style.width=$.target.clientWidth+"px",Oe.current.style.height=$.target.clientHeight+"px",Oe.current.style.top=$.target.offsetTop+"px",Oe.current.style.left=$.target.offsetLeft+"px",et.current.src=$.target.getAttribute("src")):Oe.current.style.display="none"};return U.a.createElement("div",{style:{position:"relative"}},U.a.createElement("div",{ref:ve,style:Object(k.a)({},De),className:"".concat(Ee||""," markdown-body ").concat(Z.a.mdBody),onMouseOver:ie,dangerouslySetInnerHTML:{__html:He}}),U.a.createElement("div",{ref:Oe,className:Z.a.button},U.a.createElement(V.a,null,U.a.createElement(H.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),U.a.createElement(H.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),U.a.createElement("img",{ref:et,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),U.a.createElement(G.a,{close:!0,data:Ue,type:Ue!=null&&Ue.length?be:"",style:Object(k.a)({},We),onClose:function(){return Ge("")}}))}},"9VGf":function(st,Qe,Q){"use strict";Q.d(Qe,"a",function(){return I});var ee=Q("cDcd"),V=Q.n(ee);function I(H,k){var C=Object(ee.useRef)();Object(ee.useEffect)(function(){C.current=H}),Object(ee.useEffect)(function(){function B(){C.current()}if(k!==null){var U=setInterval(B,k);return function(){return clearInterval(U)}}},[k])}},BU3w:function(st,Qe,Q){"use strict";Q.d(Qe,"a",function(){return C});var ee=Q("MNnm"),V="rc-util-key";function I(B){if(B.attachTo)return B.attachTo;var U=document.querySelector("head");return U||document.body}function H(B){var U,D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ee.a)())return null;var L=document.createElement("style");if((U=D.csp)===null||U===void 0?void 0:U.nonce){var g;L.nonce=(g=D.csp)===null||g===void 0?void 0:g.nonce}L.innerHTML=B;var p=I(D),f=p.firstChild;return D.prepend&&p.prepend?p.prepend(L):D.prepend&&f?p.insertBefore(L,f):p.appendChild(L),L}var k=new Map;function C(B,U){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=I(D);if(!k.has(L)){var g=H("",D),p=g.parentNode;k.set(L,p),p.removeChild(g)}var f=Array.from(k.get(L).children).find(function(s){return s.tagName==="STYLE"&&s[V]===U});if(f){var d,a;if(((d=D.csp)===null||d===void 0?void 0:d.nonce)&&f.nonce!==((a=D.csp)===null||a===void 0?void 0:a.nonce)){var c;f.nonce=(c=D.csp)===null||c===void 0?void 0:c.nonce}return f.innerHTML!==B&&(f.innerHTML=B),f}var o=H(B,D);return o[V]=U,o}},Bd2K:function(st,Qe,Q){(function(ee){ee(Q("VrN/"),Q("osHv"))})(function(ee){ee.defineOption("autoCloseTags",!1,function(D,L,g){if(g!=ee.Init&&g&&D.removeKeyMap("autoCloseTags"),!L)return;var p={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(p["'/'"]=function(f){return C(f)}),(typeof L!="object"||L.whenOpening!==!1)&&(p["'>'"]=function(f){return H(f)}),D.addKeyMap(p)});var V=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],I=["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 H(D){if(D.getOption("disableInput"))return ee.Pass;for(var L=D.listSelections(),g=[],p=D.getOption("autoCloseTags"),f=0;f<L.length;f++){if(!L[f].empty())return ee.Pass;var d=L[f].head,a=D.getTokenAt(d),c=ee.innerMode(D.getMode(),a.state),o=c.state,s=c.mode.xmlCurrentTag&&c.mode.xmlCurrentTag(o),l=s&&s.name;if(!l)return ee.Pass;var h=c.mode.configuration=="html",R=typeof p=="object"&&p.dontCloseTags||h&&V,x=typeof p=="object"&&p.indentTags||h&&I;a.end>d.ch&&(l=l.slice(0,l.length-a.end+d.ch));var T=l.toLowerCase();if(!l||a.type=="string"&&(a.end!=d.ch||!/[\"\']/.test(a.string.charAt(a.string.length-1))||a.string.length==1)||a.type=="tag"&&s.close||a.string.indexOf("/")==d.ch-a.start-1||R&&B(R,T)>-1||U(D,c.mode.xmlCurrentContext&&c.mode.xmlCurrentContext(o)||[],l,d,!0))return ee.Pass;var O=typeof p=="object"&&p.emptyTags;if(O&&B(O,l)>-1){g[f]={text:"/>",newPos:ee.Pos(d.line,d.ch+2)};continue}var S=x&&B(x,T)>-1;g[f]={indent:S,text:">"+(S?`
|
|
|
|
`:"")+"</"+l+">",newPos:S?ee.Pos(d.line+1,0):ee.Pos(d.line,d.ch+1)}}for(var E=typeof p=="object"&&p.dontIndentOnAutoClose,f=L.length-1;f>=0;f--){var b=g[f];D.replaceRange(b.text,L[f].head,L[f].anchor,"+insert");var v=D.listSelections().slice(0);v[f]={head:b.newPos,anchor:b.newPos},D.setSelections(v),!E&&b.indent&&(D.indentLine(b.newPos.line,null,!0),D.indentLine(b.newPos.line+1,null,!0))}}function k(D,L){for(var g=D.listSelections(),p=[],f=L?"/":"</",d=D.getOption("autoCloseTags"),a=typeof d=="object"&&d.dontIndentOnSlash,c=0;c<g.length;c++){if(!g[c].empty())return ee.Pass;var o=g[c].head,s=D.getTokenAt(o),l=ee.innerMode(D.getMode(),s.state),h=l.state;if(L&&(s.type=="string"||s.string.charAt(0)!="<"||s.start!=o.ch-1))return ee.Pass;var R,x=l.mode.name!="xml"&&D.getMode().name=="htmlmixed";if(x&&l.mode.name=="javascript")R=f+"script";else if(x&&l.mode.name=="css")R=f+"style";else{var T=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(h);if(!T||T.length&&U(D,T,T[T.length-1],o))return ee.Pass;R=f+T[T.length-1]}D.getLine(o.line).charAt(s.end)!=">"&&(R+=">"),p[c]=R}if(D.replaceSelections(p),g=D.listSelections(),!a)for(var c=0;c<g.length;c++)(c==g.length-1||g[c].head.line<g[c+1].head.line)&&D.indentLine(g[c].head.line)}function C(D){return D.getOption("disableInput")?ee.Pass:k(D,!0)}ee.commands.closeTag=function(D){return k(D)};function B(D,L){if(D.indexOf)return D.indexOf(L);for(var g=0,p=D.length;g<p;++g)if(D[g]==L)return g;return-1}function U(D,L,g,p,f){if(!ee.scanForClosingTag)return!1;var d=Math.min(D.lastLine()+1,p.line+500),a=ee.scanForClosingTag(D,p,null,d);if(!a||a.tag!=g)return!1;for(var c=f?1:0,o=L.length-1;o>=0&&L[o]==g;o--)++c;p=a.to;for(var o=1;o<c;o++){var s=ee.scanForClosingTag(D,p,null,d);if(!s||s.tag!=g)return!1;p=s.to}return!0}})},BjJ7:function(st,Qe,Q){"use strict";Q.d(Qe,"d",function(){return V}),Q.d(Qe,"c",function(){return I}),Q.d(Qe,"e",function(){return H}),Q.d(Qe,"b",function(){return k}),Q.d(Qe,"a",function(){return B});var ee=Q("m3rI");function V(U){var D=!0;if(U.length>0){for(var L=0;L<U.length;L++)if(U[L].compile_success==0||!U[L].compile_success){D=!1;break}}else D=!1;return D}function I(U){for(var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],g=0;g<U.length;g++){var p=U[g],f=D?"".concat(D,"/").concat(p.name):"".concat(p.name);L.push({title:p.name,isLeaf:!(p.type==="tree"),key:f})}return L}function H(U,D,L){for(var g=0;g<U.length;g++){var p=U[g];if(p.key===D){p.children=L;break}p.children&&H(p.children,D,L)}return U}function k(U,D,L){var g;return function(){var p=this,f=arguments,d=function(){g=null,L||U.apply(p,f)},a=L&&!g;clearTimeout(g),g=setTimeout(d,D),a&&U.apply(p,f)}}var C=!0,B=ee.a.API_SERVER},"C+DQ":function(st,Qe,Q){},DlQD:function(st,Qe,Q){(function(ee,V){st.exports=V()})(this,function(){"use strict";function ee(ue,ie){for(var te=0;te<ie.length;te++){var $=ie[te];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(ue,$.key,$)}}function V(ue,ie,te){return ie&&ee(ue.prototype,ie),te&&ee(ue,te),ue}function I(ue,ie){if(!ue)return;if(typeof ue=="string")return H(ue,ie);var te=Object.prototype.toString.call(ue).slice(8,-1);if(te==="Object"&&ue.constructor&&(te=ue.constructor.name),te==="Map"||te==="Set")return Array.from(ue);if(te==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(te))return H(ue,ie)}function H(ue,ie){(ie==null||ie>ue.length)&&(ie=ue.length);for(var te=0,$=new Array(ie);te<ie;te++)$[te]=ue[te];return $}function k(ue,ie){var te;if(typeof Symbol=="undefined"||ue[Symbol.iterator]==null){if(Array.isArray(ue)||(te=I(ue))||ie&&ue&&typeof ue.length=="number"){te&&(ue=te);var $=0;return function(){return $>=ue.length?{done:!0}:{done:!1,value:ue[$++]}}}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 te=ue[Symbol.iterator](),te.next.bind(te)}function C(ue,ie){return ie={exports:{}},ue(ie,ie.exports),ie.exports}var B=C(function(ue){function ie(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function te($){ue.exports.defaults=$}ue.exports={defaults:ie(),getDefaults:ie,changeDefaults:te}}),U=B.defaults,D=B.getDefaults,L=B.changeDefaults,g=/[&<>"']/,p=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,d=/[<>"']|&(?!#?\w+;)/g,a={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(ie){return a[ie]};function o(ue,ie){if(ie){if(g.test(ue))return ue.replace(p,c)}else if(f.test(ue))return ue.replace(d,c);return ue}var s=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ue){return ue.replace(s,function(ie,te){return te=te.toLowerCase(),te==="colon"?":":te.charAt(0)==="#"?te.charAt(1)==="x"?String.fromCharCode(parseInt(te.substring(2),16)):String.fromCharCode(+te.substring(1)):""})}var h=/(^|[^\[])\^/g;function R(ue,ie){ue=ue.source||ue,ie=ie||"";var te={replace:function(X,q){return q=q.source||q,q=q.replace(h,"$1"),ue=ue.replace(X,q),te},getRegex:function(){return new RegExp(ue,ie)}};return te}var x=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(ue,ie,te){if(ue){var $;try{$=decodeURIComponent(l(te)).replace(x,"").toLowerCase()}catch(X){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}ie&&!T.test(te)&&(te=u(ie,te));try{te=encodeURI(te).replace(/%25/g,"%")}catch(X){return null}return te}var S={},E=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,v=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(ue,ie){S[" "+ue]||(E.test(ue)?S[" "+ue]=ue+"/":S[" "+ue]=P(ue,"/",!0)),ue=S[" "+ue];var te=ue.indexOf(":")===-1;return ie.substring(0,2)==="//"?te?ie:ue.replace(b,"$1")+ie:ie.charAt(0)==="/"?te?ie:ue.replace(v,"$1")+ie:ue+ie}var _={exec:function(){}};function m(ue){for(var ie=1,te,$;ie<arguments.length;ie++){te=arguments[ie];for($ in te)Object.prototype.hasOwnProperty.call(te,$)&&(ue[$]=te[$])}return ue}function y(ue,ie){var te=ue.replace(/\|/g,function(q,ne,le){for(var ye=!1,Te=ne;--Te>=0&&le[Te]==="\\";)ye=!ye;return ye?"|":" |"}),$=te.split(/ \|/),X=0;if($.length>ie)$.splice(ie);else for(;$.length<ie;)$.push("");for(;X<$.length;X++)$[X]=$[X].trim().replace(/\\\|/g,"|");return $}function P(ue,ie,te){var $=ue.length;if($===0)return"";for(var X=0;X<$;){var q=ue.charAt($-X-1);if(q===ie&&!te)X++;else if(q!==ie&&te)X++;else break}return ue.substr(0,$-X)}function M(ue,ie){if(ue.indexOf(ie[1])===-1)return-1;for(var te=ue.length,$=0,X=0;X<te;X++)if(ue[X]==="\\")X++;else if(ue[X]===ie[0])$++;else if(ue[X]===ie[1]&&($--,$<0))return X;return-1}function j(ue){ue&&ue.sanitize&&!ue.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:o,unescape:l,edit:R,cleanUrl:O,resolveUrl:u,noopTest:_,merge:m,splitCells:y,rtrim:P,findClosingBracket:M,checkSanitizeDeprecation:j},N=B.defaults,w=W.rtrim,G=W.splitCells,J=W.escape,Z=W.findClosingBracket;function ae(ue,ie,te){var $=ie.href,X=ie.title?J(ie.title):null,q=ue[1].replace(/\\([\[\]])/g,"$1");return ue[0].charAt(0)!=="!"?{type:"link",raw:te,href:$,title:X,text:q}:{type:"image",raw:te,href:$,title:X,text:J(q)}}function _e(ue,ie){var te=ue.match(/^(\s+)(?:```)/);if(te===null)return ie;var $=te[1];return ie.split(`
|
|
`).map(function(X){var q=X.match(/^\s+/);if(q===null)return X;var ne=q[0];return ne.length>=$.length?X.slice($.length):X}).join(`
|
|
`)}var ce=function(){function ue(te){this.options=te||N}var ie=ue.prototype;return ie.space=function($){var X=this.rules.block.newline.exec($);if(X)return X[0].length>1?{type:"space",raw:X[0]}:{raw:`
|
|
`}},ie.code=function($,X){var q=this.rules.block.code.exec($);if(q){var ne=X[X.length-1];if(ne&&ne.type==="paragraph")return{raw:q[0],text:q[0].trimRight()};var le=q[0].replace(/^ {4}/gm,"");return{type:"code",raw:q[0],codeBlockStyle:"indented",text:this.options.pedantic?le:w(le,`
|
|
`)}}},ie.fences=function($){var X=this.rules.block.fences.exec($);if(X){var q=X[0],ne=_e(q,X[3]||"");return{type:"code",raw:q,lang:X[2]?X[2].trim():X[2],text:ne}}},ie.heading=function($){var X=this.rules.block.heading.exec($);if(X)return{type:"heading",raw:X[0],depth:X[1].length,text:X[2]}},ie.nptable=function($){var X=this.rules.block.nptable.exec($);if(X){var q={type:"table",header:G(X[1].replace(/^ *| *\| *$/g,"")),align:X[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:X[3]?X[3].replace(/\n$/,"").split(`
|
|
`):[],raw:X[0]};if(q.header.length===q.align.length){var ne=q.align.length,le;for(le=0;le<ne;le++)/^ *-+: *$/.test(q.align[le])?q.align[le]="right":/^ *:-+: *$/.test(q.align[le])?q.align[le]="center":/^ *:-+ *$/.test(q.align[le])?q.align[le]="left":q.align[le]=null;for(ne=q.cells.length,le=0;le<ne;le++)q.cells[le]=G(q.cells[le],q.header.length);return q}}},ie.hr=function($){var X=this.rules.block.hr.exec($);if(X)return{type:"hr",raw:X[0]}},ie.blockquote=function($){var X=this.rules.block.blockquote.exec($);if(X){var q=X[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:X[0],text:q}}},ie.list=function($){var X=this.rules.block.list.exec($);if(X){for(var q=X[0],ne=X[2],le=ne.length>1,ye=ne[ne.length-1]===")",Te={type:"list",raw:q,ordered:le,start:le?+ne.slice(0,-1):"",loose:!1,items:[]},ke=X[0].match(this.rules.block.item),rt=!1,nt,xt,ht,Ve,mt,ot,Rt,bt=ke.length,gt=0;gt<bt;gt++)nt=ke[gt],q=nt,xt=nt.length,nt=nt.replace(/^ *([*+-]|\d+[.)]) */,""),~nt.indexOf(`
|
|
`)&&(xt-=nt.length,nt=this.options.pedantic?nt.replace(/^ {1,4}/gm,""):nt.replace(new RegExp("^ {1,"+xt+"}","gm"),"")),gt!==bt-1&&(ht=this.rules.block.bullet.exec(ke[gt+1])[0],(le?ht.length===1||!ye&&ht[ht.length-1]===")":ht.length>1||this.options.smartLists&&ht!==ne)&&(Ve=ke.slice(gt+1).join(`
|
|
`),Te.raw=Te.raw.substring(0,Te.raw.length-Ve.length),gt=bt-1)),mt=rt||/\n\n(?!\s*$)/.test(nt),gt!==bt-1&&(rt=nt.charAt(nt.length-1)===`
|
|
`,mt||(mt=rt)),mt&&(Te.loose=!0),ot=/^\[[ xX]\] /.test(nt),Rt=void 0,ot&&(Rt=nt[1]!==" ",nt=nt.replace(/^\[[ xX]\] +/,"")),Te.items.push({type:"list_item",raw:q,task:ot,checked:Rt,loose:mt,text:nt});return Te}},ie.html=function($){var X=this.rules.block.html.exec($);if(X)return{type:this.options.sanitize?"paragraph":"html",raw:X[0],pre:!this.options.sanitizer&&(X[1]==="pre"||X[1]==="script"||X[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(X[0]):J(X[0]):X[0]}},ie.def=function($){var X=this.rules.block.def.exec($);if(X){X[3]&&(X[3]=X[3].substring(1,X[3].length-1));var q=X[1].toLowerCase().replace(/\s+/g," ");return{tag:q,raw:X[0],href:X[2],title:X[3]}}},ie.table=function($){var X=this.rules.block.table.exec($);if(X){var q={type:"table",header:G(X[1].replace(/^ *| *\| *$/g,"")),align:X[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:X[3]?X[3].replace(/\n$/,"").split(`
|
|
`):[]};if(q.header.length===q.align.length){q.raw=X[0];var ne=q.align.length,le;for(le=0;le<ne;le++)/^ *-+: *$/.test(q.align[le])?q.align[le]="right":/^ *:-+: *$/.test(q.align[le])?q.align[le]="center":/^ *:-+ *$/.test(q.align[le])?q.align[le]="left":q.align[le]=null;for(ne=q.cells.length,le=0;le<ne;le++)q.cells[le]=G(q.cells[le].replace(/^ *\| *| *\| *$/g,""),q.header.length);return q}}},ie.lheading=function($){var X=this.rules.block.lheading.exec($);if(X)return{type:"heading",raw:X[0],depth:X[2].charAt(0)==="="?1:2,text:X[1]}},ie.paragraph=function($){var X=this.rules.block.paragraph.exec($);if(X)return{type:"paragraph",raw:X[0],text:X[1].charAt(X[1].length-1)===`
|
|
`?X[1].slice(0,-1):X[1]}},ie.text=function($,X){var q=this.rules.block.text.exec($);if(q){var ne=X[X.length-1];return ne&&ne.type==="text"?{raw:q[0],text:q[0]}:{type:"text",raw:q[0],text:q[0]}}},ie.escape=function($){var X=this.rules.inline.escape.exec($);if(X)return{type:"escape",raw:X[0],text:J(X[1])}},ie.tag=function($,X,q){var ne=this.rules.inline.tag.exec($);if(ne)return!X&&/^<a /i.test(ne[0])?X=!0:X&&/^<\/a>/i.test(ne[0])&&(X=!1),!q&&/^<(pre|code|kbd|script)(\s|>)/i.test(ne[0])?q=!0:q&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ne[0])&&(q=!1),{type:this.options.sanitize?"text":"html",raw:ne[0],inLink:X,inRawBlock:q,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):J(ne[0]):ne[0]}},ie.link=function($){var X=this.rules.inline.link.exec($);if(X){var q=Z(X[2],"()");if(q>-1){var ne=X[0].indexOf("!")===0?5:4,le=ne+X[1].length+q;X[2]=X[2].substring(0,q),X[0]=X[0].substring(0,le).trim(),X[3]=""}var ye=X[2],Te="";if(this.options.pedantic){var ke=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ye);ke?(ye=ke[1],Te=ke[3]):Te=""}else Te=X[3]?X[3].slice(1,-1):"";ye=ye.trim().replace(/^<([\s\S]*)>$/,"$1");var rt=ae(X,{href:ye&&ye.replace(this.rules.inline._escapes,"$1"),title:Te&&Te.replace(this.rules.inline._escapes,"$1")},X[0]);return rt}},ie.reflink=function($,X){var q;if((q=this.rules.inline.reflink.exec($))||(q=this.rules.inline.nolink.exec($))){var ne=(q[2]||q[1]).replace(/\s+/g," ");if(ne=X[ne.toLowerCase()],!ne||!ne.href){var le=q[0].charAt(0);return{type:"text",raw:le,text:le}}var ye=ae(q,ne,q[0]);return ye}},ie.strong=function($,X,q){q===void 0&&(q="");var ne=this.rules.inline.strong.start.exec($);if(ne&&(!ne[1]||ne[1]&&(q===""||this.rules.inline.punctuation.exec(q)))){X=X.slice(-1*$.length);var le=ne[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;le.lastIndex=0;for(var ye;(ne=le.exec(X))!=null;)if(ye=this.rules.inline.strong.middle.exec(X.slice(0,ne.index+3)),ye)return{type:"strong",raw:$.slice(0,ye[0].length),text:$.slice(2,ye[0].length-2)}}},ie.em=function($,X,q){q===void 0&&(q="");var ne=this.rules.inline.em.start.exec($);if(ne&&(!ne[1]||ne[1]&&(q===""||this.rules.inline.punctuation.exec(q)))){X=X.slice(-1*$.length);var le=ne[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;le.lastIndex=0;for(var ye;(ne=le.exec(X))!=null;)if(ye=this.rules.inline.em.middle.exec(X.slice(0,ne.index+2)),ye)return{type:"em",raw:$.slice(0,ye[0].length),text:$.slice(1,ye[0].length-1)}}},ie.codespan=function($){var X=this.rules.inline.code.exec($);if(X){var q=X[2].replace(/\n/g," "),ne=/[^ ]/.test(q),le=q.startsWith(" ")&&q.endsWith(" ");return ne&&le&&(q=q.substring(1,q.length-1)),q=J(q,!0),{type:"codespan",raw:X[0],text:q}}},ie.br=function($){var X=this.rules.inline.br.exec($);if(X)return{type:"br",raw:X[0]}},ie.del=function($){var X=this.rules.inline.del.exec($);if(X)return{type:"del",raw:X[0],text:X[1]}},ie.autolink=function($,X){var q=this.rules.inline.autolink.exec($);if(q){var ne,le;return q[2]==="@"?(ne=J(this.options.mangle?X(q[1]):q[1]),le="mailto:"+ne):(ne=J(q[1]),le=ne),{type:"link",raw:q[0],text:ne,href:le,tokens:[{type:"text",raw:ne,text:ne}]}}},ie.url=function($,X){var q;if(q=this.rules.inline.url.exec($)){var ne,le;if(q[2]==="@")ne=J(this.options.mangle?X(q[0]):q[0]),le="mailto:"+ne;else{var ye;do ye=q[0],q[0]=this.rules.inline._backpedal.exec(q[0])[0];while(ye!==q[0]);ne=J(q[0]),q[1]==="www."?le="http://"+ne:le=ne}return{type:"link",raw:q[0],text:ne,href:le,tokens:[{type:"text",raw:ne,text:ne}]}}},ie.inlineText=function($,X,q){var ne=this.rules.inline.text.exec($);if(ne){var le;return X?le=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):J(ne[0]):ne[0]:le=J(this.options.smartypants?q(ne[0]):ne[0]),{type:"text",raw:ne[0],text:le}}},ue}(),he=W.noopTest,fe=W.edit,pe=W.merge,se={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:he,table:he,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};se._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,se._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,se.def=fe(se.def).replace("label",se._label).replace("title",se._title).getRegex(),se.bullet=/(?:[*+-]|\d{1,9}[.)])/,se.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,se.item=fe(se.item,"gm").replace(/bull/g,se.bullet).getRegex(),se.list=fe(se.list).replace(/bull/g,se.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+se.def.source+")").getRegex(),se._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",se._comment=/<!--(?!-?>)[\s\S]*?-->/,se.html=fe(se.html,"i").replace("comment",se._comment).replace("tag",se._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),se.paragraph=fe(se._paragraph).replace("hr",se.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",se._tag).getRegex(),se.blockquote=fe(se.blockquote).replace("paragraph",se.paragraph).getRegex(),se.normal=pe({},se),se.gfm=pe({},se.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),se.gfm.nptable=fe(se.gfm.nptable).replace("hr",se.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",se._tag).getRegex(),se.gfm.table=fe(se.gfm.table).replace("hr",se.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",se._tag).getRegex(),se.pedantic=pe({},se.normal,{html:fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",se._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:he,paragraph:fe(se.normal._paragraph).replace("hr",se.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",se.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var de={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:he,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:he,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};de._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",de.punctuation=fe(de.punctuation).replace(/punctuation/g,de._punctuation).getRegex(),de._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",de._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",de.em.start=fe(de.em.start).replace(/punctuation/g,de._punctuation).getRegex(),de.em.middle=fe(de.em.middle).replace(/punctuation/g,de._punctuation).replace(/overlapSkip/g,de._overlapSkip).getRegex(),de.em.endAst=fe(de.em.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.em.endUnd=fe(de.em.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.start=fe(de.strong.start).replace(/punctuation/g,de._punctuation).getRegex(),de.strong.middle=fe(de.strong.middle).replace(/punctuation/g,de._punctuation).replace(/blockSkip/g,de._blockSkip).getRegex(),de.strong.endAst=fe(de.strong.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.endUnd=fe(de.strong.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.blockSkip=fe(de._blockSkip,"g").getRegex(),de.overlapSkip=fe(de._overlapSkip,"g").getRegex(),de._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,de._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,de._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,de.autolink=fe(de.autolink).replace("scheme",de._scheme).replace("email",de._email).getRegex(),de._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,de.tag=fe(de.tag).replace("comment",se._comment).replace("attribute",de._attribute).getRegex(),de._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,de._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,de._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,de.link=fe(de.link).replace("label",de._label).replace("href",de._href).replace("title",de._title).getRegex(),de.reflink=fe(de.reflink).replace("label",de._label).getRegex(),de.reflinkSearch=fe(de.reflinkSearch,"g").replace("reflink",de.reflink).replace("nolink",de.nolink).getRegex(),de.normal=pe({},de),de.pedantic=pe({},de.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:fe(/^!?\[(label)\]\((.*?)\)/).replace("label",de._label).getRegex(),reflink:fe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",de._label).getRegex()}),de.gfm=pe({},de.normal,{escape:fe(de.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),de.gfm.url=fe(de.gfm.url,"i").replace("email",de.gfm._extended_email).getRegex(),de.breaks=pe({},de.gfm,{br:fe(de.br).replace("{2,}","*").getRegex(),text:fe(de.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Ee={block:se,inline:de},Pe=B.defaults,Se=Ee.block,Je=Ee.inline;function qe(ue){return ue.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 Ae(ue){var ie="",te,$,X=ue.length;for(te=0;te<X;te++)$=ue.charCodeAt(te),Math.random()>.5&&($="x"+$.toString(16)),ie+="&#"+$+";";return ie}var we=function(){function ue(te){this.tokens=[],this.tokens.links=Object.create(null),this.options=te||Pe,this.options.tokenizer=this.options.tokenizer||new ce,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:Se.normal,inline:Je.normal};this.options.pedantic?($.block=Se.pedantic,$.inline=Je.pedantic):this.options.gfm&&($.block=Se.gfm,this.options.breaks?$.inline=Je.breaks:$.inline=Je.gfm),this.tokenizer.rules=$}ue.lex=function($,X){var q=new ue(X);return q.lex($)};var ie=ue.prototype;return ie.lex=function($){return $=$.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens($,this.tokens,!0),this.inline(this.tokens),this.tokens},ie.blockTokens=function($,X,q){X===void 0&&(X=[]),q===void 0&&(q=!0),$=$.replace(/^ +$/gm,"");for(var ne,le,ye,Te;$;){if(ne=this.tokenizer.space($)){$=$.substring(ne.raw.length),ne.type&&X.push(ne);continue}if(ne=this.tokenizer.code($,X)){$=$.substring(ne.raw.length),ne.type?X.push(ne):(Te=X[X.length-1],Te.raw+=`
|
|
`+ne.raw,Te.text+=`
|
|
`+ne.text);continue}if(ne=this.tokenizer.fences($)){$=$.substring(ne.raw.length),X.push(ne);continue}if(ne=this.tokenizer.heading($)){$=$.substring(ne.raw.length),X.push(ne);continue}if(ne=this.tokenizer.nptable($)){$=$.substring(ne.raw.length),X.push(ne);continue}if(ne=this.tokenizer.hr($)){$=$.substring(ne.raw.length),X.push(ne);continue}if(ne=this.tokenizer.blockquote($)){$=$.substring(ne.raw.length),ne.tokens=this.blockTokens(ne.text,[],q),X.push(ne);continue}if(ne=this.tokenizer.list($)){for($=$.substring(ne.raw.length),ye=ne.items.length,le=0;le<ye;le++)ne.items[le].tokens=this.blockTokens(ne.items[le].text,[],!1);X.push(ne);continue}if(ne=this.tokenizer.html($)){$=$.substring(ne.raw.length),X.push(ne);continue}if(q&&(ne=this.tokenizer.def($))){$=$.substring(ne.raw.length),this.tokens.links[ne.tag]||(this.tokens.links[ne.tag]={href:ne.href,title:ne.title});continue}if(ne=this.tokenizer.table($)){$=$.substring(ne.raw.length),X.push(ne);continue}if(ne=this.tokenizer.lheading($)){$=$.substring(ne.raw.length),X.push(ne);continue}if(q&&(ne=this.tokenizer.paragraph($))){$=$.substring(ne.raw.length),X.push(ne);continue}if(ne=this.tokenizer.text($,X)){$=$.substring(ne.raw.length),ne.type?X.push(ne):(Te=X[X.length-1],Te.raw+=`
|
|
`+ne.raw,Te.text+=`
|
|
`+ne.text);continue}if($){var ke="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(ke);break}else throw new Error(ke)}}return X},ie.inline=function($){var X,q,ne,le,ye,Te,ke=$.length;for(X=0;X<ke;X++){Te=$[X];switch(Te.type){case"paragraph":case"text":case"heading":{Te.tokens=[],this.inlineTokens(Te.text,Te.tokens);break}case"table":{for(Te.tokens={header:[],cells:[]},le=Te.header.length,q=0;q<le;q++)Te.tokens.header[q]=[],this.inlineTokens(Te.header[q],Te.tokens.header[q]);for(le=Te.cells.length,q=0;q<le;q++)for(ye=Te.cells[q],Te.tokens.cells[q]=[],ne=0;ne<ye.length;ne++)Te.tokens.cells[q][ne]=[],this.inlineTokens(ye[ne],Te.tokens.cells[q][ne]);break}case"blockquote":{this.inline(Te.tokens);break}case"list":{for(le=Te.items.length,q=0;q<le;q++)this.inline(Te.items[q].tokens);break}}}return $},ie.inlineTokens=function($,X,q,ne,le){X===void 0&&(X=[]),q===void 0&&(q=!1),ne===void 0&&(ne=!1),le===void 0&&(le="");var ye,Te=$,ke;if(this.tokens.links){var rt=Object.keys(this.tokens.links);if(rt.length>0)for(;(ke=this.tokenizer.rules.inline.reflinkSearch.exec(Te))!=null;)rt.includes(ke[0].slice(ke[0].lastIndexOf("[")+1,-1))&&(Te=Te.slice(0,ke.index)+"["+"a".repeat(ke[0].length-2)+"]"+Te.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ke=this.tokenizer.rules.inline.blockSkip.exec(Te))!=null;)Te=Te.slice(0,ke.index)+"["+"a".repeat(ke[0].length-2)+"]"+Te.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(ye=this.tokenizer.escape($)){$=$.substring(ye.raw.length),X.push(ye);continue}if(ye=this.tokenizer.tag($,q,ne)){$=$.substring(ye.raw.length),q=ye.inLink,ne=ye.inRawBlock,X.push(ye);continue}if(ye=this.tokenizer.link($)){$=$.substring(ye.raw.length),ye.type==="link"&&(ye.tokens=this.inlineTokens(ye.text,[],!0,ne)),X.push(ye);continue}if(ye=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(ye.raw.length),ye.type==="link"&&(ye.tokens=this.inlineTokens(ye.text,[],!0,ne)),X.push(ye);continue}if(ye=this.tokenizer.strong($,Te,le)){$=$.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],q,ne),X.push(ye);continue}if(ye=this.tokenizer.em($,Te,le)){$=$.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],q,ne),X.push(ye);continue}if(ye=this.tokenizer.codespan($)){$=$.substring(ye.raw.length),X.push(ye);continue}if(ye=this.tokenizer.br($)){$=$.substring(ye.raw.length),X.push(ye);continue}if(ye=this.tokenizer.del($)){$=$.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],q,ne),X.push(ye);continue}if(ye=this.tokenizer.autolink($,Ae)){$=$.substring(ye.raw.length),X.push(ye);continue}if(!q&&(ye=this.tokenizer.url($,Ae))){$=$.substring(ye.raw.length),X.push(ye);continue}if(ye=this.tokenizer.inlineText($,ne,qe)){$=$.substring(ye.raw.length),le=ye.raw.slice(-1),X.push(ye);continue}if($){var nt="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(nt);break}else throw new Error(nt)}}return X},V(ue,null,[{key:"rules",get:function(){return{block:Se,inline:Je}}}]),ue}(),De=B.defaults,Xe=W.cleanUrl,We=W.escape,Ce=function(){function ue(te){this.options=te||De}var ie=ue.prototype;return ie.code=function($,X,q){var ne=(X||"").match(/\S*/)[0];if(this.options.highlight){var le=this.options.highlight($,ne);le!=null&&le!==$&&(q=!0,$=le)}return ne?'<pre><code class="'+this.options.langPrefix+We(ne,!0)+'">'+(q?$:We($,!0))+`</code></pre>
|
|
`:"<pre><code>"+(q?$:We($,!0))+`</code></pre>
|
|
`},ie.blockquote=function($){return`<blockquote>
|
|
`+$+`</blockquote>
|
|
`},ie.html=function($){return $},ie.heading=function($,X,q,ne){return this.options.headerIds?"<h"+X+' id="'+this.options.headerPrefix+ne.slug(q)+'">'+$+"</h"+X+`>
|
|
`:"<h"+X+">"+$+"</h"+X+`>
|
|
`},ie.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ie.list=function($,X,q){var ne=X?"ol":"ul",le=X&&q!==1?' start="'+q+'"':"";return"<"+ne+le+`>
|
|
`+$+"</"+ne+`>
|
|
`},ie.listitem=function($){return"<li>"+$+`</li>
|
|
`},ie.checkbox=function($){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ie.paragraph=function($){return"<p>"+$+`</p>
|
|
`},ie.table=function($,X){return X&&(X="<tbody>"+X+"</tbody>"),`<table>
|
|
<thead>
|
|
`+$+`</thead>
|
|
`+X+`</table>
|
|
`},ie.tablerow=function($){return`<tr>
|
|
`+$+`</tr>
|
|
`},ie.tablecell=function($,X){var q=X.header?"th":"td",ne=X.align?"<"+q+' align="'+X.align+'">':"<"+q+">";return ne+$+"</"+q+`>
|
|
`},ie.strong=function($){return"<strong>"+$+"</strong>"},ie.em=function($){return"<em>"+$+"</em>"},ie.codespan=function($){return"<code>"+$+"</code>"},ie.br=function(){return this.options.xhtml?"<br/>":"<br>"},ie.del=function($){return"<del>"+$+"</del>"},ie.link=function($,X,q){if($=Xe(this.options.sanitize,this.options.baseUrl,$),$===null)return q;var ne='<a href="'+We($)+'"';return X&&(ne+=' title="'+X+'"'),ne+=">"+q+"</a>",ne},ie.image=function($,X,q){if($=Xe(this.options.sanitize,this.options.baseUrl,$),$===null)return q;var ne='<img src="'+$+'" alt="'+q+'"';return X&&(ne+=' title="'+X+'"'),ne+=this.options.xhtml?"/>":">",ne},ie.text=function($){return $},ue}(),Oe=function(){function ue(){}var ie=ue.prototype;return ie.strong=function($){return $},ie.em=function($){return $},ie.codespan=function($){return $},ie.del=function($){return $},ie.html=function($){return $},ie.text=function($){return $},ie.link=function($,X,q){return""+q},ie.image=function($,X,q){return""+q},ie.br=function(){return""},ue}(),et=function(){function ue(){this.seen={}}var ie=ue.prototype;return ie.slug=function($){var X=$.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(X)){var q=X;do this.seen[q]++,X=q+"-"+this.seen[q];while(this.seen.hasOwnProperty(X))}return this.seen[X]=0,X},ue}(),Me=B.defaults,Le=W.unescape,Ue=function(){function ue(te){this.options=te||Me,this.options.renderer=this.options.renderer||new Ce,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Oe,this.slugger=new et}ue.parse=function($,X){var q=new ue(X);return q.parse($)};var ie=ue.prototype;return ie.parse=function($,X){X===void 0&&(X=!0);var q="",ne,le,ye,Te,ke,rt,nt,xt,ht,Ve,mt,ot,Rt,bt,gt,nn,zt,ft,dt=$.length;for(ne=0;ne<dt;ne++){Ve=$[ne];switch(Ve.type){case"space":continue;case"hr":{q+=this.renderer.hr();continue}case"heading":{q+=this.renderer.heading(this.parseInline(Ve.tokens),Ve.depth,Le(this.parseInline(Ve.tokens,this.textRenderer)),this.slugger);continue}case"code":{q+=this.renderer.code(Ve.text,Ve.lang,Ve.escaped);continue}case"table":{for(xt="",nt="",Te=Ve.header.length,le=0;le<Te;le++)nt+=this.renderer.tablecell(this.parseInline(Ve.tokens.header[le]),{header:!0,align:Ve.align[le]});for(xt+=this.renderer.tablerow(nt),ht="",Te=Ve.cells.length,le=0;le<Te;le++){for(rt=Ve.tokens.cells[le],nt="",ke=rt.length,ye=0;ye<ke;ye++)nt+=this.renderer.tablecell(this.parseInline(rt[ye]),{header:!1,align:Ve.align[ye]});ht+=this.renderer.tablerow(nt)}q+=this.renderer.table(xt,ht);continue}case"blockquote":{ht=this.parse(Ve.tokens),q+=this.renderer.blockquote(ht);continue}case"list":{for(mt=Ve.ordered,ot=Ve.start,Rt=Ve.loose,Te=Ve.items.length,ht="",le=0;le<Te;le++)gt=Ve.items[le],nn=gt.checked,zt=gt.task,bt="",gt.task&&(ft=this.renderer.checkbox(nn),Rt?gt.tokens.length>0&>.tokens[0].type==="text"?(gt.tokens[0].text=ft+" "+gt.tokens[0].text,gt.tokens[0].tokens&>.tokens[0].tokens.length>0&>.tokens[0].tokens[0].type==="text"&&(gt.tokens[0].tokens[0].text=ft+" "+gt.tokens[0].tokens[0].text)):gt.tokens.unshift({type:"text",text:ft}):bt+=ft),bt+=this.parse(gt.tokens,Rt),ht+=this.renderer.listitem(bt,zt,nn);q+=this.renderer.list(ht,mt,ot);continue}case"html":{q+=this.renderer.html(Ve.text);continue}case"paragraph":{q+=this.renderer.paragraph(this.parseInline(Ve.tokens));continue}case"text":{for(ht=Ve.tokens?this.parseInline(Ve.tokens):Ve.text;ne+1<dt&&$[ne+1].type==="text";)Ve=$[++ne],ht+=`
|
|
`+(Ve.tokens?this.parseInline(Ve.tokens):Ve.text);q+=X?this.renderer.paragraph(ht):ht;continue}default:{var At='Token with "'+Ve.type+'" type was not found.';if(this.options.silent){console.error(At);return}else throw new Error(At)}}}return q},ie.parseInline=function($,X){X=X||this.renderer;var q="",ne,le,ye=$.length;for(ne=0;ne<ye;ne++){le=$[ne];switch(le.type){case"escape":{q+=X.text(le.text);break}case"html":{q+=X.html(le.text);break}case"link":{q+=X.link(le.href,le.title,this.parseInline(le.tokens,X));break}case"image":{q+=X.image(le.href,le.title,le.text);break}case"strong":{q+=X.strong(this.parseInline(le.tokens,X));break}case"em":{q+=X.em(this.parseInline(le.tokens,X));break}case"codespan":{q+=X.codespan(le.text);break}case"br":{q+=X.br();break}case"del":{q+=X.del(this.parseInline(le.tokens,X));break}case"text":{q+=X.text(le.text);break}default:{var Te='Token with "'+le.type+'" type was not found.';if(this.options.silent){console.error(Te);return}else throw new Error(Te)}}}return q},ue}(),Ge=W.merge,Fe=W.checkSanitizeDeprecation,ze=W.escape,be=B.getDefaults,Ke=B.changeDefaults,He=B.defaults;function ve(ue,ie,te){if(typeof ue=="undefined"||ue===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ue!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ue)+", string expected");if(typeof ie=="function"&&(te=ie,ie=null),ie=Ge({},ve.defaults,ie||{}),Fe(ie),te){var $=ie.highlight,X;try{X=we.lex(ue,ie)}catch(ye){return te(ye)}var q=function(Te){var ke;if(!Te)try{ke=Ue.parse(X,ie)}catch(rt){Te=rt}return ie.highlight=$,Te?te(Te):te(null,ke)};if(!$||$.length<3)return q();if(delete ie.highlight,!X.length)return q();var ne=0;ve.walkTokens(X,function(ye){ye.type==="code"&&(ne++,setTimeout(function(){$(ye.text,ye.lang,function(Te,ke){if(Te)return q(Te);ke!=null&&ke!==ye.text&&(ye.text=ke,ye.escaped=!0),ne--,ne===0&&q()})},0))}),ne===0&&q();return}try{var le=we.lex(ue,ie);return ie.walkTokens&&ve.walkTokens(le,ie.walkTokens),Ue.parse(le,ie)}catch(ye){if(ye.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ie.silent)return"<p>An error occurred:</p><pre>"+ze(ye.message+"",!0)+"</pre>";throw ye}}ve.options=ve.setOptions=function(ue){return Ge(ve.defaults,ue),Ke(ve.defaults),ve},ve.getDefaults=be,ve.defaults=He,ve.use=function(ue){var ie=Ge({},ue);if(ue.renderer&&function(){var $=ve.defaults.renderer||new Ce,X=function(le){var ye=$[le];$[le]=function(){for(var Te=arguments.length,ke=new Array(Te),rt=0;rt<Te;rt++)ke[rt]=arguments[rt];var nt=ue.renderer[le].apply($,ke);return nt===!1&&(nt=ye.apply($,ke)),nt}};for(var q in ue.renderer)X(q);ie.renderer=$}(),ue.tokenizer&&function(){var $=ve.defaults.tokenizer||new ce,X=function(le){var ye=$[le];$[le]=function(){for(var Te=arguments.length,ke=new Array(Te),rt=0;rt<Te;rt++)ke[rt]=arguments[rt];var nt=ue.tokenizer[le].apply($,ke);return nt===!1&&(nt=ye.apply($,ke)),nt}};for(var q in ue.tokenizer)X(q);ie.tokenizer=$}(),ue.walkTokens){var te=ve.defaults.walkTokens;ie.walkTokens=function($){ue.walkTokens($),te&&te($)}}ve.setOptions(ie)},ve.walkTokens=function(ue,ie){for(var te=k(ue),$;!($=te()).done;){var X=$.value;ie(X);switch(X.type){case"table":{for(var q=k(X.tokens.header),ne;!(ne=q()).done;){var le=ne.value;ve.walkTokens(le,ie)}for(var ye=k(X.tokens.cells),Te;!(Te=ye()).done;)for(var ke=Te.value,rt=k(ke),nt;!(nt=rt()).done;){var xt=nt.value;ve.walkTokens(xt,ie)}break}case"list":{ve.walkTokens(X.items,ie);break}default:X.tokens&&ve.walkTokens(X.tokens,ie)}}},ve.Parser=Ue,ve.parser=Ue.parse,ve.Renderer=Ce,ve.TextRenderer=Oe,ve.Lexer=we,ve.lexer=we.lex,ve.Tokenizer=ce,ve.Slugger=et,ve.parse=ve;var Re=ve;return Re})},ELLl:function(st,Qe,Q){(function(ee){ee(Q("VrN/"))})(function(ee){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},I=ee.Pos;ee.defineOption("autoCloseBrackets",!1,function(a,c,o){o&&o!=ee.Init&&(a.removeKeyMap(k),a.state.closeBrackets=null),c&&(C(H(c,"pairs")),a.state.closeBrackets=c,a.addKeyMap(k))});function H(a,c){return c=="pairs"&&typeof a=="string"?a:typeof a=="object"&&a[c]!=null?a[c]:V[c]}var k={Backspace:D,Enter:L};function C(a){for(var c=0;c<a.length;c++){var o=a.charAt(c),s="'"+o+"'";k[s]||(k[s]=B(o))}}C(V.pairs+"`");function B(a){return function(c){return p(c,a)}}function U(a){var c=a.state.closeBrackets;if(!c||c.override)return c;var o=a.getModeAt(a.getCursor());return o.closeBrackets||c}function D(a){var c=U(a);if(!c||a.getOption("disableInput"))return ee.Pass;for(var o=H(c,"pairs"),s=a.listSelections(),l=0;l<s.length;l++){if(!s[l].empty())return ee.Pass;var h=f(a,s[l].head);if(!h||o.indexOf(h)%2!=0)return ee.Pass}for(var l=s.length-1;l>=0;l--){var R=s[l].head;a.replaceRange("",I(R.line,R.ch-1),I(R.line,R.ch+1),"+delete")}}function L(a){var c=U(a),o=c&&H(c,"explode");if(!o||a.getOption("disableInput"))return ee.Pass;for(var s=a.listSelections(),l=0;l<s.length;l++){if(!s[l].empty())return ee.Pass;var h=f(a,s[l].head);if(!h||o.indexOf(h)%2!=0)return ee.Pass}a.operation(function(){var R=a.lineSeparator()||`
|
|
`;a.replaceSelection(R+R,null),a.execCommand("goCharLeft"),s=a.listSelections();for(var x=0;x<s.length;x++){var T=s[x].head.line;a.indentLine(T,null,!0),a.indentLine(T+1,null,!0)}})}function g(a){var c=ee.cmpPos(a.anchor,a.head)>0;return{anchor:new I(a.anchor.line,a.anchor.ch+(c?-1:1)),head:new I(a.head.line,a.head.ch+(c?1:-1))}}function p(a,c){var o=U(a);if(!o||a.getOption("disableInput"))return ee.Pass;var s=H(o,"pairs"),l=s.indexOf(c);if(l==-1)return ee.Pass;for(var h=H(o,"closeBefore"),R=H(o,"triples"),x=s.charAt(l+1)==c,T=a.listSelections(),O=l%2==0,S,E=0;E<T.length;E++){var b=T[E],v=b.head,u,_=a.getRange(v,I(v.line,v.ch+1));if(O&&!b.empty())u="surround";else if((x||!O)&&_==c)x&&d(a,v)?u="both":R.indexOf(c)>=0&&a.getRange(v,I(v.line,v.ch+3))==c+c+c?u="skipThree":u="skip";else if(x&&v.ch>1&&R.indexOf(c)>=0&&a.getRange(I(v.line,v.ch-2),v)==c+c){if(v.ch>2&&/\bstring/.test(a.getTokenTypeAt(I(v.line,v.ch-2))))return ee.Pass;u="addFour"}else if(x){var m=v.ch==0?" ":a.getRange(I(v.line,v.ch-1),v);if(!ee.isWordChar(_)&&m!=c&&!ee.isWordChar(m))u="both";else return ee.Pass}else if(O&&(_.length===0||/\s/.test(_)||h.indexOf(_)>-1))u="both";else return ee.Pass;if(!S)S=u;else if(S!=u)return ee.Pass}var y=l%2?s.charAt(l-1):c,P=l%2?c:s.charAt(l+1);a.operation(function(){if(S=="skip")a.execCommand("goCharRight");else if(S=="skipThree")for(var M=0;M<3;M++)a.execCommand("goCharRight");else if(S=="surround"){for(var j=a.getSelections(),M=0;M<j.length;M++)j[M]=y+j[M]+P;a.replaceSelections(j,"around"),j=a.listSelections().slice();for(var M=0;M<j.length;M++)j[M]=g(j[M]);a.setSelections(j)}else S=="both"?(a.replaceSelection(y+P,null),a.triggerElectric(y+P),a.execCommand("goCharLeft")):S=="addFour"&&(a.replaceSelection(y+y+y+y,"before"),a.execCommand("goCharRight"))})}function f(a,c){var o=a.getRange(I(c.line,c.ch-1),I(c.line,c.ch+1));return o.length==2?o:null}function d(a,c){var o=a.getTokenAt(I(c.line,c.ch+1));return/\bstring/.test(o.type)&&o.start==c.ch&&(c.ch==0||!/\bstring/.test(a.getTokenTypeAt(c)))}})},G8my:function(st,Qe,Q){st.exports={flex:"flex___1FMOA"}},HmJG:function(st,Qe,Q){},JkjM:function(st,Qe,Q){"use strict";Q.r(Qe);var ee=Q("9og8"),V=Q("PpiC"),I=Q("WmNS"),H=Q.n(I),k=Q("cDcd"),C=Q.n(k),B=Q("Ty5D"),U=Q("9kvl"),D=Q("14J3"),L=Q("BMrR"),g=Q("jCWc"),p=Q("kPKH"),f=Q("+L6B"),d=Q("2/Rp"),a=Q("k1fw"),c=Q("m3rI"),o=Q("LO5M"),s=Q.n(o),l=Q("h+Ho"),h=function(Le){var Ue,Ge,Fe,ze,be=Le.user,Ke=Le.forumsDetail,He=Le.globalSetting,ve=Le.loading,Re=Le.dispatch,ue=Object(V.a)(Le,["user","forumsDetail","globalSetting","loading","dispatch"]),ie=Ke.forumsDetailData||{},te=ie.author_info,$=ie.memo,X=ie.recommend_shixuns,q=function(){var ne=Object(ee.a)(H.a.mark(function le(){var ye;return H.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:if(!(te!=null&&te.watched)){ke.next=6;break}return ke.next=3,Object(l.a)({user_id:te.user_id});case 3:ke.t0=ke.sent,ke.next=9;break;case 6:return ke.next=8,Object(l.o)({user_id:te.user_id});case 8:ke.t0=ke.sent;case 9:ye=ke.t0,ye&&Re({type:"forumsDetail/setForumsDetailData",payload:Object(a.a)(Object(a.a)({},Ke.forumsDetailData),{},{author_info:Object(a.a)(Object(a.a)({},te),{},{watched:!(te!=null&&te.watched)})})});case 11:case"end":return ke.stop()}},le)}));return function(){return ne.apply(this,arguments)}}();return C.a.createElement("section",{className:s.a.wrap},C.a.createElement("aside",{className:"ml20"},C.a.createElement("div",{className:"bg-white pt40 pb40 pl20 pr20 ".concat(s.a.head)},C.a.createElement("a",{href:"/users/".concat(te==null?void 0:te.login),target:"_blank"},(te==null?void 0:te.image_url)&&C.a.createElement("img",{src:"".concat(c.a.API_SERVER,"/images/").concat(te==null?void 0:te.image_url)})),C.a.createElement("div",{className:"tc font20"},te==null?void 0:te.username),C.a.createElement("div",{className:"tc c-grey-999"},te==null?void 0:te.identity),((Ue=be.userInfo)===null||Ue===void 0?void 0:Ue.user_id)!==(te==null?void 0:te.user_id)&&C.a.createElement(L.a,{justify:"center",className:"mt30 ".concat(s.a.buttonWrap)},C.a.createElement(p.a,null,C.a.createElement(d.a,{type:"primary",className:"mr10",onClick:q},te!=null&&te.watched?"\u53D6\u6D88\u5173\u6CE8":"\u5173\u6CE8")),C.a.createElement(p.a,null,C.a.createElement(d.a,{ghost:!0,className:s.a.privateMessage,href:"/messages/".concat((Ge=be.userInfo)===null||Ge===void 0?void 0:Ge.login,"/message_detail?target_ids=").concat(te==null?void 0:te.user_id),target:"_blank"},"\u79C1\u4FE1")))),!!($!=null&&(Fe=$.tag)!==null&&Fe!==void 0&&Fe.length)&&C.a.createElement("div",{className:"bg-white mt10 pt40 pb40 pl20 pr20"},C.a.createElement("div",{className:"font16"},"\u8BDD\u9898\u6807\u7B7E"),C.a.createElement("div",{className:"mt30 ".concat(s.a.tag)},$==null||((ze=$.tag)===null||ze===void 0)?void 0:ze.map(function(ne){return C.a.createElement("a",null,ne==null?void 0:ne.name)}))),C.a.createElement("div",{className:"pt10 pb10 pl10 pr10"},C.a.createElement("div",{className:"font16 mb20"},"\u63A8\u8350\u5B9E\u8BAD"),C.a.createElement("div",{className:s.a.recommend},X==null?void 0:X.map(function(ne){return C.a.createElement("div",{className:s.a.recommendItem},C.a.createElement("a",{href:"/shixuns/".concat(ne.identifier,"/challenges"),target:"_blank"},C.a.createElement("img",{alt:ne.id,src:"".concat(c.a.API_SERVER,"/").concat(ne.image_url)})),C.a.createElement("div",{className:"".concat(s.a.flex1," ml10")},C.a.createElement("a",{href:"/shixuns/".concat(ne.identifier,"/challenges"),target:"_blank",title:ne.name,className:"".concat(s.a.mWidth147," multi-llipsis1e c-grey-666 mb10")},ne.name),C.a.createElement("div",{className:"c-grey-999"},ne.myshixuns_count," \u4EBA\u5B66\u4E60")))})))))},R=Object(U.a)(function(Me){var Le=Me.user,Ue=Me.forumsDetail,Ge=Me.loading,Fe=Me.globalSetting;return{user:Le,forumsDetail:Ue,globalSetting:Fe,loading:Ge.models.forumsDetail}})(h),x=Q("qVdP"),T=Q("jsC+"),O=Q("5Dmo"),S=Q("3S7+"),E=Q("sPJy"),b=Q("bE4q"),v=Q("lUTK"),u=Q("BvKs"),_=Q("5NDa"),m=Q("5rEg"),y=Q("2qtc"),P=Q("kLXV"),M=Q("miYZ"),j=Q("tsqr"),W=Q("55Ip"),N=Q("wd/R"),w=Q.n(N),G=Q("9Bee"),J=Q("oBTY"),Z=Q("tJVT"),ae=Q("Ot1p"),_e=Q("/MfK"),ce=Q("8JLL"),he=Q.n(ce);w.a.lang("ZH-cn");function fe(Me){var Le=Me.user,Ue=Me.vlist,Ge=Ue===void 0?[]:Ue,Fe=Me.dispatch,ze=Me.params,be=Me.id,Ke=Me.memo_replies,He=Me.forumsDetail;return C.a.createElement("aside",{className:he.a.comment},Ge.map(function(ve,Re){var ue,ie;return C.a.createElement(L.a,{key:Re,className:he.a.commentItem},C.a.createElement(p.a,{span:24},C.a.createElement(L.a,null,C.a.createElement(p.a,{flex:"1"},C.a.createElement("a",{href:"/users/".concat(ve.user_login),target:"_blank",className:"c-light-black"},ve==null?void 0:ve.username),C.a.createElement("span",{className:"c-light-black ml10"},ve.time)),(ve.can_delete||ve.user_id===((ue=Le.userInfo)===null||ue===void 0?void 0:ue.user_id)||ve.user_login===((ie=Le.userInfo)===null||ie===void 0?void 0:ie.login))&&C.a.createElement(p.a,{className:"forums-comment-delete",style:{display:"none"}},C.a.createElement(S.a,{title:"\u5220\u9664"},C.a.createElement(_e.a,{className:"current",onClick:function(){P.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:C.a.createElement("div",{className:"font16 tc"},"\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417\uFF1F"),onOk:function(){var $=Object(ee.a)(H.a.mark(function q(){var ne,le;return H.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return Te.next=2,Object(l.b)({id:ve.id});case 2:ne=Te.sent,le=Ke.find(function(ke){return ke.id===be}).children.filter(function(ke){return ke.id!==ve.id}),Ke.find(function(ke){return ke.id===be}).children=le,Fe({type:"forumsDetail/setForumsDetailData",payload:Object(a.a)(Object(a.a)({},He.forumsDetailData),{},{memo_replies:Object(J.a)(Ke)})});case 6:case"end":return Te.stop()}},q)}));function X(){return $.apply(this,arguments)}return X}()})}}))))),C.a.createElement(p.a,null,C.a.createElement(G.a,{value:ve.content})))}))}var pe=fe,se=Q("1vsH");w.a.lang("ZH-cn");var de=function(Le,Ue){var Ge=Le.user,Fe=Le.forumsDetail,ze=Le.globalSetting,be=Le.loading,Ke=Le.dispatch,He=Le.handleClick,ve=Object(V.a)(Le,["user","forumsDetail","globalSetting","loading","dispatch","handleClick"]),Re=Fe.forumsDetailData||{},ue=Re.memo,ie=Re.memo_replies,te=Object(B.i)(),$=Object(k.useState)(""),X=Object(Z.a)($,2),q=X[0],ne=X[1],le=Object(k.useState)(""),ye=Object(Z.a)(le,2),Te=ye[0],ke=ye[1],rt=Object(k.useState)(-1),nt=Object(Z.a)(rt,2),xt=nt[0],ht=nt[1],Ve=Object(k.useState)(!1),mt=Object(Z.a)(Ve,2),ot=mt[0],Rt=mt[1],bt=Object(k.useState)(1),gt=Object(Z.a)(bt,2),nn=gt[0],zt=gt[1],ft=Object(k.useState)(!1),dt=Object(Z.a)(ft,2),At=dt[0],Nt=dt[1];Object(k.useImperativeHandle)(Ue,function(){return{onMdFouch:tr}}),Object(k.useEffect)(function(){Rt((ue==null?void 0:ue.replies_count)>10)},[ue==null?void 0:ue.replies_count]);var Wt=function(){var lt=Object(ee.a)(H.a.mark(function Ze(){var Kt,Pt,Ot;return H.a.wrap(function(Mt){for(;;)switch(Mt.prev=Mt.next){case 0:return Kt=nn+1,zt(Kt),Mt.next=4,Object(l.h)({id:te.memoId,page:Kt});case 4:Pt=Mt.sent,Pt!=null&&Pt.memo_replies&&(Ke({type:"forumsDetail/setForumsDetailData",payload:Object(a.a)(Object(a.a)({},Fe.forumsDetailData),{},{memo_replies:[].concat(Object(J.a)(ie),Object(J.a)(Pt.memo_replies))})}),Rt(((Ot=Pt.memo_replies)===null||Ot===void 0?void 0:Ot.length)===10));case 6:case"end":return Mt.stop()}},Ze)}));return function(){return lt.apply(this,arguments)}}(),Pn=function(Ze){var Kt,Pt,Ot,Tt;return Object(a.a)(Object(a.a)({},Ze),{},{image_url:(Kt=Ge.userInfo)===null||Kt===void 0?void 0:Kt.image_url,children:[],user_id:(Pt=Ge.userInfo)===null||Pt===void 0?void 0:Pt.user_id,user_login:(Ot=Ge.userInfo)===null||Ot===void 0?void 0:Ot.login,username:(Tt=Ge.userInfo)===null||Tt===void 0?void 0:Tt.username,time:"".concat(Object(se.db)((new Date().getTime()-new Date(Ze.created_at).getTime())/1e3),"\u524D")})},tr=function(){Nt(!0)};return C.a.createElement("section",{className:he.a.wrap},!!(ie!=null&&ie.length)&&C.a.createElement("aside",{className:he.a.content},C.a.createElement("div",{style:{padding:"10px 15px 5px 15px",justifyContent:"space-between",display:"flex"}},C.a.createElement("span",null,"\u5168\u90E8\u56DE\u590D\uFF08",ue.replies_count,"\uFF09")),C.a.createElement("aside",{className:he.a.replyList},ie==null?void 0:ie.map(function(lt,Ze){var Kt;return C.a.createElement(L.a,{gutter:[12,12],key:Ze},C.a.createElement(p.a,{flex:"40px"},C.a.createElement("a",{href:"/users/".concat(lt.user_login),target:"_blank"},C.a.createElement("img",{alt:"\u7528\u6237\u5934\u50CF",width:"50",height:"50",src:"".concat(c.a.IMG_SERVER,"/images/").concat(lt==null?void 0:lt.image_url)}))),C.a.createElement(p.a,{flex:"1"},C.a.createElement(L.a,{align:"middle"},C.a.createElement(p.a,{span:24},C.a.createElement("a",{href:"/users/".concat(lt.user_login),target:"_blank"},C.a.createElement("span",{className:"c-light-black"},lt==null?void 0:lt.username)),C.a.createElement("span",{className:"c-light-black ml10"},lt.time)),C.a.createElement(p.a,{span:24},C.a.createElement("div",{onClick:He},C.a.createElement(G.a,{value:lt.content}))),!!(lt!=null&&(Kt=lt.children)!==null&&Kt!==void 0&&Kt.length)&&C.a.createElement(pe,{user:Ge,id:lt==null?void 0:lt.id,vlist:lt==null?void 0:lt.children,dispatch:Ke,params:te,memo_replies:ie,forumsDetail:Fe}),C.a.createElement(p.a,{span:24,className:"mt5 c-light-black"},xt===Ze?C.a.createElement("aside",null,C.a.createElement(ae.a,{onChange:function(Ot){ke(Ot)},height:150,isFocus:!0,placeholder:"\u6211\u8981\u56DE\u590D..."}),C.a.createElement(L.a,null,C.a.createElement(p.a,{span:24,className:"tr"},C.a.createElement(d.a,{type:"primary",size:"large",onClick:Object(ee.a)(H.a.mark(function Pt(){var Ot;return H.a.wrap(function(Mt){for(;;)switch(Mt.prev=Mt.next){case 0:if(!(Te==="")){Mt.next=4;break}j.b.error("\u8BF7\u8F93\u5165\u5185\u5BB9"),Mt.next=9;break;case 4:return Mt.next=6,Object(l.k)({parent_id:lt.id,content:Te});case 6:Ot=Mt.sent,ke(null),Ot&&(ht(-1),ie.find(function(dn){return dn.id===Ot.parent_id}).children.push(Pn(Ot)),Ke({type:"forumsDetail/setForumsDetailData",payload:Object(a.a)(Object(a.a)({},Fe.forumsDetailData),{},{memo:Object(a.a)(Object(a.a)({},ue),{},{replies_count:ue.replies_count+1}),memo_replies:Object(J.a)(ie)})}));case 9:case"end":return Mt.stop()}},Pt)}))},"\u53D1\u9001")))):C.a.createElement("div",{className:"tr"},C.a.createElement("span",{className:"iconfont icon-huifu1 mr15 ml30 current",onClick:function(){return ht(Ze)}}),C.a.createElement(S.a,{title:lt.user_praise?"\u53D6\u6D88\u70B9\u8D5E":"\u70B9\u8D5E"},C.a.createElement("span",{className:lt.user_praise?"c-orange":"c-gery-888"},C.a.createElement("i",{className:"iconfont icon-dianzan mr3 current",onClick:Object(ee.a)(H.a.mark(function Pt(){var Ot;return H.a.wrap(function(Mt){for(;;)switch(Mt.prev=Mt.next){case 0:return Mt.next=2,Object(l.i)({id:lt.id,container_type:"Memo",type:lt.user_praise?0:1});case 2:Ot=Mt.sent,(Ot==null?void 0:Ot.praise_count)>=0&&(ie.find(function(dn){return dn.id===lt.id}).user_praise=!lt.user_praise,ie.find(function(dn){return dn.id===lt.id}).praise_count=Ot==null?void 0:Ot.praise_count,Ke({type:"forumsDetail/setForumsDetailData",payload:Object(a.a)(Object(a.a)({},Fe.forumsDetailData),{},{memo_replies:Object(J.a)(ie)})}));case 4:case"end":return Mt.stop()}},Pt)}))}),lt.praise_count>0?lt.praise_count:"")))))))}))),ot&&C.a.createElement("aside",{className:"bg-white pb20",style:{display:"flex",justifyContent:"center"}},C.a.createElement(L.a,{justify:"space-between"},C.a.createElement(p.a,null),C.a.createElement(p.a,null,ot&&C.a.createElement("a",{className:"c-black",onClick:Wt},"\u67E5\u770B\u66F4\u591A\u8BC4\u8BBA")))),C.a.createElement("aside",{className:he.a.reply},C.a.createElement(ae.a,{onBlur:function(){return Nt(!1)},isFocus:At,defaultValue:q,id:"writeForumsReviewId",onChange:function(Ze){ne(Ze)},placeholder:"\u6211\u8981\u56DE\u590D...",height:240}),C.a.createElement(L.a,null,C.a.createElement(p.a,{flex:"1"}),C.a.createElement(p.a,null,C.a.createElement(d.a,{type:"primary",size:"large",onClick:Object(ee.a)(H.a.mark(function lt(){var Ze;return H.a.wrap(function(Pt){for(;;)switch(Pt.prev=Pt.next){case 0:if(!(q==="")){Pt.next=4;break}j.b.error("\u8BF7\u8F93\u5165\u5185\u5BB9"),Pt.next=9;break;case 4:return Pt.next=6,Object(l.k)({parent_id:ue.id,content:q});case 6:Ze=Pt.sent,ne(null),Ze&&Ke({type:"forumsDetail/setForumsDetailData",payload:Object(a.a)(Object(a.a)({},Fe.forumsDetailData),{},{memo:Object(a.a)(Object(a.a)({},ue),{},{replies_count:ue.replies_count+1}),memo_replies:[Pn(Ze)].concat(Object(J.a)(ie))})});case 9:case"end":return Pt.stop()}},lt)}))},"\u53D1\u9001")))))},Ee=Object(U.a)(function(Me){var Le=Me.user,Ue=Me.forumsDetail,Ge=Me.loading,Fe=Me.globalSetting;return{user:Le,forumsDetail:Ue,globalSetting:Fe,loading:Ge.models.forumsDetail}},null,null,{forwardRef:!0})(Object(k.forwardRef)(de)),Pe=Q("smFo"),Se=Q.n(Pe),Je=Q("RCxd"),qe=Q("kaH+"),Ae=Q("dhSg"),we={5:"\u6280\u672F\u5206\u4EAB",3:"\u64CD\u4F5C\u6307\u5357",16:"\u901A\u77E5\u516C\u544A"},De=function(Le){var Ue,Ge,Fe,ze,be,Ke=Le.user,He=Le.forumsDetail,ve=Le.globalSetting,Re=Le.loading,ue=Le.dispatch,ie=Object(V.a)(Le,["user","forumsDetail","globalSetting","loading","dispatch"]),te=He.forumsDetailData||{},$=te.author_info,X=te.memo,q=te.attachments_list,ne=Object(k.useRef)(),le=Object(k.useRef)(),ye=function(){var Ve=Object(ee.a)(H.a.mark(function mt(){var ot,Rt;return H.a.wrap(function(gt){for(;;)switch(gt.prev=gt.next){case 0:return ot={id:X.id,sticky:X.sticky?0:1},gt.next=3,Object(l.m)(ot);case 3:Rt=gt.sent,(Rt==null?void 0:Rt.status)===0&&ue({type:"forumsDetail/setForumsDetailData",payload:Object(a.a)(Object(a.a)({},He.forumsDetailData),{},{memo:Object(a.a)(Object(a.a)({},X),{},{sticky:!(X!=null&&X.sticky)})})});case 5:case"end":return gt.stop()}},mt)}));return function(){return Ve.apply(this,arguments)}}(),Te=function(){var Ve=Object(ee.a)(H.a.mark(function mt(){var ot;return H.a.wrap(function(bt){for(;;)switch(bt.prev=bt.next){case 0:return bt.next=2,Object(l.b)({id:X==null?void 0:X.id});case 2:ot=bt.sent,(ot==null?void 0:ot.status)===0&&(j.b.success("\u5220\u9664\u6210\u529F"),U.d.push("/forums")),(ot==null?void 0:ot.status)===-1&&U.d.push("/forums");case 5:case"end":return bt.stop()}},mt)}));return function(){return Ve.apply(this,arguments)}}(),ke=function(){var Ve=Object(ee.a)(H.a.mark(function mt(){return H.a.wrap(function(Rt){for(;;)switch(Rt.prev=Rt.next){case 0:P.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u5956\u52B1\u8BBE\u7F6E",content:C.a.createElement("div",{className:"font14 tc"},C.a.createElement(m.a,{defaultValue:ne.current,onChange:function(gt){return ne.current=gt.target.value}})),onOk:function(){var bt=Object(ee.a)(H.a.mark(function nn(){var zt;return H.a.wrap(function(dt){for(;;)switch(dt.prev=dt.next){case 0:return dt.next=2,Object(l.l)({id:X==null?void 0:X.id,container_type:"Memo",score:ne.current?Number(ne.current):0,user_id:$==null?void 0:$.user_id});case 2:if(zt=dt.sent,ne.current=null,!((zt==null?void 0:zt.code)>0)){dt.next=8;break}return ue({type:"forumsDetail/setForumsDetailData",payload:Object(a.a)(Object(a.a)({},He.forumsDetailData),{},{memo:Object(a.a)(Object(a.a)({},X),{},{reward:zt==null?void 0:zt.code})})}),j.b.success("\u5956\u52B1\u6210\u529F"),dt.abrupt("return");case 8:j.b.success("\u5956\u52B1\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7CFB\u7EDF\u7BA1\u7406\u5458\uFF01");case 9:case"end":return dt.stop()}},nn)}));function gt(){return bt.apply(this,arguments)}return gt}()});case 1:case"end":return Rt.stop()}},mt)}));return function(){return Ve.apply(this,arguments)}}(),rt=function(){le.current.onMdFouch&&le.current.onMdFouch()},nt=function(){var Ve=Object(ee.a)(H.a.mark(function mt(){var ot;return H.a.wrap(function(bt){for(;;)switch(bt.prev=bt.next){case 0:return bt.next=2,Object(l.i)({id:X.id,container_type:"Memo",type:1});case 2:ot=bt.sent,(ot==null?void 0:ot.praise_count)>=0&&ue({type:"forumsDetail/setForumsDetailData",payload:Object(a.a)(Object(a.a)({},He.forumsDetailData),{},{memo:Object(a.a)(Object(a.a)({},X),{},{user_praise:!(X!=null&&X.user_praise),memo_praise_count:ot==null?void 0:ot.praise_count})})});case 4:case"end":return bt.stop()}},mt)}));return function(){return Ve.apply(this,arguments)}}(),xt=C.a.createElement(u.a,{className:Se.a.menu},((Ue=Ke.userInfo)===null||Ue===void 0?void 0:Ue.admin)&&(X==null?void 0:X.sticky)&&C.a.createElement(u.a.Item,null,C.a.createElement("a",{onClick:function(){return ye()}},"\u53D6\u6D88\u7F6E\u9876")),((Ge=Ke.userInfo)===null||Ge===void 0?void 0:Ge.admin)&&!(X!=null&&X.sticky)&&C.a.createElement(u.a.Item,null,C.a.createElement("a",{onClick:function(){return ye()}},"\u7F6E\xA0\xA0\u9876")),C.a.createElement(u.a.Item,null,C.a.createElement(W.a,{to:"/forums/".concat(X==null?void 0:X.id,"/edit")},"\u7F16\xA0\xA0\u8F91")),C.a.createElement(u.a.Item,null,C.a.createElement("a",{onClick:function(){P.a.confirm({title:"\u63D0\u793A",icon:C.a.createElement(Je.a,null),content:"\u5E16\u5B50\u5C06\u88AB\u5220\u9664\uFF0C\u65E0\u6CD5\u6062\u590D\u3002\u662F\u5426\u786E\u8BA4\u5220\u9664\uFF1F",okText:"\u786E\u8BA4",onOk:function(){Te()},cancelText:"\u53D6\u6D88"})}},"\u5220\xA0\xA0\u9664"))),ht=function(mt){var ot=mt.target,Rt=ot.nodeName,bt=ot.src;Rt==="IMG"&&(Ae.a.publish("preview-image",bt),console.log("src:",bt))};return Object(k.useEffect)(function(){},[]),C.a.createElement("section",{className:Se.a.wrap},C.a.createElement(b.a,{separator:"/",className:"mb5"},C.a.createElement(b.a.Item,null,C.a.createElement(W.a,{to:"/forums/categories/".concat(X==null?void 0:X.forum_id)},we[X==null?void 0:X.forum_id])),C.a.createElement(b.a.Item,null,"\u8BE6\u60C5")),C.a.createElement("header",{className:"bg-white pt40 pb40 pl30 pr30 ".concat(Se.a.header)},C.a.createElement(L.a,{align:"middle"},C.a.createElement(p.a,{flex:1,className:"font24 mb5"},C.a.createElement("span",{className:Se.a.title},X==null?void 0:X.subject),(X==null?void 0:X.sticky)&&C.a.createElement("span",{className:Se.a.top},"\u7F6E\u9876"),!!(X!=null&&X.reward)&&C.a.createElement(S.a,{placement:"bottom",title:"\u83B7\u5F97\u5E73\u53F0\u5956\u52B1\u91D1\u5E01\uFF1A".concat(X==null?void 0:X.reward)},C.a.createElement("span",{className:"ml10 c-orange-ff7"},C.a.createElement("i",{className:"iconfont icon-gift font16 mr5"}),C.a.createElement("span",{className:"font14"},X==null?void 0:X.reward)))),C.a.createElement(p.a,null,(((Fe=Ke.userInfo)===null||Fe===void 0?void 0:Fe.admin)||((ze=Ke.userInfo)===null||ze===void 0?void 0:ze.user_id)===($==null?void 0:$.user_id))&&C.a.createElement(T.a,{overlay:xt},C.a.createElement("i",{className:"fa fa-bars font-16 current c-grey-bcb"})))),C.a.createElement(L.a,{align:"middle",className:"font14"},C.a.createElement(p.a,{flex:1,className:"c-grey-999"},C.a.createElement("span",null,w()(X==null?void 0:X.time).fromNow()," \u53D1\u5E03")),C.a.createElement(p.a,{className:"c-grey-999"},((be=Ke.userInfo)===null||be===void 0?void 0:be.admin)&&C.a.createElement(S.a,{placement:"bottom",title:"\u5E16\u5B50\u5956\u52B1"},C.a.createElement("span",{className:"current pr10 ".concat(Se.a.line),onClick:ke},C.a.createElement("i",{className:"iconfont icon-jiangli font18 mr5"}))),C.a.createElement("span",{className:"pr10 pl10 ".concat(X!=null&&X.replies_count?Se.a.line:"")},C.a.createElement("i",{className:"iconfont icon-liulanyan font18 mr5"}),X==null?void 0:X.viewed_count),!!(X!=null&&X.replies_count)&&C.a.createElement(S.a,{placement:"bottom",title:"\u5199\u8BC4\u8BBA"},C.a.createElement("span",{className:"current pl10",onClick:rt},C.a.createElement("i",{className:"iconfont icon-huifu1 font18 mr5"}),X==null?void 0:X.replies_count))))),C.a.createElement("main",{className:"bg-white pt40 pb40 pl40 pr40"},C.a.createElement("div",{onClick:ht},C.a.createElement(G.a,{value:X==null?void 0:X.content})),C.a.createElement("div",{className:"bg-white pl40 pr40 mt40"},C.a.createElement("div",{className:"mt10 mb20 ".concat(Se.a.flexCenter)},C.a.createElement("div",{className:"".concat(Se.a.like," ").concat(X!=null&&X.user_praise?"":Se.a.canLike),onClick:nt},C.a.createElement("i",{className:"iconfont icon-dianzan font18"}),C.a.createElement("br",null),C.a.createElement("span",null,X==null?void 0:X.memo_praise_count)))),!!(q!=null&&q.length)&&C.a.createElement("div",{className:"mt40"},q==null?void 0:q.map(function(Ve){return C.a.createElement("div",{className:"c-grey-888 ".concat(Se.a.flexCenter)},C.a.createElement("i",{className:"iconfont icon-fujian mr10 font14 c-green-29b"}),C.a.createElement("a",{href:Ve==null?void 0:Ve.url,title:Ve==null?void 0:Ve.title,className:"".concat(Se.a.attachmentName," mr10")},Ve==null?void 0:Ve.title),C.a.createElement("span",{className:"font12 c-grey-666 mt3"},Ve==null?void 0:Ve.filesize))}))),C.a.createElement(Ee,{ref:le,handleClick:ht}),C.a.createElement(qe.a,null))},Xe=Object(U.a)(function(Me){var Le=Me.user,Ue=Me.forumsDetail,Ge=Me.loading,Fe=Me.globalSetting;return{user:Le,forumsDetail:Ue,globalSetting:Fe,loading:Ge.effects}})(De),We=Q("G8my"),Ce=Q.n(We),Oe=function(Le){var Ue=Le.forumsDetail,Ge=Le.globalSetting,Fe=Le.loading,ze=Le.dispatch,be=Object(V.a)(Le,["forumsDetail","globalSetting","loading","dispatch"]),Ke=Object(B.i)();Object(k.useEffect)(function(){He()},[Ke.memoId]);var He=function(){var ve=Object(ee.a)(H.a.mark(function Re(){return H.a.wrap(function(ie){for(;;)switch(ie.prev=ie.next){case 0:ze({type:"forumsDetail/getForumsDetailData",payload:{id:Ke.memoId}});case 1:case"end":return ie.stop()}},Re)}));return function(){return ve.apply(this,arguments)}}();return C.a.createElement("section",{className:"edu-container mb20 mt30 ".concat(Ce.a.flex)},C.a.createElement(Xe,null),C.a.createElement(R,null))},et=Qe.default=Object(U.a)(function(Me){var Le=Me.forumsDetail,Ue=Me.loading,Ge=Me.globalSetting;return{forumsDetail:Le,globalSetting:Ge,loading:Ue.models.forumsDetail}})(Oe)},LO5M:function(st,Qe,Q){st.exports={wrap:"wrap___1d4rP",head:"head___1_Uzf",recommendItem:"recommendItem___IStR9",buttonWrap:"buttonWrap___3dpFm",privateMessage:"privateMessage___24GfS",flex1:"flex1___3wIqQ",mWidth147:"mWidth147___3ODny"}},LdHM:function(st,Qe,Q){"use strict";Q.d(Qe,"b",function(){return h}),Q.d(Qe,"a",function(){return x});var ee=Q("1OyB"),V=Q("vuIU"),I=Q("Ji7U"),H=Q("LK+K"),k=Q("cDcd"),C=Q("rePB"),B=Q("Ff2n"),U=Q("ODXe"),D=Q("4IlW"),L=Q("bX4T"),g=Q("YrtM"),p=Q("TSYQ"),f=Q.n(p),d=Q("+nKL"),a=Q("8OUc"),c=function(G,J){var Z=G.prefixCls,ae=G.id,_e=G.flattenOptions,ce=G.childrenAsData,he=G.values,fe=G.searchValue,pe=G.multiple,se=G.defaultActiveFirstOption,de=G.height,Ee=G.itemHeight,Pe=G.notFoundContent,Se=G.open,Je=G.menuItemSelectedIcon,qe=G.virtual,Ae=G.onSelect,we=G.onToggleOpen,De=G.onActiveValue,Xe=G.onScroll,We=G.onMouseEnter,Ce="".concat(Z,"-item"),Oe=Object(g.a)(function(){return _e},[Se,_e],function(Re,ue){return ue[0]&&Re[1]!==ue[1]}),et=k.useRef(null),Me=function(ue){ue.preventDefault()},Le=function(ue){et.current&&et.current.scrollTo({index:ue})},Ue=function(ue){for(var ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,te=Oe.length,$=0;$<te;$+=1){var X=(ue+$*ie+te)%te,q=Oe[X],ne=q.group,le=q.data;if(!ne&&!le.disabled)return X}return-1},Ge=k.useState(function(){return Ue(0)}),Fe=Object(U.a)(Ge,2),ze=Fe[0],be=Fe[1],Ke=function(ue){be(ue);var ie=Oe[ue];if(!ie){De(null,-1);return}De(ie.data.value,ue)};k.useEffect(function(){Ke(se!==!1?Ue(0):-1)},[Oe.length,fe]),k.useEffect(function(){var Re=setTimeout(function(){if(!pe&&Se&&he.size===1){var ue=Array.from(he)[0],ie=Oe.findIndex(function(te){var $=te.data;return $.value===ue});Ke(ie),Le(ie)}});return function(){return clearTimeout(Re)}},[Se]);var He=function(ue){ue!==void 0&&Ae(ue,{selected:!he.has(ue)}),pe||we(!1)};if(k.useImperativeHandle(J,function(){return{onKeyDown:function(ue){var ie=ue.which;switch(ie){case D.a.UP:case D.a.DOWN:{var te=0;if(ie===D.a.UP?te=-1:ie===D.a.DOWN&&(te=1),te!==0){var $=Ue(ze+te,te);Le($),Ke($)}break}case D.a.ENTER:{var X=Oe[ze];X&&!X.data.disabled?He(X.data.value):He(void 0),Se&&ue.preventDefault();break}case D.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(ue){Le(ue)}}}),Oe.length===0)return k.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),className:"".concat(Ce,"-empty"),onMouseDown:Me},Pe);function ve(Re){var ue=Oe[Re];if(!ue)return null;var ie=ue.data||{},te=ie.value,$=ie.label,X=ie.children,q=Object(L.a)(ie,!0),ne=ce?X:$;return ue?k.createElement("div",Object.assign({"aria-label":typeof ne=="string"?ne:null},q,{key:Re,role:"option",id:"".concat(ae,"_list_").concat(Re),"aria-selected":he.has(te)}),te):null}return k.createElement(k.Fragment,null,k.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),style:{height:0,width:0,overflow:"hidden"}},ve(ze-1),ve(ze),ve(ze+1)),k.createElement(d.a,{itemKey:"key",ref:et,data:Oe,height:de,itemHeight:Ee,fullHeight:!1,onMouseDown:Me,onScroll:Xe,virtual:qe,onMouseEnter:We},function(Re,ue){var ie,te=Re.group,$=Re.groupOption,X=Re.data,q=X.label,ne=X.key;if(te)return k.createElement("div",{className:f()(Ce,"".concat(Ce,"-group"))},q!==void 0?q:ne);var le=X.disabled,ye=X.value,Te=X.title,ke=X.children,rt=X.style,nt=X.className,xt=Object(B.a)(X,["disabled","value","title","children","style","className"]),ht=he.has(ye),Ve="".concat(Ce,"-option"),mt=f()(Ce,Ve,nt,(ie={},Object(C.a)(ie,"".concat(Ve,"-grouped"),$),Object(C.a)(ie,"".concat(Ve,"-active"),ze===ue&&!le),Object(C.a)(ie,"".concat(Ve,"-disabled"),le),Object(C.a)(ie,"".concat(Ve,"-selected"),ht),ie)),ot=ce?ke:q,Rt=!Je||typeof Je=="function"||ht;return k.createElement("div",Object.assign({},xt,{"aria-selected":ht,className:mt,title:Te,onMouseMove:function(){if(ze===ue||le)return;Ke(ue)},onClick:function(){le||He(ye)},style:rt}),k.createElement("div",{className:"".concat(Ve,"-content")},ot||ye),k.isValidElement(Je)||ht,Rt&&k.createElement(a.a,{className:"".concat(Ce,"-option-state"),customizeIcon:Je,customizeIconProps:{isSelected:ht}},ht?"\u2713":null))}))},o=k.forwardRef(c);o.displayName="OptionList";var s=o,l=function(){return null};l.isSelectOption=!0;var h=l,R=function(){return null};R.isSelectOptGroup=!0;var x=R,T=Q("VTBJ"),O=Q("Zm9Q");function S(w){var G=w.key,J=w.props,Z=J.children,ae=J.value,_e=Object(B.a)(J,["children","value"]);return Object(T.a)({key:G,value:ae!==void 0?ae:G,children:Z},_e)}function E(w){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(w).map(function(J,Z){if(!k.isValidElement(J)||!J.type)return null;var ae=J.type.isSelectOptGroup,_e=J.key,ce=J.props,he=ce.children,fe=Object(B.a)(ce,["children"]);return G||!ae?S(J):Object(T.a)(Object(T.a)({key:"__RC_SELECT_GRP__".concat(_e===null?Z:_e,"__"),label:_e},fe),{},{options:E(he)})}).filter(function(J){return J})}var b=Q("2Qr1"),v=Q("qNPg"),u=Q("U8pU"),_=Q("Kwbf"),m=Q("WKfj");function y(w){var G=w.mode,J=w.options,Z=w.children,ae=w.backfill,_e=w.allowClear,ce=w.placeholder,he=w.getInputElement,fe=w.showSearch,pe=w.onSearch,se=w.defaultOpen,de=w.autoFocus,Ee=w.labelInValue,Pe=w.value,Se=w.inputValue,Je=w.optionLabelProp,qe=G==="multiple"||G==="tags",Ae=fe!==void 0?fe:qe||G==="combobox",we=J||E(Z);if(Object(_.a)(G!=="tags"||we.every(function(Ce){return!Ce.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),G==="tags"||G==="combobox"){var De=we.some(function(Ce){return Ce.options?Ce.options.some(function(Oe){return typeof("value"in Oe?Oe.value:Oe.key)=="number"}):typeof("value"in Ce?Ce.value:Ce.key)=="number"});Object(_.a)(!De,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(_.a)(G!=="combobox"||!Je,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(_.a)(G==="combobox"||!ae,"`backfill` only works with `combobox` mode."),Object(_.a)(G==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(_.b)(G!=="combobox"||!he||!_e||!ce,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),pe&&!Ae&&G!=="combobox"&&G!=="tags"&&Object(_.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(_.b)(!se||de,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Pe!=null){var Xe=Object(m.d)(Pe);Object(_.a)(!Ee||Xe.every(function(Ce){return Object(u.a)(Ce)==="object"&&("key"in Ce||"value"in Ce)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(_.a)(!qe||Array.isArray(Pe),"`value` should be array when `mode` is `multiple` or `tags`")}if(Z){var We=null;Object(O.a)(Z).some(function(Ce){if(!k.isValidElement(Ce)||!Ce.type)return!1;var Oe=Ce.type;if(Oe.isSelectOption)return!1;if(Oe.isSelectOptGroup){var et=Object(O.a)(Ce.props.children).every(function(Me){return!k.isValidElement(Me)||!Ce.type||Me.type.isSelectOption?!0:(We=Me.type,!1)});return!et}return We=Oe,!0}),We&&Object(_.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(We.displayName||We.name||We,"`.")),Object(_.a)(Se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=y,M=Object(v.a)({prefixCls:"rc-select",components:{optionList:s},convertChildrenToData:E,flattenOptions:b.d,getLabeledValue:b.e,filterOptions:b.b,isValueDisabled:b.g,findValueOption:b.c,warningProps:P,fillOptionsWithMissingValue:b.a}),j=function(w){Object(I.a)(J,w);var G=Object(H.a)(J);function J(){var Z;return Object(ee.a)(this,J),Z=G.apply(this,arguments),Z.selectRef=k.createRef(),Z.focus=function(){Z.selectRef.current.focus()},Z.blur=function(){Z.selectRef.current.blur()},Z}return Object(V.a)(J,[{key:"render",value:function(){return k.createElement(M,Object.assign({ref:this.selectRef},this.props))}}]),J}(k.Component);j.Option=h,j.OptGroup=x;var W=j,N=Qe.c=W},M8RZ:function(st,Qe,Q){"use strict";Q.d(Qe,"a",function(){return D});var ee=Q("fWQN"),V=Q("mtLc"),I=Q("yKVA"),H=Q("879j"),k=Q("cDcd"),C=Q.n(k),B=Q("faye"),U=Q.n(B),D=function(L){Object(I.a)(p,L);var g=Object(H.a)(p);function p(f){var d;Object(ee.a)(this,p),d=g.call(this,f);var a=window.document;return d.node=a.createElement("div"),a.body.appendChild(d.node),d}return Object(V.a)(p,[{key:"render",value:function(){var d=this.props.children;return Object(B.createPortal)(d,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(C.a.Component)},Ot1p:function(st,Qe,Q){"use strict";var ee=Q("2qtc"),V=Q("kLXV"),I=Q("rAM+"),H=Q("miYZ"),k=Q("tsqr"),C=Q("9og8"),B=Q("tJVT"),U=Q("jrin"),D=Q("WmNS"),L=Q.n(D),g=Q("cDcd"),p=Q.n(g),f=Q("VrN/"),d=Q.n(f),a=Q("bdgK"),c=Q("p77/"),o=Q("Bd2K"),s=Q("ELLl"),l=Q("19Vz"),h=Q("lZu9"),R=Q("+NIl"),x=Q("kSUc"),T=Q("9Bee"),O=function(le){var ye=le.value,Te=ye===void 0?"":ye,ke=le.className,rt=le.showTextOnly,nt=le.showLines,xt=le.style,ht=xt===void 0?{}:xt,Ve=Object(g.useMemo)(function(){return""},[Te]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ve}}))},S=Q("0Owb"),E=Q("dejd"),b=Q("C+DQ"),v=Q("1vsH"),u=Q("m3rI"),_=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(le){var ye=le.onActionCallback,Te=le.title,ke=le.icon,rt=le.actionName,nt=le.className,xt=nt===void 0?"":nt,ht=le.children;function Ve(){ye(rt)}return p.a.createElement("a",{title:Te,className:xt,onClick:Ve},p.a.createElement("i",{className:"md-iconfont ".concat(ke)}),ht)}var y=function(le){var ye=le.watch,Te=le.showNullButton,ke=le.onActionCallback,rt=le.fullScreen,nt=le.insertTemp,xt=le.hidetoolBar,ht=le.uuid,Ve=le.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(u.a.PROXY_SERVER)));var mt=[].concat(_,[{title:"".concat(ye?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ye?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!xt&&mt.map(function(ot,Rt){return p.a.createElement("li",{key:Rt},ot.actionName?p.a.createElement(m,Object(S.a)({},ot,{onActionCallback:ke})):p.a.createElement("span",{className:"v-line"}))}),Te?p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ke},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,nt&&p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(nt),onActionCallback:ke},p.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),p.a.createElement("li",{className:"btn-full-screen"},p.a.createElement(m,{icon:"".concat(rt?"icon-shrink":"icon-enlarge"),title:rt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ke})))},P=Q("M8RZ"),M=Q("+L6B"),j=Q("2/Rp"),W=Q("y8nQ"),N=Q("Vl3Y"),w=Q("5NDa"),G=Q("5rEg"),J={labelCol:{span:4},wrapperCol:{span:20}},Z=function(le){var ye=le.callback,Te=le.onCancel;function ke(rt){ye(rt)}return p.a.createElement(N.a,Object(S.a)({},J,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ke}),p.a.createElement(N.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(G.a,null)),p.a.createElement(N.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(G.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:Te},"\u53D6\u6D88")))},ae=Q("7ahc"),_e=Q("HmJG"),ce=Q("BjJ7"),he=N.a.useForm,fe={width:280,marginRight:10},pe={labelCol:{span:5},wrapperCol:{span:19}},se=function(le){var ye=le.callback,Te=le.onCancel,ke=he(),rt=Object(B.a)(ke,1),nt=rt[0];function xt(mt){ye(mt)}function ht(mt,ot){if(mt.status===-1){k.b.error(mt.message);return}nt.setFieldsValue({src:"/api/attachments/".concat(mt.id),type:ot.type})}function Ve(mt){var ot=mt.target.files[0];Ee(ot,ht)}return p.a.createElement(N.a,Object(S.a)({form:nt},pe,{className:"upload-image-panel",onFinish:xt}),p.a.createElement(N.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(N.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(G.a,{style:fe})),p.a.createElement(de,{onFileChange:Ve}))),p.a.createElement(N.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(G.a,{style:{width:264}})),p.a.createElement(N.a.Item,{style:{textAlign:"right"}},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:Te},"\u53D6\u6D88")))};function de(le){var ye=le.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:ye}))}function Ee(le,ye){if(!le)throw new String("\u6CA1\u6709\u6587\u4EF6");var Te=new FormData;Te.append("editormd-image-file",le),Te.append("file_param_name","editormd-image-file"),Te.append("byxhr","true");var ke=new window.XMLHttpRequest;ke.withCredentials=!0,ke.addEventListener("load",function(rt){ye(JSON.parse(rt.target.responseText),le)},!1),ke.addEventListener("error",function(rt){console.error(rt)},!1),ke.open("POST","".concat(ce.a,"/api/attachments.json")),ke.send(Te)}var Pe=Q("giR+"),Se=Q("fyUT"),Je=Q("7Kak"),qe=Q("9yH6"),Ae=qe.a.Group,we={margin:"0 8px"},De=function(le){var ye=le.callback,Te=le.onCancel;function ke(rt){ye(rt)}return p.a.createElement(N.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ke},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:we},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:we},"\u884C\u6570"),p.a.createElement(N.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(Se.a,null)),p.a.createElement("span",{style:we},"\u5217\u6570"),p.a.createElement(N.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(Se.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:we},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(N.a.Item,{name:"align"},p.a.createElement(Ae,null,p.a.createElement(qe.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(qe.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(qe.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(qe.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:Te},"\u53D6\u6D88")))},Xe=Q("ErOA"),We=Q("7Cbv"),Ce="link",Oe="upload-image",et="code-block",Me="add-table",Le="------------",Ue={default:Le,left:":".concat(Le),center:":".concat(Le,":"),right:"".concat(Le,":")},Ge=Q("9VGf"),Fe,ze;function be(){}var Ke=0,He=1e4,ve="\u2581",Re=`
|
|
**\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 ue(le){return/^\d+$/.test(le)?"".concat(le,"px"):le}var ie=navigator.platform.toUpperCase().indexOf("MAC")>=0,te=ie?"Cmd":"Ctrl",$=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],X=(Fe={},Object(U.a)(Fe,te+"-B","bold"),Object(U.a)(Fe,te+"-I","italic"),Fe),q=(ze={},Object(U.a)(ze,Ce,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(ze,et,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(ze,Oe,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(ze,Me,"\u6DFB\u52A0\u8868\u683C"),ze),ne=Qe.a=function(le){var ye=le.defaultValue,Te=ye===void 0?"":ye,ke=le.onChange,rt=le.width,nt=rt===void 0?"100%":rt,xt=le.height,ht=xt===void 0?400:xt,Ve=le.miniToolbar,mt=Ve===void 0?!1:Ve,ot=le.isFocus,Rt=ot===void 0?!1:ot,bt=le.watch,gt=le.insertTemp,nn=le.mode,zt=nn===void 0?"markdown":nn,ft=le.id,dt=ft===void 0?"markdown-editor-id":ft,At=le.showResizeBar,Nt=At===void 0?!1:At,Wt=le.noStorage,Pn=Wt===void 0?!1:Wt,tr=le.showNullButton,lt=tr===void 0?!1:tr,Ze=le.hidetoolBar,Kt=Ze===void 0?!1:Ze,Pt=le.fullScreen,Ot=Pt===void 0?!1:Pt,Tt=le.onBlur,Mt=le.onCMBeforeChange,dn=le.onFullScreen,_r=le.className,Ne=_r===void 0?"":_r,vt=le.disablePaste,zr=vt===void 0?!1:vt,yr=le.placeholder,br=yr===void 0?"":yr,nr=le.values,Er=nr===void 0?"":nr,yt=Object(g.useState)(null),Ri=Object(B.a)(yt,2),Be=Ri[0],Tr=Ri[1],xn=Object(g.useState)(Te),Vr=Object(B.a)(xn,2),rr=Vr[0],Sn=Vr[1],Xr=Object(g.useState)(bt),Yr=Object(B.a)(Xr,2),On=Yr[0],$r=Yr[1],Ai=Object(g.useState)(Ot),Jr=Object(B.a)(Ai,2),Rn=Jr[0],Li=Jr[1],aa=Object(g.useState)(""),Qr=Object(B.a)(aa,2),on=Qr[0],zn=Qr[1],sa=Object(g.useState)(0),ir=Object(B.a)(sa,2),An=ir[0],Zr=ir[1],oa=Object(g.useState)(ht),Ci=Object(B.a)(oa,2),Ii=Ci[0],xr=Ci[1],Di=Object(g.useState)(!1),Pi=Object(B.a)(Di,2),la=Pi[0],wr=Pi[1],ar=Object(g.useRef)(Object(We.a)()),sr=Object(g.useRef)(!1),Sr=Object(g.useRef)(),Fn=Object(g.useRef)(),Bn=Object(g.useRef)(),jn=Object(g.useRef)(),Or=Object(g.useRef)(),Mi=function(){var at=Object(C.a)(L.a.mark(function _t(){var ct,wt;return L.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return Ut.next=2,Object(Xe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ar.current}});case 2:wt=Ut.sent,wt!=null&&(ct=wt.attachments)!==null&&ct!==void 0&&ct.length&&(console.log("cm:",Be,Fn),wt.attachments.map(function(Lt){Lt.content_type.indexOf("image")>-1?Be.replaceSelection(".concat(Lt.content_type,")")):Lt.content_type.indexOf("video")>-1?Be.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Lt.content_type.indexOf("pdf")>-1?Be.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Lt.content_type,'&disposition=inline" target="_blank">').concat(Lt.name,"</a>")):Be.replaceSelection("[".concat(Lt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Lt.content_type,")"))}));case 4:case"end":return Ut.stop()}},_t)}));return function(){return at.apply(this,arguments)}}();Object(g.useEffect)(function(){Sn(Er),Be==null||Be.setValue(Er)},[Er]),Object(g.useEffect)(function(){dn==null||dn(Rn)},[Rn]),Object(g.useEffect)(function(){if(Fn.current){var at=d.a.fromTextArea(Fn.current,{mode:zt,lineNumbers:!mt,lineWrapping:!0,value:Te,autoCloseTags:!0,autoCloseBrackets:!0});Rt&&at.focus();function _t(ct,wt){if(zr){wt.preventDefault();return}var Ct=wt.clipboardData;if(Ct){var Ut=Ct.types.toString(),Lt=Ct.items;if(Ut==="Files"||Ct.types.indexOf("Files")>-1){if(wt.preventDefault(),zt=="stex")return;try{var Yt,cn=Lt[1];((Yt=Lt[0])===null||Yt===void 0?void 0:Yt.kind)==="file"&&(cn=Lt[0]);var St=cn.getAsFile(),Hn=St.name.split(".").pop();Ee(St,function(It){if(It.id){var hn,rn,wn;(St==null||((hn=St.type)===null||hn===void 0)?void 0:hn.indexOf("image"))>-1?at.replaceSelection(".concat(It.content_type,")")):(St==null||((rn=St.type)===null||rn===void 0)?void 0:rn.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(It.id,'"></video>')):(St==null||((wn=St.type)===null||wn===void 0)?void 0:wn.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(St.type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):$.includes(Hn)?at.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(It.id,'?type=office&disposition=inline" target="_blank">').concat(St.name,"</a>")):at.replaceSelection("[".concat(St.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,")"))}else(It==null?void 0:It.status)===401&&(document.location.href="/user/login")})}catch(It){k.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return at.on("paste",_t),at.on("dragleave",function(ct,wt){Bn.current.classList.remove("mouse-hover-md")}),at.on("dragover",function(ct,wt){Bn.current.classList.add("mouse-hover-md")}),at.on("drop",function(ct,wt){Bn.current.classList.add("mouse-hover-md");var Ct;if(Ct=wt.dataTransfer.files,Ct.length>0){wt.preventDefault(),wt.stopPropagation();for(var Ut=function(cn){var St=Ct[cn],Hn=St.name.split(".").pop();Ee(St,function(It){if(It.id){var hn,rn,wn;(St==null||((hn=St.type)===null||hn===void 0)?void 0:hn.indexOf("image"))>-1?at.replaceSelection(".concat(It.content_type,")")):(St==null||((rn=St.type)===null||rn===void 0)?void 0:rn.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(It.id,'"></video>')):(St==null||((wn=St.type)===null||wn===void 0)?void 0:wn.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(St.type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):$.includes(Hn)?at.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(It.id,'?type=office&disposition=inline" target="_blank">').concat(St.name,"</a>")):at.replaceSelection("[".concat(St.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,")"))}else(It==null?void 0:It.status)===401&&(document.location.href="/user/login")})},Lt=0;Lt<Ct.length;Lt++)Ut(Lt)}}),Tr(at),function(){at.off("paste",_t)}}},[]);var bn=Object(g.useCallback)(function(){if(Bn.current)try{}catch(at){console.log(at,"---- to set md editor body height")}},[Ii,Bn,Rn]);Object(g.useEffect)(function(){function at(){var ct=new a.default(function(wt){var Ct=Object(I.a)(wt),Ut;try{for(Ct.s();!(Ut=Ct.n()).done;){var Lt=Ut.value;(Lt.target.offsetHeight>0||Lt.target.offsetWidth>0)&&(bn(),Be.setSize("100%","100%"),Be.refresh())}}catch(Yt){Ct.e(Yt)}finally{Ct.f()}});return ct.observe(Fn.current.parentElement),ct}if(Be){var _t=at();return function(){_t.unobserve(Fn.current.parentElement)}}},[Be,bn]),Object(g.useEffect)(function(){if(Be){for(var at=[],_t=function(){var Lt=wt[ct];Ct=Object(B.a)(Lt,2);var Yt=Ct[0],cn=Ct[1],St=Object(U.a)({},Yt,function(){ki(cn)});at.push(St),Be.addKeyMap(St)},ct=0,wt=Object.entries(X);ct<wt.length;ct++){var Ct;_t()}return Sr.current=setInterval(function(){sr.current&&Mi()},4e3),function(){clearInterval(Sr.current);var Ut=Object(I.a)(at),Lt;try{for(Ut.s();!(Lt=Ut.n()).done;){var Yt=Lt.value;Be.removeKeyMap(Yt)}}catch(cn){Ut.e(cn)}finally{Ut.f()}}}},[Be]),Object(g.useEffect)(function(){Ot!==Rn&&Li(Ot)},[Ot]),Object(Ge.a)(function(){if(!Pn&&An>0){var at=new Date().getTime(),_t=window.sessionStorage.getItem(dt);at>=An+He&&(!_t||_t!==rr)&&(window.sessionStorage.setItem(dt,rr),wr(!0))}},He),Object(g.useEffect)(function(){$r(bt)},[Be,bt]),Object(g.useEffect)(function(){Be&&(Rt&&Be.focus())},[Be,Rt]),Object(g.useEffect)(function(){if(On&&Be){var at=Be.getScrollerElement();function _t(ct){var wt=ct.target;if(Or.current){var Ct=wt.scrollTop/wt.scrollHeight;Or.current.scrollTop=Or.current.scrollHeight*Ct}}return at.addEventListener("scroll",_t),function(){at.removeEventListener("scroll",_t)}}},[Be,On]),Object(g.useEffect)(function(){if(Be&&Mt){function at(_t,ct){Mt(_t,ct)}return Be.on("beforeChange",at),function(){Be.off("beforeChange",at)}}},[Be,Mt]),Object(g.useEffect)(function(){if(Be&&Tt){function at(){Tt(Be.getValue())}return Be.on("blur",at),function(){Be.off("blur",at)}}},[Be,Tt]),Object(g.useEffect)(function(){if(Be){function at(_t){var ct=_t.getValue();Sn(ct),Zr(new Date().getTime()),_t.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ke&&ke(ct)}return Be.on("change",at),function(){Be.off("change",at)}}},[Be,ke]),Object(g.useEffect)(function(){Be&&(Te==null?(Be.setValue(""),Sn("")):Te!==Be.getValue()&&(Be.setValue(Te),Sn(Te),Be.setCursor(Be.lineCount(),0)))},[Be,Te]);var ki=Object(g.useCallback)(function(at){var _t=Be.getCursor(),ct=Be.getSelection(),wt=ct.split(`
|
|
`);switch(at){case"bold":return Be.replaceSelection("**"+ct+"**"),ct===""&&Be.setCursor(_t.line,_t.ch+2),Be.focus();case"italic":return Be.replaceSelection("*"+ct+"*"),ct===""&&Be.setCursor(_t.line,_t.ch+1),Be.focus();case"code":return Be.replaceSelection("`"+ct+"`"),ct===""&&Be.setCursor(_t.line,_t.ch+1),Be.focus();case"inline-latex":return Be.replaceSelection("`$$"+ct+"$$`"),ct===""&&Be.setCursor(_t.line,_t.ch+3),Be.focus();case"latex":return Be.replaceSelection("```latex\n"+ct+"\n```"),Be.setCursor(_t.line+1,ct.length+1),Be.focus();case"line-break":return Be.replaceSelection(`<br/>
|
|
`),Be.focus();case"list-ul":return ct===""?Be.replaceSelection("- "+ct):Be.replaceSelection(wt.map(function(Ct){return Ct===""?"":"- ".concat(Ct)}).join(`
|
|
`)),Be.focus();case"list-ol":return ct===""?Be.replaceSelection("1. "+ct):Be.replaceSelection(wt.map(function(Ct,Ut){return Ct===""?"":"".concat(Ut+1,". ").concat(Ct)}).join(`
|
|
`)),Be.focus();case"add-null-ch":return ct===""&&Be.setCursor(_t.line,_t.ch+1),Be.replaceSelection(ve),Be.focus();case"inster-template-1":return ct===""&&Be.setCursor(_t.line,_t.ch),Be.replaceSelection(Re),Be.focus();case"eraser":return Be.setValue(""),Be.focus();case"trigger-watch":return $r(!On),Be.focus();case"trigger-full-screen":return Li(!Rn),Be.focus();case Ce:zn(Ce);return;case et:zn(et);return;case Oe:zn(Oe);return;case Me:zn(Me);return;default:throw new Error}},[Be,On,Rn]),Rr=Object(g.useCallback)(function(at){zn("");switch(on){case Ce:var _t=at.title,ct=at.link;return Be.replaceSelection("[".concat(_t,"](").concat(ct,")")),Be.focus();case et:var wt=at.language,Ct=at.content;return Be.replaceSelection(["```"+wt,Ct,"```"].join(`
|
|
`)),Be.focus();case Oe:var Ut=at.src,Lt=at.alt;return Lt?Be.replaceSelection(".concat(Ut,' "').concat(Lt,'" )')):Be.replaceSelection("")),Be.focus();case Me:for(var Yt=at.row,cn=at.col,St=at.align,Hn=`
|
|
`,It=0;It<Yt;It++){for(var hn=[],rn=[],wn=0;wn<cn;wn++)It===1&&rn.push(Ue[St]),hn.push(" ");It===1&&(Hn+="| ".concat(rn.join(" | "),` |
|
|
`)),Hn+="| ".concat(hn.join(cn===1?"":" | "),` |
|
|
`)}return Be.replaceSelection(Hn+`
|
|
`),Be.focus();default:throw new Error}},[Be,on]),qr=Object(g.useMemo)(function(){switch(on){case Ce:return p.a.createElement(Z,{callback:Rr,onCancel:Vn});case et:return p.a.createElement(ae.b,{callback:Rr,onCancel:Vn});case Oe:return p.a.createElement(se,{callback:Rr,onCancel:Vn});case Me:return p.a.createElement(De,{callback:Rr,onCancel:Vn});default:return null}},[on]);function Vn(){zn("")}Object(g.useEffect)(function(){if(jn.current){var at=jn.current,_t=!1,ct=0;function wt(Lt){_t=!0,ct=Lt.pageY}function Ct(){_t=!1}function Ut(Lt){if(_t){var Yt=Lt.pageY-ct;Yt<0&&(Yt=0),Yt>300&&(Yt=300);var cn=ht+Yt+"px";xr(cn)}}return at.addEventListener("mousedown",wt),document.addEventListener("mousemove",Ut),document.addEventListener("mouseup",Ct),function(){at.removeEventListener("mousedown",wt),document.removeEventListener("mousemove",Ut),document.removeEventListener("mouseup",Ct)}}},[Be,jn]),Object(g.useEffect)(function(){xr(ht)},[ht]);var Mn=ue(nt),ei=ue(Ii),Ln={width:Mn,height:ei},ti=Object(g.useMemo)(function(){if(An){var at=new Date(An),_t=at.getHours(),ct=at.getMinutes(),wt=at.getSeconds();return _t=_t<10?"0"+_t:_t,ct=ct<10?"0"+ct:ct,wt=wt<10?"0"+wt:wt,"".concat(_t,":").concat(ct,":").concat(wt)}return 0},[An]);function Ni(){window.sessionStorage.removeItem(dt),wr(!1),Zr(0)}function or(){wr(!1),Zr(0),Be.setValue(window.sessionStorage.getItem(dt))}function ua(at,_t){var ct=Be.getValue();ct=ct.replace(at,_t),Sn(ct),Be==null||Be.setValue(ct)}return p.a.createElement(g.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:Bn},p.a.createElement("div",{className:"markdown-editor-container ".concat(Ne," ").concat(On?"on-preview":""," ").concat(mt?"mini":""," ").concat(Rn?"full-screen":""),style:Ln},p.a.createElement(y,{insertTemp:gt,watch:On,fullScreen:Rn,showNullButton:lt,onActionCallback:ki,hidetoolBar:Kt,uuid:ar.current,setOpenPhones:function(){sr.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Fn,placeholder:br})),On?p.a.createElement("div",{ref:Or,className:"preview-container"},zt==="stex"&&p.a.createElement(O,{value:rr}),zt!=="stex"&&p.a.createElement(T.a,{edit:!0,value:rr,replaces:ua})):null))),Nt?p.a.createElement("a",{ref:jn,className:"editor-resize"}):null,p.a.createElement(P.a,null,q[on]?p.a.createElement(V.a,{centered:!0,title:q[on],visible:!0,onCancel:Vn,footer:null,className:"markdown-popup-form"},qr):null))}},SJMd:function(st,Qe){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var Q,ee,V,I=!1,H,k;window.PR_SHOULD_USE_CONTINUATION=!0;var C,B;(function(){var U=window,D=["break,continue,do,else,for,if,return,while"],L=[D,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],g=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[g,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],f=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],d=[g,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],a="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",c=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],o="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",s=[D,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[D,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],h=[D,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=[p,d,f,c,o,s,l,h],x=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,T="str",O="kwd",S="com",E="typ",b="lit",v="pun",u="pln",_="tag",m="dec",y="src",P="atn",M="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function N(Ae){for(var we=0,De=!1,Xe=!1,We=0,Ce=Ae.length;We<Ce;++We){var Oe=Ae[We];if(Oe.ignoreCase)Xe=!0;else if(/[a-z]/i.test(Oe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){De=!0,Xe=!1;break}}var et={b:8,t:9,n:10,v:11,f:12,r:13};function Me(ze){var be=ze.charCodeAt(0);if(be!==92)return be;var Ke=ze.charAt(1);return be=et[Ke],be||("0"<=Ke&&Ke<="7"?parseInt(ze.substring(1),8):Ke==="u"||Ke==="x"?parseInt(ze.substring(2),16):ze.charCodeAt(1))}function Le(ze){if(ze<32)return(ze<16?"\\x0":"\\x")+ze.toString(16);var be=String.fromCharCode(ze);return be==="\\"||be==="-"||be==="]"||be==="^"?"\\"+be:be}function Ue(ze){var be=ze.substring(1,ze.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")),Ke=[],He=be[0]==="^",ve=["["];He&&ve.push("^");for(var Re=He?1:0,ue=be.length;Re<ue;++Re){var ie=be[Re];if(/\\[bdsw]/i.test(ie))ve.push(ie);else{var te=Me(ie),$;Re+2<ue&&be[Re+1]==="-"?($=Me(be[Re+2]),Re+=2):$=te,Ke.push([te,$]),$<65||te>122||($<65||te>90||Ke.push([Math.max(65,te)|32,Math.min($,90)|32]),$<97||te>122||Ke.push([Math.max(97,te)&~32,Math.min($,122)&~32]))}}Ke.sort(function(le,ye){return le[0]-ye[0]||ye[1]-le[1]});for(var X=[],q=[],Re=0;Re<Ke.length;++Re){var ne=Ke[Re];ne[0]<=q[1]+1?q[1]=Math.max(q[1],ne[1]):X.push(q=ne)}for(var Re=0;Re<X.length;++Re){var ne=X[Re];ve.push(Le(ne[0])),ne[1]>ne[0]&&(ne[1]+1>ne[0]&&ve.push("-"),ve.push(Le(ne[1])))}return ve.push("]"),ve.join("")}function Ge(ze){for(var be=ze.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")),Ke=be.length,He=[],ve=0,Re=0;ve<Ke;++ve){var ue=be[ve];if(ue==="(")++Re;else if(ue.charAt(0)==="\\"){var ie=+ue.substring(1);ie&&(ie<=Re?He[ie]=-1:be[ve]=Le(ie))}}for(var ve=1;ve<He.length;++ve)He[ve]===-1&&(He[ve]=++we);for(var ve=0,Re=0;ve<Ke;++ve){var ue=be[ve];if(ue==="(")++Re,He[Re]||(be[ve]="(?:");else if(ue.charAt(0)==="\\"){var ie=+ue.substring(1);ie&&ie<=Re&&(be[ve]="\\"+He[ie])}}for(var ve=0;ve<Ke;++ve)be[ve]==="^"&&be[ve+1]!=="^"&&(be[ve]="");if(ze.ignoreCase&&De)for(var ve=0;ve<Ke;++ve){var ue=be[ve],te=ue.charAt(0);ue.length>=2&&te==="["?be[ve]=Ue(ue):te!=="\\"&&(be[ve]=ue.replace(/[a-zA-Z]/g,function(q){var ne=q.charCodeAt(0);return"["+String.fromCharCode(ne&~32,ne|32)+"]"}))}return be.join("")}for(var Fe=[],We=0,Ce=Ae.length;We<Ce;++We){var Oe=Ae[We];if(Oe.global||Oe.multiline)throw new Error(""+Oe);Fe.push("(?:"+Ge(Oe)+")")}return new RegExp(Fe.join("|"),Xe?"gi":"g")}function w(Ae,we){var De=/(?:^|\s)nocode(?:\s|$)/,Xe=[],We=0,Ce=[],Oe=0;function et(Me){var Le=Me.nodeType;if(Le==1){if(De.test(Me.className))return;for(var Ue=Me.firstChild;Ue;Ue=Ue.nextSibling)et(Ue);var Ge=Me.nodeName.toLowerCase();(Ge==="br"||Ge==="li")&&(Xe[Oe]=`
|
|
`,Ce[Oe<<1]=We++,Ce[Oe++<<1|1]=Me)}else if(Le==3||Le==4){var Fe=Me.nodeValue;Fe.length&&(we?Fe=Fe.replace(/\r\n?/g,`
|
|
`):Fe=Fe.replace(/[ \t\r\n]+/g," "),Xe[Oe]=Fe,Ce[Oe<<1]=We,We+=Fe.length,Ce[Oe++<<1|1]=Me)}}return et(Ae),{sourceCode:Xe.join("").replace(/\n$/,""),spans:Ce}}function G(Ae,we,De,Xe,We){if(!De)return;var Ce={sourceNode:Ae,pre:1,langExtension:null,numberLines:null,sourceCode:De,spans:null,basePos:we,decorations:null};Xe(Ce),We.push.apply(We,Ce.decorations)}var J=/\S/;function Z(Ae){for(var we=void 0,De=Ae.firstChild;De;De=De.nextSibling){var Xe=De.nodeType;we=Xe===1?we?Ae:De:Xe===3&&J.test(De.nodeValue)?Ae:we}return we===Ae?void 0:we}function ae(Ae,we){var De={},Xe;(function(){for(var Oe=Ae.concat(we),et=[],Me={},Le=0,Ue=Oe.length;Le<Ue;++Le){var Ge=Oe[Le],Fe=Ge[3];if(Fe)for(var ze=Fe.length;--ze>=0;)De[Fe.charAt(ze)]=Ge;var be=Ge[1],Ke=""+be;Me.hasOwnProperty(Ke)||(et.push(be),Me[Ke]=null)}et.push(/[\0-\uffff]/),Xe=N(et)})();var We=we.length,Ce=function(Oe){for(var et=Oe.sourceCode,Me=Oe.basePos,Le=Oe.sourceNode,Ue=[Me,u],Ge=0,Fe=et.match(Xe)||[],ze={},be=0,Ke=Fe.length;be<Ke;++be){var He=Fe[be],ve=ze[He],Re=void 0,ue;if(typeof ve=="string")ue=!1;else{var ie=De[He.charAt(0)];if(ie)Re=He.match(ie[1]),ve=ie[0];else{for(var te=0;te<We;++te)if(ie=we[te],Re=He.match(ie[1]),Re){ve=ie[0];break}Re||(ve=u)}ue=ve.length>=5&&ve.substring(0,5)==="lang-",ue&&!(Re&&typeof Re[1]=="string")&&(ue=!1,ve=y),ue||(ze[He]=ve)}var $=Ge;if(Ge+=He.length,!ue)Ue.push(Me+$,ve);else{var X=Re[1],q=He.indexOf(X),ne=q+X.length;Re[2]&&(ne=He.length-Re[2].length,q=ne-X.length);var le=ve.substring(5);G(Le,Me+$,He.substring(0,q),Ce,Ue),G(Le,Me+$+q,X,de(le,X),Ue),G(Le,Me+$+ne,He.substring(ne),Ce,Ue)}}Oe.decorations=Ue};return Ce}function _e(Ae){var we=[],De=[];Ae.tripleQuotedStrings?we.push([T,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ae.multiLineStrings?we.push([T,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([T,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ae.verbatimStrings&&De.push([T,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Xe=Ae.hashComments;Xe&&(Ae.cStyleComments?(Xe>1?we.push([S,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([S,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),De.push([T,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([S,/^#[^\r\n]*/,null,"#"])),Ae.cStyleComments&&(De.push([S,/^\/\/[^\r\n]*/,null]),De.push([S,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var We=Ae.regexLiterals;if(We){var Ce=We>1?"":`
|
|
\r`,Oe=Ce?".":"[\\S\\s]",et="/(?=[^/*"+Ce+"])(?:[^/\\x5B\\x5C"+Ce+"]|\\x5C"+Oe+"|\\x5B(?:[^\\x5C\\x5D"+Ce+"]|\\x5C"+Oe+")*(?:\\x5D|$))+/";De.push(["lang-regex",RegExp("^"+W+"("+et+")")])}var Me=Ae.types;Me&&De.push([E,Me]);var Le=(""+Ae.keywords).replace(/^ | $/g,"");Le.length&&De.push([O,new RegExp("^(?:"+Le.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([u,/^\s+/,null,` \r
|
|
\xA0`]);var Ue="^.[^\\s\\w.$@'\"`/\\\\]*";return Ae.regexLiterals&&(Ue+="(?!s*/)"),De.push([b,/^@[a-z_$][a-z_$@0-9]*/i,null],[E,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[b,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[v,new RegExp(Ue),null]),ae(we,De)}var ce=_e({keywords:R,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(Ae,we,De){for(var Xe=/(?:^|\s)nocode(?:\s|$)/,We=/\r\n?|\n/,Ce=Ae.ownerDocument,Oe=Ce.createElement("li");Ae.firstChild;)Oe.appendChild(Ae.firstChild);var et=[Oe];function Me(be){var Ke=be.nodeType;if(Ke==1&&!Xe.test(be.className))if(be.nodeName==="br")Le(be),be.parentNode&&be.parentNode.removeChild(be);else for(var He=be.firstChild;He;He=He.nextSibling)Me(He);else if((Ke==3||Ke==4)&&De){var ve=be.nodeValue,Re=ve.match(We);if(Re){var ue=ve.substring(0,Re.index);be.nodeValue=ue;var ie=ve.substring(Re.index+Re[0].length);if(ie){var te=be.parentNode;te.insertBefore(Ce.createTextNode(ie),be.nextSibling)}Le(be),ue||be.parentNode.removeChild(be)}}}function Le(be){for(;!be.nextSibling;)if(be=be.parentNode,!be)return;function Ke(Re,ue){var ie=ue?Re.cloneNode(!1):Re,te=Re.parentNode;if(te){var $=Ke(te,1),X=Re.nextSibling;$.appendChild(ie);for(var q=X;q;q=X)X=q.nextSibling,$.appendChild(q)}return ie}for(var He=Ke(be.nextSibling,0),ve;(ve=He.parentNode)&&ve.nodeType===1;)He=ve;et.push(He)}for(var Ue=0;Ue<et.length;++Ue)Me(et[Ue]);we===(we|0)&&et[0].setAttribute("value",we);var Ge=Ce.createElement("ol");Ge.className="linenums";for(var Fe=Math.max(0,we-1|0)||0,Ue=0,ze=et.length;Ue<ze;++Ue)Oe=et[Ue],Oe.className="L"+(Ue+Fe)%10,Oe.firstChild||Oe.appendChild(Ce.createTextNode("\xA0")),Ge.appendChild(Oe);Ae.appendChild(Ge)}function fe(Ae){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var De=/\n/g,Xe=Ae.sourceCode,We=Xe.length,Ce=0,Oe=Ae.spans,et=Oe.length,Me=0,Le=Ae.decorations,Ue=Le.length,Ge=0;Le[Ue]=We;var Fe,ze;for(ze=Fe=0;ze<Ue;)Le[ze]!==Le[ze+2]?(Le[Fe++]=Le[ze++],Le[Fe++]=Le[ze++]):ze+=2;for(Ue=Fe,ze=Fe=0;ze<Ue;){for(var be=Le[ze],Ke=Le[ze+1],He=ze+2;He+2<=Ue&&Le[He+1]===Ke;)He+=2;Le[Fe++]=be,Le[Fe++]=Ke,ze=He}Ue=Le.length=Fe;var ve=Ae.sourceNode,Re="";ve&&(Re=ve.style.display,ve.style.display="none");try{for(var ue=null;Me<et;){var ie=Oe[Me],te=Oe[Me+2]||We,$=Le[Ge+2]||We,He=Math.min(te,$),X=Oe[Me+1],q;if(X.nodeType!==1&&(q=Xe.substring(Ce,He))){we&&(q=q.replace(De,"\r")),X.nodeValue=q;var ne=X.ownerDocument,le=ne.createElement("span");le.className=Le[Ge+1];var ye=X.parentNode;ye.replaceChild(le,X),le.appendChild(X),Ce<te&&(Oe[Me+1]=X=ne.createTextNode(Xe.substring(He,te)),ye.insertBefore(X,le.nextSibling))}Ce=He,Ce>=te&&(Me+=2),Ce>=$&&(Ge+=2)}}finally{ve&&(ve.style.display=Re)}}var pe={};function se(Ae,we){for(var De=we.length;--De>=0;){var Xe=we[De];pe.hasOwnProperty(Xe)?U.console&&console.warn("cannot override language handler %s",Xe):pe[Xe]=Ae}}function de(Ae,we){return Ae&&pe.hasOwnProperty(Ae)||(Ae=/^\s*</.test(we)?"default-markup":"default-code"),pe[Ae]}se(ce,["default-code"]),se(ae([],[[u,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[S,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[v,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),se(ae([[u,/^[\s]+/,null,` \r
|
|
`],[M,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[_,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[v,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),se(ae([],[[M,/^[\s\S]+/]]),["uq.val"]),se(_e({keywords:p,hashComments:!0,cStyleComments:!0,types:x}),["c","cc","cpp","cxx","cyc","m"]),se(_e({keywords:"null,true,false"}),["json"]),se(_e({keywords:d,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:x}),["cs"]),se(_e({keywords:f,cStyleComments:!0}),["java"]),se(_e({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),se(_e({keywords:s,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),se(_e({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),se(_e({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),se(_e({keywords:c,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),se(_e({keywords:a,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),se(ae([],[[T,/^[\s\S]+/]]),["regex"]);function Ee(Ae){var we=Ae.langExtension;try{var De=w(Ae.sourceNode,Ae.pre),Xe=De.sourceCode;Ae.sourceCode=Xe,Ae.spans=De.spans,Ae.basePos=0,de(we,Xe)(Ae),fe(Ae)}catch(We){U.console&&console.log(We&&We.stack||We)}}function Pe(Ae,we,De){var Xe=De||!1,We=we||null,Ce=document.createElement("div");Ce.innerHTML="<pre>"+Ae+"</pre>",Ce=Ce.firstChild,Xe&&he(Ce,Xe,!0);var Oe={langExtension:We,numberLines:Xe,sourceNode:Ce,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Ee(Oe),Ce.innerHTML}function Se(Ae,we){var De=we||document.body,Xe=De.ownerDocument||document;function We(ie){return De.getElementsByTagName(ie)}for(var Ce=[We("pre"),We("code"),We("xmp")],Oe=[],et=0;et<Ce.length;++et)for(var Me=0,Le=Ce[et].length;Me<Le;++Me)Oe.push(Ce[et][Me]);Ce=null;var Ue=Date;Ue.now||(Ue={now:function(){return+new Date}});var Ge=0,Fe=/\blang(?:uage)?-([\w.]+)(?!\S)/,ze=/\bprettyprint\b/,be=/\bprettyprinted\b/,Ke=/pre|xmp/i,He=/^code$/i,ve=/^(?:pre|code|xmp)$/i,Re={};function ue(){for(var ie=U.PR_SHOULD_USE_CONTINUATION?Ue.now()+250:Infinity;Ge<Oe.length&&Ue.now()<ie;Ge++){for(var te=Oe[Ge],$=Re,X=te;X=X.previousSibling;){var q=X.nodeType,ne=(q===7||q===8)&&X.nodeValue;if(ne?!/^\??prettify\b/.test(ne):q!==3||/\S/.test(X.nodeValue))break;if(ne){$={},ne.replace(/\b(\w+)=([\w:.%+-]+)/g,function(bt,gt,nn){$[gt]=nn});break}}var le=te.className;if(($!==Re||ze.test(le))&&!be.test(le)){for(var ye=!1,Te=te.parentNode;Te;Te=Te.parentNode){var ke=Te.tagName;if(ve.test(ke)&&Te.className&&ze.test(Te.className)){ye=!0;break}}if(!ye){te.className+=" prettyprinted";var rt=$.lang;if(!rt){rt=le.match(Fe);var nt;!rt&&(nt=Z(te))&&He.test(nt.tagName)&&(rt=nt.className.match(Fe)),rt&&(rt=rt[1])}var xt;if(Ke.test(te.tagName))xt=1;else{var ht=te.currentStyle,Ve=Xe.defaultView,mt=ht?ht.whiteSpace:Ve&&Ve.getComputedStyle?Ve.getComputedStyle(te,null).getPropertyValue("white-space"):0;xt=mt&&mt.substring(0,3)==="pre"}var ot=$.linenums;(ot=ot==="true"||+ot)||(ot=le.match(/\blinenums\b(?::(\d+))?/),ot=ot?ot[1]&&ot[1].length?+ot[1]:!0:!1),ot&&he(te,ot,xt);var Rt={langExtension:rt,sourceNode:te,numberLines:ot,pre:xt,sourceCode:null,basePos:null,spans:null,decorations:null};Ee(Rt)}}}Ge<Oe.length?U.setTimeout(ue,250):typeof Ae=="function"&&Ae()}ue()}var Je=U.PR={createSimpleLexer:ae,registerLangHandler:se,sourceDecorator:_e,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:M,PR_COMMENT:S,PR_DECLARATION:m,PR_KEYWORD:O,PR_LITERAL:b,PR_NOCODE:j,PR_PLAIN:u,PR_PUNCTUATION:v,PR_SOURCE:y,PR_STRING:T,PR_TAG:_,PR_TYPE:E,prettyPrintOne:I?U.prettyPrintOne=Pe:C=Pe,prettyPrint:B=I?U.prettyPrint=Se:B=Se},qe=U.define;typeof qe=="function"&&qe.amd&&qe("google-code-prettify",[],function(){return Je})})()},TXwP:function(st,Qe,Q){var ee,V;(function(){var I;(function(){"use strict";var k=[,,function(D){function L(f){this.__parent=f,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}L.prototype.clone_empty=function(){var f=new L(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},L.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},L.prototype.has_match=function(f){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(f))return!0;return!1},L.prototype.set_indent=function(f,d){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},L.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},L.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},L.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},L.prototype.is_empty=function(){return this.__items.length===0},L.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},L.prototype.push=function(f){this.__items.push(f);var d=f.lastIndexOf(`
|
|
`);d!==-1?this.__character_count=f.length-d:this.__character_count+=f.length},L.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},L.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},L.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},L.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},L.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function g(f,d){this.__cache=[""],this.__indent_size=f.indent_size,this.__indent_string=f.indent_char,f.indent_with_tabs||(this.__indent_string=new Array(f.indent_size+1).join(f.indent_char)),d=d||"",f.indent_level>0&&(d=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}g.prototype.get_indent_size=function(f,d){var a=this.__base_string_length;return d=d||0,f<0&&(a=0),a+=f*this.__indent_size,a+=d,a},g.prototype.get_indent_string=function(f,d){var a=this.__base_string;return d=d||0,f<0&&(f=0,a=""),d+=f*this.__indent_size,this.__ensure_cache(d),a+=this.__cache[d],a},g.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var f=this.__cache.length,d=0,a="";this.__indent_size&&f>=this.__indent_size&&(d=Math.floor(f/this.__indent_size),f-=d*this.__indent_size,a=new Array(d+1).join(this.__indent_string)),f&&(a+=new Array(f+1).join(" ")),this.__cache.push(a)};function p(f,d){this.__indent_cache=new g(f,d),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new L(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,d){return this.__indent_cache.get_indent_string(f,d)},p.prototype.get_indent_size=function(f,d){return this.__indent_cache.get_indent_size(f,d)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(f){this.trim(!0);var d=this.current_line.pop();d&&(d[d.length-1]===`
|
|
`&&(d=d.replace(/\n+$/g,"")),this.current_line.push(d)),this._end_with_newline&&this.__add_outputline();var a=this.__lines.join(`
|
|
`);return f!==`
|
|
`&&(a=a.replace(/[\n]/g,f)),a},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,d){return f=f||0,d=d||0,this.next_line.set_indent(f,d),this.__lines.length>1?(this.current_line.set_indent(f,d),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var d=0;d<f.newlines;d++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(f.whitespace_before),this.current_line.push(f.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(f){this.__add_space_before_token(),this.current_line.push(f),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(f){for(var d=this.__lines.length;f<d;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(f){for(f=f===void 0?!1:f,this.current_line.trim();f&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,d){for(var a=this.__lines.length-2;a>=0;){var c=this.__lines[a];if(c.is_empty())break;if(c.item(0).indexOf(f)!==0&&c.item(-1)!==d){this.__lines.splice(a+1,0,new L(this)),this.previous_line=this.__lines[this.__lines.length-2];break}a--}},D.exports.Output=p},,,,function(D){function L(f,d){this.raw_options=g(f,d),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}L.prototype._get_array=function(f,d){var a=this.raw_options[f],c=d||[];return typeof a=="object"?a!==null&&typeof a.concat=="function"&&(c=a.concat()):typeof a=="string"&&(c=a.split(/[^a-zA-Z0-9_\/\-]+/)),c},L.prototype._get_boolean=function(f,d){var a=this.raw_options[f],c=a===void 0?!!d:!!a;return c},L.prototype._get_characters=function(f,d){var a=this.raw_options[f],c=d||"";return typeof a=="string"&&(c=a.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),c},L.prototype._get_number=function(f,d){var a=this.raw_options[f];d=parseInt(d,10),isNaN(d)&&(d=0);var c=parseInt(a,10);return isNaN(c)&&(c=d),c},L.prototype._get_selection=function(f,d,a){var c=this._get_selection_list(f,d,a);if(c.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[f]+"'");return c[0]},L.prototype._get_selection_list=function(f,d,a){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(a=a||[d[0]],!this._is_valid_selection(a,d))throw new Error("Invalid Default Value!");var c=this._get_array(f,a);if(!this._is_valid_selection(c,d))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[f]+"'");return c},L.prototype._is_valid_selection=function(f,d){return f.length&&d.length&&!f.some(function(a){return d.indexOf(a)===-1})};function g(f,d){var a={};f=p(f);var c;for(c in f)c!==d&&(a[c]=f[c]);if(d&&f[d])for(c in f[d])a[c]=f[d][c];return a}function p(f){var d={},a;for(a in f){var c=a.replace(/-/g,"_");d[c]=f[a]}return d}D.exports.Options=L,D.exports.normalizeOpts=p,D.exports.mergeOpts=g},,function(D){var L=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},g.prototype.peek=function(p){var f=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(f=this.__input.charAt(p)),f},g.prototype.__match=function(p,f){p.lastIndex=f;var d=p.exec(this.__input);return d&&!(L&&p.sticky)&&(d.index!==f&&(d=null)),d},g.prototype.test=function(p,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(p,f):!1},g.prototype.testChar=function(p,f){var d=this.peek(f);return p.lastIndex=0,d!==null&&p.test(d)},g.prototype.match=function(p){var f=this.__match(p,this.__position);return f?this.__position+=f[0].length:f=null,f},g.prototype.read=function(p,f,d){var a="",c;return p&&(c=this.match(p),c&&(a+=c[0])),f&&(c||!p)&&(a+=this.readUntil(f,d)),a},g.prototype.readUntil=function(p,f){var d="",a=this.__position;p.lastIndex=this.__position;var c=p.exec(this.__input);return c?(a=c.index,f&&(a+=c[0].length)):a=this.__input_length,d=this.__input.substring(this.__position,a),this.__position=a,d},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var d=null,a="g";return f&&L&&(a="y"),typeof p=="string"&&p!==""?d=new RegExp(p,a):p&&(d=new RegExp(p.source,a)),d},g.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(p){var f=this.__position,d=this.readUntilAfter(p);return this.__position=f,d},g.prototype.lookBack=function(p){var f=this.__position-1;return f>=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},D.exports.InputScanner=g},,,,,function(D){function L(g,p){g=typeof g=="string"?g:g.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+p,"g")}L.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(g);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(g);return p},L.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},D.exports.Directives=L},,function(D,L,g){var p=g(16).Beautifier,f=g(17).Options;function d(a,c){var o=new p(a,c);return o.beautify()}D.exports=d,D.exports.defaultOptions=function(){return new f}},function(D,L,g){var p=g(17).Options,f=g(2).Output,d=g(8).InputScanner,a=g(13).Directives,c=new a(/\/\*/,/\*\//),o=/\r\n|[\r\n]/,s=/\r\n|[\r\n]/g,l=/\s/,h=/(?:\s|\n)+/g,R=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,x=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function T(O,S){this._source_text=O||"",this._options=new p(S),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}T.prototype.eatString=function(O){var S="";for(this._ch=this._input.next();this._ch;){if(S+=this._ch,this._ch==="\\")S+=this._input.next();else if(O.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return S},T.prototype.eatWhitespace=function(O){for(var S=l.test(this._input.peek()),E=0;l.test(this._input.peek());)this._ch=this._input.next(),O&&this._ch===`
|
|
`&&((E===0||E<this._options.max_preserve_newlines)&&(E++,this._output.add_new_line(!0)));return S},T.prototype.foundNestedPseudoClass=function(){for(var O=0,S=1,E=this._input.peek(S);E;){if(E==="{")return!0;if(E==="(")O+=1;else if(E===")"){if(O===0)return!1;O-=1}else if(E===";"||E==="}")return!1;S++,E=this._input.peek(S)}return!1},T.prototype.print_string=function(O){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(O)},T.prototype.preserveSingleSpace=function(O){O&&(this._output.space_before_token=!0)},T.prototype.indent=function(){this._indentLevel++},T.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var O=this._source_text,S=this._options.eol;S==="auto"&&(S=`
|
|
`,O&&o.test(O||"")&&(S=O.match(o)[0])),O=O.replace(s,`
|
|
`);var E=O.match(/^[\t ]*/)[0];this._output=new f(this._options,E),this._input=new d(O),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var b=0,v=!1,u=!1,_=!1,m=!1,y=!1,P=!1,M=this._ch,j=!1,W,N,w;W=this._input.read(h),N=W!=="",w=M,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),M=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var G=this._input.read(R),J=c.get_directives(G);J&&J.ignore==="start"&&(G+=c.readIgnored(this._input)),this.print_string(G),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(x)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(N),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var Z=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);Z.match(/[ :]$/)&&(Z=this.eatString(": ").replace(/\s$/,""),this.print_string(Z),this._output.space_before_token=!0),Z=Z.replace(/\s$/,""),Z==="extend"?m=!0:Z==="import"&&(y=!0),Z in this.NESTED_AT_RULE?(this._nestedLevel+=1,Z in this.CONDITIONAL_GROUP_RULE&&(_=!0)):!v&&b===0&&Z.indexOf(":")!==-1&&(u=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(N),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")u&&(u=!1,this.outdent()),_?(_=!1,v=this._indentLevel>=this._nestedLevel):v=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&v&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(w==="("?this._output.space_before_token=!1:w!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),w==="{"&&this._output.trim(!0),y=!1,m=!1,u&&(this.outdent(),u=!1),this.print_string(this._ch),v=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var ae=0;ae<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;ae++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[ae])){j=!0;break}(v||_)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!m&&b===0?(this.print_string(":"),u||(u=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var _e=w==='"'||w==="'";this.preserveSingleSpace(_e||N),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")j=!1,b===0?(u&&(this.outdent(),u=!1),m=!1,y=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),b++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),b&&(b--,this.outdent()));else{var ce=!1;this._input.lookBack("with")&&(ce=!0),this.preserveSingleSpace(N||ce),this.print_string(this._ch),u&&w==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),P=!0):(this.eatWhitespace(),b++,this.indent())}else if(this._ch===")")b&&(b--,this.outdent()),P&&this._input.peek()===";"&&this._options.selector_separator_newline&&(P=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!u||P)&&b===0&&!y&&!m?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!u&&b===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&l.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(N),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),l.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var he=w==='"'||w==="'";this.preserveSingleSpace(he||N),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&j&&this._output.add_new_line()}var fe=this._output.get_code(S);return fe},D.exports.Beautifier=T},function(D,L,g){var p=g(6).Options;function f(d){p.call(this,d,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var a=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||a;var c=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var o=0;o<c.length;o++)c[o]!=="expand"?this.brace_style="collapse":this.brace_style=c[o]}f.prototype=new p,D.exports.Options=f}],C={};function B(D){var L=C[D];if(L!==void 0)return L.exports;var g=C[D]={exports:{}};return k[D](g,g.exports,B),g.exports}var U=B(15);I=U})();var H=I;!(ee=[],V=function(){return{css_beautify:H}}.apply(Qe,ee),V!==void 0&&(st.exports=V))})()},UZu5:function(st,Qe,Q){},"VrN/":function(st,Qe,Q){(function(ee,V){st.exports=V()})(this,function(){"use strict";var ee=navigator.userAgent,V=navigator.platform,I=/gecko\/\d/i.test(ee),H=/MSIE \d/.test(ee),k=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ee),C=/Edge\/(\d+)/.exec(ee),B=H||k||C,U=B&&(H?document.documentMode||6:+(C||k)[1]),D=!C&&/WebKit\//.test(ee),L=D&&/Qt\/\d+\.\d+/.test(ee),g=!C&&/Chrome\//.test(ee),p=/Opera\//.test(ee),f=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ee),a=/PhantomJS/.test(ee),c=!C&&/AppleWebKit/.test(ee)&&/Mobile\/\w+/.test(ee),o=/Android/.test(ee),s=c||o||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ee),l=c||/Mac/.test(V),h=/\bCrOS\b/.test(ee),R=/win/i.test(V),x=p&&ee.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(p=!1,D=!0);var T=l&&(L||p&&(x==null||x<12.11)),O=I||B&&U>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var E=function(e,t){var r=e.className,n=S(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function b(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function v(e,t){return b(e).appendChild(t)}function u(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var A=0;A<t.length;++A)i.appendChild(t[A]);return i}function _(e,t,r,n){var i=u(e,t,r,n);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:m=function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};function y(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function P(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function M(e,t){var r=e.className;S(t).test(r)||(e.className+=(r?" ":"")+t)}function j(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!S(r[n]).test(t)&&(t+=" "+r[n]);return t}var W=function(e){e.select()};c?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function N(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function w(e,t,r){t||(t={});for(var n in e)e.hasOwnProperty(n)&&(r!==!1||!t.hasOwnProperty(n))&&(t[n]=e[n]);return t}function G(e,t,r,n,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var A=n||0,F=i||0;;){var K=e.indexOf(" ",A);if(K<0||K>=t)return F+(t-A);F+=K-A,F+=r-F%r,A=K+1}}var J=function(){this.id=null,this.f=null,this.time=0,this.handler=N(this.onTimeout,this)};J.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},J.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};function Z(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var ae=50,_e={toString:function(){return"CodeMirror.Pass"}},ce={scroll:!1},he={origin:"*mouse"},fe={origin:"+move"};function pe(e,t,r){for(var n=0,i=0;;){var A=e.indexOf(" ",n);A==-1&&(A=e.length);var F=A-n;if(A==e.length||i+F>=t)return n+Math.min(F,t-i);if(i+=A-n,i+=r-i%r,n=A+1,i>=t)return n}}var se=[""];function de(e){for(;se.length<=e;)se.push(Ee(se)+" ");return se[e]}function Ee(e){return e[e.length-1]}function Pe(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Se(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}function Je(){}function qe(e,t){var r;return Object.create?r=Object.create(e):(Je.prototype=e,r=new Je),t&&w(t,r),r}var Ae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function we(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ae.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function Xe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var We=/[\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 Ce(e){return e.charCodeAt(0)>=768&&We.test(e)}function Oe(e,t,r){for(;(r<0?t>0:t<e.length)&&Ce(e.charAt(t));)t+=r;return t}function et(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,A=n<0?Math.ceil(i):Math.floor(i);if(A==t)return e(A)?t:r;e(A)?r=A:t=A+n}}function Me(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,A=0;A<e.length;++A){var F=e[A];(F.from<r&&F.to>t||t==r&&F.to==t)&&(n(Math.max(F.from,t),Math.min(F.to,r),F.level==1?"rtl":"ltr",A),i=!0)}i||n(t,r,"ltr")}var Le=null;function Ue(e,t,r){var n;Le=null;for(var i=0;i<e.length;++i){var A=e[i];if(A.from<t&&A.to>t)return i;A.to==t&&(A.from!=A.to&&r=="before"?n=i:Le=i),A.from==t&&(A.from!=A.to&&r!="before"?n=i:Le=i)}return n!=null?n:Le}var Ge=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(Y){return Y<=247?e.charAt(Y):1424<=Y&&Y<=1524?"R":1536<=Y&&Y<=1785?t.charAt(Y-1536):1774<=Y&&Y<=2220?"r":8192<=Y&&Y<=8203?"w":Y==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,A=/[LRr]/,F=/[Lb1n]/,K=/[1n]/;function z(Y,re,oe){this.level=Y,this.from=re,this.to=oe}return function(Y,re){var oe=re=="ltr"?"L":"R";if(Y.length==0||re=="ltr"&&!n.test(Y))return!1;for(var ge=Y.length,me=[],xe=0;xe<ge;++xe)me.push(r(Y.charCodeAt(xe)));for(var Ie=0,je=oe;Ie<ge;++Ie){var Ye=me[Ie];Ye=="m"?me[Ie]=je:je=Ye}for(var tt=0,$e=oe;tt<ge;++tt){var it=me[tt];it=="1"&&$e=="r"?me[tt]="n":A.test(it)&&($e=it,it=="r"&&(me[tt]="R"))}for(var pt=1,ut=me[0];pt<ge-1;++pt){var Et=me[pt];Et=="+"&&ut=="1"&&me[pt+1]=="1"?me[pt]="1":Et==","&&ut==me[pt+1]&&(ut=="1"||ut=="n")&&(me[pt]=ut),ut=Et}for(var Ft=0;Ft<ge;++Ft){var Zt=me[Ft];if(Zt==",")me[Ft]="N";else if(Zt=="%"){var jt=void 0;for(jt=Ft+1;jt<ge&&me[jt]=="%";++jt);for(var yn=Ft&&me[Ft-1]=="!"||jt<ge&&me[jt]=="1"?"1":"N",mn=Ft;mn<jt;++mn)me[mn]=yn;Ft=jt-1}}for(var Vt=0,gn=oe;Vt<ge;++Vt){var tn=me[Vt];gn=="L"&&tn=="1"?me[Vt]="L":A.test(tn)&&(gn=tn)}for(var $t=0;$t<ge;++$t)if(i.test(me[$t])){var Xt=void 0;for(Xt=$t+1;Xt<ge&&i.test(me[Xt]);++Xt);for(var Ht=($t?me[$t-1]:oe)=="L",vn=(Xt<ge?me[Xt]:oe)=="L",Kr=Ht==vn?Ht?"L":"R":oe,er=$t;er<Xt;++er)me[er]=Kr;$t=Xt-1}for(var sn=[],Un,qt=0;qt<ge;)if(F.test(me[qt])){var Va=qt;for(++qt;qt<ge&&F.test(me[qt]);++qt);sn.push(new z(0,Va,qt))}else{var Gn=qt,gr=sn.length,vr=re=="rtl"?1:0;for(++qt;qt<ge&&me[qt]!="L";++qt);for(var un=Gn;un<qt;)if(K.test(me[un])){Gn<un&&(sn.splice(gr,0,new z(1,Gn,un)),gr+=vr);var Gr=un;for(++un;un<qt&&K.test(me[un]);++un);sn.splice(gr,0,new z(2,Gr,un)),gr+=vr,Gn=un}else++un;Gn<qt&&sn.splice(gr,0,new z(1,Gn,qt))}return re=="ltr"&&(sn[0].level==1&&(Un=Y.match(/^\s+/))&&(sn[0].from=Un[0].length,sn.unshift(new z(0,0,Un[0].length))),Ee(sn).level==1&&(Un=Y.match(/\s+$/))&&(Ee(sn).to-=Un[0].length,sn.push(new z(0,ge-Un[0].length,ge)))),re=="rtl"?sn.reverse():sn}}();function Fe(e,t){var r=e.order;return r==null&&(r=e.order=Ge(e.text,t)),r}var ze=[],be=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||ze).concat(r)}};function Ke(e,t){return e._handlers&&e._handlers[t]||ze}function He(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var A=Z(i,r);A>-1&&(n[t]=i.slice(0,A).concat(i.slice(A+1)))}}}function ve(e,t){var r=Ke(e,t);if(!r.length)return;for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function Re(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),ve(e,r||t.type,e,t),q(t)||t.codemirrorIgnore}function ue(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)Z(r,t[n])==-1&&r.push(t[n])}function ie(e,t){return Ke(e,t).length>0}function te(e){e.prototype.on=function(t,r){be(this,t,r)},e.prototype.off=function(t,r){He(this,t,r)}}function $(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function X(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function q(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ne(e){$(e),X(e)}function le(e){return e.target||e.srcElement}function ye(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var Te=function(){if(B&&U<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),ke;function rt(e){if(ke==null){var t=u("span","\u200B");v(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ke=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&U<8))}var r=ke?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var nt;function xt(e){if(nt!=null)return nt;var t=v(e,document.createTextNode("A\u062EA")),r=m(t,0,1).getBoundingClientRect(),n=m(t,1,2).getBoundingClientRect();return b(e),!r||r.left==r.right?!1:nt=n.right-r.right<3}var ht=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var A=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),F=A.indexOf("\r");F!=-1?(r.push(A.slice(0,F)),t+=F+1):(r.push(A),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Ve=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(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},mt=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ot=null;function Rt(e){if(ot!=null)return ot;var t=v(e,u("span","x")),r=t.getBoundingClientRect(),n=m(t,0,1).getBoundingClientRect();return ot=Math.abs(r.left-n.left)>1}var bt={},gt={};function nn(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),bt[e]=t}function zt(e,t){gt[e]=t}function ft(e){if(typeof e=="string"&>.hasOwnProperty(e))e=gt[e];else if(e&&typeof e.name=="string"&>.hasOwnProperty(e.name)){var t=gt[e.name];typeof t=="string"&&(t={name:t}),e=qe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ft("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ft("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function dt(e,t){t=ft(t);var r=bt[t.name];if(!r)return dt(e,"text/plain");var n=r(e,t);if(At.hasOwnProperty(t.name)){var i=At[t.name];for(var A in i){if(!i.hasOwnProperty(A))continue;n.hasOwnProperty(A)&&(n["_"+A]=n[A]),n[A]=i[A]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var F in t.modeProps)n[F]=t.modeProps[F];return n}var At={};function Nt(e,t){var r=At.hasOwnProperty(e)?At[e]:At[e]={};w(t,r)}function Wt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Pn(e,t){for(var r;e.innerMode&&!(r=e.innerMode(t),!r||r.mode==e);)t=r.state,e=r.mode;return r||{mode:e,state:t}}function tr(e,t,r){return e.startState?e.startState(t,r):!0}var lt=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};lt.prototype.eol=function(){return this.pos>=this.string.length},lt.prototype.sol=function(){return this.pos==this.lineStart},lt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},lt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},lt.prototype.eat=function(e){var t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e.test?e.test(t):e(t)),r)return++this.pos,t},lt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},lt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},lt.prototype.skipToEnd=function(){this.pos=this.string.length},lt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},lt.prototype.backUp=function(e){this.pos-=e},lt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=G(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},lt.prototype.indentation=function(){return G(this.string,null,this.tabSize)-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},lt.prototype.match=function(e,t,r){if(typeof e=="string"){var n=function(F){return r?F.toLowerCase():F},i=this.string.substr(this.pos,e.length);if(n(i)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var A=this.string.slice(this.pos).match(e);return A&&A.index>0?null:(A&&t!==!1&&(this.pos+=A[0].length),A)}},lt.prototype.current=function(){return this.string.slice(this.start,this.pos)},lt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},lt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},lt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ze(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 r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],A=i.chunkSize();if(t<A){r=i;break}t-=A}return r.lines[t]}function Kt(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(A){var F=A.text;i==r.line&&(F=F.slice(0,r.ch)),i==t.line&&(F=F.slice(t.ch)),n.push(F),++i}),n}function Pt(e,t,r){var n=[];return e.iter(t,r,function(i){n.push(i.text)}),n}function Ot(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Tt(e){if(e.parent==null)return null;for(var t=e.parent,r=Z(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;!(n.children[i]==t);++i)r+=n.children[i].chunkSize();return r+t.first}function Mt(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],A=i.height;if(t<A){e=i;continue e}t-=A,r+=i.chunkSize()}return r}while(!e.lines);for(var F=0;F<e.lines.length;++F){var K=e.lines[F],z=K.height;if(t<z)break;t-=z}return r+F}function dn(e,t){return t>=e.first&&t<e.first+e.size}function _r(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ne(e,t,r){if(r===void 0&&(r=null),!(this instanceof Ne))return new Ne(e,t,r);this.line=e,this.ch=t,this.sticky=r}function vt(e,t){return e.line-t.line||e.ch-t.ch}function zr(e,t){return e.sticky==t.sticky&&vt(e,t)==0}function yr(e){return Ne(e.line,e.ch)}function br(e,t){return vt(e,t)<0?t:e}function nr(e,t){return vt(e,t)<0?e:t}function Er(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function yt(e,t){if(t.line<e.first)return Ne(e.first,0);var r=e.first+e.size-1;return t.line>r?Ne(r,Ze(e,r).text.length):Ri(t,Ze(e,t.line).text.length)}function Ri(e,t){var r=e.ch;return r==null||r>t?Ne(e.line,t):r<0?Ne(e.line,0):e}function Be(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=yt(e,t[n]);return r}var Tr=function(e,t){this.state=e,this.lookAhead=t},xn=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};xn.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},xn.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}},xn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},xn.fromSaved=function(e,t,r){return t instanceof Tr?new xn(e,Wt(e.mode,t.state),r,t.lookAhead):new xn(e,Wt(e.mode,t),r)},xn.prototype.save=function(e){var t=e!==!1?Wt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Tr(t,this.maxLookAhead):t};function Vr(e,t,r,n){var i=[e.state.modeGen],A={};Rn(e,t.text,e.doc.mode,r,function(Y,re){return i.push(Y,re)},A,n);for(var F=r.state,K=function(Y){r.baseTokens=i;var re=e.state.overlays[Y],oe=1,ge=0;r.state=!0,Rn(e,t.text,re.mode,r,function(me,xe){for(var Ie=oe;ge<me;){var je=i[oe];je>me&&i.splice(oe,1,me,i[oe+1],je),oe+=2,ge=Math.min(me,je)}if(!xe)return;if(re.opaque)i.splice(Ie,oe-Ie,me,"overlay "+xe),oe=Ie+2;else for(;Ie<oe;Ie+=2){var Ye=i[Ie+1];i[Ie+1]=(Ye?Ye+" ":"")+"overlay "+xe}},A),r.state=F,r.baseTokens=null,r.baseTokenPos=1},z=0;z<e.state.overlays.length;++z)K(z);return{styles:i,classes:A.bgClass||A.textClass?A:null}}function rr(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Sn(e,Tt(t)),i=t.text.length>e.options.maxHighlightLength&&Wt(e.doc.mode,n.state),A=Vr(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=A.styles,A.classes?t.styleClasses=A.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Sn(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new xn(n,!0,t);var A=Li(e,t,r),F=A>n.first&&Ze(n,A-1).stateAfter,K=F?xn.fromSaved(n,F,A):new xn(n,tr(n.mode),A);return n.iter(A,t,function(z){Xr(e,z.text,K);var Y=K.line;z.stateAfter=Y==t-1||Y%5==0||Y>=i.viewFrom&&Y<i.viewTo?K.save():null,K.nextLine()}),r&&(n.modeFrontier=K.line),K}function Xr(e,t,r,n){var i=e.doc.mode,A=new lt(t,e.options.tabSize,r);for(A.start=A.pos=n||0,t==""&&Yr(i,r.state);!A.eol();)On(i,A,r.state),A.start=A.pos}function Yr(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=Pn(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function On(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Pn(e,r).mode);var A=e.token(t,r);if(t.pos>t.start)return A}throw new Error("Mode "+e.name+" failed to advance stream.")}var $r=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Ai(e,t,r,n){var i=e.doc,A=i.mode,F;t=yt(i,t);var K=Ze(i,t.line),z=Sn(e,t.line,r),Y=new lt(K.text,e.options.tabSize,z),re;for(n&&(re=[]);(n||Y.pos<t.ch)&&!Y.eol();)Y.start=Y.pos,F=On(A,Y,z.state),n&&re.push(new $r(Y,F,Wt(i.mode,z.state)));return n?re:new $r(Y,F,z.state)}function Jr(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";t[n]==null?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Rn(e,t,r,n,i,A,F){var K=r.flattenSpans;K==null&&(K=e.options.flattenSpans);var z=0,Y=null,re=new lt(t,e.options.tabSize,n),oe,ge=e.options.addModeClass&&[null];for(t==""&&Jr(Yr(r,n.state),A);!re.eol();){if(re.pos>e.options.maxHighlightLength?(K=!1,F&&Xr(e,t,n,re.pos),re.pos=t.length,oe=null):oe=Jr(On(r,re,n.state,ge),A),ge){var me=ge[0].name;me&&(oe="m-"+(oe?me+" "+oe:me))}if(!K||Y!=oe){for(;z<re.start;)z=Math.min(re.start,z+5e3),i(z,Y);Y=oe}re.start=re.pos}for(;z<re.pos;){var xe=Math.min(re.pos,z+5e3);i(xe,Y),z=xe}}function Li(e,t,r){for(var n,i,A=e.doc,F=r?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>F;--K){if(K<=A.first)return A.first;var z=Ze(A,K-1),Y=z.stateAfter;if(Y&&(!r||K+(Y instanceof Tr?Y.lookAhead:0)<=A.modeFrontier))return K;var re=G(z.text,null,e.options.tabSize);(i==null||n>re)&&(i=K-1,n=re)}return i}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var r=e.first,n=t-1;n>r;n--){var i=Ze(e,n).stateAfter;if(i&&(!(i instanceof Tr)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var Qr=!1,on=!1;function zn(){Qr=!0}function sa(){on=!0}function ir(e,t,r){this.marker=e,this.from=t,this.to=r}function An(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Zr(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function oa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Ci(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var A=e[i],F=A.marker,K=A.from==null||(F.inclusiveLeft?A.from<=t:A.from<t);if(K||A.from==t&&F.type=="bookmark"&&(!r||!A.marker.insertLeft)){var z=A.to==null||(F.inclusiveRight?A.to>=t:A.to>t);(n||(n=[])).push(new ir(F,A.from,z?null:A.to))}}return n}function Ii(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var A=e[i],F=A.marker,K=A.to==null||(F.inclusiveRight?A.to>=t:A.to>t);if(K||A.from==t&&F.type=="bookmark"&&(!r||A.marker.insertLeft)){var z=A.from==null||(F.inclusiveLeft?A.from<=t:A.from<t);(n||(n=[])).push(new ir(F,z?null:A.from-t,A.to==null?null:A.to-t))}}return n}function xr(e,t){if(t.full)return null;var r=dn(e,t.from.line)&&Ze(e,t.from.line).markedSpans,n=dn(e,t.to.line)&&Ze(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,A=t.to.ch,F=vt(t.from,t.to)==0,K=Ci(r,i,F),z=Ii(n,A,F),Y=t.text.length==1,re=Ee(t.text).length+(Y?i:0);if(K)for(var oe=0;oe<K.length;++oe){var ge=K[oe];if(ge.to==null){var me=An(z,ge.marker);me?Y&&(ge.to=me.to==null?null:me.to+re):ge.to=i}}if(z)for(var xe=0;xe<z.length;++xe){var Ie=z[xe];if(Ie.to!=null&&(Ie.to+=re),Ie.from==null){var je=An(K,Ie.marker);je||(Ie.from=re,Y&&(K||(K=[])).push(Ie))}else Ie.from+=re,Y&&(K||(K=[])).push(Ie)}K&&(K=Di(K)),z&&z!=K&&(z=Di(z));var Ye=[K];if(!Y){var tt=t.text.length-2,$e;if(tt>0&&K)for(var it=0;it<K.length;++it)K[it].to==null&&($e||($e=[])).push(new ir(K[it].marker,null,null));for(var pt=0;pt<tt;++pt)Ye.push($e);Ye.push(z)}return Ye}function Di(e){for(var t=0;t<e.length;++t){var r=e[t];r.from!=null&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Pi(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(me){if(me.markedSpans)for(var xe=0;xe<me.markedSpans.length;++xe){var Ie=me.markedSpans[xe].marker;Ie.readOnly&&(!n||Z(n,Ie)==-1)&&(n||(n=[])).push(Ie)}}),!n)return null;for(var i=[{from:t,to:r}],A=0;A<n.length;++A)for(var F=n[A],K=F.find(0),z=0;z<i.length;++z){var Y=i[z];if(vt(Y.to,K.from)<0||vt(Y.from,K.to)>0)continue;var re=[z,1],oe=vt(Y.from,K.from),ge=vt(Y.to,K.to);(oe<0||!F.inclusiveLeft&&!oe)&&re.push({from:Y.from,to:K.from}),(ge>0||!F.inclusiveRight&&!ge)&&re.push({from:K.to,to:Y.to}),i.splice.apply(i,re),z+=re.length-3}return i}function la(e){var t=e.markedSpans;if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}function wr(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function ar(e){return e.inclusiveLeft?-1:0}function sr(e){return e.inclusiveRight?1:0}function Sr(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var n=e.find(),i=t.find(),A=vt(n.from,i.from)||ar(e)-ar(t);if(A)return-A;var F=vt(n.to,i.to)||sr(e)-sr(t);return F||t.id-e.id}function Fn(e,t){var r=on&&e.markedSpans,n;if(r)for(var i=void 0,A=0;A<r.length;++A)i=r[A],i.marker.collapsed&&(t?i.from:i.to)==null&&(!n||Sr(n,i.marker)<0)&&(n=i.marker);return n}function Bn(e){return Fn(e,!0)}function jn(e){return Fn(e,!1)}function Or(e,t){var r=on&&e.markedSpans,n;if(r)for(var i=0;i<r.length;++i){var A=r[i];A.marker.collapsed&&(A.from==null||A.from<t)&&(A.to==null||A.to>t)&&(!n||Sr(n,A.marker)<0)&&(n=A.marker)}return n}function Mi(e,t,r,n,i){var A=Ze(e,t),F=on&&A.markedSpans;if(F)for(var K=0;K<F.length;++K){var z=F[K];if(!z.marker.collapsed)continue;var Y=z.marker.find(0),re=vt(Y.from,r)||ar(z.marker)-ar(i),oe=vt(Y.to,n)||sr(z.marker)-sr(i);if(re>=0&&oe<=0||re<=0&&oe>=0)continue;if(re<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?vt(Y.to,r)>=0:vt(Y.to,r)>0)||re>=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?vt(Y.from,n)<=0:vt(Y.from,n)<0))return!0}}function bn(e){for(var t;t=Bn(e);)e=t.find(-1,!0).line;return e}function ki(e){for(var t;t=jn(e);)e=t.find(1,!0).line;return e}function Rr(e){for(var t,r;t=jn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function qr(e,t){var r=Ze(e,t),n=bn(r);return r==n?t:Tt(n)}function Vn(e,t){if(t>e.lastLine())return t;var r=Ze(e,t),n;if(!Mn(e,r))return t;for(;n=jn(r);)r=n.find(1,!0).line;return Tt(r)+1}function Mn(e,t){var r=on&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i){if(n=r[i],!n.marker.collapsed)continue;if(n.from==null)return!0;if(n.marker.widgetNode)continue;if(n.from==0&&n.marker.inclusiveLeft&&ei(e,t,n))return!0}}function ei(e,t,r){if(r.to==null){var n=r.marker.find(1,!0);return ei(e,n.line,An(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,A=0;A<t.markedSpans.length;++A)if(i=t.markedSpans[A],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(i.to==null||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&ei(e,t,i))return!0}function Ln(e){e=bn(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var A=r.parent;A;r=A,A=r.parent)for(var F=0;F<A.children.length;++F){var K=A.children[F];if(K==r)break;t+=K.height}return t}function ti(e){if(e.height==0)return 0;for(var t=e.text.length,r,n=e;r=Bn(n);){var i=r.find(0,!0);n=i.from.line,t+=i.from.ch-i.to.ch}for(n=e;r=jn(n);){var A=r.find(0,!0);t-=n.text.length-A.from.ch,n=A.to.line,t+=n.text.length-A.to.ch}return t}function Ni(e){var t=e.display,r=e.doc;t.maxLine=Ze(r,r.first),t.maxLineLength=ti(t.maxLine),t.maxLineChanged=!0,r.iter(function(n){var i=ti(n);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=n)})}var or=function(e,t,r){this.text=e,wr(this,t),this.height=r?r(this):1};or.prototype.lineNo=function(){return Tt(this)},te(or);function ua(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),wr(e,r);var i=n?n(e):1;i!=e.height&&Ot(e,i)}function at(e){e.parent=null,la(e)}var _t={},ct={};function wt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?ct:_t;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Ct(e,t){var r=_("span",null,null,D?"padding-right: .1px":null),n={pre:_("pre",[r],"CodeMirror-line"),content:r,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 A=i?t.rest[i-1]:t.line,F=void 0;n.pos=0,n.addToken=Lt,xt(e.display.measure)&&(F=Fe(A,e.doc.direction))&&(n.addToken=cn(n.addToken,F)),n.map=[];var K=t!=e.display.externalMeasured&&Tt(A);Hn(A,n,rr(e,A,K)),A.styleClasses&&(A.styleClasses.bgClass&&(n.bgClass=j(A.styleClasses.bgClass,n.bgClass||"")),A.styleClasses.textClass&&(n.textClass=j(A.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(rt(e.display.measure))),i==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(D){var z=n.content.lastChild;(/\bcm-tab\b/.test(z.className)||z.querySelector&&z.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return ve(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=j(n.pre.className,n.textClass||"")),n}function Ut(e){var t=u("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Lt(e,t,r,n,i,A,F){if(!t)return;var K=e.splitSpaces?Yt(t,e.trailingSpace):t,z=e.cm.state.specialChars,Y=!1,re;if(!z.test(t))e.col+=t.length,re=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,re),B&&U<9&&(Y=!0),e.pos+=t.length;else{re=document.createDocumentFragment();for(var oe=0;;){z.lastIndex=oe;var ge=z.exec(t),me=ge?ge.index-oe:t.length-oe;if(me){var xe=document.createTextNode(K.slice(oe,oe+me));B&&U<9?re.appendChild(u("span",[xe])):re.appendChild(xe),e.map.push(e.pos,e.pos+me,xe),e.col+=me,e.pos+=me}if(!ge)break;oe+=me+1;var Ie=void 0;if(ge[0]==" "){var je=e.cm.options.tabSize,Ye=je-e.col%je;Ie=re.appendChild(u("span",de(Ye),"cm-tab")),Ie.setAttribute("role","presentation"),Ie.setAttribute("cm-text"," "),e.col+=Ye}else ge[0]=="\r"||ge[0]==`
|
|
`?(Ie=re.appendChild(u("span",ge[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ie.setAttribute("cm-text",ge[0]),e.col+=1):(Ie=e.cm.options.specialCharPlaceholder(ge[0]),Ie.setAttribute("cm-text",ge[0]),B&&U<9?re.appendChild(u("span",[Ie])):re.appendChild(Ie),e.col+=1);e.map.push(e.pos,e.pos+1,Ie),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,r||n||i||Y||A||F){var tt=r||"";n&&(tt+=n),i&&(tt+=i);var $e=u("span",[re],tt,A);if(F)for(var it in F)F.hasOwnProperty(it)&&it!="style"&&it!="class"&&$e.setAttribute(it,F[it]);return e.content.appendChild($e)}e.content.appendChild(re)}function Yt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var A=e.charAt(i);A==" "&&r&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(A="\xA0"),n+=A,r=A==" "}return n}function cn(e,t){return function(r,n,i,A,F,K,z){i=i?i+" cm-force-border":"cm-force-border";for(var Y=r.pos,re=Y+n.length;;){for(var oe=void 0,ge=0;ge<t.length&&!(oe=t[ge],oe.to>Y&&oe.from<=Y);ge++);if(oe.to>=re)return e(r,n,i,A,F,K,z);e(r,n.slice(0,oe.to-Y),i,A,null,K,z),A=null,n=n.slice(oe.to-Y),Y=oe.to}}}function St(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Hn(e,t,r){var n=e.markedSpans,i=e.text,A=0;if(!n){for(var F=1;F<r.length;F+=2)t.addToken(t,i.slice(A,A=r[F]),wt(r[F+1],t.cm.options));return}for(var K=i.length,z=0,Y=1,re="",oe,ge,me=0,xe,Ie,je,Ye,tt;;){if(me==z){xe=Ie=je=ge="",tt=null,Ye=null,me=Infinity;for(var $e=[],it=void 0,pt=0;pt<n.length;++pt){var ut=n[pt],Et=ut.marker;if(Et.type=="bookmark"&&ut.from==z&&Et.widgetNode)$e.push(Et);else if(ut.from<=z&&(ut.to==null||ut.to>z||Et.collapsed&&ut.to==z&&ut.from==z)){if(ut.to!=null&&ut.to!=z&&me>ut.to&&(me=ut.to,Ie=""),Et.className&&(xe+=" "+Et.className),Et.css&&(ge=(ge?ge+";":"")+Et.css),Et.startStyle&&ut.from==z&&(je+=" "+Et.startStyle),Et.endStyle&&ut.to==me&&(it||(it=[])).push(Et.endStyle,ut.to),Et.title&&((tt||(tt={})).title=Et.title),Et.attributes)for(var Ft in Et.attributes)(tt||(tt={}))[Ft]=Et.attributes[Ft];Et.collapsed&&(!Ye||Sr(Ye.marker,Et)<0)&&(Ye=ut)}else ut.from>z&&me>ut.from&&(me=ut.from)}if(it)for(var Zt=0;Zt<it.length;Zt+=2)it[Zt+1]==me&&(Ie+=" "+it[Zt]);if(!Ye||Ye.from==z)for(var jt=0;jt<$e.length;++jt)St(t,0,$e[jt]);if(Ye&&(Ye.from||0)==z){if(St(t,(Ye.to==null?K+1:Ye.to)-z,Ye.marker,Ye.from==null),Ye.to==null)return;Ye.to==z&&(Ye=!1)}}if(z>=K)break;for(var yn=Math.min(K,me);;){if(re){var mn=z+re.length;if(!Ye){var Vt=mn>yn?re.slice(0,yn-z):re;t.addToken(t,Vt,oe?oe+xe:xe,je,z+Vt.length==me?Ie:"",ge,tt)}if(mn>=yn){re=re.slice(yn-z),z=yn;break}z=mn,je=""}re=i.slice(A,A=r[Y++]),oe=wt(r[Y++],t.cm.options)}}}function It(e,t,r){this.line=t,this.rest=Rr(t),this.size=this.rest?Tt(Ee(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Mn(e,t)}function hn(e,t,r){for(var n=[],i,A=t;A<r;A=i){var F=new It(e.doc,Ze(e.doc,A),A);i=A+F.size,n.push(F)}return n}var rn=null;function wn(e){rn?rn.ops.push(e):e.ownsGroup=rn={ops:[e],delayedCallbacks:[]}}function Co(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function Io(e,t){var r=e.ownsGroup;if(!r)return;try{Co(r)}finally{rn=null,t(r)}}var ni=null;function en(e,t){var r=Ke(e,t);if(!r.length)return;var n=Array.prototype.slice.call(arguments,2),i;rn?i=rn.delayedCallbacks:ni?i=ni:(i=ni=[],setTimeout(Do,0));for(var A=function(K){i.push(function(){return r[K].apply(null,n)})},F=0;F<r.length;++F)A(F)}function Do(){var e=ni;ni=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,r,n){for(var i=0;i<t.changes.length;i++){var A=t.changes[i];A=="text"?Mo(e,t):A=="gutter"?Ja(e,t,r,n):A=="class"?da(e,t):A=="widget"&&ko(e,t,n)}t.changes=null}function ri(e){return e.node==e.text&&(e.node=u("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&U<8&&(e.node.style.zIndex=2)),e.node}function Po(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=ri(t);t.background=n.insertBefore(u("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Ct(e,t)}function Mo(e,t){var r=t.text.className,n=$a(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,da(e,t)):r&&(t.text.className=r)}function da(e,t){Po(e,t),t.line.wrapClass?ri(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function Ja(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ri(t);t.gutterBackground=u("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var A=t.line.gutterMarkers;if(e.options.lineNumbers||A){var F=ri(t),K=t.gutter=u("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),F.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!A||!A["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(u("div",_r(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),A)for(var z=0;z<e.display.gutterSpecs.length;++z){var Y=e.display.gutterSpecs[z].className,re=A.hasOwnProperty(Y)&&A[Y];re&&K.appendChild(u("div",[re],"CodeMirror-gutter-elt","left: "+n.gutterLeft[Y]+"px; width: "+n.gutterWidth[Y]+"px"))}}}function ko(e,t,r){t.alignable&&(t.alignable=null);for(var n=S("CodeMirror-linewidget"),i=t.node.firstChild,A=void 0;i;i=A)A=i.nextSibling,n.test(i.className)&&t.node.removeChild(i);Qa(e,t,r)}function No(e,t,r,n){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Ja(e,t,r,n),Qa(e,t,n),t.node}function Qa(e,t,r){if(Za(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)Za(e,t.rest[n],t,r,!1)}function Za(e,t,r,n,i){if(!t.widgets)return;for(var A=ri(r),F=0,K=t.widgets;F<K.length;++F){var z=K[F],Y=u("div",[z.node],"CodeMirror-linewidget"+(z.className?" "+z.className:""));z.handleMouseEvents||Y.setAttribute("cm-ignore-events","true"),Uo(z,Y,r,n),e.display.input.setUneditable(Y),i&&z.above?A.insertBefore(Y,r.gutter||r.text):A.appendChild(Y),en(z,"redraw")}}function Uo(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function ii(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!y(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),v(t.display.measure,u("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Wn(e,t){for(var r=le(t);r!=e.wrapper;r=r.parentNode)if(!r||r.nodeType==1&&r.getAttribute("cm-ignore-events")=="true"||r.parentNode==e.sizer&&r!=e.mover)return!0}function Ui(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=v(e.measure,u("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(n.left)&&!isNaN(n.right)&&(e.cachedPaddingH=n),n}function kn(e){return ae-e.display.nativeBarWidth}function lr(e){return e.display.scroller.clientWidth-kn(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-kn(e)-e.display.barHeight}function Fo(e,t,r){var n=e.options.lineWrapping,i=n&&lr(e);if(!t.measure.heights||n&&t.measure.width!=i){var A=t.measure.heights=[];if(n){t.measure.width=i;for(var F=t.text.firstChild.getClientRects(),K=0;K<F.length-1;K++){var z=F[K],Y=F[K+1];Math.abs(z.bottom-Y.bottom)>2&&A.push((z.bottom+Y.top)/2-r.top)}}A.push(r.bottom-r.top)}}function es(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(Tt(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bo(e,t){t=bn(t);var r=Tt(t),n=e.display.externalMeasured=new It(e.doc,t,r);n.lineN=r;var i=n.built=Ct(e,n);return n.text=i.pre,v(e.display.lineMeasure,i.pre),n}function ts(e,t,r,n){return Nn(e,Ar(e,t),r,n)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[cr(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function Ar(e,t){var r=Tt(t),n=fa(e,r);n&&!n.text?n=null:n&&n.changes&&(Ya(e,n,r,ya(e)),e.curOp.forceUpdate=!0),n||(n=Bo(e,t));var i=es(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Nn(e,t,r,n,i){t.before&&(r=-1);var A=r+(n||""),F;return t.cache.hasOwnProperty(A)?F=t.cache[A]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fo(e,t.view,t.rect),t.hasHeights=!0),F=Ho(e,t,r,n),F.bogus||(t.cache[A]=F)),{left:F.left,right:F.right,top:i?F.rtop:F.top,bottom:i?F.rbottom:F.bottom}}var ns={left:0,right:0,top:0,bottom:0};function rs(e,t,r){for(var n,i,A,F,K,z,Y=0;Y<e.length;Y+=3)if(K=e[Y],z=e[Y+1],t<K?(i=0,A=1,F="left"):t<z?(i=t-K,A=i+1):(Y==e.length-3||t==z&&e[Y+3]>t)&&(A=z-K,i=A-1,t>=z&&(F="right")),i!=null){if(n=e[Y+2],K==z&&r==(n.insertLeft?"left":"right")&&(F=r),r=="left"&&i==0)for(;Y&&e[Y-2]==e[Y-3]&&e[Y-1].insertLeft;)n=e[(Y-=3)+2],F="left";if(r=="right"&&i==z-K)for(;Y<e.length-3&&e[Y+3]==e[Y+4]&&!e[Y+5].insertLeft;)n=e[(Y+=3)+2],F="right";break}return{node:n,start:i,end:A,collapse:F,coverStart:K,coverEnd:z}}function jo(e,t){var r=ns;if(t=="left")for(var n=0;n<e.length&&!((r=e[n]).left!=r.right);n++);else for(var i=e.length-1;i>=0&&!((r=e[i]).left!=r.right);i--);return r}function Ho(e,t,r,n){var i=rs(t.map,r,n),A=i.node,F=i.start,K=i.end,z=i.collapse,Y;if(A.nodeType==3){for(var re=0;re<4;re++){for(;F&&Ce(t.line.text.charAt(i.coverStart+F));)--F;for(;i.coverStart+K<i.coverEnd&&Ce(t.line.text.charAt(i.coverStart+K));)++K;if(B&&U<9&&F==0&&K==i.coverEnd-i.coverStart?Y=A.parentNode.getBoundingClientRect():Y=jo(m(A,F,K).getClientRects(),n),Y.left||Y.right||F==0)break;K=F,F=F-1,z="right"}B&&U<11&&(Y=Wo(e.display.measure,Y))}else{F>0&&(z=n="right");var oe;e.options.lineWrapping&&(oe=A.getClientRects()).length>1?Y=oe[n=="right"?oe.length-1:0]:Y=A.getBoundingClientRect()}if(B&&U<9&&!F&&(!Y||!Y.left&&!Y.right)){var ge=A.parentNode.getClientRects()[0];ge?Y={left:ge.left,right:ge.left+Cr(e.display),top:ge.top,bottom:ge.bottom}:Y=ns}for(var me=Y.top-t.rect.top,xe=Y.bottom-t.rect.top,Ie=(me+xe)/2,je=t.view.measure.heights,Ye=0;Ye<je.length-1&&!(Ie<je[Ye]);Ye++);var tt=Ye?je[Ye-1]:0,$e=je[Ye],it={left:(z=="right"?Y.right:Y.left)-t.rect.left,right:(z=="left"?Y.left:Y.right)-t.rect.left,top:tt,bottom:$e};return!Y.left&&!Y.right&&(it.bogus=!0),e.options.singleCursorHeightPerLine||(it.rtop=me,it.rbottom=xe),it}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Rt(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function is(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 as(e){e.display.externalMeasure=null,b(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)is(e.display.view[t])}function ai(e){as(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ss(){return g&&o?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return g&&o?-(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 r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=ii(e.widgets[r]));return t}function Fi(e,t,r,n,i){if(!i){var A=pa(t);r.top+=A,r.bottom+=A}if(n=="line")return r;n||(n="local");var F=Ln(t);if(n=="local"?F+=Ui(e.display):F-=e.display.viewOffset,n=="page"||n=="window"){var K=e.display.lineSpace.getBoundingClientRect();F+=K.top+(n=="window"?0:os());var z=K.left+(n=="window"?0:ss());r.left+=z,r.right+=z}return r.top+=F,r.bottom+=F,r}function ls(e,t,r){if(r=="div")return t;var n=t.left,i=t.top;if(r=="page")n-=ss(),i-=os();else if(r=="local"||!r){var A=e.display.sizer.getBoundingClientRect();n+=A.left,i+=A.top}var F=e.display.lineSpace.getBoundingClientRect();return{left:n-F.left,top:i-F.top}}function ma(e,t,r,n,i){return n||(n=Ze(e.doc,t.line)),Fi(e,n,ts(e,n,t.ch,i),r)}function Cn(e,t,r,n,i,A){n=n||Ze(e.doc,t.line),i||(i=Ar(e,n));function F(xe,Ie){var je=Nn(e,i,xe,Ie?"right":"left",A);return Ie?je.left=je.right:je.right=je.left,Fi(e,n,je,r)}var K=Fe(n,e.doc.direction),z=t.ch,Y=t.sticky;if(z>=n.text.length?(z=n.text.length,Y="before"):z<=0&&(z=0,Y="after"),!K)return F(Y=="before"?z-1:z,Y=="before");function re(xe,Ie,je){var Ye=K[Ie],tt=Ye.level==1;return F(je?xe-1:xe,tt!=je)}var oe=Ue(K,z,Y),ge=Le,me=re(z,oe,Y=="before");return ge!=null&&(me.other=re(z,ge,Y!="before")),me}function us(e,t){var r=0;t=yt(e.doc,t),e.options.lineWrapping||(r=Cr(e.display)*t.ch);var n=Ze(e.doc,t.line),i=Ln(n)+Ui(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function ga(e,t,r,n,i){var A=Ne(e,t,r);return A.xRel=i,n&&(A.outside=n),A}function va(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return ga(n.first,0,null,-1,-1);var i=Mt(n,r),A=n.first+n.size-1;if(i>A)return ga(n.first+n.size-1,Ze(n,A).text.length,null,1,1);t<0&&(t=0);for(var F=Ze(n,i);;){var K=Ko(e,F,i,t,r),z=Or(F,K.ch+(K.xRel>0||K.outside>0?1:0));if(!z)return K;var Y=z.find(1);if(Y.line==i)return Y;F=Ze(n,i=Y.line)}}function ds(e,t,r,n){n-=pa(t);var i=t.text.length,A=et(function(F){return Nn(e,r,F-1).bottom<=n},i,0);return i=et(function(F){return Nn(e,r,F).top>n},A,i),{begin:A,end:i}}function cs(e,t,r,n){r||(r=Ar(e,t));var i=Fi(e,t,Nn(e,r,n),"line").top;return ds(e,t,r,i)}function _a(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function Ko(e,t,r,n,i){i-=Ln(t);var A=Ar(e,t),F=pa(t),K=0,z=t.text.length,Y=!0,re=Fe(t,e.doc.direction);if(re){var oe=(e.options.lineWrapping?zo:Go)(e,t,r,A,re,n,i);Y=oe.level!=1,K=Y?oe.from:oe.to-1,z=Y?oe.to:oe.from-1}var ge=null,me=null,xe=et(function(pt){var ut=Nn(e,A,pt);return ut.top+=F,ut.bottom+=F,_a(ut,n,i,!1)?(ut.top<=i&&ut.left<=n&&(ge=pt,me=ut),!0):!1},K,z),Ie,je,Ye=!1;if(me){var tt=n-me.left<me.right-n,$e=tt==Y;xe=ge+($e?0:1),je=$e?"after":"before",Ie=tt?me.left:me.right}else{!Y&&(xe==z||xe==K)&&xe++,je=xe==0?"after":xe==t.text.length?"before":Nn(e,A,xe-(Y?1:0)).bottom+F<=i==Y?"after":"before";var it=Cn(e,Ne(r,xe,je),"line",t,A);Ie=it.left,Ye=i<it.top?-1:i>=it.bottom?1:0}return xe=Oe(t.text,xe,1),ga(r,xe,je,Ye,n-Ie)}function Go(e,t,r,n,i,A,F){var K=et(function(oe){var ge=i[oe],me=ge.level!=1;return _a(Cn(e,Ne(r,me?ge.to:ge.from,me?"before":"after"),"line",t,n),A,F,!0)},0,i.length-1),z=i[K];if(K>0){var Y=z.level!=1,re=Cn(e,Ne(r,Y?z.from:z.to,Y?"after":"before"),"line",t,n);_a(re,A,F,!0)&&re.top>F&&(z=i[K-1])}return z}function zo(e,t,r,n,i,A,F){var K=ds(e,t,n,F),z=K.begin,Y=K.end;/\s/.test(t.text.charAt(Y-1))&&Y--;for(var re=null,oe=null,ge=0;ge<i.length;ge++){var me=i[ge];if(me.from>=Y||me.to<=z)continue;var xe=me.level!=1,Ie=Nn(e,n,xe?Math.min(Y,me.to)-1:Math.max(z,me.from)).right,je=Ie<A?A-Ie+1e9:Ie-A;(!re||oe>je)&&(re=me,oe=je)}return re||(re=i[i.length-1]),re.from<z&&(re={from:z,to:re.to,level:re.level}),re.to>Y&&(re={from:re.from,to:Y,level:re.level}),re}var ur;function Lr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ur==null){ur=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ur.appendChild(document.createTextNode("x")),ur.appendChild(u("br"));ur.appendChild(document.createTextNode("x"))}v(e.measure,ur);var r=ur.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),b(e.measure),r||1}function Cr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),r=u("pre",[t],"CodeMirror-line-like");v(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ya(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,A=t.gutters.firstChild,F=0;A;A=A.nextSibling,++F){var K=e.display.gutterSpecs[F].className;r[K]=A.offsetLeft+A.clientLeft+i,n[K]=A.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function hs(e){var t=Lr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Cr(e.display)-3);return function(i){if(Mn(e.doc,i))return 0;var A=0;if(i.widgets)for(var F=0;F<i.widgets.length;F++)i.widgets[F].height&&(A+=i.widgets[F].height);return r?A+(Math.ceil(i.text.length/n)||1)*t:A+t}}function Ea(e){var t=e.doc,r=hs(e);t.iter(function(n){var i=r(n);i!=n.height&&Ot(n,i)})}function dr(e,t,r,n){var i=e.display;if(!r&&le(t).getAttribute("cm-not-content")=="true")return null;var A,F,K=i.lineSpace.getBoundingClientRect();try{A=t.clientX-K.left,F=t.clientY-K.top}catch(oe){return null}var z=va(e,A,F),Y;if(n&&z.xRel>0&&(Y=Ze(e.doc,z.line).text).length==z.ch){var re=G(Y,Y.length,e.options.tabSize)-Y.length;z=Ne(z.line,Math.max(0,Math.round((A-qa(e.display).left)/Cr(e.display))-re))}return z}function cr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,t<0)return n}function fn(e,t,r,n){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)on&&qr(e.doc,t)<i.viewTo&&Yn(e);else if(r<=i.viewFrom)on&&Vn(e.doc,r+n)>i.viewFrom?Yn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Yn(e);else if(t<=i.viewFrom){var A=Bi(e,r,r+n,1);A?(i.view=i.view.slice(A.index),i.viewFrom=A.lineN,i.viewTo+=n):Yn(e)}else if(r>=i.viewTo){var F=Bi(e,t,t,-1);F?(i.view=i.view.slice(0,F.index),i.viewTo=F.lineN):Yn(e)}else{var K=Bi(e,t,t,-1),z=Bi(e,r,r+n,1);K&&z?(i.view=i.view.slice(0,K.index).concat(hn(e,K.lineN,z.lineN)).concat(i.view.slice(z.index)),i.viewTo+=n):Yn(e)}var Y=i.externalMeasured;Y&&(r<Y.lineN?Y.lineN+=n:t<Y.lineN+Y.size&&(i.externalMeasured=null))}function Xn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),t<n.viewFrom||t>=n.viewTo)return;var A=n.view[cr(e,t)];if(A.node==null)return;var F=A.changes||(A.changes=[]);Z(F,r)==-1&&F.push(r)}function Yn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bi(e,t,r,n){var i=cr(e,t),A,F=e.display.view;if(!on||r==e.doc.first+e.doc.size)return{index:i,lineN:r};for(var K=e.display.viewFrom,z=0;z<i;z++)K+=F[z].size;if(K!=t){if(n>0){if(i==F.length-1)return null;A=K+F[i].size-t,i++}else A=K-t;t+=A,r+=A}for(;qr(e.doc,r)!=r;){if(i==(n<0?0:F.length-1))return null;r+=n*F[i-(n<0?1:0)].size,i+=n}return{index:i,lineN:r}}function Vo(e,t,r){var n=e.display,i=n.view;i.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=hn(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=hn(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(cr(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(hn(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,cr(e,r)))),n.viewTo=r}function fs(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];!i.hidden&&(!i.node||i.changes)&&++r}return r}function si(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),A=n.selection=document.createDocumentFragment(),F=0;F<r.sel.ranges.length;F++){if(!t&&F==r.sel.primIndex)continue;var K=r.sel.ranges[F];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var z=K.empty();(z||e.options.showCursorWhenSelecting)&&ms(e,K.head,i),z||Xo(e,K,A)}return n}function ms(e,t,r){var n=Cn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(u("div","\xA0","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var A=r.appendChild(u("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));A.style.display="",A.style.left=n.other.left+"px",A.style.top=n.other.top+"px",A.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function ji(e,t){return e.top-t.top||e.left-t.left}function Xo(e,t,r){var n=e.display,i=e.doc,A=document.createDocumentFragment(),F=qa(e.display),K=F.left,z=Math.max(n.sizerWidth,lr(e)-n.sizer.offsetLeft)-F.right,Y=i.direction=="ltr";function re($e,it,pt,ut){it<0&&(it=0),it=Math.round(it),ut=Math.round(ut),A.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+$e+`px;
|
|
top: `+it+"px; width: "+(pt==null?z-$e:pt)+`px;
|
|
height: `+(ut-it)+"px"))}function oe($e,it,pt){var ut=Ze(i,$e),Et=ut.text.length,Ft,Zt;function jt(Vt,gn){return ma(e,Ne($e,Vt),"div",ut,gn)}function yn(Vt,gn,tn){var $t=cs(e,ut,null,Vt),Xt=gn=="ltr"==(tn=="after")?"left":"right",Ht=tn=="after"?$t.begin:$t.end-(/\s/.test(ut.text.charAt($t.end-1))?2:1);return jt(Ht,Xt)[Xt]}var mn=Fe(ut,i.direction);return Me(mn,it||0,pt==null?Et:pt,function(Vt,gn,tn,$t){var Xt=tn=="ltr",Ht=jt(Vt,Xt?"left":"right"),vn=jt(gn-1,Xt?"right":"left"),Kr=it==null&&Vt==0,er=pt==null&&gn==Et,sn=$t==0,Un=!mn||$t==mn.length-1;if(vn.top-Ht.top<=3){var qt=(Y?Kr:er)&&sn,Va=(Y?er:Kr)&&Un,Gn=qt?K:(Xt?Ht:vn).left,gr=Va?z:(Xt?vn:Ht).right;re(Gn,Ht.top,gr-Gn,Ht.bottom)}else{var vr,un,Gr,Xa;Xt?(vr=Y&&Kr&&sn?K:Ht.left,un=Y?z:yn(Vt,tn,"before"),Gr=Y?K:yn(gn,tn,"after"),Xa=Y&&er&&Un?z:vn.right):(vr=Y?yn(Vt,tn,"before"):K,un=!Y&&Kr&&sn?z:Ht.right,Gr=!Y&&er&&Un?K:vn.left,Xa=Y?yn(gn,tn,"after"):z),re(vr,Ht.top,un-vr,Ht.bottom),Ht.bottom<vn.top&&re(K,Ht.bottom,null,vn.top),re(Gr,vn.top,Xa-Gr,vn.bottom)}(!Ft||ji(Ht,Ft)<0)&&(Ft=Ht),ji(vn,Ft)<0&&(Ft=vn),(!Zt||ji(Ht,Zt)<0)&&(Zt=Ht),ji(vn,Zt)<0&&(Zt=vn)}),{start:Ft,end:Zt}}var ge=t.from(),me=t.to();if(ge.line==me.line)oe(ge.line,ge.ch,me.ch);else{var xe=Ze(i,ge.line),Ie=Ze(i,me.line),je=bn(xe)==bn(Ie),Ye=oe(ge.line,ge.ch,je?xe.text.length+1:null).end,tt=oe(me.line,je?0:null,me.ch).start;je&&(Ye.top<tt.top-2?(re(Ye.right,Ye.top,null,Ye.bottom),re(K,tt.top,tt.left,tt.bottom)):re(Ye.right,Ye.top,tt.left-Ye.right,Ye.bottom)),Ye.bottom<tt.top&&re(K,Ye.bottom,null,tt.top)}r.appendChild(A)}function Ta(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Ir(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function gs(e){e.state.focused||(e.display.input.focus(),xa(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ir(e))},100)}function xa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(ve(e,"focus",e,t),e.state.focused=!0,M(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),D&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Ir(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(ve(e,"blur",e,t),e.state.focused=!1,E(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Hi(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],A=e.options.lineWrapping,F=void 0,K=0;if(i.hidden)continue;if(B&&U<8){var z=i.node.offsetTop+i.node.offsetHeight;F=z-r,r=z}else{var Y=i.node.getBoundingClientRect();F=Y.bottom-Y.top,!A&&i.text.firstChild&&(K=i.text.firstChild.getBoundingClientRect().right-Y.left-1)}var re=i.line.height-F;if((re>.005||re<-.005)&&(Ot(i.line,F),_s(i.line),i.rest))for(var oe=0;oe<i.rest.length;oe++)_s(i.rest[oe]);if(K>e.display.sizerWidth){var ge=Math.ceil(K/Cr(e.display));ge>e.display.maxLineLength&&(e.display.maxLineLength=ge,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function _s(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function Wi(e,t,r){var n=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Ui(e));var i=r&&r.bottom!=null?r.bottom:n+e.wrapper.clientHeight,A=Mt(t,n),F=Mt(t,i);if(r&&r.ensure){var K=r.ensure.from.line,z=r.ensure.to.line;K<A?(A=K,F=Mt(t,Ln(Ze(t,K))+e.wrapper.clientHeight)):Math.min(z,t.lastLine())>=F&&(A=Mt(t,Ln(Ze(t,z))-e.wrapper.clientHeight),F=z)}return{from:A,to:Math.max(F,A+1)}}function Yo(e,t){if(Re(e,"scrollCursorIntoView"))return;var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!a){var A=u("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-r.viewOffset-Ui(e.display))+`px;
|
|
height: `+(t.bottom-t.top+kn(e)+r.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(A),A.scrollIntoView(i),e.display.lineSpace.removeChild(A)}}function $o(e,t,r,n){n==null&&(n=0);var i;!e.options.lineWrapping&&t==r&&(t=t.ch?Ne(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Ne(t.line,t.ch+1,"before"):t);for(var A=0;A<5;A++){var F=!1,K=Cn(e,t),z=!r||r==t?K:Cn(e,r);i={left:Math.min(K.left,z.left),top:Math.min(K.top,z.top)-n,right:Math.max(K.left,z.left),bottom:Math.max(K.bottom,z.bottom)+n};var Y=wa(e,i),re=e.doc.scrollTop,oe=e.doc.scrollLeft;if(Y.scrollTop!=null&&(li(e,Y.scrollTop),Math.abs(e.doc.scrollTop-re)>1&&(F=!0)),Y.scrollLeft!=null&&(hr(e,Y.scrollLeft),Math.abs(e.doc.scrollLeft-oe)>1&&(F=!0)),!F)break}return i}function Jo(e,t){var r=wa(e,t);r.scrollTop!=null&&li(e,r.scrollTop),r.scrollLeft!=null&&hr(e,r.scrollLeft)}function wa(e,t){var r=e.display,n=Lr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,A=ha(e),F={};t.bottom-t.top>A&&(t.bottom=t.top+A);var K=e.doc.height+ca(r),z=t.top<n,Y=t.bottom>K-n;if(t.top<i)F.scrollTop=z?0:t.top;else if(t.bottom>i+A){var re=Math.min(t.top,(Y?K:t.bottom)-A);re!=i&&(F.scrollTop=re)}var oe=e.options.fixedGutter?0:r.gutters.offsetWidth,ge=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-oe,me=lr(e)-r.gutters.offsetWidth,xe=t.right-t.left>me;return xe&&(t.right=t.left+me),t.left<10?F.scrollLeft=0:t.left<ge?F.scrollLeft=Math.max(0,t.left+oe-(xe?0:10)):t.right>me+ge-3&&(F.scrollLeft=t.right+(xe?0:10)-me),F}function Sa(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Dr(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oi(e,t,r){(t!=null||r!=null)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Qo(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=us(e,t.from),n=us(e,t.to);ys(e,r,n,t.margin)}}function ys(e,t,r,n){var i=wa(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});oi(e,i.scrollLeft,i.scrollTop)}function li(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;I||Ra(e,{top:t}),bs(e,t,!0),I&&Ra(e),ci(e,100)}function bs(e,t,r){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!r)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function hr(e,t,r,n){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ui(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+kn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var fr=function(e,t,r){this.cm=r;var n=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),be(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),be(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};fr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n: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=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var A=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+A)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},fr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},fr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},fr.prototype.zeroWidthHack=function(){var e=l&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new J,this.disableVert=new J},fr.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var i=e.getBoundingClientRect(),A=r=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);A!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},fr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var di=function(){};di.prototype.update=function(){return{bottom:0,right:0}},di.prototype.setScrollLeft=function(){},di.prototype.setScrollTop=function(){},di.prototype.clear=function(){};function Pr(e,t){t||(t=ui(e));var r=e.display.barWidth,n=e.display.barHeight;Es(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Hi(e),Es(e,ui(e)),r=e.display.barWidth,n=e.display.barHeight}function Es(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var Ts={native:fr,null:di};function xs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&E(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ts[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),be(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?hr(e,t):li(e,t)},e),e.display.scrollbars.addClass&&M(e.display.wrapper,e.display.scrollbars.addClass)}var Zo=0;function pr(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:++Zo},wn(e.curOp)}function mr(e){var t=e.curOp;t&&Io(t,function(r){for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;qo(r)})}function qo(e){for(var t=e.ops,r=0;r<t.length;r++)el(t[r]);for(var n=0;n<t.length;n++)tl(t[n]);for(var i=0;i<t.length;i++)nl(t[i]);for(var A=0;A<t.length;A++)rl(t[A]);for(var F=0;F<t.length;F++)il(t[F])}function el(e){var t=e.cm,r=t.display;sl(t),e.updateMaxLine&&Ni(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.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&&Oa(e.cm,e.update)}function nl(e){var t=e.cm,r=t.display;e.updatedDisplay&&Hi(t),e.barMeasure=ui(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+kn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-lr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function rl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&hr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==P();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Pr(t,e.barMeasure),e.updatedDisplay&&La(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&gs(e.cm)}function il(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&ws(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&bs(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&hr(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$o(t,yt(n,e.scrollToPos.from),yt(n,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,i)}var A=e.maybeHiddenMarkers,F=e.maybeUnhiddenMarkers;if(A)for(var K=0;K<A.length;++K)A[K].lines.length||ve(A[K],"hide");if(F)for(var z=0;z<F.length;++z)F[z].lines.length&&ve(F[z],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&ve(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function _n(e,t){if(e.curOp)return t();pr(e);try{return t()}finally{mr(e)}}function Jt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);pr(e);try{return t.apply(e,arguments)}finally{mr(e)}}}function ln(e){return function(){if(this.curOp)return e.apply(this,arguments);pr(this);try{return e.apply(this,arguments)}finally{mr(this)}}}function Qt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);pr(t);try{return e.apply(this,arguments)}finally{mr(t)}}}function ci(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,N(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=Sn(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(A){if(n.line>=e.display.viewFrom){var F=A.styles,K=A.text.length>e.options.maxHighlightLength?Wt(t.mode,n.state):null,z=Vr(e,A,n,!0);K&&(n.state=K),A.styles=z.styles;var Y=A.styleClasses,re=z.classes;re?A.styleClasses=re:Y&&(A.styleClasses=null);for(var oe=!F||F.length!=A.styles.length||Y!=re&&(!Y||!re||Y.bgClass!=re.bgClass||Y.textClass!=re.textClass),ge=0;!oe&&ge<F.length;++ge)oe=F[ge]!=A.styles[ge];oe&&i.push(n.line),A.stateAfter=n.save(),n.nextLine()}else A.text.length<=e.options.maxHighlightLength&&Xr(e,A.text,n),A.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return ci(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&_n(e,function(){for(var A=0;A<i.length;A++)Xn(e,i[A],"text")})}var Gi=function(e,t,r){var n=e.display;this.viewport=t,this.visible=Wi(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=lr(e),this.force=r,this.dims=ya(e),this.events=[]};Gi.prototype.signal=function(e,t){ie(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)ve.apply(null,this.events[e])};function sl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=kn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=kn(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=P();if(!t||!y(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&y(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}function ll(e){if(!e||!e.activeElt||e.activeElt==P())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&y(document.body,e.anchorNode)&&y(document.body,e.focusNode)){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}function Oa(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Yn(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&fs(e)==0)return!1;Os(e)&&(Yn(e),t.dims=ya(e));var i=n.first+n.size,A=Math.max(t.visible.from-e.options.viewportMargin,n.first),F=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<A&&A-r.viewFrom<20&&(A=Math.max(n.first,r.viewFrom)),r.viewTo>F&&r.viewTo-F<20&&(F=Math.min(i,r.viewTo)),on&&(A=qr(e.doc,A),F=Vn(e.doc,F));var K=A!=r.viewFrom||F!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vo(e,A,F),r.viewOffset=Ln(Ze(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var z=fs(e);if(!K&&z==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var Y=ol(e);return z>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),z>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(Y),b(r.cursorDiv),b(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,K&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ci(e,400)),r.updateLineNumbers=null,!0}function ws(e,t){for(var r=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==lr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+ca(e.display)-ha(e),r.top)}),t.visible=Wi(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=Wi(e.display,e.doc,r));if(!Oa(e,t))break;Hi(e);var i=ui(e);si(e),Pr(e,i),La(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 Ra(e,t){var r=new Gi(e,t);if(Oa(e,r)){Hi(e),ws(e,r);var n=ui(e);si(e),Pr(e,n),La(e,n),r.finish()}}function ul(e,t,r){var n=e.display,i=e.options.lineNumbers,A=n.lineDiv,F=A.firstChild;function K(xe){var Ie=xe.nextSibling;return D&&l&&e.display.currentWheelTarget==xe?xe.style.display="none":xe.parentNode.removeChild(xe),Ie}for(var z=n.view,Y=n.viewFrom,re=0;re<z.length;re++){var oe=z[re];if(!oe.hidden)if(!oe.node||oe.node.parentNode!=A){var ge=No(e,oe,Y,r);A.insertBefore(ge,F)}else{for(;F!=oe.node;)F=K(F);var me=i&&t!=null&&t<=Y&&oe.lineNumber;oe.changes&&(Z(oe.changes,"gutter")>-1&&(me=!1),Ya(e,oe,Y,r)),me&&(b(oe.lineNumber),oe.lineNumber.appendChild(document.createTextNode(_r(e.options,Y)))),F=oe.node.nextSibling}Y+=oe.size}for(;F;)F=K(F)}function Aa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function La(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+kn(e)+"px"}function Ss(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var n=ba(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,A=n+"px",F=0;F<r.length;F++)if(!r[F].hidden){e.options.fixedGutter&&(r[F].gutter&&(r[F].gutter.style.left=A),r[F].gutterBackground&&(r[F].gutterBackground.style.left=A));var K=r[F].alignable;if(K)for(var z=0;z<K.length;z++)K[z].style.left=A}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}function Os(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=_r(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(u("div",[u("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),A=i.firstChild.offsetWidth,F=i.offsetWidth-A;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(A,n.lineGutter.offsetWidth-F)+1,n.lineNumWidth=n.lineNumInnerWidth+F,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Aa(e.display),!0}return!1}function Ca(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var A=e[i],F=null;if(typeof A!="string"&&(F=A.style,A=A.className),A=="CodeMirror-linenumbers")if(t)n=!0;else continue;r.push({className:A,style:F})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function Rs(e){var t=e.gutters,r=e.gutterSpecs;b(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var i=r[n],A=i.className,F=i.style,K=t.appendChild(u("div",null,"CodeMirror-gutter "+A));F&&(K.style.cssText=F),A=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Aa(e)}function hi(e){Rs(e.display),fn(e),Ss(e)}function dl(e,t,r,n){var i=this;this.input=r,i.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=u("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=_("div",null,"CodeMirror-code"),i.selectionDiv=u("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=u("div",null,"CodeMirror-cursors"),i.measure=u("div",null,"CodeMirror-measure"),i.lineMeasure=u("div",null,"CodeMirror-measure"),i.lineSpace=_("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var A=_("div",[i.lineSpace],"CodeMirror-lines");i.mover=u("div",[A],null,"position: relative"),i.sizer=u("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=u("div",null,null,"position: absolute; height: "+ae+"px; width: 1px;"),i.gutters=u("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=u("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=u("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&U<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!D&&!(I&&s)&&(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=Ca(n.gutters,n.lineNumbers),Rs(i),r.init(i)}var zi=0,En=null;B?En=-.53:I?En=15:g?En=-.7:f&&(En=-1/3);function As(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),r==null&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:r==null&&(r=e.wheelDelta),{x:t,y:r}}function cl(e){var t=As(e);return t.x*=En,t.y*=En,t}function Ls(e,t){var r=As(t),n=r.x,i=r.y,A=e.display,F=A.scroller,K=F.scrollWidth>F.clientWidth,z=F.scrollHeight>F.clientHeight;if(!(n&&K||i&&z))return;if(i&&l&&D){e:for(var Y=t.target,re=A.view;Y!=F;Y=Y.parentNode)for(var oe=0;oe<re.length;oe++)if(re[oe].node==Y){e.display.currentWheelTarget=Y;break e}}if(n&&!I&&!p&&En!=null){i&&z&&li(e,Math.max(0,F.scrollTop+i*En)),hr(e,Math.max(0,F.scrollLeft+n*En)),(!i||i&&z)&&$(t),A.wheelStartX=null;return}if(i&&En!=null){var ge=i*En,me=e.doc.scrollTop,xe=me+A.wrapper.clientHeight;ge<0?me=Math.max(0,me+ge-50):xe=Math.min(e.doc.height,xe+ge+50),Ra(e,{top:me,bottom:xe})}zi<20&&(A.wheelStartX==null?(A.wheelStartX=F.scrollLeft,A.wheelStartY=F.scrollTop,A.wheelDX=n,A.wheelDY=i,setTimeout(function(){if(A.wheelStartX==null)return;var Ie=F.scrollLeft-A.wheelStartX,je=F.scrollTop-A.wheelStartY,Ye=je&&A.wheelDY&&je/A.wheelDY||Ie&&A.wheelDX&&Ie/A.wheelDX;if(A.wheelStartX=A.wheelStartY=null,!Ye)return;En=(En*zi+Ye)/(zi+1),++zi},200)):(A.wheelDX+=n,A.wheelDY+=i))}var Tn=function(e,t){this.ranges=e,this.primIndex=t};Tn.prototype.primary=function(){return this.ranges[this.primIndex]},Tn.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 r=this.ranges[t],n=e.ranges[t];if(!zr(r.anchor,n.anchor)||!zr(r.head,n.head))return!1}return!0},Tn.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Dt(yr(this.ranges[t].anchor),yr(this.ranges[t].head));return new Tn(e,this.primIndex)},Tn.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Tn.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(vt(t,n.from())>=0&&vt(e,n.to())<=0)return r}return-1};var Dt=function(e,t){this.anchor=e,this.head=t};Dt.prototype.from=function(){return nr(this.anchor,this.head)},Dt.prototype.to=function(){return br(this.anchor,this.head)},Dt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function In(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(ge,me){return vt(ge.from(),me.from())}),r=Z(t,i);for(var A=1;A<t.length;A++){var F=t[A],K=t[A-1],z=vt(K.to(),F.from());if(n&&!F.empty()?z>0:z>=0){var Y=nr(K.from(),F.from()),re=br(K.to(),F.to()),oe=K.empty()?F.from()==F.head:K.from()==K.head;A<=r&&--r,t.splice(--A,2,new Dt(oe?re:Y,oe?Y:re))}}return new Tn(t,r)}function $n(e,t){return new Tn([new Dt(e,t||e)],0)}function Jn(e){return e.text?Ne(e.from.line+e.text.length-1,Ee(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Cs(e,t){if(vt(e,t.from)<0)return e;if(vt(e,t.to)<=0)return Jn(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Jn(t).ch-t.to.ch),Ne(r,n)}function Ia(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new Dt(Cs(i.anchor,t),Cs(i.head,t)))}return In(e.cm,r,e.sel.primIndex)}function Is(e,t,r){return e.line==t.line?Ne(r.line,e.ch-t.ch+r.ch):Ne(r.line+(e.line-t.line),e.ch)}function hl(e,t,r){for(var n=[],i=Ne(e.first,0),A=i,F=0;F<t.length;F++){var K=t[F],z=Is(K.from,i,A),Y=Is(Jn(K),i,A);if(i=K.to,A=Y,r=="around"){var re=e.sel.ranges[F],oe=vt(re.head,re.anchor)<0;n[F]=new Dt(oe?Y:z,oe?z:Y)}else n[F]=new Dt(z,z)}return new Tn(n,e.sel.primIndex)}function Da(e){e.doc.mode=dt(e.options,e.doc.modeOption),fi(e)}function fi(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ci(e,100),e.state.modeGen++,e.curOp&&fn(e)}function Ds(e,t){return t.from.ch==0&&t.to.ch==0&&Ee(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,r,n){function i(tt){return r?r[tt]:null}function A(tt,$e,it){ua(tt,$e,it,n),en(tt,"change",tt,t)}function F(tt,$e){for(var it=[],pt=tt;pt<$e;++pt)it.push(new or(Y[pt],i(pt),n));return it}var K=t.from,z=t.to,Y=t.text,re=Ze(e,K.line),oe=Ze(e,z.line),ge=Ee(Y),me=i(Y.length-1),xe=z.line-K.line;if(t.full)e.insert(0,F(0,Y.length)),e.remove(Y.length,e.size-Y.length);else if(Ds(e,t)){var Ie=F(0,Y.length-1);A(oe,oe.text,me),xe&&e.remove(K.line,xe),Ie.length&&e.insert(K.line,Ie)}else if(re==oe)if(Y.length==1)A(re,re.text.slice(0,K.ch)+ge+re.text.slice(z.ch),me);else{var je=F(1,Y.length-1);je.push(new or(ge+re.text.slice(z.ch),me,n)),A(re,re.text.slice(0,K.ch)+Y[0],i(0)),e.insert(K.line+1,je)}else if(Y.length==1)A(re,re.text.slice(0,K.ch)+Y[0]+oe.text.slice(z.ch),i(0)),e.remove(K.line+1,xe);else{A(re,re.text.slice(0,K.ch)+Y[0],i(0)),A(oe,ge+oe.text.slice(z.ch),me);var Ye=F(1,Y.length-1);xe>1&&e.remove(K.line+1,xe-1),e.insert(K.line+1,Ye)}en(e,"change",e,t)}function Qn(e,t,r){function n(i,A,F){if(i.linked)for(var K=0;K<i.linked.length;++K){var z=i.linked[K];if(z.doc==A)continue;var Y=F&&z.sharedHist;if(r&&!Y)continue;t(z.doc,Y),n(z.doc,i,Y)}}n(e,null,!0)}function Ps(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),Da(e),Ms(e),e.options.lineWrapping||Ni(e),e.options.mode=t.modeOption,fn(e)}function Ms(e){(e.doc.direction=="rtl"?M:E)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){_n(e,function(){Ms(e),fn(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 Ma(e,t){var r={from:yr(t.from),to:Jn(t),text:Kt(e,t.from,t.to)};return Us(e,r,t.from.line,t.to.line+1),Qn(e,function(n){return Us(n,r,t.from.line,t.to.line+1)},!0),r}function ks(e){for(;e.length;){var t=Ee(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return ks(e.done),Ee(e.done);if(e.done.length&&!Ee(e.done).ranges)return Ee(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Ee(e.done)}function Ns(e,t,r,n){var i=e.history;i.undone.length=0;var A=+new Date,F,K;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>A-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(F=pl(i,i.lastOp==n)))K=Ee(F.changes),vt(t.from,t.to)==0&&vt(t.from,K.to)==0?K.to=Jn(t):F.changes.push(Ma(e,t));else{var z=Ee(i.done);for((!z||!z.ranges)&&Xi(e.sel,i.done),F={changes:[Ma(e,t)],generation:i.generation},i.done.push(F);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=A,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,K||ve(e,"historyAdded")}function ml(e,t,r,n){var i=t.charAt(0);return i=="*"||i=="+"&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,n){var i=e.history,A=n&&n.origin;r==i.lastSelOp||A&&i.lastSelOrigin==A&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==A||ml(e,A,Ee(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=A,i.lastSelOp=r,n&&n.clearRedo!==!1&&ks(i.undone)}function Xi(e,t){var r=Ee(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Us(e,t,r,n){var i=t["spans_"+e.id],A=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(F){F.markedSpans&&((i||(i=t["spans_"+e.id]={}))[A]=F.markedSpans),++A})}function vl(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function _l(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(vl(r[i]));return n}function Fs(e,t){var r=_l(e,t),n=xr(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var A=r[i],F=n[i];if(A&&F){e:for(var K=0;K<F.length;++K){for(var z=F[K],Y=0;Y<A.length;++Y)if(A[Y].marker==z.marker)continue e;A.push(z)}}else F&&(r[i]=F)}return r}function Mr(e,t,r){for(var n=[],i=0;i<e.length;++i){var A=e[i];if(A.ranges){n.push(r?Tn.prototype.deepCopy.call(A):A);continue}var F=A.changes,K=[];n.push({changes:K});for(var z=0;z<F.length;++z){var Y=F[z],re=void 0;if(K.push({from:Y.from,to:Y.to,text:Y.text}),t)for(var oe in Y)(re=oe.match(/^spans_(\d+)$/))&&(Z(t,Number(re[1]))>-1&&(Ee(K)[oe]=Y[oe],delete Y[oe]))}}return n}function ka(e,t,r,n){if(n){var i=e.anchor;if(r){var A=vt(t,i)<0;A!=vt(r,i)<0?(i=t,t=r):A!=vt(t,r)<0&&(t=r)}return new Dt(i,t)}else return new Dt(r||t,t)}function Yi(e,t,r,n,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),an(e,new Tn([ka(e.sel.primary(),t,r,i)],0),n)}function Bs(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),A=0;A<e.sel.ranges.length;A++)n[A]=ka(e.sel.ranges[A],t[A],null,i);var F=In(e.cm,n,e.sel.primIndex);an(e,F,r)}function Na(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,an(e,In(e.cm,i,e.sel.primIndex),n)}function js(e,t,r,n){an(e,$n(t,r),n)}function yl(e,t,r){var n={ranges:t.ranges,update:function(i){this.ranges=[];for(var A=0;A<i.length;A++)this.ranges[A]=new Dt(yt(e,i[A].anchor),yt(e,i[A].head))},origin:r&&r.origin};return ve(e,"beforeSelectionChange",e,n),e.cm&&ve(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?In(e.cm,n.ranges,n.ranges.length-1):t}function Hs(e,t,r){var n=e.history.done,i=Ee(n);i&&i.ranges?(n[n.length-1]=t,$i(e,t,r)):an(e,t,r)}function an(e,t,r){$i(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function $i(e,t,r){(ie(e,"beforeSelectionChange")||e.cm&&ie(e.cm,"beforeSelectionChange"))&&(t=yl(e,t,r));var n=r&&r.bias||(vt(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,Gs(e,t,n,!0)),!(r&&r.scroll===!1)&&e.cm&&Dr(e.cm)}function Ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ue(e.cm)),en(e,"cursorActivity",e)}function Ks(e){Ws(e,Gs(e,e.sel,null,!1))}function Gs(e,t,r,n){for(var i,A=0;A<t.ranges.length;A++){var F=t.ranges[A],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[A],z=Ji(e,F.anchor,K&&K.anchor,r,n),Y=Ji(e,F.head,K&&K.head,r,n);(i||z!=F.anchor||Y!=F.head)&&(i||(i=t.ranges.slice(0,A)),i[A]=new Dt(z,Y))}return i?In(e.cm,i,t.primIndex):t}function kr(e,t,r,n,i){var A=Ze(e,t.line);if(A.markedSpans)for(var F=0;F<A.markedSpans.length;++F){var K=A.markedSpans[F],z=K.marker,Y="selectLeft"in z?!z.selectLeft:z.inclusiveLeft,re="selectRight"in z?!z.selectRight:z.inclusiveRight;if((K.from==null||(Y?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(re?K.to>=t.ch:K.to>t.ch))){if(i&&(ve(z,"beforeCursorEnter"),z.explicitlyCleared))if(A.markedSpans){--F;continue}else break;if(!z.atomic)continue;if(r){var oe=z.find(n<0?1:-1),ge=void 0;if((n<0?re:Y)&&(oe=zs(e,oe,-n,oe&&oe.line==t.line?A:null)),oe&&oe.line==t.line&&(ge=vt(oe,r))&&(n<0?ge<0:ge>0))return kr(e,oe,t,n,i)}var me=z.find(n<0?-1:1);return(n<0?Y:re)&&(me=zs(e,me,n,me.line==t.line?A:null)),me?kr(e,me,t,n,i):null}}return t}function Ji(e,t,r,n,i){var A=n||1,F=kr(e,t,r,A,i)||!i&&kr(e,t,r,A,!0)||kr(e,t,r,-A,i)||!i&&kr(e,t,r,-A,!0);return F||(e.cantEdit=!0,Ne(e.first,0))}function zs(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?yt(e,Ne(t.line-1)):null:r>0&&t.ch==(n||Ze(e,t.line)).text.length?t.line<e.first+e.size-1?Ne(t.line+1,0):null:new Ne(t.line,t.ch+r)}function Vs(e){e.setSelection(Ne(e.firstLine(),0),Ne(e.lastLine()),ce)}function Xs(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(i,A,F,K){i&&(n.from=yt(e,i)),A&&(n.to=yt(e,A)),F&&(n.text=F),K!==void 0&&(n.origin=K)}),ve(e,"beforeChange",e,n),e.cm&&ve(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Nr(e,t,r){if(e.cm){if(!e.cm.curOp)return Jt(e.cm,Nr)(e,t,r);if(e.cm.state.suppressEdits)return}if((ie(e,"beforeChange")||e.cm&&ie(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var n=Qr&&!r&&Pi(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Ys(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else Ys(e,t)}function Ys(e,t){if(t.text.length==1&&t.text[0]==""&&vt(t.from,t.to)==0)return;var r=Ia(e,t);Ns(e,t,r,e.cm?e.cm.curOp.id:NaN),pi(e,t,r,xr(e,t));var n=[];Qn(e,function(i,A){!A&&Z(n,i.history)==-1&&(Zs(i.history,t),n.push(i.history)),pi(i,t,null,xr(i,t))})}function Qi(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var i=e.history,A,F=e.sel,K=t=="undo"?i.done:i.undone,z=t=="undo"?i.undone:i.done,Y=0;Y<K.length&&!(A=K[Y],r?A.ranges&&!A.equals(e.sel):!A.ranges);Y++);if(Y==K.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(A=K.pop(),A.ranges){if(Xi(A,z),r&&!A.equals(e.sel)){an(e,A,{clearRedo:!1});return}F=A}else if(n){K.push(A);return}else break;var re=[];Xi(F,z),z.push({changes:re,generation:i.generation}),i.generation=A.generation||++i.maxGeneration;for(var oe=ie(e,"beforeChange")||e.cm&&ie(e.cm,"beforeChange"),ge=function(Ie){var je=A.changes[Ie];if(je.origin=t,oe&&!Xs(e,je,!1))return K.length=0,{};re.push(Ma(e,je));var Ye=Ie?Ia(e,je):Ee(K);pi(e,je,Ye,Fs(e,je)),!Ie&&e.cm&&e.cm.scrollIntoView({from:je.from,to:Jn(je)});var tt=[];Qn(e,function($e,it){!it&&Z(tt,$e.history)==-1&&(Zs($e.history,je),tt.push($e.history)),pi($e,je,null,Fs($e,je))})},me=A.changes.length-1;me>=0;--me){var xe=ge(me);if(xe)return xe.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new Tn(Pe(e.sel.ranges,function(i){return new Dt(Ne(i.anchor.line+t,i.anchor.ch),Ne(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){fn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Xn(e.cm,n,"gutter")}}function pi(e,t,r,n){if(e.cm&&!e.cm.curOp)return Jt(e.cm,pi)(e,t,r,n);if(t.to.line<e.first){$s(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);$s(e,i),t={from:Ne(e.first,0),to:Ne(t.to.line+i,t.to.ch),text:[Ee(t.text)],origin:t.origin}}var A=e.lastLine();t.to.line>A&&(t={from:t.from,to:Ne(A,Ze(e,A).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Kt(e,t.from,t.to),r||(r=Ia(e,t)),e.cm?bl(e.cm,t,n):Pa(e,t,n),$i(e,r,ce),e.cantEdit&&Ji(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,r){var n=e.doc,i=e.display,A=t.from,F=t.to,K=!1,z=A.line;e.options.lineWrapping||(z=Tt(bn(Ze(n,A.line))),n.iter(z,F.line+1,function(me){if(me==i.maxLine)return K=!0,!0})),n.sel.contains(t.from,t.to)>-1&&ue(e),Pa(n,t,r,hs(e)),e.options.lineWrapping||(n.iter(z,A.line+t.text.length,function(me){var xe=ti(me);xe>i.maxLineLength&&(i.maxLine=me,i.maxLineLength=xe,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),aa(n,A.line),ci(e,400);var Y=t.text.length-(F.line-A.line)-1;t.full?fn(e):A.line==F.line&&t.text.length==1&&!Ds(e.doc,t)?Xn(e,A.line,"text"):fn(e,A.line,F.line+1,Y);var re=ie(e,"changes"),oe=ie(e,"change");if(oe||re){var ge={from:A,to:F,text:t.text,removed:t.removed,origin:t.origin};oe&&en(e,"change",e,ge),re&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ge)}e.display.selForContextMenu=null}function Ur(e,t,r,n,i){var A;n||(n=r),vt(n,r)<0&&(A=[n,r],r=A[0],n=A[1]),typeof t=="string"&&(t=e.splitLines(t)),Nr(e,{from:r,to:n,text:t,origin:i})}function Js(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Qs(e,t,r,n){for(var i=0;i<e.length;++i){var A=e[i],F=!0;if(A.ranges){A.copied||(A=e[i]=A.deepCopy(),A.copied=!0);for(var K=0;K<A.ranges.length;K++)Js(A.ranges[K].anchor,t,r,n),Js(A.ranges[K].head,t,r,n);continue}for(var z=0;z<A.changes.length;++z){var Y=A.changes[z];if(r<Y.from.line)Y.from=Ne(Y.from.line+n,Y.from.ch),Y.to=Ne(Y.to.line+n,Y.to.ch);else if(t<=Y.to.line){F=!1;break}}F||(e.splice(0,i+1),i=0)}}function Zs(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;Qs(e.done,r,n,i),Qs(e.undone,r,n,i)}function mi(e,t,r,n){var i=t,A=t;return typeof t=="number"?A=Ze(e,Er(e,t)):i=Tt(t),i==null?null:(n(A,i)&&e.cm&&Xn(e.cm,i,r),A)}function gi(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}gi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,at(i),en(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}};function vi(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}vi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var A=Math.min(t,i-e),F=n.height;if(n.removeInner(e,A),this.height-=F-n.height,i==A&&(this.children.splice(r--,1),n.parent=null),(t-=A)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof gi))){var K=[];this.collapse(K),this.children=[new gi(K)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],A=i.chunkSize();if(e<=A){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var F=i.lines.length%25+25,K=F;K<i.lines.length;){var z=new gi(i.lines.slice(K,K+=25));i.height-=z.height,this.children.splice(++n,0,z),z.parent=this}i.lines=i.lines.slice(0,F),this.maybeSpill()}break}e-=A}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new vi(t);if(e.parent){e.size-=r.size,e.height-=r.height;var i=Z(e.parent.children,e);e.parent.children.splice(i+1,0,r)}else{var n=new vi(e.children);n.parent=e,e.children=[n,r],e=n}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],A=i.chunkSize();if(e<A){var F=Math.min(t,A-e);if(i.iterN(e,F,r))return!0;if((t-=F)==0)break;e=0}else e-=A}}};var _i=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};_i.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=Tt(r);if(n==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var A=ii(this);Ot(r,Math.max(0,r.height-A)),e&&(_n(e,function(){qs(e,r,-A),Xn(e,n,"widget")}),en(e,"lineWidgetCleared",e,this,n))},_i.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=ii(this)-t;if(!i)return;Mn(this.doc,n)||Ot(n,n.height+i),r&&_n(r,function(){r.curOp.forceUpdate=!0,qs(r,n,i),en(r,"lineWidgetChanged",r,e,Tt(n))})},te(_i);function qs(e,t,r){Ln(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,r)}function El(e,t,r,n){var i=new _i(e,r,n),A=e.cm;return A&&i.noHScroll&&(A.display.alignWidgets=!0),mi(e,t,"widget",function(F){var K=F.widgets||(F.widgets=[]);if(i.insertAt==null?K.push(i):K.splice(Math.min(K.length-1,Math.max(0,i.insertAt)),0,i),i.line=F,A&&!Mn(e,F)){var z=Ln(F)<e.scrollTop;Ot(F,F.height+ii(i)),z&&Sa(A,i.height),A.curOp.forceUpdate=!0}return!0}),A&&en(A,"lineWidgetAdded",A,i,typeof t=="number"?t:Tt(t)),i}var eo=0,Zn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Zn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&pr(e),ie(this,"clear")){var r=this.find();r&&en(this,"clear",r.from,r.to)}for(var n=null,i=null,A=0;A<this.lines.length;++A){var F=this.lines[A],K=An(F.markedSpans,this);e&&!this.collapsed?Xn(e,Tt(F),"text"):e&&(K.to!=null&&(i=Tt(F)),K.from!=null&&(n=Tt(F))),F.markedSpans=Zr(F.markedSpans,K),K.from==null&&this.collapsed&&!Mn(this.doc,F)&&e&&Ot(F,Lr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var z=0;z<this.lines.length;++z){var Y=bn(this.lines[z]),re=ti(Y);re>e.display.maxLineLength&&(e.display.maxLine=Y,e.display.maxLineLength=re,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&fn(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ks(e.doc)),e&&en(e,"markerCleared",e,this,n,i),t&&mr(e),this.parent&&this.parent.clear()},Zn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var A=this.lines[i],F=An(A.markedSpans,this);if(F.from!=null&&(r=Ne(t?A:Tt(A),F.from),e==-1))return r;if(F.to!=null&&(n=Ne(t?A:Tt(A),F.to),e==1))return n}return r&&{from:r,to:n}},Zn.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;if(!t||!n)return;_n(n,function(){var i=t.line,A=Tt(t.line),F=fa(n,A);if(F&&(is(F),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Mn(r.doc,i)&&r.height!=null){var K=r.height;r.height=null;var z=ii(r)-K;z&&Ot(i,i.height+z)}en(n,"markerChanged",n,e)})},Zn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||Z(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Zn.prototype.detachLine=function(e){if(this.lines.splice(Z(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},te(Zn);function Fr(e,t,r,n,i){if(n&&n.shared)return Tl(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Jt(e.cm,Fr)(e,t,r,n,i);var A=new Zn(e,i),F=vt(t,r);if(n&&w(n,A,!1),F>0||F==0&&A.clearWhenEmpty!==!1)return A;if(A.replacedWith&&(A.collapsed=!0,A.widgetNode=_("span",[A.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||A.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(A.widgetNode.insertLeft=!0)),A.collapsed){if(Mi(e,t.line,t,r,A)||t.line!=r.line&&Mi(e,r.line,t,r,A))throw new Error("Inserting collapsed marker partially overlapping an existing one");sa()}A.addToHistory&&Ns(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var K=t.line,z=e.cm,Y;if(e.iter(K,r.line+1,function(oe){z&&A.collapsed&&!z.options.lineWrapping&&bn(oe)==z.display.maxLine&&(Y=!0),A.collapsed&&K!=t.line&&Ot(oe,0),oa(oe,new ir(A,K==t.line?t.ch:null,K==r.line?r.ch:null)),++K}),A.collapsed&&e.iter(t.line,r.line+1,function(oe){Mn(e,oe)&&Ot(oe,0)}),A.clearOnEnter&&be(A,"beforeCursorEnter",function(){return A.clear()}),A.readOnly&&(zn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),A.collapsed&&(A.id=++eo,A.atomic=!0),z){if(Y&&(z.curOp.updateMaxLine=!0),A.collapsed)fn(z,t.line,r.line+1);else if(A.className||A.startStyle||A.endStyle||A.css||A.attributes||A.title)for(var re=t.line;re<=r.line;re++)Xn(z,re,"text");A.atomic&&Ks(z.doc),en(z,"markerAdded",z,A)}return A}var yi=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};yi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();en(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},te(yi);function Tl(e,t,r,n,i){n=w(n),n.shared=!1;var A=[Fr(e,t,r,n,i)],F=A[0],K=n.widgetNode;return Qn(e,function(z){K&&(n.widgetNode=K.cloneNode(!0)),A.push(Fr(z,yt(z,t),yt(z,r),n,i));for(var Y=0;Y<z.linked.length;++Y)if(z.linked[Y].isParent)return;F=Ee(A)}),new yi(A,F)}function to(e){return e.findMarks(Ne(e.first,0),e.clipPos(Ne(e.lastLine())),function(t){return t.parent})}function xl(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),A=e.clipPos(i.from),F=e.clipPos(i.to);if(vt(A,F)){var K=Fr(e,A,F,n.primary,n.primary.type);n.markers.push(K),K.parent=n}}}function wl(e){for(var t=function(n){var i=e[n],A=[i.primary.doc];Qn(i.primary.doc,function(z){return A.push(z)});for(var F=0;F<i.markers.length;F++){var K=i.markers[F];Z(A,K.doc)==-1&&(K.parent=null,i.markers.splice(F--,1))}},r=0;r<e.length;r++)t(r)}var Sl=0,pn=function(e,t,r,n,i){if(!(this instanceof pn))return new pn(e,t,r,n,i);r==null&&(r=0),vi.call(this,[new gi([new or("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var A=Ne(r,0);this.sel=$n(A),this.history=new Vi(null),this.id=++Sl,this.modeOption=t,this.lineSep=n,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Pa(this,{from:A,to:A,text:e}),an(this,$n(A),ce)};pn.prototype=qe(vi.prototype,{constructor:pn,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Pt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Qt(function(e){var t=Ne(this.first,0),r=this.first+this.size-1;Nr(this,{from:t,to:Ne(r,Ze(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),an(this,$n(t),ce)}),replaceRange:function(e,t,r,n){t=yt(this,t),r=r?yt(this,r):t,Ur(this,e,t,r,n)},getRange:function(e,t,r){var n=Kt(this,yt(this,e),yt(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(dn(this,e))return Ze(this,e)},getLineNumber:function(e){return Tt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Ze(this,e)),bn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return yt(this,e)},getCursor:function(e){var t=this.sel.primary(),r;return e==null||e=="head"?r=t.head:e=="anchor"?r=t.anchor:e=="end"||e=="to"||e===!1?r=t.to():r=t.from(),r},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Qt(function(e,t,r){js(this,yt(this,typeof e=="number"?Ne(e,t||0):e),null,r)}),setSelection:Qt(function(e,t,r){js(this,yt(this,e),yt(this,t||e),r)}),extendSelection:Qt(function(e,t,r){Yi(this,yt(this,e),t&&yt(this,t),r)}),extendSelections:Qt(function(e,t){Bs(this,Be(this,e),t)}),extendSelectionsBy:Qt(function(e,t){var r=Pe(this.sel.ranges,e);Bs(this,Be(this,r),t)}),setSelections:Qt(function(e,t,r){if(!e.length)return;for(var n=[],i=0;i<e.length;i++)n[i]=new Dt(yt(this,e[i].anchor),yt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),an(this,In(this.cm,n,t),r)}),addSelection:Qt(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Dt(yt(this,e),yt(this,t||e))),an(this,In(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,n=0;n<t.length;n++){var i=Kt(this,t[n].from(),t[n].to());r=r?r.concat(i):i}return e===!1?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=Kt(this,r[n].from(),r[n].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Qt(function(e,t,r){for(var n=[],i=this.sel,A=0;A<i.ranges.length;A++){var F=i.ranges[A];n[A]={from:F.from(),to:F.to(),text:this.splitLines(e[A]),origin:r}}for(var K=t&&t!="end"&&hl(this,n,t),z=n.length-1;z>=0;z--)Nr(this,n[z]);K?Hs(this,K):this.cm&&Dr(this.cm)}),undo:Qt(function(){Qi(this,"undo")}),redo:Qt(function(){Qi(this,"redo")}),undoSelection:Qt(function(){Qi(this,"undo",!0)}),redoSelection:Qt(function(){Qi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Vi(this.history.maxGeneration),Qn(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:Mr(this.history.done),undone:Mr(this.history.undone)}},setHistory:function(e){var t=this.history=new Vi(this.history.maxGeneration);t.done=Mr(e.done.slice(0),null,!0),t.undone=Mr(e.undone.slice(0),null,!0)},setGutterMarker:Qt(function(e,t,r){return mi(this,e,"gutter",function(n){var i=n.gutterMarkers||(n.gutterMarkers={});return i[t]=r,!r&&Xe(i)&&(n.gutterMarkers=null),!0})}),clearGutter:Qt(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&mi(t,r,"gutter",function(){return r.gutterMarkers[e]=null,Xe(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!dn(this,e))return null;if(t=e,e=Ze(this,e),!e)return null}else if(t=Tt(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:Qt(function(e,t,r){return mi(this,e,t=="gutter"?"gutter":"class",function(n){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!n[i])n[i]=r;else{if(S(r).test(n[i]))return!1;n[i]+=" "+r}return!0})}),removeLineClass:Qt(function(e,t,r){return mi(this,e,t=="gutter"?"gutter":"class",function(n){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",A=n[i];if(A)if(r==null)n[i]=null;else{var F=A.match(S(r));if(!F)return!1;var K=F.index+F[0].length;n[i]=A.slice(0,F.index)+(!F.index||K==A.length?"":" ")+A.slice(K)||null}else return!1;return!0})}),addLineWidget:Qt(function(e,t,r){return El(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Fr(this,yt(this,e),yt(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=yt(this,e),Fr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=yt(this,e);var t=[],r=Ze(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(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,r){e=yt(this,e),t=yt(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(A){var F=A.markedSpans;if(F)for(var K=0;K<F.length;K++){var z=F[K];!(z.to!=null&&i==e.line&&e.ch>=z.to||z.from==null&&i!=e.line||z.from!=null&&i==t.line&&z.from>=t.ch)&&(!r||r(z.marker))&&n.push(z.marker.parent||z.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)r[n].from!=null&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(i){var A=i.text.length+n;if(A>e)return t=e,!0;e-=A,++r}),yt(this,Ne(r,t))},indexFromPos:function(e){e=yt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(n){t+=n.text.length+r}),t},copy:function(e){var t=new pn(Pt(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,r=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<r&&(r=e.to);var n=new pn(Pt(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],xl(n,to(this)),n},unlinkDoc:function(e){if(e instanceof Bt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var r=this.linked[t];if(r.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(to(this));break}if(e.history==this.history){var n=[e.id];Qn(e,function(i){return n.push(i.id)},!0),e.history=new Vi(null),e.history.done=Mr(this.history.done,n),e.history.undone=Mr(this.history.undone,n)}},iterLinkedDocs:function(e){Qn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ht(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Qt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),pn.prototype.eachLine=pn.prototype.iter;var no=0;function Ol(e){var t=this;if(ro(t),Re(t,e)||Wn(t.display,e))return;$(e),B&&(no=+new Date);var r=dr(t,e,!0),n=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,A=Array(i),F=0,K=function(){++F==i&&Jt(t,function(){r=yt(t.doc,r);var me={from:r,to:r,text:t.doc.splitLines(A.filter(function(xe){return xe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Nr(t.doc,me),Hs(t.doc,$n(yt(t.doc,r),yt(t.doc,Jn(me))))})()},z=function(me,xe){if(t.options.allowDropFileTypes&&Z(t.options.allowDropFileTypes,me.type)==-1){K();return}var Ie=new FileReader;Ie.onerror=function(){return K()},Ie.onload=function(){var je=Ie.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(je)){K();return}A[xe]=je,K()},Ie.readAsText(me)},Y=0;Y<n.length;Y++)z(n[Y],Y);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var re=e.dataTransfer.getData("Text");if(re){var oe;if(t.state.draggingText&&!t.state.draggingText.copy&&(oe=t.listSelections()),$i(t.doc,$n(r,r)),oe)for(var ge=0;ge<oe.length;++ge)Ur(t.doc,"",oe[ge].anchor,oe[ge].head,"drag");t.replaceSelection(re,"around","paste"),t.display.input.focus()}}catch(me){}}}function Rl(e,t){if(B&&(!e.state.draggingText||+new Date-no<100)){ne(t);return}if(Re(e,t)||Wn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f){var r=u("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),p&&r.parentNode.removeChild(r)}}function Al(e,t){var r=dr(e,t);if(!r)return;var n=document.createDocumentFragment();ms(e,r,n),e.display.dragCursor||(e.display.dragCursor=u("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),v(e.display.dragCursor,n)}function ro(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function io(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var i=t[n].CodeMirror;i&&r.push(i)}r.length&&r[0].operation(function(){for(var A=0;A<r.length;A++)e(r[A])})}var ao=!1;function Ll(){if(ao)return;Cl(),ao=!0}function Cl(){var e;be(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,io(Il)},100))}),be(window,"blur",function(){return io(Ir)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var qn={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},bi=0;bi<10;bi++)qn[bi+48]=qn[bi+96]=String(bi);for(var Zi=65;Zi<=90;Zi++)qn[Zi]=String.fromCharCode(Zi);for(var Ei=1;Ei<=12;Ei++)qn[Ei+111]=qn[Ei+63235]="F"+Ei;var Kn={};Kn.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"},Kn.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"},Kn.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"},Kn.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"]},Kn.default=l?Kn.macDefault:Kn.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,i,A,F=0;F<t.length-1;F++){var K=t[F];if(/^(cmd|meta|m)$/i.test(K))A=!0;else if(/^a(lt)?$/i.test(K))r=!0;else if(/^(c|ctrl|control)$/i.test(K))n=!0;else if(/^s(hift)?$/i.test(K))i=!0;else throw new Error("Unrecognized modifier name: "+K)}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),A&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Pl(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(n=="..."){delete e[r];continue}for(var i=Pe(r.split(" "),Dl),A=0;A<i.length;A++){var F=void 0,K=void 0;A==i.length-1?(K=i.join(" "),F=n):(K=i.slice(0,A+1).join(" "),F="...");var z=t[K];if(!z)t[K]=F;else if(z!=F)throw new Error("Inconsistent bindings for "+K)}delete e[r]}for(var Y in t)e[Y]=t[Y];return e}function Br(e,t,r,n){t=qi(t);var i=t.call?t.call(e,n):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&r(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Br(e,t.fallthrough,r,n);for(var A=0;A<t.fallthrough.length;A++){var F=Br(e,t.fallthrough[A],r,n);if(F)return F}}}function so(e){var t=typeof e=="string"?e:qn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,r){var n=e;return t.altKey&&n!="Alt"&&(e="Alt-"+e),(T?t.metaKey:t.ctrlKey)&&n!="Ctrl"&&(e="Ctrl-"+e),(T?t.ctrlKey:t.metaKey)&&n!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&n!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(p&&e.keyCode==34&&e.char)return!1;var r=qn[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),oo(r,e,t))}function qi(e){return typeof e=="string"?Kn[e]:e}function jr(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var A=t(r[i]);n.length&&vt(A.from,Ee(n).to)<=0;){var F=n.pop();if(vt(F.from,A.from)<0){A.from=F.from;break}}n.push(A)}_n(e,function(){for(var K=n.length-1;K>=0;K--)Ur(e.doc,"",n[K].from,n[K].to,"+delete");Dr(e)})}function Ua(e,t,r){var n=Oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Fa(e,t,r){var n=Ua(e,t.ch,r);return n==null?null:new Ne(t.line,n,r<0?"after":"before")}function Ba(e,t,r,n,i){if(e){t.doc.direction=="rtl"&&(i=-i);var A=Fe(r,t.doc.direction);if(A){var F=i<0?Ee(A):A[0],K=i<0==(F.level==1),z=K?"after":"before",Y;if(F.level>0||t.doc.direction=="rtl"){var re=Ar(t,r);Y=i<0?r.text.length-1:0;var oe=Nn(t,re,Y).top;Y=et(function(ge){return Nn(t,re,ge).top==oe},i<0==(F.level==1)?F.from:F.to-1,Y),z=="before"&&(Y=Ua(r,Y,1))}else Y=i<0?F.to:F.from;return new Ne(n,Y,z)}}return new Ne(n,i<0?r.text.length:0,i<0?"before":"after")}function Ml(e,t,r,n){var i=Fe(t,e.doc.direction);if(!i)return Fa(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var A=Ue(i,r.ch,r.sticky),F=i[A];if(e.doc.direction=="ltr"&&F.level%2==0&&(n>0?F.to>r.ch:F.from<r.ch))return Fa(t,r,n);var K=function(Ye,tt){return Ua(t,Ye instanceof Ne?Ye.ch:Ye,tt)},z,Y=function(Ye){return e.options.lineWrapping?(z=z||Ar(e,t),cs(e,t,z,Ye)):{begin:0,end:t.text.length}},re=Y(r.sticky=="before"?K(r,-1):r.ch);if(e.doc.direction=="rtl"||F.level==1){var oe=F.level==1==n<0,ge=K(r,oe?1:-1);if(ge!=null&&(oe?ge<=F.to&&ge<=re.end:ge>=F.from&&ge>=re.begin)){var me=oe?"before":"after";return new Ne(r.line,ge,me)}}var xe=function(Ye,tt,$e){for(var it=function(Ft,Zt){return Zt?new Ne(r.line,K(Ft,1),"before"):new Ne(r.line,Ft,"after")};Ye>=0&&Ye<i.length;Ye+=tt){var pt=i[Ye],ut=tt>0==(pt.level!=1),Et=ut?$e.begin:K($e.end,-1);if(pt.from<=Et&&Et<pt.to)return it(Et,ut);if(Et=ut?pt.from:K(pt.to,-1),$e.begin<=Et&&Et<$e.end)return it(Et,ut)}},Ie=xe(A+n,n,re);if(Ie)return Ie;var je=n>0?re.end:K(re.begin,-1);return je!=null&&!(n>0&&je==t.text.length)&&(Ie=xe(n>0?0:i.length-1,n,Y(je)),Ie)?Ie:null}var Ti={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ce)},killLine:function(e){return jr(e,function(t){if(t.empty()){var r=Ze(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Ne(t.head.line+1,0)}:{from:t.head,to:Ne(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return jr(e,function(t){return{from:Ne(t.from().line,0),to:yt(e.doc,Ne(t.to().line+1,0))}})},delLineLeft:function(e){return jr(e,function(t){return{from:Ne(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return jr(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){return jr(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ne(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ne(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return co(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return kl(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},fe)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},fe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?co(e,t.head):n},fe)},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=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var A=r[i].from(),F=G(e.getLine(A.line),A.ch,n);t.push(de(n-F%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return _n(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var i=t[n].head,A=Ze(e.doc,i.line).text;if(A){if(i.ch==A.length&&(i=new Ne(i.line,i.ch-1)),i.ch>0)i=new Ne(i.line,i.ch+1),e.replaceRange(A.charAt(i.ch-1)+A.charAt(i.ch-2),Ne(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var F=Ze(e.doc,i.line-1).text;F&&(i=new Ne(i.line,1),e.replaceRange(A.charAt(0)+e.doc.lineSeparator()+F.charAt(F.length-1),Ne(i.line-1,F.length-1),i,"+transpose"))}}r.push(new Dt(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return _n(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);Dr(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var r=Ze(e.doc,t),n=bn(r);return n!=r&&(t=Tt(n)),Ba(!0,e,n,t,1)}function kl(e,t){var r=Ze(e.doc,t),n=ki(r);return n!=r&&(t=Tt(n)),Ba(!0,e,r,t,-1)}function co(e,t){var r=uo(e,t.line),n=Ze(e.doc,r.line),i=Fe(n,e.doc.direction);if(!i||i[0].level==0){var A=Math.max(r.ch,n.text.search(/\S/)),F=t.line==r.line&&t.ch<=A&&t.ch;return Ne(r.line,F?0:A,r.sticky)}return r}function ea(e,t,r){if(typeof t=="string"&&(t=Ti[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=_e}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function Nl(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Br(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Br(t,e.options.extraKeys,r,e)||Br(t,e.options.keyMap,r,e)}var Ul=new J;function xi(e,t,r,n){var i=e.state.keySeq;if(i){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ho(e,i+" "+t,r,n))return!0}return ho(e,t,r,n)}function ho(e,t,r,n){var i=Nl(e,t,n);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&en(e,"keyHandled",e,t,r),(i=="handled"||i=="multi")&&($(r),Ta(e)),!!i}function fo(e,t){var r=lo(t,!0);return r?t.shiftKey&&!e.state.keySeq?xi(e,"Shift-"+r,t,function(n){return ea(e,n,!0)})||xi(e,r,t,function(n){if(typeof n=="string"?/^go[A-Z]/.test(n):n.motion)return ea(e,n)}):xi(e,r,t,function(n){return ea(e,n)}):!1}function Fl(e,t,r){return xi(e,"'"+r+"'",t,function(n){return ea(e,n,!0)})}var ja=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=P(),Re(t,e))return;B&&U<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var n=fo(t,e);p&&(ja=n?r:null,!n&&r==88&&!mt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),I&&!l&&!n&&r==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),r==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;M(t,"CodeMirror-crosshair");function r(n){(n.keyCode==18||!n.altKey)&&(E(t,"CodeMirror-crosshair"),He(document,"keyup",r),He(document,"mouseover",r))}be(document,"keyup",r),be(document,"mouseover",r)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),Re(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Wn(t.display,e)||Re(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var r=e.keyCode,n=e.charCode;if(p&&r==ja){ja=null,$(e);return}if(p&&(!e.which||e.which<10)&&fo(t,e))return;var i=String.fromCharCode(n==null?r:n);if(i=="\b")return;if(Fl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,r){this.time=e,this.pos=t,this.button=r};Ha.prototype.compare=function(e,t,r){return this.time+jl>e&&vt(t,this.pos)==0&&r==this.button};var wi,Si;function Hl(e,t){var r=+new Date;return Si&&Si.compare(r,e,t)?(wi=Si=null,"triple"):wi&&wi.compare(r,e,t)?(Si=new Ha(r,e,t),wi=null,"double"):(wi=new Ha(r,e,t),Si=null,"single")}function vo(e){var t=this,r=t.display;if(Re(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,Wn(r,e)){D||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Wa(t,e))return;var n=dr(t,e),i=ye(e),A=n?Hl(n,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),n&&Wl(t,i,n,A,e))return;i==1?n?Gl(t,n,A,e):le(e)==r.scroller&&$(e):i==2?(n&&Yi(t.doc,n),setTimeout(function(){return r.input.focus()},20)):i==3&&(O?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,r,n,i){var A="Click";return n=="double"?A="Double"+A:n=="triple"&&(A="Triple"+A),A=(t==1?"Left":t==2?"Middle":"Right")+A,xi(e,oo(A,i),i,function(F){if(typeof F=="string"&&(F=Ti[F]),!F)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=F(e,r)!=_e}finally{e.state.suppressEdits=!1}return K})}function Kl(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(i.unit==null){var A=h?r.shiftKey&&r.metaKey:r.altKey;i.unit=A?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey),i.addNew==null&&(i.addNew=l?r.metaKey:r.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(l?r.altKey:r.ctrlKey)),i}function Gl(e,t,r,n){B?setTimeout(N(gs,e),0):e.curOp.focus=P();var i=Kl(e,r,n),A=e.doc.sel,F;e.options.dragDrop&&Te&&!e.isReadOnly()&&r=="single"&&(F=A.contains(t))>-1&&(vt((F=A.ranges[F]).from(),t)<0||t.xRel>0)&&(vt(F.to(),t)>0||t.xRel<0)?zl(e,n,t,i):Vl(e,n,t,i)}function zl(e,t,r,n){var i=e.display,A=!1,F=Jt(e,function(Y){D&&(i.scroller.draggable=!1),e.state.draggingText=!1,He(i.wrapper.ownerDocument,"mouseup",F),He(i.wrapper.ownerDocument,"mousemove",K),He(i.scroller,"dragstart",z),He(i.scroller,"drop",F),A||($(Y),n.addNew||Yi(e.doc,r,null,null,n.extend),D&&!f||B&&U==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(Y){A=A||Math.abs(t.clientX-Y.clientX)+Math.abs(t.clientY-Y.clientY)>=10},z=function(){return A=!0};D&&(i.scroller.draggable=!0),e.state.draggingText=F,F.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),be(i.wrapper.ownerDocument,"mouseup",F),be(i.wrapper.ownerDocument,"mousemove",K),be(i.scroller,"dragstart",z),be(i.scroller,"drop",F),vs(e),setTimeout(function(){return i.input.focus()},20)}function _o(e,t,r){if(r=="char")return new Dt(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Dt(Ne(t.line,0),yt(e.doc,Ne(t.line+1,0)));var n=r(e,t);return new Dt(n.from,n.to)}function Vl(e,t,r,n){var i=e.display,A=e.doc;$(t);var F,K,z=A.sel,Y=z.ranges;if(n.addNew&&!n.extend?(K=A.sel.contains(r),K>-1?F=Y[K]:F=new Dt(r,r)):(F=A.sel.primary(),K=A.sel.primIndex),n.unit=="rectangle")n.addNew||(F=new Dt(r,r)),r=dr(e,t,!0,!0),K=-1;else{var re=_o(e,r,n.unit);n.extend?F=ka(F,re.anchor,re.head,n.extend):F=re}n.addNew?K==-1?(K=Y.length,an(A,In(e,Y.concat([F]),K),{scroll:!1,origin:"*mouse"})):Y.length>1&&Y[K].empty()&&n.unit=="char"&&!n.extend?(an(A,In(e,Y.slice(0,K).concat(Y.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),z=A.sel):Na(A,K,F,he):(K=0,an(A,new Tn([F],0),he),z=A.sel);var oe=r;function ge($e){if(vt(oe,$e)==0)return;if(oe=$e,n.unit=="rectangle"){for(var it=[],pt=e.options.tabSize,ut=G(Ze(A,r.line).text,r.ch,pt),Et=G(Ze(A,$e.line).text,$e.ch,pt),Ft=Math.min(ut,Et),Zt=Math.max(ut,Et),jt=Math.min(r.line,$e.line),yn=Math.min(e.lastLine(),Math.max(r.line,$e.line));jt<=yn;jt++){var mn=Ze(A,jt).text,Vt=pe(mn,Ft,pt);Ft==Zt?it.push(new Dt(Ne(jt,Vt),Ne(jt,Vt))):mn.length>Vt&&it.push(new Dt(Ne(jt,Vt),Ne(jt,pe(mn,Zt,pt))))}it.length||it.push(new Dt(r,r)),an(A,In(e,z.ranges.slice(0,K).concat(it),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView($e)}else{var gn=F,tn=_o(e,$e,n.unit),$t=gn.anchor,Xt;vt(tn.anchor,$t)>0?(Xt=tn.head,$t=nr(gn.from(),tn.anchor)):(Xt=tn.anchor,$t=br(gn.to(),tn.head));var Ht=z.ranges.slice(0);Ht[K]=Xl(e,new Dt(yt(A,$t),Xt)),an(A,In(e,Ht,K),he)}}var me=i.wrapper.getBoundingClientRect(),xe=0;function Ie($e){var it=++xe,pt=dr(e,$e,!0,n.unit=="rectangle");if(!pt)return;if(vt(pt,oe)!=0){e.curOp.focus=P(),ge(pt);var ut=Wi(i,A);(pt.line>=ut.to||pt.line<ut.from)&&setTimeout(Jt(e,function(){xe==it&&Ie($e)}),150)}else{var Et=$e.clientY<me.top?-20:$e.clientY>me.bottom?20:0;Et&&setTimeout(Jt(e,function(){if(xe!=it)return;i.scroller.scrollTop+=Et,Ie($e)}),50)}}function je($e){e.state.selectingText=!1,xe=Infinity,$e&&($($e),i.input.focus()),He(i.wrapper.ownerDocument,"mousemove",Ye),He(i.wrapper.ownerDocument,"mouseup",tt),A.history.lastSelOrigin=null}var Ye=Jt(e,function($e){$e.buttons===0||!ye($e)?je($e):Ie($e)}),tt=Jt(e,je);e.state.selectingText=tt,be(i.wrapper.ownerDocument,"mousemove",Ye),be(i.wrapper.ownerDocument,"mouseup",tt)}function Xl(e,t){var r=t.anchor,n=t.head,i=Ze(e.doc,r.line);if(vt(r,n)==0&&r.sticky==n.sticky)return t;var A=Fe(i);if(!A)return t;var F=Ue(A,r.ch,r.sticky),K=A[F];if(K.from!=r.ch&&K.to!=r.ch)return t;var z=F+(K.from==r.ch==(K.level!=1)?0:1);if(z==0||z==A.length)return t;var Y;if(n.line!=r.line)Y=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var re=Ue(A,n.ch,n.sticky),oe=re-F||(n.ch-r.ch)*(K.level==1?-1:1);re==z-1||re==z?Y=oe<0:Y=oe>0}var ge=A[z+(Y?-1:0)],me=Y==(ge.level==1),xe=me?ge.from:ge.to,Ie=me?"after":"before";return r.ch==xe&&r.sticky==Ie?t:new Dt(new Ne(r.line,xe,Ie),n)}function yo(e,t,r,n){var i,A;if(t.touches)i=t.touches[0].clientX,A=t.touches[0].clientY;else try{i=t.clientX,A=t.clientY}catch(ge){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&$(t);var F=e.display,K=F.lineDiv.getBoundingClientRect();if(A>K.bottom||!ie(e,r))return q(t);A-=K.top-F.viewOffset;for(var z=0;z<e.display.gutterSpecs.length;++z){var Y=F.gutters.childNodes[z];if(Y&&Y.getBoundingClientRect().right>=i){var re=Mt(e.doc,A),oe=e.display.gutterSpecs[z];return ve(e,r,e,re,oe.className,t),q(t)}}}function Wa(e,t){return yo(e,t,"gutterClick",!0)}function bo(e,t){if(Wn(e.display,t)||Yl(e,t))return;if(Re(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return ie(e,"gutterContextMenu")?yo(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ai(e)}var Hr={toString:function(){return"CodeMirror.Init"}},To={},ta={};function $l(e){var t=e.optionHandlers;function r(n,i,A,F){e.defaults[n]=i,A&&(t[n]=F?function(K,z,Y){Y!=Hr&&A(K,z,Y)}:A)}e.defineOption=r,e.Init=Hr,r("value","",function(n,i){return n.setValue(i)},!0),r("mode",null,function(n,i){n.doc.modeOption=i,Da(n)},!0),r("indentUnit",2,Da,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){fi(n),ai(n),fn(n)},!0),r("lineSeparator",null,function(n,i){if(n.doc.lineSep=i,!i)return;var A=[],F=n.doc.first;n.doc.iter(function(z){for(var Y=0;;){var re=z.text.indexOf(i,Y);if(re==-1)break;Y=re+i.length,A.push(Ne(F,re))}F++});for(var K=A.length-1;K>=0;K--)Ur(n.doc,i,A[K],Ne(A[K].line,A[K].ch+i.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,i,A){n.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),A!=Hr&&n.refresh()}),r("specialCharPlaceholder",Ut,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",s?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(n,i){return n.getInputField().spellcheck=i},!0),r("autocorrect",!1,function(n,i){return n.getInputField().autocorrect=i},!0),r("autocapitalize",!1,function(n,i){return n.getInputField().autocapitalize=i},!0),r("rtlMoveVisually",!R),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Eo(n),hi(n)},!0),r("keyMap","default",function(n,i,A){var F=qi(i),K=A!=Hr&&qi(A);K&&K.detach&&K.detach(n,F),F.attach&&F.attach(n,K||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ql,!0),r("gutters",[],function(n,i){n.display.gutterSpecs=Ca(i,n.options.lineNumbers),hi(n)},!0),r("fixedGutter",!0,function(n,i){n.display.gutters.style.left=i?ba(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return Pr(n)},!0),r("scrollbarStyle","native",function(n){xs(n),Pr(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),r("lineNumbers",!1,function(n,i){n.display.gutterSpecs=Ca(n.options.gutters,i),hi(n)},!0),r("firstLineNumber",1,hi,!0),r("lineNumberFormatter",function(n){return n},hi,!0),r("showCursorWhenSelecting",!1,si,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,i){i=="nocursor"&&(Ir(n),n.display.input.blur()),n.display.input.readOnlyChanged(i)}),r("screenReaderLabel",null,function(n,i){i=i===""?null:i,n.display.input.screenReaderLabelChanged(i)}),r("disableInput",!1,function(n,i){i||n.display.input.reset()},!0),r("dragDrop",!0,Jl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,si,!0),r("singleCursorHeightPerLine",!0,si,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,fi,!0),r("addModeClass",!1,fi,!0),r("pollInterval",100),r("undoDepth",200,function(n,i){return n.doc.history.undoDepth=i}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,fi,!0),r("moveInputWithCursor",!0,function(n,i){i||n.display.input.resetPosition()}),r("tabindex",null,function(n,i){return n.display.input.getField().tabIndex=i||""}),r("autofocus",null),r("direction","ltr",function(n,i){return n.doc.setDirection(i)},!0),r("phrases",null)}function Jl(e,t,r){var n=r&&r!=Hr;if(!t!=!n){var i=e.display.dragFunctions,A=t?be:He;A(e.display.scroller,"dragstart",i.start),A(e.display.scroller,"dragenter",i.enter),A(e.display.scroller,"dragover",i.over),A(e.display.scroller,"dragleave",i.leave),A(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(M(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(E(e.display.wrapper,"CodeMirror-wrap"),Ni(e)),Ea(e),fn(e),ai(e),setTimeout(function(){return Pr(e)},100)}function Bt(e,t){var r=this;if(!(this instanceof Bt))return new Bt(e,t);this.options=t=t?w(t):{},w(To,t,!1);var n=t.value;typeof n=="string"?n=new pn(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new Bt.inputStyles[t.inputStyle](this),A=this.display=new dl(e,n,i,t);A.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),xs(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 J,keySeq:null,specialChars:null},t.autofocus&&!s&&A.input.focus(),B&&U<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Ll(),pr(this),this.curOp.forceUpdate=!0,Ps(this,n),t.autofocus&&!s||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&xa(r)},20):Ir(this);for(var F in ta)ta.hasOwnProperty(F)&&ta[F](this,t[F],Hr);Os(this),t.finishInit&&t.finishInit(this);for(var K=0;K<Ka.length;++K)Ka[K](this);mr(this),D&&t.lineWrapping&&getComputedStyle(A.lineDiv).textRendering=="optimizelegibility"&&(A.lineDiv.style.textRendering="auto")}Bt.defaults=To,Bt.optionHandlers=ta;function Zl(e){var t=e.display;be(t.scroller,"mousedown",Jt(e,vo)),B&&U<11?be(t.scroller,"dblclick",Jt(e,function(z){if(Re(e,z))return;var Y=dr(e,z);if(!Y||Wa(e,z)||Wn(e.display,z))return;$(z);var re=e.findWordAt(Y);Yi(e.doc,re.anchor,re.head)})):be(t.scroller,"dblclick",function(z){return Re(e,z)||$(z)}),be(t.scroller,"contextmenu",function(z){return bo(e,z)}),be(t.input.getField(),"contextmenu",function(z){t.scroller.contains(z.target)||bo(e,z)});var r,n={end:0};function i(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),n=t.activeTouch,n.end=+new Date)}function A(z){if(z.touches.length!=1)return!1;var Y=z.touches[0];return Y.radiusX<=1&&Y.radiusY<=1}function F(z,Y){if(Y.left==null)return!0;var re=Y.left-z.left,oe=Y.top-z.top;return re*re+oe*oe>20*20}be(t.scroller,"touchstart",function(z){if(!Re(e,z)&&!A(z)&&!Wa(e,z)){t.input.ensurePolled(),clearTimeout(r);var Y=+new Date;t.activeTouch={start:Y,moved:!1,prev:Y-n.end<=300?n:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),be(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),be(t.scroller,"touchend",function(z){var Y=t.activeTouch;if(Y&&!Wn(t,z)&&Y.left!=null&&!Y.moved&&new Date-Y.start<300){var re=e.coordsChar(t.activeTouch,"page"),oe;!Y.prev||F(Y,Y.prev)?oe=new Dt(re,re):!Y.prev.prev||F(Y,Y.prev.prev)?oe=e.findWordAt(re):oe=new Dt(Ne(re.line,0),yt(e.doc,Ne(re.line+1,0))),e.setSelection(oe.anchor,oe.head),e.focus(),$(z)}i()}),be(t.scroller,"touchcancel",i),be(t.scroller,"scroll",function(){t.scroller.clientHeight&&(li(e,t.scroller.scrollTop),hr(e,t.scroller.scrollLeft,!0),ve(e,"scroll",e))}),be(t.scroller,"mousewheel",function(z){return Ls(e,z)}),be(t.scroller,"DOMMouseScroll",function(z){return Ls(e,z)}),be(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){Re(e,z)||ne(z)},over:function(z){Re(e,z)||(Al(e,z),ne(z))},start:function(z){return Rl(e,z)},drop:Jt(e,Ol),leave:function(z){Re(e,z)||ro(e)}};var K=t.input.getField();be(K,"keyup",function(z){return mo.call(e,z)}),be(K,"keydown",Jt(e,po)),be(K,"keypress",Jt(e,go)),be(K,"focus",function(z){return xa(e,z)}),be(K,"blur",function(z){return Ir(e,z)})}var Ka=[];Bt.defineInitHook=function(e){return Ka.push(e)};function Oi(e,t,r,n){var i=e.doc,A;r==null&&(r="add"),r=="smart"&&(i.mode.indent?A=Sn(e,t).state:r="prev");var F=e.options.tabSize,K=Ze(i,t),z=G(K.text,null,F);K.stateAfter&&(K.stateAfter=null);var Y=K.text.match(/^\s*/)[0],re;if(!n&&!/\S/.test(K.text))re=0,r="not";else if(r=="smart"&&(re=i.mode.indent(A,K.text.slice(Y.length),K.text),re==_e||re>150)){if(!n)return;r="prev"}r=="prev"?t>i.first?re=G(Ze(i,t-1).text,null,F):re=0:r=="add"?re=z+e.options.indentUnit:r=="subtract"?re=z-e.options.indentUnit:typeof r=="number"&&(re=z+r),re=Math.max(0,re);var oe="",ge=0;if(e.options.indentWithTabs)for(var me=Math.floor(re/F);me;--me)ge+=F,oe+=" ";if(ge<re&&(oe+=de(re-ge)),oe!=Y)return Ur(i,oe,Ne(t,0),Ne(t,Y.length),"+input"),K.stateAfter=null,!0;for(var xe=0;xe<i.sel.ranges.length;xe++){var Ie=i.sel.ranges[xe];if(Ie.head.line==t&&Ie.head.ch<Y.length){var je=Ne(t,Y.length);Na(i,xe,new Dt(je,je));break}}}var Dn=null;function na(e){Dn=e}function Ga(e,t,r,n,i){var A=e.doc;e.display.shift=!1,n||(n=A.sel);var F=+new Date-200,K=i=="paste"||e.state.pasteIncoming>F,z=ht(t),Y=null;if(K&&n.ranges.length>1)if(Dn&&Dn.text.join(`
|
|
`)==t){if(n.ranges.length%Dn.text.length==0){Y=[];for(var re=0;re<Dn.text.length;re++)Y.push(A.splitLines(Dn.text[re]))}}else z.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(Y=Pe(z,function(Ye){return[Ye]}));for(var oe=e.curOp.updateInput,ge=n.ranges.length-1;ge>=0;ge--){var me=n.ranges[ge],xe=me.from(),Ie=me.to();me.empty()&&(r&&r>0?xe=Ne(xe.line,xe.ch-r):e.state.overwrite&&!K?Ie=Ne(Ie.line,Math.min(Ze(A,Ie.line).text.length,Ie.ch+Ee(z).length)):K&&Dn&&Dn.lineWise&&Dn.text.join(`
|
|
`)==z.join(`
|
|
`)&&(xe=Ie=Ne(xe.line,0)));var je={from:xe,to:Ie,text:Y?Y[ge%Y.length]:z,origin:i||(K?"paste":e.state.cutIncoming>F?"cut":"+input")};Nr(e.doc,je),en(e,"inputRead",e,je)}t&&!K&&wo(e,t),Dr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=oe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function xo(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&_n(t,function(){return Ga(t,r,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)continue;var A=e.getModeAt(i.head),F=!1;if(A.electricChars){for(var K=0;K<A.electricChars.length;K++)if(t.indexOf(A.electricChars.charAt(K))>-1){F=Oi(e,i.head.line,"smart");break}}else A.electricInput&&(A.electricInput.test(Ze(e.doc,i.head.line).text.slice(0,i.head.ch))&&(F=Oi(e,i.head.line,"smart")));F&&en(e,"electricInput",e,i.head.line)}}function So(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,A={anchor:Ne(i,0),head:Ne(i+1,0)};r.push(A),t.push(e.getRange(A.anchor,A.head))}return{text:t,ranges:r}}function Oo(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Ro(){var e=u("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=u("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return D?e.style.width="1000px":e.setAttribute("wrap","off"),c&&(e.style.border="1px solid black"),Oo(e),t}function ql(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(n,i){var A=this.options,F=A[n];if(A[n]==i&&n!="mode")return;A[n]=i,t.hasOwnProperty(n)&&Jt(this,t[n])(this,i,F),ve(this,"optionChange",this,n)},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,i){this.state.keyMaps[i?"push":"unshift"](qi(n))},removeKeyMap:function(n){for(var i=this.state.keyMaps,A=0;A<i.length;++A)if(i[A]==n||i[A].name==n)return i.splice(A,1),!0},addOverlay:ln(function(n,i){var A=n.token?n:e.getMode(this.options,n);if(A.startState)throw new Error("Overlays may not be stateful.");Se(this.state.overlays,{mode:A,modeSpec:n,opaque:i&&i.opaque,priority:i&&i.priority||0},function(F){return F.priority}),this.state.modeGen++,fn(this)}),removeOverlay:ln(function(n){for(var i=this.state.overlays,A=0;A<i.length;++A){var F=i[A].modeSpec;if(F==n||typeof n=="string"&&F.name==n){i.splice(A,1),this.state.modeGen++,fn(this);return}}}),indentLine:ln(function(n,i,A){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),dn(this.doc,n)&&Oi(this,n,i,A)}),indentSelection:ln(function(n){for(var i=this.doc.sel.ranges,A=-1,F=0;F<i.length;F++){var K=i[F];if(K.empty())K.head.line>A&&(Oi(this,K.head.line,n,!0),A=K.head.line,F==this.doc.sel.primIndex&&Dr(this));else{var z=K.from(),Y=K.to(),re=Math.max(A,z.line);A=Math.min(this.lastLine(),Y.line-(Y.ch?0:1))+1;for(var oe=re;oe<A;++oe)Oi(this,oe,n);var ge=this.doc.sel.ranges;z.ch==0&&i.length==ge.length&&ge[F].from().ch>0&&Na(this.doc,F,new Dt(z,ge[F].to()),ce)}}}),getTokenAt:function(n,i){return Ai(this,n,i)},getLineTokens:function(n,i){return Ai(this,Ne(n),i,!0)},getTokenTypeAt:function(n){n=yt(this.doc,n);var i=rr(this,Ze(this.doc,n.line)),A=0,F=(i.length-1)/2,K=n.ch,z;if(K==0)z=i[2];else for(;;){var Y=A+F>>1;if((Y?i[Y*2-1]:0)>=K)F=Y;else if(i[Y*2+1]<K)A=Y+1;else{z=i[Y*2+2];break}}var re=z?z.indexOf("overlay "):-1;return re<0?z:re==0?null:z.slice(0,re-1)},getModeAt:function(n){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(n).state).mode:i},getHelper:function(n,i){return this.getHelpers(n,i)[0]},getHelpers:function(n,i){var A=[];if(!r.hasOwnProperty(i))return A;var F=r[i],K=this.getModeAt(n);if(typeof K[i]=="string")F[K[i]]&&A.push(F[K[i]]);else if(K[i])for(var z=0;z<K[i].length;z++){var Y=F[K[i][z]];Y&&A.push(Y)}else K.helperType&&F[K.helperType]?A.push(F[K.helperType]):F[K.name]&&A.push(F[K.name]);for(var re=0;re<F._global.length;re++){var oe=F._global[re];oe.pred(K,this)&&Z(A,oe.val)==-1&&A.push(oe.val)}return A},getStateAfter:function(n,i){var A=this.doc;return n=Er(A,n==null?A.first+A.size-1:n),Sn(this,n+1,i).state},cursorCoords:function(n,i){var A,F=this.doc.sel.primary();return n==null?A=F.head:typeof n=="object"?A=yt(this.doc,n):A=n?F.from():F.to(),Cn(this,A,i||"page")},charCoords:function(n,i){return ma(this,yt(this.doc,n),i||"page")},coordsChar:function(n,i){return n=ls(this,n,i||"page"),va(this,n.left,n.top)},lineAtHeight:function(n,i){return n=ls(this,{top:n,left:0},i||"page").top,Mt(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,i,A){var F=!1,K;if(typeof n=="number"){var z=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>z&&(n=z,F=!0),K=Ze(this.doc,n)}else K=n;return Fi(this,K,{top:0,left:0},i||"page",A||F).top+(F?this.doc.height-Ln(K):0)},defaultTextHeight:function(){return Lr(this.display)},defaultCharWidth:function(){return Cr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,i,A,F,K){var z=this.display;n=Cn(this,yt(this.doc,n));var Y=n.bottom,re=n.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),z.sizer.appendChild(i),F=="over")Y=n.top;else if(F=="above"||F=="near"){var oe=Math.max(z.wrapper.clientHeight,this.doc.height),ge=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(F=="above"||n.bottom+i.offsetHeight>oe)&&n.top>i.offsetHeight?Y=n.top-i.offsetHeight:n.bottom+i.offsetHeight<=oe&&(Y=n.bottom),re+i.offsetWidth>ge&&(re=ge-i.offsetWidth)}i.style.top=Y+"px",i.style.left=i.style.right="",K=="right"?(re=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?re=0:K=="middle"&&(re=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=re+"px"),A&&Jo(this,{left:re,top:Y,right:re+i.offsetWidth,bottom:Y+i.offsetHeight})},triggerOnKeyDown:ln(po),triggerOnKeyPress:ln(go),triggerOnKeyUp:mo,triggerOnMouseDown:ln(vo),execCommand:function(n){if(Ti.hasOwnProperty(n))return Ti[n].call(null,this)},triggerElectric:ln(function(n){wo(this,n)}),findPosH:function(n,i,A,F){var K=1;i<0&&(K=-1,i=-i);for(var z=yt(this.doc,n),Y=0;Y<i&&!(z=za(this.doc,z,K,A,F),z.hitSide);++Y);return z},moveH:ln(function(n,i){var A=this;this.extendSelectionsBy(function(F){return A.display.shift||A.doc.extend||F.empty()?za(A.doc,F.head,n,i,A.options.rtlMoveVisually):n<0?F.from():F.to()},fe)}),deleteH:ln(function(n,i){var A=this.doc.sel,F=this.doc;A.somethingSelected()?F.replaceSelection("",null,"+delete"):jr(this,function(K){var z=za(F,K.head,n,i,!1);return n<0?{from:z,to:K.head}:{from:K.head,to:z}})}),findPosV:function(n,i,A,F){var K=1,z=F;i<0&&(K=-1,i=-i);for(var Y=yt(this.doc,n),re=0;re<i;++re){var oe=Cn(this,Y,"div");if(z==null?z=oe.left:oe.left=z,Y=Ao(this,oe,K,A),Y.hitSide)break}return Y},moveV:ln(function(n,i){var A=this,F=this.doc,K=[],z=!this.display.shift&&!F.extend&&F.sel.somethingSelected();if(F.extendSelectionsBy(function(re){if(z)return n<0?re.from():re.to();var oe=Cn(A,re.head,"div");re.goalColumn!=null&&(oe.left=re.goalColumn),K.push(oe.left);var ge=Ao(A,oe,n,i);return i=="page"&&re==F.sel.primary()&&Sa(A,ma(A,ge,"div").top-oe.top),ge},fe),K.length)for(var Y=0;Y<F.sel.ranges.length;Y++)F.sel.ranges[Y].goalColumn=K[Y]}),findWordAt:function(n){var i=this.doc,A=Ze(i,n.line).text,F=n.ch,K=n.ch;if(A){var z=this.getHelper(n,"wordChars");(n.sticky=="before"||K==A.length)&&F?--F:++K;for(var Y=A.charAt(F),re=De(Y,z)?function(oe){return De(oe,z)}:/\s/.test(Y)?function(oe){return/\s/.test(oe)}:function(oe){return!/\s/.test(oe)&&!De(oe)};F>0&&re(A.charAt(F-1));)--F;for(;K<A.length&&re(A.charAt(K));)++K}return new Dt(Ne(n.line,F),Ne(n.line,K))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?M(this.display.cursorDiv,"CodeMirror-overwrite"):E(this.display.cursorDiv,"CodeMirror-overwrite"),ve(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:ln(function(n,i){oi(this,n,i)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-kn(this)-this.display.barHeight,width:n.scrollWidth-kn(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:lr(this)}},scrollIntoView:ln(function(n,i){n==null?(n={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof n=="number"?n={from:Ne(n,0),to:null}:n.from==null&&(n={from:n,to:null}),n.to||(n.to=n.from),n.margin=i||0,n.from.line!=null?Qo(this,n):ys(this,n.from,n.to,n.margin)}),setSize:ln(function(n,i){var A=this,F=function(z){return typeof z=="number"||/^\d+$/.test(String(z))?z+"px":z};n!=null&&(this.display.wrapper.style.width=F(n)),i!=null&&(this.display.wrapper.style.height=F(i)),this.options.lineWrapping&&as(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(z){if(z.widgets){for(var Y=0;Y<z.widgets.length;Y++)if(z.widgets[Y].noHScroll){Xn(A,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,ve(this,"refresh",this)}),operation:function(n){return _n(this,n)},startOperation:function(){return pr(this)},endOperation:function(){return mr(this)},refresh:ln(function(){var n=this.display.cachedTextHeight;fn(this),this.curOp.forceUpdate=!0,ai(this),oi(this,this.doc.scrollLeft,this.doc.scrollTop),Aa(this.display),(n==null||Math.abs(n-Lr(this.display))>.5||this.options.lineWrapping)&&Ea(this),ve(this,"refresh",this)}),swapDoc:ln(function(n){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Ps(this,n),ai(this),this.display.input.reset(),oi(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,en(this,"swapDoc",this,i),i}),phrase:function(n){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,n)?i[n]:n},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}},te(e),e.registerHelper=function(n,i,A){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][i]=A},e.registerGlobalHelper=function(n,i,A,F){e.registerHelper(n,i,F),r[n]._global.push({pred:A,val:F})}}function za(e,t,r,n,i){var A=t,F=r,K=Ze(e,t.line),z=i&&e.direction=="rtl"?-r:r;function Y(){var tt=t.line+z;return tt<e.first||tt>=e.first+e.size?!1:(t=new Ne(tt,t.ch,t.sticky),K=Ze(e,tt))}function re(tt){var $e;if(n=="codepoint"){var it=K.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(it)?$e=null:$e=new Ne(t.line,Math.max(0,Math.min(K.text.length,t.ch+r*(it>=55296&&it<56320?2:1))),-r)}else i?$e=Ml(e.cm,K,t,r):$e=Fa(K,t,r);if($e==null)if(!tt&&Y())t=Ba(i,e.cm,K,t.line,z);else return!1;else t=$e;return!0}if(n=="char"||n=="codepoint")re();else if(n=="column")re(!0);else if(n=="word"||n=="group")for(var oe=null,ge=n=="group",me=e.cm&&e.cm.getHelper(t,"wordChars"),xe=!0;!(r<0&&!re(!xe));xe=!1){var Ie=K.text.charAt(t.ch)||`
|
|
`,je=De(Ie,me)?"w":ge&&Ie==`
|
|
`?"n":!ge||/\s/.test(Ie)?null:"p";if(ge&&!xe&&!je&&(je="s"),oe&&oe!=je){r<0&&(r=1,re(),t.sticky="after");break}if(je&&(oe=je),r>0&&!re(!xe))break}var Ye=Ji(e,t,A,F,!0);return zr(A,Ye)&&(Ye.hitSide=!0),Ye}function Ao(e,t,r,n){var i=e.doc,A=t.left,F;if(n=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(K-.5*Lr(e.display),3);F=(r>0?t.bottom:t.top)+r*z}else n=="line"&&(F=r>0?t.bottom+3:t.top-3);for(var Y;!(Y=va(e,A,F),!Y.outside);){if(r<0?F<=0:F>=i.height){Y.hitSide=!0;break}F+=r*5}return Y}var kt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new J,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};kt.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;Oo(i,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function A(K){for(var z=K.target;z;z=z.parentNode){if(z==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}be(i,"paste",function(K){if(!A(K)||Re(n,K)||xo(K,n))return;U<=11&&setTimeout(Jt(n,function(){return t.updateFromDOM()}),20)}),be(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),be(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),be(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),be(i,"touchstart",function(){return r.forceCompositionEnd()}),be(i,"input",function(){t.composing||t.readFromDOMSoon()});function F(K){if(!A(K)||Re(n,K))return;if(n.somethingSelected())na({lineWise:!1,text:n.getSelections()}),K.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var z=So(n);na({lineWise:!0,text:z.text}),K.type=="cut"&&n.operation(function(){n.setSelections(z.ranges,0,ce),n.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var Y=Dn.text.join(`
|
|
`);if(K.clipboardData.setData("Text",Y),K.clipboardData.getData("Text")==Y){K.preventDefault();return}}var re=Ro(),oe=re.firstChild;n.display.lineSpace.insertBefore(re,n.display.lineSpace.firstChild),oe.value=Dn.text.join(`
|
|
`);var ge=document.activeElement;W(oe),setTimeout(function(){n.display.lineSpace.removeChild(re),ge.focus(),ge==i&&r.showPrimarySelection()},50)}be(i,"copy",F),be(i,"cut",F)},kt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},kt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},kt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},kt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},kt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),i=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var A=ra(t,e.anchorNode,e.anchorOffset),F=ra(t,e.focusNode,e.focusOffset);if(A&&!A.bad&&F&&!F.bad&&vt(nr(A,F),n)==0&&vt(br(A,F),i)==0)return;var K=t.display.view,z=n.line>=t.display.viewFrom&&Lo(t,n)||{node:K[0].measure.map[2],offset:0},Y=i.line<t.display.viewTo&&Lo(t,i);if(!Y){var re=K[K.length-1].measure,oe=re.maps?re.maps[re.maps.length-1]:re.map;Y={node:oe[oe.length-1],offset:oe[oe.length-2]-oe[oe.length-3]}}if(!z||!Y){e.removeAllRanges();return}var ge=e.rangeCount&&e.getRangeAt(0),me;try{me=m(z.node,z.offset,Y.offset,Y.node)}catch(xe){}me&&(!I&&t.state.focused?(e.collapse(z.node,z.offset),me.collapsed||(e.removeAllRanges(),e.addRange(me))):(e.removeAllRanges(),e.addRange(me)),ge&&e.anchorNode==null?e.addRange(ge):I&&this.startGracePeriod()),this.rememberSelection()},kt.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)},kt.prototype.showMultipleSelections=function(e){v(this.cm.display.cursorDiv,e.cursors),v(this.cm.display.selectionDiv,e.selection)},kt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},kt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return y(this.div,t)},kt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},kt.prototype.blur=function(){this.div.blur()},kt.prototype.getField=function(){return this.div},kt.prototype.supportsTouch=function(){return!0},kt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():_n(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)},kt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},kt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(o&&g&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var r=ra(t,e.anchorNode,e.anchorOffset),n=ra(t,e.focusNode,e.focusOffset);r&&n&&_n(t,function(){an(t.doc,$n(r,n),ce),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},kt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.ch==0&&n.line>e.firstLine()&&(n=Ne(n.line-1,Ze(e.doc,n.line-1).length)),i.ch==Ze(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ne(i.line+1,0)),n.line<t.viewFrom||i.line>t.viewTo-1)return!1;var A,F,K;n.line==t.viewFrom||(A=cr(e,n.line))==0?(F=Tt(t.view[0].line),K=t.view[0].node):(F=Tt(t.view[A].line),K=t.view[A-1].node.nextSibling);var z=cr(e,i.line),Y,re;if(z==t.view.length-1?(Y=t.viewTo-1,re=t.lineDiv.lastChild):(Y=Tt(t.view[z+1].line)-1,re=t.view[z+1].node.previousSibling),!K)return!1;for(var oe=e.doc.splitLines(tu(e,K,re,F,Y)),ge=Kt(e.doc,Ne(F,0),Ne(Y,Ze(e.doc,Y).text.length));oe.length>1&&ge.length>1;)if(Ee(oe)==Ee(ge))oe.pop(),ge.pop(),Y--;else if(oe[0]==ge[0])oe.shift(),ge.shift(),F++;else break;for(var me=0,xe=0,Ie=oe[0],je=ge[0],Ye=Math.min(Ie.length,je.length);me<Ye&&Ie.charCodeAt(me)==je.charCodeAt(me);)++me;for(var tt=Ee(oe),$e=Ee(ge),it=Math.min(tt.length-(oe.length==1?me:0),$e.length-(ge.length==1?me:0));xe<it&&tt.charCodeAt(tt.length-xe-1)==$e.charCodeAt($e.length-xe-1);)++xe;if(oe.length==1&&ge.length==1&&F==n.line)for(;me&&me>n.ch&&tt.charCodeAt(tt.length-xe-1)==$e.charCodeAt($e.length-xe-1);)me--,xe++;oe[oe.length-1]=tt.slice(0,tt.length-xe).replace(/^\u200b+/,""),oe[0]=oe[0].slice(me).replace(/\u200b+$/,"");var pt=Ne(F,me),ut=Ne(Y,ge.length?Ee(ge).length-xe:0);if(oe.length>1||oe[0]||vt(pt,ut))return Ur(e.doc,oe,pt,ut,"+input"),!0},kt.prototype.ensurePolled=function(){this.forceCompositionEnd()},kt.prototype.reset=function(){this.forceCompositionEnd()},kt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},kt.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)},kt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&_n(this.cm,function(){return fn(e.cm)})},kt.prototype.setUneditable=function(e){e.contentEditable="false"},kt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Jt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},kt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},kt.prototype.onContextMenu=function(){},kt.prototype.resetPosition=function(){},kt.prototype.needsContentAttribute=!0;function Lo(e,t){var r=fa(e,t.line);if(!r||r.hidden)return null;var n=Ze(e.doc,t.line),i=es(r,n,t.line),A=Fe(n,e.doc.direction),F="left";if(A){var K=Ue(A,t.ch);F=K%2?"right":"left"}var z=rs(i.map,t.ch,F);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Wr(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,n,i){var A="",F=!1,K=e.doc.lineSeparator(),z=!1;function Y(me){return function(xe){return xe.id==me}}function re(){F&&(A+=K,z&&(A+=K),F=z=!1)}function oe(me){me&&(re(),A+=me)}function ge(me){if(me.nodeType==1){var xe=me.getAttribute("cm-text");if(xe){oe(xe);return}var Ie=me.getAttribute("cm-marker"),je;if(Ie){var Ye=e.findMarks(Ne(n,0),Ne(i+1,0),Y(+Ie));Ye.length&&(je=Ye[0].find(0))&&oe(Kt(e.doc,je.from,je.to).join(K));return}if(me.getAttribute("contenteditable")=="false")return;var tt=/^(pre|div|p|li|table|br)$/i.test(me.nodeName);if(!/^br$/i.test(me.nodeName)&&me.textContent.length==0)return;tt&&re();for(var $e=0;$e<me.childNodes.length;$e++)ge(me.childNodes[$e]);/^(pre|p)$/i.test(me.nodeName)&&(z=!0),tt&&(F=!0)}else me.nodeType==3&&oe(me.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ge(t),t==r);)t=t.nextSibling,z=!1;return A}function ra(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return Wr(e.clipPos(Ne(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var A=e.display.view[i];if(A.node==n)return nu(A,t,r)}}function nu(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!y(n,t))return Wr(Ne(Tt(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var A=e.rest?Ee(e.rest):e.line;return Wr(Ne(Tt(A),A.text.length),i)}var F=t.nodeType==3?t:null,K=t;for(!F&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(F=t.firstChild,r&&(r=F.nodeValue.length));K.parentNode!=n;)K=K.parentNode;var z=e.measure,Y=z.maps;function re(je,Ye,tt){for(var $e=-1;$e<(Y?Y.length:0);$e++)for(var it=$e<0?z.map:Y[$e],pt=0;pt<it.length;pt+=3){var ut=it[pt+2];if(ut==je||ut==Ye){var Et=Tt($e<0?e.line:e.rest[$e]),Ft=it[pt]+tt;return(tt<0||ut!=je)&&(Ft=it[pt+(tt?1:0)]),Ne(Et,Ft)}}}var oe=re(F,K,r);if(oe)return Wr(oe,i);for(var ge=K.nextSibling,me=F?F.nodeValue.length-r:0;ge;ge=ge.nextSibling){if(oe=re(ge,ge.firstChild,0),oe)return Wr(Ne(oe.line,oe.ch-me),i);me+=ge.textContent.length}for(var xe=K.previousSibling,Ie=r;xe;xe=xe.previousSibling){if(oe=re(xe,xe.firstChild,-1),oe)return Wr(Ne(oe.line,oe.ch+Ie),i);Ie+=xe.textContent.length}}var Gt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new J,this.hasSelection=!1,this.composing=null};Gt.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),c&&(i.style.width="0px"),be(i,"input",function(){B&&U>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),be(i,"paste",function(F){if(Re(n,F)||xo(F,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function A(F){if(Re(n,F))return;if(n.somethingSelected())na({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var K=So(n);na({lineWise:!0,text:K.text}),F.type=="cut"?n.setSelections(K.ranges,null,ce):(r.prevInput="",i.value=K.text.join(`
|
|
`),W(i))}else return;F.type=="cut"&&(n.state.cutIncoming=+new Date)}be(i,"cut",A),be(i,"copy",A),be(e.scroller,"paste",function(F){if(Wn(e,F)||Re(n,F))return;if(!i.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var K=new Event("paste");K.clipboardData=F.clipboardData,i.dispatchEvent(K)}),be(e.lineSpace,"selectstart",function(F){Wn(e,F)||$(F)}),be(i,"compositionstart",function(){var F=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:F,range:n.markText(F,n.getCursor("to"),{className:"CodeMirror-composing"})}}),be(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Gt.prototype.createField=function(e){this.wrapper=Ro(),this.textarea=this.wrapper.firstChild},Gt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Gt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=ps(e);if(e.options.moveInputWithCursor){var i=Cn(e,r.sel.primary().head,"div"),A=t.wrapper.getBoundingClientRect(),F=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+F.top-A.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+F.left-A.left))}return n},Gt.prototype.showSelection=function(e){var t=this.cm,r=t.display;v(r.cursorDiv,e.cursors),v(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Gt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&W(this.textarea),B&&U>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",B&&U>=9&&(this.hasSelection=null))},Gt.prototype.getField=function(){return this.textarea},Gt.prototype.supportsTouch=function(){return!1},Gt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!s||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},Gt.prototype.blur=function(){this.textarea.blur()},Gt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Gt.prototype.receivedFocus=function(){this.slowPoll()},Gt.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Gt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},Gt.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ve(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(B&&U>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var A=i.charCodeAt(0);if(A==8203&&!n&&(n="\u200B"),A==8666)return this.reset(),this.cm.execCommand("undo")}for(var F=0,K=Math.min(n.length,i.length);F<K&&n.charCodeAt(F)==i.charCodeAt(F);)++F;return _n(t,function(){Ga(t,i.slice(F),n.length-F,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Gt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Gt.prototype.onKeyPress=function(){B&&U>=9&&(this.hasSelection=null),this.fastPoll()},Gt.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var A=dr(r,e),F=n.scroller.scrollTop;if(!A||p)return;var K=r.options.resetSelectionOnContextMenu;K&&r.doc.sel.contains(A)==-1&&Jt(r,an)(r.doc,$n(A),ce);var z=i.style.cssText,Y=t.wrapper.style.cssText,re=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-re.top-5)+"px; left: "+(e.clientX-re.left-5)+`px;
|
|
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var oe;D&&(oe=window.scrollY),n.input.focus(),D&&window.scrollTo(null,oe),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=me,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function ge(){if(i.selectionStart!=null){var Ie=r.somethingSelected(),je="\u200B"+(Ie?i.value:"");i.value="\u21DA",i.value=je,t.prevInput=Ie?"":"\u200B",i.selectionStart=1,i.selectionEnd=je.length,n.selForContextMenu=r.doc.sel}}function me(){if(t.contextMenuPending!=me)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=Y,i.style.cssText=z,B&&U<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=F),i.selectionStart!=null){(!B||B&&U<9)&&ge();var Ie=0,je=function(){n.selForContextMenu==r.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Jt(r,Vs)(r):Ie++<10?n.detectingSelectAll=setTimeout(je,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(je,200)}}if(B&&U>=9&&ge(),O){ne(e);var xe=function(){He(window,"mouseup",xe),setTimeout(me,20)};be(window,"mouseup",xe)}else setTimeout(me,50)},Gt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Gt.prototype.setUneditable=function(){},Gt.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?w(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 r=P();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=K.getValue()}var i;if(e.form&&(be(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var A=e.form;i=A.submit;try{var F=A.submit=function(){n(),A.submit=i,A.submit(),A.submit=F}}catch(z){}}t.finishInit=function(z){z.save=n,z.getTextArea=function(){return e},z.toTextArea=function(){z.toTextArea=isNaN,n(),e.parentNode.removeChild(z.getWrapperElement()),e.style.display="",e.form&&(He(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=Bt(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return K}function iu(e){e.off=He,e.on=be,e.wheelEventPixels=cl,e.Doc=pn,e.splitLines=ht,e.countColumn=G,e.findColumn=pe,e.isWordChar=we,e.Pass=_e,e.signal=ve,e.Line=or,e.changeEnd=Jn,e.scrollbarModel=Ts,e.Pos=Ne,e.cmpPos=vt,e.modes=bt,e.mimeModes=gt,e.resolveMode=ft,e.getMode=dt,e.modeExtensions=At,e.extendMode=Nt,e.copyState=Wt,e.startState=tr,e.innerMode=Pn,e.commands=Ti,e.keyMap=Kn,e.keyName=lo,e.isModifierKey=so,e.lookupKey=Br,e.normalizeKeyMap=Pl,e.StringStream=lt,e.SharedTextMarker=yi,e.TextMarker=Zn,e.LineWidget=_i,e.e_preventDefault=$,e.e_stopPropagation=X,e.e_stop=ne,e.addClass=M,e.contains=y,e.rmClass=E,e.keyNames=qn}$l(Bt),ql(Bt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in pn.prototype)pn.prototype.hasOwnProperty(ia)&&Z(au,ia)<0&&(Bt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(pn.prototype[ia]));return te(pn),Bt.inputStyles={textarea:Gt,contenteditable:kt},Bt.defineMode=function(e){!Bt.defaults.mode&&e!="null"&&(Bt.defaults.mode=e),nn.apply(this,arguments)},Bt.defineMIME=zt,Bt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Bt.defineMIME("text/plain","null"),Bt.defineExtension=function(e,t){Bt.prototype[e]=t},Bt.defineDocExtension=function(e,t){pn.prototype[e]=t},Bt.fromTextArea=ru,iu(Bt),Bt.version="5.58.2",Bt})},Y1PL:function(st,Qe,Q){"use strict";Q.r(Qe),Q.d(Qe,"ResizableTextArea",function(){return Z});var ee=Q("wx14"),V=Q("1OyB"),I=Q("vuIU"),H=Q("Ji7U"),k=Q("LK+K"),C=Q("cDcd"),B=Q("VTBJ"),U=Q("rePB"),D=Q("Zm9Q"),L=Q("Kwbf"),g=Q("c+Xe"),p=Q("m+aA"),f=Q("bdgK"),d=new Map;function a(ce){ce.forEach(function(he){var fe,pe=he.target;(fe=d.get(pe))===null||fe===void 0||fe.forEach(function(se){return se(pe)})})}var c=new f.default(a),o=null,s=null;function l(ce,he){d.has(ce)||(d.set(ce,new Set),c.observe(ce)),d.get(ce).add(he)}function h(ce,he){d.has(ce)&&(d.get(ce).delete(he),d.get(ce).size||(c.unobserve(ce),d.delete(ce)))}var R=function(ce){Object(H.a)(fe,ce);var he=Object(k.a)(fe);function fe(){return Object(V.a)(this,fe),he.apply(this,arguments)}return Object(I.a)(fe,[{key:"render",value:function(){return this.props.children}}]),fe}(C.Component),x=C.createContext(null);function T(ce){var he=ce.children,fe=ce.onBatchResize,pe=C.useRef(0),se=C.useRef([]),de=C.useContext(x),Ee=C.useCallback(function(Pe,Se,Je){pe.current+=1;var qe=pe.current;se.current.push({size:Pe,element:Se,data:Je}),Promise.resolve().then(function(){qe===pe.current&&(fe==null||fe(se.current),se.current=[])}),de==null||de(Pe,Se,Je)},[fe,de]);return C.createElement(x.Provider,{value:Ee},he)}function O(ce){var he=ce.children,fe=ce.disabled,pe=C.useRef(null),se=C.useRef(null),de=C.useContext(x),Ee=C.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Pe=C.isValidElement(he)&&Object(g.c)(he),Se=Pe?he.ref:null,Je=C.useMemo(function(){return Object(g.a)(Se,pe)},[Se,pe]),qe=C.useRef(ce);qe.current=ce;var Ae=C.useCallback(function(we){var De=qe.current,Xe=De.onResize,We=De.data,Ce=we.getBoundingClientRect(),Oe=Ce.width,et=Ce.height,Me=we.offsetWidth,Le=we.offsetHeight,Ue=Math.floor(Oe),Ge=Math.floor(et);if(Ee.current.width!==Ue||Ee.current.height!==Ge||Ee.current.offsetWidth!==Me||Ee.current.offsetHeight!==Le){var Fe={width:Ue,height:Ge,offsetWidth:Me,offsetHeight:Le};Ee.current=Fe;var ze=Me===Math.round(Oe)?Oe:Me,be=Le===Math.round(et)?et:Le,Ke=Object(B.a)(Object(B.a)({},Fe),{},{offsetWidth:ze,offsetHeight:be});de==null||de(Ke,we,We),Xe&&Promise.resolve().then(function(){Xe(Ke,we)})}},[]);return C.useEffect(function(){var we=Object(p.a)(pe.current)||Object(p.a)(se.current);return we&&!fe&&l(we,Ae),function(){return h(we,Ae)}},[pe.current,fe]),C.createElement(R,{ref:se},Pe?C.cloneElement(he,{ref:Je}):he)}var S="rc-observer-key";function E(ce){var he=ce.children,fe=Object(D.a)(he);return fe.map(function(pe,se){var de=(pe==null?void 0:pe.key)||"".concat(S,"-").concat(se);return C.createElement(O,Object(ee.a)({},ce,{key:de}),pe)})}E.Collection=T;var b=E,v=Q("bT9E"),u=Q("TSYQ"),_=Q.n(u),m=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,y=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],P={},M;function j(ce){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=ce.getAttribute("id")||ce.getAttribute("data-reactid")||ce.getAttribute("name");if(he&&P[fe])return P[fe];var pe=window.getComputedStyle(ce),se=pe.getPropertyValue("box-sizing")||pe.getPropertyValue("-moz-box-sizing")||pe.getPropertyValue("-webkit-box-sizing"),de=parseFloat(pe.getPropertyValue("padding-bottom"))+parseFloat(pe.getPropertyValue("padding-top")),Ee=parseFloat(pe.getPropertyValue("border-bottom-width"))+parseFloat(pe.getPropertyValue("border-top-width")),Pe=y.map(function(Je){return"".concat(Je,":").concat(pe.getPropertyValue(Je))}).join(";"),Se={sizingStyle:Pe,paddingSize:de,borderSize:Ee,boxSizing:se};return he&&fe&&(P[fe]=Se),Se}function W(ce){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,pe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;M||(M=document.createElement("textarea"),M.setAttribute("tab-index","-1"),M.setAttribute("aria-hidden","true"),document.body.appendChild(M)),ce.getAttribute("wrap")?M.setAttribute("wrap",ce.getAttribute("wrap")):M.removeAttribute("wrap");var se=j(ce,he),de=se.paddingSize,Ee=se.borderSize,Pe=se.boxSizing,Se=se.sizingStyle;M.setAttribute("style","".concat(Se,";").concat(m)),M.value=ce.value||ce.placeholder||"";var Je=Number.MIN_SAFE_INTEGER,qe=Number.MAX_SAFE_INTEGER,Ae=M.scrollHeight,we;if(Pe==="border-box"?Ae+=Ee:Pe==="content-box"&&(Ae-=de),fe!==null||pe!==null){M.value=" ";var De=M.scrollHeight-de;fe!==null&&(Je=De*fe,Pe==="border-box"&&(Je=Je+de+Ee),Ae=Math.max(Je,Ae)),pe!==null&&(qe=De*pe,Pe==="border-box"&&(qe=qe+de+Ee),we=Ae>qe?"":"hidden",Ae=Math.min(qe,Ae))}return{height:Ae,minHeight:Je,maxHeight:qe,overflowY:we,resize:"none"}}var N=Q("Gytx"),w=Q.n(N),G;(function(ce){ce[ce.NONE=0]="NONE",ce[ce.RESIZING=1]="RESIZING",ce[ce.RESIZED=2]="RESIZED"})(G||(G={}));var J=function(ce){Object(H.a)(fe,ce);var he=Object(k.a)(fe);function fe(pe){var se;return Object(V.a)(this,fe),se=he.call(this,pe),se.nextFrameActionId=void 0,se.resizeFrameId=void 0,se.textArea=void 0,se.saveTextArea=function(de){se.textArea=de},se.handleResize=function(de){var Ee=se.state.resizeStatus,Pe=se.props,Se=Pe.autoSize,Je=Pe.onResize;if(Ee!==G.NONE)return;typeof Je=="function"&&Je(de),Se&&se.resizeOnNextFrame()},se.resizeOnNextFrame=function(){cancelAnimationFrame(se.nextFrameActionId),se.nextFrameActionId=requestAnimationFrame(se.resizeTextarea)},se.resizeTextarea=function(){var de=se.props.autoSize;if(!de||!se.textArea)return;var Ee=de.minRows,Pe=de.maxRows,Se=W(se.textArea,!1,Ee,Pe);se.setState({textareaStyles:Se,resizeStatus:G.RESIZING},function(){cancelAnimationFrame(se.resizeFrameId),se.resizeFrameId=requestAnimationFrame(function(){se.setState({resizeStatus:G.RESIZED},function(){se.resizeFrameId=requestAnimationFrame(function(){se.setState({resizeStatus:G.NONE}),se.fixFirefoxAutoScroll()})})})})},se.renderTextArea=function(){var de=se.props,Ee=de.prefixCls,Pe=Ee===void 0?"rc-textarea":Ee,Se=de.autoSize,Je=de.onResize,qe=de.className,Ae=de.disabled,we=se.state,De=we.textareaStyles,Xe=we.resizeStatus,We=Object(v.a)(se.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ce=_()(Pe,qe,Object(U.a)({},"".concat(Pe,"-disabled"),Ae));"value"in We&&(We.value=We.value||"");var Oe=Object(B.a)(Object(B.a)(Object(B.a)({},se.props.style),De),Xe===G.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return C.createElement(b,{onResize:se.handleResize,disabled:!(Se||Je)},C.createElement("textarea",Object(ee.a)({},We,{className:Ce,style:Oe,ref:se.saveTextArea})))},se.state={textareaStyles:{},resizeStatus:G.NONE},se}return Object(I.a)(fe,[{key:"componentDidUpdate",value:function(se){(se.value!==this.props.value||!w()(se.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var se=this.textArea.selectionStart,de=this.textArea.selectionEnd;this.textArea.setSelectionRange(se,de)}}catch(Ee){}}},{key:"render",value:function(){return this.renderTextArea()}}]),fe}(C.Component),Z=J,ae=function(ce){Object(H.a)(fe,ce);var he=Object(k.a)(fe);function fe(pe){var se;Object(V.a)(this,fe),se=he.call(this,pe),se.resizableTextArea=void 0,se.focus=function(){se.resizableTextArea.textArea.focus()},se.saveTextArea=function(Ee){se.resizableTextArea=Ee},se.handleChange=function(Ee){var Pe=se.props.onChange;se.setValue(Ee.target.value,function(){se.resizableTextArea.resizeTextarea()}),Pe&&Pe(Ee)},se.handleKeyDown=function(Ee){var Pe=se.props,Se=Pe.onPressEnter,Je=Pe.onKeyDown;Ee.keyCode===13&&Se&&Se(Ee),Je&&Je(Ee)};var de=typeof pe.value=="undefined"||pe.value===null?pe.defaultValue:pe.value;return se.state={value:de},se}return Object(I.a)(fe,[{key:"setValue",value:function(se,de){"value"in this.props||this.setState({value:se},de)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return C.createElement(Z,Object(ee.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(se){return"value"in se?{value:se.value}:null}}]),fe}(C.Component),_e=Qe.default=ae},ZW9T:function(st,Qe,Q){"use strict";Q.d(Qe,"a",function(){return W});var ee=Q("k1fw"),V=Q("miYZ"),I=Q("tsqr"),H=Q("rAM+"),k=Q("tJVT"),C=Q("PpiC"),B=Q("cDcd"),U=Q.n(B),D=Q("bdgK"),L=Q("oBTY"),g=Q("9og8"),p=Q("WmNS"),f=Q.n(p),d={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},a={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},c={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"#include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},o={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},s=Q("5VLF"),l=Q.n(s),h={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},R=function(w,G){return G.map(function(J){return{label:J,kind:w.languages.CompletionItemKind.Keyword,insertText:J}})},x=function(w){return Object.keys(h.tables).map(function(G){return{label:G,kind:w.languages.CompletionItemKind.Variable,insertText:G}})},T=function(w,G){var J=h.tables[w];return J?J.map(function(Z){return{label:Z,kind:G.languages.CompletionItemKind.Field,insertText:Z}}):[]};function O(N,w,G,J,Z){var ae=w.getWordUntilPosition(G),_e={startLineNumber:G.lineNumber,endLineNumber:G.lineNumber,startColumn:ae.startColumn,endColumn:ae.endColumn},ce=J.map(function(he){return{label:he,kind:N.languages.CompletionItemKind.Keyword,insertText:he,insertTextRules:N.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:_e}});return Z.map(function(he){ce.push(Object(ee.a)(Object(ee.a)({},he),{},{range:_e}))}),ce}var S=function(N){h.languages.map(function(Z){return N.languages.registerDocumentFormattingEditProvider(Z,{provideDocumentFormattingEdits:function(_e,ce,he){return Object(g.a)(f.a.mark(function fe(){var pe;return f.a.wrap(function(de){for(;;)switch(de.prev=de.next){case 0:return pe=l()(_e.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),de.abrupt("return",[{range:_e.getFullModelRange(),text:pe}]);case 2:case"end":return de.stop()}},fe)}))()}}),Z});var w=c.quickKey.map(function(Z){return{label:Z.label,kind:N.languages.CompletionItemKind.Method,insertText:Z.content,insertTextRules:N.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),G=o.quickKey.map(function(Z){return{label:Z.label,kind:N.languages.CompletionItemKind.Method,insertText:Z.content,insertTextRules:N.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),J=a.quickKey.map(function(Z){return{label:Z.label,kind:N.languages.CompletionItemKind.Method,insertText:Z.content,insertTextRules:N.languages.CompletionItemInsertTextRule.InsertAsSnippet}});N.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(L.a)(c.keywords),Object(L.a)(c.quickKey.map(function(Z){return Z.label}))),provideCompletionItems:function(ae,_e){var ce=ae.getValueInRange({startLineNumber:_e.lineNumber,startColumn:1,endLineNumber:_e.lineNumber,endColumn:_e.column}),he=ce.match(/cu/gim);console.log("match:",he,_e,ce,ae);var fe=[],pe=_e.lineNumber,se=_e.column,de=ae.getValueInRange({startLineNumber:pe,startColumn:0,endLineNumber:pe,endColumn:se}),Ee=de.trim().split(/\s+/),Pe=Ee[Ee.length-1];if(Pe.endsWith(".")){var Se=Pe.slice(0,Pe.length-1);Object.keys(h.tables).includes(Se)&&(fe=Object(L.a)(T(Se,N)))}else Pe==="."?fe=[]:fe=[].concat(Object(L.a)(x(N)),Object(L.a)(R(N,c.keywords)),Object(L.a)(w));return{suggestions:fe}}}),N.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(L.a)(d.keywords)),provideCompletionItems:function(ae,_e){var ce=ae.getValueInRange({startLineNumber:_e.lineNumber,startColumn:1,endLineNumber:_e.lineNumber,endColumn:_e.column}),he=ce.match(/cu/gim);console.log("match:",he,_e,ce,ae);var fe=[],pe=_e.lineNumber,se=_e.column,de=ae.getValueInRange({startLineNumber:pe,startColumn:0,endLineNumber:pe,endColumn:se}),Ee=de.trim().split(/\s+/),Pe=Ee[Ee.length-1];if(Pe.endsWith(".")){var Se=Pe.slice(0,Pe.length-1);Object.keys(h.tables).includes(Se)&&(fe=Object(L.a)(T(Se,N)))}else Pe==="."?fe=[]:fe=[].concat(Object(L.a)(x(N)),Object(L.a)(R(N,d.keywords)));return{suggestions:fe}}}),N.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(L.a)(a.keywords)),provideCompletionItems:function(ae,_e){var ce=[],he=_e.lineNumber,fe=_e.column,pe=ae.getValueInRange({startLineNumber:he,startColumn:0,endLineNumber:he,endColumn:fe}),se=pe.trim().split(/\s+/),de=se[se.length-1];if(de.endsWith(".")){var Ee=de.slice(0,de.length-1);Object.keys(h.tables).includes(Ee)&&(ce=Object(L.a)(T(Ee,N)))}else de==="."?ce=[]:ce=[].concat(Object(L.a)(x(N)),Object(L.a)(R(N,a.keywords)),Object(L.a)(J));return{suggestions:ce}}}),N.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(L.a)(o.keywords)),provideCompletionItems:function(ae,_e){var ce=[],he=_e.lineNumber,fe=_e.column,pe=ae.getValueInRange({startLineNumber:he,startColumn:0,endLineNumber:he,endColumn:fe}),se=pe.trim().split(/\s+/),de=se[se.length-1];if(de.endsWith(".")){var Ee=de.slice(0,de.length-1);Object.keys(h.tables).includes(Ee)&&(ce=Object(L.a)(T(Ee,N)))}else de==="."?ce=[]:ce=[].concat(Object(L.a)(x(N)),Object(L.a)(R(N,o.keywords)),Object(L.a)(G));return{suggestions:ce}}})},E="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",b=Q("LvDl"),v=Q("+ua5");function u(N){return/^\d+$/.test(N)?"".concat(N,"px"):N}function _(){}var m=!1,y={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function P(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],w=N;if(Array.isArray(N)){for(var G=0;G<N.length;G++){var J=y[N[G]];if(J)return J}return w[0]}return y[w]||w}var M=null,j=Qe.b=function(N){var w=N.width,G=w===void 0?"100%":w,J=N.height,Z=J===void 0?"100%":J,ae=N.value,_e=N.language,ce=_e===void 0?"javascript":_e,he=N.style,fe=he===void 0?{}:he,pe=N.options,se=pe===void 0?{}:pe,de=N.overrideServices,Ee=de===void 0?{}:de,Pe=N.theme,Se=Pe===void 0?"vs-dark":Pe,Je=N.onEditBlur,qe=N.onSave,Ae=N.autoHeight,we=Ae===void 0?!1:Ae,De=N.forbidCopy,Xe=De===void 0?!1:De,We=N.onChange,Ce=We===void 0?_:We,Oe=N.editorDidMount,et=Oe===void 0?_:Oe,Me=N.onFocus,Le=Me===void 0?_:Me,Ue=N.filename,Ge=Ue===void 0?"educoder.txt":Ue,Fe=N.errorLine,ze=N.errorContent,be=ze===void 0?"":ze,Ke=Object(C.a)(N,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),He=Object(B.useRef)(),ve=Object(B.useRef)({}),Re=Object(B.useRef)(),ue=Object(B.useRef)(!1),ie=Object(B.useRef)(),te=Object(B.useState)(!1),$=Object(k.a)(te,2),X=$[0],q=$[1];function ne(){var ft;return He.current&&(ft=new D.default(function(dt){var At=Object(H.a)(dt),Nt;try{for(At.s();!(Nt=At.n()).done;){var Wt=Nt.value;(Wt.target.offsetHeight>0||Wt.target.offsetWidth>0)&&ve.current.instance.layout()}}catch(Pn){At.e(Pn)}finally{At.f()}}),ft.observe(He.current)),ft}function le(){I.b.warn(decodeURIComponent(E))}var ye=function(){var dt=ve.current.instance;if(ae!=null&&dt&&X){var At=dt.getModel();At&&ae!==At.getValue()&&(m=!0,At.setValue(ae),dt.layout(),m=!1)}};Object(B.useEffect)(function(){Re.current&&clearTimeout(Re.current),Re.current=setTimeout(function(){ye()},500)},[ae,X,ve.current]),Object(B.useEffect)(function(){if(Fe&&ve.current&&ve.current.instance){var ft=ve.current.instance;ft.changeViewZones(function(At){var Nt=document.createElement("div");Nt.style.padding="10px 20px",Nt.style.width="calc(100% - 20px)",Nt.className="my-error-line-wrp",Nt.innerHTML=be,At.addZone({afterLineNumber:Fe||11,heightInLines:3,domNode:Nt})});var dt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};ft.addOverlayWidget(dt),ft.revealPositionInCenter({lineNumber:20,column:1})}},[Fe,ve.current,X]);function Te(){var ft=ve.current.instance;if(ft){var dt=ft.getSelection(),At=ve.current.pastePos||{},Nt=new M.Range(At.startLineNumber||dt.endLineNumber,At.startColumn||dt.endColumn,At.endLineNumber||dt.endLineNumber,At.endColumn||dt.endColumn);setTimeout(function(){ft.executeEdits("",[{range:Nt,text:""}])},300)}}function ke(ft){(window.navigator.platform.match("Mac")?ft.metaKey:ft.ctrlKey)&&ft.keyCode==83&&(ft.preventDefault(),qe())}var rt=function(){if(we&&ve.current.instance){var dt=ve.current.instance.getContentHeight();nn(dt<Z?Z:dt)}else nn(Z)};function nt(ft){var dt=document.createEvent("MouseEvents");dt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ft.dispatchEvent(dt)}function xt(ft,dt){var At=window.URL||window.webkitURL||window,Nt=new Blob([dt]),Wt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Wt.href=At.createObjectURL(Nt),Wt.download=ft,nt(Wt)}Object(B.useEffect)(function(){rt()},[rt]),Object(B.useEffect)(function(){He.current&&!X&&Q.e(27).then(Q.t.bind(null,"M/lh",7)).then(function(ft){try{M=ft,ve.current.instance=M.editor.create(He.current,{value:ae,language:P(ce),theme:Se,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Ee);var dt=ve.current.instance;if(et(dt,M),setTimeout(function(){rt(),ve.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){xt(Ge||"educoder.txt",dt.getValue())}})},500),ve.current.subscription=dt.onDidChangeModelContent(function(Nt){ue.current?clearTimeout(ie.current):(rt(),Ce(dt.getValue(),Nt)),ie.current=setTimeout(function(){ue.current=!1},500)}),window.Monaco||S(M),Xe&&(dt.addCommand(M.KeyMod.CtrlCmd|M.KeyMod.Shift|M.KeyCode.KEY_V,function(){return le(),null}),dt.addCommand(M.KeyMod.CtrlCmd|M.KeyCode.KEY_C,function(){return le(),null})),window.Monaco=M,Je&&dt.onDidBlurEditorWidget(function(){Je(dt.getValue())}),Le&&dt.onDidFocusEditorText(function(){Le(dt.getValue())}),Xe){dt.addCommand(M.KeyMod.CtrlCmd|M.KeyCode.KEY_V,function(){return le(),null}),dt.onDidPaste(function(Nt){ve.current.pastePos=Nt});try{window.addEventListener("paste",Te)}catch(Nt){}}var At=ne();return q(!0),function(){var Nt=ve.current.instance;Nt.dispose();var Wt=Nt.getModel();Wt&&Wt.dispose(),ve.current.subscription&&ve.current.subscription.dispose(),Xe&&window.removeEventListener("paste",Te),At.unobserve(He.current)}}catch(Nt){}})},[]),Object(B.useEffect)(function(){var ft=ve.current.instance;if(ft&&X)return document.addEventListener("keydown",ke,!1),function(){document.removeEventListener("keydown",ke)}},[qe,X]),Object(B.useEffect)(function(){var ft=ve.current.instance;if(ft&&X){var dt=P(ce);M.editor.setModelLanguage(ft.getModel(),dt),console.log("language:",ce,ft.getModel(),dt)}},[ce,X]),Object(B.useEffect)(function(){var ft=ve.current.instance;ft&&X&&M.editor.setTheme(Se)},[Se,X]),Object(B.useEffect)(function(){var ft=ve.current.instance;ft&&X&&(ft.updateOptions(Object(ee.a)({},se)),setTimeout(function(){ft.getModel().updateOptions(Object(ee.a)({},se))},200))},[JSON.stringify(se),X]),Object(B.useEffect)(function(){var ft=ve.current.instance;ft&&X&&ft.layout()},[G,Z,X]);var ht=Object(B.useState)(u(G)),Ve=Object(k.a)(ht,2),mt=Ve[0],ot=Ve[1],Rt=Object(B.useState)(u(Z)),bt=Object(k.a)(Rt,2),gt=bt[0],nn=bt[1],zt=Object(ee.a)(Object(ee.a)({},fe),{},{width:mt,height:gt});return U.a.createElement("div",{className:"my-monaco-editor",ref:He,style:zt})};function W(N){var w=N.width,G=w===void 0?"100%":w,J=N.height,Z=J===void 0?"100%":J,ae=N.original,_e=N.modified,ce=N.language,he=N.options,fe=he===void 0?{}:he,pe=Object(B.useRef)(),se=Object(B.useState)(null),de=Object(k.a)(se,2),Ee=de[0],Pe=de[1];function Se(we){var De;return pe.current&&(De=new D.default(function(Xe){var We=Object(H.a)(Xe),Ce;try{for(We.s();!(Ce=We.n()).done;){var Oe=Ce.value;(Oe.target.offsetHeight>0||Oe.target.offsetWidth>0)&&we.layout()}}catch(et){We.e(et)}finally{We.f()}}),De.observe(pe.current)),De}Object(B.useEffect)(function(){pe.current&&Q.e(27).then(Q.t.bind(null,"M/lh",7)).then(function(we){M=we;var De=M.editor.createDiffEditor(pe.current,Object(ee.a)(Object(ee.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},fe),{},{wordWrap:!0}));Pe(De);var Xe=Se(De);return function(){De.dispose();var We=De.getModel();We&&We.dispose(),Xe.unobserve(pe.current)}})},[]),Object(B.useEffect)(function(){Ee&&Ee.setModel({original:M.editor.createModel(ae,ce),modified:M.editor.createModel(_e,ce)})},[ae,_e,ce,Ee]);var Je=u(G),qe=u(Z),Ae={width:Je,height:qe};return U.a.createElement("div",{className:"my-diff-editor",ref:pe,style:Ae})}},ZpRC:function(st,Qe,Q){"use strict";function ee(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function V(g,p){return(!p||g!=="hidden")&&g!=="visible"&&g!=="clip"}function I(g,p){if(g.clientHeight<g.scrollHeight||g.clientWidth<g.scrollWidth){var f=getComputedStyle(g,null);return V(f.overflowY,p)||V(f.overflowX,p)||function(d){var a=function(c){if(!c.ownerDocument||!c.ownerDocument.defaultView)return null;try{return c.ownerDocument.defaultView.frameElement}catch(o){return null}}(d);return!!a&&(a.clientHeight<d.scrollHeight||a.clientWidth<d.scrollWidth)}(g)}return!1}function H(g,p,f,d,a,c,o,s){return c<g&&o>p||c>g&&o<p?0:c<=g&&s<=f||o>=p&&s>=f?c-g-d:o>p&&s<f||c<g&&s>f?o-p+a:0}var k=function(g,p){var f=window,d=p.scrollMode,a=p.block,c=p.inline,o=p.boundary,s=p.skipOverflowHiddenElements,l=typeof o=="function"?o:function(De){return De!==o};if(!ee(g))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,R=[],x=g;ee(x)&&l(x);){if((x=x.parentElement)===h){R.push(x);break}x!=null&&x===document.body&&I(x)&&!I(document.documentElement)||x!=null&&I(x,s)&&R.push(x)}for(var T=f.visualViewport?f.visualViewport.width:innerWidth,O=f.visualViewport?f.visualViewport.height:innerHeight,S=window.scrollX||pageXOffset,E=window.scrollY||pageYOffset,b=g.getBoundingClientRect(),v=b.height,u=b.width,_=b.top,m=b.right,y=b.bottom,P=b.left,M=a==="start"||a==="nearest"?_:a==="end"?y:_+v/2,j=c==="center"?P+u/2:c==="end"?m:P,W=[],N=0;N<R.length;N++){var w=R[N],G=w.getBoundingClientRect(),J=G.height,Z=G.width,ae=G.top,_e=G.right,ce=G.bottom,he=G.left;if(d==="if-needed"&&_>=0&&P>=0&&y<=O&&m<=T&&_>=ae&&y<=ce&&P>=he&&m<=_e)return W;var fe=getComputedStyle(w),pe=parseInt(fe.borderLeftWidth,10),se=parseInt(fe.borderTopWidth,10),de=parseInt(fe.borderRightWidth,10),Ee=parseInt(fe.borderBottomWidth,10),Pe=0,Se=0,Je="offsetWidth"in w?w.offsetWidth-w.clientWidth-pe-de:0,qe="offsetHeight"in w?w.offsetHeight-w.clientHeight-se-Ee:0;if(h===w)Pe=a==="start"?M:a==="end"?M-O:a==="nearest"?H(E,E+O,O,se,Ee,E+M,E+M+v,v):M-O/2,Se=c==="start"?j:c==="center"?j-T/2:c==="end"?j-T:H(S,S+T,T,pe,de,S+j,S+j+u,u),Pe=Math.max(0,Pe+E),Se=Math.max(0,Se+S);else{Pe=a==="start"?M-ae-se:a==="end"?M-ce+Ee+qe:a==="nearest"?H(ae,ce,J,se,Ee+qe,M,M+v,v):M-(ae+J/2)+qe/2,Se=c==="start"?j-he-pe:c==="center"?j-(he+Z/2)+Je/2:c==="end"?j-_e+de+Je:H(he,_e,Z,pe,de+Je,j,j+u,u);var Ae=w.scrollLeft,we=w.scrollTop;M+=we-(Pe=Math.max(0,Math.min(we+Pe,w.scrollHeight-J+qe))),j+=Ae-(Se=Math.max(0,Math.min(Ae+Se,w.scrollWidth-Z+Je)))}W.push({el:w,top:Pe,left:Se})}return W};function C(g){return g===Object(g)&&Object.keys(g).length!==0}function B(g,p){p===void 0&&(p="auto");var f="scrollBehavior"in document.body.style;g.forEach(function(d){var a=d.el,c=d.top,o=d.left;a.scroll&&f?a.scroll({top:c,left:o,behavior:p}):(a.scrollTop=c,a.scrollLeft=o)})}function U(g){return g===!1?{block:"end",inline:"nearest"}:C(g)?g:{block:"start",inline:"nearest"}}function D(g,p){var f=!g.ownerDocument.documentElement.contains(g);if(C(p)&&typeof p.behavior=="function")return p.behavior(f?[]:k(g,p));if(f)return;var d=U(p);return B(k(g,d),d.behavior)}var L=Qe.a=D},bT9E:function(st,Qe,Q){"use strict";Q.d(Qe,"a",function(){return V});var ee=Q("VTBJ");function V(I,H){var k=Object(ee.a)({},I);return Array.isArray(H)&&H.forEach(function(C){delete k[C]}),k}},c5Ni:function(st,Qe,Q){},dejd:function(st,Qe,Q){},dmUQ:function(st,Qe,Q){"use strict";var ee=Q("Ff2n"),V=Q("rePB"),I=Q("1OyB"),H=Q("vuIU"),k=Q("Ji7U"),C=Q("md7G"),B=Q("foSv"),U=Q("cDcd"),D=Q.n(U),L=Q("TSYQ"),g=Q.n(L),p=Q("4IlW");function f(v,u){var _=Object.keys(v);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(v);u&&(m=m.filter(function(y){return Object.getOwnPropertyDescriptor(v,y).enumerable})),_.push.apply(_,m)}return _}function d(v){for(var u=1;u<arguments.length;u++){var _=arguments[u]!=null?arguments[u]:{};u%2?f(Object(_),!0).forEach(function(m){Object(V.a)(v,m,_[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(_)):f(Object(_)).forEach(function(m){Object.defineProperty(v,m,Object.getOwnPropertyDescriptor(_,m))})}return v}function a(v){var u=c();return function(){var m=Object(B.a)(v),y;if(u){var P=Object(B.a)(this).constructor;y=Reflect.construct(m,arguments,P)}else y=m.apply(this,arguments);return Object(C.a)(this,y)}}function c(){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(v){return!1}}function o(){}function s(v){v.preventDefault()}var l=function(u){return u.replace(/[^\w.-]+/g,"")},h=200,R=600,x=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,T=function(u){return u!=null},O=function(u,_){return _===u||typeof _=="number"&&typeof u=="number"&&isNaN(_)&&isNaN(u)},S=function(v){Object(k.a)(_,v);var u=a(_);function _(m){var y;Object(I.a)(this,_),y=u.call(this,m),y.onKeyDown=function(j){var W=y.props,N=W.onKeyDown,w=W.onPressEnter;if(j.keyCode===p.a.UP){var G=y.getRatio(j);y.up(j,G,null),y.stop()}else if(j.keyCode===p.a.DOWN){var J=y.getRatio(j);y.down(j,J,null),y.stop()}else j.keyCode===p.a.ENTER&&w&&w(j);if(y.recordCursorPosition(),y.lastKeyCode=j.keyCode,N){for(var Z=arguments.length,ae=new Array(Z>1?Z-1:0),_e=1;_e<Z;_e++)ae[_e-1]=arguments[_e];N.apply(void 0,[j].concat(ae))}},y.onKeyUp=function(j){var W=y.props.onKeyUp;if(y.stop(),y.recordCursorPosition(),W){for(var N=arguments.length,w=new Array(N>1?N-1:0),G=1;G<N;G++)w[G-1]=arguments[G];W.apply(void 0,[j].concat(w))}},y.onChange=function(j){var W=y.props.onChange;y.state.focused&&(y.inputting=!0),y.rawInput=y.props.parser(y.getValueFromEvent(j)),y.setState({inputValue:y.rawInput}),W(y.toNumber(y.rawInput))},y.onMouseUp=function(){var j=y.props.onMouseUp;y.recordCursorPosition(),j&&j.apply(void 0,arguments)},y.onFocus=function(){var j;y.setState({focused:!0}),(j=y.props).onFocus.apply(j,arguments)},y.onBlur=function(){var j=y.props.onBlur;y.inputting=!1,y.setState({focused:!1});var W=y.getCurrentValidValue(y.state.inputValue),N=y.setValue(W,o);if(j){var w=y.input.value,G=y.getInputDisplayValue({focus:!1,value:N});y.input.value=G&&Number(G),j.apply(void 0,arguments),y.input.value=w}},y.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},y.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},y.getPrecision=function(j){if(T(y.props.precision))return y.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var N=0;return W.indexOf(".")>=0&&(N=W.length-W.indexOf(".")-1),N},y.getInputDisplayValue=function(j){var W=j||y.state,N=W.focused,w=W.inputValue,G=W.value,J;N?J=w:J=y.toPrecisionAsStep(G),J==null&&(J="");var Z=y.formatWrapper(J);return T(y.props.decimalSeparator)&&(Z=Z.toString().replace(".",y.props.decimalSeparator)),Z},y.recordCursorPosition=function(){try{y.cursorStart=y.input.selectionStart,y.cursorEnd=y.input.selectionEnd,y.currentValue=y.input.value,y.cursorBefore=y.input.value.substring(0,y.cursorStart),y.cursorAfter=y.input.value.substring(y.cursorEnd)}catch(j){}},y.restoreByAfter=function(j){if(j===void 0)return!1;var W=y.input.value,N=W.lastIndexOf(j);if(N===-1)return!1;var w=y.cursorBefore.length;return y.lastKeyCode===p.a.DELETE&&y.cursorBefore.charAt(w-1)===j[0]?(y.fixCaret(w,w),!0):N+j.length===W.length?(y.fixCaret(N,N),!0):!1},y.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,N){var w=j.substring(N);return y.restoreByAfter(w)})},y.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},y.stop=function(){y.autoStepTimer&&clearTimeout(y.autoStepTimer)},y.down=function(j,W,N){y.pressingUpOrDown=!0,y.step("down",j,W,N)},y.up=function(j,W,N){y.pressingUpOrDown=!0,y.step("up",j,W,N)},y.saveInput=function(j){y.input=j};var P=m.value;P===void 0&&(P=m.defaultValue),y.state={focused:m.autoFocus};var M=y.getValidValue(y.toNumber(P));return y.state=d(d({},y.state),{},{inputValue:y.toPrecisionAsStep(M),value:M}),y}return Object(H.a)(_,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(y){var P=this.props,M=P.value,j=P.onChange,W=P.max,N=P.min,w=this.state.focused;if(y){if(!O(y.value,M)||!O(y.max,W)||!O(y.min,N)){var G=w?M:this.getValidValue(M),J;this.pressingUpOrDown?J=G:this.inputting?J=this.rawInput:J=this.toPrecisionAsStep(G),this.setState({value:G,inputValue:J})}var Z="value"in this.props?M:this.state.value;"max"in this.props&&y.max!==W&&typeof Z=="number"&&Z>W&&j&&j(W),"min"in this.props&&y.min!==N&&typeof Z=="number"&&Z<N&&j&&j(N)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ae=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?ae=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(ae=this.cursorStart):ae=this.input.value.length,this.fixCaret(ae,ae)}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(_e){}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(y){var P=y;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(y){var P=y.target.value.trim().replace(/。/g,".");return T(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(y){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(y);return isNaN(j)?y:(j<P&&(j=P),j>M&&(j=M),j)}},{key:"setValue",value:function(y,P){var M=this.props.precision,j=this.isNotCompleteNumber(parseFloat(y))?null:parseFloat(y),W=this.state.value,N=W===void 0?null:W,w=this.state.inputValue,G=w===void 0?null:w,J=typeof j=="number"?j.toFixed(M):"".concat(j),Z=j!==N||J!=="".concat(G);return"value"in this.props?(G=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:G},P)):this.setState({value:j,inputValue:this.toPrecisionAsStep(y)},P),Z&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(y){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,M=this.props,j=M.precision,W=M.step;if(T(j))return j;var N=this.getPrecision(P),w=this.getPrecision(W),G=this.getPrecision(y);return y?Math.max(G,N+w):N+w}},{key:"getPrecisionFactor",value:function(y){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,M=this.getMaxPrecision(y,P);return Math.pow(10,M)}},{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(y){return this.props.formatter?this.props.formatter(y):y}},{key:"toPrecisionAsStep",value:function(y){if(this.isNotCompleteNumber(y)||y==="")return y;var P=Math.abs(this.getMaxPrecision(y));return isNaN(P)?y.toString():Number(y).toFixed(P)}},{key:"toNumber",value:function(y){var P=this.props.precision,M=this.state.focused,j=y&&y.length>16&&M;return this.isNotCompleteNumber(y)||j?y:T(P)?Math.round(y*Math.pow(10,P))/Math.pow(10,P):Number(y)}},{key:"upStep",value:function(y,P){var M=this.props.step,j=this.getPrecisionFactor(y,P),W=Math.abs(this.getMaxPrecision(y,P)),N=((j*y+j*M*P)/j).toFixed(W);return this.toNumber(N)}},{key:"downStep",value:function(y,P){var M=this.props.step,j=this.getPrecisionFactor(y,P),W=Math.abs(this.getMaxPrecision(y,P)),N=((j*y-j*M*P)/j).toFixed(W);return this.toNumber(N)}},{key:"step",value:function(y,P){var M=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var N=this.props;if(N.disabled)return;var w=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(w))return;var G=this["".concat(y,"Step")](w,j),J=G>N.max||G<N.min;if(G>N.max?G=N.max:G<N.min&&(G=N.min),this.setValue(G,null),this.setState({focused:!0},function(){M.pressingUpOrDown=!1}),J)return;this.autoStepTimer=setTimeout(function(){M[y](P,j,!0)},W?h:R)}},{key:"fixCaret",value:function(y,P){if(y===void 0||P===void 0||!this.input||!this.input.value)return;try{var M=this.input.selectionStart,j=this.input.selectionEnd;(y!==M||P!==j)&&this.input.setSelectionRange(y,P)}catch(W){}}},{key:"render",value:function(){var y,P=this.props,M=P.prefixCls,j=P.disabled,W=P.readOnly,N=P.useTouch,w=P.autoComplete,G=P.upHandler,J=P.downHandler,Z=P.className,ae=P.max,_e=P.min,ce=P.style,he=P.title,fe=P.onMouseEnter,pe=P.onMouseLeave,se=P.onMouseOver,de=P.onMouseOut,Ee=P.required,Pe=P.onClick,Se=P.tabIndex,Je=P.type,qe=P.placeholder,Ae=P.id,we=P.inputMode,De=P.pattern,Xe=P.step,We=P.maxLength,Ce=P.autoFocus,Oe=P.name,et=P.onPaste,Me=P.onInput,Le=Object(ee.a)(P,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ue=this.state,Ge=Ue.value,Fe=Ue.focused,ze=g()(M,(y={},Object(V.a)(y,Z,!!Z),Object(V.a)(y,"".concat(M,"-disabled"),j),Object(V.a)(y,"".concat(M,"-focused"),Fe),y)),be={};Object.keys(Le).forEach(function(ne){(ne.substr(0,5)==="data-"||ne.substr(0,5)==="aria-"||ne==="role")&&(be[ne]=Le[ne])});var Ke=!W&&!j,He=this.getInputDisplayValue(null),ve=(Ge||Ge===0)&&(isNaN(Ge)||Number(Ge)>=ae),Re=(Ge||Ge===0)&&(isNaN(Ge)||Number(Ge)<=_e),ue=ve||j||W,ie=Re||j||W,te=g()("".concat(M,"-handler"),"".concat(M,"-handler-up"),Object(V.a)({},"".concat(M,"-handler-up-disabled"),ue)),$=g()("".concat(M,"-handler"),"".concat(M,"-handler-down"),Object(V.a)({},"".concat(M,"-handler-down-disabled"),ie)),X=N?{onTouchStart:ue?o:this.up,onTouchEnd:this.stop}:{onMouseDown:ue?o:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},q=N?{onTouchStart:ie?o:this.down,onTouchEnd:this.stop}:{onMouseDown:ie?o:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return D.a.createElement("div",{className:ze,style:ce,title:he,onMouseEnter:fe,onMouseLeave:pe,onMouseOver:se,onMouseOut:de,onFocus:function(){return null},onBlur:function(){return null}},D.a.createElement("div",{className:"".concat(M,"-handler-wrap")},D.a.createElement("span",Object.assign({unselectable:"on"},X,{role:"button","aria-label":"Increase Value","aria-disabled":ue,className:te}),G||D.a.createElement("span",{unselectable:"on",className:"".concat(M,"-handler-up-inner"),onClick:s})),D.a.createElement("span",Object.assign({unselectable:"on"},q,{role:"button","aria-label":"Decrease Value","aria-disabled":ie,className:$}),J||D.a.createElement("span",{unselectable:"on",className:"".concat(M,"-handler-down-inner"),onClick:s}))),D.a.createElement("div",{className:"".concat(M,"-input-wrap")},D.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":_e,"aria-valuemax":ae,"aria-valuenow":Ge,required:Ee,type:Je,placeholder:qe,onPaste:et,onClick:Pe,onMouseUp:this.onMouseUp,className:"".concat(M,"-input"),tabIndex:Se,autoComplete:w,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ke?this.onKeyDown:o,onKeyUp:Ke?this.onKeyUp:o,autoFocus:Ce,maxLength:We,readOnly:W,disabled:j,max:ae,min:_e,step:Xe,name:Oe,title:he,id:Ae,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(He),pattern:De,inputMode:we,onInput:Me},be))))}}]),_}(D.a.Component);S.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:x,min:-x,step:1,style:{},onChange:o,onKeyDown:o,onPressEnter:o,onFocus:o,onBlur:o,parser:l,required:!1,autoComplete:"off"};var E=S,b=Qe.a=E},kSUc:function(st,Qe,Q){},"kaH+":function(st,Qe,Q){"use strict";var ee=Q("+L6B"),V=Q("2/Rp"),I=Q("tJVT"),H=Q("cDcd"),k=Q.n(H),C=Q("UZu5"),B=Q.n(C),U=Q("dhSg"),D=Q("rLCj"),L=Q("dF/Y"),g=Q("4i/N");Qe.a=function(){var p=Object(H.useState)(""),f=Object(I.a)(p,2),d=f[0],a=f[1],c=Object(H.useState)(0),o=Object(I.a)(c,2),s=o[0],l=o[1],h=Object(H.useRef)("");Object(H.useEffect)(function(){var b=U.a.subscribe("preview-image",function(v){a(v),document.body.style.overflow="hidden"});return b},[]),Object(H.useEffect)(function(){return document.addEventListener("keydown",R),function(){document.removeEventListener("keydown",R)}},[]),Object(H.useEffect)(function(){h.current=d},[d]);function R(b){b.keyCode==27&&h.current&&x()}function x(){document.body.style.overflow="auto",a("")}function T(){l(s+90)}var O=Object(H.useRef)(),S=Object(H.useRef)(),E=function(v){(v.nativeEvent.target===O.current||v.nativeEvent.target===S.current)&&x()};return k.a.createElement(H.Fragment,null,d?k.a.createElement("div",{className:"image-preview-container",ref:O,onClick:E},k.a.createElement("div",{className:"button-group"},k.a.createElement(V.a,{onClick:T},"\u65CB\u8F6C",k.a.createElement(D.a,null)),k.a.createElement(V.a,{href:d},"\u4E0B\u8F7D",k.a.createElement(L.a,null)),k.a.createElement(V.a,{onClick:x},"\u5173\u95ED",k.a.createElement(g.a,null))),k.a.createElement("div",{className:"preview-wrp-group",ref:S},k.a.createElement("img",{className:"image-preview",src:d,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(s,"deg)")}}))):null)}},lZu9:function(st,Qe,Q){(function(ee){ee(Q("VrN/"),Q("1eCo"),Q("8EBN"))})(function(ee){"use strict";ee.defineMode("markdown",function(V,I){var H=ee.getMode(V,"text/html"),k=H.name=="null";function C(N){if(ee.findModeByName){var w=ee.findModeByName(N);w&&(N=w.mime||w.mimes[0])}var G=ee.getMode(V,N);return G.name=="null"?null:G}I.highlightFormatting===void 0&&(I.highlightFormatting=!1),I.maxBlockquoteDepth===void 0&&(I.maxBlockquoteDepth=0),I.taskLists===void 0&&(I.taskLists=!1),I.strikethrough===void 0&&(I.strikethrough=!1),I.emoji===void 0&&(I.emoji=!1),I.fencedCodeBlockHighlighting===void 0&&(I.fencedCodeBlockHighlighting=!0),I.fencedCodeBlockDefaultMode===void 0&&(I.fencedCodeBlockDefaultMode="text/plain"),I.xml===void 0&&(I.xml=!0),I.tokenTypeOverrides===void 0&&(I.tokenTypeOverrides={});var B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var U in B)B.hasOwnProperty(U)&&I.tokenTypeOverrides[U]&&(B[U]=I.tokenTypeOverrides[U]);var D=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,p=I.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,d=/^[^#!\[\]*_\\<>` "'(~:]+/,a=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,c=/^\s*\[[^\]]+?\]:.*$/,o=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,s=" ";function l(N,w,G){return w.f=w.inline=G,G(N,w)}function h(N,w,G){return w.f=w.block=G,G(N,w)}function R(N){return!N||!/\S/.test(N.string)}function x(N){if(N.linkTitle=!1,N.linkHref=!1,N.linkText=!1,N.em=!1,N.strong=!1,N.strikethrough=!1,N.quote=0,N.indentedCode=!1,N.f==O){var w=k;if(!w){var G=ee.innerMode(H,N.htmlState);w=G.mode.name=="xml"&&G.state.tagStart===null&&!G.state.context&&G.state.tokenize.isInText}w&&(N.f=v,N.block=T,N.htmlState=null)}return N.trailingSpace=0,N.trailingSpaceNewLine=!1,N.prevLine=N.thisLine,N.thisLine={stream:null},null}function T(N,w){var G=N.column()===w.indentation,J=R(w.prevLine.stream),Z=w.indentedCode,ae=w.prevLine.hr,_e=w.list!==!1,ce=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var he=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,_e)){for(w.list=null;he<w.listStack[w.listStack.length-1];)w.listStack.pop(),w.listStack.length?w.indentation=w.listStack[w.listStack.length-1]:w.list=!1;w.list!==!1&&(w.indentationDiff=he-w.listStack[w.listStack.length-1])}var fe=!J&&!ae&&!w.prevLine.header&&(!_e||!Z)&&!w.prevLine.fencedCodeEnd,pe=(w.list===!1||ae||J)&&w.indentation<=ce&&N.match(D),se=null;if(w.indentationDiff>=4&&(Z||w.prevLine.fencedCodeEnd||w.prevLine.header||J))return N.skipToEnd(),w.indentedCode=!0,B.code;if(N.eatSpace())return null;if(G&&w.indentation<=ce&&(se=N.match(p))&&se[1].length<=6)return w.quote=0,w.header=se[1].length,w.thisLine.header=!0,I.highlightFormatting&&(w.formatting="header"),w.f=w.inline,E(w);if(w.indentation<=ce&&N.eat(">"))return w.quote=G?1:w.quote+1,I.highlightFormatting&&(w.formatting="quote"),N.eatSpace(),E(w);if(!pe&&!w.setext&&G&&w.indentation<=ce&&(se=N.match(L))){var de=se[1]?"ol":"ul";return w.indentation=he+N.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,I.taskLists&&N.match(g,!1)&&(w.taskList=!0),w.f=w.inline,I.highlightFormatting&&(w.formatting=["list","list-"+de]),E(w)}else{if(G&&w.indentation<=ce&&(se=N.match(a,!0)))return w.quote=0,w.fencedEndRE=new RegExp(se[1]+"+ *$"),w.localMode=I.fencedCodeBlockHighlighting&&C(se[2]||I.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=ee.startState(w.localMode)),w.f=w.block=S,I.highlightFormatting&&(w.formatting="code-block"),w.code=-1,E(w);if(w.setext||(!fe||!_e)&&!w.quote&&w.list===!1&&!w.code&&!pe&&!c.test(N.string)&&(se=N.lookAhead(1))&&(se=se.match(f)))return w.setext?(w.header=w.setext,w.setext=0,N.skipToEnd(),I.highlightFormatting&&(w.formatting="header")):(w.header=se[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,E(w);if(pe)return N.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,B.hr;if(N.peek()==="[")return l(N,w,P)}return l(N,w,w.inline)}function O(N,w){var G=H.token(N,w.htmlState);if(!k){var J=ee.innerMode(H,w.htmlState);(J.mode.name=="xml"&&J.state.tagStart===null&&!J.state.context&&J.state.tokenize.isInText||w.md_inside&&N.current().indexOf(">")>-1)&&(w.f=v,w.block=T,w.htmlState=null)}return G}function S(N,w){var G=w.listStack[w.listStack.length-1]||0,J=w.indentation<G,Z=G+3;if(w.fencedEndRE&&w.indentation<=Z&&(J||N.match(w.fencedEndRE))){I.highlightFormatting&&(w.formatting="code-block");var ae;return J||(ae=E(w)),w.localMode=w.localState=null,w.block=T,w.f=v,w.fencedEndRE=null,w.code=0,w.thisLine.fencedCodeEnd=!0,J?h(N,w,w.block):ae}else return w.localMode?w.localMode.token(N,w.localState):(N.skipToEnd(),B.code)}function E(N){var w=[];if(N.formatting){w.push(B.formatting),typeof N.formatting=="string"&&(N.formatting=[N.formatting]);for(var G=0;G<N.formatting.length;G++)w.push(B.formatting+"-"+N.formatting[G]),N.formatting[G]==="header"&&w.push(B.formatting+"-"+N.formatting[G]+"-"+N.header),N.formatting[G]==="quote"&&(!I.maxBlockquoteDepth||I.maxBlockquoteDepth>=N.quote?w.push(B.formatting+"-"+N.formatting[G]+"-"+N.quote):w.push("error"))}if(N.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(N.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(N.linkHref?w.push(B.linkHref,"url"):(N.strong&&w.push(B.strong),N.em&&w.push(B.em),N.strikethrough&&w.push(B.strikethrough),N.emoji&&w.push(B.emoji),N.linkText&&w.push(B.linkText),N.code&&w.push(B.code),N.image&&w.push(B.image),N.imageAltText&&w.push(B.imageAltText,"link"),N.imageMarker&&w.push(B.imageMarker)),N.header&&w.push(B.header,B.header+"-"+N.header),N.quote&&(w.push(B.quote),!I.maxBlockquoteDepth||I.maxBlockquoteDepth>=N.quote?w.push(B.quote+"-"+N.quote):w.push(B.quote+"-"+I.maxBlockquoteDepth)),N.list!==!1){var J=(N.listStack.length-1)%3;J?J===1?w.push(B.list2):w.push(B.list3):w.push(B.list1)}return N.trailingSpaceNewLine?w.push("trailing-space-new-line"):N.trailingSpace&&w.push("trailing-space-"+(N.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function b(N,w){return N.match(d,!0)?E(w):void 0}function v(N,w){var G=w.text(N,w);if(typeof G!="undefined")return G;if(w.list)return w.list=null,E(w);if(w.taskList){var J=N.match(g,!0)[1]===" ";return J?w.taskOpen=!0:w.taskClosed=!0,I.highlightFormatting&&(w.formatting="task"),w.taskList=!1,E(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&N.match(/^#+$/,!0))return I.highlightFormatting&&(w.formatting="header"),E(w);var Z=N.next();if(w.linkTitle){w.linkTitle=!1;var ae=Z;Z==="("&&(ae=")"),ae=(ae+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var _e="^\\s*(?:[^"+ae+"\\\\]+|\\\\\\\\|\\\\.)"+ae;if(N.match(new RegExp(_e),!0))return B.linkHref}if(Z==="`"){var ce=w.formatting;I.highlightFormatting&&(w.formatting="code"),N.eatWhile("`");var he=N.current().length;if(w.code==0&&(!w.quote||he==1))return w.code=he,E(w);if(he==w.code){var fe=E(w);return w.code=0,fe}else return w.formatting=ce,E(w)}else if(w.code)return E(w);if(Z==="\\"&&(N.next(),I.highlightFormatting)){var pe=E(w),se=B.formatting+"-escape";return pe?pe+" "+se:se}if(Z==="!"&&N.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,I.highlightFormatting&&(w.formatting="image"),E(w);if(Z==="["&&w.imageMarker&&N.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,I.highlightFormatting&&(w.formatting="image"),E(w);if(Z==="]"&&w.imageAltText){I.highlightFormatting&&(w.formatting="image");var pe=E(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=_,pe}if(Z==="["&&!w.image)return w.linkText&&N.match(/^.*?\]/)||(w.linkText=!0,I.highlightFormatting&&(w.formatting="link")),E(w);if(Z==="]"&&w.linkText){I.highlightFormatting&&(w.formatting="link");var pe=E(w);return w.linkText=!1,w.inline=w.f=N.match(/\(.*?\)| ?\[.*?\]/,!1)?_:v,pe}if(Z==="<"&&N.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=u,I.highlightFormatting&&(w.formatting="link");var pe=E(w);return pe?pe+=" ":pe="",pe+B.linkInline}if(Z==="<"&&N.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=u,I.highlightFormatting&&(w.formatting="link");var pe=E(w);return pe?pe+=" ":pe="",pe+B.linkEmail}if(I.xml&&Z==="<"&&N.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var de=N.string.indexOf(">",N.pos);if(de!=-1){var Ee=N.string.substring(N.start,de);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ee)&&(w.md_inside=!0)}return N.backUp(1),w.htmlState=ee.startState(H),h(N,w,O)}if(I.xml&&Z==="<"&&N.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(Z==="*"||Z==="_"){for(var Pe=1,Se=N.pos==1?" ":N.string.charAt(N.pos-2);Pe<3&&N.eat(Z);)Pe++;var Je=N.peek()||" ",qe=!/\s/.test(Je)&&(!o.test(Je)||/\s/.test(Se)||o.test(Se)),Ae=!/\s/.test(Se)&&(!o.test(Se)||/\s/.test(Je)||o.test(Je)),we=null,De=null;if(Pe%2&&(!w.em&&qe&&(Z==="*"||!Ae||o.test(Se))?we=!0:w.em==Z&&Ae&&(Z==="*"||!qe||o.test(Je))&&(we=!1)),Pe>1&&(!w.strong&&qe&&(Z==="*"||!Ae||o.test(Se))?De=!0:w.strong==Z&&Ae&&(Z==="*"||!qe||o.test(Je))&&(De=!1)),De!=null||we!=null){I.highlightFormatting&&(w.formatting=we==null?"strong":De==null?"em":"strong em"),we===!0&&(w.em=Z),De===!0&&(w.strong=Z);var fe=E(w);return we===!1&&(w.em=!1),De===!1&&(w.strong=!1),fe}}else if(Z===" "&&(N.eat("*")||N.eat("_"))){if(N.peek()===" ")return E(w);N.backUp(1)}if(I.strikethrough){if(Z==="~"&&N.eatWhile(Z)){if(w.strikethrough){I.highlightFormatting&&(w.formatting="strikethrough");var fe=E(w);return w.strikethrough=!1,fe}else if(N.match(/^[^\s]/,!1))return w.strikethrough=!0,I.highlightFormatting&&(w.formatting="strikethrough"),E(w)}else if(Z===" "&&N.match(/^~~/,!0)){if(N.peek()===" ")return E(w);N.backUp(2)}}if(I.emoji&&Z===":"&&N.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,I.highlightFormatting&&(w.formatting="emoji");var Xe=E(w);return w.emoji=!1,Xe}return Z===" "&&(N.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),E(w)}function u(N,w){var G=N.next();if(G===">"){w.f=w.inline=v,I.highlightFormatting&&(w.formatting="link");var J=E(w);return J?J+=" ":J="",J+B.linkInline}return N.match(/^[^>]+/,!0),B.linkInline}function _(N,w){if(N.eatSpace())return null;var G=N.next();return G==="("||G==="["?(w.f=w.inline=y(G==="("?")":"]"),I.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,E(w)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function y(N){return function(w,G){var J=w.next();if(J===N){G.f=G.inline=v,I.highlightFormatting&&(G.formatting="link-string");var Z=E(G);return G.linkHref=!1,Z}return w.match(m[N]),G.linkHref=!0,E(G)}}function P(N,w){return N.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=M,N.next(),I.highlightFormatting&&(w.formatting="link"),w.linkText=!0,E(w)):l(N,w,v)}function M(N,w){if(N.match(/^\]:/,!0)){w.f=w.inline=j,I.highlightFormatting&&(w.formatting="link");var G=E(w);return w.linkText=!1,G}return N.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(N,w){return N.eatSpace()?null:(N.match(/^[^\s]+/,!0),N.peek()===void 0?w.linkTitle=!0:N.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),w.f=w.inline=v,B.linkHref+" url")}var W={startState:function(){return{f:T,prevLine:{stream:null},thisLine:{stream:null},block:T,htmlState:null,indentation:0,inline:v,text:b,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(N){return{f:N.f,prevLine:N.prevLine,thisLine:N.thisLine,block:N.block,htmlState:N.htmlState&&ee.copyState(H,N.htmlState),indentation:N.indentation,localMode:N.localMode,localState:N.localMode?ee.copyState(N.localMode,N.localState):null,inline:N.inline,text:N.text,formatting:!1,linkText:N.linkText,linkTitle:N.linkTitle,linkHref:N.linkHref,code:N.code,em:N.em,strong:N.strong,strikethrough:N.strikethrough,emoji:N.emoji,header:N.header,setext:N.setext,hr:N.hr,taskList:N.taskList,list:N.list,listStack:N.listStack.slice(0),quote:N.quote,indentedCode:N.indentedCode,trailingSpace:N.trailingSpace,trailingSpaceNewLine:N.trailingSpaceNewLine,md_inside:N.md_inside,fencedEndRE:N.fencedEndRE}},token:function(N,w){if(w.formatting=!1,N!=w.thisLine.stream){if(w.header=0,w.hr=!1,N.match(/^\s*$/,!0))return x(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:N},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=O)){var G=N.match(/^\s*/,!0)[0].replace(/\t/g,s).length;if(w.indentation=G,w.indentationDiff=null,G>0)return null}}return w.f(N,w)},innerMode:function(N){return N.block==O?{state:N.htmlState,mode:H}:N.localState?{state:N.localState,mode:N.localMode}:{state:N,mode:W}},indent:function(N,w,G){return N.block==O&&H.indent?H.indent(N.htmlState,w,G):N.localState&&N.localMode.indent?N.localMode.indent(N.localState,w,G):ee.Pass},blankLine:x,getType:E,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),ee.defineMIME("text/markdown","markdown"),ee.defineMIME("text/x-markdown","markdown")})},osHv:function(st,Qe,Q){(function(ee){ee(Q("VrN/"))})(function(ee){"use strict";var V=ee.Pos;function I(o,s){return o.line-s.line||o.ch-s.ch}var H="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",k=H+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",C=new RegExp("<(/?)(["+H+"]["+k+"]*)","g");function B(o,s,l,h){this.line=s,this.ch=l,this.cm=o,this.text=o.getLine(s),this.min=h?Math.max(h.from,o.firstLine()):o.firstLine(),this.max=h?Math.min(h.to-1,o.lastLine()):o.lastLine()}function U(o,s){var l=o.cm.getTokenTypeAt(V(o.line,s));return l&&/\btag\b/.test(l)}function D(o){return o.line>=o.max?void 0:(o.ch=0,o.text=o.cm.getLine(++o.line),!0)}function L(o){return o.line<=o.min?void 0:(o.text=o.cm.getLine(--o.line),o.ch=o.text.length,!0)}function g(o){for(;;){var s=o.text.indexOf(">",o.ch);if(s==-1){if(D(o))continue;return}if(!U(o,s+1)){o.ch=s+1;continue}var l=o.text.lastIndexOf("/",s),h=l>-1&&!/\S/.test(o.text.slice(l+1,s));return o.ch=s+1,h?"selfClose":"regular"}}function p(o){for(;;){var s=o.ch?o.text.lastIndexOf("<",o.ch-1):-1;if(s==-1){if(L(o))continue;return}if(!U(o,s+1)){o.ch=s;continue}C.lastIndex=s,o.ch=s;var l=C.exec(o.text);if(l&&l.index==s)return l}}function f(o){for(;;){C.lastIndex=o.ch;var s=C.exec(o.text);if(!s){if(D(o))continue;return}if(!U(o,s.index+1)){o.ch=s.index+1;continue}return o.ch=s.index+s[0].length,s}}function d(o){for(;;){var s=o.ch?o.text.lastIndexOf(">",o.ch-1):-1;if(s==-1){if(L(o))continue;return}if(!U(o,s+1)){o.ch=s;continue}var l=o.text.lastIndexOf("/",s),h=l>-1&&!/\S/.test(o.text.slice(l+1,s));return o.ch=s+1,h?"selfClose":"regular"}}function a(o,s){for(var l=[];;){var h=f(o),R,x=o.line,T=o.ch-(h?h[0].length:0);if(!h||!(R=g(o)))return;if(R=="selfClose")continue;if(h[1]){for(var O=l.length-1;O>=0;--O)if(l[O]==h[2]){l.length=O;break}if(O<0&&(!s||s==h[2]))return{tag:h[2],from:V(x,T),to:V(o.line,o.ch)}}else l.push(h[2])}}function c(o,s){for(var l=[];;){var h=d(o);if(!h)return;if(h=="selfClose"){p(o);continue}var R=o.line,x=o.ch,T=p(o);if(!T)return;if(T[1])l.push(T[2]);else{for(var O=l.length-1;O>=0;--O)if(l[O]==T[2]){l.length=O;break}if(O<0&&(!s||s==T[2]))return{tag:T[2],from:V(o.line,o.ch),to:V(R,x)}}}}ee.registerHelper("fold","xml",function(o,s){for(var l=new B(o,s.line,0);;){var h=f(l);if(!h||l.line!=s.line)return;var R=g(l);if(!R)return;if(!h[1]&&R!="selfClose"){var x=V(l.line,l.ch),T=a(l,h[2]);return T&&I(T.from,x)>0?{from:x,to:T.from}:null}}}),ee.findMatchingTag=function(o,s,l){var h=new B(o,s.line,s.ch,l);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var R=g(h),x=R&&V(h.line,h.ch),T=R&&p(h);if(!R||!T||I(h,s)>0)return;var O={from:V(h.line,h.ch),to:x,tag:T[2]};return R=="selfClose"?{open:O,close:null,at:"open"}:T[1]?{open:c(h,T[2]),close:O,at:"close"}:(h=new B(o,x.line,x.ch,l),{open:O,close:a(h,T[2]),at:"open"})},ee.findEnclosingTag=function(o,s,l,h){for(var R=new B(o,s.line,s.ch,l);;){var x=c(R,h);if(!x)break;var T=new B(o,s.line,s.ch,l),O=a(T,x.tag);if(O)return{open:x,close:O}}},ee.scanForClosingTag=function(o,s,l,h){var R=new B(o,s.line,s.ch,h?{from:0,to:h}:null);return a(R,l)}})},p5ED:function(st,Qe,Q){"use strict";var ee=Q("+L6B"),V=Q("2/Rp"),I=Q("5Dmo"),H=Q("3S7+"),k=Q("k1fw"),C=Q("tJVT"),B=Q("cDcd"),U=Q.n(B),D=Q("vHTk"),L=Q.n(D),g=Q("yEEn"),p=Q("ZW9T"),f=Q("1vsH");Qe.a=function(d){var a=d.name,c=d.data,o=d.theme,s=d.type,l=d.filename,h=d.monacoEditor,R=d.className,x=d.style,T=d.close,O=d.onClose,S=d.hasMask,E=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),b=Object(C.a)(E,2),v=b[0],u=b[1],_=Object(B.useState)(""),m=Object(C.a)(_,2),y=m[0],P=m[1],M,j=1024*1024,W=10*j,N=Object(B.useRef)();s==="office"&&(M=Object(f.V)(c).filesize,M>W&&(s="other")),l&&(h.filename=l),Object(B.useEffect)(function(){var J,Z,ae=(J=document.cookie)===null||J===void 0||((Z=J.replace(/\s/g,""))===null||Z===void 0)?void 0:Z.split(";");ae==null||ae.map(function(_e){var ce=_e.split("=");ce[0]==="_educoder_session"&&P(ce[1])})},[]);var w=function(){if(c.startsWith("http")||c.startsWith("/")){G();return}Object(f.z)(l||"educoder",c,l)},G=function(){Object(f.x)(l||a,c)};return console.log("data:",c,"fileanme:",l," name:",a),U.a.createElement("div",{style:Object(k.a)({},x||{}),className:"".concat(S&&L.a.bgBlack," ").concat(s?L.a.wrp:"hide")},T&&U.a.createElement("div",{className:L.a.close,ref:N},U.a.createElement(H.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return N.current}},U.a.createElement("span",{onClick:G},U.a.createElement("i",{className:"icon-quxiaozhiding"}))),U.a.createElement(H.a,{title:"\u5173\u95ED",getPopupContainer:function(){return N.current}},U.a.createElement("span",{className:"",onClick:O},U.a.createElement("i",{className:"icon-guanbi1"})))),U.a.createElement("div",{className:"".concat(L.a[R]," ").concat(R," ").concat(L.a.monaco," ").concat(s==="txt"?"show":"hide")},s==="txt"&&U.a.createElement(p.b,h)),s==="audio"&&U.a.createElement("audio",{src:"".concat(c!=null&&c.startsWith("/")||(c==null?void 0:c.indexOf("https://"))>-1?c:"data:audio/mp3;base64,").concat(c),autoPlay:!0}),s==="video"&&U.a.createElement(U.a.Fragment,null,c!=null&&c.startsWith("/")?U.a.createElement("video",{controls:!0,src:"".concat(c),autoPlay:!0}):U.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(c),autoPlay:!0})),s==="html"&&U.a.createElement("iframe",{src:c+"&disposition=inline"}),s==="pdf"&&U.a.createElement("embed",{className:L.a.embed,src:c}),s==="image"&&U.a.createElement(U.a.Fragment,null,U.a.createElement("img",{src:"".concat(c!=null&&c.startsWith("/")||(c==null?void 0:c.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(c)})),s==="other"&&U.a.createElement("div",null,U.a.createElement(V.a,{type:"primary",size:"large",onClick:w},U.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(s==="download"||s==="office")&&U.a.createElement(V.a,{type:"primary",size:"large",onClick:w},U.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(st,Qe,Q){},psGv:function(st,Qe,Q){var ee,V;(function(){var I;(function(){"use strict";var B=[,,function(g){function p(a){this.__parent=a,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}p.prototype.clone_empty=function(){var a=new p(this.__parent);return a.set_indent(this.__indent_count,this.__alignment_count),a},p.prototype.item=function(a){return a<0?this.__items[this.__items.length+a]:this.__items[a]},p.prototype.has_match=function(a){for(var c=this.__items.length-1;c>=0;c--)if(this.__items[c].match(a))return!0;return!1},p.prototype.set_indent=function(a,c){this.is_empty()&&(this.__indent_count=a||0,this.__alignment_count=c||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},p.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},p.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},p.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var a=this.__parent.current_line;return a.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),a.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),a.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,a.__items[0]===" "&&(a.__items.splice(0,1),a.__character_count-=1),!0}return!1},p.prototype.is_empty=function(){return this.__items.length===0},p.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},p.prototype.push=function(a){this.__items.push(a);var c=a.lastIndexOf(`
|
|
`);c!==-1?this.__character_count=a.length-c:this.__character_count+=a.length},p.prototype.pop=function(){var a=null;return this.is_empty()||(a=this.__items.pop(),this.__character_count-=a.length),a},p.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},p.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},p.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},p.prototype.toString=function(){var a="";return this.is_empty()?this.__parent.indent_empty_lines&&(a=this.__parent.get_indent_string(this.__indent_count)):(a=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),a+=this.__items.join("")),a};function f(a,c){this.__cache=[""],this.__indent_size=a.indent_size,this.__indent_string=a.indent_char,a.indent_with_tabs||(this.__indent_string=new Array(a.indent_size+1).join(a.indent_char)),c=c||"",a.indent_level>0&&(c=new Array(a.indent_level+1).join(this.__indent_string)),this.__base_string=c,this.__base_string_length=c.length}f.prototype.get_indent_size=function(a,c){var o=this.__base_string_length;return c=c||0,a<0&&(o=0),o+=a*this.__indent_size,o+=c,o},f.prototype.get_indent_string=function(a,c){var o=this.__base_string;return c=c||0,a<0&&(a=0,o=""),c+=a*this.__indent_size,this.__ensure_cache(c),o+=this.__cache[c],o},f.prototype.__ensure_cache=function(a){for(;a>=this.__cache.length;)this.__add_column()},f.prototype.__add_column=function(){var a=this.__cache.length,c=0,o="";this.__indent_size&&a>=this.__indent_size&&(c=Math.floor(a/this.__indent_size),a-=c*this.__indent_size,o=new Array(c+1).join(this.__indent_string)),a&&(o+=new Array(a+1).join(" ")),this.__cache.push(o)};function d(a,c){this.__indent_cache=new f(a,c),this.raw=!1,this._end_with_newline=a.end_with_newline,this.indent_size=a.indent_size,this.wrap_line_length=a.wrap_line_length,this.indent_empty_lines=a.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new p(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}d.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},d.prototype.get_line_number=function(){return this.__lines.length},d.prototype.get_indent_string=function(a,c){return this.__indent_cache.get_indent_string(a,c)},d.prototype.get_indent_size=function(a,c){return this.__indent_cache.get_indent_size(a,c)},d.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},d.prototype.add_new_line=function(a){return this.is_empty()||!a&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},d.prototype.get_code=function(a){this.trim(!0);var c=this.current_line.pop();c&&(c[c.length-1]===`
|
|
`&&(c=c.replace(/\n+$/g,"")),this.current_line.push(c)),this._end_with_newline&&this.__add_outputline();var o=this.__lines.join(`
|
|
`);return a!==`
|
|
`&&(o=o.replace(/[\n]/g,a)),o},d.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},d.prototype.set_indent=function(a,c){return a=a||0,c=c||0,this.next_line.set_indent(a,c),this.__lines.length>1?(this.current_line.set_indent(a,c),!0):(this.current_line.set_indent(),!1)},d.prototype.add_raw_token=function(a){for(var c=0;c<a.newlines;c++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(a.whitespace_before),this.current_line.push(a.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},d.prototype.add_token=function(a){this.__add_space_before_token(),this.current_line.push(a),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},d.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},d.prototype.remove_indent=function(a){for(var c=this.__lines.length;a<c;)this.__lines[a]._remove_indent(),a++;this.current_line._remove_wrap_indent()},d.prototype.trim=function(a){for(a=a===void 0?!1:a,this.current_line.trim();a&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},d.prototype.just_added_newline=function(){return this.current_line.is_empty()},d.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},d.prototype.ensure_empty_line_above=function(a,c){for(var o=this.__lines.length-2;o>=0;){var s=this.__lines[o];if(s.is_empty())break;if(s.item(0).indexOf(a)!==0&&s.item(-1)!==c){this.__lines.splice(o+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},g.exports.Output=d},function(g){function p(f,d,a,c){this.type=f,this.text=d,this.comments_before=null,this.newlines=a||0,this.whitespace_before=c||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}g.exports.Token=p},,,function(g){function p(a,c){this.raw_options=f(a,c),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}p.prototype._get_array=function(a,c){var o=this.raw_options[a],s=c||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(s=o.concat()):typeof o=="string"&&(s=o.split(/[^a-zA-Z0-9_\/\-]+/)),s},p.prototype._get_boolean=function(a,c){var o=this.raw_options[a],s=o===void 0?!!c:!!o;return s},p.prototype._get_characters=function(a,c){var o=this.raw_options[a],s=c||"";return typeof o=="string"&&(s=o.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),s},p.prototype._get_number=function(a,c){var o=this.raw_options[a];c=parseInt(c,10),isNaN(c)&&(c=0);var s=parseInt(o,10);return isNaN(s)&&(s=c),s},p.prototype._get_selection=function(a,c,o){var s=this._get_selection_list(a,c,o);if(s.length!==1)throw new Error("Invalid Option Value: The option '"+a+`' can only be one of the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[a]+"'");return s[0]},p.prototype._get_selection_list=function(a,c,o){if(!c||c.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[c[0]],!this._is_valid_selection(o,c))throw new Error("Invalid Default Value!");var s=this._get_array(a,o);if(!this._is_valid_selection(s,c))throw new Error("Invalid Option Value: The option '"+a+`' can contain only the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[a]+"'");return s},p.prototype._is_valid_selection=function(a,c){return a.length&&c.length&&!a.some(function(o){return c.indexOf(o)===-1})};function f(a,c){var o={};a=d(a);var s;for(s in a)s!==c&&(o[s]=a[s]);if(c&&a[c])for(s in a[c])o[s]=a[c][s];return o}function d(a){var c={},o;for(o in a){var s=o.replace(/-/g,"_");c[s]=a[o]}return c}g.exports.Options=p,g.exports.normalizeOpts=d,g.exports.mergeOpts=f},,function(g){var p=RegExp.prototype.hasOwnProperty("sticky");function f(d){this.__input=d||"",this.__input_length=this.__input.length,this.__position=0}f.prototype.restart=function(){this.__position=0},f.prototype.back=function(){this.__position>0&&(this.__position-=1)},f.prototype.hasNext=function(){return this.__position<this.__input_length},f.prototype.next=function(){var d=null;return this.hasNext()&&(d=this.__input.charAt(this.__position),this.__position+=1),d},f.prototype.peek=function(d){var a=null;return d=d||0,d+=this.__position,d>=0&&d<this.__input_length&&(a=this.__input.charAt(d)),a},f.prototype.__match=function(d,a){d.lastIndex=a;var c=d.exec(this.__input);return c&&!(p&&d.sticky)&&(c.index!==a&&(c=null)),c},f.prototype.test=function(d,a){return a=a||0,a+=this.__position,a>=0&&a<this.__input_length?!!this.__match(d,a):!1},f.prototype.testChar=function(d,a){var c=this.peek(a);return d.lastIndex=0,c!==null&&d.test(c)},f.prototype.match=function(d){var a=this.__match(d,this.__position);return a?this.__position+=a[0].length:a=null,a},f.prototype.read=function(d,a,c){var o="",s;return d&&(s=this.match(d),s&&(o+=s[0])),a&&(s||!d)&&(o+=this.readUntil(a,c)),o},f.prototype.readUntil=function(d,a){var c="",o=this.__position;d.lastIndex=this.__position;var s=d.exec(this.__input);return s?(o=s.index,a&&(o+=s[0].length)):o=this.__input_length,c=this.__input.substring(this.__position,o),this.__position=o,c},f.prototype.readUntilAfter=function(d){return this.readUntil(d,!0)},f.prototype.get_regexp=function(d,a){var c=null,o="g";return a&&p&&(o="y"),typeof d=="string"&&d!==""?c=new RegExp(d,o):d&&(c=new RegExp(d.source,o)),c},f.prototype.get_literal_regexp=function(d){return RegExp(d.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},f.prototype.peekUntilAfter=function(d){var a=this.__position,c=this.readUntilAfter(d);return this.__position=a,c},f.prototype.lookBack=function(d){var a=this.__position-1;return a>=d.length&&this.__input.substring(a-d.length,a).toLowerCase()===d},g.exports.InputScanner=f},function(g,p,f){var d=f(8).InputScanner,a=f(3).Token,c=f(10).TokenStream,o=f(11).WhitespacePattern,s={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(h,R){this._input=new d(h),this._options=R||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new c,this._reset();for(var h,R=new a(s.START,""),x=null,T=[],O=new c;R.type!==s.EOF;){for(h=this._get_next_token(R,x);this._is_comment(h);)O.add(h),h=this._get_next_token(R,x);O.isEmpty()||(h.comments_before=O,O=new c),h.parent=x,this._is_opening(h)?(T.push(x),x=h):x&&this._is_closing(h,x)&&(h.opened=x,x.closed=h,x=T.pop(),h.parent=x),h.previous=R,R.next=h,this.__tokens.add(h),R=h}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(h,R){this._readWhitespace();var x=this._input.read(/.+/g);return x?this._create_token(s.RAW,x):this._create_token(s.EOF,"")},l.prototype._is_comment=function(h){return!1},l.prototype._is_opening=function(h){return!1},l.prototype._is_closing=function(h,R){return!1},l.prototype._create_token=function(h,R){var x=new a(h,R,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return x},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},g.exports.Tokenizer=l,g.exports.TOKEN=s},function(g){function p(f){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=f}p.prototype.restart=function(){this.__position=0},p.prototype.isEmpty=function(){return this.__tokens_length===0},p.prototype.hasNext=function(){return this.__position<this.__tokens_length},p.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__tokens[this.__position],this.__position+=1),f},p.prototype.peek=function(f){var d=null;return f=f||0,f+=this.__position,f>=0&&f<this.__tokens_length&&(d=this.__tokens[f]),d},p.prototype.add=function(f){this.__parent_token&&(f.parent=this.__parent_token),this.__tokens.push(f),this.__tokens_length+=1},g.exports.TokenStream=p},function(g,p,f){var d=f(12).Pattern;function a(c,o){d.call(this,c,o),o?this._line_regexp=this._input.get_regexp(o._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}a.prototype=new d,a.prototype.__set_whitespace_patterns=function(c,o){c+="\\t ",o+="\\n\\r",this._match_pattern=this._input.get_regexp("["+c+o+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+o+"]")},a.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var c=this._input.read(this._match_pattern);if(c===" ")this.whitespace_before_token=" ";else if(c){var o=this.__split(this._newline_regexp,c);this.newline_count=o.length-1,this.whitespace_before_token=o[this.newline_count]}return c},a.prototype.matching=function(c,o){var s=this._create();return s.__set_whitespace_patterns(c,o),s._update(),s},a.prototype._create=function(){return new a(this._input,this)},a.prototype.__split=function(c,o){c.lastIndex=0;for(var s=0,l=[],h=c.exec(o);h;)l.push(o.substring(s,h.index)),s=h.index+h[0].length,h=c.exec(o);return s<o.length?l.push(o.substring(s,o.length)):l.push(""),l},g.exports.WhitespacePattern=a},function(g){function p(f,d){this._input=f,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,d&&(this._starting_pattern=this._input.get_regexp(d._starting_pattern,!0),this._match_pattern=this._input.get_regexp(d._match_pattern,!0),this._until_pattern=this._input.get_regexp(d._until_pattern),this._until_after=d._until_after)}p.prototype.read=function(){var f=this._input.read(this._starting_pattern);return(!this._starting_pattern||f)&&(f+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),f},p.prototype.read_match=function(){return this._input.match(this._match_pattern)},p.prototype.until_after=function(f){var d=this._create();return d._until_after=!0,d._until_pattern=this._input.get_regexp(f),d._update(),d},p.prototype.until=function(f){var d=this._create();return d._until_after=!1,d._until_pattern=this._input.get_regexp(f),d._update(),d},p.prototype.starting_with=function(f){var d=this._create();return d._starting_pattern=this._input.get_regexp(f,!0),d._update(),d},p.prototype.matching=function(f){var d=this._create();return d._match_pattern=this._input.get_regexp(f,!0),d._update(),d},p.prototype._create=function(){return new p(this._input,this)},p.prototype._update=function(){},g.exports.Pattern=p},function(g){function p(f,d){f=typeof f=="string"?f:f.source,d=typeof d=="string"?d:d.source,this.__directives_block_pattern=new RegExp(f+/ beautify( \w+[:]\w+)+ /.source+d,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(f+/\sbeautify\signore:end\s/.source+d,"g")}p.prototype.get_directives=function(f){if(!f.match(this.__directives_block_pattern))return null;var d={};this.__directive_pattern.lastIndex=0;for(var a=this.__directive_pattern.exec(f);a;)d[a[1]]=a[2],a=this.__directive_pattern.exec(f);return d},p.prototype.readIgnored=function(f){return f.readUntilAfter(this.__directives_end_ignore_pattern)},g.exports.Directives=p},function(g,p,f){var d=f(12).Pattern,a={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function c(o,s){d.call(this,o,s),this.__template_pattern=null,this._disabled=Object.assign({},a),this._excluded=Object.assign({},a),s&&(this.__template_pattern=this._input.get_regexp(s.__template_pattern),this._excluded=Object.assign(this._excluded,s._excluded),this._disabled=Object.assign(this._disabled,s._disabled));var l=new d(o);this.__patterns={handlebars_comment:l.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:l.starting_with(/{{{/).until_after(/}}}/),handlebars:l.starting_with(/{{/).until_after(/}}/),php:l.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}c.prototype=new d,c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){this.__set_templated_pattern()},c.prototype.disable=function(o){var s=this._create();return s._disabled[o]=!0,s._update(),s},c.prototype.read_options=function(o){var s=this._create();for(var l in a)s._disabled[l]=o.templating.indexOf(l)===-1;return s._update(),s},c.prototype.exclude=function(o){var s=this._create();return s._excluded[o]=!0,s._update(),s},c.prototype.read=function(){var o="";this._match_pattern?o=this._input.read(this._starting_pattern):o=this._input.read(this._starting_pattern,this.__template_pattern);for(var s=this._read_template();s;)this._match_pattern?s+=this._input.read(this._match_pattern):s+=this._input.readUntil(this.__template_pattern),o+=s,s=this._read_template();return this._until_after&&(o+=this._input.readUntilAfter(this._until_pattern)),o},c.prototype.__set_templated_pattern=function(){var o=[];this._disabled.php||o.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||o.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||o.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(o.push(this.__patterns.django._starting_pattern.source),o.push(this.__patterns.django_value._starting_pattern.source),o.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||o.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&o.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+o.join("|")+")")},c.prototype._read_template=function(){var o="",s=this._input.peek();if(s==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(o=o||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(o=o||this.__patterns.erb.read())}else s==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(o=o||this.__patterns.handlebars_comment.read(),o=o||this.__patterns.handlebars_unescaped.read(),o=o||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(o=o||this.__patterns.django_value.read()),this._excluded.django||(o=o||this.__patterns.django_comment.read(),o=o||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(o=o||this.__patterns.smarty_comment.read(),o=o||this.__patterns.smarty_literal.read(),o=o||this.__patterns.smarty.read()));return o},g.exports.TemplatablePattern=c},,,,function(g,p,f){var d=f(19).Beautifier,a=f(20).Options;function c(o,s,l,h){var R=new d(o,s,l,h);return R.beautify()}g.exports=c,g.exports.defaultOptions=function(){return new a}},function(g,p,f){var d=f(20).Options,a=f(2).Output,c=f(21).Tokenizer,o=f(21).TOKEN,s=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,h=function(_,m){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=_.max_preserve_newlines,this.preserve_newlines=_.preserve_newlines,this._output=new a(_,m)};h.prototype.current_line_has_match=function(_){return this._output.current_line.has_match(_)},h.prototype.set_space_before_token=function(_,m){this._output.space_before_token=_,this._output.non_breaking_space=m},h.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},h.prototype.add_raw_token=function(_){this._output.add_raw_token(_)},h.prototype.print_preserved_newlines=function(_){var m=0;_.type!==o.TEXT&&_.previous.type!==o.TEXT&&(m=_.newlines?1:0),this.preserve_newlines&&(m=_.newlines<this.max_preserve_newlines+1?_.newlines:this.max_preserve_newlines+1);for(var y=0;y<m;y++)this.print_newline(y>0);return m!==0},h.prototype.traverse_whitespace=function(_){return _.whitespace_before||_.newlines?(this.print_preserved_newlines(_)||(this._output.space_before_token=!0),!0):!1},h.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},h.prototype.print_newline=function(_){this._output.add_new_line(_)},h.prototype.print_token=function(_){_.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(_.text))},h.prototype.indent=function(){this.indent_level++},h.prototype.get_full_indent=function(_){return _=this.indent_level+(_||0),_<1?"":this._output.get_indent_string(_)};var R=function(_){for(var m=null,y=_.next;y.type!==o.EOF&&_.closed!==y;){if(y.type===o.ATTRIBUTE&&y.text==="type"){y.next&&y.next.type===o.EQUALS&&y.next.next&&y.next.next.type===o.VALUE&&(m=y.next.next.text);break}y=y.next}return m},x=function(_,m){var y=null,P=null;return m.closed?(_==="script"?y="text/javascript":_==="style"&&(y="text/css"),y=R(m)||y,y.search("text/css")>-1?P="css":y.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?P="javascript":y.search(/(text|application|dojo)\/(x-)?(html)/)>-1?P="html":y.search(/test\/null/)>-1&&(P="null"),P):null};function T(_,m){return m.indexOf(_)!==-1}function O(_,m,y){this.parent=_||null,this.tag=m?m.tag_name:"",this.indent_level=y||0,this.parser_token=m||null}function S(_){this._printer=_,this._current_frame=null}S.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},S.prototype.record_tag=function(_){var m=new O(this._current_frame,_,this._printer.indent_level);this._current_frame=m},S.prototype._try_pop_frame=function(_){var m=null;return _&&(m=_.parser_token,this._printer.indent_level=_.indent_level,this._current_frame=_.parent),m},S.prototype._get_frame=function(_,m){for(var y=this._current_frame;y&&!(_.indexOf(y.tag)!==-1);){if(m&&m.indexOf(y.tag)!==-1){y=null;break}y=y.parent}return y},S.prototype.try_pop=function(_,m){var y=this._get_frame([_],m);return this._try_pop_frame(y)},S.prototype.indent_to_tag=function(_){var m=this._get_frame(_);m&&(this._printer.indent_level=m.indent_level)};function E(_,m,y,P){this._source_text=_||"",m=m||{},this._js_beautify=y,this._css_beautify=P,this._tag_stack=null;var M=new d(m,"html");this._options=M,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}E.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var _=this._source_text,m=this._options.eol;this._options.eol==="auto"&&(m=`
|
|
`,_&&s.test(_)&&(m=_.match(s)[0])),_=_.replace(l,`
|
|
`);var y=_.match(/^[\t ]*/)[0],P={text:"",type:""},M=new b,j=new h(this._options,y),W=new c(_,this._options).tokenize();this._tag_stack=new S(j);for(var N=null,w=W.next();w.type!==o.EOF;)w.type===o.TAG_OPEN||w.type===o.COMMENT?(N=this._handle_tag_open(j,w,M,P),M=N):w.type===o.ATTRIBUTE||w.type===o.EQUALS||w.type===o.VALUE||w.type===o.TEXT&&!M.tag_complete?N=this._handle_inside_tag(j,w,M,W):w.type===o.TAG_CLOSE?N=this._handle_tag_close(j,w,M):w.type===o.TEXT?N=this._handle_text(j,w,M):j.add_raw_token(w),P=N,w=W.next();var G=j._output.get_code(m);return G},E.prototype._handle_tag_close=function(_,m,y){var P={text:m.text,type:m.type};return _.alignment_size=0,y.tag_complete=!0,_.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),y.is_unformatted?_.add_raw_token(m):(y.tag_start_char==="<"&&(_.set_space_before_token(m.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&y.has_wrapped_attrs&&_.print_newline(!1)),_.print_token(m)),y.indent_content&&!(y.is_unformatted||y.is_content_unformatted)&&(_.indent(),y.indent_content=!1),!y.is_inline_element&&!(y.is_unformatted||y.is_content_unformatted)&&_.set_wrap_point(),P},E.prototype._handle_inside_tag=function(_,m,y,P){var M=y.has_wrapped_attrs,j={text:m.text,type:m.type};if(_.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),y.is_unformatted)_.add_raw_token(m);else if(y.tag_start_char==="{"&&m.type===o.TEXT)_.print_preserved_newlines(m)?(m.newlines=0,_.add_raw_token(m)):_.print_token(m);else{if(m.type===o.ATTRIBUTE?(_.set_space_before_token(!0),y.attr_count+=1):(m.type===o.EQUALS||m.type===o.VALUE&&m.previous.type===o.EQUALS)&&_.set_space_before_token(!1),m.type===o.ATTRIBUTE&&y.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(_.traverse_whitespace(m),M=M||m.newlines!==0),this._is_wrap_attributes_force)){var W=y.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&y.attr_count===1){var N=!0,w=0,G;do{if(G=P.peek(w),G.type===o.ATTRIBUTE){N=!1;break}w+=1}while(w<4&&G.type!==o.EOF&&G.type!==o.TAG_CLOSE);W=!N}W&&(_.print_newline(!1),M=!0)}_.print_token(m),M=M||_.previous_token_wrapped(),y.has_wrapped_attrs=M}return j},E.prototype._handle_text=function(_,m,y){var P={text:m.text,type:"TK_CONTENT"};return y.custom_beautifier_name?this._print_custom_beatifier_text(_,m,y):y.is_unformatted||y.is_content_unformatted?_.add_raw_token(m):(_.traverse_whitespace(m),_.print_token(m)),P},E.prototype._print_custom_beatifier_text=function(_,m,y){var P=this;if(m.text!==""){var M=m.text,j,W=1,N="",w="";y.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?j=this._js_beautify:y.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?j=this._css_beautify:y.custom_beautifier_name==="html"&&(j=function(ce,he){var fe=new E(ce,he,P._js_beautify,P._css_beautify);return fe.beautify()}),this._options.indent_scripts==="keep"?W=0:this._options.indent_scripts==="separate"&&(W=-_.indent_level);var G=_.get_full_indent(W);if(M=M.replace(/\n[ \t]*$/,""),y.custom_beautifier_name!=="html"&&M[0]==="<"&&M.match(/^(<!--|<!\[CDATA\[)/)){var J=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(M);if(!J){_.add_raw_token(m);return}N=G+J[1]+`
|
|
`,M=J[4],J[5]&&(w=G+J[5]),M=M.replace(/\n[ \t]*$/,""),(J[2]||J[3].indexOf(`
|
|
`)!==-1)&&(J=J[3].match(/[ \t]+$/),J&&(m.whitespace_before=J[0]))}if(M)if(j){var Z=function(){this.eol=`
|
|
`};Z.prototype=this._options.raw_options;var ae=new Z;M=j(G+M,ae)}else{var _e=m.whitespace_before;_e&&(M=M.replace(new RegExp(`
|
|
(`+_e+")?","g"),`
|
|
`)),M=G+M.replace(/\n/g,`
|
|
`+G)}N&&(M?M=N+M+`
|
|
`+w:M=N+w),_.print_newline(!1),M&&(m.text=M,m.whitespace_before="",m.newlines=0,_.add_raw_token(m),_.print_newline(!0))}},E.prototype._handle_tag_open=function(_,m,y,P){var M=this._get_tag_open_token(m);return(y.is_unformatted||y.is_content_unformatted)&&!y.is_empty_element&&m.type===o.TAG_OPEN&&m.text.indexOf("</")===0?(_.add_raw_token(m),M.start_tag_token=this._tag_stack.try_pop(M.tag_name)):(_.traverse_whitespace(m),this._set_tag_position(_,m,M,y,P),M.is_inline_element||_.set_wrap_point(),_.print_token(m)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(M.alignment_size=m.text.length+1),!M.tag_complete&&!M.is_unformatted&&(_.alignment_size=M.alignment_size),M};var b=function(_,m){if(this.parent=_||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!m)this.tag_complete=!0;else{var y;this.tag_start_char=m.text[0],this.text=m.text,this.tag_start_char==="<"?(y=m.text.match(/^<([^\s>]*)/),this.tag_check=y?y[1]:""):(y=m.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=y?y[1]:"",(m.text.startsWith("{{#>")||m.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&m.next!==null?this.tag_check=m.next.text.split(" ")[0]:this.tag_check=m.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),m.type===o.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||m.closed&&m.closed.text==="/>";var P=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(P=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(P)))}};E.prototype._get_tag_open_token=function(_){var m=new b(this._tag_stack.get_parser_token(),_);return m.alignment_size=this._options.wrap_attributes_indent_size,m.is_end_tag=m.is_end_tag||T(m.tag_check,this._options.void_elements),m.is_empty_element=m.tag_complete||m.is_start_tag&&m.is_end_tag,m.is_unformatted=!m.tag_complete&&T(m.tag_check,this._options.unformatted),m.is_content_unformatted=!m.is_empty_element&&T(m.tag_check,this._options.content_unformatted),m.is_inline_element=T(m.tag_name,this._options.inline)||m.tag_name.includes("-")||m.tag_start_char==="{",m},E.prototype._set_tag_position=function(_,m,y,P,M){if(y.is_empty_element||(y.is_end_tag?y.start_tag_token=this._tag_stack.try_pop(y.tag_name):(this._do_optional_end_element(y)&&(y.is_inline_element||_.print_newline(!1)),this._tag_stack.record_tag(y),(y.tag_name==="script"||y.tag_name==="style")&&!(y.is_unformatted||y.is_content_unformatted)&&(y.custom_beautifier_name=x(y.tag_check,m)))),T(y.tag_check,this._options.extra_liners)&&(_.print_newline(!1),_._output.just_added_blankline()||_.print_newline(!0)),y.is_empty_element){if(y.tag_start_char==="{"&&y.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),y.indent_content=!0;var j=_.current_line_has_match(/{{#if/);j||_.print_newline(!1)}y.tag_name==="!--"&&M.type===o.TAG_CLOSE&&P.is_end_tag&&y.text.indexOf(`
|
|
`)===-1||(y.is_inline_element||y.is_unformatted||_.print_newline(!1),this._calcluate_parent_multiline(_,y))}else if(y.is_end_tag){var W=!1;W=y.start_tag_token&&y.start_tag_token.multiline_content,W=W||!y.is_inline_element&&!(P.is_inline_element||P.is_unformatted)&&!(M.type===o.TAG_CLOSE&&y.start_tag_token===P)&&M.type!=="TK_CONTENT",(y.is_content_unformatted||y.is_unformatted)&&(W=!1),W&&_.print_newline(!1)}else y.indent_content=!y.custom_beautifier_name,y.tag_start_char==="<"&&(y.tag_name==="html"?y.indent_content=this._options.indent_inner_html:y.tag_name==="head"?y.indent_content=this._options.indent_head_inner_html:y.tag_name==="body"&&(y.indent_content=this._options.indent_body_inner_html)),!(y.is_inline_element||y.is_unformatted)&&(M.type!=="TK_CONTENT"||y.is_content_unformatted)&&_.print_newline(!1),this._calcluate_parent_multiline(_,y)},E.prototype._calcluate_parent_multiline=function(_,m){m.parent&&_._output.just_added_newline()&&!((m.is_inline_element||m.is_unformatted)&&m.parent.is_inline_element)&&(m.parent.multiline_content=!0)};var v=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],u=["a","audio","del","ins","map","noscript","video"];E.prototype._do_optional_end_element=function(_){var m=null;if(_.is_empty_element||!_.is_start_tag||!_.parent)return;if(_.tag_name==="body")m=m||this._tag_stack.try_pop("head");else if(_.tag_name==="li")m=m||this._tag_stack.try_pop("li",["ol","ul"]);else if(_.tag_name==="dd"||_.tag_name==="dt")m=m||this._tag_stack.try_pop("dt",["dl"]),m=m||this._tag_stack.try_pop("dd",["dl"]);else if(_.parent.tag_name==="p"&&v.indexOf(_.tag_name)!==-1){var y=_.parent.parent;(!y||u.indexOf(y.tag_name)===-1)&&(m=m||this._tag_stack.try_pop("p"))}else _.tag_name==="rp"||_.tag_name==="rt"?(m=m||this._tag_stack.try_pop("rt",["ruby","rtc"]),m=m||this._tag_stack.try_pop("rp",["ruby","rtc"])):_.tag_name==="optgroup"?m=m||this._tag_stack.try_pop("optgroup",["select"]):_.tag_name==="option"?m=m||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):_.tag_name==="colgroup"?m=m||this._tag_stack.try_pop("caption",["table"]):_.tag_name==="thead"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"])):_.tag_name==="tbody"||_.tag_name==="tfoot"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"]),m=m||this._tag_stack.try_pop("thead",["table"]),m=m||this._tag_stack.try_pop("tbody",["table"])):_.tag_name==="tr"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"]),m=m||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(_.tag_name==="th"||_.tag_name==="td")&&(m=m||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),m=m||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return _.parent=this._tag_stack.get_parser_token(),m},g.exports.Beautifier=E},function(g,p,f){var d=f(6).Options;function a(c){d.call(this,c,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}a.prototype=new d,g.exports.Options=a},function(g,p,f){var d=f(9).Tokenizer,a=f(9).TOKEN,c=f(13).Directives,o=f(14).TemplatablePattern,s=f(12).Pattern,l={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:a.START,RAW:a.RAW,EOF:a.EOF},h=new c(/<\!--/,/-->/),R=function(x,T){d.call(this,x,T),this._current_tag_name="";var O=new o(this._input).read_options(this._options),S=new s(this._input);if(this.__patterns={word:O.until(/[\n\r\t <]/),single_quote:O.until_after(/'/),double_quote:O.until_after(/"/),attribute:O.until(/[\n\r\t =>]|\/>/),element_name:O.until(/[\n\r\t >\/]/),handlebars_comment:S.starting_with(/{{!--/).until_after(/--}}/),handlebars:S.starting_with(/{{/).until_after(/}}/),handlebars_open:S.until(/[\n\r\t }]/),handlebars_raw_close:S.until(/}}/),comment:S.starting_with(/<!--/).until_after(/-->/),cdata:S.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:S.starting_with(/<!\[/).until_after(/]>/),processing:S.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var E=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=S.matching(E).until_after(E)}};R.prototype=new d,R.prototype._is_comment=function(x){return!1},R.prototype._is_opening=function(x){return x.type===l.TAG_OPEN},R.prototype._is_closing=function(x,T){return x.type===l.TAG_CLOSE&&T&&((x.text===">"||x.text==="/>")&&T.text[0]==="<"||x.text==="}}"&&T.text[0]==="{"&&T.text[1]==="{")},R.prototype._reset=function(){this._current_tag_name=""},R.prototype._get_next_token=function(x,T){var O=null;this._readWhitespace();var S=this._input.peek();return S===null?this._create_token(l.EOF,""):(O=O||this._read_open_handlebars(S,T),O=O||this._read_attribute(S,x,T),O=O||this._read_close(S,T),O=O||this._read_raw_content(S,x,T),O=O||this._read_content_word(S),O=O||this._read_comment_or_cdata(S),O=O||this._read_processing(S),O=O||this._read_open(S,T),O=O||this._create_token(l.UNKNOWN,this._input.next()),O)},R.prototype._read_comment_or_cdata=function(x){var T=null,O=null,S=null;if(x==="<"){var E=this._input.peek(1);E==="!"&&(O=this.__patterns.comment.read(),O?(S=h.get_directives(O),S&&S.ignore==="start"&&(O+=h.readIgnored(this._input))):O=this.__patterns.cdata.read()),O&&(T=this._create_token(l.COMMENT,O),T.directives=S)}return T},R.prototype._read_processing=function(x){var T=null,O=null,S=null;if(x==="<"){var E=this._input.peek(1);(E==="!"||E==="?")&&(O=this.__patterns.conditional_comment.read(),O=O||this.__patterns.processing.read()),O&&(T=this._create_token(l.COMMENT,O),T.directives=S)}return T},R.prototype._read_open=function(x,T){var O=null,S=null;return T||x==="<"&&(O=this._input.next(),this._input.peek()==="/"&&(O+=this._input.next()),O+=this.__patterns.element_name.read(),S=this._create_token(l.TAG_OPEN,O)),S},R.prototype._read_open_handlebars=function(x,T){var O=null,S=null;return T||this._options.indent_handlebars&&x==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(O=this.__patterns.handlebars_comment.read(),O=O||this.__patterns.handlebars.read(),S=this._create_token(l.COMMENT,O)):(O=this.__patterns.handlebars_open.read(),S=this._create_token(l.TAG_OPEN,O))),S},R.prototype._read_close=function(x,T){var O=null,S=null;return T&&(T.text[0]==="<"&&(x===">"||x==="/"&&this._input.peek(1)===">")?(O=this._input.next(),x==="/"&&(O+=this._input.next()),S=this._create_token(l.TAG_CLOSE,O)):T.text[0]==="{"&&x==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),S=this._create_token(l.TAG_CLOSE,"}}"))),S},R.prototype._read_attribute=function(x,T,O){var S=null,E="";if(O&&O.text[0]==="<")if(x==="=")S=this._create_token(l.EQUALS,this._input.next());else if(x==='"'||x==="'"){var b=this._input.next();x==='"'?b+=this.__patterns.double_quote.read():b+=this.__patterns.single_quote.read(),S=this._create_token(l.VALUE,b)}else E=this.__patterns.attribute.read(),E&&(T.type===l.EQUALS?S=this._create_token(l.VALUE,E):S=this._create_token(l.ATTRIBUTE,E));return S},R.prototype._is_content_unformatted=function(x){return this._options.void_elements.indexOf(x)===-1&&(this._options.content_unformatted.indexOf(x)!==-1||this._options.unformatted.indexOf(x)!==-1)},R.prototype._read_raw_content=function(x,T,O){var S="";if(O&&O.text[0]==="{")S=this.__patterns.handlebars_raw_close.read();else if(T.type===l.TAG_CLOSE&&T.opened.text[0]==="<"&&T.text[0]!=="/"){var E=T.opened.text.substr(1).toLowerCase();if(E==="script"||E==="style"){var b=this._read_comment_or_cdata(x);if(b)return b.type=l.TEXT,b;S=this._input.readUntil(new RegExp("</"+E+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(E)&&(S=this._input.readUntil(new RegExp("</"+E+"[\\n\\r\\t ]*?>","ig")))}return S?this._create_token(l.TEXT,S):null},R.prototype._read_content_word=function(x){var T="";if(this._options.unformatted_content_delimiter&&(x===this._options.unformatted_content_delimiter[0]&&(T=this.__patterns.unformatted_content_delimiter.read())),T||(T=this.__patterns.word.read()),T)return this._create_token(l.TEXT,T)},g.exports.Tokenizer=R,g.exports.TOKEN=l}],U={};function D(g){var p=U[g];if(p!==void 0)return p.exports;var f=U[g]={exports:{}};return B[g](f,f.exports,D),f.exports}var L=D(18);I=L})();var H=I;if(!0)!(ee=[Q,Q("6UM0"),Q("TXwP")],V=function(B){var U=Q("6UM0"),D=Q("TXwP");return{html_beautify:function(L,g){return H(L,g,U.js_beautify,D.css_beautify)}}}.apply(Qe,ee),V!==void 0&&(st.exports=V));else var k,C})()},"rAM+":function(st,Qe,Q){"use strict";Q.d(Qe,"a",function(){return V});var ee=Q("Qw5x");function V(I,H){var k;if(typeof Symbol=="undefined"||I[Symbol.iterator]==null){if(Array.isArray(I)||(k=Object(ee.a)(I))||H&&I&&typeof I.length=="number"){k&&(I=k);var C=0,B=function(){};return{s:B,n:function(){return C>=I.length?{done:!0}:{done:!1,value:I[C++]}},e:function(p){throw p},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var U=!0,D=!1,L;return{s:function(){k=I[Symbol.iterator]()},n:function(){var p=k.next();return U=p.done,p},e:function(p){D=!0,L=p},f:function(){try{!U&&k.return!=null&&k.return()}finally{if(D)throw L}}}}},rUJ1:function(st,Qe){const Q=/[&<>"']/,ee=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,I=/[<>"']|&(?!#?\w+;)/g,H={"&":"&","<":"<",">":">",'"':""","'":"'"},k=S=>H[S];function C(S,E){if(E){if(Q.test(S))return S.replace(ee,k)}else if(V.test(S))return S.replace(I,k);return S}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(S){return S.replace(B,(E,b)=>(b=b.toLowerCase(),b==="colon"?":":b.charAt(0)==="#"?b.charAt(1)==="x"?String.fromCharCode(parseInt(b.substring(2),16)):String.fromCharCode(+b.substring(1)):""))}const D=/(^|[^\[])\^/g;function L(S,E){S=S.source||S,E=E||"";const b={replace:(v,u)=>(u=u.source||u,u=u.replace(D,"$1"),S=S.replace(v,u),b),getRegex:()=>new RegExp(S,E)};return b}const g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(S,E,b){if(S){let v;try{v=decodeURIComponent(U(b)).replace(g,"").toLowerCase()}catch(u){return null}if(v.indexOf("javascript:")===0||v.indexOf("vbscript:")===0||v.indexOf("data:")===0)return null}E&&!p.test(b)&&(b=s(E,b));try{b=encodeURI(b).replace(/%25/g,"%")}catch(v){return null}return b}const d={},a=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function s(S,E){d[" "+S]||(a.test(S)?d[" "+S]=S+"/":d[" "+S]=x(S,"/",!0)),S=d[" "+S];const b=S.indexOf(":")===-1;return E.substring(0,2)==="//"?b?E:S.replace(c,"$1")+E:E.charAt(0)==="/"?b?E:S.replace(o,"$1")+E:S+E}const l={exec:function(){}};function h(S){let E=1,b,v;for(;E<arguments.length;E++){b=arguments[E];for(v in b)Object.prototype.hasOwnProperty.call(b,v)&&(S[v]=b[v])}return S}function R(S,E){const b=S.replace(/\|/g,(_,m,y)=>{let P=!1,M=m;for(;--M>=0&&y[M]==="\\";)P=!P;return P?"|":" |"}),v=b.split(/ \|/);let u=0;if(v.length>E)v.splice(E);else for(;v.length<E;)v.push("");for(;u<v.length;u++)v[u]=v[u].trim().replace(/\\\|/g,"|");return v}function x(S,E,b){const v=S.length;if(v===0)return"";let u=0;for(;u<v;){const _=S.charAt(v-u-1);if(_===E&&!b)u++;else if(_!==E&&b)u++;else break}return S.substr(0,v-u)}function T(S,E){if(S.indexOf(E[1])===-1)return-1;const b=S.length;let v=0,u=0;for(;u<b;u++)if(S[u]==="\\")u++;else if(S[u]===E[0])v++;else if(S[u]===E[1]&&(v--,v<0))return u;return-1}function O(S){S&&S.sanitize&&!S.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")}st.exports={escape:C,unescape:U,edit:L,cleanUrl:f,resolveUrl:s,noopTest:l,merge:h,splitCells:R,rtrim:x,findClosingBracket:T,checkSanitizeDeprecation:O}},smFo:function(st,Qe,Q){st.exports={wrap:"wrap___1xSvp",header:"header___1niV1",title:"title____shwY",menu:"menu___2Y-rd",top:"top___1_d5Y",line:"line___1kciD",flexCenter:"flexCenter___3bP7s",like:"like___3lXjz",canLike:"canLike___AuDmL",attachmentName:"attachmentName___2SteY"}},ulZh:function(st,Qe,Q){typeof window!="undefined"&&function(V,I){st.exports=I()}(this,function(){return function(ee){var V={};function I(H){if(V[H])return V[H].exports;var k=V[H]={i:H,l:!1,exports:{}};return ee[H].call(k.exports,k,k.exports,I),k.l=!0,k.exports}return I.m=ee,I.c=V,I.d=function(H,k,C){I.o(H,k)||Object.defineProperty(H,k,{enumerable:!0,get:C})},I.r=function(H){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},I.t=function(H,k){if(k&1&&(H=I(H)),k&8)return H;if(k&4&&typeof H=="object"&&H&&H.__esModule)return H;var C=Object.create(null);if(I.r(C),Object.defineProperty(C,"default",{enumerable:!0,value:H}),k&2&&typeof H!="string")for(var B in H)I.d(C,B,function(U){return H[U]}.bind(null,B));return C},I.n=function(H){var k=H&&H.__esModule?function(){return H.default}:function(){return H};return I.d(k,"a",k),k},I.o=function(H,k){return Object.prototype.hasOwnProperty.call(H,k)},I.p="/dist/",I(I.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ee,V,I){"use strict";var H=Object.prototype.hasOwnProperty,k="~";function C(){}Object.create&&(C.prototype=Object.create(null),new C().__proto__||(k=!1));function B(g,p,f){this.fn=g,this.context=p,this.once=f||!1}function U(g,p,f,d,a){if(typeof f!="function")throw new TypeError("The listener must be a function");var c=new B(f,d||g,a),o=k?k+p:p;return g._events[o]?g._events[o].fn?g._events[o]=[g._events[o],c]:g._events[o].push(c):(g._events[o]=c,g._eventsCount++),g}function D(g,p){--g._eventsCount===0?g._events=new C:delete g._events[p]}function L(){this._events=new C,this._eventsCount=0}L.prototype.eventNames=function(){var p=[],f,d;if(this._eventsCount===0)return p;for(d in f=this._events)H.call(f,d)&&p.push(k?d.slice(1):d);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(f)):p},L.prototype.listeners=function(p){var f=k?k+p:p,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var a=0,c=d.length,o=new Array(c);a<c;a++)o[a]=d[a].fn;return o},L.prototype.listenerCount=function(p){var f=k?k+p:p,d=this._events[f];return d?d.fn?1:d.length:0},L.prototype.emit=function(p,f,d,a,c,o){var s=k?k+p:p;if(!this._events[s])return!1;var l=this._events[s],h=arguments.length,R,x;if(l.fn){l.once&&this.removeListener(p,l.fn,void 0,!0);switch(h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,f),!0;case 3:return l.fn.call(l.context,f,d),!0;case 4:return l.fn.call(l.context,f,d,a),!0;case 5:return l.fn.call(l.context,f,d,a,c),!0;case 6:return l.fn.call(l.context,f,d,a,c,o),!0}for(x=1,R=new Array(h-1);x<h;x++)R[x-1]=arguments[x];l.fn.apply(l.context,R)}else{var T=l.length,O;for(x=0;x<T;x++){l[x].once&&this.removeListener(p,l[x].fn,void 0,!0);switch(h){case 1:l[x].fn.call(l[x].context);break;case 2:l[x].fn.call(l[x].context,f);break;case 3:l[x].fn.call(l[x].context,f,d);break;case 4:l[x].fn.call(l[x].context,f,d,a);break;default:if(!R)for(O=1,R=new Array(h-1);O<h;O++)R[O-1]=arguments[O];l[x].fn.apply(l[x].context,R)}}}return!0},L.prototype.on=function(p,f,d){return U(this,p,f,d,!1)},L.prototype.once=function(p,f,d){return U(this,p,f,d,!0)},L.prototype.removeListener=function(p,f,d,a){var c=k?k+p:p;if(!this._events[c])return this;if(!f)return D(this,c),this;var o=this._events[c];if(o.fn)o.fn===f&&(!a||o.once)&&(!d||o.context===d)&&D(this,c);else{for(var s=0,l=[],h=o.length;s<h;s++)(o[s].fn!==f||a&&!o[s].once||d&&o[s].context!==d)&&l.push(o[s]);l.length?this._events[c]=l.length===1?l[0]:l:D(this,c)}return this},L.prototype.removeAllListeners=function(p){var f;return p?(f=k?k+p:p,this._events[f]&&D(this,f)):(this._events=new C,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=k,L.EventEmitter=L,ee.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(ee,V,I){(function(H){var k=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,C=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,D={buildAbsoluteURL:function(L,g,p){if(p=p||{},L=L.trim(),g=g.trim(),!g){if(!p.alwaysNormalize)return L;var f=D.parseURL(L);if(!f)throw new Error("Error trying to parse base URL.");return f.path=D.normalizePath(f.path),D.buildURLFromParts(f)}var d=D.parseURL(g);if(!d)throw new Error("Error trying to parse relative URL.");if(d.scheme)return p.alwaysNormalize?(d.path=D.normalizePath(d.path),D.buildURLFromParts(d)):g;var a=D.parseURL(L);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&a.path[0]!=="/"){var c=C.exec(a.path);a.netLoc=c[1],a.path=c[2]}a.netLoc&&!a.path&&(a.path="/");var o={scheme:a.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(o.netLoc=a.netLoc,d.path[0]!=="/"))if(!d.path)o.path=a.path,d.params||(o.params=a.params,d.query||(o.query=a.query));else{var s=a.path,l=s.substring(0,s.lastIndexOf("/")+1)+d.path;o.path=D.normalizePath(l)}return o.path===null&&(o.path=p.alwaysNormalize?D.normalizePath(d.path):d.path),D.buildURLFromParts(o)},parseURL:function(L){var g=k.exec(L);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(B,"");L.length!==(L=L.replace(U,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};ee.exports=D})(this)},"./node_modules/webworkify-webpack/index.js":function(ee,V,I){function H(p){var f={};function d(c){if(f[c])return f[c].exports;var o=f[c]={i:c,l:!1,exports:{}};return p[c].call(o.exports,o,o.exports,d),o.l=!0,o.exports}d.m=p,d.c=f,d.i=function(c){return c},d.d=function(c,o,s){d.o(c,o)||Object.defineProperty(c,o,{configurable:!1,enumerable:!0,get:s})},d.r=function(c){Object.defineProperty(c,"__esModule",{value:!0})},d.n=function(c){var o=c&&c.__esModule?function(){return c.default}:function(){return c};return d.d(o,"a",o),o},d.o=function(c,o){return Object.prototype.hasOwnProperty.call(c,o)},d.p="/",d.oe=function(c){throw console.error(c),c};var a=d(d.s=ENTRY_MODULE);return a.default||a}var k="[\\.|\\-|\\+|\\w|/|@]+",C="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+k+").*?\\)";function B(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(p){return!isNaN(1*p)}function D(p,f,d){var a={};a[d]=[];var c=f.toString(),o=c.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return a;for(var s=o[1],l=new RegExp("(\\\\n|\\W)"+B(s)+C,"g"),h;h=l.exec(c);){if(h[3]==="dll-reference")continue;a[d].push(h[3])}for(l=new RegExp("\\("+B(s)+'\\("(dll-reference\\s('+k+'))"\\)\\)'+C,"g");h=l.exec(c);)p[h[2]]||(a[d].push(h[1]),p[h[2]]=I(h[1]).m),a[h[2]]=a[h[2]]||[],a[h[2]].push(h[4]);for(var R=Object.keys(a),x=0;x<R.length;x++)for(var T=0;T<a[R[x]].length;T++)U(a[R[x]][T])&&(a[R[x]][T]=1*a[R[x]][T]);return a}function L(p){var f=Object.keys(p);return f.reduce(function(d,a){return d||p[a].length>0},!1)}function g(p,f){for(var d={main:[f]},a={main:[]},c={main:{}};L(d);)for(var o=Object.keys(d),s=0;s<o.length;s++){var l=o[s],h=d[l],R=h.pop();if(c[l]=c[l]||{},c[l][R]||!p[l][R])continue;c[l][R]=!0,a[l]=a[l]||[],a[l].push(R);for(var x=D(p,p[l][R],l),T=Object.keys(x),O=0;O<T.length;O++)d[T[O]]=d[T[O]]||[],d[T[O]]=d[T[O]].concat(x[T[O]])}return a}ee.exports=function(p,f){f=f||{};var d={main:I.m},a=f.all?{main:Object.keys(d.main)}:g(d,p),c="";Object.keys(a).filter(function(R){return R!=="main"}).forEach(function(R){for(var x=0;a[R][x];)x++;a[R].push(x),d[R][x]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",c=c+"var "+R+" = ("+H.toString().replace("ENTRY_MODULE",JSON.stringify(x))+")({"+a[R].map(function(T){return""+JSON.stringify(T)+": "+d[R][T].toString()}).join(",")+`});
|
|
`}),c=c+"new (("+H.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+a.main.map(function(R){return""+JSON.stringify(R)+": "+d.main[R].toString()}).join(",")+"}))(self);";var o=new window.Blob([c],{type:"text/javascript"});if(f.bare)return o;var s=window.URL||window.webkitURL||window.mozURL||window.msURL,l=s.createObjectURL(o),h=new window.Worker(l);return h.objectURL=l,h}},"./src/config.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"hlsDefaultConfig",function(){return O}),I.d(V,"mergeConfig",function(){return E}),I.d(V,"enableStreamingMode",function(){return b});var H=I("./src/controller/abr-controller.ts"),k=I("./src/controller/audio-stream-controller.ts"),C=I("./src/controller/audio-track-controller.ts"),B=I("./src/controller/subtitle-stream-controller.ts"),U=I("./src/controller/subtitle-track-controller.ts"),D=I("./src/controller/buffer-controller.ts"),L=I("./src/controller/timeline-controller.ts"),g=I("./src/controller/cap-level-controller.ts"),p=I("./src/controller/fps-controller.ts"),f=I("./src/controller/eme-controller.ts"),d=I("./src/controller/cmcd-controller.ts"),a=I("./src/utils/xhr-loader.ts"),c=I("./src/utils/fetch-loader.ts"),o=I("./src/utils/cues.ts"),s=I("./src/utils/mediakeys-helper.ts"),l=I("./src/utils/logger.ts");function h(){return h=Object.assign||function(v){for(var u=1;u<arguments.length;u++){var _=arguments[u];for(var m in _)Object.prototype.hasOwnProperty.call(_,m)&&(v[m]=_[m])}return v},h.apply(this,arguments)}function R(v,u){var _=Object.keys(v);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(v);u&&(m=m.filter(function(y){return Object.getOwnPropertyDescriptor(v,y).enumerable})),_.push.apply(_,m)}return _}function x(v){for(var u=1;u<arguments.length;u++){var _=arguments[u]!=null?arguments[u]:{};u%2?R(Object(_),!0).forEach(function(m){T(v,m,_[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(_)):R(Object(_)).forEach(function(m){Object.defineProperty(v,m,Object.getOwnPropertyDescriptor(_,m))})}return v}function T(v,u,_){return u in v?Object.defineProperty(v,u,{value:_,enumerable:!0,configurable:!0,writable:!0}):v[u]=_,v}var O=x(x({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:a.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:H.default,bufferController:D.default,capLevelController:g.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:s.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},S()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:U.default,timelineController:L.TimelineController,audioStreamController:k.default,audioTrackController:C.default,emeController:f.default,cmcdController:d.default});function S(){return{cueHandler:o.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 E(v,u){if((u.liveSyncDurationCount||u.liveMaxLatencyDurationCount)&&(u.liveSyncDuration||u.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(u.liveMaxLatencyDurationCount!==void 0&&(u.liveSyncDurationCount===void 0||u.liveMaxLatencyDurationCount<=u.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(u.liveMaxLatencyDuration!==void 0&&(u.liveSyncDuration===void 0||u.liveMaxLatencyDuration<=u.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},v,u)}function b(v){var u=v.loader;if(u!==c.default&&u!==a.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),v.progressive=!1;else{var _=Object(c.fetchSupported)();_&&(v.loader=c.default,v.progressive=!0,v.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/polyfills/number.ts"),k=I("./src/utils/ewma-bandwidth-estimator.ts"),C=I("./src/events.ts"),B=I("./src/utils/buffer-helper.ts"),U=I("./src/errors.ts"),D=I("./src/types/loader.ts"),L=I("./src/utils/logger.ts");function g(d,a){for(var c=0;c<a.length;c++){var o=a[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(d,o.key,o)}}function p(d,a,c){return a&&g(d.prototype,a),c&&g(d,c),d}var f=function(){function d(c){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=c;var o=c.config;this.bwEstimator=new k.default(o.abrEwmaSlowVoD,o.abrEwmaFastVoD,o.abrEwmaDefaultEstimate),this.registerListeners()}var a=d.prototype;return a.registerListeners=function(){var o=this.hls;o.on(C.Events.FRAG_LOADING,this.onFragLoading,this),o.on(C.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(C.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.on(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(C.Events.ERROR,this.onError,this)},a.unregisterListeners=function(){var o=this.hls;o.off(C.Events.FRAG_LOADING,this.onFragLoading,this),o.off(C.Events.FRAG_LOADED,this.onFragLoaded,this),o.off(C.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.off(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(C.Events.ERROR,this.onError,this)},a.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},a.onFragLoading=function(o,s){var l=s.frag;if(l.type===D.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=l,this.partCurrent=(h=s.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},a.onLevelLoaded=function(o,s){var l=this.hls.config;s.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},a._abandonRulesCheck=function(){var o=this.fragCurrent,s=this.partCurrent,l=this.hls,h=l.autoLevelEnabled,R=l.config,x=l.media;if(!o||!x)return;var T=s?s.stats:o.stats,O=s?s.duration:o.duration;if(T.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||x.paused||!x.playbackRate||!x.readyState)return;var S=performance.now()-T.loading.start,E=Math.abs(x.playbackRate);if(S<=500*O/E)return;var b=l.levels,v=l.minAutoLevel,u=b[o.level],_=T.total||Math.max(T.loaded,Math.round(O*u.maxBitrate/8)),m=Math.max(1,T.bwEstimate?T.bwEstimate/8:T.loaded*1e3/S),y=(_-T.loaded)/m,P=x.currentTime,M=(B.BufferHelper.bufferInfo(x,P,R.maxBufferHole).end-P)/E;if(M>=2*O/E||y<=M)return;var j=Number.POSITIVE_INFINITY,W;for(W=o.level-1;W>v;W--){var N=b[W].maxBitrate;if(j=O*N/(8*.8*m),j<M)break}if(j>=y)return;var w=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+o.sn+(s?" part "+s.index:"")+" of level "+o.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(H.isFiniteNumber)(w)?(w/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+y.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+M.toFixed(3)+" s"),l.nextLoadLevel=W,this.bwEstimator.sample(S,T.loaded),this.clearTimer(),o.loader&&(this.fragCurrent=this.partCurrent=null,o.loader.abort()),l.trigger(C.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:s,stats:T})},a.onFragLoaded=function(o,s){var l=s.frag,h=s.part;if(l.type===D.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(l.sn)){var R=h?h.stats:l.stats,x=h?h.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var T=this.hls.levels[l.level],O=(T.loaded?T.loaded.bytes:0)+R.loaded,S=(T.loaded?T.loaded.duration:0)+x;T.loaded={bytes:O,duration:S},T.realBitrate=Math.round(8*O/S)}if(l.bitrateTest){var E={stats:R,frag:l,part:h,id:l.type};this.onFragBuffered(C.Events.FRAG_BUFFERED,E),l.bitrateTest=!1}}},a.onFragBuffered=function(o,s){var l=s.frag,h=s.part,R=h?h.stats:l.stats;if(R.aborted)return;if(l.type!==D.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var x=R.parsing.end-R.loading.start;this.bwEstimator.sample(x,R.loaded),R.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=x/1e3:this.bitrateTestDelay=0},a.onError=function(o,s){switch(s.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},a.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},a.getNextABRAutoLevel=function(){var o=this.fragCurrent,s=this.partCurrent,l=this.hls,h=l.maxAutoLevel,R=l.config,x=l.minAutoLevel,T=l.media,O=s?s.duration:o?o.duration:0,S=T?T.currentTime:0,E=T&&T.playbackRate!==0?Math.abs(T.playbackRate):1,b=this.bwEstimator?this.bwEstimator.getEstimate():R.abrEwmaDefaultEstimate,v=(B.BufferHelper.bufferInfo(T,S,R.maxBufferHole).end-S)/E,u=this.findBestLevel(b,x,h,v,R.abrBandWidthFactor,R.abrBandWidthUpFactor);if(u>=0)return u;L.logger.trace((v?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var _=O?Math.min(O,R.maxStarvationDelay):R.maxStarvationDelay,m=R.abrBandWidthFactor,y=R.abrBandWidthUpFactor;if(!v){var P=this.bitrateTestDelay;if(P){var M=O?Math.min(O,R.maxLoadingDelay):R.maxLoadingDelay;_=M-P,L.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*_)+" ms"),m=y=1}}return u=this.findBestLevel(b,x,h,v+_,m,y),Math.max(u,0)},a.findBestLevel=function(o,s,l,h,R,x){for(var T,O=this.fragCurrent,S=this.partCurrent,E=this.lastLoadedFragLevel,b=this.hls.levels,v=b[E],u=!!(v!=null&&(T=v.details)!==null&&T!==void 0&&T.live),_=v==null?void 0:v.codecSet,m=S?S.duration:O?O.duration:0,y=l;y>=s;y--){var P=b[y];if(!P||_&&P.codecSet!==_)continue;var M=P.details,j=(S?M==null?void 0:M.partTarget:M==null?void 0:M.averagetargetduration)||m,W=void 0;y<=E?W=R*o:W=x*o;var N=b[y].maxBitrate,w=N*j/W;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(W)+"/"+N+"/"+j+"/"+h+"/"+w),W>N&&(!w||u&&!this.bitrateTestDelay||w<h))return y}return-1},p(d,[{key:"nextAutoLevel",get:function(){var o=this._nextAutoLevel,s=this.bwEstimator;if(o!==-1&&(!s||!s.canEstimate()))return o;var l=this.getNextABRAutoLevel();return o!==-1&&(l=Math.min(o,l)),l},set:function(o){this._nextAutoLevel=o}}]),d}();V.default=f},"./src/controller/audio-stream-controller.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/polyfills/number.ts"),k=I("./src/controller/base-stream-controller.ts"),C=I("./src/events.ts"),B=I("./src/utils/buffer-helper.ts"),U=I("./src/controller/fragment-tracker.ts"),D=I("./src/types/level.ts"),L=I("./src/types/loader.ts"),g=I("./src/loader/fragment.ts"),p=I("./src/demux/chunk-cache.ts"),f=I("./src/demux/transmuxer-interface.ts"),d=I("./src/types/transmuxer.ts"),a=I("./src/controller/fragment-finders.ts"),c=I("./src/utils/discontinuities.ts"),o=I("./src/errors.ts"),s=I("./src/utils/logger.ts");function l(){return l=Object.assign||function(O){for(var S=1;S<arguments.length;S++){var E=arguments[S];for(var b in E)Object.prototype.hasOwnProperty.call(E,b)&&(O[b]=E[b])}return O},l.apply(this,arguments)}function h(O,S){O.prototype=Object.create(S.prototype),O.prototype.constructor=O,R(O,S)}function R(O,S){return R=Object.setPrototypeOf||function(b,v){return b.__proto__=v,b},R(O,S)}var x=100,T=function(O){h(S,O);function S(b,v){var u;return u=O.call(this,b,v,"[audio-stream-controller]")||this,u.videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u._registerListeners(),u}var E=S.prototype;return E.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},E._registerListeners=function(){var v=this.hls;v.on(C.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.on(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.on(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),v.on(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(C.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),v.on(C.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),v.on(C.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),v.on(C.Events.ERROR,this.onError,this),v.on(C.Events.BUFFER_RESET,this.onBufferReset,this),v.on(C.Events.BUFFER_CREATED,this.onBufferCreated,this),v.on(C.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),v.on(C.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),v.on(C.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var v=this.hls;v.off(C.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.off(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.off(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),v.off(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(C.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),v.off(C.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),v.off(C.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),v.off(C.Events.ERROR,this.onError,this),v.off(C.Events.BUFFER_RESET,this.onBufferReset,this),v.off(C.Events.BUFFER_CREATED,this.onBufferCreated,this),v.off(C.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),v.off(C.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),v.off(C.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onInitPtsFound=function(v,u){var _=u.frag,m=u.id,y=u.initPTS;if(m==="main"){var P=_.cc;this.initPTS[_.cc]=y,this.log("InitPTS for cc: "+P+" found from main: "+y),this.videoTrackCC=P,this.state===k.State.WAITING_INIT_PTS&&this.tick()}},E.startLoad=function(v){if(!this.levels){this.startPosition=v,this.state=k.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(x),this.fragLoadError=0,u>0&&v===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=k.State.IDLE):(this.loadedmetadata=!1,this.state=k.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=v,this.tick()},E.doTick=function(){switch(this.state){case k.State.IDLE:this.doTickIdle();break;case k.State.WAITING_TRACK:{var v,u=this.levels,_=this.trackId,m=u==null||((v=u[_])===null||v===void 0)?void 0:v.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=k.State.WAITING_INIT_PTS}break}case k.State.FRAG_LOADING_WAITING_RETRY:{var y,P=performance.now(),M=this.retryDate;(!M||P>=M||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=k.State.IDLE);break}case k.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,N=j.part,w=j.cache,G=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=k.State.FRAG_LOADING;var J=w.flush(),Z={frag:W,part:N,payload:J,networkDetails:null};this._handleFragmentLoadProgress(Z),G&&O.prototype._handleFragmentLoadComplete.call(this,Z)}else if(this.videoTrackCC!==this.waitingVideoCC)s.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ae=this.getLoadPosition(),_e=B.BufferHelper.bufferInfo(this.mediaBuffer,ae,this.config.maxBufferHole),ce=Object(a.fragmentWithinToleranceTest)(_e.end,this.config.maxFragLookUpTolerance,W);ce<0&&(s.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+_e.end+" is needed"),this.clearWaitingFragment())}}else this.state=k.State.IDLE}}this.onTickEnd()},E.clearWaitingFragment=function(){var v=this.waitingData;v&&(this.fragmentTracker.removeFragment(v.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=k.State.IDLE)},E.onTickEnd=function(){var v=this.media;if(!v||!v.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:v,_=u.buffered;!this.loadedmetadata&&_.length&&(this.loadedmetadata=!0),this.lastCurrentTime=v.currentTime},E.doTickIdle=function(){var v,u,_=this.hls,m=this.levels,y=this.media,P=this.trackId,M=_.config;if(!m||!m[P])return;if(!y&&(this.startFragRequested||!M.startFragPrefetch))return;var j=m[P],W=j.details;if(!W||W.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(W)){this.state=k.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var N=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(N===null)return;var w=N.len,G=this.getMaxBufferLength(),J=this.audioSwitch;if(w>=G&&!J)return;if(!J&&this._streamEnded(N,W)){_.trigger(C.Events.BUFFER_EOS,{type:"audio"}),this.state=k.State.ENDED;return}var Z=W.fragments,ae=Z[0].start,_e=N.end;if(J){var ce=this.getLoadPosition();_e=ce,W.PTSKnown&&ce<ae&&((N.end>ae||N.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=ae+.05))}var he=this.getNextFragment(_e,W);if(!he){this.bufferFlushed=!0;return}((v=he.decryptdata)===null||v===void 0?void 0:v.keyFormat)==="identity"&&!((u=he.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(he,W):this.loadFragment(he,W,_e)},E.getMaxBufferLength=function(){var v=O.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return u===null?v:Math.max(v,u.len)},E.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},E.onAudioTracksUpdated=function(v,u){var _=u.audioTracks;this.resetTransmuxer(),this.levels=_.map(function(m){return new D.Level(m)})},E.onAudioTrackSwitching=function(v,u){var _=!!u.url;this.trackId=u.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),_?this.setInterval(x):this.resetTransmuxer(),_?(this.audioSwitch=!0,this.state=k.State.IDLE):this.state=k.State.STOPPED,this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},E.onLevelLoaded=function(v,u){this.mainDetails=u.details},E.onAudioTrackLoaded=function(v,u){var _,m=this.levels,y=u.details,P=u.id;if(!m){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var M=m[P],j=0;if(y.live||(_=M.details)!==null&&_!==void 0&&_.live){var W=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!W)return;!M.details&&y.hasProgramDateTime&&W.hasProgramDateTime?(Object(c.alignMediaPlaylistByPDT)(y,W),j=y.fragments[0].start):j=this.alignPlaylists(y,M.details)}M.details=y,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(M.details,j),this.state===k.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=k.State.IDLE),this.tick()},E._handleFragmentLoadProgress=function(v){var u,_=v.frag,m=v.part,y=v.payload,P=this.config,M=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+_.sn+" of level "+_.level+" will not be buffered");return}var W=j[M];console.assert(W,"Audio track is defined on fragment load progress");var N=W.details;console.assert(N,"Audio track details are defined on fragment load progress");var w=P.defaultAudioCodec||W.audioCodec||"mp4a.40.2",G=this.transmuxer;G||(G=this.transmuxer=new f.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var J=this.initPTS[_.cc],Z=(u=_.initSegment)===null||u===void 0?void 0:u.data;if(J!==void 0){var ae=!1,_e=m?m.index:-1,ce=_e!==-1,he=new d.ChunkMetadata(_.level,_.sn,_.stats.chunkCount,y.byteLength,_e,ce);G.push(y,Z,w,"",_,m,N.totalduration,ae,he,J)}else{s.logger.log("Unknown video PTS for cc "+_.cc+", waiting for video PTS before demuxing audio frag "+_.sn+" of ["+N.startSN+" ,"+N.endSN+"],track "+M);var fe=this.waitingData=this.waitingData||{frag:_,part:m,cache:new p.default,complete:!1},pe=fe.cache;pe.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=k.State.WAITING_INIT_PTS}},E._handleFragmentLoadComplete=function(v){if(this.waitingData){this.waitingData.complete=!0;return}O.prototype._handleFragmentLoadComplete.call(this,v)},E.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},E.onBufferCreated=function(v,u){var _=u.tracks.audio;_&&(this.mediaBuffer=_.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},E.onFragBuffered=function(v,u){var _=u.frag,m=u.part;if(_.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(_)){this.warn("Fragment "+_.sn+(m?" p: "+m.index:"")+" of level "+_.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}_.sn!=="initSegment"&&(this.fragPrevious=_,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(C.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(_,m)},E.onError=function(v,u){switch(u.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,u);break;case o.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case o.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==k.State.ERROR&&this.state!==k.State.STOPPED&&(this.state=u.fatal?k.State.ERROR:k.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="audio"&&(this.state===k.State.PARSING||this.state===k.State.PARSED)){var _=!0,m=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);m&&m.len>.5&&(_=!this.reduceMaxBufferLength(m.len)),_&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},E.onBufferFlushed=function(v,u){var _=u.type;_===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},E._handleTransmuxComplete=function(v){var u,_="audio",m=this.hls,y=v.remuxResult,P=v.chunkMeta,M=this.getCurrentContext(P);if(!M){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var j=M.frag,W=M.part,N=y.audio,w=y.text,G=y.id3,J=y.initSegment;if(this.fragContextChanged(j))return;if(this.state=k.State.PARSING,this.audioSwitch&&N&&this.completeAudioSwitch(),J!=null&&J.tracks&&(this._bufferInitSegment(J.tracks,j,P),m.trigger(C.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:_,tracks:J.tracks})),N){var Z=N.startPTS,ae=N.endPTS,_e=N.startDTS,ce=N.endDTS;W&&(W.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:Z,endPTS:ae,startDTS:_e,endDTS:ce}),j.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,Z,ae,_e,ce),this.bufferFragmentData(N,j,W,P)}if(G!=null&&(u=G.samples)!==null&&u!==void 0&&u.length){var he=l({frag:j,id:_},G);m.trigger(C.Events.FRAG_PARSING_METADATA,he)}if(w){var fe=l({frag:j,id:_},w);m.trigger(C.Events.FRAG_PARSING_USERDATA,fe)}},E._bufferInitSegment=function(v,u,_){if(this.state!==k.State.PARSING)return;v.video&&delete v.video;var m=v.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(C.Events.BUFFER_CODECS,v);var y=m.initSegment;if(y!=null&&y.byteLength){var P={type:"audio",frag:u,part:null,chunkMeta:_,parent:u.type,data:y};this.hls.trigger(C.Events.BUFFER_APPENDING,P)}this.tick()},E.loadFragment=function(v,u,_){var m=this.fragmentTracker.getState(v);this.fragCurrent=v,(this.audioSwitch||m===U.FragmentState.NOT_LOADED||m===U.FragmentState.PARTIAL)&&(v.sn==="initSegment"?this._loadInitSegment(v):u.live&&!Object(H.isFiniteNumber)(this.initPTS[v.cc])?(this.log("Waiting for video PTS in continuity counter "+v.cc+" of live stream before loading audio fragment "+v.sn+" of level "+this.trackId),this.state=k.State.WAITING_INIT_PTS):(this.startFragRequested=!0,O.prototype.loadFragment.call(this,v,u,_)))},E.completeAudioSwitch=function(){var v=this.hls,u=this.media,_=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,v.trigger(C.Events.AUDIO_TRACK_SWITCHED,{id:_})},S}(k.default);V.default=T},"./src/controller/audio-track-controller.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/events.ts"),k=I("./src/errors.ts"),C=I("./src/controller/base-playlist-controller.ts"),B=I("./src/types/loader.ts");function U(f,d){for(var a=0;a<d.length;a++){var c=d[a];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(f,c.key,c)}}function D(f,d,a){return d&&U(f.prototype,d),a&&U(f,a),f}function L(f,d){f.prototype=Object.create(d.prototype),f.prototype.constructor=f,g(f,d)}function g(f,d){return g=Object.setPrototypeOf||function(c,o){return c.__proto__=o,c},g(f,d)}var p=function(f){L(d,f);function d(c){var o;return o=f.call(this,c,"[audio-track-controller]")||this,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.trackName="",o.selectDefaultTrack=!0,o.registerListeners(),o}var a=d.prototype;return a.registerListeners=function(){var o=this.hls;o.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(H.Events.ERROR,this.onError,this)},a.unregisterListeners=function(){var o=this.hls;o.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(H.Events.ERROR,this.onError,this)},a.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,f.prototype.destroy.call(this)},a.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},a.onManifestParsed=function(o,s){this.tracks=s.audioTracks||[]},a.onAudioTrackLoaded=function(o,s){var l=s.id,h=s.details,R=this.tracksInGroup[l];if(!R){this.warn("Invalid audio track id "+l);return}var x=R.details;R.details=s.details,this.log("audioTrack "+l+" loaded ["+h.startSN+"-"+h.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,x))},a.onLevelLoading=function(o,s){this.switchLevel(s.level)},a.onLevelSwitching=function(o,s){this.switchLevel(s.level)},a.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.audioGroupIds))return;var l=s.audioGroupIds[s.urlId];if(this.groupId!==l){this.groupId=l;var h=this.tracks.filter(function(x){return!l||x.groupId===l});this.selectDefaultTrack&&!h.some(function(x){return x.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var R={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(H.Events.AUDIO_TRACKS_UPDATED,R),this.selectInitialTrack()}},a.onError=function(o,s){if(f.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===B.PlaylistContextType.AUDIO_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},a.setAudioTrack=function(o){var s=this.tracksInGroup;if(o<0||o>=s.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=s[this.trackId];this.log("Now switching to audio-track index "+o);var h=s[o],R=h.id,x=h.groupId,T=x===void 0?"":x,O=h.name,S=h.type,E=h.url;if(this.trackId=o,this.trackName=O,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:R,groupId:T,name:O,type:S,url:E}),h.details&&!h.details.live)return;var b=this.switchParams(h.url,l==null?void 0:l.details);this.loadPlaylist(b)},a.selectInitialTrack=function(){var o=this.tracksInGroup;console.assert(o.length,"Initial audio track should be selected when tracks are known");var s=this.trackName,l=this.findTrackId(s)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},a.findTrackId=function(o){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var h=s[l];if((!this.selectDefaultTrack||h.default)&&(!o||o===h.name))return h.id}return-1},a.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,h=s.groupId,R=s.url;if(o)try{R=o.addDirectives(R)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(H.Events.AUDIO_TRACK_LOADING,{url:R,id:l,groupId:h,deliveryDirectives:o||null})}},D(d,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1,this.setAudioTrack(o)}}]),d}(C.default);V.default=p},"./src/controller/base-playlist-controller.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return D});var H=I("./src/polyfills/number.ts"),k=I("./src/types/level.ts"),C=I("./src/controller/level-helper.ts"),B=I("./src/utils/logger.ts"),U=I("./src/errors.ts"),D=function(){function L(p,f){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,f+":"),this.warn=B.logger.warn.bind(B.logger,f+":"),this.hls=p}var g=L.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(f,d){d.fatal&&d.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(f,d){var a=d==null?void 0:d.renditionReports;if(a)for(var c=0;c<a.length;c++){var o=a[c],s=""+o.URI;if(s===f.substr(-s.length)){var l=parseInt(o["LAST-MSN"]),h=parseInt(o["LAST-PART"]);if(d&&this.hls.config.lowLatencyMode){var R=Math.min(d.age-d.partTarget,d.targetduration);h!==void 0&&R>d.partTarget&&(h+=1)}if(Object(H.isFiniteNumber)(l))return new k.HlsUrlParameters(l,Object(H.isFiniteNumber)(h)?h:void 0,k.HlsSkip.No)}}},g.loadPlaylist=function(f){},g.shouldLoadTrack=function(f){return this.canLoad&&f&&!!f.url&&(!f.details||f.details.live)},g.playlistLoaded=function(f,d,a){var c=this,o=d.details,s=d.stats,l=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(o.advancedDateTime=Date.now()-l,o.live||a!=null&&a.live){if(o.reloaded(a),a&&this.log("live playlist "+f+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),a&&o.fragments.length>0&&Object(C.mergeDetails)(a,o),!this.canLoad||!o.live)return;var h,R=void 0,x=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var T=this.hls.config.lowLatencyMode,O=o.lastPartSn,S=o.endSN,E=o.lastPartIndex,b=E!==-1,v=O===S,u=T?0:E;b?(R=v?S+1:O,x=v?u:E+1):R=S+1;var _=o.age,m=_+o.ageHeader,y=Math.min(m-o.partTarget,o.targetduration*1.5);if(y>0){if(a&&y>a.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+a.tuneInGoal+" to: "+y+" with playlist age: "+o.age),y=0;else{var P=Math.floor(y/o.targetduration);if(R+=P,x!==void 0){var M=Math.round(y%o.targetduration/o.partTarget);x+=M}this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+_.toFixed(2)+"s goal: "+y+" skip sn "+P+" to part "+x)}o.tuneInGoal=y}if(h=this.getDeliveryDirectives(o,d.deliveryDirectives,R,x),T||!v){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(o,d.deliveryDirectives,R,x);var j=Object(C.computeReloadInterval)(o,s);R!==void 0&&o.canBlockReload&&(j-=o.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return c.loadPlaylist(h)},j)}else this.clearTimer()},g.getDeliveryDirectives=function(f,d,a,c){var o=Object(k.getSkipValue)(f,a);return d!=null&&d.skip&&f.deltaUpdateFailed&&(a=d.msn,c=d.part,o=k.HlsSkip.No),new k.HlsUrlParameters(a,c,o)},g.retryLoadingOrFail=function(f){var d=this,a=this.hls.config,c=this.retryCount<a.levelLoadingMaxRetry;if(c){var o;if(this.retryCount++,f.details.indexOf("LoadTimeOut")>-1&&(o=f.context)!==null&&o!==void 0&&o.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+f.details+'"'),this.loadPlaylist();else{var s=Math.min(Math.pow(2,this.retryCount)*a.levelLoadingRetryDelay,a.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return d.loadPlaylist()},s),this.warn("retry playlist loading #"+this.retryCount+" in "+s+' ms after "'+f.details+'"')}}else this.warn('cannot recover from error "'+f.details+'"'),this.clearTimer(),f.fatal=!0;return c},L}()},"./src/controller/base-stream-controller.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"State",function(){return S}),I.d(V,"default",function(){return E});var H=I("./src/polyfills/number.ts"),k=I("./src/task-loop.ts"),C=I("./src/controller/fragment-tracker.ts"),B=I("./src/utils/buffer-helper.ts"),U=I("./src/utils/logger.ts"),D=I("./src/events.ts"),L=I("./src/errors.ts"),g=I("./src/types/transmuxer.ts"),p=I("./src/utils/mp4-tools.ts"),f=I("./src/utils/discontinuities.ts"),d=I("./src/controller/fragment-finders.ts"),a=I("./src/controller/level-helper.ts"),c=I("./src/loader/fragment-loader.ts"),o=I("./src/crypt/decrypter.ts"),s=I("./src/utils/time-ranges.ts"),l=I("./src/types/loader.ts");function h(b,v){for(var u=0;u<v.length;u++){var _=v[u];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(b,_.key,_)}}function R(b,v,u){return v&&h(b.prototype,v),u&&h(b,u),b}function x(b){if(b===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b}function T(b,v){b.prototype=Object.create(v.prototype),b.prototype.constructor=b,O(b,v)}function O(b,v){return O=Object.setPrototypeOf||function(_,m){return _.__proto__=m,_},O(b,v)}var S={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"},E=function(b){T(v,b);function v(_,m,y){var P;return P=b.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=S.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=y,P.log=U.logger.log.bind(U.logger,y+":"),P.warn=U.logger.warn.bind(U.logger,y+":"),P.hls=_,P.fragmentLoader=new c.default(_.config),P.fragmentTracker=m,P.config=_.config,P.decrypter=new o.default(_,_.config),_.on(D.Events.KEY_LOADED,P.onKeyLoaded,x(P)),P}var u=v.prototype;return u.doTick=function(){this.onTickEnd()},u.onTickEnd=function(){},u.startLoad=function(m){},u.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=S.STOPPED},u._streamEnded=function(m,y){var P=this.fragCurrent,M=this.fragmentTracker;if(!y.live&&P&&P.sn===y.endSN&&!m.nextStart){var j=M.getState(P);return j===C.FragmentState.PARTIAL||j===C.FragmentState.OK}return!1},u.onMediaAttached=function(m,y){var P=this.media=this.mediaBuffer=y.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var M=this.config;this.levels&&M.autoStartLoad&&this.state===S.STOPPED&&this.startLoad(M.startPosition)},u.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},u.onMediaSeeking=function(){var m=this.config,y=this.fragCurrent,P=this.media,M=this.mediaBuffer,j=this.state,W=P?P.currentTime:0,N=B.BufferHelper.bufferInfo(M||P,W,m.maxBufferHole);if(this.log("media seeking to "+(Object(H.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===S.ENDED)this.resetLoadingState();else if(y&&!N.len){var w=m.maxFragLookUpTolerance,G=y.start-w,J=y.start+y.duration+w,Z=W>J;(W<G||Z)&&(Z&&y.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),y.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=W),!this.loadedmetadata&&!N.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(m,y){if(this.state!==S.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=S.IDLE;var P=this.levels[y.frag.level].details;P&&this.loadFragment(y.frag,P,y.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),b.prototype.onHandlerDestroying.call(this)},u.onHandlerDestroyed=function(){this.state=S.STOPPED,this.hls.off(D.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,b.prototype.onHandlerDestroyed.call(this)},u.loadKey=function(m,y){this.log("Loading key for "+m.sn+" of ["+y.startSN+"-"+y.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=S.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(D.Events.KEY_LOADING,{frag:m})},u.loadFragment=function(m,y,P){this._loadFragForPlayback(m,y,P)},u._loadFragForPlayback=function(m,y,P){var M=this,j=function(N){if(M.fragContextChanged(m)){M.warn("Fragment "+m.sn+(N.part?" p: "+N.part.index:"")+" of level "+m.level+" was dropped during download."),M.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,M._handleFragmentLoadProgress(N)};this._doFragLoad(m,y,P,j).then(function(W){if(!W)return;M.fragLoadError=0;var N=M.state;if(M.fragContextChanged(m)){(N===S.FRAG_LOADING||N===S.BACKTRACKING||!M.fragCurrent&&N===S.PARSING)&&(M.fragmentTracker.removeFragment(m),M.state=S.IDLE);return}if("payload"in W&&(M.log("Loaded fragment "+m.sn+" of level "+m.level),M.hls.trigger(D.Events.FRAG_LOADED,W),M.state===S.BACKTRACKING)){M.fragmentTracker.backtrack(m,W),M.resetFragmentLoading(m);return}M._handleFragmentLoadComplete(W)}).catch(function(W){M.warn(W),M.resetFragmentLoading(m)})},u.flushMainBuffer=function(m,y,P){if(P===void 0&&(P=null),!(m-y))return;var M={startOffset:m,endOffset:y,type:P};this.fragLoadError=0,this.hls.trigger(D.Events.BUFFER_FLUSHING,M)},u._loadInitSegment=function(m){var y=this;this._doFragLoad(m).then(function(P){if(!P||y.fragContextChanged(m)||!y.levels)throw new Error("init load aborted");return P}).then(function(P){var M=y.hls,j=P.payload,W=m.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var N=self.performance.now();return y.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(w){var G=self.performance.now();return M.trigger(D.Events.FRAG_DECRYPTED,{frag:m,payload:w,stats:{tstart:N,tdecrypt:G}}),P.payload=w,P})}return P}).then(function(P){var M=y.fragCurrent,j=y.hls,W=y.levels;if(!W)throw new Error("init load aborted, missing levels");var N=W[m.level].details;console.assert(N,"Level details are defined when init segment is loaded");var w=m.stats;y.state=S.IDLE,y.fragLoadError=0,m.data=new Uint8Array(P.payload),w.parsing.start=w.buffering.start=self.performance.now(),w.parsing.end=w.buffering.end=self.performance.now(),P.frag===M&&j.trigger(D.Events.FRAG_BUFFERED,{stats:w,frag:M,part:null,id:m.type}),y.tick()}).catch(function(P){y.warn(P),y.resetFragmentLoading(m)})},u.fragContextChanged=function(m){var y=this.fragCurrent;return!m||!y||m.level!==y.level||m.sn!==y.sn||m.urlId!==y.urlId},u.fragBufferedComplete=function(m,y){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(y?" part: "+y.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+s.default.toString(B.BufferHelper.getBuffered(P))),this.state=S.IDLE,this.tick()},u._handleFragmentLoadComplete=function(m){var y=this.transmuxer;if(!y)return;var P=m.frag,M=m.part,j=m.partsLoaded,W=!j||j.length===0||j.some(function(w){return!w}),N=new g.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,M?M.index:-1,!W);y.flush(N)},u._handleFragmentLoadProgress=function(m){},u._doFragLoad=function(m,y,P,M){var j=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(m.start,P||0),this.config.lowLatencyMode&&y){var W=y.partList;if(W&&M){P>m.end&&y.fragmentHint&&(m=y.fragmentHint);var N=this.getNextPart(W,m,P);if(N>-1){var w=W[N];return this.log("Loading part sn: "+m.sn+" p: "+w.index+" cc: "+m.cc+" of playlist ["+y.startSN+"-"+y.endSN+"] parts [0-"+N+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=w.start+w.duration,this.state=S.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:m,part:W[N],targetBufferTime:P}),this.doFragPartsLoad(m,W,N,M).catch(function(G){return j.handleFragLoadError(G)})}else if(!m.url||this.loadedEndOfParts(W,P))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(y?"of ["+y.startSN+"-"+y.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(P.toFixed(3))),Object(H.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=S.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:m,targetBufferTime:P}),this.fragmentLoader.load(m,M).catch(function(G){return j.handleFragLoadError(G)})},u.doFragPartsLoad=function(m,y,P,M){var j=this;return new Promise(function(W,N){var w=[],G=function J(Z){var ae=y[Z];j.fragmentLoader.loadPart(m,ae,M).then(function(_e){w[ae.index]=_e;var ce=_e.part;j.hls.trigger(D.Events.FRAG_LOADED,_e);var he=y[Z+1];if(he&&he.fragment===m)J(Z+1);else return W({frag:m,part:ce,partsLoaded:w})}).catch(N)};G(P)})},u.handleFragLoadError=function(m){var y=m.data;return y&&y.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(y.frag,y.part):this.hls.trigger(D.Events.ERROR,y),null},u._handleTransmuxerFlush=function(m){var y=this.getCurrentContext(m);if(!y||this.state!==S.PARSING){this.fragCurrent||(this.state=S.IDLE);return}var P=y.frag,M=y.part,j=y.level,W=self.performance.now();P.stats.parsing.end=W,M&&(M.stats.parsing.end=W),this.updateLevelTiming(P,M,j,m.partial)},u.getCurrentContext=function(m){var y=this.levels,P=m.level,M=m.sn,j=m.part;if(!y||!y[P])return this.warn("Levels object was unset while buffering fragment "+M+" of level "+P+". The current chunk will not be buffered."),null;var W=y[P],N=j>-1?Object(a.getPartWith)(W,M,j):null,w=N?N.fragment:Object(a.getFragmentWithSN)(W,M,this.fragCurrent);return w?{frag:w,part:N,level:W}:null},u.bufferFragmentData=function(m,y,P,M){if(!m||this.state!==S.PARSING)return;var j=m.data1,W=m.data2,N=j;if(j&&W&&(N=Object(p.appendUint8Array)(j,W)),!N||!N.length)return;var w={type:m.type,frag:y,part:P,chunkMeta:M,parent:y.type,data:N};this.hls.trigger(D.Events.BUFFER_APPENDING,w),m.dropped&&m.independent&&!P&&this.flushBufferGap(y)},u.flushBufferGap=function(m){var y=this.media;if(!y)return;if(!B.BufferHelper.isBuffered(y,y.currentTime)){this.flushMainBuffer(0,m.start);return}var P=y.currentTime,M=B.BufferHelper.bufferInfo(y,P,0),j=m.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),N=Math.max(Math.min(m.start-W,M.end-W),P+W);m.start-N>W&&this.flushMainBuffer(N,m.start)},u.getFwdBufferInfo=function(m,y){var P=this.config,M=this.getLoadPosition();if(!Object(H.isFiniteNumber)(M))return null;var j=B.BufferHelper.bufferInfo(m,M,P.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(M,y);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(m,M,Math.max(j.nextStart,P.maxBufferHole))}return j},u.getMaxBufferLength=function(m){var y=this.config,P;return m?P=Math.max(8*y.maxBufferSize/m,y.maxBufferLength):P=y.maxBufferLength,Math.min(P,y.maxMaxBufferLength)},u.reduceMaxBufferLength=function(m){var y=this.config,P=m||y.maxBufferLength;return y.maxMaxBufferLength>=P?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(m,y){var P,M,j=y.fragments,W=j.length;if(!W)return null;var N=this.config,w=j[0].start,G;if(y.live){var J=N.initialLiveManifestSize;if(W<J)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+J+")"),null;!y.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(G=this.getInitialLiveFragment(y,j),this.startPosition=G?this.hls.liveSyncPosition||G.start:m)}else m<=w&&(G=j[0]);if(!G){var Z=N.lowLatencyMode?y.partEnd:y.fragmentEnd;G=this.getFragmentAtPosition(m,Z,y)}return(P=G)!==null&&P!==void 0&&P.initSegment&&!((M=G)!==null&&M!==void 0&&M.initSegment.data)&&!this.bitrateTest&&(G=G.initSegment),G},u.getNextPart=function(m,y,P){for(var M=-1,j=!1,W=!0,N=0,w=m.length;N<w;N++){var G=m[N];if(W=W&&!G.independent,M>-1&&P<G.start)break;var J=G.loaded;!J&&(j||G.independent||W)&&G.fragment===y&&(M=N),j=J}return M},u.loadedEndOfParts=function(m,y){var P=m[m.length-1];return P&&y>P.start&&P.loaded},u.getInitialLiveFragment=function(m,y){var P=this.fragPrevious,M=null;if(P){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),M=Object(d.findFragmentByPDT)(y,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!M){var j=P.sn+1;if(j>=m.startSN&&j<=m.endSN){var W=y[j-m.startSN];P.cc===W.cc&&(M=W,this.log("Live playlist, switching playlist, load frag with next SN: "+M.sn))}M||(M=Object(d.findFragWithCC)(y,P.cc),M&&this.log("Live playlist, switching playlist, load frag with same CC: "+M.sn))}}else{var N=this.hls.liveSyncPosition;N!==null&&(M=this.getFragmentAtPosition(N,this.bitrateTest?m.fragmentEnd:m.edge,m))}return M},u.getFragmentAtPosition=function(m,y,P){var M=this.config,j=this.fragPrevious,W=P.fragments,N=P.endSN,w=P.fragmentHint,G=M.maxFragLookUpTolerance,J=!!(M.lowLatencyMode&&P.partList&&w);J&&w&&!this.bitrateTest&&(W=W.concat(w),N=w.sn);var Z;if(m<y){var ae=m>y-G?0:G;Z=Object(d.findFragmentByPTS)(j,W,m,ae)}else Z=W[W.length-1];if(Z){var _e=Z.sn-P.startSN,ce=j&&Z.level===j.level,he=W[_e+1],fe=this.fragmentTracker.getState(Z);if(fe===C.FragmentState.BACKTRACKED){Z=null;for(var pe=_e;W[pe]&&this.fragmentTracker.getState(W[pe])===C.FragmentState.BACKTRACKED;)j?Z=W[pe--]:Z=W[--pe];Z||(Z=he)}else j&&Z.sn===j.sn&&!J&&(ce&&(Z.sn<N&&this.fragmentTracker.getState(he)!==C.FragmentState.OK?(this.log("SN "+Z.sn+" just loaded, load next one: "+he.sn),Z=he):Z=null))}return Z},u.synchronizeToLiveEdge=function(m){var y=this.config,P=this.media;if(!P)return;var M=this.hls.liveSyncPosition,j=P.currentTime,W=m.fragments[0].start,N=m.edge,w=j>=W-y.maxFragLookUpTolerance&&j<=N;if(M!==null&&P.duration>M&&(j<M||!w)){var G=y.liveMaxLatencyDuration!==void 0?y.liveMaxLatencyDuration:y.liveMaxLatencyDurationCount*m.targetduration;(!w&&P.readyState<4||j<N-G)&&(this.loadedmetadata||(this.nextLoadPosition=M),P.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+N+", reset currentTime to : "+M.toFixed(3)),P.currentTime=M))}},u.alignPlaylists=function(m,y){var P=this.levels,M=this.levelLastLoaded,j=this.fragPrevious,W=M!==null?P[M]:null,N=m.fragments.length;if(!N)return this.warn("No fragments in live playlist"),0;var w=m.fragments[0].start,G=!y,J=m.alignedSliding&&Object(H.isFiniteNumber)(w);if(G||!J&&!w){Object(f.alignStream)(j,W,m);var Z=m.fragments[0].start;return this.log("Live playlist sliding: "+Z.toFixed(2)+" start-sn: "+(y?y.startSN:"na")+"->"+m.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+N),Z}return w},u.waitForCdnTuneIn=function(m){var y=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*y)},u.setStartPosition=function(m,y){var P=this.startPosition;if(P<y&&(P=-1),P===-1||this.lastCurrentTime===-1){var M=m.startTimeOffset;Object(H.isFiniteNumber)(M)?(P=y+M,M<0&&(P+=m.totalduration),P=Math.min(Math.max(y,P),y+m.totalduration),this.log("Start time offset "+M+" found in playlist, adjust startPosition to "+P),this.startPosition=P):m.live?P=this.hls.liveSyncPosition||y:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},u.getLoadPosition=function(){var m=this.media,y=0;return this.loadedmetadata&&m?y=m.currentTime:this.nextLoadPosition&&(y=this.nextLoadPosition),y},u.handleFragLoadAborted=function(m,y){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(y?" part"+y.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},u.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=S.IDLE)},u.onFragmentOrKeyLoadError=function(m,y){if(y.fatal)return;var P=y.frag;if(!P||P.type!==m)return;var M=this.fragCurrent;console.assert(M&&P.sn===M.sn&&P.level===M.level&&P.urlId===M.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+m+" "+P.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=S.FRAG_LOADING_WAITING_RETRY}else y.levelRetry?(m===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=S.IDLE):(U.logger.error(y.details+" reaches max retry, redispatch as fatal ..."),y.fatal=!0,this.hls.stopLoad(),this.state=S.ERROR)},u.afterBufferFlushed=function(m,y,P){if(!m)return;var M=B.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(y,M,P),this.state===S.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=S.IDLE},u.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var y=this.levels?this.levels[m].details:null;if(y!=null&&y.live)return this.startPosition=-1,this.setStartPosition(y,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(m,y,P,M){var j=this,W=P.details;console.assert(!!W,"level.details must be defined");var N=Object.keys(m.elementaryStreams).reduce(function(w,G){var J=m.elementaryStreams[G];if(J){var Z=J.endPTS-J.startPTS;if(Z<=0)return j.warn("Could not parse fragment "+m.sn+" "+G+" duration reliably ("+Z+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),w||!1;var ae=M?0:Object(a.updateFragPTSDTS)(W,m,J.startPTS,J.endPTS,J.startDTS,J.endDTS);return j.hls.trigger(D.Events.LEVEL_PTS_UPDATED,{details:W,level:P,drift:ae,type:G,frag:m,start:J.startPTS,end:J.endPTS}),!0}return w},!1);N?(this.state=S.PARSED,this.hls.trigger(D.Events.FRAG_PARSED,{frag:m,part:y})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},R(v,[{key:"state",get:function(){return this._state},set:function(m){var y=this._state;y!==m&&(this._state=m,this.log(y+"->"+m))}}]),v}(k.default)},"./src/controller/buffer-controller.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return d});var H=I("./src/polyfills/number.ts"),k=I("./src/events.ts"),C=I("./src/utils/logger.ts"),B=I("./src/errors.ts"),U=I("./src/utils/buffer-helper.ts"),D=I("./src/utils/mediasource-helper.ts"),L=I("./src/loader/fragment.ts"),g=I("./src/controller/buffer-operation-queue.ts"),p=Object(D.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,d=function(){function a(o){var s=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=s.hls,h=s.media,R=s.mediaSource;C.logger.log("[buffer-controller]: Media source opened"),h&&(s.updateMediaElementDuration(),l.trigger(k.Events.MEDIA_ATTACHED,{media:h})),R&&R.removeEventListener("sourceopen",s._onMediaSourceOpen),s.checkPendingTracks()},this._onMediaSourceClose=function(){C.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){C.logger.log("[buffer-controller]: Media source ended")},this.hls=o,this._initSourceBuffer(),this.registerListeners()}var c=a.prototype;return c.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},c.destroy=function(){this.unregisterListeners(),this.details=null},c.registerListeners=function(){var s=this.hls;s.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(k.Events.BUFFER_RESET,this.onBufferReset,this),s.on(k.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.on(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.on(k.Events.BUFFER_EOS,this.onBufferEos,this),s.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.on(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.on(k.Events.FRAG_PARSED,this.onFragParsed,this),s.on(k.Events.FRAG_CHANGED,this.onFragChanged,this)},c.unregisterListeners=function(){var s=this.hls;s.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(k.Events.BUFFER_RESET,this.onBufferReset,this),s.off(k.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.off(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.off(k.Events.BUFFER_EOS,this.onBufferEos,this),s.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.off(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.off(k.Events.FRAG_PARSED,this.onFragParsed,this),s.off(k.Events.FRAG_CHANGED,this.onFragChanged,this)},c._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},c.onManifestParsed=function(s,l){var h=2;(l.audio&&!l.video||!l.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,C.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},c.onMediaAttaching=function(s,l){var h=this.media=l.media;if(h&&p){var R=this.mediaSource=new p;R.addEventListener("sourceopen",this._onMediaSourceOpen),R.addEventListener("sourceended",this._onMediaSourceEnded),R.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(R),this._objectUrl=h.src}},c.onMediaDetaching=function(){var s=this.media,l=this.mediaSource,h=this._objectUrl;if(l){if(C.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(R){C.logger.warn("[buffer-controller]: onMediaDetaching: "+R.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),s&&(h&&self.URL.revokeObjectURL(h),s.src===h?(s.removeAttribute("src"),s.load()):C.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(k.Events.MEDIA_DETACHED,void 0)},c.onBufferReset=function(){var s=this;this.getSourceBufferTypes().forEach(function(l){var h=s.sourceBuffer[l];try{h&&(s.removeBufferListeners(l),s.mediaSource&&s.mediaSource.removeSourceBuffer(h),s.sourceBuffer[l]=void 0)}catch(R){C.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",R)}}),this._initSourceBuffer()},c.onBufferCodecs=function(s,l){var h=this,R=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(x){if(R){var T=h.tracks[x];if(T&&typeof T.buffer.changeType=="function"){var O=l[x],S=O.codec,E=O.levelCodec,b=O.container,v=(T.levelCodec||T.codec).replace(f,"$1"),u=(E||S).replace(f,"$1");if(v!==u){var _=b+";codecs="+(E||S);h.appendChangeType(x,_)}}}else h.pendingTracks[x]=l[x]}),R)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},c.appendChangeType=function(s,l){var h=this,R=this.operationQueue,x={execute:function(){var O=h.sourceBuffer[s];O&&(C.logger.log("[buffer-controller]: changing "+s+" sourceBuffer type to "+l),O.changeType(l)),R.shiftAndExecuteNext(s)},onStart:function(){},onComplete:function(){},onError:function(O){C.logger.warn("[buffer-controller]: Failed to change "+s+" SourceBuffer type",O)}};R.append(x,s)},c.onBufferAppending=function(s,l){var h=this,R=this.hls,x=this.operationQueue,T=this.tracks,O=l.data,S=l.type,E=l.frag,b=l.part,v=l.chunkMeta,u=v.buffering[S],_=self.performance.now();u.start=_;var m=E.stats.buffering,y=b?b.stats.buffering:null;m.start===0&&(m.start=_),y&&y.start===0&&(y.start=_);var P=T.audio,M=S==="audio"&&v.id===1&&(P==null?void 0:P.container)==="audio/mpeg",j={execute:function(){if(u.executeStart=self.performance.now(),M){var N=h.sourceBuffer[S];if(N){var w=E.start-N.timestampOffset;Math.abs(w)>=.1&&(C.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+E.start+" (delta: "+w+") sn: "+E.sn+")"),N.timestampOffset=E.start)}}h.appendExecutor(O,S)},onStart:function(){},onComplete:function(){var N=self.performance.now();u.executeEnd=u.end=N,m.first===0&&(m.first=N),y&&y.first===0&&(y.first=N);var w=h.sourceBuffer,G={};for(var J in w)G[J]=U.BufferHelper.getBuffered(w[J]);h.appendError=0,h.hls.trigger(k.Events.BUFFER_APPENDED,{type:S,frag:E,part:b,chunkMeta:v,parent:E.type,timeRanges:G})},onError:function(N){C.logger.error("[buffer-controller]: Error encountered while trying to append to the "+S+" SourceBuffer",N);var w={type:B.ErrorTypes.MEDIA_ERROR,parent:E.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:N,fatal:!1};N.code===DOMException.QUOTA_EXCEEDED_ERR?w.details=B.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,w.details=B.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>R.config.appendErrorMaxRetry&&(C.logger.error("[buffer-controller]: Failed "+R.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),w.fatal=!0)),R.trigger(k.Events.ERROR,w)}};x.append(j,S)},c.onBufferFlushing=function(s,l){var h=this,R=this.operationQueue,x=function(O){return{execute:h.removeExecutor.bind(h,O,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(k.Events.BUFFER_FLUSHED,{type:O})},onError:function(E){C.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",E)}}};l.type?R.append(x(l.type),l.type):this.getSourceBufferTypes().forEach(function(T){R.append(x(T),T)})},c.onFragParsed=function(s,l){var h=this,R=l.frag,x=l.part,T=[],O=x?x.elementaryStreams:R.elementaryStreams;O[L.ElementaryStreamTypes.AUDIOVIDEO]?T.push("audiovideo"):(O[L.ElementaryStreamTypes.AUDIO]&&T.push("audio"),O[L.ElementaryStreamTypes.VIDEO]&&T.push("video"));var S=function(){var b=self.performance.now();R.stats.buffering.end=b,x&&(x.stats.buffering.end=b);var v=x?x.stats:R.stats;h.hls.trigger(k.Events.FRAG_BUFFERED,{frag:R,part:x,stats:v,id:R.type})};T.length===0&&C.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+R.type+" level: "+R.level+" sn: "+R.sn),this.blockBuffers(S,T)},c.onFragChanged=function(s,l){this.flushBackBuffer()},c.onBufferEos=function(s,l){var h=this,R=this.getSourceBufferTypes().reduce(function(x,T){var O=h.sourceBuffer[T];return(!l.type||l.type===T)&&(O&&!O.ended&&(O.ended=!0,C.logger.log("[buffer-controller]: "+T+" sourceBuffer now EOS"))),x&&!!(!O||O.ended)},!0);R&&this.blockBuffers(function(){var x=h.mediaSource;if(!x||x.readyState!=="open")return;x.endOfStream()})},c.onLevelUpdated=function(s,l){var h=l.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},c.flushBackBuffer=function(){var s=this.hls,l=this.details,h=this.media,R=this.sourceBuffer;if(!h||l===null)return;var x=this.getSourceBufferTypes();if(!x.length)return;var T=l.live&&s.config.liveBackBufferLength!==null?s.config.liveBackBufferLength:s.config.backBufferLength;if(!Object(H.isFiniteNumber)(T)||T<0)return;var O=h.currentTime,S=l.levelTargetDuration,E=Math.max(T,S),b=Math.floor(O/S)*S-E;x.forEach(function(v){var u=R[v];if(u){var _=U.BufferHelper.getBuffered(u);_.length>0&&b>_.start(0)&&(s.trigger(k.Events.BACK_BUFFER_REACHED,{bufferEnd:b}),l.live&&s.trigger(k.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:b}),s.trigger(k.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:b,type:v}))}})},c.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var s=this.details,l=this.hls,h=this.media,R=this.mediaSource,x=s.fragments[0].start+s.totalduration,T=h.duration,O=Object(H.isFiniteNumber)(R.duration)?R.duration:0;s.live&&l.config.liveDurationInfinity?(C.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),R.duration=Infinity,this.updateSeekableRange(s)):(x>O&&x>T||!Object(H.isFiniteNumber)(T))&&(C.logger.log("[buffer-controller]: Updating Media Source duration to "+x.toFixed(3)),R.duration=x)},c.updateSeekableRange=function(s){var l=this.mediaSource,h=s.fragments,R=h.length;if(R&&s.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var x=Math.max(0,h[0].start),T=Math.max(x,x+s.totalduration);l.setLiveSeekableRange(x,T)}},c.checkPendingTracks=function(){var s=this.bufferCodecEventsExpected,l=this.operationQueue,h=this.pendingTracks,R=Object.keys(h).length;if(R&&!s||R===2){this.createSourceBuffers(h),this.pendingTracks={};var x=this.getSourceBufferTypes();if(x.length===0){this.hls.trigger(k.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}x.forEach(function(T){l.executeNext(T)})}},c.createSourceBuffers=function(s){var l=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var R=0;for(var x in s)if(!l[x]){var T=s[x];if(!T)throw Error("source buffer exists for track "+x+", however track does not");var O=T.levelCodec||T.codec,S=T.container+";codecs="+O;C.logger.log("[buffer-controller]: creating sourceBuffer("+S+")");try{var E=l[x]=h.addSourceBuffer(S),b=x;this.addBufferListener(b,"updatestart",this._onSBUpdateStart),this.addBufferListener(b,"updateend",this._onSBUpdateEnd),this.addBufferListener(b,"error",this._onSBUpdateError),this.tracks[x]={buffer:E,codec:O,container:T.container,levelCodec:T.levelCodec,id:T.id},R++}catch(v){C.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+v.message),this.hls.trigger(k.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:v,mimeType:S})}}R&&this.hls.trigger(k.Events.BUFFER_CREATED,{tracks:this.tracks})},c._onSBUpdateStart=function(s){var l=this.operationQueue,h=l.current(s);h.onStart()},c._onSBUpdateEnd=function(s){var l=this.operationQueue,h=l.current(s);h.onComplete(),l.shiftAndExecuteNext(s)},c._onSBUpdateError=function(s,l){C.logger.error("[buffer-controller]: "+s+" SourceBuffer error",l),this.hls.trigger(k.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(s);h&&h.onError(l)},c.removeExecutor=function(s,l,h){var R=this.media,x=this.mediaSource,T=this.operationQueue,O=this.sourceBuffer,S=O[s];if(!R||!x||!S){C.logger.warn("[buffer-controller]: Attempting to remove from the "+s+" SourceBuffer, but it does not exist"),T.shiftAndExecuteNext(s);return}var E=Object(H.isFiniteNumber)(R.duration)?R.duration:Infinity,b=Object(H.isFiniteNumber)(x.duration)?x.duration:Infinity,v=Math.max(0,l),u=Math.min(h,E,b);u>v?(C.logger.log("[buffer-controller]: Removing ["+v+","+u+"] from the "+s+" SourceBuffer"),console.assert(!S.updating,s+" sourceBuffer must not be updating"),S.remove(v,u)):T.shiftAndExecuteNext(s)},c.appendExecutor=function(s,l){var h=this.operationQueue,R=this.sourceBuffer,x=R[l];if(!x){C.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(l);return}x.ended=!1,console.assert(!x.updating,l+" sourceBuffer must not be updating"),x.appendBuffer(s)},c.blockBuffers=function(s,l){var h=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){C.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(s);return}var R=this.operationQueue,x=l.map(function(T){return R.appendBlocker(T)});Promise.all(x).then(function(){s(),l.forEach(function(T){var O=h.sourceBuffer[T];(!O||!O.updating)&&R.shiftAndExecuteNext(T)})})},c.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},c.addBufferListener=function(s,l,h){var R=this.sourceBuffer[s];if(!R)return;var x=h.bind(this,s);this.listeners[s].push({event:l,listener:x}),R.addEventListener(l,x)},c.removeBufferListeners=function(s){var l=this.sourceBuffer[s];if(!l)return;this.listeners[s].forEach(function(h){l.removeEventListener(h.event,h.listener)})},a}()},"./src/controller/buffer-operation-queue.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return k});var H=I("./src/utils/logger.ts"),k=function(){function C(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var B=C.prototype;return B.append=function(D,L){var g=this.queues[L];g.push(D),g.length===1&&this.buffers[L]&&this.executeNext(L)},B.insertAbort=function(D,L){var g=this.queues[L];g.unshift(D),this.executeNext(L)},B.appendBlocker=function(D){var L,g=new Promise(function(f){L=f}),p={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,D),g},B.executeNext=function(D){var L=this.buffers,g=this.queues,p=L[D],f=g[D];if(f.length){var d=f[0];try{d.execute()}catch(a){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),d.onError(a),(!p||!p.updating)&&(f.shift(),this.executeNext(D))}}},B.shiftAndExecuteNext=function(D){this.queues[D].shift(),this.executeNext(D)},B.current=function(D){return this.queues[D][0]},C}()},"./src/controller/cap-level-controller.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/events.ts");function k(U,D){for(var L=0;L<D.length;L++){var g=D[L];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(U,g.key,g)}}function C(U,D,L){return D&&k(U.prototype,D),L&&k(U,L),U}var B=function(){function U(L){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=L,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var D=U.prototype;return D.setStreamController=function(g){this.streamController=g},D.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},D.registerListeners=function(){var g=this.hls;g.on(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.unregisterListener=function(){var g=this.hls;g.off(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.onFpsDropLevelCapping=function(g,p){U.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},D.onMediaAttaching=function(g,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},D.onManifestParsed=function(g,p){var f=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},D.onBufferCodecs=function(g,p){var f=this.hls;f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},D.onMediaDetaching=function(){this.stopCapping()},D.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var p=this.hls;p.autoLevelCapping=this.getMaxLevel(g.length-1),p.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=p.autoLevelCapping}}},D.getMaxLevel=function(g){var p=this,f=this.hls.levels;if(!f.length)return-1;var d=f.filter(function(a,c){return U.isLevelAllowed(c,p.restrictedLevels)&&c<=g});return this.clientRect=null,U.getMaxLevelByMediaSize(d,this.mediaWidth,this.mediaHeight)},D.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},D.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},D.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,p={width:0,height:0};if(g){var f=g.getBoundingClientRect();p.width=f.width,p.height=f.height,!p.width&&!p.height&&(p.width=f.right-f.left||g.width||0,p.height=f.bottom-f.top||g.height||0)}return this.clientRect=p,p},U.isLevelAllowed=function(g,p){return p===void 0&&(p=[]),p.indexOf(g)===-1},U.getMaxLevelByMediaSize=function(g,p,f){if(!g||!g.length)return-1;for(var d=function(l,h){return h?l.width!==h.width||l.height!==h.height:!0},a=g.length-1,c=0;c<g.length;c+=1){var o=g[c];if((o.width>=p||o.height>=f)&&d(o,g[c+1])){a=c;break}}return a},C(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(p){}return g}}]),U}();V.default=B},"./src/controller/cmcd-controller.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return d});var H=I("./src/events.ts"),k=I("./src/types/cmcd.ts"),C=I("./src/utils/buffer-helper.ts"),B=I("./src/utils/logger.ts");function U(a,c){for(var o=0;o<c.length;o++){var s=c[o];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(a,s.key,s)}}function D(a,c,o){return c&&U(a.prototype,c),o&&U(a,o),a}function L(a,c){var o=typeof Symbol!="undefined"&&a[Symbol.iterator]||a["@@iterator"];if(o)return(o=o.call(a)).next.bind(o);if(Array.isArray(a)||(o=g(a))||c&&a&&typeof a.length=="number"){o&&(a=o);var s=0;return function(){return s>=a.length?{done:!0}:{done:!1,value:a[s++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g(a,c){if(!a)return;if(typeof a=="string")return p(a,c);var o=Object.prototype.toString.call(a).slice(8,-1);if(o==="Object"&&a.constructor&&(o=a.constructor.name),o==="Map"||o==="Set")return Array.from(a);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return p(a,c)}function p(a,c){(c==null||c>a.length)&&(c=a.length);for(var o=0,s=new Array(c);o<c;o++)s[o]=a[o];return s}function f(){return f=Object.assign||function(a){for(var c=1;c<arguments.length;c++){var o=arguments[c];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(a[s]=o[s])}return a},f.apply(this,arguments)}var d=function(){function a(o){var s=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(){s.initialized&&(s.starved=!0),s.buffering=!0},this.onPlaying=function(){s.initialized||(s.initialized=!0),s.buffering=!1},this.applyPlaylistData=function(R){try{s.apply(R,{ot:k.CMCDObjectType.MANIFEST,su:!s.initialized})}catch(x){B.logger.warn("Could not generate manifest CMCD data.",x)}},this.applyFragmentData=function(R){try{var x=R.frag,T=s.hls.levels[x.level],O=s.getObjectType(x),S={d:x.duration*1e3,ot:O};(O===k.CMCDObjectType.VIDEO||O===k.CMCDObjectType.AUDIO||O==k.CMCDObjectType.MUXED)&&(S.br=T.bitrate/1e3,S.tb=s.getTopBandwidth(O),S.bl=s.getBufferLength(O)),s.apply(R,S)}catch(E){B.logger.warn("Could not generate segment CMCD data.",E)}},this.hls=o;var l=this.config=o.config,h=l.cmcd;h!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||a.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var c=a.prototype;return c.registerListeners=function(){var s=this.hls;s.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this)},c.unregisterListeners=function(){var s=this.hls;s.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},c.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},c.onMediaAttached=function(s,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},c.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},c.onBufferCreated=function(s,l){var h,R;this.audioBuffer=(h=l.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(R=l.tracks.video)===null||R===void 0?void 0:R.buffer},c.createData=function(){var s;return{v:k.CMCDVersion,sf:k.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(s=this.media)===null||s===void 0?void 0:s.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},c.apply=function(s,l){l===void 0&&(l={}),f(l,this.createData());var h=l.ot===k.CMCDObjectType.INIT||l.ot===k.CMCDObjectType.VIDEO||l.ot===k.CMCDObjectType.MUXED;if(this.starved&&h&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var R=a.toHeaders(l);if(!Object.keys(R).length)return;s.headers||(s.headers={}),f(s.headers,R)}else{var x=a.toQuery(l);if(!x)return;s.url=a.appendQueryToUri(s.url,x)}},c.getObjectType=function(s){var l=s.type;return l==="subtitle"?k.CMCDObjectType.TIMED_TEXT:s.sn==="initSegment"?k.CMCDObjectType.INIT:l==="audio"?k.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?k.CMCDObjectType.VIDEO:k.CMCDObjectType.MUXED:void 0},c.getTopBandwidth=function(s){for(var l=0,h=s===k.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,R=L(h),x;!(x=R()).done;){var T=x.value;T.bitrate>l&&(l=T.bitrate)}return l>0?l:NaN},c.getBufferLength=function(s){var l=this.hls.media,h=s===k.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!l)return NaN;var R=C.BufferHelper.bufferInfo(h,l.currentTime,this.config.maxBufferHole);return R.len*1e3},c.createPlaylistLoader=function(){var s=this.config.pLoader,l=this.applyPlaylistData,h=s||this.config.loader;return function(){function R(T){this.loader=void 0,this.loader=new h(T)}var x=R.prototype;return x.destroy=function(){this.loader.destroy()},x.abort=function(){this.loader.abort()},x.load=function(O,S,E){l(O),this.loader.load(O,S,E)},D(R,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),R}()},c.createFragmentLoader=function(){var s=this.config.fLoader,l=this.applyFragmentData,h=s||this.config.loader;return function(){function R(T){this.loader=void 0,this.loader=new h(T)}var x=R.prototype;return x.destroy=function(){this.loader.destroy()},x.abort=function(){this.loader.abort()},x.load=function(O,S,E){l(O),this.loader.load(O,S,E)},D(R,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),R}()},a.uuid=function(){var s=URL.createObjectURL(new Blob),l=s.toString();return URL.revokeObjectURL(s),l.substr(l.lastIndexOf("/")+1)},a.serialize=function(s){for(var l=[],h=function(M){return!Number.isNaN(M)&&M!=null&&M!==""&&M!==!1},R=function(M){return Math.round(M)},x=function(M){return R(M/100)*100},T=function(M){return encodeURIComponent(M)},O={br:R,d:R,bl:x,dl:x,mtp:x,nor:T,rtp:x,tb:R},S=Object.keys(s||{}).sort(),E=L(S),b;!(b=E()).done;){var v=b.value,u=s[v];if(!h(u))continue;if(v==="v"&&u===1)continue;if(v=="pr"&&u===1)continue;var _=O[v];_&&(u=_(u));var m=typeof u,y=void 0;v==="ot"||v==="sf"||v==="st"?y=v+"="+u:m==="boolean"?y=v:m==="number"?y=v+"="+u:y=v+"="+JSON.stringify(u),l.push(y)}return l.join(",")},a.toHeaders=function(s){for(var l=Object.keys(s),h={},R=["Object","Request","Session","Status"],x=[{},{},{},{}],T={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},O=0,S=l;O<S.length;O++){var E=S[O],b=T[E]!=null?T[E]:1;x[b][E]=s[E]}for(var v=0;v<x.length;v++){var u=a.serialize(x[v]);u&&(h["CMCD-"+R[v]]=u)}return h},a.toQuery=function(s){return"CMCD="+encodeURIComponent(a.serialize(s))},a.appendQueryToUri=function(s,l){if(!l)return s;var h=s.includes("?")?"&":"?";return""+s+h+l},a}()},"./src/controller/eme-controller.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/events.ts"),k=I("./src/errors.ts"),C=I("./src/utils/logger.ts"),B=I("./src/utils/mediakeys-helper.ts");function U(d,a){for(var c=0;c<a.length;c++){var o=a[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(d,o.key,o)}}function D(d,a,c){return a&&U(d.prototype,a),c&&U(d,c),d}var L=3,g=function(a,c,o){var s={audioCapabilities:[],videoCapabilities:[]};return a.forEach(function(l){s.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:o.audioRobustness||""})}),c.forEach(function(l){s.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:o.videoRobustness||""})}),[s]},p=function(a,c,o,s){switch(a){case B.KeySystems.WIDEVINE:return g(c,o,s);default:throw new Error("Unknown key-system: "+a)}},f=function(){function d(c){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=c,this._config=c.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 a=d.prototype;return a.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},a._registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},a._unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},a.getLicenseServerUrl=function(o){switch(o){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+o+'"')},a._attemptKeySystemAccess=function(o,s,l){var h=this,R=p(o,s,l,this._drmSystemOptions);C.logger.log("Requesting encrypted media key-system access");var x=this.requestMediaKeySystemAccess(o,R);this.mediaKeysPromise=x.then(function(T){return h._onMediaKeySystemAccessObtained(o,T)}),x.catch(function(T){C.logger.error('Failed to obtain key-system "'+o+'" access:',T)})},a._onMediaKeySystemAccessObtained=function(o,s){var l=this;C.logger.log('Access for key-system "'+o+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:s,mediaKeySystemDomain:o};this._mediaKeysList.push(h);var R=Promise.resolve().then(function(){return s.createMediaKeys()}).then(function(x){return h.mediaKeys=x,C.logger.log('Media-keys created for key-system "'+o+'"'),l._onMediaKeysCreated(),x});return R.catch(function(x){C.logger.error("Failed to create media-keys:",x)}),R},a._onMediaKeysCreated=function(){var o=this;this._mediaKeysList.forEach(function(s){s.mediaKeysSession||(s.mediaKeysSession=s.mediaKeys.createSession(),o._onNewMediaKeySession(s.mediaKeysSession))})},a._onNewMediaKeySession=function(o){var s=this;C.logger.log("New key-system session "+o.sessionId),o.addEventListener("message",function(l){s._onKeySessionMessage(o,l.message)},!1)},a._onKeySessionMessage=function(o,s){C.logger.log("Got EME message event, creating license request"),this._requestLicense(s,function(l){C.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),o.update(l)})},a.onMediaEncrypted=function(o){var s=this;if(C.logger.log('Media is encrypted using "'+o.initDataType+'" init data type'),!this.mediaKeysPromise){C.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(R){if(!s._media)return;s._attemptSetMediaKeys(R),s._generateRequestWithPreferredKeySession(o.initDataType,o.initData)};this.mediaKeysPromise.then(l).catch(l)},a._attemptSetMediaKeys=function(o){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var s=this._mediaKeysList[0];if(!s||!s.mediaKeys){C.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}C.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(s.mediaKeys),this._hasSetMediaKeys=!0}},a._generateRequestWithPreferredKeySession=function(o,s){var l=this,h=this._mediaKeysList[0];if(!h){C.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){C.logger.warn("Key-Session already initialized but requested again");return}var R=h.mediaKeysSession;if(!R){C.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!s){C.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}C.logger.log('Generating key-session request for "'+o+'" init data type'),h.mediaKeysSessionInitialized=!0,R.generateRequest(o,s).then(function(){C.logger.debug("Key-session generation succeeded")}).catch(function(x){C.logger.error("Error generating key-session request:",x),l.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},a._createLicenseXhr=function(o,s,l){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,o,s,l);var R=this._licenseXhrSetup;if(R)try{R.call(this.hls,h,o),R=void 0}catch(x){C.logger.error(x)}try{h.readyState||h.open("POST",o,!0),R&&R.call(this.hls,h,o)}catch(x){throw new Error("issue setting up KeySystem license XHR "+x)}return h},a._onLicenseRequestReadyStageChange=function(o,s,l,h){switch(o.readyState){case 4:if(o.status===200){this._requestLicenseFailureCount=0,C.logger.log("License request succeeded");var R=o.response,x=this._licenseResponseCallback;if(x)try{R=x.call(this.hls,o,s)}catch(O){C.logger.error(O)}h(R)}else{if(C.logger.error("License Request XHR failed ("+s+"). Status: "+o.status+" ("+o.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var T=L-this._requestLicenseFailureCount+1;C.logger.warn("Retrying license request, "+T+" attempts left"),this._requestLicense(l,h)}break}},a._generateLicenseRequestChallenge=function(o,s){switch(o.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return s}throw new Error("unsupported key-system: "+o.mediaKeySystemDomain)},a._requestLicense=function(o,s){C.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){C.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(l.mediaKeySystemDomain),R=this._createLicenseXhr(h,o,s);C.logger.log("Sending license request to URL: "+h);var x=this._generateLicenseRequestChallenge(l,o);R.send(x)}catch(T){C.logger.error("Failure requesting DRM license: "+T),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},a.onMediaAttached=function(o,s){if(!this._emeEnabled)return;var l=s.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},a.onMediaDetached=function(){var o=this._media,s=this._mediaKeysList;if(!o)return;o.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(s.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return o.setMediaKeys(null)}).catch(function(){})},a.onManifestParsed=function(o,s){if(!this._emeEnabled)return;var l=s.levels.map(function(R){return R.audioCodec}).filter(function(R){return!!R}),h=s.levels.map(function(R){return R.videoCodec}).filter(function(R){return!!R});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,l,h)},D(d,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),d}();V.default=f},"./src/controller/fps-controller.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/events.ts"),k=I("./src/utils/logger.ts"),C=function(){function B(D){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=D,this.registerListeners()}var U=B.prototype;return U.setStreamController=function(L){this.streamController=L},U.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(L,g){var p=this.hls.config;if(p.capLevelOnFPSDrop){var f=g.media instanceof self.HTMLVideoElement?g.media:null;this.media=f,f&&typeof f.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),p.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(L,g,p){var f=performance.now();if(g){if(this.lastTime){var d=f-this.lastTime,a=p-this.lastDroppedFrames,c=g-this.lastDecodedFrames,o=1e3*a/d,s=this.hls;if(s.trigger(H.Events.FPS_DROP,{currentDropped:a,currentDecoded:c,totalDroppedFrames:p}),o>0&&a>s.config.fpsDroppedMonitoringThreshold*c){var l=s.currentLevel;k.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(s.autoLevelCapping===-1||s.autoLevelCapping>=l)&&(l=l-1,s.trigger(H.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:s.currentLevel}),s.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=f,this.lastDroppedFrames=p,this.lastDecodedFrames=g}},U.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var g=L.getVideoPlaybackQuality();this.checkFPS(L,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},B}();V.default=C},"./src/controller/fragment-finders.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"findFragmentByPDT",function(){return C}),I.d(V,"findFragmentByPTS",function(){return B}),I.d(V,"fragmentWithinToleranceTest",function(){return U}),I.d(V,"pdtWithinToleranceTest",function(){return D}),I.d(V,"findFragWithCC",function(){return L});var H=I("./src/polyfills/number.ts"),k=I("./src/utils/binary-search.ts");function C(g,p,f){if(p===null||!Array.isArray(g)||!g.length||!Object(H.isFiniteNumber)(p))return null;var d=g[0].programDateTime;if(p<(d||0))return null;var a=g[g.length-1].endProgramDateTime;if(p>=(a||0))return null;f=f||0;for(var c=0;c<g.length;++c){var o=g[c];if(D(p,f,o))return o}return null}function B(g,p,f,d){f===void 0&&(f=0),d===void 0&&(d=0);var a=null;if(g?a=p[g.sn-p[0].sn+1]||null:f===0&&p[0].start===0&&(a=p[0]),a&&U(f,d,a)===0)return a;var c=k.default.search(p,U.bind(null,f,d));return c||a}function U(g,p,f){g===void 0&&(g=0),p===void 0&&(p=0);var d=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0));return f.start+f.duration-d<=g?1:f.start-d>g&&f.start?-1:0}function D(g,p,f){var d=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0))*1e3,a=f.endProgramDateTime||0;return a-d>g}function L(g,p){return k.default.search(g,function(f){return f.cc<p?1:f.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"FragmentState",function(){return C}),I.d(V,"FragmentTracker",function(){return B});var H=I("./src/events.ts"),k=I("./src/types/loader.ts"),C;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(C||(C={}));var B=function(){function L(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 g=L.prototype;return g._registerListeners=function(){var f=this.hls;f.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var f=this.hls;f.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(f,d){if(d===k.PlaylistLevelType.MAIN){var a=this.activeFragment,c=this.activeParts;if(!a)return null;if(c)for(var o=c.length;o--;){var s=c[o],l=s?s.end:a.appendedPTS;if(s.start<=f&&l!==void 0&&f<=l)return o>9&&(this.activeParts=c.slice(o-9)),s}else if(a.start<=f&&a.appendedPTS!==void 0&&f<=a.appendedPTS)return a}return this.getBufferedFrag(f,d)},g.getBufferedFrag=function(f,d){for(var a=this.fragments,c=Object.keys(a),o=c.length;o--;){var s=a[c[o]];if((s==null?void 0:s.body.type)===d&&s.buffered){var l=s.body;if(l.start<=f&&f<=l.end)return l}}return null},g.detectEvictedFragments=function(f,d,a){var c=this;Object.keys(this.fragments).forEach(function(o){var s=c.fragments[o];if(!s)return;if(!s.buffered){s.body.type===a&&c.removeFragment(s.body);return}var l=s.range[f];if(!l)return;l.time.some(function(h){var R=!c.isTimeBuffered(h.startPTS,h.endPTS,d);return R&&c.removeFragment(s.body),R})})},g.detectPartialFragments=function(f){var d=this,a=this.timeRanges,c=f.frag,o=f.part;if(!a||c.sn==="initSegment")return;var s=D(c),l=this.fragments[s];if(!l)return;Object.keys(a).forEach(function(h){var R=c.elementaryStreams[h];if(!R)return;var x=a[h],T=o!==null||R.partial===!0;l.range[h]=d.getBufferedTimes(c,o,T,x)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},g.fragBuffered=function(f){var d=D(f),a=this.fragments[d];a&&(a.backtrack=a.loaded=null,a.buffered=!0)},g.getBufferedTimes=function(f,d,a,c){for(var o={time:[],partial:a},s=d?d.start:f.start,l=d?d.end:f.end,h=f.minEndPTS||l,R=f.maxStartPTS||s,x=0;x<c.length;x++){var T=c.start(x)-this.bufferPadding,O=c.end(x)+this.bufferPadding;if(R>=T&&h<=O){o.time.push({startPTS:Math.max(s,c.start(x)),endPTS:Math.min(l,c.end(x))});break}else if(s<O&&l>T)o.partial=!0,o.time.push({startPTS:Math.max(s,c.start(x)),endPTS:Math.min(l,c.end(x))});else if(l<=T)break}return o},g.getPartialFragment=function(f){var d=null,a,c,o,s=0,l=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(R){var x=h[R];if(!x)return;U(x)&&(c=x.body.start-l,o=x.body.end+l,f>=c&&f<=o&&(a=Math.min(f-c,o-f),s<=a&&(d=x.body,s=a)))}),d},g.getState=function(f){var d=D(f),a=this.fragments[d];return a?a.buffered?U(a)?C.PARTIAL:C.OK:a.backtrack?C.BACKTRACKED:C.APPENDING:C.NOT_LOADED},g.backtrack=function(f,d){var a=D(f),c=this.fragments[a];if(!c||c.backtrack)return null;var o=c.backtrack=d||c.loaded;return c.loaded=null,o},g.getBacktrackData=function(f){var d=D(f),a=this.fragments[d];if(a){var c,o=a.backtrack;if(o!=null&&(c=o.payload)!==null&&c!==void 0&&c.byteLength)return o;this.removeFragment(f)}return null},g.isTimeBuffered=function(f,d,a){for(var c,o,s=0;s<a.length;s++){if(c=a.start(s)-this.bufferPadding,o=a.end(s)+this.bufferPadding,f>=c&&d<=o)return!0;if(d<=c)return!1}return!1},g.onFragLoaded=function(f,d){var a=d.frag,c=d.part;if(a.sn==="initSegment"||a.bitrateTest||c)return;var o=D(a);this.fragments[o]={body:a,loaded:d,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(f,d){var a=this,c=d.frag,o=d.part,s=d.timeRanges;if(c.type===k.PlaylistLevelType.MAIN)if(this.activeFragment=c,o){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(o)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach(function(h){var R=s[h];if(a.detectEvictedFragments(h,R),!o)for(var x=0;x<R.length;x++)c.appendedPTS=Math.max(R.end(x),c.appendedPTS||0)})},g.onFragBuffered=function(f,d){this.detectPartialFragments(d)},g.hasFragment=function(f){var d=D(f);return!!this.fragments[d]},g.removeFragmentsInRange=function(f,d,a){var c=this;Object.keys(this.fragments).forEach(function(o){var s=c.fragments[o];if(!s)return;if(s.buffered){var l=s.body;l.type===a&&l.start<d&&l.end>f&&c.removeFragment(l)}})},g.removeFragment=function(f){var d=D(f);f.stats.loaded=0,f.clearElementaryStreamInfo(),delete this.fragments[d]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function U(L){var g,p;return L.buffered&&(((g=L.range.video)===null||g===void 0?void 0:g.partial)||((p=L.range.audio)===null||p===void 0?void 0:p.partial))}function D(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"STALL_MINIMUM_DURATION_MS",function(){return U}),I.d(V,"MAX_START_GAP_JUMP",function(){return D}),I.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),I.d(V,"SKIP_BUFFER_RANGE_START",function(){return g}),I.d(V,"default",function(){return p});var H=I("./src/utils/buffer-helper.ts"),k=I("./src/errors.ts"),C=I("./src/events.ts"),B=I("./src/utils/logger.ts"),U=250,D=2,L=.1,g=.05,p=function(){function f(a,c,o,s){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=a,this.media=c,this.fragmentTracker=o,this.hls=s}var d=f.prototype;return d.destroy=function(){this.hls=this.fragmentTracker=this.media=null},d.poll=function(c){var o=this.config,s=this.media,l=this.stalled,h=s.currentTime,R=s.seeking,x=this.seeking&&!R,T=!this.seeking&&R;if(this.seeking=R,h!==c){if(this.moved=!0,l!==null){if(this.stallReported){var O=self.performance.now()-l;B.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(O)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((T||x)&&(this.stalled=null),s.paused||s.ended||s.playbackRate===0||!H.BufferHelper.getBuffered(s).length)return;var S=H.BufferHelper.bufferInfo(s,h,0),E=S.len>0,b=S.nextStart||0;if(!E&&!b)return;if(R){var v=S.len>D,u=!b||b-h>D&&!this.fragmentTracker.getPartialFragment(h);if(v||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var _,m=Math.max(b,S.start||0)-h,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=y==null||((_=y.details)===null||_===void 0)?void 0:_.live,M=P?y.details.targetduration*2:D;if(m>0&&m<=M){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(l===null){this.stalled=j;return}var W=j-l;!R&&W>=U&&this._reportStall(S.len);var N=H.BufferHelper.bufferInfo(s,h,o.maxBufferHole);this._tryFixBufferStall(N,W)},d._tryFixBufferStall=function(c,o){var s=this.config,l=this.fragmentTracker,h=this.media,R=h.currentTime,x=l.getPartialFragment(R);if(x){var T=this._trySkipBufferHole(x);if(T)return}c.len>s.maxBufferHole&&o>s.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},d._reportStall=function(c){var o=this.hls,s=this.media,l=this.stallReported;l||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+s.currentTime+" due to low buffer (buffer="+c+")"),o.trigger(C.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:c}))},d._trySkipBufferHole=function(c){for(var o=this.config,s=this.hls,l=this.media,h=l.currentTime,R=0,x=H.BufferHelper.getBuffered(l),T=0;T<x.length;T++){var O=x.start(T);if(h+o.maxBufferHole>=R&&h<O){var S=Math.max(O+g,l.currentTime+L);return B.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+S),this.moved=!0,this.stalled=null,l.currentTime=S,c&&s.trigger(C.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+S,frag:c}),S}R=x.end(T)}return 0},d._tryNudgeBuffer=function(){var c=this.config,o=this.hls,s=this.media,l=s.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<c.nudgeMaxRetry){var R=l+h*c.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+l+" to "+R),s.currentTime=R,o.trigger(C.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+c.nudgeMaxRetry+" nudges"),o.trigger(C.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},f}()},"./src/controller/id3-track-controller.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/events.ts"),k=I("./src/utils/texttrack-utils.ts"),C=I("./src/demux/id3.ts"),B=.25,U=function(){function D(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var L=D.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var p=this.hls;p.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var p=this.hls;p.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(p,f){this.media=f.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(k.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(p){if(!this.media)return;for(var f=0;f<p.length;f++){var d=p[f];if(d.kind==="metadata"&&d.label==="id3")return Object(k.sendAddTrackEvent)(d,this.media),d}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(p,f){if(!this.media)return;var d=f.frag,a=f.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var c=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,o=0;o<a.length;o++){var s=C.getID3Frames(a[o].data);if(s){var l=a[o].pts,h=o<a.length-1?a[o+1].pts:d.end,R=h-l;R<=0&&(h=l+B);for(var x=0;x<s.length;x++){var T=s[x];if(!C.isTimeStampFrame(T)){var O=new c(l,h,"");O.value=T,this.id3Track.addCue(O)}}}}},L.onBufferFlushing=function(p,f){var d=f.startOffset,a=f.endOffset,c=f.type;if(!c||c==="audio"){var o=this.id3Track;o&&Object(k.removeCuesInRange)(o,d,a)}},D}();V.default=U},"./src/controller/latency-controller.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return D});var H=I("./src/errors.ts"),k=I("./src/events.ts"),C=I("./src/utils/logger.ts");function B(L,g){for(var p=0;p<g.length;p++){var f=g[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(L,f.key,f)}}function U(L,g,p){return g&&B(L.prototype,g),p&&B(L,p),L}var D=function(){function L(p){var f=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 f.timeupdate()},this.hls=p,this.config=p.config,this.registerListeners()}var g=L.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(k.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(k.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(k.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(k.Events.ERROR,this.onError)},g.onMediaAttached=function(f,d){this.media=d.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(f,d){var a=d.details;this.levelDetails=a,a.advanced&&this.timeupdate(),!a.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(f,d){if(d.details!==H.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,C.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var f=this.media,d=this.levelDetails;if(!f||!d)return;this.currentTime=f.currentTime;var a=this.computeLatency();if(a===null)return;this._latency=a;var c=this.config,o=c.lowLatencyMode,s=c.maxLiveSyncPlaybackRate;if(!o||s===1)return;var l=this.targetLatency;if(l===null)return;var h=a-l,R=Math.min(this.maxLatency,l+d.targetduration),x=h<R;if(d.live&&x&&h>.05&&this.forwardBufferLength>1){var T=Math.min(2,Math.max(1,s)),O=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;f.playbackRate=Math.min(T,Math.max(1,O))}else f.playbackRate!==1&&f.playbackRate!==0&&(f.playbackRate=1)},g.estimateLiveEdge=function(){var f=this.levelDetails;return f===null?null:f.edge+f.age},g.computeLatency=function(){var f=this.estimateLiveEdge();return f===null?null:f-this.currentTime},U(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var f=this.config,d=this.levelDetails;return f.liveMaxLatencyDuration!==void 0?f.liveMaxLatencyDuration:d?f.liveMaxLatencyDurationCount*d.targetduration:0}},{key:"targetLatency",get:function(){var f=this.levelDetails;if(f===null)return null;var d=f.holdBack,a=f.partHoldBack,c=f.targetduration,o=this.config,s=o.liveSyncDuration,l=o.liveSyncDurationCount,h=o.lowLatencyMode,R=this.hls.userConfig,x=h&&a||d;(R.liveSyncDuration||R.liveSyncDurationCount||x===0)&&(x=s!==void 0?s:l*c);var T=c,O=1;return x+Math.min(this.stallCount*O,T)}},{key:"liveSyncPosition",get:function(){var f=this.estimateLiveEdge(),d=this.targetLatency,a=this.levelDetails;if(f===null||d===null||a===null)return null;var c=a.edge,o=f-d-this.edgeStalled,s=c-a.totalduration,l=c-(this.config.lowLatencyMode&&a.partTarget||a.targetduration);return Math.min(Math.max(s,o),l)}},{key:"drift",get:function(){var f=this.levelDetails;return f===null?1:f.drift}},{key:"edgeStalled",get:function(){var f=this.levelDetails;if(f===null)return 0;var d=(this.config.lowLatencyMode&&f.partTarget||f.targetduration)*3;return Math.max(f.age-d,0)}},{key:"forwardBufferLength",get:function(){var f=this.media,d=this.levelDetails;if(!f||!d)return 0;var a=f.buffered.length;return a?f.buffered.end(a-1):d.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return o});var H=I("./src/types/level.ts"),k=I("./src/events.ts"),C=I("./src/errors.ts"),B=I("./src/utils/codecs.ts"),U=I("./src/controller/level-helper.ts"),D=I("./src/controller/base-playlist-controller.ts"),L=I("./src/types/loader.ts");function g(){return g=Object.assign||function(s){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var R in h)Object.prototype.hasOwnProperty.call(h,R)&&(s[R]=h[R])}return s},g.apply(this,arguments)}function p(s,l){for(var h=0;h<l.length;h++){var R=l[h];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(s,R.key,R)}}function f(s,l,h){return l&&p(s.prototype,l),h&&p(s,h),s}function d(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,a(s,l)}function a(s,l){return a=Object.setPrototypeOf||function(R,x){return R.__proto__=x,R},a(s,l)}var c=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),o=function(s){d(l,s);function l(R){var x;return x=s.call(this,R,"[level-controller]")||this,x._levels=[],x._firstLevel=-1,x._startLevel=void 0,x.currentLevelIndex=-1,x.manualLevelIndex=-1,x.onParsedComplete=void 0,x._registerListeners(),x}var h=l.prototype;return h._registerListeners=function(){var x=this.hls;x.on(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),x.on(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.on(k.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.on(k.Events.FRAG_LOADED,this.onFragLoaded,this),x.on(k.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var x=this.hls;x.off(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),x.off(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.off(k.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.off(k.Events.FRAG_LOADED,this.onFragLoaded,this),x.off(k.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,s.prototype.destroy.call(this)},h.startLoad=function(){var x=this._levels;x.forEach(function(T){T.loadError=0}),s.prototype.startLoad.call(this)},h.onManifestLoaded=function(x,T){var O=[],S=[],E=[],b,v={},u,_=!1,m=!1,y=!1;if(T.levels.forEach(function(W){var N=W.attrs;_=_||!!(W.width&&W.height),m=m||!!W.videoCodec,y=y||!!W.audioCodec,c&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var w=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;u=v[w],u?u.url.push(W.url):(u=new H.Level(W),v[w]=u,O.push(u)),N&&(N.AUDIO&&Object(U.addGroupId)(u,"audio",N.AUDIO),N.SUBTITLES&&Object(U.addGroupId)(u,"text",N.SUBTITLES))}),(_||m)&&y&&(O=O.filter(function(W){var N=W.videoCodec,w=W.width,G=W.height;return!!N||!!(w&&G)})),O=O.filter(function(W){var N=W.audioCodec,w=W.videoCodec;return(!N||Object(B.isCodecSupportedInMp4)(N,"audio"))&&(!w||Object(B.isCodecSupportedInMp4)(w,"video"))}),T.audioTracks&&(S=T.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(S)),T.subtitles&&(E=T.subtitles,Object(U.assignTrackIdsByGroup)(E)),O.length>0){b=O[0].bitrate,O.sort(function(W,N){return W.bitrate-N.bitrate}),this._levels=O;for(var P=0;P<O.length;P++)if(O[P].bitrate===b){this._firstLevel=P,this.log("manifest loaded, "+O.length+" level(s) found, first bitrate: "+b);break}var M=y&&!m,j={levels:O,audioTracks:S,subtitleTracks:E,firstLevel:this._firstLevel,stats:T.stats,audio:y,video:m,altAudio:!M&&S.some(function(W){return!!W.url})};this.hls.trigger(k.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(k.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:T.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(x,T){if(s.prototype.onError.call(this,x,T),T.fatal)return;var O=T.context,S=this._levels[this.currentLevelIndex];if(O&&(O.type===L.PlaylistContextType.AUDIO_TRACK&&S.audioGroupIds&&O.groupId===S.audioGroupIds[S.urlId]||O.type===L.PlaylistContextType.SUBTITLE_TRACK&&S.textGroupIds&&O.groupId===S.textGroupIds[S.urlId])){this.redundantFailover(this.currentLevelIndex);return}var E=!1,b=!0,v;switch(T.details){case C.ErrorDetails.FRAG_LOAD_ERROR:case C.ErrorDetails.FRAG_LOAD_TIMEOUT:case C.ErrorDetails.KEY_LOAD_ERROR:case C.ErrorDetails.KEY_LOAD_TIMEOUT:if(T.frag){var u=this._levels[T.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(v=T.frag.level)):v=T.frag.level}break;case C.ErrorDetails.LEVEL_LOAD_ERROR:case C.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(b=!1),v=O.level),E=!0;break;case C.ErrorDetails.REMUX_ALLOC_ERROR:v=T.level,E=!0;break}v!==void 0&&this.recoverLevel(T,v,E,b)},h.recoverLevel=function(x,T,O,S){var E=x.details,b=this._levels[T];if(b.loadError++,O){var v=this.retryLoadingOrFail(x);if(v)x.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(S){var u=b.url.length;if(u>1&&b.loadError<u)x.levelRetry=!0,this.redundantFailover(T);else if(this.manualLevelIndex===-1){var _=T===0?this._levels.length-1:T-1;this.currentLevelIndex!==_&&this._levels[_].loadError===0&&(this.warn(E+": switch to "+_),x.levelRetry=!0,this.hls.nextAutoLevel=_)}}},h.redundantFailover=function(x){var T=this._levels[x],O=T.url.length;if(O>1){var S=(T.urlId+1)%O;this.warn("Switching to redundant URL-id "+S),this._levels.forEach(function(E){E.urlId=S}),this.level=x}},h.onFragLoaded=function(x,T){var O=T.frag;if(O!==void 0&&O.type===L.PlaylistLevelType.MAIN){var S=this._levels[O.level];S!==void 0&&(S.fragmentError=0,S.loadError=0)}},h.onLevelLoaded=function(x,T){var O,S=T.level,E=T.details,b=this._levels[S];if(!b){var v;this.warn("Invalid level index "+S),(v=T.deliveryDirectives)!==null&&v!==void 0&&v.skip&&(E.deltaUpdateFailed=!0);return}S===this.currentLevelIndex?(b.fragmentError===0&&(b.loadError=0,this.retryCount=0),this.playlistLoaded(S,T,b.details)):(O=T.deliveryDirectives)!==null&&O!==void 0&&O.skip&&(E.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(x,T){var O=this.hls.levels[this.currentLevelIndex];if(!O)return;if(O.audioGroupIds){for(var S=-1,E=this.hls.audioTracks[T.id].groupId,b=0;b<O.audioGroupIds.length;b++)if(O.audioGroupIds[b]===E){S=b;break}S!==O.urlId&&(O.urlId=S,this.startLoad())}},h.loadPlaylist=function(x){var T=this.currentLevelIndex,O=this._levels[T];if(this.canLoad&&O&&O.url.length>0){var S=O.urlId,E=O.url[S];if(x)try{E=x.addDirectives(E)}catch(b){this.warn("Could not construct new URL with HLS Delivery Directives: "+b)}this.log("Attempt loading level index "+T+(x?" at sn "+x.msn+" part "+x.part:"")+" with URL-id "+S+" "+E),this.clearTimer(),this.hls.trigger(k.Events.LEVEL_LOADING,{url:E,level:T,id:S,deliveryDirectives:x||null})}},h.removeLevel=function(x,T){var O=function(b,v){return v!==T},S=this._levels.filter(function(E,b){return b!==x?!0:E.url.length>1&&T!==void 0?(E.url=E.url.filter(O),E.audioGroupIds&&(E.audioGroupIds=E.audioGroupIds.filter(O)),E.textGroupIds&&(E.textGroupIds=E.textGroupIds.filter(O)),E.urlId=0,!0):!1}).map(function(E,b){var v=E.details;return v!=null&&v.fragments&&v.fragments.forEach(function(u){u.level=b}),E});this._levels=S,this.hls.trigger(k.Events.LEVELS_UPDATED,{levels:S})},f(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(x){var T,O=this._levels;if(O.length===0)return;if(this.currentLevelIndex===x&&(T=O[x])!==null&&T!==void 0&&T.details)return;if(x<0||x>=O.length){var S=x<0;if(this.hls.trigger(k.Events.ERROR,{type:C.ErrorTypes.OTHER_ERROR,details:C.ErrorDetails.LEVEL_SWITCH_ERROR,level:x,fatal:S,reason:"invalid level idx"}),S)return;x=Math.min(x,O.length-1)}this.clearTimer();var E=this.currentLevelIndex,b=O[E],v=O[x];this.log("switching to level "+x+" from "+E),this.currentLevelIndex=x;var u=g({},v,{level:x,maxBitrate:v.maxBitrate,uri:v.uri,urlId:v.urlId});delete u._urlId,this.hls.trigger(k.Events.LEVEL_SWITCHING,u);var _=v.details;if(!_||_.live){var m=this.switchParams(v.uri,b==null?void 0:b.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(x){this.manualLevelIndex=x,this._startLevel===void 0&&(this._startLevel=x),x!==-1&&(this.level=x)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(x){this._firstLevel=x}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var x=this.hls.config.startLevel;return x!==void 0?x:this._firstLevel}else return this._startLevel},set:function(x){this._startLevel=x}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(x){this.level=x,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=x)}}]),l}(D.default)},"./src/controller/level-helper.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"addGroupId",function(){return C}),I.d(V,"assignTrackIdsByGroup",function(){return B}),I.d(V,"updatePTS",function(){return U}),I.d(V,"updateFragPTSDTS",function(){return L}),I.d(V,"mergeDetails",function(){return g}),I.d(V,"mapPartIntersection",function(){return p}),I.d(V,"mapFragmentIntersection",function(){return f}),I.d(V,"adjustSliding",function(){return d}),I.d(V,"addSliding",function(){return a}),I.d(V,"computeReloadInterval",function(){return c}),I.d(V,"getFragmentWithSN",function(){return o}),I.d(V,"getPartWith",function(){return s});var H=I("./src/polyfills/number.ts"),k=I("./src/utils/logger.ts");function C(l,h,R){switch(h){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(R);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(R);break}}function B(l){var h={};l.forEach(function(R){var x=R.groupId||"";R.id=h[x]=h[x]||0,h[x]++})}function U(l,h,R){var x=l[h],T=l[R];D(x,T)}function D(l,h){var R=h.startPTS;if(Object(H.isFiniteNumber)(R)){var x=0,T;h.sn>l.sn?(x=R-l.start,T=l):(x=l.start-R,T=h),T.duration!==x&&(T.duration=x)}else if(h.sn>l.sn){var O=l.cc===h.cc;O&&l.minEndPTS?h.start=l.start+(l.minEndPTS-l.start):h.start=l.start+l.duration}else h.start=Math.max(l.start-h.duration,0)}function L(l,h,R,x,T,O){var S=x-R;S<=0&&(k.logger.warn("Fragment should have a positive duration",h),x=R+h.duration,O=T+h.duration);var E=R,b=x,v=h.startPTS,u=h.endPTS;if(Object(H.isFiniteNumber)(v)){var _=Math.abs(v-R);Object(H.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(_,h.deltaPTS):h.deltaPTS=_,E=Math.max(R,v),R=Math.min(R,v),T=Math.min(T,h.startDTS),b=Math.min(x,u),x=Math.max(x,u),O=Math.max(O,h.endDTS)}h.duration=x-R;var m=R-h.start;h.appendedPTS=x,h.start=h.startPTS=R,h.maxStartPTS=E,h.startDTS=T,h.endPTS=x,h.minEndPTS=b,h.endDTS=O;var y=h.sn;if(!l||y<l.startSN||y>l.endSN)return 0;var P,M=y-l.startSN,j=l.fragments;for(j[M]=h,P=M;P>0;P--)D(j[P],j[P-1]);for(P=M;P<j.length-1;P++)D(j[P],j[P+1]);return l.fragmentHint&&D(j[j.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,m}function g(l,h){for(var R=null,x=l.fragments,T=x.length-1;T>=0;T--){var O=x[T].initSegment;if(O){R=O;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var S=0,E;if(f(l,h,function(P,M){P.relurl&&(S=P.cc-M.cc),Object(H.isFiniteNumber)(P.startPTS)&&Object(H.isFiniteNumber)(P.endPTS)&&(M.start=M.startPTS=P.startPTS,M.startDTS=P.startDTS,M.appendedPTS=P.appendedPTS,M.maxStartPTS=P.maxStartPTS,M.endPTS=P.endPTS,M.endDTS=P.endDTS,M.minEndPTS=P.minEndPTS,M.duration=P.endPTS-P.startPTS,M.duration&&(E=M),h.PTSKnown=h.alignedSliding=!0),M.elementaryStreams=P.elementaryStreams,M.loader=P.loader,M.stats=P.stats,M.urlId=P.urlId,P.initSegment&&(M.initSegment=P.initSegment,R=P.initSegment)}),R){var b=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;b.forEach(function(P){var M;(!P.initSegment||P.initSegment.relurl===((M=R)===null||M===void 0?void 0:M.relurl))&&(P.initSegment=R)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(P){return!P}),h.deltaUpdateFailed)){k.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var v=h.skippedSegments;v--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var u=h.fragments;if(S){k.logger.warn("discontinuity sliding from playlist, take drift into account");for(var _=0;_<u.length;_++)u[_].cc+=S}h.skippedSegments&&(h.startCC=h.fragments[0].cc),p(l.partList,h.partList,function(P,M){M.elementaryStreams=P.elementaryStreams,M.stats=P.stats}),E?L(h,E,E.startPTS,E.endPTS,E.startDTS,E.endDTS):d(l,h),u.length&&(h.totalduration=h.edge-u[0].start),h.driftStartTime=l.driftStartTime,h.driftStart=l.driftStart;var m=h.advancedDateTime;if(h.advanced&&m){var y=h.edge;h.driftStart||(h.driftStartTime=m,h.driftStart=y),h.driftEndTime=m,h.driftEnd=y}else h.driftEndTime=l.driftEndTime,h.driftEnd=l.driftEnd,h.advancedDateTime=l.advancedDateTime}function p(l,h,R){if(l&&h)for(var x=0,T=0,O=l.length;T<=O;T++){var S=l[T],E=h[T+x];S&&E&&S.index===E.index&&S.fragment.sn===E.fragment.sn?R(S,E):x--}}function f(l,h,R){for(var x=h.skippedSegments,T=Math.max(l.startSN,h.startSN)-h.startSN,O=(l.fragmentHint?1:0)+(x?h.endSN:Math.min(l.endSN,h.endSN))-h.startSN,S=h.startSN-l.startSN,E=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,b=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,v=T;v<=O;v++){var u=b[S+v],_=E[v];x&&!_&&v<x&&(_=h.fragments[v]=u),u&&_&&R(u,_)}}function d(l,h){var R=h.startSN+h.skippedSegments-l.startSN,x=l.fragments;if(R<0||R>=x.length)return;a(h,x[R].start)}function a(l,h){if(h){for(var R=l.fragments,x=l.skippedSegments;x<R.length;x++)R[x].start+=h;l.fragmentHint&&(l.fragmentHint.start+=h)}}function c(l,h){var R=1e3*l.levelTargetDuration,x=R/2,T=l.age,O=T>0&&T<R*3,S=h.loading.end-h.loading.start,E,b=l.availabilityDelay;if(l.updated===!1)if(O){var v=333*l.misses;E=Math.max(Math.min(x,S*2),v),l.availabilityDelay=(l.availabilityDelay||0)+E}else E=x;else O?(b=Math.min(b||R/2,T),l.availabilityDelay=b,E=b+R-T):E=R-S;return Math.round(E)}function o(l,h,R){if(!l||!l.details)return null;var x=l.details,T=x.fragments[h-x.startSN];return T||(T=x.fragmentHint,T&&T.sn===h?T:h<x.startSN&&R&&R.sn===h?R:null)}function s(l,h,R){if(!l||!l.details)return null;var x=l.details.partList;if(x)for(var T=x.length;T--;){var O=x[T];if(O.index===R&&O.fragment.sn===h)return O}return null}},"./src/controller/stream-controller.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return x});var H=I("./src/polyfills/number.ts"),k=I("./src/controller/base-stream-controller.ts"),C=I("./src/is-supported.ts"),B=I("./src/events.ts"),U=I("./src/utils/buffer-helper.ts"),D=I("./src/controller/fragment-tracker.ts"),L=I("./src/types/loader.ts"),g=I("./src/loader/fragment.ts"),p=I("./src/demux/transmuxer-interface.ts"),f=I("./src/types/transmuxer.ts"),d=I("./src/controller/gap-controller.ts"),a=I("./src/errors.ts"),c=I("./src/utils/logger.ts");function o(T,O){for(var S=0;S<O.length;S++){var E=O[S];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(T,E.key,E)}}function s(T,O,S){return O&&o(T.prototype,O),S&&o(T,S),T}function l(T,O){T.prototype=Object.create(O.prototype),T.prototype.constructor=T,h(T,O)}function h(T,O){return h=Object.setPrototypeOf||function(E,b){return E.__proto__=b,E},h(T,O)}var R=100,x=function(T){l(O,T);function O(E,b){var v;return v=T.call(this,E,b,"[stream-controller]")||this,v.audioCodecSwap=!1,v.gapController=null,v.level=-1,v._forceStartLoad=!1,v.altAudio=!1,v.audioOnly=!1,v.fragPlaying=null,v.onvplaying=null,v.onvseeked=null,v.fragLastKbps=0,v.stalled=!1,v.couldBacktrack=!1,v.audioCodecSwitch=!1,v.videoBuffer=null,v._registerListeners(),v}var S=O.prototype;return S._registerListeners=function(){var b=this.hls;b.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),b.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),b.on(B.Events.ERROR,this.onError,this),b.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),b.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),b.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),b.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),b.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S._unregisterListeners=function(){var b=this.hls;b.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),b.off(B.Events.ERROR,this.onError,this),b.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),b.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),b.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),b.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),b.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},S.startLoad=function(b){if(this.levels){var v=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(R),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var _=u.startLevel;_===-1&&(u.config.testBandwidth?(_=0,this.bitrateTest=!0):_=u.nextAutoLevel),this.level=u.nextLoadLevel=_,this.loadedmetadata=!1}v>0&&b===-1&&(this.log("Override startPosition with lastCurrentTime @"+v.toFixed(3)),b=v),this.state=k.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=b,this.tick()}else this._forceStartLoad=!0,this.state=k.State.STOPPED},S.stopLoad=function(){this._forceStartLoad=!1,T.prototype.stopLoad.call(this)},S.doTick=function(){switch(this.state){case k.State.IDLE:this.doTickIdle();break;case k.State.WAITING_LEVEL:{var b,v=this.levels,u=this.level,_=v==null||((b=v[u])===null||b===void 0)?void 0:b.details;if(_&&(!_.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(_))break;this.state=k.State.IDLE;break}break}case k.State.FRAG_LOADING_WAITING_RETRY:{var m,y=self.performance.now(),P=this.retryDate;(!P||y>=P||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=k.State.IDLE)}break;default:break}this.onTickEnd()},S.onTickEnd=function(){T.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},S.doTickIdle=function(){var b,v,u=this.hls,_=this.levelLastLoaded,m=this.levels,y=this.media,P=u.config,M=u.nextLoadLevel;if(_===null||!y&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[M])return;var j=m[M];this.level=u.nextLoadLevel=M;var W=j.details;if(!W||this.state===k.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==M){this.state=k.State.WAITING_LEVEL;return}var N=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,L.PlaylistLevelType.MAIN);if(N===null)return;var w=N.len,G=this.getMaxBufferLength(j.maxBitrate);if(w>=G)return;if(this._streamEnded(N,W)){var J={};this.altAudio&&(J.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,J),this.state=k.State.ENDED;return}var Z=N.end,ae=this.getNextFragment(Z,W);if(this.couldBacktrack&&!this.fragPrevious&&ae&&ae.sn!=="initSegment"){var _e=ae.sn-W.startSN;_e>1&&(ae=W.fragments[_e-1],this.fragmentTracker.removeFragment(ae))}if(ae&&this.fragmentTracker.getState(ae)===D.FragmentState.OK&&this.nextLoadPosition>Z){var ce=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,ce,L.PlaylistLevelType.MAIN),ae=this.getNextFragment(this.nextLoadPosition,W)}if(!ae)return;ae.initSegment&&!ae.initSegment.data&&!this.bitrateTest&&(ae=ae.initSegment),((b=ae.decryptdata)===null||b===void 0?void 0:b.keyFormat)==="identity"&&!((v=ae.decryptdata)!==null&&v!==void 0&&v.key)?this.loadKey(ae,W):this.loadFragment(ae,W,Z)},S.loadFragment=function(b,v,u){var _,m=this.fragmentTracker.getState(b);if(this.fragCurrent=b,m===D.FragmentState.BACKTRACKED){var y=this.fragmentTracker.getBacktrackData(b);if(y){this._handleFragmentLoadProgress(y),this._handleFragmentLoadComplete(y);return}else m=D.FragmentState.NOT_LOADED}m===D.FragmentState.NOT_LOADED||m===D.FragmentState.PARTIAL?b.sn==="initSegment"?this._loadInitSegment(b):this.bitrateTest?(b.bitrateTest=!0,this.log("Fragment "+b.sn+" of level "+b.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(b)):(this.startFragRequested=!0,T.prototype.loadFragment.call(this,b,v,u)):m===D.FragmentState.APPENDING?this.reduceMaxBufferLength(b.duration)&&this.fragmentTracker.removeFragment(b):((_=this.media)===null||_===void 0?void 0:_.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},S.getAppendedFrag=function(b){var v=this.fragmentTracker.getAppendedFrag(b,L.PlaylistLevelType.MAIN);return v&&"fragment"in v?v.fragment:v},S.getBufferedFrag=function(b){return this.fragmentTracker.getBufferedFrag(b,L.PlaylistLevelType.MAIN)},S.followingBufferedFrag=function(b){return b?this.getBufferedFrag(b.end+.5):null},S.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},S.nextLevelSwitch=function(){var b=this.levels,v=this.media;if(v!=null&&v.readyState){var u,_=this.getAppendedFrag(v.currentTime);if(_&&_.start>1&&this.flushMainBuffer(0,_.start-1),!v.paused&&b){var m=this.hls.nextLoadLevel,y=b[m],P=this.fragLastKbps;P&&this.fragCurrent?u=this.fragCurrent.duration*y.maxBitrate/(1e3*P)+1:u=0}else u=0;var M=this.getBufferedFrag(v.currentTime+u);if(M){var j=this.followingBufferedFrag(M);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,N=j.duration,w=Math.max(M.end,W+Math.min(Math.max(N-this.config.maxFragLookUpTolerance,N*.5),N*.75));this.flushMainBuffer(w,Number.POSITIVE_INFINITY)}}}},S.abortCurrentFrag=function(){var b=this.fragCurrent;this.fragCurrent=null,b!=null&&b.loader&&b.loader.abort(),this.state===k.State.KEY_LOADING&&(this.state=k.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},S.flushMainBuffer=function(b,v){T.prototype.flushMainBuffer.call(this,b,v,this.altAudio?"video":null)},S.onMediaAttached=function(b,v){T.prototype.onMediaAttached.call(this,b,v);var u=v.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),u.addEventListener("playing",this.onvplaying),u.addEventListener("seeked",this.onvseeked),this.gapController=new d.default(this.config,u,this.fragmentTracker,this.hls)},S.onMediaDetaching=function(){var b=this.media;b&&(b.removeEventListener("playing",this.onvplaying),b.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),T.prototype.onMediaDetaching.call(this)},S.onMediaPlaying=function(){this.tick()},S.onMediaSeeked=function(){var b=this.media,v=b?b.currentTime:null;Object(H.isFiniteNumber)(v)&&this.log("Media seeked to "+v.toFixed(3)),this.tick()},S.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},S.onManifestParsed=function(b,v){var u=!1,_=!1,m;v.levels.forEach(function(y){m=y.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(u=!0),m.indexOf("mp4a.40.5")!==-1&&(_=!0))}),this.audioCodecSwitch=u&&_&&!Object(C.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=v.levels,this.startFragRequested=!1},S.onLevelLoading=function(b,v){var u=this.levels;if(!u||this.state!==k.State.IDLE)return;var _=u[v.level];(!_.details||_.details.live&&this.levelLastLoaded!==v.level||this.waitForCdnTuneIn(_.details))&&(this.state=k.State.WAITING_LEVEL)},S.onLevelLoaded=function(b,v){var u,_=this.levels,m=v.level,y=v.details,P=y.totalduration;if(!_){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+y.startSN+","+y.endSN+"], cc ["+y.startCC+", "+y.endCC+"] duration:"+P);var M=this.fragCurrent;M&&(this.state===k.State.FRAG_LOADING||this.state===k.State.FRAG_LOADING_WAITING_RETRY)&&(M.level!==v.level&&M.loader&&(this.state=k.State.IDLE,M.loader.abort()));var j=_[m],W=0;if(y.live||(u=j.details)!==null&&u!==void 0&&u.live){if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed)return;W=this.alignPlaylists(y,j.details)}if(j.details=y,this.levelLastLoaded=m,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:y,level:m}),this.state===k.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(y))return;this.state=k.State.IDLE}this.startFragRequested?y.live&&this.synchronizeToLiveEdge(y):this.setStartPosition(y,W),this.tick()},S._handleFragmentLoadProgress=function(b){var v,u=b.frag,_=b.part,m=b.payload,y=this.levels;if(!y){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var P=y[u.level],M=P.details;if(!M){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var j=P.videoCodec,W=M.PTSKnown||!M.live,N=(v=u.initSegment)===null||v===void 0?void 0:v.data,w=this._getAudioCodec(P),G=this.transmuxer=this.transmuxer||new p.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),J=_?_.index:-1,Z=J!==-1,ae=new f.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,m.byteLength,J,Z),_e=this.initPTS[u.cc];G.push(m,N,w,j,u,_,M.totalduration,W,ae,_e)},S.onAudioTrackSwitching=function(b,v){var u=this.altAudio,_=!!v.url,m=v.id;if(!_){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var y=this.fragCurrent;y!=null&&y.loader&&(this.log("Switching to main audio track, cancel main fragment load"),y.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;u&&P.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:m})}},S.onAudioTrackSwitched=function(b,v){var u=v.id,_=!!this.hls.audioTracks[u].url;if(_){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=_,this.tick()},S.onBufferCreated=function(b,v){var u=v.tracks,_,m,y=!1;for(var P in u){var M=u[P];if(M.id==="main"){if(m=P,_=M,P==="video"){var j=u[P];j&&(this.videoBuffer=j.buffer)}}else y=!0}y&&_?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=_.buffer):this.mediaBuffer=this.media},S.onFragBuffered=function(b,v){var u=v.frag,_=v.part;if(u&&u.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(_?" p: "+_.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===k.State.PARSED&&(this.state=k.State.IDLE);return}var m=_?_.stats:u.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,_)},S.onError=function(b,v){switch(v.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,v);break;case a.ErrorDetails.LEVEL_LOAD_ERROR:case a.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==k.State.ERROR&&(v.fatal?(this.warn(""+v.details),this.state=k.State.ERROR):!v.levelRetry&&this.state===k.State.WAITING_LEVEL&&(this.state=k.State.IDLE));break;case a.ErrorDetails.BUFFER_FULL_ERROR:if(v.parent==="main"&&(this.state===k.State.PARSING||this.state===k.State.PARSED)){var u=!0,_=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);_&&_.len>.5&&(u=!this.reduceMaxBufferLength(_.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},S.checkBuffer=function(){var b=this.media,v=this.gapController;if(!b||!v||!b.readyState)return;var u=U.BufferHelper.getBuffered(b);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):v.poll(this.lastCurrentTime),this.lastCurrentTime=b.currentTime},S.onFragLoadEmergencyAborted=function(){this.state=k.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},S.onBufferFlushed=function(b,v){var u=v.type;if(u!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var _=(u===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(_,u,L.PlaylistLevelType.MAIN)}},S.onLevelsUpdated=function(b,v){this.levels=v.levels},S.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},S.seekToStartPos=function(){var b=this.media,v=b.currentTime,u=this.startPosition;if(u>=0&&v<u){if(b.seeking){c.logger.log("could not seek to "+u+", already seeking at "+v);return}var _=U.BufferHelper.getBuffered(b),m=_.length?_.start(0):0,y=m-u;y>0&&(y<this.config.maxBufferHole||y<this.config.maxFragLookUpTolerance)&&(c.logger.log("adjusting start position by "+y+" to match buffer start"),u+=y,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+v),b.currentTime=u}},S._getAudioCodec=function(b){var v=this.config.defaultAudioCodec||b.audioCodec;return this.audioCodecSwap&&v&&(this.log("Swapping audio codec"),v.indexOf("mp4a.40.5")!==-1?v="mp4a.40.2":v="mp4a.40.5"),v},S._loadBitrateTestFrag=function(b){var v=this;this._doFragLoad(b).then(function(u){var _=v.hls;if(!u||_.nextLoadLevel||v.fragContextChanged(b))return;v.fragLoadError=0,v.state=k.State.IDLE,v.startFragRequested=!1,v.bitrateTest=!1;var m=b.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),_.trigger(B.Events.FRAG_LOADED,u)})},S._handleTransmuxComplete=function(b){var v,u="main",_=this.hls,m=b.remuxResult,y=b.chunkMeta,P=this.getCurrentContext(y);if(!P){this.warn("The loading context changed while buffering fragment "+y.sn+" of level "+y.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(y.level);return}var M=P.frag,j=P.part,W=P.level,N=m.video,w=m.text,G=m.id3,J=m.initSegment,Z=this.altAudio?void 0:m.audio;if(this.fragContextChanged(M))return;if(this.state=k.State.PARSING,J){J.tracks&&(this._bufferInitSegment(W,J.tracks,M,y),_.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:M,id:u,tracks:J.tracks}));var ae=J.initPTS,_e=J.timescale;Object(H.isFiniteNumber)(ae)&&(this.initPTS[M.cc]=ae,_.trigger(B.Events.INIT_PTS_FOUND,{frag:M,id:u,initPTS:ae,timescale:_e}))}if(N&&m.independent!==!1){if(W.details){var ce=N.startPTS,he=N.endPTS,fe=N.startDTS,pe=N.endDTS;if(j)j.elementaryStreams[N.type]={startPTS:ce,endPTS:he,startDTS:fe,endDTS:pe};else if(N.firstKeyFrame&&N.independent&&(this.couldBacktrack=!0),N.dropped&&N.independent){var se=this.getLoadPosition()+this.config.maxBufferHole;if(se<ce){this.backtrack(M);return}M.setElementaryStreamInfo(N.type,M.start,he,M.start,pe,!0)}M.setElementaryStreamInfo(N.type,ce,he,fe,pe),this.bufferFragmentData(N,M,j,y)}}else if(m.independent===!1){this.backtrack(M);return}if(Z){var de=Z.startPTS,Ee=Z.endPTS,Pe=Z.startDTS,Se=Z.endDTS;j&&(j.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:de,endPTS:Ee,startDTS:Pe,endDTS:Se}),M.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,de,Ee,Pe,Se),this.bufferFragmentData(Z,M,j,y)}if(G!=null&&(v=G.samples)!==null&&v!==void 0&&v.length){var Je={frag:M,id:u,samples:G.samples};_.trigger(B.Events.FRAG_PARSING_METADATA,Je)}if(w){var qe={frag:M,id:u,samples:w.samples};_.trigger(B.Events.FRAG_PARSING_USERDATA,qe)}},S._bufferInitSegment=function(b,v,u,_){var m=this;if(this.state!==k.State.PARSING)return;this.audioOnly=!!v.audio&&!v.video,this.altAudio&&!this.audioOnly&&delete v.audio;var y=v.audio,P=v.video,M=v.audiovideo;if(y){var j=b.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),y.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&y.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),b.audioCodec&&b.audioCodec!==j&&this.log('Swapping manifest audio codec "'+b.audioCodec+'" for "'+j+'"'),y.levelCodec=j,y.id="main",this.log("Init audio buffer, container:"+y.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(b.audioCodec||"")+"/"+y.codec+"]")}P&&(P.levelCodec=b.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(b.videoCodec||"")+"/"+P.codec+"]")),M&&this.log("Init audiovideo buffer, container:"+M.container+", codecs[level/parsed]=["+(b.attrs.CODECS||"")+"/"+M.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,v),Object.keys(v).forEach(function(N){var w=v[N],G=w.initSegment;G!=null&&G.byteLength&&m.hls.trigger(B.Events.BUFFER_APPENDING,{type:N,data:G,frag:u,part:null,chunkMeta:_,parent:u.type})}),this.tick()},S.backtrack=function(b){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(b);var v=this.fragmentTracker.backtrack(b);this.fragPrevious=null,this.nextLoadPosition=b.start,v?this.resetFragmentLoading(b):this.state=k.State.BACKTRACKING},S.checkFragmentChanged=function(){var b=this.media,v=null;if(b&&b.readyState>1&&b.seeking===!1){var u=b.currentTime;if(U.BufferHelper.isBuffered(b,u)?v=this.getAppendedFrag(u):U.BufferHelper.isBuffered(b,u+.1)&&(v=this.getAppendedFrag(u+.1)),v){var _=this.fragPlaying,m=v.level;(!_||v.sn!==_.sn||_.level!==m||v.urlId!==_.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:v}),(!_||_.level!==m)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=v)}}},s(O,[{key:"nextLevel",get:function(){var b=this.nextBufferedFrag;return b?b.level:-1}},{key:"currentLevel",get:function(){var b=this.media;if(b){var v=this.getAppendedFrag(b.currentTime);if(v)return v.level}return-1}},{key:"nextBufferedFrag",get:function(){var b=this.media;if(b){var v=this.getAppendedFrag(b.currentTime);return this.followingBufferedFrag(v)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),O}(k.default)},"./src/controller/subtitle-stream-controller.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"SubtitleStreamController",function(){return l});var H=I("./src/events.ts"),k=I("./src/utils/logger.ts"),C=I("./src/utils/buffer-helper.ts"),B=I("./src/controller/fragment-finders.ts"),U=I("./src/utils/discontinuities.ts"),D=I("./src/controller/level-helper.ts"),L=I("./src/controller/fragment-tracker.ts"),g=I("./src/controller/base-stream-controller.ts"),p=I("./src/types/loader.ts"),f=I("./src/types/level.ts");function d(h,R){for(var x=0;x<R.length;x++){var T=R[x];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(h,T.key,T)}}function a(h,R,x){return R&&d(h.prototype,R),x&&d(h,x),h}function c(h,R){h.prototype=Object.create(R.prototype),h.prototype.constructor=h,o(h,R)}function o(h,R){return o=Object.setPrototypeOf||function(T,O){return T.__proto__=O,T},o(h,R)}var s=500,l=function(h){c(R,h);function R(T,O){var S;return S=h.call(this,T,O,"[subtitle-stream-controller]")||this,S.levels=[],S.currentTrackId=-1,S.tracksBuffered=[],S.mainDetails=null,S._registerListeners(),S}var x=R.prototype;return x.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},x._registerListeners=function(){var O=this.hls;O.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.on(H.Events.ERROR,this.onError,this),O.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.on(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.on(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},x._unregisterListeners=function(){var O=this.hls;O.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.off(H.Events.ERROR,this.onError,this),O.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.off(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.off(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},x.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(s),this.tick()},x.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},x.onLevelLoaded=function(O,S){this.mainDetails=S.details},x.onSubtitleFragProcessed=function(O,S){var E=S.frag,b=S.success;if(this.fragPrevious=E,this.state=g.State.IDLE,!b)return;var v=this.tracksBuffered[this.currentTrackId];if(!v)return;for(var u,_=E.start,m=0;m<v.length;m++)if(_>=v[m].start&&_<=v[m].end){u=v[m];break}var y=E.start+E.duration;u?u.end=y:(u={start:_,end:y},v.push(u)),this.fragmentTracker.fragBuffered(E)},x.onBufferFlushing=function(O,S){var E=S.startOffset,b=S.endOffset;if(E===0&&b!==Number.POSITIVE_INFINITY){var v=this.currentTrackId,u=this.levels;if(!u.length||!u[v]||!u[v].details)return;var _=u[v].details,m=_.targetduration,y=b-m;if(y<=0)return;S.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(P){for(var M=0;M<P.length;){if(P[M].end<=y){P.shift();continue}else if(P[M].start<y)P[M].start=y;else break;M++}}),this.fragmentTracker.removeFragmentsInRange(E,y,p.PlaylistLevelType.SUBTITLE)}},x.onError=function(O,S){var E,b=S.frag;if(!b||b.type!==p.PlaylistLevelType.SUBTITLE)return;(E=this.fragCurrent)!==null&&E!==void 0&&E.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},x.onSubtitleTracksUpdated=function(O,S){var E=this,b=S.subtitleTracks;this.tracksBuffered=[],this.levels=b.map(function(v){return new f.Level(v)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(v){E.tracksBuffered[v.id]=[]}),this.mediaBuffer=null},x.onSubtitleTrackSwitch=function(O,S){if(this.currentTrackId=S.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var E=this.levels[this.currentTrackId];E!=null&&E.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,E&&this.setInterval(s)},x.onSubtitleTrackLoaded=function(O,S){var E,b=S.details,v=S.id,u=this.currentTrackId,_=this.levels;if(!_.length)return;var m=_[u];if(v>=_.length||v!==u||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,b.live||(E=m.details)!==null&&E!==void 0&&E.live){var y=this.mainDetails;if(b.deltaUpdateFailed||!y)return;var P=y.fragments[0];if(!m.details)b.hasProgramDateTime&&y.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(b,y):P&&Object(D.addSliding)(b,P.start);else{var M=this.alignPlaylists(b,m.details);M===0&&P&&Object(D.addSliding)(b,P.start)}}if(m.details=b,this.levelLastLoaded=v,this.tick(),b.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var j=Object(B.findFragmentByPTS)(null,b.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},x._handleFragmentLoadComplete=function(O){var S=O.frag,E=O.payload,b=S.decryptdata,v=this.hls;if(this.fragContextChanged(S))return;if(E&&E.byteLength>0&&b&&b.key&&b.iv&&b.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(E),b.key.buffer,b.iv.buffer).then(function(_){var m=performance.now();v.trigger(H.Events.FRAG_DECRYPTED,{frag:S,payload:_,stats:{tstart:u,tdecrypt:m}})})}},x.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var O,S=this.currentTrackId,E=this.levels;if(!E.length||!E[S]||!E[S].details)return;var b=E[S].details,v=b.targetduration,u=this.config,_=this.media,m=C.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,_.currentTime-v,u.maxBufferHole),y=m.end,P=m.len,M=this.getMaxBufferLength()+v;if(P>M)return;console.assert(b,"Subtitle track details are defined on idle subtitle stream controller tick");var j=b.fragments,W=j.length,N=b.edge,w,G=this.fragPrevious;if(y<N){var J=u.maxFragLookUpTolerance;G&&b.hasProgramDateTime&&(w=Object(B.findFragmentByPDT)(j,G.endProgramDateTime,J)),w||(w=Object(B.findFragmentByPTS)(G,j,y,J),!w&&G&&G.start<j[0].start&&(w=j[0]))}else w=j[W-1];(O=w)!==null&&O!==void 0&&O.encrypted?(k.logger.log("Loading key for "+w.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(H.Events.KEY_LOADING,{frag:w})):w&&this.fragmentTracker.getState(w)===L.FragmentState.NOT_LOADED&&this.loadFragment(w,b,y)}},x.loadFragment=function(O,S,E){this.fragCurrent=O,h.prototype.loadFragment.call(this,O,S,E)},a(R,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),R}(g.default)},"./src/controller/subtitle-track-controller.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/events.ts"),k=I("./src/utils/texttrack-utils.ts"),C=I("./src/controller/base-playlist-controller.ts"),B=I("./src/types/loader.ts");function U(d,a){for(var c=0;c<a.length;c++){var o=a[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(d,o.key,o)}}function D(d,a,c){return a&&U(d.prototype,a),c&&U(d,c),d}function L(d,a){d.prototype=Object.create(a.prototype),d.prototype.constructor=d,g(d,a)}function g(d,a){return g=Object.setPrototypeOf||function(o,s){return o.__proto__=s,o},g(d,a)}var p=function(d){L(a,d);function a(o){var s;return s=d.call(this,o,"[subtitle-track-controller]")||this,s.media=null,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.selectDefaultTrack=!0,s.queuedDefaultTrack=-1,s.trackChangeListener=function(){return s.onTextTracksChanged()},s.asyncPollTrackChange=function(){return s.pollTrackChange(0)},s.useTextTrackPolling=!1,s.subtitlePollingInterval=-1,s.subtitleDisplay=!0,s.registerListeners(),s}var c=a.prototype;return c.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,d.prototype.destroy.call(this)},c.registerListeners=function(){var s=this.hls;s.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.on(H.Events.ERROR,this.onError,this)},c.unregisterListeners=function(){var s=this.hls;s.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.off(H.Events.ERROR,this.onError,this)},c.onMediaAttached=function(s,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},c.pollTrackChange=function(s){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,s)},c.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 s=f(this.media.textTracks);s.forEach(function(l){Object(k.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},c.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},c.onManifestParsed=function(s,l){this.tracks=l.subtitleTracks},c.onSubtitleTrackLoaded=function(s,l){var h=l.id,R=l.details,x=this.trackId,T=this.tracksInGroup[x];if(!T){this.warn("Invalid subtitle track id "+h);return}var O=T.details;T.details=l.details,this.log("subtitle track "+h+" loaded ["+R.startSN+"-"+R.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,l,O))},c.onLevelLoading=function(s,l){this.switchLevel(l.level)},c.onLevelSwitching=function(s,l){this.switchLevel(l.level)},c.switchLevel=function(s){var l=this.hls.levels[s];if(!(l!=null&&l.textGroupIds))return;var h=l.textGroupIds[l.urlId];if(this.groupId!==h){var R=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,x=this.tracks.filter(function(S){return!h||S.groupId===h});this.tracksInGroup=x;var T=this.findTrackId(R==null?void 0:R.name)||this.findTrackId();this.groupId=h;var O={subtitleTracks:x};this.log("Updating subtitle tracks, "+x.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,O),T!==-1&&this.setSubtitleTrack(T,R)}},c.findTrackId=function(s){for(var l=this.tracksInGroup,h=0;h<l.length;h++){var R=l[h];if((!this.selectDefaultTrack||R.default)&&(!s||s===R.name))return R.id}return-1},c.onError=function(s,l){if(d.prototype.onError.call(this,s,l),l.fatal||!l.context)return;l.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},c.loadPlaylist=function(s){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var h=l.id,R=l.groupId,x=l.url;if(s)try{x=s.addDirectives(x)}catch(T){this.warn("Could not construct new URL with HLS Delivery Directives: "+T)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADING,{url:x,id:h,groupId:R,deliveryDirectives:s||null})}},c.toggleTrackModes=function(s){var l=this,h=this.media,R=this.subtitleDisplay,x=this.trackId;if(!h)return;var T=f(h.textTracks),O=T.filter(function(b){return b.groupId===l.groupId});if(s===-1)[].slice.call(T).forEach(function(b){b.mode="disabled"});else{var S=O[x];S&&(S.mode="disabled")}var E=O[s];E&&(E.mode=R?"showing":"hidden")},c.setSubtitleTrack=function(s,l){var h,R=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=s;return}if(this.trackId!==s&&this.toggleTrackModes(s),this.trackId===s&&(s===-1||(h=R[s])!==null&&h!==void 0&&h.details)||s<-1||s>=R.length)return;this.clearTimer();var x=R[s];if(this.log("Switching to subtitle track "+s),this.trackId=s,x){var T=x.id,O=x.groupId,S=O===void 0?"":O,E=x.name,b=x.type,v=x.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:T,groupId:S,name:E,type:b,url:v});var u=this.switchParams(x.url,l==null?void 0:l.details);this.loadPlaylist(u)}else this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:s})},c.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var s=-1,l=f(this.media.textTracks),h=0;h<l.length;h++)if(l[h].mode==="hidden")s=h;else if(l[h].mode==="showing"){s=h;break}this.subtitleTrack!==s&&(this.subtitleTrack=s)},D(a,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(s,l)}}]),a}(C.default);function f(d){for(var a=[],c=0;c<d.length;c++){var o=d[c];o.kind==="subtitles"&&o.label&&a.push(d[c])}return a}V.default=p},"./src/controller/timeline-controller.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"TimelineController",function(){return f});var H=I("./src/polyfills/number.ts"),k=I("./src/events.ts"),C=I("./src/utils/cea-608-parser.ts"),B=I("./src/utils/output-filter.ts"),U=I("./src/utils/webvtt-parser.ts"),D=I("./src/utils/texttrack-utils.ts"),L=I("./src/utils/imsc1-ttml-parser.ts"),g=I("./src/types/loader.ts"),p=I("./src/utils/logger.ts"),f=function(){function o(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=c(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var h=new B.default(this,"textTrack1"),R=new B.default(this,"textTrack2"),x=new B.default(this,"textTrack3"),T=new B.default(this,"textTrack4");this.cea608Parser1=new C.default(1,h,R),this.cea608Parser2=new C.default(3,x,T)}l.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(k.Events.FRAG_LOADING,this.onFragLoading,this),l.on(k.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(k.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(k.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(k.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(k.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=o.prototype;return s.destroy=function(){var h=this.hls;h.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(k.Events.FRAG_LOADING,this.onFragLoading,this),h.off(k.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(k.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(k.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(k.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(k.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(h,R,x,T,O){for(var S=!1,E=O.length;E--;){var b=O[E],v=a(b[0],b[1],R,x);if(v>=0&&(b[0]=Math.min(b[0],R),b[1]=Math.max(b[1],x),S=!0,v/(x-R)>.5))return}if(S||O.push([R,x]),this.config.renderTextTracksNatively){var u=this.captionsTracks[h];this.Cues.newCue(u,R,x,T)}else{var _=this.Cues.newCue(null,R,x,T);this.hls.trigger(k.Events.CUES_PARSED,{type:"captions",cues:_,track:h})}},s.onInitPtsFound=function(h,R){var x=this,T=R.frag,O=R.id,S=R.initPTS,E=R.timescale,b=this.unparsedVttFrags;O==="main"&&(this.initPTS[T.cc]=S,this.timescale[T.cc]=E),b.length&&(this.unparsedVttFrags=[],b.forEach(function(v){x.onFragLoaded(k.Events.FRAG_LOADED,v)}))},s.getExistingTrack=function(h){var R=this.media;if(R)for(var x=0;x<R.textTracks.length;x++){var T=R.textTracks[x];if(T[h])return T}return null},s.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},s.createNativeTrack=function(h){if(this.captionsTracks[h])return;var R=this.captionsProperties,x=this.captionsTracks,T=this.media,O=R[h],S=O.label,E=O.languageCode,b=this.getExistingTrack(h);if(b)x[h]=b,Object(D.clearCurrentCues)(x[h]),Object(D.sendAddTrackEvent)(x[h],T);else{var v=this.createTextTrack("captions",S,E);v&&(v[h]=!0,x[h]=v)}},s.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var R=this.captionsProperties[h];if(!R)return;var x=R.label,T={_id:h,label:x,kind:"captions",default:R.media?!!R.media.default:!1,closedCaptions:R.media};this.nonNativeCaptionsTracks[h]=T,this.hls.trigger(k.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[T]})},s.createTextTrack=function(h,R,x){var T=this.media;return T?T.addTextTrack(h,R,x):void 0},s.onMediaAttaching=function(h,R){this.media=R.media,this._cleanTracks()},s.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(R){Object(D.clearCurrentCues)(h[R]),delete h[R]}),this.nonNativeCaptionsTracks={}},s.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=c(),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())},s._cleanTracks=function(){var h=this.media;if(!h)return;var R=h.textTracks;if(R)for(var x=0;x<R.length;x++)Object(D.clearCurrentCues)(R[x])},s.onSubtitleTracksUpdated=function(h,R){var x=this;this.textTracks=[];var T=R.subtitleTracks||[],O=T.some(function(v){return v.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||O&&this.config.enableIMSC1){var S=this.tracks&&T&&this.tracks.length===T.length;if(this.tracks=T||[],this.config.renderTextTracksNatively){var E=this.media?this.media.textTracks:[];this.tracks.forEach(function(v,u){var _;if(u<E.length){for(var m=null,y=0;y<E.length;y++)if(d(E[y],v)){m=E[y];break}m&&(_=m)}_?Object(D.clearCurrentCues)(_):(_=x.createTextTrack("subtitles",v.name,v.lang),_&&(_.mode="disabled")),_&&(_.groupId=v.groupId,x.textTracks.push(_))})}else if(!S&&this.tracks&&this.tracks.length){var b=this.tracks.map(function(v){return{label:v.name,kind:v.type.toLowerCase(),default:v.default,subtitleTrack:v}});this.hls.trigger(k.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:b})}}},s.onManifestLoaded=function(h,R){var x=this;this.config.enableCEA708Captions&&R.captions&&R.captions.forEach(function(T){var O=/(?:CC|SERVICE)([1-4])/.exec(T.instreamId);if(!O)return;var S="textTrack"+O[1],E=x.captionsProperties[S];if(!E)return;E.label=T.name,T.lang&&(E.languageCode=T.lang),E.media=T})},s.onFragLoading=function(h,R){var x=this.cea608Parser1,T=this.cea608Parser2,O=this.lastSn,S=this.lastPartIndex;if(!this.enabled||!(x&&T))return;if(R.frag.type===g.PlaylistLevelType.MAIN){var E,b,v=R.frag.sn,u=(E=R==null||((b=R.part)===null||b===void 0)?void 0:b.index)!=null?E:-1;v===O+1||v===O&&u===S+1||(x.reset(),T.reset()),this.lastSn=v,this.lastPartIndex=u}},s.onFragLoaded=function(h,R){var x=R.frag,T=R.payload,O=this.initPTS,S=this.unparsedVttFrags;if(x.type===g.PlaylistLevelType.SUBTITLE)if(T.byteLength){if(!Object(H.isFiniteNumber)(O[x.cc])){S.push(R),O.length&&this.hls.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:x,error:new Error("Missing initial subtitle PTS")});return}var E=x.decryptdata;if(E==null||E.key==null||E.method!=="AES-128"){var b=this.tracks[x.level],v=this.vttCCs;v[x.cc]||(v[x.cc]={start:x.start,prevCC:this.prevCC,new:!0},this.prevCC=x.cc),b&&b.textCodec===L.IMSC1_CODEC?this._parseIMSC1(x,T):this._parseVTTs(x,T,v)}}else this.hls.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:x,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(h,R){var x=this,T=this.hls;Object(L.parseIMSC1)(R,this.initPTS[h.cc],this.timescale[h.cc],function(O){x._appendCues(O,h.level),T.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(O){p.logger.log("Failed to parse IMSC1: "+O),T.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:O})})},s._parseVTTs=function(h,R,x){var T=this,O=this.hls;Object(U.parseWebVTT)(R,this.initPTS[h.cc],this.timescale[h.cc],x,h.cc,h.start,function(S){T._appendCues(S,h.level),O.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(S){T._fallbackToIMSC1(h,R),p.logger.log("Failed to parse VTT cue: "+S),O.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:S})})},s._fallbackToIMSC1=function(h,R){var x=this,T=this.tracks[h.level];T.textCodec||Object(L.parseIMSC1)(R,this.initPTS[h.cc],this.timescale[h.cc],function(){T.textCodec=L.IMSC1_CODEC,x._parseIMSC1(h,R)},function(){T.textCodec="wvtt"})},s._appendCues=function(h,R){var x=this.hls;if(this.config.renderTextTracksNatively){var T=this.textTracks[R];if(T.mode==="disabled")return;h.forEach(function(E){return Object(D.addCueToTrack)(T,E)})}else{var O=this.tracks[R],S=O.default?"default":"subtitles"+R;x.trigger(k.Events.CUES_PARSED,{type:"subtitles",cues:h,track:S})}},s.onFragDecrypted=function(h,R){var x=R.frag;if(x.type===g.PlaylistLevelType.SUBTITLE){if(!Object(H.isFiniteNumber)(this.initPTS[x.cc])){this.unparsedVttFrags.push(R);return}this.onFragLoaded(k.Events.FRAG_LOADED,R)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(h,R){var x=this.cea608Parser1,T=this.cea608Parser2;if(!this.enabled||!(x&&T))return;for(var O=0;O<R.samples.length;O++){var S=R.samples[O].bytes;if(S){var E=this.extractCea608Data(S);x.addData(R.samples[O].pts,E[0]),T.addData(R.samples[O].pts,E[1])}}},s.onBufferFlushing=function(h,R){var x=R.startOffset,T=R.endOffset,O=R.endOffsetSubtitles,S=R.type,E=this.media;if(!E||E.currentTime<T)return;if(!S||S==="video"){var b=this.captionsTracks;Object.keys(b).forEach(function(u){return Object(D.removeCuesInRange)(b[u],x,T)})}if(this.config.renderTextTracksNatively&&(x===0&&O!==void 0)){var v=this.textTracks;Object.keys(v).forEach(function(u){return Object(D.removeCuesInRange)(v[u],x,O)})}},s.extractCea608Data=function(h){for(var R=h[0]&31,x=2,T=[[],[]],O=0;O<R;O++){var S=h[x++],E=127&h[x++],b=127&h[x++],v=(4&S)!==0,u=3&S;if(E===0&&b===0)continue;v&&((u===0||u===1)&&(T[u].push(E),T[u].push(b)))}return T},o}();function d(o,s){return o&&o.label===s.name&&!(o.textTrack1||o.textTrack2)}function a(o,s,l,h){return Math.min(s,h)-Math.max(o,l)}function c(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return H});var H=function(){function k(B,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=U}var C=k.prototype;return C.decrypt=function(U,D){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},D,U)},k}()},"./src/crypt/aes-decryptor.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"removePadding",function(){return k}),I.d(V,"default",function(){return C});var H=I("./src/utils/typed-array.ts");function k(B){var U=B.byteLength,D=U&&new DataView(B.buffer).getUint8(U-1);return D?Object(H.sliceUint8)(B,0,U-D):B}var C=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var U=B.prototype;return U.uint8ArrayToUint32Array_=function(L){for(var g=new DataView(L),p=new Uint32Array(4),f=0;f<4;f++)p[f]=g.getUint32(f*4);return p},U.initTable=function(){var L=this.sBox,g=this.invSBox,p=this.subMix,f=p[0],d=p[1],a=p[2],c=p[3],o=this.invSubMix,s=o[0],l=o[1],h=o[2],R=o[3],x=new Uint32Array(256),T=0,O=0,S=0;for(S=0;S<256;S++)S<128?x[S]=S<<1:x[S]=S<<1^283;for(S=0;S<256;S++){var E=O^O<<1^O<<2^O<<3^O<<4;E=E>>>8^E&255^99,L[T]=E,g[E]=T;var b=x[T],v=x[b],u=x[v],_=x[E]*257^E*16843008;f[T]=_<<24|_>>>8,d[T]=_<<16|_>>>16,a[T]=_<<8|_>>>24,c[T]=_,_=u*16843009^v*65537^b*257^T*16843008,s[E]=_<<24|_>>>8,l[E]=_<<16|_>>>16,h[E]=_<<8|_>>>24,R[E]=_,T?(T=b^x[x[x[u^b]]],O^=x[x[O]]):T=O=1}},U.expandKey=function(L){for(var g=this.uint8ArrayToUint32Array_(L),p=!0,f=0;f<g.length&&p;)p=g[f]===this.key[f],f++;if(p)return;this.key=g;var d=this.keySize=g.length;if(d!==4&&d!==6&&d!==8)throw new Error("Invalid aes key size="+d);var a=this.ksRows=(d+6+1)*4,c,o,s=this.keySchedule=new Uint32Array(a),l=this.invKeySchedule=new Uint32Array(a),h=this.sBox,R=this.rcon,x=this.invSubMix,T=x[0],O=x[1],S=x[2],E=x[3],b,v;for(c=0;c<a;c++){if(c<d){b=s[c]=g[c];continue}v=b,c%d===0?(v=v<<8|v>>>24,v=h[v>>>24]<<24|h[v>>>16&255]<<16|h[v>>>8&255]<<8|h[v&255],v^=R[c/d|0]<<24):d>6&&c%d===4&&(v=h[v>>>24]<<24|h[v>>>16&255]<<16|h[v>>>8&255]<<8|h[v&255]),s[c]=b=(s[c-d]^v)>>>0}for(o=0;o<a;o++)c=a-o,o&3?v=s[c]:v=s[c-4],o<4||c<=4?l[o]=v:l[o]=T[h[v>>>24]]^O[h[v>>>16&255]]^S[h[v>>>8&255]]^E[h[v&255]],l[o]=l[o]>>>0},U.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},U.decrypt=function(L,g,p){for(var f=this.keySize+6,d=this.invKeySchedule,a=this.invSBox,c=this.invSubMix,o=c[0],s=c[1],l=c[2],h=c[3],R=this.uint8ArrayToUint32Array_(p),x=R[0],T=R[1],O=R[2],S=R[3],E=new Int32Array(L),b=new Int32Array(E.length),v,u,_,m,y,P,M,j,W,N,w,G,J,Z,ae=this.networkToHostOrderSwap;g<E.length;){for(W=ae(E[g]),N=ae(E[g+1]),w=ae(E[g+2]),G=ae(E[g+3]),y=W^d[0],P=G^d[1],M=w^d[2],j=N^d[3],J=4,Z=1;Z<f;Z++)v=o[y>>>24]^s[P>>16&255]^l[M>>8&255]^h[j&255]^d[J],u=o[P>>>24]^s[M>>16&255]^l[j>>8&255]^h[y&255]^d[J+1],_=o[M>>>24]^s[j>>16&255]^l[y>>8&255]^h[P&255]^d[J+2],m=o[j>>>24]^s[y>>16&255]^l[P>>8&255]^h[M&255]^d[J+3],y=v,P=u,M=_,j=m,J=J+4;v=a[y>>>24]<<24^a[P>>16&255]<<16^a[M>>8&255]<<8^a[j&255]^d[J],u=a[P>>>24]<<24^a[M>>16&255]<<16^a[j>>8&255]<<8^a[y&255]^d[J+1],_=a[M>>>24]<<24^a[j>>16&255]<<16^a[y>>8&255]<<8^a[P&255]^d[J+2],m=a[j>>>24]<<24^a[y>>16&255]<<16^a[P>>8&255]<<8^a[M&255]^d[J+3],b[g]=ae(v^x),b[g+1]=ae(m^T),b[g+2]=ae(_^O),b[g+3]=ae(u^S),x=W,T=N,O=w,S=G,g=g+4}return b.buffer},B}()},"./src/crypt/decrypter.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return g});var H=I("./src/crypt/aes-crypto.ts"),k=I("./src/crypt/fast-aes-key.ts"),C=I("./src/crypt/aes-decryptor.ts"),B=I("./src/utils/logger.ts"),U=I("./src/utils/mp4-tools.ts"),D=I("./src/utils/typed-array.ts"),L=16,g=function(){function p(d,a,c){var o=c===void 0?{}:c,s=o.removePKCS7Padding,l=s===void 0?!0:s;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=d,this.config=a,this.removePKCS7Padding=l,l)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(R){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var f=p.prototype;return f.destroy=function(){this.observer=null},f.isSync=function(){return this.config.enableSoftwareAES},f.flush=function(){var a=this.currentResult;if(!a){this.reset();return}var c=new Uint8Array(a);return this.reset(),this.removePKCS7Padding?Object(C.removePadding)(c):c},f.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},f.decrypt=function(a,c,o,s){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(a),c,o);var l=this.flush();l&&s(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(a),c,o).then(s)},f.softwareDecrypt=function(a,c,o){var s=this.currentIV,l=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(a=Object(U.appendUint8Array)(h,a),this.remainderData=null);var R=this.getValidChunk(a);if(!R.length)return null;s&&(o=s);var x=this.softwareDecrypter;x||(x=this.softwareDecrypter=new C.default),x.expandKey(c);var T=l;return this.currentResult=x.decrypt(R.buffer,0,o),this.currentIV=Object(D.sliceUint8)(R,-16).buffer,T||null},f.webCryptoDecrypt=function(a,c,o){var s=this,l=this.subtle;return(this.key!==c||!this.fastAesKey)&&(this.key=c,this.fastAesKey=new k.default(l,c)),this.fastAesKey.expandKey().then(function(h){if(!l)return Promise.reject(new Error("web crypto not initialized"));var R=new H.default(l,o);return R.decrypt(a.buffer,h)}).catch(function(h){return s.onWebCryptoError(h,a,c,o)})},f.onWebCryptoError=function(a,c,o,s){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",a),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(c,o,s)},f.getValidChunk=function(a){var c=a,o=a.length-a.length%L;return o!==a.length&&(c=Object(D.sliceUint8)(a,0,o),this.remainderData=Object(D.sliceUint8)(a,o)),c},f.logOnce=function(a){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+a),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return H});var H=function(){function k(B,U){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=U}var C=k.prototype;return C.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},k}()},"./src/demux/aacdemuxer.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/demux/base-audio-demuxer.ts"),k=I("./src/demux/adts.ts"),C=I("./src/utils/logger.ts"),B=I("./src/demux/id3.ts");function U(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,D(g,p)}function D(g,p){return D=Object.setPrototypeOf||function(d,a){return d.__proto__=a,d},D(g,p)}var L=function(g){U(p,g);function p(d,a){var c;return c=g.call(this)||this,c.observer=void 0,c.config=void 0,c.observer=d,c.config=a,c}var f=p.prototype;return f.resetInitSegment=function(a,c,o){g.prototype.resetInitSegment.call(this,a,c,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:a,duration:o,inputTimeScale:9e4,dropped:0}},p.probe=function(a){if(!a)return!1;for(var c=B.getID3Data(a,0)||[],o=c.length,s=a.length;o<s;o++)if(k.probe(a,o))return C.logger.log("ADTS sync word found !"),!0;return!1},f.canParse=function(a,c){return k.canParse(a,c)},f.appendFrame=function(a,c,o){k.initTrackConfig(a,this.observer,c,o,a.manifestCodec);var s=k.appendFrame(a,c,o,this.initPTS,this.frameIndex);if(s&&s.missing===0)return s},p}(H.default);L.minProbeByteLength=9,V.default=L},"./src/demux/adts.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"getAudioConfig",function(){return B}),I.d(V,"isHeaderPattern",function(){return U}),I.d(V,"getHeaderLength",function(){return D}),I.d(V,"getFullFrameLength",function(){return L}),I.d(V,"canGetFrameLength",function(){return g}),I.d(V,"isHeader",function(){return p}),I.d(V,"canParse",function(){return f}),I.d(V,"probe",function(){return d}),I.d(V,"initTrackConfig",function(){return a}),I.d(V,"getFrameDuration",function(){return c}),I.d(V,"parseFrameHeader",function(){return o}),I.d(V,"appendFrame",function(){return s});var H=I("./src/utils/logger.ts"),k=I("./src/errors.ts"),C=I("./src/events.ts");function B(l,h,R,x){var T,O,S,E,b=navigator.userAgent.toLowerCase(),v=x,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];T=((h[R+2]&192)>>>6)+1;var _=(h[R+2]&60)>>>2;if(_>u.length-1){l.trigger(C.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+_});return}return S=(h[R+2]&1)<<2,S|=(h[R+3]&192)>>>6,H.logger.log("manifest codec:"+x+", ADTS type:"+T+", samplingIndex:"+_),/firefox/i.test(b)?_>=6?(T=5,E=new Array(4),O=_-3):(T=2,E=new Array(2),O=_):b.indexOf("android")!==-1?(T=2,E=new Array(2),O=_):(T=5,E=new Array(4),x&&(x.indexOf("mp4a.40.29")!==-1||x.indexOf("mp4a.40.5")!==-1)||!x&&_>=6?O=_-3:((x&&x.indexOf("mp4a.40.2")!==-1&&(_>=6&&S===1||/vivaldi/i.test(b))||!x&&S===1)&&(T=2,E=new Array(2)),O=_)),E[0]=T<<3,E[0]|=(_&14)>>1,E[1]|=(_&1)<<7,E[1]|=S<<3,T===5&&(E[1]|=(O&14)>>1,E[2]=(O&1)<<7,E[2]|=2<<2,E[3]=0),{config:E,samplerate:u[_],channelCount:S,codec:"mp4a.40."+T,manifestCodec:v}}function U(l,h){return l[h]===255&&(l[h+1]&246)===240}function D(l,h){return l[h+1]&1?7:9}function L(l,h){return(l[h+3]&3)<<11|l[h+4]<<3|(l[h+5]&224)>>>5}function g(l,h){return h+5<l.length}function p(l,h){return h+1<l.length&&U(l,h)}function f(l,h){return g(l,h)&&U(l,h)&&L(l,h)<=l.length-h}function d(l,h){if(p(l,h)){var R=D(l,h);if(h+R>=l.length)return!1;var x=L(l,h);if(x<=R)return!1;var T=h+x;return T===l.length||p(l,T)}return!1}function a(l,h,R,x,T){if(!l.samplerate){var O=B(h,R,x,T);if(!O)return;l.config=O.config,l.samplerate=O.samplerate,l.channelCount=O.channelCount,l.codec=O.codec,l.manifestCodec=O.manifestCodec,H.logger.log("parsed codec:"+l.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function c(l){return 1024*9e4/l}function o(l,h,R,x,T){var O=D(l,h),S=L(l,h);if(S-=O,S>0){var E=R+x*T;return{headerLength:O,frameLength:S,stamp:E}}}function s(l,h,R,x,T){var O=c(l.samplerate),S=o(h,R,x,T,O);if(S){var E=S.frameLength,b=S.headerLength,v=S.stamp,u=b+E,_=Math.max(0,R+u-h.length),m;_?(m=new Uint8Array(u-b),m.set(h.subarray(R+b,h.length),0)):m=h.subarray(R+b,R+u);var y={unit:m,pts:v};return _||l.samples.push(y),{sample:y,length:u,missing:_}}}},"./src/demux/base-audio-demuxer.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"initPTSFn",function(){return L});var H=I("./src/polyfills/number.ts"),k=I("./src/demux/id3.ts"),C=I("./src/demux/dummy-demuxed-track.ts"),B=I("./src/utils/mp4-tools.ts"),U=I("./src/utils/typed-array.ts"),D=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var p=g.prototype;return p.resetInitSegment=function(d,a,c){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(d,a){return!1},p.appendFrame=function(d,a,c){},p.demux=function(d,a){this.cachedData&&(d=Object(B.appendUint8Array)(this.cachedData,d),this.cachedData=null);var c=k.getID3Data(d,0),o=c?c.length:0,s,l,h=this._audioTrack,R=this._id3Track,x=c?k.getTimeStamp(c):void 0,T=d.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(x,a)),c&&c.length>0&&R.samples.push({pts:this.initPTS,dts:this.initPTS,data:c}),l=this.initPTS;o<T;){if(this.canParse(d,o)){var O=this.appendFrame(h,d,o);O?(this.frameIndex++,l=O.sample.pts,o+=O.length,s=o):o=T}else k.canParse(d,o)?(c=k.getID3Data(d,o),R.samples.push({pts:l,dts:l,data:c}),o+=c.length,s=o):o++;if(o===T&&s!==T){var S=Object(U.sliceUint8)(d,s);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,S):this.cachedData=S}}return{audioTrack:h,avcTrack:Object(C.dummyTrack)(),id3Track:R,textTrack:Object(C.dummyTrack)()}},p.demuxSampleAes=function(d,a,c){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(d){var a=this.cachedData;return a&&(this.cachedData=null,this.demux(a,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(C.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(C.dummyTrack)()}},p.destroy=function(){},g}(),L=function(p,f){return Object(H.isFiniteNumber)(p)?p*90:f*9e4};V.default=D},"./src/demux/chunk-cache.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return H});var H=function(){function C(){this.chunks=[],this.dataLength=0}var B=C.prototype;return B.push=function(D){this.chunks.push(D),this.dataLength+=D.length},B.flush=function(){var D=this.chunks,L=this.dataLength,g;if(D.length)D.length===1?g=D[0]:g=k(D,L);else return new Uint8Array(0);return this.reset(),g},B.reset=function(){this.chunks.length=0,this.dataLength=0},C}();function k(C,B){for(var U=new Uint8Array(B),D=0,L=0;L<C.length;L++){var g=C[L];U.set(g,D),D+=g.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"dummyTrack",function(){return H});function H(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/utils/logger.ts"),k=function(){function C(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var B=C.prototype;return B.loadWord=function(){var D=this.data,L=this.bytesAvailable,g=D.byteLength-L,p=new Uint8Array(4),f=Math.min(4,L);if(f===0)throw new Error("no bytes available");p.set(D.subarray(g,g+f)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=f*8,this.bytesAvailable-=f},B.skipBits=function(D){var L;this.bitsAvailable>D?(this.word<<=D,this.bitsAvailable-=D):(D-=this.bitsAvailable,L=D>>3,D-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=D,this.bitsAvailable-=D)},B.readBits=function(D){var L=Math.min(this.bitsAvailable,D),g=this.word>>>32-L;return D>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=D-L,L>0&&this.bitsAvailable?g<<L|this.readBits(L):g},B.skipLZ=function(){var D;for(D=0;D<this.bitsAvailable;++D)if((this.word&2147483648>>>D)!==0)return this.word<<=D,this.bitsAvailable-=D,D;return this.loadWord(),D+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var D=this.skipLZ();return this.readBits(D+1)-1},B.readEG=function(){var D=this.readUEG();return 1&D?1+D>>>1:-1*(D>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(D){for(var L=8,g=8,p,f=0;f<D;f++)g!==0&&(p=this.readEG(),g=(L+p+256)%256),L=g===0?L:g},B.readSPS=function(){var D=0,L=0,g=0,p=0,f,d,a,c=this.readUByte.bind(this),o=this.readBits.bind(this),s=this.readUEG.bind(this),l=this.readBoolean.bind(this),h=this.skipBits.bind(this),R=this.skipEG.bind(this),x=this.skipUEG.bind(this),T=this.skipScalingList.bind(this);c();var O=c();if(o(5),h(3),c(),x(),O===100||O===110||O===122||O===244||O===44||O===83||O===86||O===118||O===128){var S=s();if(S===3&&h(1),x(),x(),h(1),l())for(d=S!==3?8:12,a=0;a<d;a++)l()&&(a<6?T(16):T(64))}x();var E=s();if(E===0)s();else if(E===1)for(h(1),R(),R(),f=s(),a=0;a<f;a++)R();x(),h(1);var b=s(),v=s(),u=o(1);u===0&&h(1),h(1),l()&&(D=s(),L=s(),g=s(),p=s());var _=[1,1];if(l()&&l()){var m=c();switch(m){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:{_=[c()<<8|c(),c()<<8|c()];break}}}return{width:Math.ceil((b+1)*16-D*2-L*2),height:(2-u)*(v+1)*16-(u?2:4)*(g+p),pixelRatio:_}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},C}();V.default=k},"./src/demux/id3.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"isHeader",function(){return H}),I.d(V,"isFooter",function(){return k}),I.d(V,"getID3Data",function(){return C}),I.d(V,"canParse",function(){return U}),I.d(V,"getTimeStamp",function(){return D}),I.d(V,"isTimeStampFrame",function(){return L}),I.d(V,"getID3Frames",function(){return p}),I.d(V,"decodeFrame",function(){return f}),I.d(V,"utf8ArrayToStr",function(){return s}),I.d(V,"testables",function(){return l});var H=function(T,O){return O+10<=T.length&&(T[O]===73&&T[O+1]===68&&T[O+2]===51&&(T[O+3]<255&&T[O+4]<255&&(T[O+6]<128&&T[O+7]<128&&T[O+8]<128&&T[O+9]<128)))},k=function(T,O){return O+10<=T.length&&(T[O]===51&&T[O+1]===68&&T[O+2]===73&&(T[O+3]<255&&T[O+4]<255&&(T[O+6]<128&&T[O+7]<128&&T[O+8]<128&&T[O+9]<128)))},C=function(T,O){for(var S=O,E=0;H(T,O);){E+=10;var b=B(T,O+6);E+=b,k(T,O+10)&&(E+=10),O+=E}return E>0?T.subarray(S,S+E):void 0},B=function(T,O){var S=0;return S=(T[O]&127)<<21,S|=(T[O+1]&127)<<14,S|=(T[O+2]&127)<<7,S|=T[O+3]&127,S},U=function(T,O){return H(T,O)&&B(T,O+6)+10<=T.length-O},D=function(T){for(var O=p(T),S=0;S<O.length;S++){var E=O[S];if(L(E))return o(E)}return},L=function(T){return T&&T.key==="PRIV"&&T.info==="com.apple.streaming.transportStreamTimestamp"},g=function(T){var O=String.fromCharCode(T[0],T[1],T[2],T[3]),S=B(T,4),E=10;return{type:O,size:S,data:T.subarray(E,E+S)}},p=function(T){for(var O=0,S=[];H(T,O);){var E=B(T,O+6);O+=10;for(var b=O+E;O+8<b;){var v=g(T.subarray(O)),u=f(v);u&&S.push(u),O+=v.size+10}k(T,O)&&(O+=10)}return S},f=function(T){return T.type==="PRIV"?d(T):T.type[0]==="W"?c(T):a(T)},d=function(T){if(T.size<2)return;var O=s(T.data,!0),S=new Uint8Array(T.data.subarray(O.length+1));return{key:T.type,info:O,data:S.buffer}},a=function(T){if(T.size<2)return;if(T.type==="TXXX"){var O=1,S=s(T.data.subarray(O),!0);O+=S.length+1;var E=s(T.data.subarray(O));return{key:T.type,info:S,data:E}}var b=s(T.data.subarray(1));return{key:T.type,data:b}},c=function(T){if(T.type==="WXXX"){if(T.size<2)return;var O=1,S=s(T.data.subarray(O),!0);O+=S.length+1;var E=s(T.data.subarray(O));return{key:T.type,info:S,data:E}}var b=s(T.data);return{key:T.type,data:b}},o=function(T){if(T.data.byteLength===8){var O=new Uint8Array(T.data),S=O[3]&1,E=(O[4]<<23)+(O[5]<<15)+(O[6]<<7)+O[7];return E/=45,S&&(E+=4772185884e-2),Math.round(E)}return},s=function(T,O){O===void 0&&(O=!1);var S=R();if(S){var E=S.decode(T);if(O){var b=E.indexOf("\0");return b!==-1?E.substring(0,b):E}return E.replace(/\0/g,"")}for(var v=T.length,u,_,m,y="",P=0;P<v;){if(u=T[P++],u===0&&O)return y;if(u===0||u===3)continue;switch(u>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:y+=String.fromCharCode(u);break;case 12:case 13:_=T[P++],y+=String.fromCharCode((u&31)<<6|_&63);break;case 14:_=T[P++],m=T[P++],y+=String.fromCharCode((u&15)<<12|(_&63)<<6|(m&63)<<0);break;default:}}return y},l={decodeTextFrame:a},h;function R(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/demux/base-audio-demuxer.ts"),k=I("./src/demux/id3.ts"),C=I("./src/utils/logger.ts"),B=I("./src/demux/mpegaudio.ts");function U(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,D(g,p)}function D(g,p){return D=Object.setPrototypeOf||function(d,a){return d.__proto__=a,d},D(g,p)}var L=function(g){U(p,g);function p(){return g.apply(this,arguments)||this}var f=p.prototype;return f.resetInitSegment=function(a,c,o){g.prototype.resetInitSegment.call(this,a,c,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:a,duration:o,inputTimeScale:9e4,dropped:0}},p.probe=function(a){if(!a)return!1;for(var c=k.getID3Data(a,0)||[],o=c.length,s=a.length;o<s;o++)if(B.probe(a,o))return C.logger.log("MPEG Audio sync word found !"),!0;return!1},f.canParse=function(a,c){return B.canParse(a,c)},f.appendFrame=function(a,c,o){return this.initPTS===null?void 0:B.appendFrame(a,c,o,this.initPTS,this.frameIndex)},p}(H.default);L.minProbeByteLength=4,V.default=L},"./src/demux/mp4demuxer.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/utils/mp4-tools.ts"),k=I("./src/demux/dummy-demuxed-track.ts"),C=function(){function B(D,L){this.remainderData=null,this.config=void 0,this.config=L}var U=B.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},B.probe=function(L){return Object(H.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},U.demux=function(L){var g=L,p=Object(k.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(H.appendUint8Array)(this.remainderData,L));var f=Object(H.segmentValidRange)(g);this.remainderData=f.remainder,p.samples=f.valid||new Uint8Array}else p.samples=g;return{audioTrack:Object(k.dummyTrack)(),avcTrack:p,id3Track:Object(k.dummyTrack)(),textTrack:Object(k.dummyTrack)()}},U.flush=function(){var L=Object(k.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(k.dummyTrack)(),avcTrack:L,id3Track:Object(k.dummyTrack)(),textTrack:Object(k.dummyTrack)()}},U.demuxSampleAes=function(L,g,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},B}();C.minProbeByteLength=1024,V.default=C},"./src/demux/mpegaudio.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"appendFrame",function(){return D}),I.d(V,"parseHeader",function(){return L}),I.d(V,"isHeaderPattern",function(){return g}),I.d(V,"isHeader",function(){return p}),I.d(V,"canParse",function(){return f}),I.d(V,"probe",function(){return d});var H=null,k=[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],C=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function D(a,c,o,s,l){if(o+24>c.length)return;var h=L(c,o);if(h&&o+h.frameLength<=c.length){var R=h.samplesPerFrame*9e4/h.sampleRate,x=s+l*R,T={unit:c.subarray(o,o+h.frameLength),pts:x,dts:x};return a.config=[],a.channelCount=h.channelCount,a.samplerate=h.sampleRate,a.samples.push(T),{sample:T,length:h.frameLength,missing:0}}}function L(a,c){var o=a[c+1]>>3&3,s=a[c+1]>>1&3,l=a[c+2]>>4&15,h=a[c+2]>>2&3;if(o!==1&&l!==0&&l!==15&&h!==3){var R=a[c+2]>>1&1,x=a[c+3]>>6,T=o===3?3-s:s===3?3:4,O=k[T*14+l-1]*1e3,S=o===3?0:o===2?1:2,E=C[S*3+h],b=x===3?1:2,v=B[o][s],u=U[s],_=v*8*u,m=Math.floor(v*O/E+R)*u;if(H===null){var y=navigator.userAgent||"",P=y.match(/Chrome\/(\d+)/i);H=P?parseInt(P[1]):0}var M=!!H&&H<=87;return M&&s===2&&O>=224e3&&x===0&&(a[c+3]=a[c+3]|128),{sampleRate:E,channelCount:b,frameLength:m,samplesPerFrame:_}}}function g(a,c){return a[c]===255&&(a[c+1]&224)===224&&(a[c+1]&6)!==0}function p(a,c){return c+1<a.length&&g(a,c)}function f(a,c){var o=4;return g(a,c)&&o<=a.length-c}function d(a,c){if(c+1<a.length&&g(a,c)){var o=4,s=L(a,c),l=o;s!=null&&s.frameLength&&(l=s.frameLength);var h=c+l;return h===a.length||p(a,h)}return!1}},"./src/demux/sample-aes.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/crypt/decrypter.ts"),k=I("./src/demux/tsdemuxer.ts"),C=function(){function B(D,L,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new H.default(D,L,{removePKCS7Padding:!1})}var U=B.prototype;return U.decryptBuffer=function(L,g){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,g)},U.decryptAacSample=function(L,g,p,f){var d=L[g].unit,a=d.subarray(16,d.length-d.length%16),c=a.buffer.slice(a.byteOffset,a.byteOffset+a.length),o=this;this.decryptBuffer(c,function(s){var l=new Uint8Array(s);d.set(l,16),f||o.decryptAacSamples(L,g+1,p)})},U.decryptAacSamples=function(L,g,p){for(;;g++){if(g>=L.length){p();return}if(L[g].unit.length<32)continue;var f=this.decrypter.isSync();if(this.decryptAacSample(L,g,p,f),!f)return}},U.getAvcEncryptedData=function(L){for(var g=Math.floor((L.length-48)/160)*16+16,p=new Int8Array(g),f=0,d=32;d<=L.length-16;d+=160,f+=16)p.set(L.subarray(d,d+16),f);return p},U.getAvcDecryptedUnit=function(L,g){for(var p=new Uint8Array(g),f=0,d=32;d<=L.length-16;d+=160,f+=16)L.set(p.subarray(f,f+16),d);return L},U.decryptAvcSample=function(L,g,p,f,d,a){var c=Object(k.discardEPB)(d.data),o=this.getAvcEncryptedData(c),s=this;this.decryptBuffer(o.buffer,function(l){d.data=s.getAvcDecryptedUnit(c,l),a||s.decryptAvcSamples(L,g,p+1,f)})},U.decryptAvcSamples=function(L,g,p,f){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,p=0){if(g>=L.length){f();return}for(var d=L[g].units;!(p>=d.length);p++){var a=d[p];if(a.data.length<=48||a.type!==1&&a.type!==5)continue;var c=this.decrypter.isSync();if(this.decryptAvcSample(L,g,p,f,a,c),!c)return}}},B}();V.default=C},"./src/demux/transmuxer-interface.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return d});var H=I("./node_modules/webworkify-webpack/index.js"),k=I.n(H),C=I("./src/events.ts"),B=I("./src/demux/transmuxer.ts"),U=I("./src/utils/logger.ts"),D=I("./src/errors.ts"),L=I("./src/utils/mediasource-helper.ts"),g=I("./node_modules/eventemitter3/index.js"),p=I.n(g),f=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},d=function(){function a(o,s,l,h){var R=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=o,this.id=s,this.onTransmuxComplete=l,this.onFlush=h;var x=o.config,T=function(v,u){u=u||{},u.frag=R.frag,u.id=R.id,o.trigger(v,u)};this.observer=new g.EventEmitter,this.observer.on(C.Events.FRAG_DECRYPTED,T),this.observer.on(C.Events.ERROR,T);var O={mp4:f.isTypeSupported("video/mp4"),mpeg:f.isTypeSupported("audio/mpeg"),mp3:f.isTypeSupported('audio/mp4; codecs="mp3"')},S=navigator.vendor;if(x.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var E;try{E=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),E.addEventListener("message",this.onwmsg),E.onerror=function(b){o.trigger(C.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(b.message+" ("+b.filename+":"+b.lineno+")")})},E.postMessage({cmd:"init",typeSupported:O,vendor:S,id:s,config:JSON.stringify(x)})}catch(b){U.logger.warn("Error in worker:",b),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),E&&self.URL.revokeObjectURL(E.objectURL),this.transmuxer=new B.default(this.observer,O,x,S,s),this.worker=null}}else this.transmuxer=new B.default(this.observer,O,x,S,s)}var c=a.prototype;return c.destroy=function(){var s=this.worker;if(s)s.removeEventListener("message",this.onwmsg),s.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},c.push=function(s,l,h,R,x,T,O,S,E,b){var v=this;E.transmuxing.start=self.performance.now();var u=this.transmuxer,_=this.worker,m=T?T.start:x.start,y=x.decryptdata,P=this.frag,M=!(P&&x.cc===P.cc),j=!(P&&E.level===P.level),W=P?E.sn-P.sn:-1,N=this.part?E.part-this.part.index:1,w=!j&&(W===1||W===0&&N===1),G=self.performance.now();(j||W||x.stats.parsing.start===0)&&(x.stats.parsing.start=G),T&&(N||!w)&&(T.stats.parsing.start=G);var J=new B.TransmuxState(M,w,S,j,m);if(!w||M){U.logger.log("[transmuxer-interface, "+x.type+"]: Starting new transmux session for sn: "+E.sn+" p: "+E.part+" level: "+E.level+" id: "+E.id+`
|
|
discontinuity: `+M+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+w+`
|
|
accurateTimeOffset: `+S+`
|
|
timeOffset: `+m);var Z=new B.TransmuxConfig(h,R,l,O,b);this.configureTransmuxer(Z)}if(this.frag=x,this.part=T,_)_.postMessage({cmd:"demux",data:s,decryptdata:y,chunkMeta:E,state:J},s instanceof ArrayBuffer?[s]:[]);else if(u){var ae=u.push(s,y,E,J);Object(B.isPromise)(ae)?ae.then(function(_e){v.handleTransmuxComplete(_e)}):this.handleTransmuxComplete(ae)}},c.flush=function(s){var l=this;s.transmuxing.start=self.performance.now();var h=this.transmuxer,R=this.worker;if(R)R.postMessage({cmd:"flush",chunkMeta:s});else if(h){var x=h.flush(s);Object(B.isPromise)(x)?x.then(function(T){l.handleFlushResult(T,s)}):this.handleFlushResult(x,s)}},c.handleFlushResult=function(s,l){var h=this;s.forEach(function(R){h.handleTransmuxComplete(R)}),this.onFlush(l)},c.onWorkerMessage=function(s){var l=s.data,h=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,h.trigger(l.event,l.data);break}}},c.configureTransmuxer=function(s){var l=this.worker,h=this.transmuxer;l?l.postMessage({cmd:"configure",config:s}):h&&h.configure(s)},c.handleTransmuxComplete=function(s){s.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(s)},a}()},"./src/demux/transmuxer-worker.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return D});var H=I("./src/demux/transmuxer.ts"),k=I("./src/events.ts"),C=I("./src/utils/logger.ts"),B=I("./node_modules/eventemitter3/index.js"),U=I.n(B);function D(d){var a=new B.EventEmitter,c=function(s,l){d.postMessage({event:s,data:l})};a.on(k.Events.FRAG_DECRYPTED,c),a.on(k.Events.ERROR,c),d.addEventListener("message",function(o){var s=o.data;switch(s.cmd){case"init":{var l=JSON.parse(s.config);d.transmuxer=new H.default(a,s.typeSupported,l,s.vendor,s.id),Object(C.enableLogs)(l.debug),c("init",null);break}case"configure":{d.transmuxer.configure(s.config);break}case"demux":{var h=d.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(H.isPromise)(h)?h.then(function(T){L(d,T)}):L(d,h);break}case"flush":{var R=s.chunkMeta,x=d.transmuxer.flush(R);Object(H.isPromise)(x)?x.then(function(T){p(d,T,R)}):p(d,x,R);break}default:break}})}function L(d,a){if(f(a.remuxResult))return;var c=[],o=a.remuxResult,s=o.audio,l=o.video;s&&g(c,s),l&&g(c,l),d.postMessage({event:"transmuxComplete",data:a},c)}function g(d,a){a.data1&&d.push(a.data1.buffer),a.data2&&d.push(a.data2.buffer)}function p(d,a,c){a.forEach(function(o){L(d,o)}),d.postMessage({event:"flush",data:c})}function f(d){return!d.audio&&!d.video&&!d.text&&!d.id3&&!d.initSegment}},"./src/demux/transmuxer.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return l}),I.d(V,"isPromise",function(){return x}),I.d(V,"TransmuxConfig",function(){return T}),I.d(V,"TransmuxState",function(){return O});var H=I("./src/events.ts"),k=I("./src/errors.ts"),C=I("./src/crypt/decrypter.ts"),B=I("./src/demux/aacdemuxer.ts"),U=I("./src/demux/mp4demuxer.ts"),D=I("./src/demux/tsdemuxer.ts"),L=I("./src/demux/mp3demuxer.ts"),g=I("./src/remux/mp4-remuxer.ts"),p=I("./src/remux/passthrough-remuxer.ts"),f=I("./src/demux/chunk-cache.ts"),d=I("./src/utils/mp4-tools.ts"),a=I("./src/utils/logger.ts"),c;try{c=self.performance.now.bind(self.performance)}catch(S){a.logger.debug("Unable to use Performance API on this environment"),c=self.Date.now}var o=[{demux:D.default,remux:g.default},{demux:U.default,remux:p.default},{demux:B.default,remux:g.default},{demux:L.default,remux:g.default}],s=1024;o.forEach(function(S){var E=S.demux;s=Math.max(s,E.minProbeByteLength)});var l=function(){function S(b,v,u,_,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new f.default,this.observer=b,this.typeSupported=v,this.config=u,this.vendor=_,this.id=m}var E=S.prototype;return E.configure=function(v){this.transmuxConfig=v,this.decrypter&&this.decrypter.reset()},E.push=function(v,u,_,m){var y=this,P=_.transmuxing;P.executeStart=c();var M=new Uint8Array(v),j=this.cache,W=this.config,N=this.currentTransmuxState,w=this.transmuxConfig;m&&(this.currentTransmuxState=m);var G=h(M,u);if(G&&G.method==="AES-128"){var J=this.getDecrypter();if(W.enableSoftwareAES){var Z=J.softwareDecrypt(M,G.key.buffer,G.iv.buffer);if(!Z)return P.executeEnd=c(),R(_);M=new Uint8Array(Z)}else return this.decryptionPromise=J.webCryptoDecrypt(M,G.key.buffer,G.iv.buffer).then(function(we){var De=y.push(we,null,_);return y.decryptionPromise=null,De}),this.decryptionPromise}var ae=m||N,_e=ae.contiguous,ce=ae.discontinuity,he=ae.trackSwitch,fe=ae.accurateTimeOffset,pe=ae.timeOffset,se=w.audioCodec,de=w.videoCodec,Ee=w.defaultInitPts,Pe=w.duration,Se=w.initSegmentData;if((ce||he)&&this.resetInitSegment(Se,se,de,Pe),ce&&this.resetInitialTimestamp(Ee),_e||this.resetContiguity(),this.needsProbing(M,ce,he)){if(j.dataLength){var Je=j.flush();M=Object(d.appendUint8Array)(Je,M)}this.configureTransmuxer(M,w)}var qe=this.transmux(M,G,pe,fe,_),Ae=this.currentTransmuxState;return Ae.contiguous=!0,Ae.discontinuity=!1,Ae.trackSwitch=!1,P.executeEnd=c(),qe},E.flush=function(v){var u=this,_=v.transmuxing;_.executeStart=c();var m=this.decrypter,y=this.cache,P=this.currentTransmuxState,M=this.decryptionPromise;if(M)return M.then(function(){return u.flush(v)});var j=[],W=P.timeOffset;if(m){var N=m.flush();N&&j.push(this.push(N,null,v))}var w=y.dataLength;y.reset();var G=this.demuxer,J=this.remuxer;if(!G||!J)return w>=s&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),_.executeEnd=c(),[R(v)];var Z=G.flush(W);return x(Z)?Z.then(function(ae){return u.flushRemux(j,ae,v),j}):(this.flushRemux(j,Z,v),j)},E.flushRemux=function(v,u,_){var m=u.audioTrack,y=u.avcTrack,P=u.id3Track,M=u.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,N=j.timeOffset;a.logger.log("[transmuxer.ts]: Flushed fragment "+_.sn+(_.part>-1?" p: "+_.part:"")+" of level "+_.level);var w=this.remuxer.remux(m,y,P,M,N,W,!0,this.id);v.push({remuxResult:w,chunkMeta:_}),_.transmuxing.executeEnd=c()},E.resetInitialTimestamp=function(v){var u=this.demuxer,_=this.remuxer;if(!u||!_)return;u.resetTimeStamp(v),_.resetTimeStamp(v)},E.resetContiguity=function(){var v=this.demuxer,u=this.remuxer;if(!v||!u)return;v.resetContiguity(),u.resetNextTimestamp()},E.resetInitSegment=function(v,u,_,m){var y=this.demuxer,P=this.remuxer;if(!y||!P)return;y.resetInitSegment(u,_,m),P.resetInitSegment(v,u,_)},E.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},E.transmux=function(v,u,_,m,y){var P;return u&&u.method==="SAMPLE-AES"?P=this.transmuxSampleAes(v,u,_,m,y):P=this.transmuxUnencrypted(v,_,m,y),P},E.transmuxUnencrypted=function(v,u,_,m){var y=this.demuxer.demux(v,u,!1,!this.config.progressive),P=y.audioTrack,M=y.avcTrack,j=y.id3Track,W=y.textTrack,N=this.remuxer.remux(P,M,j,W,u,_,!1,this.id);return{remuxResult:N,chunkMeta:m}},E.transmuxSampleAes=function(v,u,_,m,y){var P=this;return this.demuxer.demuxSampleAes(v,u,_).then(function(M){var j=P.remuxer.remux(M.audioTrack,M.avcTrack,M.id3Track,M.textTrack,_,m,!1,P.id);return{remuxResult:j,chunkMeta:y}})},E.configureTransmuxer=function(v,u){for(var _=this.config,m=this.observer,y=this.typeSupported,P=this.vendor,M=u.audioCodec,j=u.defaultInitPts,W=u.duration,N=u.initSegmentData,w=u.videoCodec,G,J=0,Z=o.length;J<Z;J++)if(o[J].demux.probe(v)){G=o[J];break}G||(a.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),G={demux:U.default,remux:p.default});var ae=this.demuxer,_e=this.remuxer,ce=G.remux,he=G.demux;(!_e||!(_e instanceof ce))&&(this.remuxer=new ce(m,_,y,P)),(!ae||!(ae instanceof he))&&(this.demuxer=new he(m,_,y),this.probe=he.probe),this.resetInitSegment(N,M,w,W),this.resetInitialTimestamp(j)},E.needsProbing=function(v,u,_){return!this.demuxer||!this.remuxer||u||_},E.getDecrypter=function(){var v=this.decrypter;return v||(v=this.decrypter=new C.default(this.observer,this.config)),v},S}();function h(S,E){var b=null;return S.byteLength>0&&E!=null&&E.key!=null&&E.iv!==null&&E.method!=null&&(b=E),b}var R=function(E){return{remuxResult:{},chunkMeta:E}};function x(S){return"then"in S&&S.then instanceof Function}var T=function(E,b,v,u,_){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=E,this.videoCodec=b,this.initSegmentData=v,this.duration=u,this.defaultInitPts=_},O=function(E,b,v,u,_){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=E,this.contiguous=b,this.accurateTimeOffset=v,this.trackSwitch=u,this.timeOffset=_}},"./src/demux/tsdemuxer.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"discardEPB",function(){return R});var H=I("./src/demux/adts.ts"),k=I("./src/demux/mpegaudio.ts"),C=I("./src/demux/exp-golomb.ts"),B=I("./src/demux/id3.ts"),U=I("./src/demux/sample-aes.ts"),D=I("./src/events.ts"),L=I("./src/utils/mp4-tools.ts"),g=I("./src/utils/logger.ts"),p=I("./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},d=function(){function x(O,S,E){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=O,this.config=S,this.typeSupported=E}x.probe=function(S){var E=x.syncOffset(S);return E<0?!1:(E&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+E+", junk ahead ?"),!0)},x.syncOffset=function(S){for(var E=Math.min(1e3,S.length-3*188),b=0;b<E;){if(S[b]===71&&S[b+188]===71&&S[b+2*188]===71)return b;b++}return-1},x.createTrack=function(S,E){return{container:S==="video"||S==="audio"?"video/mp2t":void 0,type:S,id:f[S],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:S==="audio"?E:void 0}};var T=x.prototype;return T.resetInitSegment=function(S,E,b){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=x.createTrack("video",b),this._audioTrack=x.createTrack("audio",b),this._id3Track=x.createTrack("id3",b),this._txtTrack=x.createTrack("text",b),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=S,this.videoCodec=E,this._duration=b},T.resetTimeStamp=function(){},T.resetContiguity=function(){var S=this._audioTrack,E=this._avcTrack,b=this._id3Track;S&&(S.pesData=null),E&&(E.pesData=null),b&&(b.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},T.demux=function(S,E,b,v){b===void 0&&(b=!1),v===void 0&&(v=!1),b||(this.sampleAes=null);var u,_=this._avcTrack,m=this._audioTrack,y=this._id3Track,P=_.pid,M=_.pesData,j=m.pid,W=y.pid,N=m.pesData,w=y.pesData,G=!1,J=this.pmtParsed,Z=this._pmtId,ae=S.length;if(this.remainderData&&(S=Object(L.appendUint8Array)(this.remainderData,S),ae=S.length,this.remainderData=null),ae<188&&!v)return this.remainderData=S,{audioTrack:m,avcTrack:_,id3Track:y,textTrack:this._txtTrack};var _e=Math.max(0,x.syncOffset(S));ae-=(ae+_e)%188,ae<S.byteLength&&!v&&(this.remainderData=new Uint8Array(S.buffer,ae,S.buffer.byteLength-ae));for(var ce=_e;ce<ae;ce+=188)if(S[ce]===71){var he=!!(S[ce+1]&64),fe=((S[ce+1]&31)<<8)+S[ce+2],pe=(S[ce+3]&48)>>4,se=void 0;if(pe>1){if(se=ce+5+S[ce+4],se===ce+188)continue}else se=ce+4;switch(fe){case P:he&&(M&&(u=s(M))&&this.parseAVCPES(u,!1),M={data:[],size:0}),M&&(M.data.push(S.subarray(se,ce+188)),M.size+=ce+188-se);break;case j:he&&(N&&(u=s(N))&&(m.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),N={data:[],size:0}),N&&(N.data.push(S.subarray(se,ce+188)),N.size+=ce+188-se);break;case W:he&&(w&&(u=s(w))&&this.parseID3PES(u),w={data:[],size:0}),w&&(w.data.push(S.subarray(se,ce+188)),w.size+=ce+188-se);break;case 0:he&&(se+=S[se]+1),Z=this._pmtId=c(S,se);break;case Z:{he&&(se+=S[se]+1);var de=o(S,se,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,b);P=de.avc,P>0&&(_.pid=P),j=de.audio,j>0&&(m.pid=j,m.isAAC=de.isAAC),W=de.id3,W>0&&(y.pid=W),G&&!J&&(g.logger.log("reparse from beginning"),G=!1,ce=_e-188),J=this.pmtParsed=!0;break}case 17:case 8191:break;default:G=!0;break}}else this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});_.pesData=M,m.pesData=N,y.pesData=w;var Ee={audioTrack:m,avcTrack:_,id3Track:y,textTrack:this._txtTrack};return v&&this.extractRemainingSamples(Ee),Ee},T.flush=function(){var S=this.remainderData;this.remainderData=null;var E;return S?E=this.demux(S,-1,!1,!0):E={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(E),this.sampleAes?this.decrypt(E,this.sampleAes):E},T.extractRemainingSamples=function(S){var E=S.audioTrack,b=S.avcTrack,v=S.id3Track,u=b.pesData,_=E.pesData,m=v.pesData,y;u&&(y=s(u))?(this.parseAVCPES(y,!0),b.pesData=null):b.pesData=u,_&&(y=s(_))?(E.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),E.pesData=null):(_!=null&&_.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),E.pesData=_),m&&(y=s(m))?(this.parseID3PES(y),v.pesData=null):v.pesData=m},T.demuxSampleAes=function(S,E,b){var v=this.demux(S,b,!0,!this.config.progressive),u=this.sampleAes=new U.default(this.observer,this.config,E);return this.decrypt(v,u)},T.decrypt=function(S,E){return new Promise(function(b){var v=S.audioTrack,u=S.avcTrack;v.samples&&v.isAAC?E.decryptAacSamples(v.samples,0,function(){u.samples?E.decryptAvcSamples(u.samples,0,0,function(){b(S)}):b(S)}):u.samples&&E.decryptAvcSamples(u.samples,0,0,function(){b(S)})})},T.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},T.parseAVCPES=function(S,E){var b=this,v=this._avcTrack,u=this.parseAVCNALu(S.data),_=!1,m=this.avcSample,y,P=!1;S.data=null,m&&u.length&&!v.audFound&&(l(m,v),m=this.avcSample=a(!1,S.pts,S.dts,"")),u.forEach(function(M){switch(M.type){case 1:{y=!0,m||(m=b.avcSample=a(!0,S.pts,S.dts,"")),_&&(m.debug+="NDR "),m.frame=!0;var j=M.data;if(P&&j.length>4){var W=new C.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(m.key=!0)}break}case 5:y=!0,m||(m=b.avcSample=a(!0,S.pts,S.dts,"")),_&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{y=!0,_&&m&&(m.debug+="SEI ");var N=new C.default(R(M.data));N.readUByte();for(var w=0,G=0,J=!1,Z=0;!J&&N.bytesAvailable>1;){w=0;do Z=N.readUByte(),w+=Z;while(Z===255);G=0;do Z=N.readUByte(),G+=Z;while(Z===255);if(w===4&&N.bytesAvailable!==0){J=!0;var ae=N.readUByte();if(ae===181){var _e=N.readUShort();if(_e===49){var ce=N.readUInt();if(ce===1195456820){var he=N.readUByte();if(he===3){for(var fe=N.readUByte(),pe=N.readUByte(),se=31&fe,de=[fe,pe],Ee=0;Ee<se;Ee++)de.push(N.readUByte()),de.push(N.readUByte()),de.push(N.readUByte());h(b._txtTrack.samples,{type:3,pts:S.pts,bytes:de})}}}}}else if(w===5&&N.bytesAvailable!==0){if(J=!0,G>16){for(var Pe=[],Se=0;Se<16;Se++)Pe.push(N.readUByte().toString(16)),(Se===3||Se===5||Se===7||Se===9)&&Pe.push("-");for(var Je=G-16,qe=new Uint8Array(Je),Ae=0;Ae<Je;Ae++)qe[Ae]=N.readUByte();h(b._txtTrack.samples,{pts:S.pts,payloadType:w,uuid:Pe.join(""),userData:Object(B.utf8ArrayToStr)(qe),userDataBytes:qe})}}else if(G<N.bytesAvailable)for(var we=0;we<G;we++)N.readUByte()}break}case 7:if(y=!0,P=!0,_&&m&&(m.debug+="SPS "),!v.sps){var De=new C.default(M.data),Xe=De.readSPS();v.width=Xe.width,v.height=Xe.height,v.pixelRatio=Xe.pixelRatio,v.sps=[M.data],v.duration=b._duration;for(var We=M.data.subarray(1,4),Ce="avc1.",Oe=0;Oe<3;Oe++){var et=We[Oe].toString(16);et.length<2&&(et="0"+et),Ce+=et}v.codec=Ce}break;case 8:y=!0,_&&m&&(m.debug+="PPS "),v.pps||(v.pps=[M.data]);break;case 9:y=!1,v.audFound=!0,m&&l(m,v),m=b.avcSample=a(!1,S.pts,S.dts,_?"AUD ":"");break;case 12:y=!1;break;default:y=!1,m&&(m.debug+="unknown NAL "+M.type+" ");break}if(m&&y){var Me=m.units;Me.push(M)}}),E&&m&&(l(m,v),this.avcSample=null)},T.getLastNalUnit=function(){var S,E=this.avcSample,b;if(!E||E.units.length===0){var v=this._avcTrack.samples;E=v[v.length-1]}if((S=E)!==null&&S!==void 0&&S.units){var u=E.units;b=u[u.length-1]}return b},T.parseAVCNALu=function(S){var E=S.byteLength,b=this._avcTrack,v=b.naluState||0,u=v,_=[],m=0,y,P,M,j=-1,W=0;for(v===-1&&(j=0,W=S[0]&31,v=0,m=1);m<E;){if(y=S[m++],!v){v=y?0:1;continue}if(v===1){v=y?0:2;continue}if(!y)v=3;else if(y===1){if(j>=0){var N={data:S.subarray(j,m-v-1),type:W};_.push(N)}else{var w=this.getLastNalUnit();if(w&&(u&&m<=4-u&&(w.state&&(w.data=w.data.subarray(0,w.data.byteLength-u))),P=m-v-1,P>0)){var G=new Uint8Array(w.data.byteLength+P);G.set(w.data,0),G.set(S.subarray(0,P),w.data.byteLength),w.data=G,w.state=0}}m<E?(M=S[m]&31,j=m,W=M,v=0):v=-1}else v=0}if(j>=0&&v>=0){var J={data:S.subarray(j,E),type:W,state:v};_.push(J)}if(_.length===0){var Z=this.getLastNalUnit();if(Z){var ae=new Uint8Array(Z.data.byteLength+S.byteLength);ae.set(Z.data,0),ae.set(S,Z.data.byteLength),Z.data=ae}}return b.naluState=v,_},T.parseAACPES=function(S){var E=0,b=this._audioTrack,v=this.aacOverFlow,u=S.data;if(v){this.aacOverFlow=null;var _=v.sample.unit.byteLength,m=Math.min(v.missing,_),y=_-m;v.sample.unit.set(u.subarray(0,m),y),b.samples.push(v.sample),E=v.missing}var P,M;for(P=E,M=u.length;P<M-1&&!H.isHeader(u,P);P++);if(P!==E){var j,W;if(P<M-1?(j="AAC PES did not start with ADTS header,offset:"+P,W=!1):(j="no ADTS header found in AAC PES",W=!0),g.logger.warn("parsing error:"+j),this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}H.initTrackConfig(b,this.observer,u,P,this.audioCodec);var N;if(S.pts!==void 0)N=S.pts;else if(v){var w=H.getFrameDuration(b.samplerate);N=v.sample.pts+w}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var G=0;P<M;)if(H.isHeader(u,P)){if(P+5<M){var J=H.appendFrame(b,u,P,N,G);if(J)if(J.missing)this.aacOverFlow=J;else{P+=J.length,G++;continue}}break}else P++},T.parseMPEGPES=function(S){var E=S.data,b=E.length,v=0,u=0,_=S.pts;if(_===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<b;)if(k.isHeader(E,u)){var m=k.appendFrame(this._audioTrack,E,u,_,v);if(m)u+=m.length,v++;else break}else u++},T.parseID3PES=function(S){if(S.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(S)},x}();d.minProbeByteLength=188;function a(x,T,O,S){return{key:x,frame:!1,pts:T,dts:O,units:[],debug:S,length:0}}function c(x,T){return(x[T+10]&31)<<8|x[T+11]}function o(x,T,O,S){var E={audio:-1,avc:-1,id3:-1,isAAC:!0},b=(x[T+1]&15)<<8|x[T+2],v=T+3+b-4,u=(x[T+10]&15)<<8|x[T+11];for(T+=12+u;T<v;){var _=(x[T+1]&31)<<8|x[T+2];switch(x[T]){case 207:if(!S){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:E.audio===-1&&(E.audio=_);break;case 21:E.id3===-1&&(E.id3=_);break;case 219:if(!S){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:E.avc===-1&&(E.avc=_);break;case 3:case 4:O?E.audio===-1&&(E.audio=_,E.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}T+=((x[T+3]&15)<<8|x[T+4])+5}return E}function s(x){var T=0,O,S,E,b,v,u=x.data;if(!x||x.size===0)return null;for(;u[0].length<19&&u.length>1;){var _=new Uint8Array(u[0].length+u[1].length);_.set(u[0]),_.set(u[1],u[0].length),u[0]=_,u.splice(1,1)}O=u[0];var m=(O[0]<<16)+(O[1]<<8)+O[2];if(m===1){if(S=(O[4]<<8)+O[5],S&&S>x.size-6)return null;var y=O[7];y&192&&(b=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,y&64?(v=(O[14]&14)*536870912+(O[15]&255)*4194304+(O[16]&254)*16384+(O[17]&255)*128+(O[18]&254)/2,b-v>60*9e4&&(g.logger.warn(Math.round((b-v)/9e4)+"s delta between PTS and DTS, align them"),b=v)):v=b),E=O[8];var P=E+9;if(x.size<=P)return null;x.size-=P;for(var M=new Uint8Array(x.size),j=0,W=u.length;j<W;j++){O=u[j];var N=O.byteLength;if(P)if(P>N){P-=N;continue}else O=O.subarray(P),N-=P,P=0;M.set(O,T),T+=N}return S&&(S-=E+3),{data:M,pts:b,dts:v,len:S}}return null}function l(x,T){if(x.units.length&&x.frame){if(x.pts===void 0){var O=T.samples,S=O.length;if(S){var E=O[S-1];x.pts=E.pts,x.dts=E.dts}else{T.dropped++;return}}T.samples.push(x)}x.debug.length&&g.logger.log(x.pts+"/"+x.dts+":"+x.debug)}function h(x,T){var O=x.length;if(O>0){if(T.pts>=x[O-1].pts)x.push(T);else for(var S=O-1;S>=0;S--)if(T.pts<x[S].pts){x.splice(S,0,T);break}}else x.push(T)}function R(x){for(var T=x.byteLength,O=[],S=1;S<T-2;)x[S]===0&&x[S+1]===0&&x[S+2]===3?(O.push(S+2),S+=2):S++;if(O.length===0)return x;var E=T-O.length,b=new Uint8Array(E),v=0;for(S=0;S<E;v++,S++)v===O[0]&&(v++,O.shift()),b[S]=x[v];return b}V.default=d},"./src/errors.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"ErrorTypes",function(){return H}),I.d(V,"ErrorDetails",function(){return k});var H;(function(C){C.NETWORK_ERROR="networkError",C.MEDIA_ERROR="mediaError",C.KEY_SYSTEM_ERROR="keySystemError",C.MUX_ERROR="muxError",C.OTHER_ERROR="otherError"})(H||(H={}));var k;(function(C){C.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",C.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",C.KEY_SYSTEM_NO_SESSION="keySystemNoSession",C.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",C.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",C.MANIFEST_LOAD_ERROR="manifestLoadError",C.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",C.MANIFEST_PARSING_ERROR="manifestParsingError",C.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",C.LEVEL_EMPTY_ERROR="levelEmptyError",C.LEVEL_LOAD_ERROR="levelLoadError",C.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",C.LEVEL_SWITCH_ERROR="levelSwitchError",C.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",C.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",C.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",C.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",C.FRAG_LOAD_ERROR="fragLoadError",C.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",C.FRAG_DECRYPT_ERROR="fragDecryptError",C.FRAG_PARSING_ERROR="fragParsingError",C.REMUX_ALLOC_ERROR="remuxAllocError",C.KEY_LOAD_ERROR="keyLoadError",C.KEY_LOAD_TIMEOUT="keyLoadTimeOut",C.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",C.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",C.BUFFER_APPEND_ERROR="bufferAppendError",C.BUFFER_APPENDING_ERROR="bufferAppendingError",C.BUFFER_STALLED_ERROR="bufferStalledError",C.BUFFER_FULL_ERROR="bufferFullError",C.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",C.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",C.INTERNAL_EXCEPTION="internalException",C.INTERNAL_ABORTED="aborted",C.UNKNOWN="unknown"})(k||(k={}))},"./src/events.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"Events",function(){return H});var H;(function(k){k.MEDIA_ATTACHING="hlsMediaAttaching",k.MEDIA_ATTACHED="hlsMediaAttached",k.MEDIA_DETACHING="hlsMediaDetaching",k.MEDIA_DETACHED="hlsMediaDetached",k.BUFFER_RESET="hlsBufferReset",k.BUFFER_CODECS="hlsBufferCodecs",k.BUFFER_CREATED="hlsBufferCreated",k.BUFFER_APPENDING="hlsBufferAppending",k.BUFFER_APPENDED="hlsBufferAppended",k.BUFFER_EOS="hlsBufferEos",k.BUFFER_FLUSHING="hlsBufferFlushing",k.BUFFER_FLUSHED="hlsBufferFlushed",k.MANIFEST_LOADING="hlsManifestLoading",k.MANIFEST_LOADED="hlsManifestLoaded",k.MANIFEST_PARSED="hlsManifestParsed",k.LEVEL_SWITCHING="hlsLevelSwitching",k.LEVEL_SWITCHED="hlsLevelSwitched",k.LEVEL_LOADING="hlsLevelLoading",k.LEVEL_LOADED="hlsLevelLoaded",k.LEVEL_UPDATED="hlsLevelUpdated",k.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",k.LEVELS_UPDATED="hlsLevelsUpdated",k.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",k.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",k.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",k.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",k.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",k.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",k.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",k.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",k.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",k.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",k.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",k.CUES_PARSED="hlsCuesParsed",k.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",k.INIT_PTS_FOUND="hlsInitPtsFound",k.FRAG_LOADING="hlsFragLoading",k.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",k.FRAG_LOADED="hlsFragLoaded",k.FRAG_DECRYPTED="hlsFragDecrypted",k.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",k.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",k.FRAG_PARSING_METADATA="hlsFragParsingMetadata",k.FRAG_PARSED="hlsFragParsed",k.FRAG_BUFFERED="hlsFragBuffered",k.FRAG_CHANGED="hlsFragChanged",k.FPS_DROP="hlsFpsDrop",k.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",k.ERROR="hlsError",k.DESTROYING="hlsDestroying",k.KEY_LOADING="hlsKeyLoading",k.KEY_LOADED="hlsKeyLoaded",k.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",k.BACK_BUFFER_REACHED="hlsBackBufferReached"})(H||(H={}))},"./src/hls.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return x});var H=I("./node_modules/url-toolkit/src/url-toolkit.js"),k=I.n(H),C=I("./src/loader/playlist-loader.ts"),B=I("./src/loader/key-loader.ts"),U=I("./src/controller/id3-track-controller.ts"),D=I("./src/controller/latency-controller.ts"),L=I("./src/controller/level-controller.ts"),g=I("./src/controller/fragment-tracker.ts"),p=I("./src/controller/stream-controller.ts"),f=I("./src/is-supported.ts"),d=I("./src/utils/logger.ts"),a=I("./src/config.ts"),c=I("./node_modules/eventemitter3/index.js"),o=I.n(c),s=I("./src/events.ts"),l=I("./src/errors.ts");function h(T,O){for(var S=0;S<O.length;S++){var E=O[S];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(T,E.key,E)}}function R(T,O,S){return O&&h(T.prototype,O),S&&h(T,S),T}var x=function(){T.isSupported=function(){return Object(f.isSupported)()};function T(S){S===void 0&&(S={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new c.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 E=this.config=Object(a.mergeConfig)(T.DefaultConfig,S);this.userConfig=S,Object(d.enableLogs)(E.debug),this._autoLevelCapping=-1,E.progressive&&Object(a.enableStreamingMode)(E);var b=E.abrController,v=E.bufferController,u=E.capLevelController,_=E.fpsController,m=this.abrController=new b(this),y=this.bufferController=new v(this),P=this.capLevelController=new u(this),M=new _(this),j=new C.default(this),W=new B.default(this),N=new U.default(this),w=this.levelController=new L.default(this),G=new g.FragmentTracker(this),J=this.streamController=new p.default(this,G);P.setStreamController(J),M.setStreamController(J);var Z=[w,J];this.networkControllers=Z;var ae=[j,W,m,y,P,M,N,G];this.audioTrackController=this.createController(E.audioTrackController,null,Z),this.createController(E.audioStreamController,G,Z),this.subtitleTrackController=this.createController(E.subtitleTrackController,null,Z),this.createController(E.subtitleStreamController,G,Z),this.createController(E.timelineController,null,ae),this.emeController=this.createController(E.emeController,null,ae),this.cmcdController=this.createController(E.cmcdController,null,ae),this.latencyController=this.createController(D.default,null,ae),this.coreComponents=ae}var O=T.prototype;return O.createController=function(E,b,v){if(E){var u=b?new E(this,b):new E(this);return v&&v.push(u),u}return null},O.on=function(E,b,v){v===void 0&&(v=this),this._emitter.on(E,b,v)},O.once=function(E,b,v){v===void 0&&(v=this),this._emitter.once(E,b,v)},O.removeAllListeners=function(E){this._emitter.removeAllListeners(E)},O.off=function(E,b,v,u){v===void 0&&(v=this),this._emitter.off(E,b,v,u)},O.listeners=function(E){return this._emitter.listeners(E)},O.emit=function(E,b,v){return this._emitter.emit(E,b,v)},O.trigger=function(E,b){if(this.config.debug)return this.emit(E,E,b);try{return this.emit(E,E,b)}catch(v){d.logger.error("An internal error happened while handling event "+E+'. Error message: "'+v.message+'". Here is a stacktrace:',v),this.trigger(s.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:E,error:v})}return!1},O.listenerCount=function(E){return this._emitter.listenerCount(E)},O.destroy=function(){d.logger.log("destroy"),this.trigger(s.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(E){return E.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(E){return E.destroy()}),this.coreComponents.length=0},O.attachMedia=function(E){d.logger.log("attachMedia"),this._media=E,this.trigger(s.Events.MEDIA_ATTACHING,{media:E})},O.detachMedia=function(){d.logger.log("detachMedia"),this.trigger(s.Events.MEDIA_DETACHING,void 0),this._media=null},O.loadSource=function(E){this.stopLoad();var b=this.media,v=this.url,u=this.url=H.buildAbsoluteURL(self.location.href,E,{alwaysNormalize:!0});d.logger.log("loadSource:"+u),b&&v&&v!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(b)),this.trigger(s.Events.MANIFEST_LOADING,{url:E})},O.startLoad=function(E){E===void 0&&(E=-1),d.logger.log("startLoad("+E+")"),this.networkControllers.forEach(function(b){b.startLoad(E)})},O.stopLoad=function(){d.logger.log("stopLoad"),this.networkControllers.forEach(function(E){E.stopLoad()})},O.swapAudioCodec=function(){d.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},O.recoverMediaError=function(){d.logger.log("recoverMediaError");var E=this._media;this.detachMedia(),E&&this.attachMedia(E)},O.removeLevel=function(E,b){b===void 0&&(b=0),this.levelController.removeLevel(E,b)},R(T,[{key:"levels",get:function(){var E=this.levelController.levels;return E||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(E){d.logger.log("set currentLevel:"+E),this.loadLevel=E,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(E){d.logger.log("set nextLevel:"+E),this.levelController.manualLevel=E,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(E){d.logger.log("set loadLevel:"+E),this.levelController.manualLevel=E}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(E){this.levelController.nextLoadLevel=E}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(E){d.logger.log("set firstLevel:"+E),this.levelController.firstLevel=E}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(E){d.logger.log("set startLevel:"+E),E!==-1&&(E=Math.max(E,this.minAutoLevel)),this.levelController.startLevel=E}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(E){var b=!!E;b!==this.config.capLevelToPlayerSize&&(b?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=b)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(E){this._autoLevelCapping!==E&&(d.logger.log("set autoLevelCapping:"+E),this._autoLevelCapping=E)}},{key:"bandwidthEstimate",get:function(){var E=this.abrController.bwEstimator;return E?E.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var E=this.levels,b=this.config.minAutoBitrate;if(!E)return 0;for(var v=E.length,u=0;u<v;u++)if(E[u].maxBitrate>b)return u;return 0}},{key:"maxAutoLevel",get:function(){var E=this.levels,b=this.autoLevelCapping,v;return b===-1&&E&&E.length?v=E.length-1:v=b,v}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(E){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,E)}},{key:"audioTracks",get:function(){var E=this.audioTrackController;return E?E.audioTracks:[]}},{key:"audioTrack",get:function(){var E=this.audioTrackController;return E?E.audioTrack:-1},set:function(E){var b=this.audioTrackController;b&&(b.audioTrack=E)}},{key:"subtitleTracks",get:function(){var E=this.subtitleTrackController;return E?E.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var E=this.subtitleTrackController;return E?E.subtitleTrack:-1},set:function(E){var b=this.subtitleTrackController;b&&(b.subtitleTrack=E)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var E=this.subtitleTrackController;return E?E.subtitleDisplay:!1},set:function(E){var b=this.subtitleTrackController;b&&(b.subtitleDisplay=E)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(E){this.config.lowLatencyMode=E}},{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 s.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return T.defaultConfig?T.defaultConfig:a.hlsDefaultConfig},set:function(E){T.defaultConfig=E}}]),T}();x.defaultConfig=void 0},"./src/is-supported.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"isSupported",function(){return C}),I.d(V,"changeTypeSupported",function(){return B});var H=I("./src/utils/mediasource-helper.ts");function k(){return self.SourceBuffer||self.WebKitSourceBuffer}function C(){var U=Object(H.getMediaSource)();if(!U)return!1;var D=k(),L=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!D||D.prototype&&typeof D.prototype.appendBuffer=="function"&&typeof D.prototype.remove=="function";return!!L&&!!g}function B(){var U,D=k();return typeof(D==null||((U=D.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return d}),I.d(V,"LoadError",function(){return c});var H=I("./src/polyfills/number.ts"),k=I("./src/errors.ts");function C(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,g(o,s)}function B(o){var s=typeof Map=="function"?new Map:void 0;return B=function(h){if(h===null||!L(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof s!="undefined"){if(s.has(h))return s.get(h);s.set(h,R)}function R(){return U(h,arguments,p(this).constructor)}return R.prototype=Object.create(h.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),g(R,h)},B(o)}function U(o,s,l){return D()?U=Reflect.construct:U=function(R,x,T){var O=[null];O.push.apply(O,x);var S=Function.bind.apply(R,O),E=new S;return T&&g(E,T.prototype),E},U.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(o){return!1}}function L(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function g(o,s){return g=Object.setPrototypeOf||function(h,R){return h.__proto__=R,h},g(o,s)}function p(o){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},p(o)}var f=Math.pow(2,17),d=function(){function o(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var s=o.prototype;return s.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},s.abort=function(){this.loader&&this.loader.abort()},s.load=function(h,R){var x=this,T=h.url;if(!T)return Promise.reject(new c({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(T?"part list":"url")));this.abort();var O=this.config,S=O.fLoader,E=O.loader;return new Promise(function(b,v){x.loader&&x.loader.destroy();var u=x.loader=h.loader=S?new S(O):new E(O),_=a(h),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};h.stats=u.stats,u.load(_,m,{onSuccess:function(P,M,j,W){x.resetLoader(h,u),b({frag:h,part:null,payload:P.data,networkDetails:W})},onError:function(P,M,j){x.resetLoader(h,u),v(new c({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:P,networkDetails:j}))},onAbort:function(P,M,j){x.resetLoader(h,u),v(new c({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:j}))},onTimeout:function(P,M,j){x.resetLoader(h,u),v(new c({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:j}))},onProgress:function(P,M,j,W){R&&R({frag:h,part:null,payload:j,networkDetails:W})}})})},s.loadPart=function(h,R,x){var T=this;this.abort();var O=this.config,S=O.fLoader,E=O.loader;return new Promise(function(b,v){T.loader&&T.loader.destroy();var u=T.loader=h.loader=S?new S(O):new E(O),_=a(h,R),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};R.stats=u.stats,u.load(_,m,{onSuccess:function(P,M,j,W){T.resetLoader(h,u),T.updateStatsFromPart(h,R);var N={frag:h,part:R,payload:P.data,networkDetails:W};x(N),b(N)},onError:function(P,M,j){T.resetLoader(h,u),v(new c({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:R,response:P,networkDetails:j}))},onAbort:function(P,M,j){h.stats.aborted=R.stats.aborted,T.resetLoader(h,u),v(new c({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:R,networkDetails:j}))},onTimeout:function(P,M,j){T.resetLoader(h,u),v(new c({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:R,networkDetails:j}))}})})},s.updateStatsFromPart=function(h,R){var x=h.stats,T=R.stats,O=T.total;if(x.loaded+=T.loaded,O){var S=Math.round(h.duration/R.duration),E=Math.min(Math.round(x.loaded/O),S),b=S-E,v=b*Math.round(x.loaded/E);x.total=x.loaded+v}else x.total=Math.max(x.loaded,x.total);var u=x.loading,_=T.loading;u.start?u.first+=_.first-_.start:(u.start=_.start,u.first=_.first),u.end=_.end},s.resetLoader=function(h,R){h.loader=null,this.loader===R&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),R.destroy()},o}();function a(o,s){s===void 0&&(s=null);var l=s||o,h={frag:o,part:s,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},R=l.byteRangeStartOffset,x=l.byteRangeEndOffset;return Object(H.isFiniteNumber)(R)&&Object(H.isFiniteNumber)(x)&&(h.rangeStart=R,h.rangeEnd=x),h}var c=function(o){C(s,o);function s(l){for(var h,R=arguments.length,x=new Array(R>1?R-1:0),T=1;T<R;T++)x[T-1]=arguments[T];return h=o.call.apply(o,[this].concat(x))||this,h.data=void 0,h.data=l,h}return s}(B(Error))},"./src/loader/fragment.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"ElementaryStreamTypes",function(){return d}),I.d(V,"BaseSegment",function(){return a}),I.d(V,"Fragment",function(){return c}),I.d(V,"Part",function(){return o});var H=I("./src/polyfills/number.ts"),k=I("./node_modules/url-toolkit/src/url-toolkit.js"),C=I.n(k),B=I("./src/utils/logger.ts"),U=I("./src/loader/level-key.ts"),D=I("./src/loader/load-stats.ts");function L(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,g(s,l)}function g(s,l){return g=Object.setPrototypeOf||function(R,x){return R.__proto__=x,R},g(s,l)}function p(s,l){for(var h=0;h<l.length;h++){var R=l[h];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(s,R.key,R)}}function f(s,l,h){return l&&p(s.prototype,l),h&&p(s,h),s}var d;(function(s){s.AUDIO="audio",s.VIDEO="video",s.AUDIOVIDEO="audiovideo"})(d||(d={}));var a=function(){function s(h){var R;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(R={},R[d.AUDIO]=null,R[d.VIDEO]=null,R[d.AUDIOVIDEO]=null,R),this.baseurl=h}var l=s.prototype;return l.setByteRange=function(R,x){var T=R.split("@",2),O=[];T.length===1?O[0]=x?x.byteRangeEndOffset:0:O[0]=parseInt(T[1]),O[1]=parseInt(T[0])+O[0],this._byteRange=O},f(s,[{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(k.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(R){this._url=R}}]),s}(),c=function(s){L(l,s);function l(R,x){var T;return T=s.call(this,x)||this,T._decryptdata=null,T.rawProgramDateTime=null,T.programDateTime=null,T.tagList=[],T.duration=0,T.sn=0,T.levelkey=void 0,T.type=void 0,T.loader=null,T.level=-1,T.cc=0,T.startPTS=void 0,T.endPTS=void 0,T.appendedPTS=void 0,T.startDTS=void 0,T.endDTS=void 0,T.start=0,T.deltaPTS=void 0,T.maxStartPTS=void 0,T.minEndPTS=void 0,T.stats=new D.LoadStats,T.urlId=0,T.data=void 0,T.bitrateTest=!1,T.title=null,T.initSegment=null,T.type=R,T}var h=l.prototype;return h.createInitializationVector=function(x){for(var T=new Uint8Array(16),O=12;O<16;O++)T[O]=x>>8*(15-O)&255;return T},h.setDecryptDataFromLevelKey=function(x,T){var O=x;return(x==null?void 0:x.method)==="AES-128"&&x.uri&&!x.iv&&(O=U.LevelKey.fromURI(x.uri),O.method=x.method,O.iv=this.createInitializationVector(T),O.keyFormat="identity"),O},h.setElementaryStreamInfo=function(x,T,O,S,E,b){b===void 0&&(b=!1);var v=this.elementaryStreams,u=v[x];if(!u){v[x]={startPTS:T,endPTS:O,startDTS:S,endDTS:E,partial:b};return}u.startPTS=Math.min(u.startPTS,T),u.endPTS=Math.max(u.endPTS,O),u.startDTS=Math.min(u.startDTS,S),u.endDTS=Math.max(u.endDTS,E)},h.clearElementaryStreamInfo=function(){var x=this.elementaryStreams;x[d.AUDIO]=null,x[d.VIDEO]=null,x[d.AUDIOVIDEO]=null},f(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var x=this.sn;typeof x!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),x=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,x)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var x=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+x*1e3}},{key:"encrypted",get:function(){var x;return!!((x=this.decryptdata)!==null&&x!==void 0&&x.keyFormat&&this.decryptdata.uri)}}]),l}(a),o=function(s){L(l,s);function l(h,R,x,T,O){var S;S=s.call(this,x)||this,S.fragOffset=0,S.duration=0,S.gap=!1,S.independent=!1,S.relurl=void 0,S.fragment=void 0,S.index=void 0,S.stats=new D.LoadStats,S.duration=h.decimalFloatingPoint("DURATION"),S.gap=h.bool("GAP"),S.independent=h.bool("INDEPENDENT"),S.relurl=h.enumeratedString("URI"),S.fragment=R,S.index=T;var E=h.enumeratedString("BYTERANGE");return E&&S.setByteRange(E,O),O&&(S.fragOffset=O.fragOffset+O.duration),S}return f(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var R=this.elementaryStreams;return!!(R.audio||R.video||R.audiovideo)}}]),l}(a)},"./src/loader/key-loader.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return B});var H=I("./src/events.ts"),k=I("./src/errors.ts"),C=I("./src/utils/logger.ts"),B=function(){function U(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var D=U.prototype;return D._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},D._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},D.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var p=this.loaders[g];p&&p.destroy()}this.loaders={}},D.onKeyLoading=function(g,p){var f=p.frag,d=f.type,a=this.loaders[d];if(!f.decryptdata){C.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var c=f.decryptdata.uri;if(c!==this.decrypturl||this.decryptkey===null){var o=this.hls.config;if(a&&(C.logger.warn("abort previous key loader for type:"+d),a.abort()),!c){C.logger.warn("key uri is falsy");return}var s=o.loader,l=f.loader=this.loaders[d]=new s(o);this.decrypturl=c,this.decryptkey=null;var h={url:c,frag:f,responseType:"arraybuffer"},R={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:0},x={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(h,R,x)}else this.decryptkey&&(f.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:f}))},D.loadsuccess=function(g,p,f){var d=f.frag;if(!d.decryptdata){C.logger.error("after key load, decryptdata unset");return}this.decryptkey=d.decryptdata.key=new Uint8Array(g.data),d.loader=null,delete this.loaders[d.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:d})},D.loaderror=function(g,p){var f=p.frag,d=f.loader;d&&d.abort(),delete this.loaders[f.type],this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:f,response:g})},D.loadtimeout=function(g,p){var f=p.frag,d=f.loader;d&&d.abort(),delete this.loaders[f.type],this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:f})},U}()},"./src/loader/level-details.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"LevelDetails",function(){return U});var H=I("./src/polyfills/number.ts");function k(D,L){for(var g=0;g<L.length;g++){var p=L[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(D,p.key,p)}}function C(D,L,g){return L&&k(D.prototype,L),g&&k(D,g),D}var B=10,U=function(){function D(g){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=g}var L=D.prototype;return L.reloaded=function(p){if(!p){this.advanced=!0,this.updated=!0;return}var f=this.lastPartSn-p.lastPartSn,d=this.lastPartIndex-p.lastPartIndex;this.updated=this.endSN!==p.endSN||!!d||!!f,this.advanced=this.endSN>p.endSN||f>0||f===0&&d>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},C(D,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var p=this.driftEndTime-this.driftStartTime;if(p>0){var f=this.driftEnd-this.driftStart;return f*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}}]),D}()},"./src/loader/level-key.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"LevelKey",function(){return U});var H=I("./node_modules/url-toolkit/src/url-toolkit.js"),k=I.n(H);function C(D,L){for(var g=0;g<L.length;g++){var p=L[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(D,p.key,p)}}function B(D,L,g){return L&&C(D.prototype,L),g&&C(D,g),D}var U=function(){D.fromURL=function(g,p){return new D(g,p)},D.fromURI=function(g){return new D(g)};function D(L,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(H.buildAbsoluteURL)(L,g,{alwaysNormalize:!0}):this._uri=L}return B(D,[{key:"uri",get:function(){return this._uri}}]),D}()},"./src/loader/load-stats.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"LoadStats",function(){return H});var H=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(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return l});var H=I("./src/polyfills/number.ts"),k=I("./node_modules/url-toolkit/src/url-toolkit.js"),C=I.n(k),B=I("./src/loader/fragment.ts"),U=I("./src/loader/level-details.ts"),D=I("./src/loader/level-key.ts"),L=I("./src/utils/attr-list.ts"),g=I("./src/utils/logger.ts"),p=I("./src/utils/codecs.ts"),f=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,d=/#EXT-X-MEDIA:(.*)/g,a=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),c=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("|")),o=/\.(mp4|m4s|m4v|m4a)$/i;function s(O){var S,E;return o.test((S=(E=k.parseURL(O))===null||E===void 0?void 0:E.path)!=null?S:"")}var l=function(){function O(){}return O.findGroup=function(E,b){for(var v=0;v<E.length;v++){var u=E[v];if(u.id===b)return u}},O.convertAVC1ToAVCOTI=function(E){var b=E.split(".");if(b.length>2){var v=b.shift()+".";return v+=parseInt(b.shift()).toString(16),v+=("000"+parseInt(b.shift()).toString(16)).substr(-4),v}return E},O.resolve=function(E,b){return k.buildAbsoluteURL(b,E,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(E,b){var v=[],u={},_=!1;f.lastIndex=0;for(var m;(m=f.exec(E))!=null;)if(m[1]){var y=new L.AttrList(m[1]),P={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:O.resolve(m[2],b)},M=y.decimalResolution("RESOLUTION");M&&(P.width=M.width,P.height=M.height),h((y.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=O.convertAVC1ToAVCOTI(P.videoCodec)),v.push(P)}else if(m[3]){var j=new L.AttrList(m[3]);j["DATA-ID"]&&(_=!0,u[j["DATA-ID"]]=j)}return{levels:v,sessionData:_?u:null}},O.parseMasterPlaylistMedia=function(E,b,v,u){u===void 0&&(u=[]);var _,m=[],y=0;for(d.lastIndex=0;(_=d.exec(E))!==null;){var P=new L.AttrList(_[1]);if(P.TYPE===v){var M={attrs:P,bitrate:0,id:y++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:v,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?O.resolve(P.URI,b):""};if(u.length){var j=O.findGroup(u,M.groupId)||u[0];R(M,j,"audioCodec"),R(M,j,"textCodec")}m.push(M)}}return m},O.parseLevelPlaylist=function(E,b,v,u,_){var m=new U.LevelDetails(b),y=m.fragments,P=null,M=0,j=0,W=0,N=0,w=null,G=new B.Fragment(u,b),J,Z,ae,_e=-1,ce=!1;for(a.lastIndex=0,m.m3u8=E;(J=a.exec(E))!==null;){ce&&(ce=!1,G=new B.Fragment(u,b),G.start=W,G.sn=M,G.cc=N,G.level=v,P&&(G.initSegment=P,G.rawProgramDateTime=P.rawProgramDateTime));var he=J[1];if(he){G.duration=parseFloat(he);var fe=(" "+J[2]).slice(1);G.title=fe||null,G.tagList.push(fe?["INF",he,fe]:["INF",he])}else if(J[3])Object(H.isFiniteNumber)(G.duration)&&(G.start=W,ae&&(G.levelkey=ae),G.sn=M,G.level=v,G.cc=N,G.urlId=_,y.push(G),G.relurl=(" "+J[3]).slice(1),T(G,w),w=G,W+=G.duration,M++,j=0,ce=!0);else if(J[4]){var pe=(" "+J[4]).slice(1);w?G.setByteRange(pe,w):G.setByteRange(pe)}else if(J[5])G.rawProgramDateTime=(" "+J[5]).slice(1),G.tagList.push(["PROGRAM-DATE-TIME",G.rawProgramDateTime]),_e===-1&&(_e=y.length);else{if(J=J[0].match(c),!J){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(Z=1;Z<J.length&&!(typeof J[Z]!="undefined");Z++);var se=(" "+J[Z]).slice(1),de=(" "+J[Z+1]).slice(1),Ee=J[Z+2]?(" "+J[Z+2]).slice(1):"";switch(se){case"PLAYLIST-TYPE":m.type=de.toUpperCase();break;case"MEDIA-SEQUENCE":M=m.startSN=parseInt(de);break;case"SKIP":{var Pe=new L.AttrList(de),Se=Pe.decimalInteger("SKIPPED-SEGMENTS");if(Object(H.isFiniteNumber)(Se)){m.skippedSegments=Se;for(var Je=Se;Je--;)y.unshift(null);M+=Se}var qe=Pe.enumeratedString("RECENTLY-REMOVED-DATERANGES");qe&&(m.recentlyRemovedDateranges=qe.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(de);break;case"VERSION":m.version=parseInt(de);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(de||Ee)&&G.tagList.push(Ee?[de,Ee]:[de]);break;case"DIS":N++;case"GAP":G.tagList.push([se]);break;case"BITRATE":G.tagList.push([se,de]);break;case"DISCONTINUITY-SEQ":N=parseInt(de);break;case"KEY":{var Ae,we=new L.AttrList(de),De=we.enumeratedString("METHOD"),Xe=we.URI,We=we.hexadecimalInteger("IV"),Ce=we.enumeratedString("KEYFORMATVERSIONS"),Oe=we.enumeratedString("KEYID"),et=(Ae=we.enumeratedString("KEYFORMAT"))!=null?Ae:"identity",Me=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Me.indexOf(et)>-1){g.logger.warn("Keyformat "+et+" is not supported from the manifest");continue}else if(et!=="identity")continue;De&&(ae=D.LevelKey.fromURL(b,Xe),Xe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(De)>=0&&(ae.method=De,ae.keyFormat=et,Oe&&(ae.keyID=Oe),Ce&&(ae.keyFormatVersions=Ce),ae.iv=We));break}case"START":{var Le=new L.AttrList(de),Ue=Le.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(Ue)&&(m.startTimeOffset=Ue);break}case"MAP":{var Ge=new L.AttrList(de);G.relurl=Ge.URI,Ge.BYTERANGE&&G.setByteRange(Ge.BYTERANGE),G.level=v,G.sn="initSegment",ae&&(G.levelkey=ae),G.initSegment=null,P=G,ce=!0;break}case"SERVER-CONTROL":{var Fe=new L.AttrList(de);m.canBlockReload=Fe.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Fe.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Fe.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Fe.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Fe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ze=new L.AttrList(de);m.partTarget=ze.decimalFloatingPoint("PART-TARGET");break}case"PART":{var be=m.partList;be||(be=m.partList=[]);var Ke=j>0?be[be.length-1]:void 0,He=j++,ve=new B.Part(new L.AttrList(de),G,b,He,Ke);be.push(ve),G.duration+=ve.duration;break}case"PRELOAD-HINT":{var Re=new L.AttrList(de);m.preloadHint=Re;break}case"RENDITION-REPORT":{var ue=new L.AttrList(de);m.renditionReports=m.renditionReports||[],m.renditionReports.push(ue);break}default:g.logger.warn("line parsed but not handled: "+J);break}}}w&&!w.relurl?(y.pop(),W-=w.duration,m.partList&&(m.fragmentHint=w)):m.partList&&(T(G,w),G.cc=N,m.fragmentHint=G);var ie=y.length,te=y[0],$=y[ie-1];if(W+=m.skippedSegments*m.targetduration,W>0&&ie&&$){m.averagetargetduration=W/ie;var X=$.sn;m.endSN=X!=="initSegment"?X:0,te&&(m.startCC=te.cc,te.initSegment||m.fragments.every(function(q){return q.relurl&&s(q.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),G=new B.Fragment(u,b),G.relurl=$.relurl,G.level=v,G.sn="initSegment",te.initSegment=G,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(W+=m.fragmentHint.duration),m.totalduration=W,m.endCC=N,_e>0&&x(y,_e),m},O}();function h(O,S){["video","audio","text"].forEach(function(E){var b=O.filter(function(u){return Object(p.isCodecType)(u,E)});if(b.length){var v=b.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});S[E+"Codec"]=v.length>0?v[0]:b[0],O=O.filter(function(u){return b.indexOf(u)===-1})}}),S.unknownCodecs=O}function R(O,S,E){var b=S[E];b&&(O[E]=b)}function x(O,S){for(var E=O[S],b=S;b--;){var v=O[b];if(!v)return;v.programDateTime=E.programDateTime-v.duration*1e3,E=v}}function T(O,S){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):S!=null&&S.programDateTime&&(O.programDateTime=S.endProgramDateTime),Object(H.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/polyfills/number.ts"),k=I("./src/events.ts"),C=I("./src/errors.ts"),B=I("./src/utils/logger.ts"),U=I("./src/utils/mp4-tools.ts"),D=I("./src/loader/m3u8-parser.ts"),L=I("./src/types/loader.ts"),g=I("./src/utils/attr-list.ts");function p(a){var c=a.type;switch(c){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function f(a,c){var o=a.url;return(o===void 0||o.indexOf("data:")===0)&&(o=c.url),o}var d=function(){function a(o){this.hls=void 0,this.loaders=Object.create(null),this.hls=o,this.registerListeners()}var c=a.prototype;return c.registerListeners=function(){var s=this.hls;s.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(k.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.on(k.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.unregisterListeners=function(){var s=this.hls;s.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(k.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.off(k.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.createInternalLoader=function(s){var l=this.hls.config,h=l.pLoader,R=l.loader,x=h||R,T=new x(l);return s.loader=T,this.loaders[s.type]=T,T},c.getInternalLoader=function(s){return this.loaders[s.type]},c.resetInternalLoader=function(s){this.loaders[s]&&delete this.loaders[s]},c.destroyInternalLoaders=function(){for(var s in this.loaders){var l=this.loaders[s];l&&l.destroy(),this.resetInternalLoader(s)}},c.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},c.onManifestLoading=function(s,l){var h=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},c.onLevelLoading=function(s,l){var h=l.id,R=l.level,x=l.url,T=l.deliveryDirectives;this.load({id:h,groupId:null,level:R,responseType:"text",type:L.PlaylistContextType.LEVEL,url:x,deliveryDirectives:T})},c.onAudioTrackLoading=function(s,l){var h=l.id,R=l.groupId,x=l.url,T=l.deliveryDirectives;this.load({id:h,groupId:R,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:x,deliveryDirectives:T})},c.onSubtitleTrackLoading=function(s,l){var h=l.id,R=l.groupId,x=l.url,T=l.deliveryDirectives;this.load({id:h,groupId:R,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:x,deliveryDirectives:T})},c.load=function(s){var l,h=this.hls.config,R=this.getInternalLoader(s);if(R){var x=R.context;if(x&&x.url===s.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+s.type),R.abort()}var T,O,S,E;switch(s.type){case L.PlaylistContextType.MANIFEST:T=h.manifestLoadingMaxRetry,O=h.manifestLoadingTimeOut,S=h.manifestLoadingRetryDelay,E=h.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:T=0,O=h.levelLoadingTimeOut;break;default:T=h.levelLoadingMaxRetry,O=h.levelLoadingTimeOut,S=h.levelLoadingRetryDelay,E=h.levelLoadingMaxRetryTimeout;break}if(R=this.createInternalLoader(s),(l=s.deliveryDirectives)!==null&&l!==void 0&&l.part){var b;if(s.type===L.PlaylistContextType.LEVEL&&s.level!==null?b=this.hls.levels[s.level].details:s.type===L.PlaylistContextType.AUDIO_TRACK&&s.id!==null?b=this.hls.audioTracks[s.id].details:s.type===L.PlaylistContextType.SUBTITLE_TRACK&&s.id!==null&&(b=this.hls.subtitleTracks[s.id].details),b){var v=b.partTarget,u=b.targetduration;v&&u&&(O=Math.min(Math.max(v*3,u*.8)*1e3,O))}}var _={timeout:O,maxRetry:T,retryDelay:S,maxRetryDelay:E,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};R.load(s,_,m)},c.loadsuccess=function(s,l,h,R){if(R===void 0&&(R=null),h.isSidxRequest){this.handleSidxRequest(s,h),this.handlePlaylistLoaded(s,l,h,R);return}this.resetInternalLoader(h.type);var x=s.data;if(x.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(s,h,"no EXTM3U delimiter",R);return}l.parsing.start=performance.now(),x.indexOf("#EXTINF:")>0||x.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(s,l,h,R):this.handleMasterPlaylist(s,l,h,R)},c.loaderror=function(s,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!1,s)},c.loadtimeout=function(s,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!0)},c.handleMasterPlaylist=function(s,l,h,R){var x=this.hls,T=s.data,O=f(s,h),S=D.default.parseMasterPlaylist(T,O),E=S.levels,b=S.sessionData;if(!E.length){this.handleManifestParsingError(s,h,"no level found in manifest",R);return}var v=E.map(function(M){return{id:M.attrs.AUDIO,audioCodec:M.audioCodec}}),u=E.map(function(M){return{id:M.attrs.SUBTITLES,textCodec:M.textCodec}}),_=D.default.parseMasterPlaylistMedia(T,O,"AUDIO",v),m=D.default.parseMasterPlaylistMedia(T,O,"SUBTITLES",u),y=D.default.parseMasterPlaylistMedia(T,O,"CLOSED-CAPTIONS");if(_.length){var P=_.some(function(M){return!M.url});!P&&E[0].audioCodec&&!E[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),_.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}x.trigger(k.Events.MANIFEST_LOADED,{levels:E,audioTracks:_,subtitles:m,captions:y,url:O,stats:l,networkDetails:R,sessionData:b})},c.handleTrackOrLevelPlaylist=function(s,l,h,R){var x=this.hls,T=h.id,O=h.level,S=h.type,E=f(s,h),b=Object(H.isFiniteNumber)(T)?T:0,v=Object(H.isFiniteNumber)(O)?O:b,u=p(h),_=D.default.parseLevelPlaylist(s.data,E,v,u,b);if(!_.fragments.length){x.trigger(k.Events.ERROR,{type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:E,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(S===L.PlaylistContextType.MANIFEST){var m={attrs:new g.AttrList({}),bitrate:0,details:_,name:"",url:E};x.trigger(k.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:E,stats:l,networkDetails:R,sessionData:null})}if(l.parsing.end=performance.now(),_.needSidxRanges){var y,P=(y=_.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:P,isSidxRequest:!0,type:S,level:O,levelDetails:_,id:T,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=_,this.handlePlaylistLoaded(s,l,h,R)},c.handleSidxRequest=function(s,l){var h=Object(U.parseSegmentIndex)(new Uint8Array(s.data));if(!h)return;var R=h.references,x=l.levelDetails;R.forEach(function(T,O){var S=T.info,E=x.fragments[O];E.byteRange.length===0&&E.setByteRange(String(1+S.end-S.start)+"@"+String(S.start)),E.initSegment&&E.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},c.handleManifestParsingError=function(s,l,h,R){this.hls.trigger(k.Events.ERROR,{type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===L.PlaylistContextType.MANIFEST,url:s.url,reason:h,response:s,context:l,networkDetails:R})},c.handleNetworkError=function(s,l,h,R){h===void 0&&(h=!1),B.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+s.type+" level: "+s.level+" id: "+s.id+' group-id: "'+s.groupId+'"');var x=C.ErrorDetails.UNKNOWN,T=!1,O=this.getInternalLoader(s);switch(s.type){case L.PlaylistContextType.MANIFEST:x=h?C.ErrorDetails.MANIFEST_LOAD_TIMEOUT:C.ErrorDetails.MANIFEST_LOAD_ERROR,T=!0;break;case L.PlaylistContextType.LEVEL:x=h?C.ErrorDetails.LEVEL_LOAD_TIMEOUT:C.ErrorDetails.LEVEL_LOAD_ERROR,T=!1;break;case L.PlaylistContextType.AUDIO_TRACK:x=h?C.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:C.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:x=h?C.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:C.ErrorDetails.SUBTITLE_LOAD_ERROR,T=!1;break}O&&this.resetInternalLoader(s.type);var S={type:C.ErrorTypes.NETWORK_ERROR,details:x,fatal:T,url:s.url,loader:O,context:s,networkDetails:l};R&&(S.response=R),this.hls.trigger(k.Events.ERROR,S)},c.handlePlaylistLoaded=function(s,l,h,R){var x=h.type,T=h.level,O=h.id,S=h.groupId,E=h.loader,b=h.levelDetails,v=h.deliveryDirectives;if(!(b!=null&&b.targetduration)){this.handleManifestParsingError(s,h,"invalid target duration",R);return}if(!E)return;b.live&&(E.getCacheAge&&(b.ageHeader=E.getCacheAge()||0),(!E.getCacheAge||isNaN(b.ageHeader))&&(b.ageHeader=0));switch(x){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(k.Events.LEVEL_LOADED,{details:b,level:T||0,id:O||0,stats:l,networkDetails:R,deliveryDirectives:v});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(k.Events.AUDIO_TRACK_LOADED,{details:b,id:O||0,groupId:S||"",stats:l,networkDetails:R,deliveryDirectives:v});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(k.Events.SUBTITLE_TRACK_LOADED,{details:b,id:O||0,groupId:S||"",stats:l,networkDetails:R,deliveryDirectives:v});break}},a}();V.default=d},"./src/polyfills/number.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"isFiniteNumber",function(){return H}),I.d(V,"MAX_SAFE_INTEGER",function(){return k});var H=Number.isFinite||function(C){return typeof C=="number"&&isFinite(C)},k=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ee,V,I){"use strict";I.r(V);var H=function(){function k(){}return k.getSilentFrame=function(B,U){switch(B){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(U===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(U===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},k}();V.default=H},"./src/remux/mp4-generator.ts":function(ee,V,I){"use strict";I.r(V);var H=Math.pow(2,32)-1,k=function(){function C(){}return C.init=function(){C.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var U;for(U in C.types)C.types.hasOwnProperty(U)&&(C.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var D=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),L=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]);C.HDLR_TYPES={video:D,audio:L};var g=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]);C.STTS=C.STSC=C.STCO=p,C.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),C.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),C.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),C.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var f=new Uint8Array([105,115,111,109]),d=new Uint8Array([97,118,99,49]),a=new Uint8Array([0,0,0,1]);C.FTYP=C.box(C.types.ftyp,f,a,f,d),C.DINF=C.box(C.types.dinf,C.box(C.types.dref,g))},C.box=function(U){for(var D=8,L=arguments.length,g=new Array(L>1?L-1:0),p=1;p<L;p++)g[p-1]=arguments[p];for(var f=g.length,d=f;f--;)D+=g[f].byteLength;var a=new Uint8Array(D);for(a[0]=D>>24&255,a[1]=D>>16&255,a[2]=D>>8&255,a[3]=D&255,a.set(U,4),f=0,D=8;f<d;f++)a.set(g[f],D),D+=g[f].byteLength;return a},C.hdlr=function(U){return C.box(C.types.hdlr,C.HDLR_TYPES[U])},C.mdat=function(U){return C.box(C.types.mdat,U)},C.mdhd=function(U,D){D*=U;var L=Math.floor(D/(H+1)),g=Math.floor(D%(H+1));return C.box(C.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,L>>24,L>>16&255,L>>8&255,L&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},C.mdia=function(U){return C.box(C.types.mdia,C.mdhd(U.timescale,U.duration),C.hdlr(U.type),C.minf(U))},C.mfhd=function(U){return C.box(C.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},C.minf=function(U){return U.type==="audio"?C.box(C.types.minf,C.box(C.types.smhd,C.SMHD),C.DINF,C.stbl(U)):C.box(C.types.minf,C.box(C.types.vmhd,C.VMHD),C.DINF,C.stbl(U))},C.moof=function(U,D,L){return C.box(C.types.moof,C.mfhd(U),C.traf(L,D))},C.moov=function(U){for(var D=U.length,L=[];D--;)L[D]=C.trak(U[D]);return C.box.apply(null,[C.types.moov,C.mvhd(U[0].timescale,U[0].duration)].concat(L).concat(C.mvex(U)))},C.mvex=function(U){for(var D=U.length,L=[];D--;)L[D]=C.trex(U[D]);return C.box.apply(null,[C.types.mvex].concat(L))},C.mvhd=function(U,D){D*=U;var L=Math.floor(D/(H+1)),g=Math.floor(D%(H+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,L>>24,L>>16&255,L>>8&255,L&255,g>>24,g>>16&255,g>>8&255,g&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return C.box(C.types.mvhd,p)},C.sdtp=function(U){var D=U.samples||[],L=new Uint8Array(4+D.length),g,p;for(g=0;g<D.length;g++)p=D[g].flags,L[g+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return C.box(C.types.sdtp,L)},C.stbl=function(U){return C.box(C.types.stbl,C.stsd(U),C.box(C.types.stts,C.STTS),C.box(C.types.stsc,C.STSC),C.box(C.types.stsz,C.STSZ),C.box(C.types.stco,C.STCO))},C.avc1=function(U){var D=[],L=[],g,p,f;for(g=0;g<U.sps.length;g++)p=U.sps[g],f=p.byteLength,D.push(f>>>8&255),D.push(f&255),D=D.concat(Array.prototype.slice.call(p));for(g=0;g<U.pps.length;g++)p=U.pps[g],f=p.byteLength,L.push(f>>>8&255),L.push(f&255),L=L.concat(Array.prototype.slice.call(p));var d=C.box(C.types.avcC,new Uint8Array([1,D[3],D[4],D[5],252|3,224|U.sps.length].concat(D).concat([U.pps.length]).concat(L))),a=U.width,c=U.height,o=U.pixelRatio[0],s=U.pixelRatio[1];return C.box(C.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,a>>8&255,a&255,c>>8&255,c&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]),d,C.box(C.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),C.box(C.types.pasp,new Uint8Array([o>>24,o>>16&255,o>>8&255,o&255,s>>24,s>>16&255,s>>8&255,s&255])))},C.esds=function(U){var D=U.config.length;return new Uint8Array([0,0,0,0,3,23+D,0,1,0,4,15+D,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([D]).concat(U.config).concat([6,1,2]))},C.mp4a=function(U){var D=U.samplerate;return C.box(C.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]),C.box(C.types.esds,C.esds(U)))},C.mp3=function(U){var D=U.samplerate;return C.box(C.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]))},C.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?C.box(C.types.stsd,C.STSD,C.mp3(U)):C.box(C.types.stsd,C.STSD,C.mp4a(U)):C.box(C.types.stsd,C.STSD,C.avc1(U))},C.tkhd=function(U){var D=U.id,L=U.duration*U.timescale,g=U.width,p=U.height,f=Math.floor(L/(H+1)),d=Math.floor(L%(H+1));return C.box(C.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,D>>24&255,D>>16&255,D>>8&255,D&255,0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,d>>24,d>>16&255,d>>8&255,d&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,g>>8&255,g&255,0,0,p>>8&255,p&255,0,0]))},C.traf=function(U,D){var L=C.sdtp(U),g=U.id,p=Math.floor(D/(H+1)),f=Math.floor(D%(H+1));return C.box(C.types.traf,C.box(C.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),C.box(C.types.tfdt,new Uint8Array([1,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,f>>24,f>>16&255,f>>8&255,f&255])),C.trun(U,L.length+16+20+8+16+8+8),L)},C.trak=function(U){return U.duration=U.duration||4294967295,C.box(C.types.trak,C.tkhd(U),C.mdia(U))},C.trex=function(U){var D=U.id;return C.box(C.types.trex,new Uint8Array([0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},C.trun=function(U,D){var L=U.samples||[],g=L.length,p=12+16*g,f=new Uint8Array(p),d,a,c,o,s,l;for(D+=8+p,f.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255],0),d=0;d<g;d++)a=L[d],c=a.duration,o=a.size,s=a.flags,l=a.cts,f.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,s.degradPrio&240<<8,s.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*d);return C.box(C.types.trun,f)},C.initSegment=function(U){C.types||C.init();var D=C.moov(U),L=new Uint8Array(C.FTYP.byteLength+D.byteLength);return L.set(C.FTYP),L.set(D,C.FTYP.byteLength),L},C}();k.types=void 0,k.HDLR_TYPES=void 0,k.STTS=void 0,k.STSC=void 0,k.STCO=void 0,k.STSZ=void 0,k.VMHD=void 0,k.SMHD=void 0,k.STSD=void 0,k.FTYP=void 0,k.DINF=void 0,V.default=k},"./src/remux/mp4-remuxer.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return l}),I.d(V,"normalizePts",function(){return h});var H=I("./src/polyfills/number.ts"),k=I("./src/remux/aac-helper.ts"),C=I("./src/remux/mp4-generator.ts"),B=I("./src/events.ts"),U=I("./src/errors.ts"),D=I("./src/utils/logger.ts"),L=I("./src/types/loader.ts"),g=I("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(O){for(var S=1;S<arguments.length;S++){var E=arguments[S];for(var b in E)Object.prototype.hasOwnProperty.call(E,b)&&(O[b]=E[b])}return O},p.apply(this,arguments)}var f=10*1e3,d=1024,a=1152,c=null,o=null,s=!1,l=function(){function O(E,b,v,u){if(u===void 0&&(u=""),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=E,this.config=b,this.typeSupported=v,this.ISGenerated=!1,c===null){var _=navigator.userAgent||"",m=_.match(/Chrome\/(\d+)/i);c=m?parseInt(m[1]):0}if(o===null){var y=navigator.userAgent.match(/Safari\/(\d+)/i);o=y?parseInt(y[1]):0}s=!!c&&c<75||!!o&&o<600}var S=O.prototype;return S.destroy=function(){},S.resetTimeStamp=function(b){D.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=b},S.resetNextTimestamp=function(){D.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},S.resetInitSegment=function(){D.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},S.getVideoStartPts=function(b){var v=!1,u=b.reduce(function(_,m){var y=m.pts-_;return y<-4294967296?(v=!0,h(_,m.pts)):y>0?_:m.pts},b[0].pts);return v&&D.logger.debug("PTS rollover detected"),u},S.remux=function(b,v,u,_,m,y,P,M){var j,W,N,w,G,J,Z=m,ae=m,_e=b.pid>-1,ce=v.pid>-1,he=v.samples.length,fe=b.samples.length>0,pe=he>1,se=(!_e||fe)&&(!ce||pe)||this.ISGenerated||P;if(se){this.ISGenerated||(N=this.generateIS(b,v,m));var de=this.isVideoContiguous,Ee=-1;if(pe&&(Ee=R(v.samples),!de&&this.config.forceKeyFrameOnDiscontinuity))if(J=!0,Ee>0){D.logger.warn("[mp4-remuxer]: Dropped "+Ee+" out of "+he+" video samples due to a missing keyframe");var Pe=this.getVideoStartPts(v.samples);v.samples=v.samples.slice(Ee),v.dropped+=Ee,ae+=(v.samples[0].pts-Pe)/(v.timescale||9e4)}else Ee===-1&&(D.logger.warn("[mp4-remuxer]: No keyframe found out of "+he+" video samples"),J=!1);if(this.ISGenerated){if(fe&&pe){var Se=this.getVideoStartPts(v.samples),Je=h(b.samples[0].pts,Se)-Se,qe=Je/v.inputTimeScale;Z+=Math.max(0,qe),ae+=Math.max(0,-qe)}if(fe){if(b.samplerate||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),N=this.generateIS(b,v,m)),W=this.remuxAudio(b,Z,this.isAudioContiguous,y,ce||pe||M===L.PlaylistLevelType.AUDIO?ae:void 0),pe){var Ae=W?W.endPTS-W.startPTS:0;v.inputTimeScale||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),N=this.generateIS(b,v,m)),j=this.remuxVideo(v,ae,de,Ae)}}else pe&&(j=this.remuxVideo(v,ae,de,0));j&&(j.firstKeyFrame=Ee,j.independent=Ee!==-1)}}return this.ISGenerated&&(u.samples.length&&(G=this.remuxID3(u,m)),_.samples.length&&(w=this.remuxText(_,m))),{audio:W,video:j,initSegment:N,independent:J,text:w,id3:G}},S.generateIS=function(b,v,u){var _=b.samples,m=v.samples,y=this.typeSupported,P={},M=!Object(H.isFiniteNumber)(this._initPTS),j="audio/mp4",W,N,w;if(M&&(W=N=Infinity),b.config&&_.length&&(b.timescale=b.samplerate,b.isAAC||(y.mpeg?(j="audio/mpeg",b.codec=""):y.mp3&&(b.codec="mp3")),P.audio={id:"audio",container:j,codec:b.codec,initSegment:!b.isAAC&&y.mpeg?new Uint8Array(0):C.default.initSegment([b]),metadata:{channelCount:b.channelCount}},M&&(w=b.inputTimeScale,W=N=_[0].pts-Math.round(w*u))),v.sps&&v.pps&&m.length&&(v.timescale=v.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:v.codec,initSegment:C.default.initSegment([v]),metadata:{width:v.width,height:v.height}},M)){w=v.inputTimeScale;var G=this.getVideoStartPts(m),J=Math.round(w*u);N=Math.min(N,h(m[0].dts,G)-J),W=Math.min(W,G-J)}if(Object.keys(P).length)return this.ISGenerated=!0,M&&(this._initPTS=W,this._initDTS=N),{tracks:P,initPTS:W,timescale:w}},S.remuxVideo=function(b,v,u,_){var m=b.inputTimeScale,y=b.samples,P=[],M=y.length,j=this._initPTS,W=this.nextAvcDts,N=8,w,G,J,Z=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,_e=0,ce=!1;if(!u||W===null){var he=v*m,fe=y[0].pts-h(y[0].dts,y[0].pts);W=he-fe}for(var pe=0;pe<M;pe++){var se=y[pe];if(se.pts=h(se.pts-j,W),se.dts=h(se.dts-j,W),se.dts>se.pts){var de=9e4*.2;_e=Math.max(Math.min(_e,se.pts-se.dts),-1*de)}se.dts<y[pe>0?pe-1:pe].dts&&(ce=!0)}ce&&y.sort(function(xt,ht){var Ve=xt.dts-ht.dts,mt=xt.pts-ht.pts;return Ve||mt}),G=y[0].dts,J=y[y.length-1].dts;var Ee=Math.round((J-G)/(M-1));if(_e<0){if(_e<Ee*-2){D.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-Ee,!0)+" ms");for(var Pe=_e,Se=0;Se<M;Se++)y[Se].dts=Pe=Math.max(Pe,y[Se].pts-Ee),y[Se].pts=Math.max(Pe,y[Se].pts)}else{D.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(_e,!0)+" ms to overcome this issue");for(var Je=0;Je<M;Je++)y[Je].dts=y[Je].dts+_e}G=y[0].dts}if(u){var qe=G-W,Ae=qe>Ee,we=qe<-1;if(Ae||we){Ae?D.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(qe,!0)+" ms ("+qe+"dts) hole between fragments detected, filling it"):D.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-qe,!0)+" ms ("+qe+"dts) overlapping between fragments detected"),G=W;var De=y[0].pts-qe;y[0].dts=G,y[0].pts=De,D.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(De,!0)+"/"+Object(g.toMsFromMpegTsClock)(G,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(qe,!0)+" ms")}}s&&(G=Math.max(0,G));for(var Xe=0,We=0,Ce=0;Ce<M;Ce++){for(var Oe=y[Ce],et=Oe.units,Me=et.length,Le=0,Ue=0;Ue<Me;Ue++)Le+=et[Ue].data.length;We+=Le,Xe+=Me,Oe.length=Le,Oe.dts=Math.max(Oe.dts,G),Oe.pts=Math.max(Oe.pts,Oe.dts,0),Z=Math.min(Oe.pts,Z),ae=Math.max(Oe.pts,ae)}J=y[M-1].dts;var Ge=We+4*Xe+8,Fe;try{Fe=new Uint8Array(Ge)}catch(xt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ge,reason:"fail allocating video mdat "+Ge});return}var ze=new DataView(Fe.buffer);ze.setUint32(0,Ge),Fe.set(C.default.types.mdat,4);for(var be=0;be<M;be++){for(var Ke=y[be],He=Ke.units,ve=0,Re=0,ue=He.length;Re<ue;Re++){var ie=He[Re],te=ie.data,$=ie.data.byteLength;ze.setUint32(N,$),N+=4,Fe.set(te,N),N+=$,ve+=4+$}if(be<M-1)w=y[be+1].dts-Ke.dts;else{var X=this.config,q=Ke.dts-y[be>0?be-1:be].dts;if(X.stretchShortVideoTrack&&this.nextAudioPts!==null){var ne=Math.floor(X.maxBufferHole*m),le=(_?Z+_*m:this.nextAudioPts)-Ke.pts;le>ne?(w=le-q,w<0&&(w=q),D.logger.log("[mp4-remuxer]: It is approximately "+le/90+" ms to the next segment; using duration "+w/90+" ms for the last video frame.")):w=q}else w=q}var ye=Math.round(Ke.pts-Ke.dts);P.push(new x(Ke.key,w,ve,ye))}if(P.length&&c&&c<70){var Te=P[0].flags;Te.dependsOn=2,Te.isNonSync=0}console.assert(w!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=J+w,this.isVideoContiguous=!0;var ke=C.default.moof(b.sequenceNumber++,G,p({},b,{samples:P})),rt="video",nt={data1:ke,data2:Fe,startPTS:Z/m,endPTS:(ae+w)/m,startDTS:G/m,endDTS:W/m,type:rt,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:b.dropped};return b.samples=[],b.dropped=0,console.assert(Fe.length,"MDAT length must not be zero"),nt},S.remuxAudio=function(b,v,u,_,m){var y=b.inputTimeScale,P=b.samplerate?b.samplerate:y,M=y/P,j=b.isAAC?d:a,W=j*M,N=this._initPTS,w=!b.isAAC&&this.typeSupported.mpeg,G=[],J=b.samples,Z=w?0:8,ae=this.nextAudioPts||-1,_e=v*y;if(this.isAudioContiguous=u=u||J.length&&ae>0&&(_&&Math.abs(_e-ae)<9e3||Math.abs(h(J[0].pts-N,_e)-ae)<20*W),J.forEach(function(te){te.pts=h(te.pts-N,_e)}),!u||ae<0){if(J=J.filter(function(te){return te.pts>=0}),!J.length)return;m===0?ae=0:_?ae=Math.max(0,_e):ae=J[0].pts}if(b.isAAC)for(var ce=m!==void 0,he=this.config.maxAudioFramesDrift,fe=0,pe=ae;fe<J.length;fe++){var se=J[fe],de=se.pts,Ee=de-pe,Pe=Math.abs(1e3*Ee/y);if(Ee<=-he*W&&ce)fe===0&&(D.logger.warn("Audio frame @ "+(de/y).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Ee/y)+" ms."),this.nextAudioPts=ae=pe=de);else if(Ee>=he*W&&Pe<f&&ce){var Se=Math.round(Ee/W);pe=de-Se*W,pe<0&&(Se--,pe+=W),fe===0&&(this.nextAudioPts=ae=pe),D.logger.warn("[mp4-remuxer]: Injecting "+Se+" audio frame @ "+(pe/y).toFixed(3)+"s due to "+Math.round(1e3*Ee/y)+" ms gap.");for(var Je=0;Je<Se;Je++){var qe=Math.max(pe,0),Ae=k.default.getSilentFrame(b.manifestCodec||b.codec,b.channelCount);Ae||(D.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ae=se.unit.subarray()),J.splice(fe,0,{unit:Ae,pts:qe}),pe+=W,fe++}}se.pts=pe,pe+=W}for(var we=null,De=null,Xe,We=0,Ce=J.length;Ce--;)We+=J[Ce].unit.byteLength;for(var Oe=0,et=J.length;Oe<et;Oe++){var Me=J[Oe],Le=Me.unit,Ue=Me.pts;if(De!==null){var Ge=G[Oe-1];Ge.duration=Math.round((Ue-De)/M)}else if(u&&b.isAAC&&(Ue=ae),we=Ue,We>0){We+=Z;try{Xe=new Uint8Array(We)}catch(te){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:We,reason:"fail allocating audio mdat "+We});return}if(!w){var Fe=new DataView(Xe.buffer);Fe.setUint32(0,We),Xe.set(C.default.types.mdat,4)}}else return;Xe.set(Le,Z);var ze=Le.byteLength;Z+=ze,G.push(new x(!0,j,ze,0)),De=Ue}var be=G.length;if(!be)return;var Ke=G[G.length-1];this.nextAudioPts=ae=De+M*Ke.duration;var He=w?new Uint8Array(0):C.default.moof(b.sequenceNumber++,we/M,p({},b,{samples:G}));b.samples=[];var ve=we/y,Re=ae/y,ue="audio",ie={data1:He,data2:Xe,startPTS:ve,endPTS:Re,startDTS:ve,endDTS:Re,type:ue,hasAudio:!0,hasVideo:!1,nb:be};return this.isAudioContiguous=!0,console.assert(Xe.length,"MDAT length must not be zero"),ie},S.remuxEmptyAudio=function(b,v,u,_){var m=b.inputTimeScale,y=b.samplerate?b.samplerate:m,P=m/y,M=this.nextAudioPts,j=(M!==null?M:_.startDTS*m)+this._initDTS,W=_.endDTS*m+this._initDTS,N=P*d,w=Math.ceil((W-j)/N),G=k.default.getSilentFrame(b.manifestCodec||b.codec,b.channelCount);if(D.logger.warn("[mp4-remuxer]: remux empty Audio"),!G){D.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var J=[],Z=0;Z<w;Z++){var ae=j+Z*N;J.push({unit:G,pts:ae,dts:ae})}return b.samples=J,this.remuxAudio(b,v,u,!1)},S.remuxID3=function(b,v){var u=b.samples.length;if(!u)return;for(var _=b.inputTimeScale,m=this._initPTS,y=this._initDTS,P=0;P<u;P++){var M=b.samples[P];M.pts=h(M.pts-m,v*_)/_,M.dts=h(M.dts-y,v*_)/_}var j=b.samples;return b.samples=[],{samples:j}},S.remuxText=function(b,v){var u=b.samples.length;if(!u)return;for(var _=b.inputTimeScale,m=this._initPTS,y=0;y<u;y++){var P=b.samples[y];P.pts=h(P.pts-m,v*_)/_}b.samples.sort(function(j,W){return j.pts-W.pts});var M=b.samples;return b.samples=[],{samples:M}},O}();function h(O,S){var E;if(S===null)return O;for(S<O?E=-8589934592:E=8589934592;Math.abs(O-S)>4294967296;)O+=E;return O}function R(O){for(var S=0;S<O.length;S++)if(O[S].key)return S;return-1}var x=function(S,E,b,v){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=E,this.size=b,this.cts=v,this.flags=new T(S)},T=function(S){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=S?2:1,this.isNonSync=S?0:1}},"./src/remux/passthrough-remuxer.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/polyfills/number.ts"),k=I("./src/utils/mp4-tools.ts"),C=I("./src/loader/fragment.ts"),B=I("./src/utils/logger.ts"),U=function(){function g(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var p=g.prototype;return p.destroy=function(){},p.resetTimeStamp=function(d){this.initPTS=d,this.lastEndDTS=null},p.resetNextTimestamp=function(){this.lastEndDTS=null},p.resetInitSegment=function(d,a,c){this.audioCodec=a,this.videoCodec=c,this.generateInitSegment(d),this.emitInitSegment=!0},p.generateInitSegment=function(d){var a=this.audioCodec,c=this.videoCodec;if(!d||!d.byteLength){this.initTracks=void 0,this.initData=void 0;return}var o=this.initData=Object(k.parseInitSegment)(d);a||(a=L(o.audio,C.ElementaryStreamTypes.AUDIO)),c||(c=L(o.video,C.ElementaryStreamTypes.VIDEO));var s={};o.audio&&o.video?s.audiovideo={container:"video/mp4",codec:a+","+c,initSegment:d,id:"main"}:o.audio?s.audio={container:"audio/mp4",codec:a,initSegment:d,id:"audio"}:o.video?s.video={container:"video/mp4",codec:c,initSegment:d,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s},p.remux=function(d,a,c,o,s){var l=this.initPTS,h=this.lastEndDTS,R={audio:void 0,video:void 0,text:o,id3:c,initSegment:void 0};Object(H.isFiniteNumber)(h)||(h=this.lastEndDTS=s||0);var x=a.samples;if(!x||!x.length)return R;var T={initPTS:void 0,timescale:1},O=this.initData;if((!O||!O.length)&&(this.generateInitSegment(x),O=this.initData),!O||!O.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),R;this.emitInitSegment&&(T.tracks=this.initTracks,this.emitInitSegment=!1),Object(H.isFiniteNumber)(l)||(this.initPTS=T.initPTS=l=D(O,x,h));var S=Object(k.getDuration)(x,O),E=h,b=S+E;Object(k.offsetStartDTS)(O,x,l),S>0?this.lastEndDTS=b:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var v=!!O.audio,u=!!O.video,_="";v&&(_+="audio"),u&&(_+="video");var m={data1:x,startPTS:E,startDTS:E,endPTS:b,endDTS:b,type:_,hasAudio:v,hasVideo:u,nb:1,dropped:0};return R.audio=m.type==="audio"?m:void 0,R.video=m.type!=="audio"?m:void 0,R.text=o,R.id3=c,R.initSegment=T,R},g}(),D=function(p,f,d){return Object(k.getStartDTS)(p,f)-d};function L(g,p){var f=g==null?void 0:g.codec;return f&&f.length>4?f:f==="hvc1"?"hvc1.1.c.L120.90":f==="av01"?"av01.0.04M.08":f==="avc1"||p===C.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=U},"./src/task-loop.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return H});var H=function(){function k(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var C=k.prototype;return C.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},C.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},C.onHandlerDestroyed=function(){},C.hasInterval=function(){return!!this._tickInterval},C.hasNextTick=function(){return!!this._tickTimer},C.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},C.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},C.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},C.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},C.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},C.doTick=function(){},k}()},"./src/types/cmcd.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"CMCDVersion",function(){return H}),I.d(V,"CMCDObjectType",function(){return k}),I.d(V,"CMCDStreamingFormat",function(){return C}),I.d(V,"CMCDStreamType",function(){return B});var H=1,k;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(k||(k={}));var C;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(C||(C={}));var B;(function(U){U.VOD="v",U.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"HlsSkip",function(){return C}),I.d(V,"getSkipValue",function(){return B}),I.d(V,"HlsUrlParameters",function(){return U}),I.d(V,"Level",function(){return D});function H(L,g){for(var p=0;p<g.length;p++){var f=g[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(L,f.key,f)}}function k(L,g,p){return g&&H(L.prototype,g),p&&H(L,p),L}var C;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(C||(C={}));function B(L,g){var p=L.canSkipUntil,f=L.canSkipDateRanges,d=L.endSN,a=g!==void 0?g-d:0;return p&&a<p?f?C.v2:C.Yes:C.No}var U=function(){function L(p,f,d){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=p,this.part=f,this.skip=d}var g=L.prototype;return g.addDirectives=function(f){var d=new self.URL(f);return this.msn!==void 0&&d.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&d.searchParams.set("_HLS_part",this.part.toString()),this.skip&&d.searchParams.set("_HLS_skip",this.skip),d.toString()},L}(),D=function(){function L(g){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(p){return p}).join(",").replace(/\.[^.,]+/g,"")}return k(L,[{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 f=p%this.url.length;this._urlId!==f&&(this.details=void 0,this._urlId=f)}}]),L}()},"./src/types/loader.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"PlaylistContextType",function(){return H}),I.d(V,"PlaylistLevelType",function(){return k});var H;(function(C){C.MANIFEST="manifest",C.LEVEL="level",C.AUDIO_TRACK="audioTrack",C.SUBTITLE_TRACK="subtitleTrack"})(H||(H={}));var k;(function(C){C.MAIN="main",C.AUDIO="audio",C.SUBTITLE="subtitle"})(k||(k={}))},"./src/types/transmuxer.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"ChunkMetadata",function(){return H});var H=function(B,U,D,L,g,p){L===void 0&&(L=0),g===void 0&&(g=-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=k(),this.buffering={audio:k(),video:k(),audiovideo:k()},this.level=B,this.sn=U,this.id=D,this.size=L,this.part=g,this.partial=p};function k(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"AttrList",function(){return C});var H=/^(\d+)x(\d+)$/,k=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,C=function(){function B(D){typeof D=="string"&&(D=B.parseAttrList(D));for(var L in D)D.hasOwnProperty(L)&&(this[L]=D[L])}var U=B.prototype;return U.decimalInteger=function(L){var g=parseInt(this[L],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},U.hexadecimalInteger=function(L){if(this[L]){var g=(this[L]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var p=new Uint8Array(g.length/2),f=0;f<g.length/2;f++)p[f]=parseInt(g.slice(f*2,f*2+2),16);return p}else return null},U.hexadecimalIntegerAsNumber=function(L){var g=parseInt(this[L],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},U.decimalFloatingPoint=function(L){return parseFloat(this[L])},U.optionalFloat=function(L,g){var p=this[L];return p?parseFloat(p):g},U.enumeratedString=function(L){return this[L]},U.bool=function(L){return this[L]==="YES"},U.decimalResolution=function(L){var g=H.exec(this[L]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},B.parseAttrList=function(L){var g,p={},f='"';for(k.lastIndex=0;(g=k.exec(L))!==null;){var d=g[2];d.indexOf(f)===0&&d.lastIndexOf(f)===d.length-1&&(d=d.slice(1,-1)),p[g[1]]=d}return p},B}()},"./src/utils/binary-search.ts":function(ee,V,I){"use strict";I.r(V);var H={search:function(C,B){for(var U=0,D=C.length-1,L=null,g=null;U<=D;){L=(U+D)/2|0,g=C[L];var p=B(g);if(p>0)U=L+1;else if(p<0)D=L-1;else return g}return null}};V.default=H},"./src/utils/buffer-helper.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"BufferHelper",function(){return C});var H=I("./src/utils/logger.ts"),k={length:0,start:function(){return 0},end:function(){return 0}},C=function(){function B(){}return B.isBuffered=function(D,L){try{if(D){for(var g=B.getBuffered(D),p=0;p<g.length;p++)if(L>=g.start(p)&&L<=g.end(p))return!0}}catch(f){}return!1},B.bufferInfo=function(D,L,g){try{if(D){var p=B.getBuffered(D),f=[],d;for(d=0;d<p.length;d++)f.push({start:p.start(d),end:p.end(d)});return this.bufferedInfo(f,L,g)}}catch(a){}return{len:0,start:L,end:L,nextStart:void 0}},B.bufferedInfo=function(D,L,g){L=Math.max(0,L),D.sort(function(T,O){var S=T.start-O.start;return S||O.end-T.end});var p=[];if(g)for(var f=0;f<D.length;f++){var d=p.length;if(d){var a=p[d-1].end;D[f].start-a<g?D[f].end>a&&(p[d-1].end=D[f].end):p.push(D[f])}else p.push(D[f])}else p=D;for(var c=0,o,s=L,l=L,h=0;h<p.length;h++){var R=p[h].start,x=p[h].end;if(L+g>=R&&L<x)s=R,l=x,c=l-L;else if(L+g<R){o=R;break}}return{len:c,start:s||0,end:l||0,nextStart:o}},B.getBuffered=function(D){try{return D.buffered}catch(L){return H.logger.log("failed to get media.buffered",L),k}},B}()},"./src/utils/cea-608-parser.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"Row",function(){return l}),I.d(V,"CaptionScreen",function(){return h});var H=I("./src/utils/logger.ts"),k={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},C=function(b){var v=b;return k.hasOwnProperty(b)&&(v=k[b]),String.fromCharCode(v)},B=15,U=100,D={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},f=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],d;(function(E){E[E.ERROR=0]="ERROR",E[E.TEXT=1]="TEXT",E[E.WARNING=2]="WARNING",E[E.INFO=2]="INFO",E[E.DEBUG=3]="DEBUG",E[E.DATA=3]="DATA"})(d||(d={}));var a=function(){function E(){this.time=null,this.verboseLevel=d.ERROR}var b=E.prototype;return b.log=function(u,_){this.verboseLevel>=u&&H.logger.log(this.time+" ["+u+"] "+_)},E}(),c=function(b){for(var v=[],u=0;u<b.length;u++)v.push(b[u].toString(16));return v},o=function(){function E(v,u,_,m,y){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=v||"white",this.underline=u||!1,this.italics=_||!1,this.background=m||"black",this.flash=y||!1}var b=E.prototype;return b.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},b.setStyles=function(u){for(var _=["foreground","underline","italics","background","flash"],m=0;m<_.length;m++){var y=_[m];u.hasOwnProperty(y)&&(this[y]=u[y])}},b.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},b.equals=function(u){return this.foreground===u.foreground&&this.underline===u.underline&&this.italics===u.italics&&this.background===u.background&&this.flash===u.flash},b.copy=function(u){this.foreground=u.foreground,this.underline=u.underline,this.italics=u.italics,this.background=u.background,this.flash=u.flash},b.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},E}(),s=function(){function E(v,u,_,m,y,P){this.uchar=void 0,this.penState=void 0,this.uchar=v||" ",this.penState=new o(u,_,m,y,P)}var b=E.prototype;return b.reset=function(){this.uchar=" ",this.penState.reset()},b.setChar=function(u,_){this.uchar=u,this.penState.copy(_)},b.setPenState=function(u){this.penState.copy(u)},b.equals=function(u){return this.uchar===u.uchar&&this.penState.equals(u.penState)},b.copy=function(u){this.uchar=u.uchar,this.penState.copy(u.penState)},b.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},E}(),l=function(){function E(v){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var u=0;u<U;u++)this.chars.push(new s);this.logger=v,this.pos=0,this.currPenState=new o}var b=E.prototype;return b.equals=function(u){for(var _=!0,m=0;m<U;m++)if(!this.chars[m].equals(u.chars[m])){_=!1;break}return _},b.copy=function(u){for(var _=0;_<U;_++)this.chars[_].copy(u.chars[_])},b.isEmpty=function(){for(var u=!0,_=0;_<U;_++)if(!this.chars[_].isEmpty()){u=!1;break}return u},b.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(d.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(d.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},b.moveCursor=function(u){var _=this.pos+u;if(u>1)for(var m=this.pos+1;m<_+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(_)},b.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},b.insertChar=function(u){u>=144&&this.backSpace();var _=C(u);if(this.pos>=U){this.logger.log(d.ERROR,"Cannot insert "+u.toString(16)+" ("+_+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(_,this.currPenState),this.moveCursor(1)},b.clearFromPos=function(u){var _;for(_=u;_<U;_++)this.chars[_].reset()},b.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},b.clearToEndOfRow=function(){this.clearFromPos(this.pos)},b.getTextString=function(){for(var u=[],_=!0,m=0;m<U;m++){var y=this.chars[m].uchar;y!==" "&&(_=!1),u.push(y)}return _?"":u.join("")},b.setPenStyles=function(u){this.currPenState.setStyles(u);var _=this.chars[this.pos];_.setPenState(this.currPenState)},E}(),h=function(){function E(v){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var u=0;u<B;u++)this.rows.push(new l(v));this.logger=v,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var b=E.prototype;return b.reset=function(){for(var u=0;u<B;u++)this.rows[u].clear();this.currRow=B-1},b.equals=function(u){for(var _=!0,m=0;m<B;m++)if(!this.rows[m].equals(u.rows[m])){_=!1;break}return _},b.copy=function(u){for(var _=0;_<B;_++)this.rows[_].copy(u.rows[_])},b.isEmpty=function(){for(var u=!0,_=0;_<B;_++)if(!this.rows[_].isEmpty()){u=!1;break}return u},b.backSpace=function(){var u=this.rows[this.currRow];u.backSpace()},b.clearToEndOfRow=function(){var u=this.rows[this.currRow];u.clearToEndOfRow()},b.insertChar=function(u){var _=this.rows[this.currRow];_.insertChar(u)},b.setPen=function(u){var _=this.rows[this.currRow];_.setPenStyles(u)},b.moveCursor=function(u){var _=this.rows[this.currRow];_.moveCursor(u)},b.setCursor=function(u){this.logger.log(d.INFO,"setCursor: "+u);var _=this.rows[this.currRow];_.setCursor(u)},b.setPAC=function(u){this.logger.log(d.INFO,"pacData = "+JSON.stringify(u));var _=u.row-1;if(this.nrRollUpRows&&_<this.nrRollUpRows-1&&(_=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==_){for(var m=0;m<B;m++)this.rows[m].clear();var y=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var M=P.rows[y].cueStartTime,j=this.logger.time;if(M&&j!==null&&M<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[_-this.nrRollUpRows+W+1].copy(P.rows[y+W])}}this.currRow=_;var N=this.rows[this.currRow];if(u.indent!==null){var w=u.indent,G=Math.max(w-1,0);N.setCursor(u.indent),u.color=N.chars[G].penState.foreground}var J={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(J)},b.setBkgData=function(u){this.logger.log(d.INFO,"bkgData = "+JSON.stringify(u)),this.backSpace(),this.setPen(u),this.insertChar(32)},b.setRollUpRows=function(u){this.nrRollUpRows=u},b.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(d.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(d.TEXT,this.getDisplayText());var u=this.currRow+1-this.nrRollUpRows,_=this.rows.splice(u,1)[0];_.clear(),this.rows.splice(this.currRow,0,_),this.logger.log(d.INFO,"Rolling up")},b.getDisplayText=function(u){u=u||!1;for(var _=[],m="",y=-1,P=0;P<B;P++){var M=this.rows[P].getTextString();M&&(y=P+1,u?_.push("Row "+y+": '"+M+"'"):_.push(M.trim()))}return _.length>0&&(u?m="["+_.join(" | ")+"]":m=_.join(`
|
|
`)),m},b.getTextAndFormat=function(){return this.rows},E}(),R=function(){function E(v,u,_){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=v,this.outputFilter=u,this.mode=null,this.verbose=0,this.displayedMemory=new h(_),this.nonDisplayedMemory=new h(_),this.lastOutputScreen=new h(_),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=_}var b=E.prototype;return b.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},b.getHandler=function(){return this.outputFilter},b.setHandler=function(u){this.outputFilter=u},b.setPAC=function(u){this.writeScreen.setPAC(u)},b.setBkgData=function(u){this.writeScreen.setBkgData(u)},b.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(d.INFO,"MODE="+u),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=u},b.insertChars=function(u){for(var _=0;_<u.length;_++)this.writeScreen.insertChar(u[_]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(d.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(d.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},b.ccRCL=function(){this.logger.log(d.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},b.ccBS=function(){if(this.logger.log(d.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},b.ccAOF=function(){},b.ccAON=function(){},b.ccDER=function(){this.logger.log(d.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},b.ccRU=function(u){this.logger.log(d.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},b.ccFON=function(){this.logger.log(d.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},b.ccRDC=function(){this.logger.log(d.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},b.ccTR=function(){this.logger.log(d.INFO,"TR"),this.setMode("MODE_TEXT")},b.ccRTD=function(){this.logger.log(d.INFO,"RTD"),this.setMode("MODE_TEXT")},b.ccEDM=function(){this.logger.log(d.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},b.ccCR=function(){this.logger.log(d.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},b.ccENM=function(){this.logger.log(d.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},b.ccEOC=function(){if(this.logger.log(d.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var u=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=u,this.writeScreen=this.nonDisplayedMemory,this.logger.log(d.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},b.ccTO=function(u){this.logger.log(d.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},b.ccMIDROW=function(u){var _={flash:!1};if(_.underline=u%2===1,_.italics=u>=46,_.italics)_.foreground="white";else{var m=Math.floor(u/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];_.foreground=y[m]}this.logger.log(d.INFO,"MIDROW: "+JSON.stringify(_)),this.writeScreen.setPen(_)},b.outputDataUpdate=function(u){u===void 0&&(u=!1);var _=this.logger.time;if(_===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=_:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,_,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:_),this.lastOutputScreen.copy(this.displayedMemory))},b.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},E}(),x=function(){function E(v,u,_){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new a;this.channels=[null,new R(v,u,m),new R(v+1,_,m)],this.cmdHistory=S(),this.logger=m}var b=E.prototype;return b.getHandler=function(u){return this.channels[u].getHandler()},b.setHandler=function(u,_){this.channels[u].setHandler(_)},b.addData=function(u,_){var m,y,P,M=!1;this.logger.time=u;for(var j=0;j<_.length;j+=2){if(y=_[j]&127,P=_[j+1]&127,y===0&&P===0)continue;if(this.logger.log(d.DATA,"["+c([_[j],_[j+1]])+"] -> ("+c([y,P])+")"),m=this.parseCmd(y,P),m||(m=this.parseMidrow(y,P)),m||(m=this.parsePAC(y,P)),m||(m=this.parseBackgroundAttributes(y,P)),!m&&(M=this.parseChars(y,P),M)){var W=this.currentChannel;if(W&&W>0){var N=this.channels[W];N.insertChars(M)}else this.logger.log(d.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!M&&this.logger.log(d.WARNING,"Couldn't parse cleaned data "+c([y,P])+" orig: "+c([_[j],_[j+1]]))}},b.parseCmd=function(u,_){var m=this.cmdHistory,y=(u===20||u===28||u===21||u===29)&&_>=32&&_<=47,P=(u===23||u===31)&&_>=33&&_<=35;if(!(y||P))return!1;if(O(u,_,m))return T(null,null,m),this.logger.log(d.DEBUG,"Repeated command ("+c([u,_])+") is dropped"),!0;var M=u===20||u===21||u===23?1:2,j=this.channels[M];return u===20||u===21||u===28||u===29?_===32?j.ccRCL():_===33?j.ccBS():_===34?j.ccAOF():_===35?j.ccAON():_===36?j.ccDER():_===37?j.ccRU(2):_===38?j.ccRU(3):_===39?j.ccRU(4):_===40?j.ccFON():_===41?j.ccRDC():_===42?j.ccTR():_===43?j.ccRTD():_===44?j.ccEDM():_===45?j.ccCR():_===46?j.ccENM():_===47&&j.ccEOC():j.ccTO(_-32),T(u,_,m),this.currentChannel=M,!0},b.parseMidrow=function(u,_){var m=0;if((u===17||u===25)&&_>=32&&_<=47){if(u===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(d.ERROR,"Mismatch channel in midrow parsing"),!1;var y=this.channels[m];return y?(y.ccMIDROW(_),this.logger.log(d.DEBUG,"MIDROW ("+c([u,_])+")"),!0):!1}return!1},b.parsePAC=function(u,_){var m,y=this.cmdHistory,P=(u>=17&&u<=23||u>=25&&u<=31)&&_>=64&&_<=127,M=(u===16||u===24)&&_>=64&&_<=95;if(!(P||M))return!1;if(O(u,_,y))return T(null,null,y),!0;var j=u<=23?1:2;_>=64&&_<=95?m=j===1?D[u]:g[u]:m=j===1?L[u]:p[u];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(m,_)),T(u,_,y),this.currentChannel=j,!0):!1},b.interpretPAC=function(u,_){var m,y={color:null,italics:!1,indent:null,underline:!1,row:u};return _>95?m=_-96:m=_-64,y.underline=(m&1)===1,m<=13?y.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(y.italics=!0,y.color="white"):y.indent=Math.floor((m-16)/2)*4,y},b.parseChars=function(u,_){var m,y=null,P=null;if(u>=25?(m=2,P=u-8):(m=1,P=u),P>=17&&P<=19){var M;P===17?M=_+80:P===18?M=_+112:M=_+144,this.logger.log(d.INFO,"Special char '"+C(M)+"' in channel "+m),y=[M]}else u>=32&&u<=127&&(y=_===0?[u]:[u,_]);if(y){var j=c(y);this.logger.log(d.DEBUG,"Char codes = "+j.join(",")),T(u,_,this.cmdHistory)}return y},b.parseBackgroundAttributes=function(u,_){var m=(u===16||u===24)&&_>=32&&_<=47,y=(u===23||u===31)&&_>=45&&_<=47;if(!(m||y))return!1;var P,M={};u===16||u===24?(P=Math.floor((_-32)/2),M.background=f[P],_%2===1&&(M.background=M.background+"_semi")):_===45?M.background="transparent":(M.foreground="black",_===47&&(M.underline=!0));var j=u<=23?1:2,W=this.channels[j];return W.setBkgData(M),T(u,_,this.cmdHistory),!0},b.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var _=this.channels[u];_&&_.reset()}this.cmdHistory=S()},b.cueSplitAtTime=function(u){for(var _=0;_<this.channels.length;_++){var m=this.channels[_];m&&m.cueSplitAtTime(u)}},E}();function T(E,b,v){v.a=E,v.b=b}function O(E,b,v){return v.a===E&&v.b===b}function S(){return{a:null,b:null}}V.default=x},"./src/utils/codecs.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"isCodecType",function(){return k}),I.d(V,"isCodecSupportedInMp4",function(){return C});var H={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 k(B,U){var D=H[U];return!!D&&D[B.slice(0,4)]===!0}function C(B,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/utils/vttparser.ts"),k=I("./src/utils/webvtt-parser.ts"),C=I("./src/utils/texttrack-utils.ts"),B=/\s/,U={newCue:function(L,g,p,f){for(var d=[],a,c,o,s,l,h=self.VTTCue||self.TextTrackCue,R=0;R<f.rows.length;R++)if(a=f.rows[R],o=!0,s=0,l="",!a.isEmpty()){for(var x=0;x<a.chars.length;x++)B.test(a.chars[x].uchar)&&o?s++:(l+=a.chars[x].uchar,o=!1);a.cueStartTime=g,g===p&&(p+=1e-4),s>=16?s--:s++;var T=Object(H.fixLineBreaks)(l.trim()),O=Object(k.generateCueId)(g,p,T);(!L||!L.cues||!L.cues.getCueById(O))&&(c=new h(g,p,T),c.id=O,c.line=R+1,c.align="left",c.position=10+Math.min(80,Math.floor(s*8/32)*10),d.push(c))}return L&&d.length&&(d.sort(function(S,E){return S.line==="auto"||E.line==="auto"?0:S.line>8&&E.line>8?E.line-S.line:S.line-E.line}),d.forEach(function(S){return Object(C.addCueToTrack)(L,S)})),d}};V.default=U},"./src/utils/discontinuities.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"findFirstFragWithCC",function(){return B}),I.d(V,"shouldAlignOnDiscontinuities",function(){return U}),I.d(V,"findDiscontinuousReferenceFrag",function(){return D}),I.d(V,"adjustSlidingStart",function(){return g}),I.d(V,"alignStream",function(){return p}),I.d(V,"alignPDT",function(){return d}),I.d(V,"alignFragmentByPDTDelta",function(){return a}),I.d(V,"alignMediaPlaylistByPDT",function(){return c});var H=I("./src/polyfills/number.ts"),k=I("./src/utils/logger.ts"),C=I("./src/controller/level-helper.ts");function B(o,s){for(var l=null,h=0,R=o.length;h<R;h++){var x=o[h];if(x&&x.cc===s){l=x;break}}return l}function U(o,s,l){return!!(s.details&&(l.endCC>l.startCC||o&&o.cc<l.startCC))}function D(o,s){var l=o.fragments,h=s.fragments;if(!h.length||!l.length){k.logger.log("No fragments to align");return}var R=B(l,h[0].cc);if(!R||R&&!R.startPTS){k.logger.log("No frag in previous level to align on");return}return R}function L(o,s){if(o){var l=o.start+s;o.start=o.startPTS=l,o.endPTS=l+o.duration}}function g(o,s){for(var l=s.fragments,h=0,R=l.length;h<R;h++)L(l[h],o);s.fragmentHint&&L(s.fragmentHint,o),s.alignedSliding=!0}function p(o,s,l){if(!s)return;f(o,l,s),!l.alignedSliding&&s.details&&d(l,s.details),!l.alignedSliding&&s.details&&!l.skippedSegments&&Object(C.adjustSliding)(s.details,l)}function f(o,s,l){if(U(o,l,s)){var h=D(l.details,s);h&&Object(H.isFiniteNumber)(h.start)&&(k.logger.log("Adjusting PTS using last level due to CC increase within current level "+s.url),g(h.start,s))}}function d(o,s){if(!s.fragments.length||!o.hasProgramDateTime||!s.hasProgramDateTime)return;var l=s.fragments[0].programDateTime,h=o.fragments[0].programDateTime,R=(h-l)/1e3+s.fragments[0].start;R&&Object(H.isFiniteNumber)(R)&&(k.logger.log("Adjusting PTS using programDateTime delta "+(h-l)+"ms, sliding:"+R.toFixed(3)+" "+o.url+" "),g(R,o))}function a(o,s){var l=o.programDateTime;if(!l)return;var h=(l-s)/1e3;o.start=o.startPTS=h,o.endPTS=h+o.duration}function c(o,s){if(!s.fragments.length||!o.hasProgramDateTime||!s.hasProgramDateTime)return;var l=s.fragments[0].programDateTime,h=s.fragments[0].start,R=l-h*1e3;o.fragments.forEach(function(x){a(x,R)}),o.fragmentHint&&a(o.fragmentHint,R),o.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/utils/ewma.ts"),k=function(){function C(U,D,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new H.default(U),this.fast_=new H.default(D)}var B=C.prototype;return B.update=function(D,L){var g=this.slow_,p=this.fast_;this.slow_.halfLife!==D&&(this.slow_=new H.default(D,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new H.default(L,p.getEstimate(),p.getTotalWeight()))},B.sample=function(D,L){D=Math.max(D,this.minDelayMs_);var g=8*L,p=D/1e3,f=g/p;this.fast_.sample(p,f),this.slow_.sample(p,f)},B.canEstimate=function(){var D=this.fast_;return D&&D.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},C}();V.default=k},"./src/utils/ewma.ts":function(ee,V,I){"use strict";I.r(V);var H=function(){function k(B,U,D){U===void 0&&(U=0),D===void 0&&(D=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=U,this.totalWeight_=D}var C=k.prototype;return C.sample=function(U,D){var L=Math.pow(this.alpha_,U);this.estimate_=D*(1-L)+L*this.estimate_,this.totalWeight_+=U},C.getTotalWeight=function(){return this.totalWeight_},C.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},k}();V.default=H},"./src/utils/fetch-loader.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"fetchSupported",function(){return a});var H=I("./src/polyfills/number.ts"),k=I("./src/loader/load-stats.ts"),C=I("./src/demux/chunk-cache.ts");function B(h,R){h.prototype=Object.create(R.prototype),h.prototype.constructor=h,p(h,R)}function U(h){var R=typeof Map=="function"?new Map:void 0;return U=function(T){if(T===null||!g(T))return T;if(typeof T!="function")throw new TypeError("Super expression must either be null or a function");if(typeof R!="undefined"){if(R.has(T))return R.get(T);R.set(T,O)}function O(){return D(T,arguments,f(this).constructor)}return O.prototype=Object.create(T.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),p(O,T)},U(h)}function D(h,R,x){return L()?D=Reflect.construct:D=function(O,S,E){var b=[null];b.push.apply(b,S);var v=Function.bind.apply(O,b),u=new v;return E&&p(u,E.prototype),u},D.apply(null,arguments)}function L(){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(h){return!1}}function g(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function p(h,R){return p=Object.setPrototypeOf||function(T,O){return T.__proto__=O,T},p(h,R)}function f(h){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(x){return x.__proto__||Object.getPrototypeOf(x)},f(h)}function d(){return d=Object.assign||function(h){for(var R=1;R<arguments.length;R++){var x=arguments[R];for(var T in x)Object.prototype.hasOwnProperty.call(x,T)&&(h[T]=x[T])}return h},d.apply(this,arguments)}function a(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var c=function(){function h(x){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=x.fetchSetup||s,this.controller=new self.AbortController,this.stats=new k.LoadStats}var R=h.prototype;return R.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},R.abortInternal=function(){var T=this.response;(!T||!T.ok)&&(this.stats.aborted=!0,this.controller.abort())},R.abort=function(){var T;this.abortInternal(),(T=this.callbacks)!==null&&T!==void 0&&T.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},R.load=function(T,O,S){var E=this,b=this.stats;if(b.loading.start)throw new Error("Loader can only be used once.");b.loading.start=self.performance.now();var v=o(T,this.controller.signal),u=S.onProgress,_=T.responseType==="arraybuffer",m=_?"byteLength":"length";this.context=T,this.config=O,this.callbacks=S,this.request=this.fetchSetup(T,v),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){E.abortInternal(),S.onTimeout(b,T,E.response)},O.timeout),self.fetch(this.request).then(function(y){if(E.response=E.loader=y,!y.ok){var P=y.status,M=y.statusText;throw new l(M||"fetch, bad network response",P,y)}return b.loading.first=Math.max(self.performance.now(),b.loading.start),b.total=parseInt(y.headers.get("Content-Length")||"0"),u&&Object(H.isFiniteNumber)(O.highWaterMark)?E.loadProgressively(y,b,T,O.highWaterMark,u):_?y.arrayBuffer():y.text()}).then(function(y){var P=E.response;self.clearTimeout(E.requestTimeout),b.loading.end=Math.max(self.performance.now(),b.loading.first),b.loaded=b.total=y[m];var M={url:P.url,data:y};u&&!Object(H.isFiniteNumber)(O.highWaterMark)&&u(b,T,y,P),S.onSuccess(M,b,T,P)}).catch(function(y){if(self.clearTimeout(E.requestTimeout),b.aborted)return;var P=y.code||0;S.onError({code:P,text:y.message},T,y.details)})},R.getCacheAge=function(){var T=null;if(this.response){var O=this.response.headers.get("age");T=O?parseFloat(O):null}return T},R.loadProgressively=function(T,O,S,E,b){E===void 0&&(E=0);var v=new C.default,u=T.body.getReader(),_=function m(){return u.read().then(function(y){if(y.done)return v.dataLength&&b(O,S,v.flush(),T),Promise.resolve(new ArrayBuffer(0));var P=y.value,M=P.length;return O.loaded+=M,M<E||v.dataLength?(v.push(P),v.dataLength>=E&&b(O,S,v.flush(),T)):b(O,S,P,T),m()}).catch(function(){return Promise.reject()})};return _()},h}();function o(h,R){var x={method:"GET",mode:"cors",credentials:"same-origin",signal:R,headers:new self.Headers(d({},h.headers))};return h.rangeEnd&&x.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),x}function s(h,R){return new self.Request(h.url,R)}var l=function(h){B(R,h);function R(x,T,O){var S;return S=h.call(this,x)||this,S.code=void 0,S.details=void 0,S.code=T,S.details=O,S}return R}(U(Error));V.default=c},"./src/utils/imsc1-ttml-parser.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"IMSC1_CODEC",function(){return g}),I.d(V,"parseIMSC1",function(){return a});var H=I("./src/utils/mp4-tools.ts"),k=I("./src/utils/vttparser.ts"),C=I("./src/utils/vttcue.ts"),B=I("./src/demux/id3.ts"),U=I("./src/utils/timescale-conversion.ts"),D=I("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(E){for(var b=1;b<arguments.length;b++){var v=arguments[b];for(var u in v)Object.prototype.hasOwnProperty.call(v,u)&&(E[u]=v[u])}return E},L.apply(this,arguments)}var g="stpp.ttml.im1t",p=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,f=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,d={left:"start",center:"center",right:"end",start:"start",end:"end"};function a(E,b,v,u,_){var m=Object(H.findBox)(new Uint8Array(E),["mdat"]);if(m.length===0){_(new Error("Could not parse IMSC1 mdat"));return}var y=m[0],P=Object(B.utf8ArrayToStr)(new Uint8Array(E,y.start,y.end-y.start)),M=Object(U.toTimescaleFromScale)(b,1,v);try{u(c(P,M))}catch(j){_(j)}}function c(E,b){var v=new DOMParser,u=v.parseFromString(E,"text/xml"),_=u.getElementsByTagName("tt")[0];if(!_)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},y=Object.keys(m).reduce(function(N,w){return N[w]=_.getAttribute("ttp:"+w)||m[w],N},{}),P=_.getAttribute("xml:space")!=="preserve",M=s(o(_,"styling","style")),j=s(o(_,"layout","region")),W=o(_,"body","[begin]");return[].map.call(W,function(N){var w=l(N,P);if(!w||!N.hasAttribute("begin"))return null;var G=T(N.getAttribute("begin"),y),J=T(N.getAttribute("dur"),y),Z=T(N.getAttribute("end"),y);if(G===null)throw x(N);if(Z===null){if(J===null)throw x(N);Z=G+J}var ae=new C.default(G-b,Z-b,w);ae.id=Object(D.generateCueId)(ae.startTime,ae.endTime,ae.text);var _e=j[N.getAttribute("region")],ce=M[N.getAttribute("style")];ae.position=10,ae.size=80;var he=h(_e,ce),fe=he.textAlign;if(fe){var pe=d[fe];pe&&(ae.lineAlign=pe),ae.align=fe}return L(ae,he),ae}).filter(function(N){return N!==null})}function o(E,b,v){var u=E.getElementsByTagName(b)[0];return u?[].slice.call(u.querySelectorAll(v)):[]}function s(E){return E.reduce(function(b,v){var u=v.getAttribute("xml:id");return u&&(b[u]=v),b},{})}function l(E,b){return[].slice.call(E.childNodes).reduce(function(v,u,_){var m;return u.nodeName==="br"&&_?v+`
|
|
`:(m=u.childNodes)!==null&&m!==void 0&&m.length?l(u,b):b?v+u.textContent.trim().replace(/\s+/g," "):v+u.textContent},"")}function h(E,b){var v="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(_,m){var y=R(b,v,m)||R(E,v,m);return y&&(_[m]=y),_},{})}function R(E,b,v){return E.hasAttributeNS(b,v)?E.getAttributeNS(b,v):null}function x(E){return new Error("Could not parse ttml timestamp "+E)}function T(E,b){if(!E)return null;var v=Object(k.parseTimeStamp)(E);return v===null&&(p.test(E)?v=O(E,b):f.test(E)&&(v=S(E,b))),v}function O(E,b){var v=p.exec(E),u=(v[4]|0)+(v[5]|0)/b.subFrameRate;return(v[1]|0)*3600+(v[2]|0)*60+(v[3]|0)+u/b.frameRate}function S(E,b){var v=f.exec(E),u=Number(v[1]),_=v[2];switch(_){case"h":return u*3600;case"m":return u*60;case"ms":return u*1e3;case"f":return u/b.frameRate;case"t":return u/b.tickRate}return u}},"./src/utils/logger.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"enableLogs",function(){return D}),I.d(V,"logger",function(){return L});var H=function(){},k={trace:H,debug:H,log:H,warn:H,info:H,error:H},C=k;function B(g){var p=self.console[g];return p?p.bind(self.console,"["+g+"] >"):H}function U(g){for(var p=arguments.length,f=new Array(p>1?p-1:0),d=1;d<p;d++)f[d-1]=arguments[d];f.forEach(function(a){C[a]=g[a]?g[a].bind(g):B(a)})}function D(g){if(self.console&&g===!0||typeof g=="object"){U(g,"debug","log","info","warn","error");try{C.log()}catch(p){C=k}}else C=k}var L=C},"./src/utils/mediakeys-helper.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"KeySystems",function(){return H}),I.d(V,"requestMediaKeySystemAccess",function(){return k});var H;(function(C){C.WIDEVINE="com.widevine.alpha",C.PLAYREADY="com.microsoft.playready"})(H||(H={}));var k=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"getMediaSource",function(){return H});function H(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"bin2str",function(){return U}),I.d(V,"readUint16",function(){return D}),I.d(V,"readUint32",function(){return L}),I.d(V,"writeUint32",function(){return g}),I.d(V,"findBox",function(){return p}),I.d(V,"parseSegmentIndex",function(){return f}),I.d(V,"parseInitSegment",function(){return d}),I.d(V,"getStartDTS",function(){return a}),I.d(V,"getDuration",function(){return c}),I.d(V,"computeRawDurationFromSamples",function(){return o}),I.d(V,"offsetStartDTS",function(){return s}),I.d(V,"segmentValidRange",function(){return l}),I.d(V,"appendUint8Array",function(){return h});var H=I("./src/utils/typed-array.ts"),k=I("./src/loader/fragment.ts"),C=Math.pow(2,32)-1,B=[].push;function U(R){return String.fromCharCode.apply(null,R)}function D(R,x){"data"in R&&(x+=R.start,R=R.data);var T=R[x]<<8|R[x+1];return T<0?65536+T:T}function L(R,x){"data"in R&&(x+=R.start,R=R.data);var T=R[x]<<24|R[x+1]<<16|R[x+2]<<8|R[x+3];return T<0?4294967296+T:T}function g(R,x,T){"data"in R&&(x+=R.start,R=R.data),R[x]=T>>24,R[x+1]=T>>16&255,R[x+2]=T>>8&255,R[x+3]=T&255}function p(R,x){var T=[];if(!x.length)return T;var O,S,E;"data"in R?(O=R.data,S=R.start,E=R.end):(O=R,S=0,E=O.byteLength);for(var b=S;b<E;){var v=L(O,b),u=U(O.subarray(b+4,b+8)),_=v>1?b+v:E;if(u===x[0])if(x.length===1)T.push({data:O,start:b+8,end:_});else{var m=p({data:O,start:b+8,end:_},x.slice(1));m.length&&B.apply(T,m)}b=_}return T}function f(R){var x=p(R,["moov"]),T=x[0],O=T?T.end:null,S=p(R,["sidx"]);if(!S||!S[0])return null;var E=[],b=S[0],v=b.data[0],u=v===0?8:16,_=L(b,u);u+=4;var m=0,y=0;v===0?u+=8:u+=16,u+=2;var P=b.end+y,M=D(b,u);u+=2;for(var j=0;j<M;j++){var W=u,N=L(b,W);W+=4;var w=N&2147483647,G=(N&2147483648)>>>31;if(G===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var J=L(b,W);W+=4,E.push({referenceSize:w,subsegmentDuration:J,info:{duration:J/_,start:P,end:P+w-1}}),P+=w,W+=4,u=W}return{earliestPresentationTime:m,timescale:_,version:v,referencesCount:M,references:E,moovEndOffset:O}}function d(R){for(var x=[],T=p(R,["moov","trak"]),O=0;O<T.length;O++){var S=T[O],E=p(S,["tkhd"])[0];if(E){var b=E.data[E.start],v=b===0?12:20,u=L(E,v),_=p(S,["mdia","mdhd"])[0];if(_){b=_.data[_.start],v=b===0?12:20;var m=L(_,v),y=p(S,["mdia","hdlr"])[0];if(y){var P=U(y.data.subarray(y.start+8,y.start+12)),M={soun:k.ElementaryStreamTypes.AUDIO,vide:k.ElementaryStreamTypes.VIDEO}[P];if(M){var j=p(S,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=U(j.data.subarray(j.start+12,j.start+16))),x[u]={timescale:m,type:M},x[M]={timescale:m,id:u,codec:W}}}}}}var N=p(R,["moov","mvex","trex"]);return N.forEach(function(w){var G=L(w,4),J=x[G];J&&(J.default={duration:L(w,12),flags:L(w,20)})}),x}function a(R,x){return p(x,["moof","traf"]).reduce(function(T,O){var S=p(O,["tfdt"])[0],E=S.data[S.start],b=p(O,["tfhd"]).reduce(function(v,u){var _=L(u,4),m=R[_];if(m){var y=L(S,4);E===1&&(y*=Math.pow(2,32),y+=L(S,8));var P=m.timescale||9e4,M=y/P;if(isFinite(M)&&(v===null||M<v))return M}return v},null);return b!==null&&isFinite(b)&&(T===null||b<T)?b:T},null)||0}function c(R,x){for(var T=0,O=0,S=0,E=p(R,["moof","traf"]),b=0;b<E.length;b++){var v=E[b],u=p(v,["tfhd"])[0],_=L(u,4),m=x[_];if(!m)continue;var y=m.default,P=L(u,0)|(y==null?void 0:y.flags),M=y==null?void 0:y.duration;P&8&&(P&2?M=L(u,12):M=L(u,8));for(var j=m.timescale||9e4,W=p(v,["trun"]),N=0;N<W.length;N++){if(M){var w=L(W[N],4);T=M*w}else T=o(W[N]);m.type===k.ElementaryStreamTypes.VIDEO?O+=T/j:m.type===k.ElementaryStreamTypes.AUDIO&&(S+=T/j)}}if(O===0&&S===0){var G=f(R);if(G!=null&&G.references)return G.references.reduce(function(J,Z){return J+Z.info.duration||0},0)}return O||S}function o(R){var x=L(R,0),T=8;x&1&&(T+=4),x&4&&(T+=4);for(var O=0,S=L(R,4),E=0;E<S;E++){if(x&256){var b=L(R,T);O+=b,T+=4}x&512&&(T+=4),x&1024&&(T+=4),x&2048&&(T+=4)}return O}function s(R,x,T){p(x,["moof","traf"]).forEach(function(O){p(O,["tfhd"]).forEach(function(S){var E=L(S,4),b=R[E];if(!b)return;var v=b.timescale||9e4;p(O,["tfdt"]).forEach(function(u){var _=u.data[u.start],m=L(u,4);if(_===0)g(u,4,m-T*v);else{m*=Math.pow(2,32),m+=L(u,8),m-=T*v,m=Math.max(m,0);var y=Math.floor(m/(C+1)),P=Math.floor(m%(C+1));g(u,4,y),g(u,8,P)}})})})}function l(R){var x={valid:null,remainder:null},T=p(R,["moof"]);if(T){if(T.length<2)return x.remainder=R,x}else return x;var O=T[T.length-1];return x.valid=Object(H.sliceUint8)(R,0,O.start-8),x.remainder=Object(H.sliceUint8)(R,O.start-8),x}function h(R,x){var T=new Uint8Array(R.length+x.length);return T.set(R),T.set(x,R.length),T}},"./src/utils/output-filter.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"default",function(){return H});var H=function(){function k(B,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=U}var C=k.prototype;return C.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},C.newCue=function(U,D,L){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=D,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},C.reset=function(){this.cueRanges=[]},k}()},"./src/utils/texttrack-utils.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"sendAddTrackEvent",function(){return k}),I.d(V,"addCueToTrack",function(){return C}),I.d(V,"clearCurrentCues",function(){return B}),I.d(V,"removeCuesInRange",function(){return U}),I.d(V,"getCuesInRange",function(){return L});var H=I("./src/utils/logger.ts");function k(g,p){var f;try{f=new Event("addtrack")}catch(d){f=document.createEvent("Event"),f.initEvent("addtrack",!1,!1)}f.track=g,p.dispatchEvent(f)}function C(g,p){var f=g.mode;if(f==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(p.id))try{if(g.addCue(p),!g.cues.getCueById(p.id))throw new Error("addCue is failed for: "+p)}catch(a){H.logger.debug("[texttrack-utils]: "+a);var d=new self.TextTrackCue(p.startTime,p.endTime,p.text);d.id=p.id,g.addCue(d)}f==="disabled"&&(g.mode=f)}function B(g){var p=g.mode;if(p==="disabled"&&(g.mode="hidden"),g.cues)for(var f=g.cues.length;f--;)g.removeCue(g.cues[f]);p==="disabled"&&(g.mode=p)}function U(g,p,f){var d=g.mode;if(d==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var a=L(g.cues,p,f),c=0;c<a.length;c++)g.removeCue(a[c]);d==="disabled"&&(g.mode=d)}function D(g,p){if(p<g[0].startTime)return 0;var f=g.length-1;if(p>g[f].endTime)return-1;for(var d=0,a=f;d<=a;){var c=Math.floor((a+d)/2);if(p<g[c].startTime)a=c-1;else if(p>g[c].startTime&&d<f)d=c+1;else return c}return g[d].startTime-p<p-g[a].startTime?d:a}function L(g,p,f){var d=[],a=D(g,p);if(a>-1)for(var c=a,o=g.length;c<o;c++){var s=g[c];if(s.startTime>=p&&s.endTime<=f)d.push(s);else if(s.startTime>f)return d}return d}},"./src/utils/time-ranges.ts":function(ee,V,I){"use strict";I.r(V);var H={toString:function(C){for(var B="",U=C.length,D=0;D<U;D++)B+="["+C.start(D).toFixed(3)+","+C.end(D).toFixed(3)+"]";return B}};V.default=H},"./src/utils/timescale-conversion.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"toTimescaleFromBase",function(){return k}),I.d(V,"toTimescaleFromScale",function(){return C}),I.d(V,"toMsFromMpegTsClock",function(){return B}),I.d(V,"toMpegTsClockFromTimescale",function(){return U});var H=9e4;function k(D,L,g,p){g===void 0&&(g=1),p===void 0&&(p=!1);var f=D*L*g;return p?Math.round(f):f}function C(D,L,g,p){return g===void 0&&(g=1),p===void 0&&(p=!1),k(D,L,1/g,p)}function B(D,L){return L===void 0&&(L=!1),k(D,1e3,1/H,L)}function U(D,L){return L===void 0&&(L=1),k(D,H,1/L)}},"./src/utils/typed-array.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"sliceUint8",function(){return H});function H(k,C,B){return Uint8Array.prototype.slice?k.slice(C,B):new Uint8Array(Array.prototype.slice.call(k,C,B))}},"./src/utils/vttcue.ts":function(ee,V,I){"use strict";I.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var H=["","lr","rl"],k=["start","middle","end","left","right"];function C(g,p){if(typeof p!="string")return!1;if(!Array.isArray(g))return!1;var f=p.toLowerCase();return~g.indexOf(f)?f:!1}function B(g){return C(H,g)}function U(g){return C(k,g)}function D(g){for(var p=arguments.length,f=new Array(p>1?p-1:0),d=1;d<p;d++)f[d-1]=arguments[d];for(var a=1;a<arguments.length;a++){var c=arguments[a];for(var o in c)g[o]=c[o]}return g}function L(g,p,f){var d=this,a={enumerable:!0};d.hasBeenReset=!1;var c="",o=!1,s=g,l=p,h=f,R=null,x="",T=!0,O="auto",S="start",E=50,b="middle",v=50,u="middle";Object.defineProperty(d,"id",D({},a,{get:function(){return c},set:function(m){c=""+m}})),Object.defineProperty(d,"pauseOnExit",D({},a,{get:function(){return o},set:function(m){o=!!m}})),Object.defineProperty(d,"startTime",D({},a,{get:function(){return s},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");s=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",D({},a,{get:function(){return l},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"text",D({},a,{get:function(){return h},set:function(m){h=""+m,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",D({},a,{get:function(){return R},set:function(m){R=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",D({},a,{get:function(){return x},set:function(m){var y=B(m);if(y===!1)throw new SyntaxError("An invalid or illegal string was specified.");x=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",D({},a,{get:function(){return T},set:function(m){T=!!m,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",D({},a,{get:function(){return O},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");O=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"lineAlign",D({},a,{get:function(){return S},set:function(m){var y=U(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");S=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",D({},a,{get:function(){return E},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");E=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"positionAlign",D({},a,{get:function(){return b},set:function(m){var y=U(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");b=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",D({},a,{get:function(){return v},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");v=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",D({},a,{get:function(){return u},set:function(m){var y=U(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");u=y,this.hasBeenReset=!0}})),d.displayState=void 0}return L.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"parseTimeStamp",function(){return C}),I.d(V,"fixLineBreaks",function(){return p}),I.d(V,"VTTParser",function(){return f});var H=I("./src/utils/vttcue.ts"),k=function(){function d(){}var a=d.prototype;return a.decode=function(o,s){if(!o)return"";if(typeof o!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(o))},d}();function C(d){function a(o,s,l,h){return(o|0)*3600+(s|0)*60+(l|0)+parseFloat(h||0)}var c=d.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return c?parseFloat(c[2])>59?a(c[2],c[3],0,c[4]):a(c[1],c[2],c[3],c[4]):null}var B=function(){function d(){this.values=Object.create(null)}var a=d.prototype;return a.set=function(o,s){!this.get(o)&&s!==""&&(this.values[o]=s)},a.get=function(o,s,l){return l?this.has(o)?this.values[o]:s[l]:this.has(o)?this.values[o]:s},a.has=function(o){return o in this.values},a.alt=function(o,s,l){for(var h=0;h<l.length;++h)if(s===l[h]){this.set(o,s);break}},a.integer=function(o,s){/^-?\d+$/.test(s)&&this.set(o,parseInt(s,10))},a.percent=function(o,s){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(s)){var l=parseFloat(s);if(l>=0&&l<=100)return this.set(o,l),!0}return!1},d}();function U(d,a,c,o){var s=o?d.split(o):[d];for(var l in s){if(typeof s[l]!="string")continue;var h=s[l].split(c);if(h.length!==2)continue;var R=h[0],x=h[1];a(R,x)}}var D=new H.default(0,0,""),L=D.align==="middle"?"middle":"center";function g(d,a,c){var o=d;function s(){var R=C(d);if(R===null)throw new Error("Malformed timestamp: "+o);return d=d.replace(/^[^\sa-zA-Z-]+/,""),R}function l(R,x){var T=new B;U(R,function(E,b){var v;switch(E){case"region":for(var u=c.length-1;u>=0;u--)if(c[u].id===b){T.set(E,c[u].region);break}break;case"vertical":T.alt(E,b,["rl","lr"]);break;case"line":v=b.split(","),T.integer(E,v[0]),T.percent(E,v[0])&&T.set("snapToLines",!1),T.alt(E,v[0],["auto"]),v.length===2&&T.alt("lineAlign",v[1],["start",L,"end"]);break;case"position":v=b.split(","),T.percent(E,v[0]),v.length===2&&T.alt("positionAlign",v[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":T.percent(E,b);break;case"align":T.alt(E,b,["start",L,"end","left","right"]);break}},/:/,/\s/),x.region=T.get("region",null),x.vertical=T.get("vertical","");var O=T.get("line","auto");O==="auto"&&D.line===-1&&(O=-1),x.line=O,x.lineAlign=T.get("lineAlign","start"),x.snapToLines=T.get("snapToLines",!0),x.size=T.get("size",100),x.align=T.get("align",L);var S=T.get("position","auto");S==="auto"&&D.position===50&&(S=x.align==="start"||x.align==="left"?0:x.align==="end"||x.align==="right"?100:50),x.position=S}function h(){d=d.replace(/^\s+/,"")}if(h(),a.startTime=s(),h(),d.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+o);d=d.substr(3),h(),a.endTime=s(),h(),l(d,a)}function p(d){return d.replace(/<br(?: \/)?>/gi,`
|
|
`)}var f=function(){function d(){this.state="INITIAL",this.buffer="",this.decoder=new k,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var a=d.prototype;return a.parse=function(o){var s=this;o&&(s.buffer+=s.decoder.decode(o,{stream:!0}));function l(){var S=s.buffer,E=0;for(S=p(S);E<S.length&&S[E]!=="\r"&&S[E]!==`
|
|
`;)++E;var b=S.substr(0,E);return S[E]==="\r"&&++E,S[E]===`
|
|
`&&++E,s.buffer=S.substr(E),b}function h(S){U(S,function(E,b){},/:/)}try{var R="";if(s.state==="INITIAL"){if(!/\r\n|\n/.test(s.buffer))return this;R=l();var x=R.match(/^()?WEBVTT([ \t].*)?$/);if(!x||!x[0])throw new Error("Malformed WebVTT signature.");s.state="HEADER"}for(var T=!1;s.buffer;){if(!/\r\n|\n/.test(s.buffer))return this;T?T=!1:R=l();switch(s.state){case"HEADER":/:/.test(R)?h(R):R||(s.state="ID");continue;case"NOTE":R||(s.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(R)){s.state="NOTE";break}if(!R)continue;if(s.cue=new H.default(0,0,""),s.state="CUE",R.indexOf("-->")===-1){s.cue.id=R;continue}case"CUE":if(!s.cue){s.state="BADCUE";continue}try{g(R,s.cue,s.regionList)}catch(S){s.cue=null,s.state="BADCUE";continue}s.state="CUETEXT";continue;case"CUETEXT":{var O=R.indexOf("-->")!==-1;if(!R||O&&(T=!0)){s.oncue&&s.cue&&s.oncue(s.cue),s.cue=null,s.state="ID";continue}if(s.cue===null)continue;s.cue.text&&(s.cue.text+=`
|
|
`),s.cue.text+=R}continue;case"BADCUE":R||(s.state="ID")}}}catch(S){s.state==="CUETEXT"&&s.cue&&s.oncue&&s.oncue(s.cue),s.cue=null,s.state=s.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},a.flush=function(){var o=this;try{if((o.cue||o.state==="HEADER")&&(o.buffer+=`
|
|
|
|
`,o.parse()),o.state==="INITIAL"||o.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(s){o.onparsingerror&&o.onparsingerror(s)}return o.onflush&&o.onflush(),this},d}()},"./src/utils/webvtt-parser.ts":function(ee,V,I){"use strict";I.r(V),I.d(V,"generateCueId",function(){return f}),I.d(V,"parseWebVTT",function(){return a});var H=I("./src/polyfills/number.ts"),k=I("./src/utils/vttparser.ts"),C=I("./src/demux/id3.ts"),B=I("./src/utils/timescale-conversion.ts"),U=I("./src/remux/mp4-remuxer.ts"),D=/\r\n|\n\r|\n|\r/g,L=function(o,s,l){return l===void 0&&(l=0),o.substr(l,s.length)===s},g=function(o){var s=parseInt(o.substr(-3)),l=parseInt(o.substr(-6,2)),h=parseInt(o.substr(-9,2)),R=o.length>9?parseInt(o.substr(0,o.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(s)||!Object(H.isFiniteNumber)(l)||!Object(H.isFiniteNumber)(h)||!Object(H.isFiniteNumber)(R))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+o);return s+=1e3*l,s+=60*1e3*h,s+=60*60*1e3*R,s},p=function(o){for(var s=5381,l=o.length;l;)s=s*33^o.charCodeAt(--l);return(s>>>0).toString()};function f(c,o,s){return p(c.toString())+p(o.toString())+p(s)}var d=function(o,s,l){var h=o[s],R=o[h.prevCC];if(!R||!R.new&&h.new){o.ccOffset=o.presentationOffset=h.start,h.new=!1;return}for(;(x=R)!==null&&x!==void 0&&x.new;){var x;o.ccOffset+=h.start-R.start,h.new=!1,h=R,R=o[h.prevCC]}o.presentationOffset=l};function a(c,o,s,l,h,R,x,T){var O=new k.VTTParser,S=Object(C.utf8ArrayToStr)(new Uint8Array(c)).trim().replace(D,`
|
|
`).split(`
|
|
`),E=[],b=Object(B.toMpegTsClockFromTimescale)(o,s),v="00:00.000",u=0,_=0,m,y=!0,P=!1;O.oncue=function(M){var j=l[h],W=l.ccOffset,N=(u-b)/9e4;if(j!=null&&j.new&&(_!==void 0?W=l.ccOffset=j.start:d(l,h,N)),N&&(W=N-l.presentationOffset),P){var w=M.endTime-M.startTime,G=Object(U.normalizePts)((M.startTime+W-_)*9e4,R*9e4)/9e4;M.startTime=G,M.endTime=G+w}var J=M.text.trim();M.text=decodeURIComponent(encodeURIComponent(J)),M.id||(M.id=f(M.startTime,M.endTime,J)),M.endTime>0&&E.push(M)},O.onparsingerror=function(M){m=M},O.onflush=function(){if(m){T(m);return}x(E)},S.forEach(function(M){if(y)if(L(M,"X-TIMESTAMP-MAP=")){y=!1,P=!0,M.substr(16).split(",").forEach(function(j){L(j,"LOCAL:")?v=j.substr(6):L(j,"MPEGTS:")&&(u=parseInt(j.substr(7)))});try{_=g(v)/1e3}catch(j){P=!1,m=j}return}else M===""&&(y=!1);O.parse(M+`
|
|
`)}),O.flush()}},"./src/utils/xhr-loader.ts":function(ee,V,I){"use strict";I.r(V);var H=I("./src/utils/logger.ts"),k=I("./src/loader/load-stats.ts"),C=/^age:\s*[\d.]+\s*$/m,B=function(){function U(L){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=L?L.xhrSetup:null,this.stats=new k.LoadStats,this.retryDelay=0}var D=U.prototype;return D.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},D.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},D.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},D.load=function(g,p,f){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=p,this.callbacks=f,this.retryDelay=p.retryDelay,this.loadInternal()},D.loadInternal=function(){var g=this.config,p=this.context;if(!g)return;var f=this.loader=new self.XMLHttpRequest,d=this.stats;d.loading.first=0,d.loaded=0;var a=this.xhrSetup;try{if(a)try{a(f,p.url)}catch(s){f.open("GET",p.url,!0),a(f,p.url)}f.readyState||f.open("GET",p.url,!0);var c=this.context.headers;if(c)for(var o in c)f.setRequestHeader(o,c[o])}catch(s){this.callbacks.onError({code:f.status,text:s.message},p,f);return}p.rangeEnd&&f.setRequestHeader("Range","bytes="+p.rangeStart+"-"+(p.rangeEnd-1)),f.onreadystatechange=this.readystatechange.bind(this),f.onprogress=this.loadprogress.bind(this),f.responseType=p.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),f.send()},D.readystatechange=function(){var g=this.context,p=this.loader,f=this.stats;if(!g||!p)return;var d=p.readyState,a=this.config;if(f.aborted)return;if(d>=2)if(self.clearTimeout(this.requestTimeout),f.loading.first===0&&(f.loading.first=Math.max(self.performance.now(),f.loading.start)),d===4){p.onreadystatechange=null,p.onprogress=null;var c=p.status;if(c>=200&&c<300){f.loading.end=Math.max(self.performance.now(),f.loading.first);var o,s;if(g.responseType==="arraybuffer"?(o=p.response,s=o.byteLength):(o=p.responseText,s=o.length),f.loaded=f.total=s,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(f,g,o,p),!this.callbacks)return;var h={url:p.responseURL,data:o};this.callbacks.onSuccess(h,f,g,p)}else f.retry>=a.maxRetry||c>=400&&c<499?(H.logger.error(c+" while loading "+g.url),this.callbacks.onError({code:c,text:p.statusText},g,p)):(H.logger.warn(c+" while loading "+g.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),f.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout)},D.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},D.loadprogress=function(g){var p=this.stats;p.loaded=g.loaded,g.lengthComputable&&(p.total=g.total)},D.getCacheAge=function(){var g=null;if(this.loader&&C.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");g=p?parseFloat(p):null}return g},U}();V.default=B}}).default})},vHTk:function(st,Qe,Q){st.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|