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.
208 lines
887 KiB
208 lines
887 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[254,5,6,7],{"+NIl":function(ut,Qe,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";ae.defineMode("stex",function(V,D){"use strict";function z(d,s){d.cmdState.push(s)}function N(d){return d.cmdState.length>0?d.cmdState[d.cmdState.length-1]:null}function M(d){var s=d.cmdState.pop();s&&s.closeBracket()}function W(d){for(var s=d.cmdState,u=s.length-1;u>=0;u--){var o=s[u];if(o.name=="DEFAULT")continue;return o}return{styleIdentifier:function(){return null}}}function F(d,s,u){return function(){this.name=d,this.bracketNo=0,this.style=s,this.styles=u,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=F("importmodule","tag",["string","builtin"]),k.documentclass=F("documentclass","tag",["","atom"]),k.usepackage=F("usepackage","tag",["atom"]),k.begin=F("begin","tag",["atom"]),k.end=F("end","tag",["atom"]),k.label=F("label","tag",["atom"]),k.ref=F("ref","tag",["atom"]),k.eqref=F("eqref","tag",["atom"]),k.cite=F("cite","tag",["atom"]),k.bibitem=F("bibitem","tag",["atom"]),k.Bibitem=F("Bibitem","tag",["atom"]),k.RBibitem=F("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(d,s){d.f=s}function g(d,s){var u;if(d.match(/^\\[a-zA-Z@]+/)){var o=d.current().slice(1);return u=k.hasOwnProperty(o)?k[o]:k.DEFAULT,u=new u,z(s,u),R(s,f),u.style}if(d.match(/^\\[$&%#{}_]/))return"tag";if(d.match(/^\\[,;!\/\\]/))return"tag";if(d.match("\\["))return R(s,function(l,h){return p(l,h,"\\]")}),"keyword";if(d.match("\\("))return R(s,function(l,h){return p(l,h,"\\)")}),"keyword";if(d.match("$$"))return R(s,function(l,h){return p(l,h,"$$")}),"keyword";if(d.match("$"))return R(s,function(l,h){return p(l,h,"$")}),"keyword";var a=d.next();if(a=="%")return d.skipToEnd(),"comment";if(a=="}"||a=="]"){if(u=N(s),u)u.closeBracket(a),R(s,f);else return"error";return"bracket"}else return a=="{"||a=="["?(u=k.DEFAULT,u=new u,z(s,u),"bracket"):/\d/.test(a)?(d.eatWhile(/[\w.%]/),"atom"):(d.eatWhile(/[\w\-_]/),u=W(s),u.name=="begin"&&(u.argument=d.current()),u.styleIdentifier())}function p(d,s,u){if(d.eatSpace())return null;if(u&&d.match(u))return R(s,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,s){var u=d.peek(),o;return u=="{"||u=="["?(o=N(s),o.openBracket(u),d.eat(u),R(s,g),"bracket"):/[ \t\r]/.test(u)?(d.eat(u),null):(R(s,g),M(s),g(d,s))}return{startState:function(){var d=D.inMathMode?function(s,u){return p(s,u)}:g;return{cmdState:[],f:d}},copyState:function(d){return{cmdState:d.cmdState.slice(),f:d.f}},token:function(d,s){return s.f(d,s)},blankLine:function(d){d.f=g,d.cmdState.length=0},lineComment:"%"}}),ae.defineMIME("text/x-stex","stex"),ae.defineMIME("text/x-latex","stex")})},"+ua5":function(ut,Qe,ne){},"19Vz":function(ut,Qe,ne){(function(ae){ae(ne("VrN/"))})(function(ae){ae.defineOption("placeholder","",function(F,k,R){var g=R&&R!=ae.Init;if(k&&!g)F.on("blur",N),F.on("change",M),F.on("swapDoc",M),ae.on(F.getInputField(),"compositionupdate",F.state.placeholderCompose=function(){z(F)}),M(F);else if(!k&&g){F.off("blur",N),F.off("change",M),F.off("swapDoc",M),ae.off(F.getInputField(),"compositionupdate",F.state.placeholderCompose),V(F);var p=F.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}k&&!F.hasFocus()&&N(F)});function V(F){F.state.placeholder&&(F.state.placeholder.parentNode.removeChild(F.state.placeholder),F.state.placeholder=null)}function D(F){V(F);var k=F.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=F.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var R=F.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),k.appendChild(R),F.display.lineSpace.insertBefore(k,F.display.lineSpace.firstChild)}function z(F){setTimeout(function(){var k=!1,R=F.getInputField();R.nodeName=="TEXTAREA"?k=!R.value:F.lineCount()==1&&(k=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),k?D(F):V(F)},20)}function N(F){W(F)&&D(F)}function M(F){var k=F.getWrapperElement(),R=W(F);k.className=k.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?D(F):V(F)}function W(F){return F.lineCount()===1&&F.getLine(0)===""}})},"1eCo":function(ut,Qe,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ae.defineMode("xml",function(z,N){var M=z.indentUnit,W={},F=N.htmlMode?V:D;for(var k in F)W[k]=F[k];for(var k in N)W[k]=N[k];var R,g;function p(c,y){function m(I){return y.tokenize=I,I(c,y)}var _=c.next();if(_=="<")return c.eat("!")?c.eat("[")?c.match("CDATA[")?m(s("atom","]]>")):null:c.match("--")?m(s("comment","-->")):c.match("DOCTYPE",!0,!0)?(c.eatWhile(/[\w\._\-]/),m(u(1))):null:c.eat("?")?(c.eatWhile(/[\w\._\-]/),y.tokenize=s("meta","?>"),"meta"):(R=c.eat("/")?"closeTag":"openTag",y.tokenize=f,"tag bracket");if(_=="&"){var P;return c.eat("#")?c.eat("x")?P=c.eatWhile(/[a-fA-F\d]/)&&c.eat(";"):P=c.eatWhile(/[\d]/)&&c.eat(";"):P=c.eatWhile(/[\w\.\-:]/)&&c.eat(";"),P?"atom":"error"}else return c.eatWhile(/[^&<]/),null}p.isInText=!0;function f(c,y){var m=c.next();if(m==">"||m=="/"&&c.eat(">"))return y.tokenize=p,R=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return R="equals",null;if(m=="<"){y.tokenize=p,y.state=h,y.tagName=y.tagStart=null;var _=y.tokenize(c,y);return _?_+" tag error":"tag error"}else return/[\'\"]/.test(m)?(y.tokenize=d(m),y.stringStartCol=c.column(),y.tokenize(c,y)):(c.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function d(c){var y=function(m,_){for(;!m.eol();)if(m.next()==c){_.tokenize=f;break}return"string"};return y.isInAttribute=!0,y}function s(c,y){return function(m,_){for(;!m.eol();){if(m.match(y)){_.tokenize=p;break}m.next()}return c}}function u(c){return function(y,m){for(var _;(_=y.next())!=null;){if(_=="<")return m.tokenize=u(c+1),m.tokenize(y,m);if(_==">")if(c==1){m.tokenize=p;break}else return m.tokenize=u(c-1),m.tokenize(y,m)}return"meta"}}function o(c,y,m){this.prev=c.context,this.tagName=y,this.indent=c.indented,this.startOfLine=m,(W.doNotIndent.hasOwnProperty(y)||c.context&&c.context.noIndent)&&(this.noIndent=!0)}function a(c){c.context&&(c.context=c.context.prev)}function l(c,y){for(var m;;){if(!c.context)return;if(m=c.context.tagName,!W.contextGrabbers.hasOwnProperty(m)||!W.contextGrabbers[m].hasOwnProperty(y))return;a(c)}}function h(c,y,m){return c=="openTag"?(m.tagStart=y.column(),A):c=="closeTag"?x:h}function A(c,y,m){return c=="word"?(m.tagName=y.current(),g="tag",S):W.allowMissingTagName&&c=="endTag"?(g="tag bracket",S(c,y,m)):(g="error",A)}function x(c,y,m){if(c=="word"){var _=y.current();return m.context&&m.context.tagName!=_&&W.implicitlyClosed.hasOwnProperty(m.context.tagName)&&a(m),m.context&&m.context.tagName==_||W.matchClosing===!1?(g="tag",T):(g="tag error",O)}else return W.allowMissingTagName&&c=="endTag"?(g="tag bracket",T(c,y,m)):(g="error",O)}function T(c,y,m){return c!="endTag"?(g="error",T):(a(m),h)}function O(c,y,m){return g="error",T(c,y,m)}function S(c,y,m){if(c=="word")return g="attribute",E;if(c=="endTag"||c=="selfcloseTag"){var _=m.tagName,P=m.tagStart;return m.tagName=m.tagStart=null,c=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(_)?l(m,_):(l(m,_),m.context=new o(m,_,P==m.indented)),h}return g="error",S}function E(c,y,m){return c=="equals"?w:(W.allowMissing||(g="error"),S(c,y,m))}function w(c,y,m){return c=="string"?b:c=="word"&&W.allowUnquoted?(g="string",S):(g="error",S(c,y,m))}function b(c,y,m){return c=="string"?b:S(c,y,m)}return{startState:function(c){var y={tokenize:p,state:h,indented:c||0,tagName:null,tagStart:null,context:null};return c!=null&&(y.baseIndent=c),y},token:function(c,y){if(!y.tagName&&c.sol()&&(y.indented=c.indentation()),c.eatSpace())return null;R=null;var m=y.tokenize(c,y);return(m||R)&&m!="comment"&&(g=null,y.state=y.state(R||m,c,y),g&&(m=g=="error"?m+" error":g)),m},indent:function(c,y,m){var _=c.context;if(c.tokenize.isInAttribute)return c.tagStart==c.indented?c.stringStartCol+1:c.indented+M;if(_&&_.noIndent)return ae.Pass;if(c.tokenize!=f&&c.tokenize!=p)return m?m.match(/^(\s*)/)[0].length:0;if(c.tagName)return W.multilineTagIndentPastTag!==!1?c.tagStart+c.tagName.length+2:c.tagStart+M*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(y))return 0;var P=y&&/^<(\/)?([\w_:\.-]*)/.exec(y);if(P&&P[1])for(;_;)if(_.tagName==P[2]){_=_.prev;break}else if(W.implicitlyClosed.hasOwnProperty(_.tagName))_=_.prev;else break;else if(P)for(;_;){var I=W.contextGrabbers[_.tagName];if(I&&I.hasOwnProperty(P[2]))_=_.prev;else break}for(;_&&_.prev&&!_.startOfLine;)_=_.prev;return _?_.indent+M:c.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(c){c.state==w&&(c.state=S)},xmlCurrentTag:function(c){return c.tagName?{name:c.tagName,close:c.type=="closeTag"}:null},xmlCurrentContext:function(c){for(var y=[],m=c.context;m;m=m.prev)m.tagName&&y.push(m.tagName);return y.reverse()}}}),ae.defineMIME("text/xml","xml"),ae.defineMIME("application/xml","xml"),ae.mimeModes.hasOwnProperty("text/html")||ae.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"5VLF":function(ut,Qe,ne){"use strict";var ae,V;function D(z,N,M){var W=function(F,k){return z.js_beautify(F,k)};return W.js=z.js_beautify,W.css=N.css_beautify,W.html=M.html_beautify,W.js_beautify=z.js_beautify,W.css_beautify=N.css_beautify,W.html_beautify=M.html_beautify,W}!(ae=[ne("6UM0"),ne("TXwP"),ne("psGv")],V=function(z,N,M){return D(z,N,M)}.apply(Qe,ae),V!==void 0&&(ut.exports=V))},"6UM0":function(ut,Qe,ne){var ae,V;(function(){var D;(function(){"use strict";var N=[function(k,R,g){var p=g(1).Beautifier,f=g(5).Options;function d(s,u){var o=new p(s,u);return o.beautify()}k.exports=d,k.exports.defaultOptions=function(){return new f}},function(k,R,g){var p=g(2).Output,f=g(3).Token,d=g(4),s=g(5).Options,u=g(7).Tokenizer,o=g(7).line_starters,a=g(7).positionable_operators,l=g(7).TOKEN;function h(v,j){return j.indexOf(v)!==-1}function A(v){return v.replace(/^\s+/g,"")}function x(v){for(var j={},G=0;G<v.length;G++)j[v[G].replace(/-/g,"_")]=v[G];return j}function T(v,j){return v&&v.type===l.RESERVED&&v.text===j}function O(v,j){return v&&v.type===l.RESERVED&&h(v.text,j)}var S=["case","return","do","if","throw","else","await","break","continue","async"],E=["before-newline","after-newline","preserve-newline"],w=x(E),b=[w.before_newline,w.preserve_newline],c={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function y(v,j){if(j.multiline_frame||j.mode===c.ForInitializer||j.mode===c.Conditional)return;v.remove_indent(j.start_line_index)}function m(v){v=v.replace(d.allLineBreaks,`
|
|
`);for(var j=[],G=v.indexOf(`
|
|
`);G!==-1;)j.push(v.substring(0,G)),v=v.substring(G+1),G=v.indexOf(`
|
|
`);return v.length&&j.push(v),j}function _(v){return v===c.ArrayLiteral}function P(v){return h(v,[c.Expression,c.ForInitializer,c.Conditional])}function I(v,j){for(var G=0;G<v.length;G++){var J=v[G].trim();if(J.charAt(0)!==j)return!1}return!0}function B(v,j){for(var G=0,J=v.length,ee;G<J;G++)if(ee=v[G],ee&&ee.indexOf(j)!==0)return!1;return!0}function U(v,j){j=j||{},this._source_text=v||"",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 s(j)}U.prototype.create_flags=function(v,j){var G=0;v&&(G=v.indentation_level,!this._output.just_added_newline()&&v.line_indent_level>G&&(G=v.line_indent_level));var J={mode:j,parent:v,last_token:v?v.last_token:new f(l.START_BLOCK,""),last_word:v?v.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:G,alignment:0,line_indent_level:v?v.line_indent_level:G,start_line_index:this._output.get_line_number(),ternary_depth:0};return J},U.prototype._reset=function(v){var j=v.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new p(this._options,j),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(c.BlockStatement);var G=new u(v,this._options);return this._tokens=G.tokenize(),v},U.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v,j=this._reset(this._source_text),G=this._options.eol;this._options.eol==="auto"&&(G=`
|
|
`,j&&d.lineBreak.test(j||"")&&(G=j.match(d.lineBreak)[0]));for(var J=this._tokens.next();J;)this.handle_token(J),this._last_last_text=this._flags.last_token.text,this._flags.last_token=J,J=this._tokens.next();return v=this._output.get_code(G),v},U.prototype.handle_token=function(v,j){v.type===l.START_EXPR?this.handle_start_expr(v):v.type===l.END_EXPR?this.handle_end_expr(v):v.type===l.START_BLOCK?this.handle_start_block(v):v.type===l.END_BLOCK?this.handle_end_block(v):v.type===l.WORD?this.handle_word(v):v.type===l.RESERVED?this.handle_word(v):v.type===l.SEMICOLON?this.handle_semicolon(v):v.type===l.STRING?this.handle_string(v):v.type===l.EQUALS?this.handle_equals(v):v.type===l.OPERATOR?this.handle_operator(v):v.type===l.COMMA?this.handle_comma(v):v.type===l.BLOCK_COMMENT?this.handle_block_comment(v,j):v.type===l.COMMENT?this.handle_comment(v,j):v.type===l.DOT?this.handle_dot(v):v.type===l.EOF?this.handle_eof(v):v.type===l.UNKNOWN?this.handle_unknown(v,j):this.handle_unknown(v,j)},U.prototype.handle_whitespace_and_comments=function(v,j){var G=v.newlines,J=this._options.keep_array_indentation&&_(this._flags.mode);if(v.comments_before)for(var ee=v.comments_before.next();ee;)this.handle_whitespace_and_comments(ee,j),this.handle_token(ee,j),ee=v.comments_before.next();if(J)for(var ye=0;ye<G;ye+=1)this.print_newline(ye>0,j);else if(this._options.max_preserve_newlines&&G>this._options.max_preserve_newlines&&(G=this._options.max_preserve_newlines),this._options.preserve_newlines&&G>1){this.print_newline(!1,j);for(var he=1;he<G;he+=1)this.print_newline(!0,j)}};var C=["async","break","continue","return","throw","yield"];U.prototype.allow_wrap_or_preserved_newline=function(v,j){if(j=j===void 0?!1:j,this._output.just_added_newline())return;var G=this._options.preserve_newlines&&v.newlines||j,J=h(this._flags.last_token.text,a)||h(v.text,a);if(J){var ee=h(this._flags.last_token.text,a)&&h(this._options.operator_position,b)||h(v.text,a);G=G&&ee}if(G)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(O(this._flags.last_token,C))return;this._output.set_wrap_point()}},U.prototype.print_newline=function(v,j){if(!j&&(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 G=this._tokens.peek();this._flags.mode===c.Statement&&!(this._flags.if_block&&T(G,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(v)&&(this._flags.multiline_frame=!0)},U.prototype.print_token_line_indentation=function(v){this._output.just_added_newline()&&(this._options.keep_array_indentation&&v.newlines&&(v.text==="["||_(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(v.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))},U.prototype.print_token=function(v){if(this._output.raw){this._output.add_raw_token(v);return}if(this._options.comma_first&&v.previous&&v.previous.type===l.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var j=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(j),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(v),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(v),this._output.non_breaking_space=!0,this._output.add_token(v.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},U.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},U.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))},U.prototype.set_mode=function(v){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,v),this._flags=this.create_flags(this._previous_flags,v),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},U.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===c.Statement&&y(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},U.prototype.start_of_object_property=function(){return this._flags.parent.mode===c.ObjectLiteral&&this._flags.mode===c.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"]))},U.prototype.start_of_statement=function(v){var j=!1;return j=j||O(this._flags.last_token,["var","let","const"])&&v.type===l.WORD,j=j||T(this._flags.last_token,"do"),j=j||!(this._flags.parent.mode===c.ObjectLiteral&&this._flags.mode===c.Statement)&&O(this._flags.last_token,C)&&!v.newlines,j=j||T(this._flags.last_token,"else")&&!(T(v,"if")&&!v.comments_before),j=j||this._flags.last_token.type===l.END_EXPR&&(this._previous_flags.mode===c.ForInitializer||this._previous_flags.mode===c.Conditional),j=j||this._flags.last_token.type===l.WORD&&this._flags.mode===c.BlockStatement&&!this._flags.in_case&&!(v.text==="--"||v.text==="++")&&this._last_last_text!=="function"&&v.type!==l.WORD&&v.type!==l.RESERVED,j=j||this._flags.mode===c.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"])),j?(this.set_mode(c.Statement),this.indent(),this.handle_whitespace_and_comments(v,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v,O(v,["do","for","if","while"])),!0):!1},U.prototype.handle_start_expr=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v);var j=c.Expression;if(v.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(v),this.set_mode(j),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}j=c.ArrayLiteral,_(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,j=c.ForInitializer):h(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,j=c.Conditional):h(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&v.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(v);else if(this._flags.last_token.type===l.WORD){this._output.space_before_token=!1;var G=this._tokens.peek(-3);if(this._options.space_after_named_function&&G){var J=this._tokens.peek(-4);O(G,["async","function"])||G.text==="*"&&O(J,["async","function"])?this._output.space_before_token=!0:this._flags.mode===c.ObjectLiteral?(G.text==="{"||G.text===","||G.text==="*"&&(J.text==="{"||J.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(v);(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===c.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(v,v.newlines),this.print_token(v),this.set_mode(j),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},U.prototype.handle_end_expr=function(v){for(;this._flags.mode===c.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(v,v.text==="]"&&_(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(v),this.restore_mode(),y(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===c.Conditional&&(this._previous_flags.mode=c.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},U.prototype.handle_start_block=function(v){this.handle_whitespace_and_comments(v);var j=this._tokens.peek(),G=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===l.END_EXPR?(this.set_mode(c.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(c.BlockStatement):G&&(h(G.text,[":",","])&&h(j.type,[l.STRING,l.WORD,l.RESERVED])||h(j.text,["get","set","..."])&&h(G.type,[l.WORD,l.RESERVED]))?h(this._last_last_text,["class","interface"])&&!h(G.text,[":",","])?this.set_mode(c.BlockStatement):this.set_mode(c.ObjectLiteral):this._flags.last_token.type===l.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(c.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(c.ObjectLiteral):this.set_mode(c.BlockStatement),this._flags.last_token&&(O(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var J=!j.comments_before&&j.text==="}",ee=J&&this._flags.last_word==="function"&&this._flags.last_token.type===l.END_EXPR;if(this._options.brace_preserve_inline){var ye=0,he=null;this._flags.inline_frame=!0;do if(ye+=1,he=this._tokens.peek(ye-1),he.newlines){this._flags.inline_frame=!1;break}while(he.type!==l.EOF&&!(he.type===l.END_BLOCK&&he.opened===v))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==l.OPERATOR&&(ee||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):(_(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(v),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(v),this.indent(),!J&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},U.prototype.handle_end_block=function(v){for(this.handle_whitespace_and_comments(v);this._flags.mode===c.Statement;)this.restore_mode();var j=this._flags.last_token.type===l.START_BLOCK;this._flags.inline_frame&&!j?this._output.space_before_token=!0:this._options.brace_style==="expand"?j||this.print_newline():j||(_(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(v)},U.prototype.handle_word=function(v){if(v.type===l.RESERVED){if(h(v.text,["set","get"])&&this._flags.mode!==c.ObjectLiteral)v.type=l.WORD;else if(v.text==="import"&&h(this._tokens.peek().text,["(","."]))v.type=l.WORD;else if(h(v.text,["as","from"])&&!this._flags.import_block)v.type=l.WORD;else if(this._flags.mode===c.ObjectLiteral){var j=this._tokens.peek();j.text===":"&&(v.type=l.WORD)}}if(this.start_of_statement(v)?O(this._flags.last_token,["var","let","const"])&&v.type===l.WORD&&(this._flags.declaration_statement=!0):v.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(v),this.print_newline()):this.handle_whitespace_and_comments(v),this._flags.do_block&&!this._flags.do_while)if(T(v,"while")){this._output.space_before_token=!0,this.print_token(v),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(v,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===c.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&O(v,["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(v),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(v)),T(v,"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()&&!v.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,C)?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)||_(this._flags.mode))||this.print_newline(),this.print_token(v),this._flags.last_word=v.text;return}var G="NONE";if(this._flags.last_token.type===l.END_BLOCK?this._previous_flags.inline_frame?G="SPACE":O(v,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines?G="NEWLINE":(G="SPACE",this._output.space_before_token=!0):G="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&this._flags.mode===c.BlockStatement?G="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&P(this._flags.mode)?G="SPACE":this._flags.last_token.type===l.STRING?G="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===c.ObjectLiteral&&h(this._last_last_text,["{",","]))?G="SPACE":this._flags.last_token.type===l.START_BLOCK?this._flags.inline_frame?G="SPACE":G="NEWLINE":this._flags.last_token.type===l.END_EXPR&&(this._output.space_before_token=!0,G="NEWLINE"),O(v,o)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?G="SPACE":G="NEWLINE"),O(v,["else","catch","finally"]))if((!(this._flags.last_token.type===l.END_BLOCK&&this._previous_flags.mode===c.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var J=this._output.current_line;J.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else G==="NEWLINE"?O(this._flags.last_token,S)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&O(v,["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(v,["var","let","const"]))&&this._flags.last_token.text!==":"&&(T(v,"if")&&T(v.previous,"else")?this._output.space_before_token=!0:this.print_newline()):O(v,o)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&_(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():G==="SPACE"&&(this._output.space_before_token=!0);v.previous&&(v.previous.type===l.WORD||v.previous.type===l.RESERVED)&&(this._output.space_before_token=!0),this.print_token(v),this._flags.last_word=v.text,v.type===l.RESERVED&&(v.text==="do"?this._flags.do_block=!0:v.text==="if"?this._flags.if_block=!0:v.text==="import"?this._flags.import_block=!0:this._flags.import_block&&T(v,"from")&&(this._flags.import_block=!1))},U.prototype.handle_semicolon=function(v){this.start_of_statement(v)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(v);for(var j=this._tokens.peek();this._flags.mode===c.Statement&&!(this._flags.if_block&&T(j,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(v)},U.prototype.handle_string=function(v){v.text.startsWith("`")&&v.newlines===0&&v.whitespace_before===""&&(v.previous.text===")"||this._flags.last_token.type===l.WORD)||(this.start_of_statement(v)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(v),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(v):v.text.startsWith("`")&&this._flags.last_token.type===l.END_EXPR&&(v.previous.text==="]"||v.previous.text===")")&&v.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(v)},U.prototype.handle_equals=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0},U.prototype.handle_comma=function(v){this.handle_whitespace_and_comments(v,!0),this.print_token(v),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(v)):this._flags.mode===c.ObjectLiteral||this._flags.mode===c.Statement&&this._flags.parent.mode===c.ObjectLiteral?(this._flags.mode===c.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)},U.prototype.handle_operator=function(v){var j=v.text==="*"&&(O(this._flags.last_token,["function","yield"])||h(this._flags.last_token.type,[l.START_BLOCK,l.COMMA,l.END_BLOCK,l.SEMICOLON])),G=h(v.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(v)){var J=!j;this.handle_whitespace_and_comments(v,J)}if(v.text==="*"&&this._flags.last_token.type===l.DOT){this.print_token(v);return}if(v.text==="::"){this.print_token(v);return}if(this._flags.last_token.type===l.OPERATOR&&h(this._options.operator_position,b)&&this.allow_wrap_or_preserved_newline(v),v.text===":"&&this._flags.in_case){this.print_token(v),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 ee=!0,ye=!0,he=!1;if(v.text===":"?this._flags.ternary_depth===0?ee=!1:(this._flags.ternary_depth-=1,he=!0):v.text==="?"&&(this._flags.ternary_depth+=1),!G&&!j&&this._options.preserve_newlines&&h(v.text,a)){var ge=v.text===":",pe=ge&&he,oe=ge&&!he;switch(this._options.operator_position){case w.before_newline:this._output.space_before_token=!oe,this.print_token(v),(!ge||pe)&&this.allow_wrap_or_preserved_newline(v),this._output.space_before_token=!0;return;case w.after_newline:this._output.space_before_token=!0,!ge||pe?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(v):this._output.space_before_token=!1,this.print_token(v),this._output.space_before_token=!0;return;case w.preserve_newline:oe||this.allow_wrap_or_preserved_newline(v),ee=!(this._output.just_added_newline()||oe),this._output.space_before_token=ee,this.print_token(v),this._output.space_before_token=!0;return}}if(j){this.allow_wrap_or_preserved_newline(v),ee=!1;var ie=this._tokens.peek();ye=ie&&h(ie.type,[l.WORD,l.RESERVED])}else if(v.text==="...")this.allow_wrap_or_preserved_newline(v),ee=this._flags.last_token.type===l.START_BLOCK,ye=!1;else if(h(v.text,["--","++","!","~"])||G){if((this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR)&&this.allow_wrap_or_preserved_newline(v),ee=!1,ye=!1,v.newlines&&(v.text==="--"||v.text==="++"||v.text==="~")){var ue=O(this._flags.last_token,S)&&v.newlines;ue&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(ue,!0)}this._flags.last_token.text===";"&&P(this._flags.mode)&&(ee=!0),this._flags.last_token.type===l.RESERVED?ee=!0:this._flags.last_token.type===l.END_EXPR?ee=!(this._flags.last_token.text==="]"&&(v.text==="--"||v.text==="++")):this._flags.last_token.type===l.OPERATOR&&(ee=h(v.text,["--","-","++","+"])&&h(this._flags.last_token.text,["--","-","++","+"]),h(v.text,["+","-"])&&h(this._flags.last_token.text,["--","++"])&&(ye=!0)),(this._flags.mode===c.BlockStatement&&!this._flags.inline_frame||this._flags.mode===c.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||ee,this.print_token(v),this._output.space_before_token=ye},U.prototype.handle_block_comment=function(v,j){if(this._output.raw){this._output.add_raw_token(v),v.directives&&v.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(v.directives){this.print_newline(!1,j),this.print_token(v),v.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!d.newline.test(v.text)&&!v.newlines){this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0;return}else this.print_block_commment(v,j)},U.prototype.print_block_commment=function(v,j){var G=m(v.text),J,ee=!1,ye=!1,he=v.whitespace_before,ge=he.length;if(this.print_newline(!1,j),this.print_token_line_indentation(v),this._output.add_token(G[0]),this.print_newline(!1,j),G.length>1){for(G=G.slice(1),ee=I(G,"*"),ye=B(G,he),ee&&(this._flags.alignment=1),J=0;J<G.length;J++)ee?(this.print_token_line_indentation(v),this._output.add_token(A(G[J]))):ye&&G[J]?(this.print_token_line_indentation(v),this._output.add_token(G[J].substring(ge))):(this._output.current_line.set_indent(-1),this._output.add_token(G[J])),this.print_newline(!1,j);this._flags.alignment=0}},U.prototype.handle_comment=function(v,j){v.newlines?this.print_newline(!1,j):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(v),this.print_newline(!1,j)},U.prototype.handle_dot=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v,!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(v,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(v)},U.prototype.handle_unknown=function(v,j){this.print_token(v),v.text[v.text.length-1]===`
|
|
`&&this.print_newline(!1,j)},U.prototype.handle_eof=function(v){for(;this._flags.mode===c.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v)},k.exports.Beautifier=U},function(k){function R(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=[]}R.prototype.clone_empty=function(){var f=new R(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},R.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},R.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},R.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))},R.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)},R.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},R.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},R.prototype.is_empty=function(){return this.__items.length===0},R.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},R.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},R.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},R.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},R.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},R.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},R.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 s=this.__base_string_length;return d=d||0,f<0&&(s=0),s+=f*this.__indent_size,s+=d,s},g.prototype.get_indent_string=function(f,d){var s=this.__base_string;return d=d||0,f<0&&(f=0,s=""),d+=f*this.__indent_size,this.__ensure_cache(d),s+=this.__cache[d],s},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,s="";this.__indent_size&&f>=this.__indent_size&&(d=Math.floor(f/this.__indent_size),f-=d*this.__indent_size,s=new Array(d+1).join(this.__indent_string)),f&&(s+=new Array(f+1).join(" ")),this.__cache.push(s)};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 R(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 s=this.__lines.join(`
|
|
`);return f!==`
|
|
`&&(s=s.replace(/[\n]/g,f)),s},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 s=this.__lines.length-2;s>=0;){var u=this.__lines[s];if(u.is_empty())break;if(u.item(0).indexOf(f)!==0&&u.item(-1)!==d){this.__lines.splice(s+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},k.exports.Output=p},function(k){function R(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}k.exports.Token=R},function(k,R){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",s="(?:\\\\u[0-9a-fA-F]{4}|["+g+f+"])",u="(?:\\\\u[0-9a-fA-F]{4}|["+p+f+d+"])*";R.identifier=new RegExp(s+u,"g"),R.identifierStart=new RegExp(s),R.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+f+d+"])+");var o=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;R.newline=/[\n\r\u2028\u2029]/,R.lineBreak=new RegExp(`\r
|
|
|`+R.newline.source),R.allLineBreaks=new RegExp(R.lineBreak.source,"g")},function(k,R,g){var p=g(6).Options,f=["before-newline","after-newline","preserve-newline"];function d(s){p.call(this,s,"js");var u=this.raw_options.brace_style||null;u==="expand-strict"?this.raw_options.brace_style="expand":u==="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 a=0;a<o.length;a++)o[a]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=o[a];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,k.exports.Options=d},function(k){function R(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"])}R.prototype._get_array=function(f,d){var s=this.raw_options[f],u=d||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(u=s.concat()):typeof s=="string"&&(u=s.split(/[^a-zA-Z0-9_\/\-]+/)),u},R.prototype._get_boolean=function(f,d){var s=this.raw_options[f],u=s===void 0?!!d:!!s;return u},R.prototype._get_characters=function(f,d){var s=this.raw_options[f],u=d||"";return typeof s=="string"&&(u=s.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),u},R.prototype._get_number=function(f,d){var s=this.raw_options[f];d=parseInt(d,10),isNaN(d)&&(d=0);var u=parseInt(s,10);return isNaN(u)&&(u=d),u},R.prototype._get_selection=function(f,d,s){var u=this._get_selection_list(f,d,s);if(u.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 u[0]},R.prototype._get_selection_list=function(f,d,s){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[d[0]],!this._is_valid_selection(s,d))throw new Error("Invalid Default Value!");var u=this._get_array(f,s);if(!this._is_valid_selection(u,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 u},R.prototype._is_valid_selection=function(f,d){return f.length&&d.length&&!f.some(function(s){return d.indexOf(s)===-1})};function g(f,d){var s={};f=p(f);var u;for(u in f)u!==d&&(s[u]=f[u]);if(d&&f[d])for(u in f[d])s[u]=f[d][u];return s}function p(f){var d={},s;for(s in f){var u=s.replace(/-/g,"_");d[u]=f[s]}return d}k.exports.Options=R,k.exports.normalizeOpts=p,k.exports.mergeOpts=g},function(k,R,g){var p=g(8).InputScanner,f=g(9).Tokenizer,d=g(9).TOKEN,s=g(13).Directives,u=g(4),o=g(12).Pattern,a=g(14).TemplatablePattern;function l(I,B){return B.indexOf(I)!==-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},A=new s(/\/\*/,/\*\//),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 w=new RegExp(E),b="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),c=b.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),y=new RegExp("^(?:"+c.join("|")+")$"),m,_=function(I,B){f.call(this,I,B),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var U=new o(this._input),C=new a(this._input).read_options(this._options);this.__patterns={template:C,identifier:C.starting_with(u.identifier).matching(u.identifierMatch),number:U.matching(x),punct:U.matching(w),comment:U.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:U.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:U.matching(/<!--/),html_comment_end:U.matching(/-->/),include:U.starting_with(/#include/).until_after(u.lineBreak),shebang:U.starting_with(/#!/).until_after(u.lineBreak),xml:U.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:C.until(/['\\\n\r\u2028\u2029]/),double_quote:C.until(/["\\\n\r\u2028\u2029]/),template_text:C.until(/[`\\$]/),template_expression:C.until(/[`}\\]/)}};_.prototype=new f,_.prototype._is_comment=function(I){return I.type===h.COMMENT||I.type===h.BLOCK_COMMENT||I.type===h.UNKNOWN},_.prototype._is_opening=function(I){return I.type===h.START_BLOCK||I.type===h.START_EXPR},_.prototype._is_closing=function(I,B){return(I.type===h.END_BLOCK||I.type===h.END_EXPR)&&B&&(I.text==="]"&&B.text==="["||I.text===")"&&B.text==="("||I.text==="}"&&B.text==="{")},_.prototype._reset=function(){m=!1},_.prototype._get_next_token=function(I,B){var U=null;this._readWhitespace();var C=this._input.peek();return C===null?this._create_token(h.EOF,""):(U=U||this._read_non_javascript(C),U=U||this._read_string(C),U=U||this._read_word(I),U=U||this._read_singles(C),U=U||this._read_comment(C),U=U||this._read_regexp(C,I),U=U||this._read_xml(C,I),U=U||this._read_punctuation(),U=U||this._create_token(h.UNKNOWN,this._input.next()),U)},_.prototype._read_word=function(I){var B;if(B=this.__patterns.identifier.read(),B!=="")return B=B.replace(u.allLineBreaks,`
|
|
`),!(I.type===h.DOT||I.type===h.RESERVED&&(I.text==="set"||I.text==="get"))&&y.test(B)?(B==="in"||B==="of")&&(I.type===h.WORD||I.type===h.STRING)?this._create_token(h.OPERATOR,B):this._create_token(h.RESERVED,B):this._create_token(h.WORD,B);if(B=this.__patterns.number.read(),B!=="")return this._create_token(h.WORD,B)},_.prototype._read_singles=function(I){var B=null;return I==="("||I==="["?B=this._create_token(h.START_EXPR,I):I===")"||I==="]"?B=this._create_token(h.END_EXPR,I):I==="{"?B=this._create_token(h.START_BLOCK,I):I==="}"?B=this._create_token(h.END_BLOCK,I):I===";"?B=this._create_token(h.SEMICOLON,I):I==="."&&O.test(this._input.peek(1))?B=this._create_token(h.DOT,I):I===","&&(B=this._create_token(h.COMMA,I)),B&&this._input.next(),B},_.prototype._read_punctuation=function(){var I=this.__patterns.punct.read();if(I!=="")return I==="="?this._create_token(h.EQUALS,I):I==="?."?this._create_token(h.DOT,I):this._create_token(h.OPERATOR,I)},_.prototype._read_non_javascript=function(I){var B="";if(I==="#"){if(this._is_first_token()&&(B=this.__patterns.shebang.read(),B))return this._create_token(h.UNKNOWN,B.trim()+`
|
|
`);if(B=this.__patterns.include.read(),B)return this._create_token(h.UNKNOWN,B.trim()+`
|
|
`);I=this._input.next();var U="#";if(this._input.hasNext()&&this._input.testChar(T)){do I=this._input.next(),U+=I;while(this._input.hasNext()&&I!=="#"&&I!=="=");return I==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(U+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(U+="{}",this._input.next(),this._input.next())),this._create_token(h.WORD,U)}this._input.back()}else if(I==="<"&&this._is_first_token()){if(B=this.__patterns.html_comment_start.read(),B){for(;this._input.hasNext()&&!this._input.testChar(u.newline);)B+=this._input.next();return m=!0,this._create_token(h.COMMENT,B)}}else if(m&&I==="-"&&(B=this.__patterns.html_comment_end.read(),B))return m=!1,this._create_token(h.COMMENT,B);return null},_.prototype._read_comment=function(I){var B=null;if(I==="/"){var U="";if(this._input.peek(1)==="*"){U=this.__patterns.block_comment.read();var C=A.get_directives(U);C&&C.ignore==="start"&&(U+=A.readIgnored(this._input)),U=U.replace(u.allLineBreaks,`
|
|
`),B=this._create_token(h.BLOCK_COMMENT,U),B.directives=C}else this._input.peek(1)==="/"&&(U=this.__patterns.comment.read(),B=this._create_token(h.COMMENT,U))}return B},_.prototype._read_string=function(I){if(I==="`"||I==="'"||I==='"'){var B=this._input.next();return this.has_char_escapes=!1,I==="`"?B+=this._read_string_recursive("`",!0,"${"):B+=this._read_string_recursive(I),this.has_char_escapes&&this._options.unescape_strings&&(B=P(B)),this._input.peek()===I&&(B+=this._input.next()),B=B.replace(u.allLineBreaks,`
|
|
`),this._create_token(h.STRING,B)}return null},_.prototype._allow_regexp_or_xml=function(I){return I.type===h.RESERVED&&l(I.text,["return","case","throw","else","do","typeof","yield"])||I.type===h.END_EXPR&&I.text===")"&&I.opened.previous.type===h.RESERVED&&l(I.opened.previous.text,["if","while","for"])||l(I.type,[h.COMMENT,h.START_EXPR,h.START_BLOCK,h.START,h.END_BLOCK,h.OPERATOR,h.EQUALS,h.EOF,h.SEMICOLON,h.COMMA])},_.prototype._read_regexp=function(I,B){if(I==="/"&&this._allow_regexp_or_xml(B)){for(var U=this._input.next(),C=!1,v=!1;this._input.hasNext()&&(C||v||this._input.peek()!==I)&&!this._input.testChar(u.newline);)U+=this._input.peek(),C?C=!1:(C=this._input.peek()==="\\",this._input.peek()==="["?v=!0:this._input.peek()==="]"&&(v=!1)),this._input.next();return this._input.peek()===I&&(U+=this._input.next(),U+=this._input.read(u.identifier)),this._create_token(h.STRING,U)}return null},_.prototype._read_xml=function(I,B){if(this._options.e4x&&I==="<"&&this._allow_regexp_or_xml(B)){var U="",C=this.__patterns.xml.read_match();if(C){for(var v=C[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),j=v.indexOf("{")===0,G=0;C;){var J=!!C[1],ee=C[2],ye=!!C[C.length-1]||ee.slice(0,8)==="![CDATA[";if(!ye&&(ee===v||j&&ee.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(J?--G:++G),U+=C[0],G<=0)break;C=this.__patterns.xml.read_match()}return C||(U+=this._input.match(/[\s\S]*/g)[0]),U=U.replace(u.allLineBreaks,`
|
|
`),this._create_token(h.STRING,U)}}return null};function P(I){for(var B="",U=0,C=new p(I),v=null;C.hasNext();)if(v=C.match(/([\s]|[^\\]|\\\\)+/g),v&&(B+=v[0]),C.peek()==="\\"){if(C.next(),C.peek()==="x")v=C.match(/x([0-9A-Fa-f]{2})/g);else if(C.peek()==="u")v=C.match(/u([0-9A-Fa-f]{4})/g);else{B+="\\",C.hasNext()&&(B+=C.next());continue}if(!v)return I;if(U=parseInt(v[1],16),U>126&&U<=255&&v[0].indexOf("x")===0)return I;if(U>=0&&U<32){B+="\\"+v[0];continue}else U===34||U===39||U===92?B+="\\"+String.fromCharCode(U):B+=String.fromCharCode(U)}return B}_.prototype._read_string_recursive=function(I,B,U){var C,v;I==="'"?v=this.__patterns.single_quote:I==='"'?v=this.__patterns.double_quote:I==="`"?v=this.__patterns.template_text:I==="}"&&(v=this.__patterns.template_expression);for(var j=v.read(),G="";this._input.hasNext();){if(G=this._input.next(),G===I||!B&&u.newline.test(G)){this._input.back();break}else G==="\\"&&this._input.hasNext()?(C=this._input.peek(),C==="x"||C==="u"?this.has_char_escapes=!0:C==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),G+=this._input.next()):U&&(U==="${"&&G==="$"&&this._input.peek()==="{"&&(G+=this._input.next()),U===G&&(I==="`"?G+=this._read_string_recursive("}",B,"`"):G+=this._read_string_recursive("`",B,"${"),this._input.hasNext()&&(G+=this._input.next())));G+=v.read(),j+=G}return j},k.exports.Tokenizer=_,k.exports.TOKEN=h,k.exports.positionable_operators=S.slice(),k.exports.line_starters=b.slice()},function(k){var R=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&&!(R&&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 s="",u;return p&&(u=this.match(p),u&&(s+=u[0])),f&&(u||!p)&&(s+=this.readUntil(f,d)),s},g.prototype.readUntil=function(p,f){var d="",s=this.__position;p.lastIndex=this.__position;var u=p.exec(this.__input);return u?(s=u.index,f&&(s+=u[0].length)):s=this.__input_length,d=this.__input.substring(this.__position,s),this.__position=s,d},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var d=null,s="g";return f&&R&&(s="y"),typeof p=="string"&&p!==""?d=new RegExp(p,s):p&&(d=new RegExp(p.source,s)),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},k.exports.InputScanner=g},function(k,R,g){var p=g(8).InputScanner,f=g(3).Token,d=g(10).TokenStream,s=g(11).WhitespacePattern,u={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},o=function(a,l){this._input=new p(a),this._options=l||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var a,l=new f(u.START,""),h=null,A=[],x=new d;l.type!==u.EOF;){for(a=this._get_next_token(l,h);this._is_comment(a);)x.add(a),a=this._get_next_token(l,h);x.isEmpty()||(a.comments_before=x,x=new d),a.parent=h,this._is_opening(a)?(A.push(h),h=a):h&&this._is_closing(a,h)&&(a.opened=h,h.closed=a,h=A.pop(),a.parent=h),a.previous=l,l.next=a,this.__tokens.add(a),l=a}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(a,l){this._readWhitespace();var h=this._input.read(/.+/g);return h?this._create_token(u.RAW,h):this._create_token(u.EOF,"")},o.prototype._is_comment=function(a){return!1},o.prototype._is_opening=function(a){return!1},o.prototype._is_closing=function(a,l){return!1},o.prototype._create_token=function(a,l){var h=new f(a,l,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return h},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},k.exports.Tokenizer=o,k.exports.TOKEN=u},function(k){function R(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}R.prototype.restart=function(){this.__position=0},R.prototype.isEmpty=function(){return this.__tokens_length===0},R.prototype.hasNext=function(){return this.__position<this.__tokens_length},R.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__tokens[this.__position],this.__position+=1),g},R.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},R.prototype.add=function(g){this.__parent_token&&(g.parent=this.__parent_token),this.__tokens.push(g),this.__tokens_length+=1},k.exports.TokenStream=R},function(k,R,g){var p=g(12).Pattern;function f(d,s){p.call(this,d,s),s?this._line_regexp=this._input.get_regexp(s._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,s){d+="\\t ",s+="\\n\\r",this._match_pattern=this._input.get_regexp("["+d+s+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+s+"]")},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 s=this.__split(this._newline_regexp,d);this.newline_count=s.length-1,this.whitespace_before_token=s[this.newline_count]}return d},f.prototype.matching=function(d,s){var u=this._create();return u.__set_whitespace_patterns(d,s),u._update(),u},f.prototype._create=function(){return new f(this._input,this)},f.prototype.__split=function(d,s){d.lastIndex=0;for(var u=0,o=[],a=d.exec(s);a;)o.push(s.substring(u,a.index)),u=a.index+a[0].length,a=d.exec(s);return u<s.length?o.push(s.substring(u,s.length)):o.push(""),o},k.exports.WhitespacePattern=f},function(k){function R(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)}R.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},R.prototype.read_match=function(){return this._input.match(this._match_pattern)},R.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},R.prototype.until=function(g){var p=this._create();return p._until_after=!1,p._until_pattern=this._input.get_regexp(g),p._update(),p},R.prototype.starting_with=function(g){var p=this._create();return p._starting_pattern=this._input.get_regexp(g,!0),p._update(),p},R.prototype.matching=function(g){var p=this._create();return p._match_pattern=this._input.get_regexp(g,!0),p._update(),p},R.prototype._create=function(){return new R(this._input,this)},R.prototype._update=function(){},k.exports.Pattern=R},function(k){function R(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")}R.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},R.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=R},function(k,R,g){var p=g(12).Pattern,f={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function d(s,u){p.call(this,s,u),this.__template_pattern=null,this._disabled=Object.assign({},f),this._excluded=Object.assign({},f),u&&(this.__template_pattern=this._input.get_regexp(u.__template_pattern),this._excluded=Object.assign(this._excluded,u._excluded),this._disabled=Object.assign(this._disabled,u._disabled));var o=new p(s);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(s){var u=this._create();return u._disabled[s]=!0,u._update(),u},d.prototype.read_options=function(s){var u=this._create();for(var o in f)u._disabled[o]=s.templating.indexOf(o)===-1;return u._update(),u},d.prototype.exclude=function(s){var u=this._create();return u._excluded[s]=!0,u._update(),u},d.prototype.read=function(){var s="";this._match_pattern?s=this._input.read(this._starting_pattern):s=this._input.read(this._starting_pattern,this.__template_pattern);for(var u=this._read_template();u;)this._match_pattern?u+=this._input.read(this._match_pattern):u+=this._input.readUntil(this.__template_pattern),s+=u,u=this._read_template();return this._until_after&&(s+=this._input.readUntilAfter(this._until_pattern)),s},d.prototype.__set_templated_pattern=function(){var s=[];this._disabled.php||s.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||s.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||s.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(s.push(this.__patterns.django._starting_pattern.source),s.push(this.__patterns.django_value._starting_pattern.source),s.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||s.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&s.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+s.join("|")+")")},d.prototype._read_template=function(){var s="",u=this._input.peek();if(u==="<"){var o=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&o==="?"&&(s=s||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&o==="%"&&(s=s||this.__patterns.erb.read())}else u==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(s=s||this.__patterns.handlebars_comment.read(),s=s||this.__patterns.handlebars_unescaped.read(),s=s||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(s=s||this.__patterns.django_value.read()),this._excluded.django||(s=s||this.__patterns.django_comment.read(),s=s||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(s=s||this.__patterns.smarty_comment.read(),s=s||this.__patterns.smarty_literal.read(),s=s||this.__patterns.smarty.read()));return s},k.exports.TemplatablePattern=d}],M={};function W(k){var R=M[k];if(R!==void 0)return R.exports;var g=M[k]={exports:{}};return N[k](g,g.exports,W),g.exports}var F=W(0);D=F})();var z=D;!(ae=[],V=function(){return{js_beautify:z}}.apply(Qe,ae),V!==void 0&&(ut.exports=V))})()},"7Cbv":function(ut,Qe,ne){"use strict";var ae=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 D(){if(!ae)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ae(V)}var z=/^(?:[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 N(f){return typeof f=="string"&&z.test(f)}for(var M=N,W=[],F=0;F<256;++F)W.push((F+256).toString(16).substr(1));function k(f){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=(W[f[d+0]]+W[f[d+1]]+W[f[d+2]]+W[f[d+3]]+"-"+W[f[d+4]]+W[f[d+5]]+"-"+W[f[d+6]]+W[f[d+7]]+"-"+W[f[d+8]]+W[f[d+9]]+"-"+W[f[d+10]]+W[f[d+11]]+W[f[d+12]]+W[f[d+13]]+W[f[d+14]]+W[f[d+15]]).toLowerCase();if(!M(s))throw TypeError("Stringified UUID is invalid");return s}var R=k;function g(f,d,s){f=f||{};var u=f.random||(f.rng||D)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,d){s=s||0;for(var o=0;o<16;++o)d[s+o]=u[o];return d}return R(u)}var p=Qe.a=g},"7ahc":function(ut,Qe,ne){"use strict";ne.d(Qe,"a",function(){return A});var ae=ne("k1fw"),V=ne("0Owb"),D=ne("+L6B"),z=ne("2/Rp"),N=ne("y8nQ"),M=ne("Vl3Y"),W=ne("tJVT"),F=ne("OaEy"),k=ne("2fM7"),R=ne("cDcd"),g=ne.n(R),p=ne("VrN/"),f=ne.n(p),d=ne("p77/"),s=ne.n(d),u=ne("c5Ni"),o=ne.n(u),a=k.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(R.useState)("python"),E=Object(W.a)(S,2),w=E[0],b=E[1];function c(m){b(h[m][1])}function y(m){T(m)}return g.a.createElement(M.a,Object(V.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:y}),g.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(k.a,{onChange:c},Object.keys(h).map(function(m){return g.a.createElement(a,{key:m,value:m},h[m][0])}))),g.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(A,{mode:w})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(z.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function A(x){var T=x.value,O=x.onChange,S=x.mode,E=x.options,w=E===void 0?{}:E,b=Object(R.useRef)(),c=Object(R.useState)(),y=Object(W.a)(c,2),m=y[0],_=y[1];return Object(R.useEffect)(function(){if(m){function P(I){var B=I.getValue();O&&O(B)}return m.on("change",P),function(){m.off("change",P)}}},[m,O]),Object(R.useEffect)(function(){m&&m.setOption("mode",S)},[m,S]),Object(R.useEffect)(function(){m&&((T!==m.getValue()||T==="")&&setTimeout(function(){m.setValue(T||" ")},300))},[m,T]),Object(R.useEffect)(function(){if(b.current&&!m){var P=f.a.fromTextArea(b.current,Object(ae.a)({mode:S,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},w));_(P)}},[b.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:b}))}},"8EBN":function(ut,Qe,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";ae.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<ae.modeInfo.length;V++){var D=ae.modeInfo[V];D.mimes&&(D.mime=D.mimes[0])}ae.findModeByMIME=function(z){z=z.toLowerCase();for(var N=0;N<ae.modeInfo.length;N++){var M=ae.modeInfo[N];if(M.mime==z)return M;if(M.mimes){for(var W=0;W<M.mimes.length;W++)if(M.mimes[W]==z)return M}}if(/\+xml$/.test(z))return ae.findModeByMIME("application/xml");if(/\+json$/.test(z))return ae.findModeByMIME("application/json")},ae.findModeByExtension=function(z){z=z.toLowerCase();for(var N=0;N<ae.modeInfo.length;N++){var M=ae.modeInfo[N];if(M.ext){for(var W=0;W<M.ext.length;W++)if(M.ext[W]==z)return M}}},ae.findModeByFileName=function(z){for(var N=0;N<ae.modeInfo.length;N++){var M=ae.modeInfo[N];if(M.file&&M.file.test(z))return M}var W=z.lastIndexOf("."),F=W>-1&&z.substring(W+1,z.length);if(F)return ae.findModeByExtension(F)},ae.findModeByName=function(z){z=z.toLowerCase();for(var N=0;N<ae.modeInfo.length;N++){var M=ae.modeInfo[N];if(M.name.toLowerCase()==z)return M;if(M.alias){for(var W=0;W<M.alias.length;W++)if(M.alias[W].toLowerCase()==z)return M}}}})},"8hTe":function(ut,Qe,ne){ut.exports={button:"button___1wy9m"}},"9Bee":function(ut,Qe,ne){"use strict";var ae=ne("DYRE"),V=ne("zeV3"),D=ne("+L6B"),z=ne("2/Rp"),N=ne("k1fw"),M=ne("tJVT"),W=ne("cDcd"),F=ne.n(W),k=ne("vg9a"),R=ne("DlQD"),g=ne.n(R),p=ne("rUJ1");function f(ge,pe){var oe=ge.match(/^(\s+)(?:```)/);if(oe===null)return pe;var ie=oe[1];return pe.split(`
|
|
`).map(function(ue){var $=ue.match(/^\s+/);if($===null)return ue;var re=Object(M.a)($,1),q=re[0];return q.length>=ie.length?ue.slice(ie.length):ue}).join(`
|
|
`)}var d=[],s=["<ul>"],u=new g.a.Renderer,o=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function a(){d.length=0,s=["<ul>"]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function h(ge,pe,oe,ie){if(pe>=ge.length||ge[pe].level<=oe)return pe;var ue=ge[pe];ie.push("<li><a href='#"+ue.anchor+"'>"+ue.text+"</a>"),pe++;var $=[];return pe=h(ge,pe,ue.level,$),$.length>0&&(ie.push("<ul>"),$.forEach(function(re){ie.push(re)}),ie.push("</ul>")),ie.push("</li>"),pe=h(ge,pe,oe,ie),pe}function A(){return h(d,0,0,s),s.push("</ul>"),s.join("")}var x={heading:function(pe){var oe=o.exec(pe);if(oe)return{type:"heading",raw:oe[0],depth:oe[1].length,text:oe[2]}},fences:function(pe){var oe=this.rules.block.fences.exec(pe);if(oe){var ie=oe[0],ue=f(ie,oe[3]||""),$=oe[2]?oe[2].trim():oe[2];if(["latex","katex","math"].indexOf($)>=0){var re=S(),q=ue;ue=re,E[re]={type:"block",expression:q}}return{type:"code",raw:ie,lang:$,text:ue}}}},T=/(?:\${2})([^\n`]+?)(?:\${2})/gi,O=0,S=function(){return"__special_katext_id_".concat(O++,"__")},E={};function w(){return E}function b(){O=0,E={}}function c(ge){return ge=ge.replace(T,function(pe,oe){var ie=S();return E[ie]={type:"inline",expression:oe},ie}),ge}var y=u.listitem;u.listitem=function(ge){return y(c(ge))};var m=u.paragraph;u.paragraph=function(ge){return m(c(ge))};var _=u.tablecell;u.tablecell=function(ge,pe){return _(c(ge),pe)},u.code=function(ge,pe,oe){var ie=(pe||"").match(/\S*/)[0];return ie?["latex","katex","math"].indexOf(ie)>=0?"<p class='editormd-tex'>".concat(ge,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(pe,'">').concat(oe?ge:Object(p.escape)(ge,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(oe?ge:Object(p.escape)(ge,!0))+"</code></pre>"},u.heading=function(ge,pe,oe){var ie=this.options.headerPrefix+oe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:ie,level:pe,text:ge}),"<h"+pe+' id="'+ie+'">'+ge+"</h"+pe+">"},g.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),g.a.use({tokenizer:x,renderer:u});var P=g.a,I=ne("SJMd"),B=ne("ulZh"),U=ne.n(B),C=ne("m3rI"),v=ne("Oy/b"),j=ne("p5ED"),G=ne("8hTe"),J=ne.n(G),ee=/<pre[^>]*>/g;function ye(ge){var pe=document.createElement("div");return pe.innerHTML=ge,pe.childNodes.length===0?"":pe.childNodes[0].nodeValue}var he=Qe.a=function(ge){var pe=ge.value,oe=pe===void 0?"":pe,ie=ge.edit,ue=ie===void 0?!1:ie,$=ge.className,re=ge.showTextOnly,q=ge.showLines,be=ge.replaces,Oe=ge.zoomImg,_e=ge.hasMask,xe=ge.style,Re=xe===void 0?{}:xe,ke=ge.stylesPrev,De=ke===void 0?{}:ke,Le=String(oe),Ce=Object(W.useRef)(),We=Object(W.useRef)(),Je=Object(W.useState)(""),Xe=Object(M.a)(Je,2),Ke=Xe[0],qe=Xe[1],Be=Object(W.useState)("office"),Ue=Object(M.a)(Be,2),we=Ue[0],Ze=Ue[1],Ve=Object(W.useMemo)(function(){try{var fe=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Q=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Z=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Le=Le.replace(fe,"("+C.a.API_SERVER+"/api/attachments/").replace(Q,'"'+C.a.API_SERVER+"/api/attachments/").replace(Z,'"'+C.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(Ae){}var te=P(Le),le=w();if(Le.match(/\[TOC\]/)&&(te=te.replace("<p>[TOC]</p>",A()),a()),te=te.replace(/(__special_katext_id_\d+__)/g,function(Ae,Me){var ze=le[Me],nt=ze.type,tt=ze.expression;return Object(v.renderToString)(ye(tt)||"",{displayMode:nt==="block",throwOnError:!1,output:"html"})}),te=te.replace(/▁/g,"\u2581\u2581\u2581"),b(),re){var me=document.createElement("div");return me.innerHTML=te,me.innerText}return setTimeout(function(){return ve()},500),te},[Le]),Se=Object(W.useRef)();l.WebkitLineClamp=q,q&&(Re=Object(N.a)(Object(N.a)({},Re),l));function Ne(fe){var Q=fe.target;if(Q.tagName.toUpperCase()==="IMG"){if(Oe){var Z=Q.getAttribute("src");qe(Z),Ze("image")}}else if(Q.tagName.toUpperCase()==="A"){var te=Q.getAttribute("href");if(te.indexOf("office")>-1)fe.preventDefault(),qe(te),Ze("office");else if(te.indexOf("application/pdf")>-1)fe.preventDefault(),qe(te),Ze("pdf");else if(te.indexOf("text/html")>-1)fe.preventDefault(),qe(te),Ze("html");else if(te.startsWith("#")){fe.preventDefault();var le=document.getElementById(te.replace("#",""));le&&le.scrollIntoView(!0)}}}var ve=function(){var Q,Z=(Q=Se.current)===null||Q===void 0?void 0:Q.querySelectorAll("video");Z==null||Z.forEach(function(te){if(te.oncontextmenu=function(){return!1},te.src.indexOf(".m3u8")>-1&&!te.canPlayType("application/vnd.apple.mpegurl")){if(U.a.isSupported()){var le=new U.a;le.loadSource(te.src),le.attachMedia(te)}}})};Object(W.useEffect)(function(){if(Se.current&&Ve&&(Ve.match(ee)&&window.PR.prettyPrint()),Se.current)return Se.current.addEventListener("click",Ne),function(){Se.current.removeEventListener("click",Ne),b(),a()}},[Ve,Se.current,Ne]);var ce=function(Q){if(!ue)return;Q.target.nodeName==="IMG"?(Ce.current.style.display="flex",Ce.current.style.width=Q.target.clientWidth+"px",Ce.current.style.height=Q.target.clientHeight+"px",Ce.current.style.top=Q.target.offsetTop+"px",Ce.current.style.left=Q.target.offsetLeft+"px",We.current.src=Q.target.getAttribute("src")):Ce.current.style.display="none"};return F.a.createElement("div",{style:{position:"relative"}},F.a.createElement("div",{ref:Se,style:Object(N.a)({},Re),className:"".concat($||""," markdown-body ").concat(J.a.mdBody),onMouseOver:ce,dangerouslySetInnerHTML:{__html:Ve}}),F.a.createElement("div",{ref:Ce,className:J.a.button},F.a.createElement(V.a,null,F.a.createElement(z.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),F.a.createElement(z.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),F.a.createElement("img",{ref:We,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),F.a.createElement(j.a,{close:!0,data:Ke,type:Ke!=null&&Ke.length?we:"",style:Object(N.a)({},De),onClose:function(){return qe("")}}))}},"9VGf":function(ut,Qe,ne){"use strict";ne.d(Qe,"a",function(){return D});var ae=ne("cDcd"),V=ne.n(ae);function D(z,N){var M=Object(ae.useRef)();Object(ae.useEffect)(function(){M.current=z}),Object(ae.useEffect)(function(){function W(){M.current()}if(N!==null){var F=setInterval(W,N);return function(){return clearInterval(F)}}},[N])}},BU3w:function(ut,Qe,ne){"use strict";ne.d(Qe,"a",function(){return M});var ae=ne("MNnm"),V="rc-util-key";function D(W){if(W.attachTo)return W.attachTo;var F=document.querySelector("head");return F||document.body}function z(W){var F,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ae.a)())return null;var R=document.createElement("style");if((F=k.csp)===null||F===void 0?void 0:F.nonce){var g;R.nonce=(g=k.csp)===null||g===void 0?void 0:g.nonce}R.innerHTML=W;var p=D(k),f=p.firstChild;return k.prepend&&p.prepend?p.prepend(R):k.prepend&&f?p.insertBefore(R,f):p.appendChild(R),R}var N=new Map;function M(W,F){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=D(k);if(!N.has(R)){var g=z("",k),p=g.parentNode;N.set(R,p),p.removeChild(g)}var f=Array.from(N.get(R).children).find(function(a){return a.tagName==="STYLE"&&a[V]===F});if(f){var d,s;if(((d=k.csp)===null||d===void 0?void 0:d.nonce)&&f.nonce!==((s=k.csp)===null||s===void 0?void 0:s.nonce)){var u;f.nonce=(u=k.csp)===null||u===void 0?void 0:u.nonce}return f.innerHTML!==W&&(f.innerHTML=W),f}var o=z(W,k);return o[V]=F,o}},Bd2K:function(ut,Qe,ne){(function(ae){ae(ne("VrN/"),ne("osHv"))})(function(ae){ae.defineOption("autoCloseTags",!1,function(k,R,g){if(g!=ae.Init&&g&&k.removeKeyMap("autoCloseTags"),!R)return;var p={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(p["'/'"]=function(f){return M(f)}),(typeof R!="object"||R.whenOpening!==!1)&&(p["'>'"]=function(f){return z(f)}),k.addKeyMap(p)});var V=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function z(k){if(k.getOption("disableInput"))return ae.Pass;for(var R=k.listSelections(),g=[],p=k.getOption("autoCloseTags"),f=0;f<R.length;f++){if(!R[f].empty())return ae.Pass;var d=R[f].head,s=k.getTokenAt(d),u=ae.innerMode(k.getMode(),s.state),o=u.state,a=u.mode.xmlCurrentTag&&u.mode.xmlCurrentTag(o),l=a&&a.name;if(!l)return ae.Pass;var h=u.mode.configuration=="html",A=typeof p=="object"&&p.dontCloseTags||h&&V,x=typeof p=="object"&&p.indentTags||h&&D;s.end>d.ch&&(l=l.slice(0,l.length-s.end+d.ch));var T=l.toLowerCase();if(!l||s.type=="string"&&(s.end!=d.ch||!/[\"\']/.test(s.string.charAt(s.string.length-1))||s.string.length==1)||s.type=="tag"&&a.close||s.string.indexOf("/")==d.ch-s.start-1||A&&W(A,T)>-1||F(k,u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(o)||[],l,d,!0))return ae.Pass;var O=typeof p=="object"&&p.emptyTags;if(O&&W(O,l)>-1){g[f]={text:"/>",newPos:ae.Pos(d.line,d.ch+2)};continue}var S=x&&W(x,T)>-1;g[f]={indent:S,text:">"+(S?`
|
|
|
|
`:"")+"</"+l+">",newPos:S?ae.Pos(d.line+1,0):ae.Pos(d.line,d.ch+1)}}for(var E=typeof p=="object"&&p.dontIndentOnAutoClose,f=R.length-1;f>=0;f--){var w=g[f];k.replaceRange(w.text,R[f].head,R[f].anchor,"+insert");var b=k.listSelections().slice(0);b[f]={head:w.newPos,anchor:w.newPos},k.setSelections(b),!E&&w.indent&&(k.indentLine(w.newPos.line,null,!0),k.indentLine(w.newPos.line+1,null,!0))}}function N(k,R){for(var g=k.listSelections(),p=[],f=R?"/":"</",d=k.getOption("autoCloseTags"),s=typeof d=="object"&&d.dontIndentOnSlash,u=0;u<g.length;u++){if(!g[u].empty())return ae.Pass;var o=g[u].head,a=k.getTokenAt(o),l=ae.innerMode(k.getMode(),a.state),h=l.state;if(R&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=o.ch-1))return ae.Pass;var A,x=l.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(x&&l.mode.name=="javascript")A=f+"script";else if(x&&l.mode.name=="css")A=f+"style";else{var T=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(h);if(!T||T.length&&F(k,T,T[T.length-1],o))return ae.Pass;A=f+T[T.length-1]}k.getLine(o.line).charAt(a.end)!=">"&&(A+=">"),p[u]=A}if(k.replaceSelections(p),g=k.listSelections(),!s)for(var u=0;u<g.length;u++)(u==g.length-1||g[u].head.line<g[u+1].head.line)&&k.indentLine(g[u].head.line)}function M(k){return k.getOption("disableInput")?ae.Pass:N(k,!0)}ae.commands.closeTag=function(k){return N(k)};function W(k,R){if(k.indexOf)return k.indexOf(R);for(var g=0,p=k.length;g<p;++g)if(k[g]==R)return g;return-1}function F(k,R,g,p,f){if(!ae.scanForClosingTag)return!1;var d=Math.min(k.lastLine()+1,p.line+500),s=ae.scanForClosingTag(k,p,null,d);if(!s||s.tag!=g)return!1;for(var u=f?1:0,o=R.length-1;o>=0&&R[o]==g;o--)++u;p=s.to;for(var o=1;o<u;o++){var a=ae.scanForClosingTag(k,p,null,d);if(!a||a.tag!=g)return!1;p=a.to}return!0}})},BjJ7:function(ut,Qe,ne){"use strict";ne.d(Qe,"d",function(){return V}),ne.d(Qe,"c",function(){return D}),ne.d(Qe,"e",function(){return z}),ne.d(Qe,"b",function(){return N}),ne.d(Qe,"a",function(){return W});var ae=ne("m3rI");function V(F){var k=!0;if(F.length>0){for(var R=0;R<F.length;R++)if(F[R].compile_success==0||!F[R].compile_success){k=!1;break}}else k=!1;return k}function D(F){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],g=0;g<F.length;g++){var p=F[g],f=k?"".concat(k,"/").concat(p.name):"".concat(p.name);R.push({title:p.name,isLeaf:!(p.type==="tree"),key:f})}return R}function z(F,k,R){for(var g=0;g<F.length;g++){var p=F[g];if(p.key===k){p.children=R;break}p.children&&z(p.children,k,R)}return F}function N(F,k,R){var g;return function(){var p=this,f=arguments,d=function(){g=null,R||F.apply(p,f)},s=R&&!g;clearTimeout(g),g=setTimeout(d,k),s&&F.apply(p,f)}}var M=!0,W=ae.a.API_SERVER},"C+DQ":function(ut,Qe,ne){},DlQD:function(ut,Qe,ne){(function(ae,V){ut.exports=V()})(this,function(){"use strict";function ae(ve,ce){for(var fe=0;fe<ce.length;fe++){var Q=ce[fe];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(ve,Q.key,Q)}}function V(ve,ce,fe){return ce&&ae(ve.prototype,ce),fe&&ae(ve,fe),ve}function D(ve,ce){if(!ve)return;if(typeof ve=="string")return z(ve,ce);var fe=Object.prototype.toString.call(ve).slice(8,-1);if(fe==="Object"&&ve.constructor&&(fe=ve.constructor.name),fe==="Map"||fe==="Set")return Array.from(ve);if(fe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(fe))return z(ve,ce)}function z(ve,ce){(ce==null||ce>ve.length)&&(ce=ve.length);for(var fe=0,Q=new Array(ce);fe<ce;fe++)Q[fe]=ve[fe];return Q}function N(ve,ce){var fe;if(typeof Symbol=="undefined"||ve[Symbol.iterator]==null){if(Array.isArray(ve)||(fe=D(ve))||ce&&ve&&typeof ve.length=="number"){fe&&(ve=fe);var Q=0;return function(){return Q>=ve.length?{done:!0}:{done:!1,value:ve[Q++]}}}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 fe=ve[Symbol.iterator](),fe.next.bind(fe)}function M(ve,ce){return ce={exports:{}},ve(ce,ce.exports),ce.exports}var W=M(function(ve){function ce(){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 fe(Q){ve.exports.defaults=Q}ve.exports={defaults:ce(),getDefaults:ce,changeDefaults:fe}}),F=W.defaults,k=W.getDefaults,R=W.changeDefaults,g=/[&<>"']/,p=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,d=/[<>"']|&(?!#?\w+;)/g,s={"&":"&","<":"<",">":">",'"':""","'":"'"},u=function(ce){return s[ce]};function o(ve,ce){if(ce){if(g.test(ve))return ve.replace(p,u)}else if(f.test(ve))return ve.replace(d,u);return ve}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ve){return ve.replace(a,function(ce,fe){return fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""})}var h=/(^|[^\[])\^/g;function A(ve,ce){ve=ve.source||ve,ce=ce||"";var fe={replace:function(Z,te){return te=te.source||te,te=te.replace(h,"$1"),ve=ve.replace(Z,te),fe},getRegex:function(){return new RegExp(ve,ce)}};return fe}var x=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(ve,ce,fe){if(ve){var Q;try{Q=decodeURIComponent(l(fe)).replace(x,"").toLowerCase()}catch(Z){return null}if(Q.indexOf("javascript:")===0||Q.indexOf("vbscript:")===0||Q.indexOf("data:")===0)return null}ce&&!T.test(fe)&&(fe=c(ce,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch(Z){return null}return fe}var S={},E=/^[^:]+:\/*[^/]*$/,w=/^([^:]+:)[\s\S]*$/,b=/^([^:]+:\/*[^/]*)[\s\S]*$/;function c(ve,ce){S[" "+ve]||(E.test(ve)?S[" "+ve]=ve+"/":S[" "+ve]=P(ve,"/",!0)),ve=S[" "+ve];var fe=ve.indexOf(":")===-1;return ce.substring(0,2)==="//"?fe?ce:ve.replace(w,"$1")+ce:ce.charAt(0)==="/"?fe?ce:ve.replace(b,"$1")+ce:ve+ce}var y={exec:function(){}};function m(ve){for(var ce=1,fe,Q;ce<arguments.length;ce++){fe=arguments[ce];for(Q in fe)Object.prototype.hasOwnProperty.call(fe,Q)&&(ve[Q]=fe[Q])}return ve}function _(ve,ce){var fe=ve.replace(/\|/g,function(te,le,me){for(var Ae=!1,Me=le;--Me>=0&&me[Me]==="\\";)Ae=!Ae;return Ae?"|":" |"}),Q=fe.split(/ \|/),Z=0;if(Q.length>ce)Q.splice(ce);else for(;Q.length<ce;)Q.push("");for(;Z<Q.length;Z++)Q[Z]=Q[Z].trim().replace(/\\\|/g,"|");return Q}function P(ve,ce,fe){var Q=ve.length;if(Q===0)return"";for(var Z=0;Z<Q;){var te=ve.charAt(Q-Z-1);if(te===ce&&!fe)Z++;else if(te!==ce&&fe)Z++;else break}return ve.substr(0,Q-Z)}function I(ve,ce){if(ve.indexOf(ce[1])===-1)return-1;for(var fe=ve.length,Q=0,Z=0;Z<fe;Z++)if(ve[Z]==="\\")Z++;else if(ve[Z]===ce[0])Q++;else if(ve[Z]===ce[1]&&(Q--,Q<0))return Z;return-1}function B(ve){ve&&ve.sanitize&&!ve.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 U={escape:o,unescape:l,edit:A,cleanUrl:O,resolveUrl:c,noopTest:y,merge:m,splitCells:_,rtrim:P,findClosingBracket:I,checkSanitizeDeprecation:B},C=W.defaults,v=U.rtrim,j=U.splitCells,G=U.escape,J=U.findClosingBracket;function ee(ve,ce,fe){var Q=ce.href,Z=ce.title?G(ce.title):null,te=ve[1].replace(/\\([\[\]])/g,"$1");return ve[0].charAt(0)!=="!"?{type:"link",raw:fe,href:Q,title:Z,text:te}:{type:"image",raw:fe,href:Q,title:Z,text:G(te)}}function ye(ve,ce){var fe=ve.match(/^(\s+)(?:```)/);if(fe===null)return ce;var Q=fe[1];return ce.split(`
|
|
`).map(function(Z){var te=Z.match(/^\s+/);if(te===null)return Z;var le=te[0];return le.length>=Q.length?Z.slice(Q.length):Z}).join(`
|
|
`)}var he=function(){function ve(fe){this.options=fe||C}var ce=ve.prototype;return ce.space=function(Q){var Z=this.rules.block.newline.exec(Q);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:`
|
|
`}},ce.code=function(Q,Z){var te=this.rules.block.code.exec(Q);if(te){var le=Z[Z.length-1];if(le&&le.type==="paragraph")return{raw:te[0],text:te[0].trimRight()};var me=te[0].replace(/^ {4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?me:v(me,`
|
|
`)}}},ce.fences=function(Q){var Z=this.rules.block.fences.exec(Q);if(Z){var te=Z[0],le=ye(te,Z[3]||"");return{type:"code",raw:te,lang:Z[2]?Z[2].trim():Z[2],text:le}}},ce.heading=function(Q){var Z=this.rules.block.heading.exec(Q);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},ce.nptable=function(Q){var Z=this.rules.block.nptable.exec(Q);if(Z){var te={type:"table",header:j(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Z[0]};if(te.header.length===te.align.length){var le=te.align.length,me;for(me=0;me<le;me++)/^ *-+: *$/.test(te.align[me])?te.align[me]="right":/^ *:-+: *$/.test(te.align[me])?te.align[me]="center":/^ *:-+ *$/.test(te.align[me])?te.align[me]="left":te.align[me]=null;for(le=te.cells.length,me=0;me<le;me++)te.cells[me]=j(te.cells[me],te.header.length);return te}}},ce.hr=function(Q){var Z=this.rules.block.hr.exec(Q);if(Z)return{type:"hr",raw:Z[0]}},ce.blockquote=function(Q){var Z=this.rules.block.blockquote.exec(Q);if(Z){var te=Z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Z[0],text:te}}},ce.list=function(Q){var Z=this.rules.block.list.exec(Q);if(Z){for(var te=Z[0],le=Z[2],me=le.length>1,Ae=le[le.length-1]===")",Me={type:"list",raw:te,ordered:me,start:me?+le.slice(0,-1):"",loose:!1,items:[]},ze=Z[0].match(this.rules.block.item),nt=!1,tt,xt,ft,it,Ot,at,yt,bt=ze.length,Ge=0;Ge<bt;Ge++)tt=ze[Ge],te=tt,xt=tt.length,tt=tt.replace(/^ *([*+-]|\d+[.)]) */,""),~tt.indexOf(`
|
|
`)&&(xt-=tt.length,tt=this.options.pedantic?tt.replace(/^ {1,4}/gm,""):tt.replace(new RegExp("^ {1,"+xt+"}","gm"),"")),Ge!==bt-1&&(ft=this.rules.block.bullet.exec(ze[Ge+1])[0],(me?ft.length===1||!Ae&&ft[ft.length-1]===")":ft.length>1||this.options.smartLists&&ft!==le)&&(it=ze.slice(Ge+1).join(`
|
|
`),Me.raw=Me.raw.substring(0,Me.raw.length-it.length),Ge=bt-1)),Ot=nt||/\n\n(?!\s*$)/.test(tt),Ge!==bt-1&&(nt=tt.charAt(tt.length-1)===`
|
|
`,Ot||(Ot=nt)),Ot&&(Me.loose=!0),at=/^\[[ xX]\] /.test(tt),yt=void 0,at&&(yt=tt[1]!==" ",tt=tt.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:te,task:at,checked:yt,loose:Ot,text:tt});return Me}},ce.html=function(Q){var Z=this.rules.block.html.exec(Q);if(Z)return{type:this.options.sanitize?"paragraph":"html",raw:Z[0],pre:!this.options.sanitizer&&(Z[1]==="pre"||Z[1]==="script"||Z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):G(Z[0]):Z[0]}},ce.def=function(Q){var Z=this.rules.block.def.exec(Q);if(Z){Z[3]&&(Z[3]=Z[3].substring(1,Z[3].length-1));var te=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:te,raw:Z[0],href:Z[2],title:Z[3]}}},ce.table=function(Q){var Z=this.rules.block.table.exec(Q);if(Z){var te={type:"table",header:j(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
|
|
`):[]};if(te.header.length===te.align.length){te.raw=Z[0];var le=te.align.length,me;for(me=0;me<le;me++)/^ *-+: *$/.test(te.align[me])?te.align[me]="right":/^ *:-+: *$/.test(te.align[me])?te.align[me]="center":/^ *:-+ *$/.test(te.align[me])?te.align[me]="left":te.align[me]=null;for(le=te.cells.length,me=0;me<le;me++)te.cells[me]=j(te.cells[me].replace(/^ *\| *| *\| *$/g,""),te.header.length);return te}}},ce.lheading=function(Q){var Z=this.rules.block.lheading.exec(Q);if(Z)return{type:"heading",raw:Z[0],depth:Z[2].charAt(0)==="="?1:2,text:Z[1]}},ce.paragraph=function(Q){var Z=this.rules.block.paragraph.exec(Q);if(Z)return{type:"paragraph",raw:Z[0],text:Z[1].charAt(Z[1].length-1)===`
|
|
`?Z[1].slice(0,-1):Z[1]}},ce.text=function(Q,Z){var te=this.rules.block.text.exec(Q);if(te){var le=Z[Z.length-1];return le&&le.type==="text"?{raw:te[0],text:te[0]}:{type:"text",raw:te[0],text:te[0]}}},ce.escape=function(Q){var Z=this.rules.inline.escape.exec(Q);if(Z)return{type:"escape",raw:Z[0],text:G(Z[1])}},ce.tag=function(Q,Z,te){var le=this.rules.inline.tag.exec(Q);if(le)return!Z&&/^<a /i.test(le[0])?Z=!0:Z&&/^<\/a>/i.test(le[0])&&(Z=!1),!te&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?te=!0:te&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(te=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:Z,inRawBlock:te,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):G(le[0]):le[0]}},ce.link=function(Q){var Z=this.rules.inline.link.exec(Q);if(Z){var te=J(Z[2],"()");if(te>-1){var le=Z[0].indexOf("!")===0?5:4,me=le+Z[1].length+te;Z[2]=Z[2].substring(0,te),Z[0]=Z[0].substring(0,me).trim(),Z[3]=""}var Ae=Z[2],Me="";if(this.options.pedantic){var ze=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ae);ze?(Ae=ze[1],Me=ze[3]):Me=""}else Me=Z[3]?Z[3].slice(1,-1):"";Ae=Ae.trim().replace(/^<([\s\S]*)>$/,"$1");var nt=ee(Z,{href:Ae&&Ae.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},Z[0]);return nt}},ce.reflink=function(Q,Z){var te;if((te=this.rules.inline.reflink.exec(Q))||(te=this.rules.inline.nolink.exec(Q))){var le=(te[2]||te[1]).replace(/\s+/g," ");if(le=Z[le.toLowerCase()],!le||!le.href){var me=te[0].charAt(0);return{type:"text",raw:me,text:me}}var Ae=ee(te,le,te[0]);return Ae}},ce.strong=function(Q,Z,te){te===void 0&&(te="");var le=this.rules.inline.strong.start.exec(Q);if(le&&(!le[1]||le[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Z=Z.slice(-1*Q.length);var me=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;me.lastIndex=0;for(var Ae;(le=me.exec(Z))!=null;)if(Ae=this.rules.inline.strong.middle.exec(Z.slice(0,le.index+3)),Ae)return{type:"strong",raw:Q.slice(0,Ae[0].length),text:Q.slice(2,Ae[0].length-2)}}},ce.em=function(Q,Z,te){te===void 0&&(te="");var le=this.rules.inline.em.start.exec(Q);if(le&&(!le[1]||le[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Z=Z.slice(-1*Q.length);var me=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;me.lastIndex=0;for(var Ae;(le=me.exec(Z))!=null;)if(Ae=this.rules.inline.em.middle.exec(Z.slice(0,le.index+2)),Ae)return{type:"em",raw:Q.slice(0,Ae[0].length),text:Q.slice(1,Ae[0].length-1)}}},ce.codespan=function(Q){var Z=this.rules.inline.code.exec(Q);if(Z){var te=Z[2].replace(/\n/g," "),le=/[^ ]/.test(te),me=te.startsWith(" ")&&te.endsWith(" ");return le&&me&&(te=te.substring(1,te.length-1)),te=G(te,!0),{type:"codespan",raw:Z[0],text:te}}},ce.br=function(Q){var Z=this.rules.inline.br.exec(Q);if(Z)return{type:"br",raw:Z[0]}},ce.del=function(Q){var Z=this.rules.inline.del.exec(Q);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},ce.autolink=function(Q,Z){var te=this.rules.inline.autolink.exec(Q);if(te){var le,me;return te[2]==="@"?(le=G(this.options.mangle?Z(te[1]):te[1]),me="mailto:"+le):(le=G(te[1]),me=le),{type:"link",raw:te[0],text:le,href:me,tokens:[{type:"text",raw:le,text:le}]}}},ce.url=function(Q,Z){var te;if(te=this.rules.inline.url.exec(Q)){var le,me;if(te[2]==="@")le=G(this.options.mangle?Z(te[0]):te[0]),me="mailto:"+le;else{var Ae;do Ae=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(Ae!==te[0]);le=G(te[0]),te[1]==="www."?me="http://"+le:me=le}return{type:"link",raw:te[0],text:le,href:me,tokens:[{type:"text",raw:le,text:le}]}}},ce.inlineText=function(Q,Z,te){var le=this.rules.inline.text.exec(Q);if(le){var me;return Z?me=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):G(le[0]):le[0]:me=G(this.options.smartypants?te(le[0]):le[0]),{type:"text",raw:le[0],text:me}}},ve}(),ge=U.noopTest,pe=U.edit,oe=U.merge,ie={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:ge,table:ge,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=pe(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=pe(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=pe(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._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",ie._comment=/<!--(?!-?>)[\s\S]*?-->/,ie.html=pe(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=pe(ie._paragraph).replace("hr",ie.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",ie._tag).getRegex(),ie.blockquote=pe(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=oe({},ie),ie.gfm=oe({},ie.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*|$)"}),ie.gfm.nptable=pe(ie.gfm.nptable).replace("hr",ie.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",ie._tag).getRegex(),ie.gfm.table=pe(ie.gfm.table).replace("hr",ie.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",ie._tag).getRegex(),ie.pedantic=oe({},ie.normal,{html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:ge,paragraph:pe(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ge,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ge,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=pe(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=pe(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=pe(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=pe(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=pe(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=pe(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=pe(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=pe(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=pe(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=pe(ue._blockSkip,"g").getRegex(),ue.overlapSkip=pe(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._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])?)+(?![-_])/,ue.autolink=pe(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=pe(ue.tag).replace("comment",ie._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=pe(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=pe(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=pe(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=oe({},ue),ue.pedantic=oe({},ue.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=oe({},ue.normal,{escape:pe(ue.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=pe(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=oe({},ue.gfm,{br:pe(ue.br).replace("{2,}","*").getRegex(),text:pe(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $={block:ie,inline:ue},re=W.defaults,q=$.block,be=$.inline;function Oe(ve){return ve.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 _e(ve){var ce="",fe,Q,Z=ve.length;for(fe=0;fe<Z;fe++)Q=ve.charCodeAt(fe),Math.random()>.5&&(Q="x"+Q.toString(16)),ce+="&#"+Q+";";return ce}var xe=function(){function ve(fe){this.tokens=[],this.tokens.links=Object.create(null),this.options=fe||re,this.options.tokenizer=this.options.tokenizer||new he,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Q={block:q.normal,inline:be.normal};this.options.pedantic?(Q.block=q.pedantic,Q.inline=be.pedantic):this.options.gfm&&(Q.block=q.gfm,this.options.breaks?Q.inline=be.breaks:Q.inline=be.gfm),this.tokenizer.rules=Q}ve.lex=function(Q,Z){var te=new ve(Z);return te.lex(Q)};var ce=ve.prototype;return ce.lex=function(Q){return Q=Q.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Q,this.tokens,!0),this.inline(this.tokens),this.tokens},ce.blockTokens=function(Q,Z,te){Z===void 0&&(Z=[]),te===void 0&&(te=!0),Q=Q.replace(/^ +$/gm,"");for(var le,me,Ae,Me;Q;){if(le=this.tokenizer.space(Q)){Q=Q.substring(le.raw.length),le.type&&Z.push(le);continue}if(le=this.tokenizer.code(Q,Z)){Q=Q.substring(le.raw.length),le.type?Z.push(le):(Me=Z[Z.length-1],Me.raw+=`
|
|
`+le.raw,Me.text+=`
|
|
`+le.text);continue}if(le=this.tokenizer.fences(Q)){Q=Q.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.heading(Q)){Q=Q.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.nptable(Q)){Q=Q.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.hr(Q)){Q=Q.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.blockquote(Q)){Q=Q.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],te),Z.push(le);continue}if(le=this.tokenizer.list(Q)){for(Q=Q.substring(le.raw.length),Ae=le.items.length,me=0;me<Ae;me++)le.items[me].tokens=this.blockTokens(le.items[me].text,[],!1);Z.push(le);continue}if(le=this.tokenizer.html(Q)){Q=Q.substring(le.raw.length),Z.push(le);continue}if(te&&(le=this.tokenizer.def(Q))){Q=Q.substring(le.raw.length),this.tokens.links[le.tag]||(this.tokens.links[le.tag]={href:le.href,title:le.title});continue}if(le=this.tokenizer.table(Q)){Q=Q.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.lheading(Q)){Q=Q.substring(le.raw.length),Z.push(le);continue}if(te&&(le=this.tokenizer.paragraph(Q))){Q=Q.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.text(Q,Z)){Q=Q.substring(le.raw.length),le.type?Z.push(le):(Me=Z[Z.length-1],Me.raw+=`
|
|
`+le.raw,Me.text+=`
|
|
`+le.text);continue}if(Q){var ze="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(ze);break}else throw new Error(ze)}}return Z},ce.inline=function(Q){var Z,te,le,me,Ae,Me,ze=Q.length;for(Z=0;Z<ze;Z++){Me=Q[Z];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},me=Me.header.length,te=0;te<me;te++)Me.tokens.header[te]=[],this.inlineTokens(Me.header[te],Me.tokens.header[te]);for(me=Me.cells.length,te=0;te<me;te++)for(Ae=Me.cells[te],Me.tokens.cells[te]=[],le=0;le<Ae.length;le++)Me.tokens.cells[te][le]=[],this.inlineTokens(Ae[le],Me.tokens.cells[te][le]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(me=Me.items.length,te=0;te<me;te++)this.inline(Me.items[te].tokens);break}}}return Q},ce.inlineTokens=function(Q,Z,te,le,me){Z===void 0&&(Z=[]),te===void 0&&(te=!1),le===void 0&&(le=!1),me===void 0&&(me="");var Ae,Me=Q,ze;if(this.tokens.links){var nt=Object.keys(this.tokens.links);if(nt.length>0)for(;(ze=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)nt.includes(ze[0].slice(ze[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,ze.index)+"["+"a".repeat(ze[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ze=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,ze.index)+"["+"a".repeat(ze[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Q;){if(Ae=this.tokenizer.escape(Q)){Q=Q.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.tag(Q,te,le)){Q=Q.substring(Ae.raw.length),te=Ae.inLink,le=Ae.inRawBlock,Z.push(Ae);continue}if(Ae=this.tokenizer.link(Q)){Q=Q.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,le)),Z.push(Ae);continue}if(Ae=this.tokenizer.reflink(Q,this.tokens.links)){Q=Q.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,le)),Z.push(Ae);continue}if(Ae=this.tokenizer.strong(Q,Me,me)){Q=Q.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,le),Z.push(Ae);continue}if(Ae=this.tokenizer.em(Q,Me,me)){Q=Q.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,le),Z.push(Ae);continue}if(Ae=this.tokenizer.codespan(Q)){Q=Q.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.br(Q)){Q=Q.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.del(Q)){Q=Q.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,le),Z.push(Ae);continue}if(Ae=this.tokenizer.autolink(Q,_e)){Q=Q.substring(Ae.raw.length),Z.push(Ae);continue}if(!te&&(Ae=this.tokenizer.url(Q,_e))){Q=Q.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.inlineText(Q,le,Oe)){Q=Q.substring(Ae.raw.length),me=Ae.raw.slice(-1),Z.push(Ae);continue}if(Q){var tt="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return Z},V(ve,null,[{key:"rules",get:function(){return{block:q,inline:be}}}]),ve}(),Re=W.defaults,ke=U.cleanUrl,De=U.escape,Le=function(){function ve(fe){this.options=fe||Re}var ce=ve.prototype;return ce.code=function(Q,Z,te){var le=(Z||"").match(/\S*/)[0];if(this.options.highlight){var me=this.options.highlight(Q,le);me!=null&&me!==Q&&(te=!0,Q=me)}return le?'<pre><code class="'+this.options.langPrefix+De(le,!0)+'">'+(te?Q:De(Q,!0))+`</code></pre>
|
|
`:"<pre><code>"+(te?Q:De(Q,!0))+`</code></pre>
|
|
`},ce.blockquote=function(Q){return`<blockquote>
|
|
`+Q+`</blockquote>
|
|
`},ce.html=function(Q){return Q},ce.heading=function(Q,Z,te,le){return this.options.headerIds?"<h"+Z+' id="'+this.options.headerPrefix+le.slug(te)+'">'+Q+"</h"+Z+`>
|
|
`:"<h"+Z+">"+Q+"</h"+Z+`>
|
|
`},ce.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ce.list=function(Q,Z,te){var le=Z?"ol":"ul",me=Z&&te!==1?' start="'+te+'"':"";return"<"+le+me+`>
|
|
`+Q+"</"+le+`>
|
|
`},ce.listitem=function(Q){return"<li>"+Q+`</li>
|
|
`},ce.checkbox=function(Q){return"<input "+(Q?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ce.paragraph=function(Q){return"<p>"+Q+`</p>
|
|
`},ce.table=function(Q,Z){return Z&&(Z="<tbody>"+Z+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Q+`</thead>
|
|
`+Z+`</table>
|
|
`},ce.tablerow=function(Q){return`<tr>
|
|
`+Q+`</tr>
|
|
`},ce.tablecell=function(Q,Z){var te=Z.header?"th":"td",le=Z.align?"<"+te+' align="'+Z.align+'">':"<"+te+">";return le+Q+"</"+te+`>
|
|
`},ce.strong=function(Q){return"<strong>"+Q+"</strong>"},ce.em=function(Q){return"<em>"+Q+"</em>"},ce.codespan=function(Q){return"<code>"+Q+"</code>"},ce.br=function(){return this.options.xhtml?"<br/>":"<br>"},ce.del=function(Q){return"<del>"+Q+"</del>"},ce.link=function(Q,Z,te){if(Q=ke(this.options.sanitize,this.options.baseUrl,Q),Q===null)return te;var le='<a href="'+De(Q)+'"';return Z&&(le+=' title="'+Z+'"'),le+=">"+te+"</a>",le},ce.image=function(Q,Z,te){if(Q=ke(this.options.sanitize,this.options.baseUrl,Q),Q===null)return te;var le='<img src="'+Q+'" alt="'+te+'"';return Z&&(le+=' title="'+Z+'"'),le+=this.options.xhtml?"/>":">",le},ce.text=function(Q){return Q},ve}(),Ce=function(){function ve(){}var ce=ve.prototype;return ce.strong=function(Q){return Q},ce.em=function(Q){return Q},ce.codespan=function(Q){return Q},ce.del=function(Q){return Q},ce.html=function(Q){return Q},ce.text=function(Q){return Q},ce.link=function(Q,Z,te){return""+te},ce.image=function(Q,Z,te){return""+te},ce.br=function(){return""},ve}(),We=function(){function ve(){this.seen={}}var ce=ve.prototype;return ce.slug=function(Q){var Z=Q.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Z)){var te=Z;do this.seen[te]++,Z=te+"-"+this.seen[te];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},ve}(),Je=W.defaults,Xe=U.unescape,Ke=function(){function ve(fe){this.options=fe||Je,this.options.renderer=this.options.renderer||new Le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ce,this.slugger=new We}ve.parse=function(Q,Z){var te=new ve(Z);return te.parse(Q)};var ce=ve.prototype;return ce.parse=function(Q,Z){Z===void 0&&(Z=!0);var te="",le,me,Ae,Me,ze,nt,tt,xt,ft,it,Ot,at,yt,bt,Ge,en,tn,pt,st=Q.length;for(le=0;le<st;le++){it=Q[le];switch(it.type){case"space":continue;case"hr":{te+=this.renderer.hr();continue}case"heading":{te+=this.renderer.heading(this.parseInline(it.tokens),it.depth,Xe(this.parseInline(it.tokens,this.textRenderer)),this.slugger);continue}case"code":{te+=this.renderer.code(it.text,it.lang,it.escaped);continue}case"table":{for(xt="",tt="",Me=it.header.length,me=0;me<Me;me++)tt+=this.renderer.tablecell(this.parseInline(it.tokens.header[me]),{header:!0,align:it.align[me]});for(xt+=this.renderer.tablerow(tt),ft="",Me=it.cells.length,me=0;me<Me;me++){for(nt=it.tokens.cells[me],tt="",ze=nt.length,Ae=0;Ae<ze;Ae++)tt+=this.renderer.tablecell(this.parseInline(nt[Ae]),{header:!1,align:it.align[Ae]});ft+=this.renderer.tablerow(tt)}te+=this.renderer.table(xt,ft);continue}case"blockquote":{ft=this.parse(it.tokens),te+=this.renderer.blockquote(ft);continue}case"list":{for(Ot=it.ordered,at=it.start,yt=it.loose,Me=it.items.length,ft="",me=0;me<Me;me++)Ge=it.items[me],en=Ge.checked,tn=Ge.task,bt="",Ge.task&&(pt=this.renderer.checkbox(en),yt?Ge.tokens.length>0&&Ge.tokens[0].type==="text"?(Ge.tokens[0].text=pt+" "+Ge.tokens[0].text,Ge.tokens[0].tokens&&Ge.tokens[0].tokens.length>0&&Ge.tokens[0].tokens[0].type==="text"&&(Ge.tokens[0].tokens[0].text=pt+" "+Ge.tokens[0].tokens[0].text)):Ge.tokens.unshift({type:"text",text:pt}):bt+=pt),bt+=this.parse(Ge.tokens,yt),ft+=this.renderer.listitem(bt,tn,en);te+=this.renderer.list(ft,Ot,at);continue}case"html":{te+=this.renderer.html(it.text);continue}case"paragraph":{te+=this.renderer.paragraph(this.parseInline(it.tokens));continue}case"text":{for(ft=it.tokens?this.parseInline(it.tokens):it.text;le+1<st&&Q[le+1].type==="text";)it=Q[++le],ft+=`
|
|
`+(it.tokens?this.parseInline(it.tokens):it.text);te+=Z?this.renderer.paragraph(ft):ft;continue}default:{var wt='Token with "'+it.type+'" type was not found.';if(this.options.silent){console.error(wt);return}else throw new Error(wt)}}}return te},ce.parseInline=function(Q,Z){Z=Z||this.renderer;var te="",le,me,Ae=Q.length;for(le=0;le<Ae;le++){me=Q[le];switch(me.type){case"escape":{te+=Z.text(me.text);break}case"html":{te+=Z.html(me.text);break}case"link":{te+=Z.link(me.href,me.title,this.parseInline(me.tokens,Z));break}case"image":{te+=Z.image(me.href,me.title,me.text);break}case"strong":{te+=Z.strong(this.parseInline(me.tokens,Z));break}case"em":{te+=Z.em(this.parseInline(me.tokens,Z));break}case"codespan":{te+=Z.codespan(me.text);break}case"br":{te+=Z.br();break}case"del":{te+=Z.del(this.parseInline(me.tokens,Z));break}case"text":{te+=Z.text(me.text);break}default:{var Me='Token with "'+me.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return te},ve}(),qe=U.merge,Be=U.checkSanitizeDeprecation,Ue=U.escape,we=W.getDefaults,Ze=W.changeDefaults,Ve=W.defaults;function Se(ve,ce,fe){if(typeof ve=="undefined"||ve===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ve!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ve)+", string expected");if(typeof ce=="function"&&(fe=ce,ce=null),ce=qe({},Se.defaults,ce||{}),Be(ce),fe){var Q=ce.highlight,Z;try{Z=xe.lex(ve,ce)}catch(Ae){return fe(Ae)}var te=function(Me){var ze;if(!Me)try{ze=Ke.parse(Z,ce)}catch(nt){Me=nt}return ce.highlight=Q,Me?fe(Me):fe(null,ze)};if(!Q||Q.length<3)return te();if(delete ce.highlight,!Z.length)return te();var le=0;Se.walkTokens(Z,function(Ae){Ae.type==="code"&&(le++,setTimeout(function(){Q(Ae.text,Ae.lang,function(Me,ze){if(Me)return te(Me);ze!=null&&ze!==Ae.text&&(Ae.text=ze,Ae.escaped=!0),le--,le===0&&te()})},0))}),le===0&&te();return}try{var me=xe.lex(ve,ce);return ce.walkTokens&&Se.walkTokens(me,ce.walkTokens),Ke.parse(me,ce)}catch(Ae){if(Ae.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ce.silent)return"<p>An error occurred:</p><pre>"+Ue(Ae.message+"",!0)+"</pre>";throw Ae}}Se.options=Se.setOptions=function(ve){return qe(Se.defaults,ve),Ze(Se.defaults),Se},Se.getDefaults=we,Se.defaults=Ve,Se.use=function(ve){var ce=qe({},ve);if(ve.renderer&&function(){var Q=Se.defaults.renderer||new Le,Z=function(me){var Ae=Q[me];Q[me]=function(){for(var Me=arguments.length,ze=new Array(Me),nt=0;nt<Me;nt++)ze[nt]=arguments[nt];var tt=ve.renderer[me].apply(Q,ze);return tt===!1&&(tt=Ae.apply(Q,ze)),tt}};for(var te in ve.renderer)Z(te);ce.renderer=Q}(),ve.tokenizer&&function(){var Q=Se.defaults.tokenizer||new he,Z=function(me){var Ae=Q[me];Q[me]=function(){for(var Me=arguments.length,ze=new Array(Me),nt=0;nt<Me;nt++)ze[nt]=arguments[nt];var tt=ve.tokenizer[me].apply(Q,ze);return tt===!1&&(tt=Ae.apply(Q,ze)),tt}};for(var te in ve.tokenizer)Z(te);ce.tokenizer=Q}(),ve.walkTokens){var fe=Se.defaults.walkTokens;ce.walkTokens=function(Q){ve.walkTokens(Q),fe&&fe(Q)}}Se.setOptions(ce)},Se.walkTokens=function(ve,ce){for(var fe=N(ve),Q;!(Q=fe()).done;){var Z=Q.value;ce(Z);switch(Z.type){case"table":{for(var te=N(Z.tokens.header),le;!(le=te()).done;){var me=le.value;Se.walkTokens(me,ce)}for(var Ae=N(Z.tokens.cells),Me;!(Me=Ae()).done;)for(var ze=Me.value,nt=N(ze),tt;!(tt=nt()).done;){var xt=tt.value;Se.walkTokens(xt,ce)}break}case"list":{Se.walkTokens(Z.items,ce);break}default:Z.tokens&&Se.walkTokens(Z.tokens,ce)}}},Se.Parser=Ke,Se.parser=Ke.parse,Se.Renderer=Le,Se.TextRenderer=Ce,Se.Lexer=xe,Se.lexer=xe.lex,Se.Tokenizer=he,Se.Slugger=We,Se.parse=Se;var Ne=Se;return Ne})},ELLl:function(ut,Qe,ne){(function(ae){ae(ne("VrN/"))})(function(ae){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=ae.Pos;ae.defineOption("autoCloseBrackets",!1,function(s,u,o){o&&o!=ae.Init&&(s.removeKeyMap(N),s.state.closeBrackets=null),u&&(M(z(u,"pairs")),s.state.closeBrackets=u,s.addKeyMap(N))});function z(s,u){return u=="pairs"&&typeof s=="string"?s:typeof s=="object"&&s[u]!=null?s[u]:V[u]}var N={Backspace:k,Enter:R};function M(s){for(var u=0;u<s.length;u++){var o=s.charAt(u),a="'"+o+"'";N[a]||(N[a]=W(o))}}M(V.pairs+"`");function W(s){return function(u){return p(u,s)}}function F(s){var u=s.state.closeBrackets;if(!u||u.override)return u;var o=s.getModeAt(s.getCursor());return o.closeBrackets||u}function k(s){var u=F(s);if(!u||s.getOption("disableInput"))return ae.Pass;for(var o=z(u,"pairs"),a=s.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return ae.Pass;var h=f(s,a[l].head);if(!h||o.indexOf(h)%2!=0)return ae.Pass}for(var l=a.length-1;l>=0;l--){var A=a[l].head;s.replaceRange("",D(A.line,A.ch-1),D(A.line,A.ch+1),"+delete")}}function R(s){var u=F(s),o=u&&z(u,"explode");if(!o||s.getOption("disableInput"))return ae.Pass;for(var a=s.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return ae.Pass;var h=f(s,a[l].head);if(!h||o.indexOf(h)%2!=0)return ae.Pass}s.operation(function(){var A=s.lineSeparator()||`
|
|
`;s.replaceSelection(A+A,null),s.execCommand("goCharLeft"),a=s.listSelections();for(var x=0;x<a.length;x++){var T=a[x].head.line;s.indentLine(T,null,!0),s.indentLine(T+1,null,!0)}})}function g(s){var u=ae.cmpPos(s.anchor,s.head)>0;return{anchor:new D(s.anchor.line,s.anchor.ch+(u?-1:1)),head:new D(s.head.line,s.head.ch+(u?1:-1))}}function p(s,u){var o=F(s);if(!o||s.getOption("disableInput"))return ae.Pass;var a=z(o,"pairs"),l=a.indexOf(u);if(l==-1)return ae.Pass;for(var h=z(o,"closeBefore"),A=z(o,"triples"),x=a.charAt(l+1)==u,T=s.listSelections(),O=l%2==0,S,E=0;E<T.length;E++){var w=T[E],b=w.head,c,y=s.getRange(b,D(b.line,b.ch+1));if(O&&!w.empty())c="surround";else if((x||!O)&&y==u)x&&d(s,b)?c="both":A.indexOf(u)>=0&&s.getRange(b,D(b.line,b.ch+3))==u+u+u?c="skipThree":c="skip";else if(x&&b.ch>1&&A.indexOf(u)>=0&&s.getRange(D(b.line,b.ch-2),b)==u+u){if(b.ch>2&&/\bstring/.test(s.getTokenTypeAt(D(b.line,b.ch-2))))return ae.Pass;c="addFour"}else if(x){var m=b.ch==0?" ":s.getRange(D(b.line,b.ch-1),b);if(!ae.isWordChar(y)&&m!=u&&!ae.isWordChar(m))c="both";else return ae.Pass}else if(O&&(y.length===0||/\s/.test(y)||h.indexOf(y)>-1))c="both";else return ae.Pass;if(!S)S=c;else if(S!=c)return ae.Pass}var _=l%2?a.charAt(l-1):u,P=l%2?u:a.charAt(l+1);s.operation(function(){if(S=="skip")s.execCommand("goCharRight");else if(S=="skipThree")for(var I=0;I<3;I++)s.execCommand("goCharRight");else if(S=="surround"){for(var B=s.getSelections(),I=0;I<B.length;I++)B[I]=_+B[I]+P;s.replaceSelections(B,"around"),B=s.listSelections().slice();for(var I=0;I<B.length;I++)B[I]=g(B[I]);s.setSelections(B)}else S=="both"?(s.replaceSelection(_+P,null),s.triggerElectric(_+P),s.execCommand("goCharLeft")):S=="addFour"&&(s.replaceSelection(_+_+_+_,"before"),s.execCommand("goCharRight"))})}function f(s,u){var o=s.getRange(D(u.line,u.ch-1),D(u.line,u.ch+1));return o.length==2?o:null}function d(s,u){var o=s.getTokenAt(D(u.line,u.ch+1));return/\bstring/.test(o.type)&&o.start==u.ch&&(u.ch==0||!/\bstring/.test(s.getTokenTypeAt(u)))}})},GfqC:function(ut,Qe,ne){"use strict";var ae=ne("cDcd"),V=ne.n(ae),D=ne("TSYQ"),z=ne.n(D);function N(U,C){var v="cannot "+U.method+" "+U.action+" "+C.status+"'",j=new Error(v);return j.status=C.status,j.method=U.method,j.url=U.action,j}function M(U){var C=U.responseText||U.response;if(!C)return C;try{return JSON.parse(C)}catch(v){return C}}function W(U){var C=new XMLHttpRequest;U.onProgress&&C.upload&&(C.upload.onprogress=function(J){J.total>0&&(J.percent=J.loaded/J.total*100),U.onProgress(J)});var v=new FormData;U.data&&Object.keys(U.data).forEach(function(G){var J=U.data[G];if(Array.isArray(J)){J.forEach(function(ee){v.append(G+"[]",ee)});return}v.append(G,U.data[G])}),U.file instanceof Blob?v.append(U.filename,U.file,U.file.name):v.append(U.filename,U.file),C.onerror=function(J){U.onError(J)},C.onload=function(){return C.status<200||C.status>=300?U.onError(N(U,C),M(C)):U.onSuccess(M(C),C)},C.open(U.method,U.action,!0),U.withCredentials&&"withCredentials"in C&&(C.withCredentials=!0);var j=U.headers||{};return j["X-Requested-With"]!==null&&C.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(j).forEach(function(G){j[G]!==null&&C.setRequestHeader(G,j[G])}),C.send(v),{abort:function(){C.abort()}}}var F=+new Date,k=0;function R(){return"rc-upload-"+F+"-"+ ++k}function g(U,C){return U.indexOf(C,U.length-C.length)!==-1}var p=function(U,C){if(U&&C){var v=Array.isArray(C)?C:C.split(","),j=U.name||"",G=U.type||"",J=G.replace(/\/.*$/,"");return v.some(function(ee){var ye=ee.trim();return ye.charAt(0)==="."?g(j.toLowerCase(),ye.toLowerCase()):/\/\*$/.test(ye)?J===ye.replace(/\/.*$/,""):G===ye})}return!0};function f(U,C){var v=U.createReader(),j=[];function G(){v.readEntries(function(J){var ee=Array.prototype.slice.apply(J);j=j.concat(ee);var ye=!ee.length;ye?C(j):G()})}G()}var d=function(C,v,j){var G=function J(ee,ye){ye=ye||"",ee.isFile?ee.file(function(he){j(he)&&(ee.fullPath&&!he.webkitRelativePath&&(Object.defineProperties(he,{webkitRelativePath:{writable:!0}}),he.webkitRelativePath=ee.fullPath.replace(/^\//,""),Object.defineProperties(he,{webkitRelativePath:{writable:!1}})),v([he]))}):ee.isDirectory&&f(ee,function(he){he.forEach(function(ge){J(ge,""+ye+ee.name+"/")})})};C.forEach(function(J){G(J.webkitGetAsEntry())})},s=d,u=Object.assign||function(U){for(var C=1;C<arguments.length;C++){var v=arguments[C];for(var j in v)Object.prototype.hasOwnProperty.call(v,j)&&(U[j]=v[j])}return U},o=function(){function U(C,v){var j=[],G=!0,J=!1,ee=void 0;try{for(var ye=C[Symbol.iterator](),he;!(G=(he=ye.next()).done)&&!(j.push(he.value),v&&j.length===v);G=!0);}catch(ge){J=!0,ee=ge}finally{try{!G&&ye.return&&ye.return()}finally{if(J)throw ee}}return j}return function(C,v){if(Array.isArray(C))return C;if(Symbol.iterator in Object(C))return U(C,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function U(C,v){for(var j=0;j<v.length;j++){var G=v[j];G.enumerable=G.enumerable||!1,G.configurable=!0,"value"in G&&(G.writable=!0),Object.defineProperty(C,G.key,G)}}return function(C,v,j){return v&&U(C.prototype,v),j&&U(C,j),C}}();function l(U,C,v){return C in U?Object.defineProperty(U,C,{value:v,enumerable:!0,configurable:!0,writable:!0}):U[C]=v,U}function h(U,C){var v={};for(var j in U){if(C.indexOf(j)>=0)continue;if(!Object.prototype.hasOwnProperty.call(U,j))continue;v[j]=U[j]}return v}function A(U,C){if(!(U instanceof C))throw new TypeError("Cannot call a class as a function")}function x(U,C){if(!U)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:U}function T(U,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);U.prototype=Object.create(C&&C.prototype,{constructor:{value:U,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(U,C):U.__proto__=C)}var O=function(C){return Object.keys(C).reduce(function(v,j){return(j.substr(0,5)==="data-"||j.substr(0,5)==="aria-"||j==="role")&&(v[j]=C[j]),v},{})},S=function(U){T(C,U);function C(){var v,j,G,J;A(this,C);for(var ee=arguments.length,ye=Array(ee),he=0;he<ee;he++)ye[he]=arguments[he];return J=(j=(G=x(this,(v=C.__proto__||Object.getPrototypeOf(C)).call.apply(v,[this].concat(ye))),G),G.state={uid:R()},G.reqs={},G.onChange=function(ge){var pe=ge.target.files;G.uploadFiles(pe),G.reset()},G.onClick=function(ge){var pe=G.fileInput;if(!pe)return;var oe=G.props,ie=oe.children,ue=oe.onClick;ie&&ie.type==="button"&&(pe.parentNode.focus(),pe.parentNode.querySelector("button").blur()),pe.click(),ue&&ue(ge)},G.onKeyDown=function(ge){ge.key==="Enter"&&G.onClick()},G.onFileDrop=function(ge){var pe=G.props.multiple;if(ge.preventDefault(),ge.type==="dragover")return;if(G.props.directory)s(Array.prototype.slice.call(ge.dataTransfer.items),G.uploadFiles,function(ie){return p(ie,G.props.accept)});else{var oe=Array.prototype.slice.call(ge.dataTransfer.files).filter(function(ie){return p(ie,G.props.accept)});pe===!1&&(oe=oe.slice(0,1)),G.uploadFiles(oe)}},G.uploadFiles=function(ge){var pe=Array.prototype.slice.call(ge);pe.map(function(oe){return oe.uid=R(),oe}).forEach(function(oe){G.upload(oe,pe)})},G.saveFileInput=function(ge){G.fileInput=ge},j),x(G,J)}return a(C,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(j,G){var J=this,ee=this.props;if(!ee.beforeUpload)return setTimeout(function(){return J.post(j)},0);var ye=ee.beforeUpload(j,G);ye&&ye.then?ye.then(function(he){var ge=Object.prototype.toString.call(he);return ge==="[object File]"||ge==="[object Blob]"?J.post(he):J.post(j)}).catch(function(he){console.log(he)}):ye!==!1&&setTimeout(function(){return J.post(j)},0);return}},{key:"post",value:function(j){var G=this;if(!this._isMounted)return;var J=this.props,ee=J.onStart,ye=J.onProgress,he=J.transformFile,ge=he===void 0?function(pe){return pe}:he;new Promise(function(pe){var oe=J.action;return typeof oe=="function"&&(oe=oe(j)),pe(oe)}).then(function(pe){var oe=j.uid,ie=J.customRequest||W,ue=Promise.resolve(ge(j)).then(function($){var re=J.data;return typeof re=="function"&&(re=re($)),Promise.all([$,re])}).catch(function($){console.error($)});ue.then(function($){var re=o($,2),q=re[0],be=re[1],Oe={action:pe,filename:J.name,data:be,file:q,headers:J.headers,withCredentials:J.withCredentials,method:J.method||"post",onProgress:ye?function(_e){ye(_e,j)}:null,onSuccess:function(xe,Re){delete G.reqs[oe],J.onSuccess(xe,j,Re)},onError:function(xe,Re){delete G.reqs[oe],J.onError(xe,Re,j)}};ee(j),G.reqs[oe]=ie(Oe)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function(j){var G=this.reqs;if(j){var J=j;j&&j.uid&&(J=j.uid),G[J]&&G[J].abort&&G[J].abort(),delete G[J]}else Object.keys(G).forEach(function(ee){G[ee]&&G[ee].abort&&G[ee].abort(),delete G[ee]})}},{key:"render",value:function(){var j,G=this.props,J=G.component,ee=G.prefixCls,ye=G.className,he=G.disabled,ge=G.id,pe=G.style,oe=G.multiple,ie=G.accept,ue=G.children,$=G.directory,re=G.openFileDialogOnClick,q=G.onMouseEnter,be=G.onMouseLeave,Oe=h(G,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),_e=z()((j={},l(j,ee,!0),l(j,ee+"-disabled",he),l(j,ye,ye),j)),xe=he?{}:{onClick:re?this.onClick:function(){},onKeyDown:re?this.onKeyDown:function(){},onMouseEnter:q,onMouseLeave:be,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return V.a.createElement(J,u({},xe,{className:_e,role:"button",style:pe}),V.a.createElement("input",u({},O(Oe),{id:ge,type:"file",ref:this.saveFileInput,onClick:function(ke){return ke.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ie,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:oe,onChange:this.onChange})),ue)}}]),C}(ae.Component),E=S,w=Object.assign||function(U){for(var C=1;C<arguments.length;C++){var v=arguments[C];for(var j in v)Object.prototype.hasOwnProperty.call(v,j)&&(U[j]=v[j])}return U},b=function(){function U(C,v){for(var j=0;j<v.length;j++){var G=v[j];G.enumerable=G.enumerable||!1,G.configurable=!0,"value"in G&&(G.writable=!0),Object.defineProperty(C,G.key,G)}}return function(C,v,j){return v&&U(C.prototype,v),j&&U(C,j),C}}();function c(U,C){if(!(U instanceof C))throw new TypeError("Cannot call a class as a function")}function y(U,C){if(!U)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:U}function m(U,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);U.prototype=Object.create(C&&C.prototype,{constructor:{value:U,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(U,C):U.__proto__=C)}function _(){}var P=function(U){m(C,U);function C(){var v,j,G,J;c(this,C);for(var ee=arguments.length,ye=Array(ee),he=0;he<ee;he++)ye[he]=arguments[he];return J=(j=(G=y(this,(v=C.__proto__||Object.getPrototypeOf(C)).call.apply(v,[this].concat(ye))),G),G.saveUploader=function(ge){G.uploader=ge},j),y(G,J)}return b(C,[{key:"abort",value:function(j){this.uploader.abort(j)}},{key:"render",value:function(){return V.a.createElement(E,w({},this.props,{ref:this.saveUploader}))}}]),C}(ae.Component);P.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:_,onError:_,onSuccess:_,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var I=P,B=Qe.a=I},HmJG:function(ut,Qe,ne){},LdHM:function(ut,Qe,ne){"use strict";ne.d(Qe,"b",function(){return h}),ne.d(Qe,"a",function(){return x});var ae=ne("1OyB"),V=ne("vuIU"),D=ne("Ji7U"),z=ne("LK+K"),N=ne("cDcd"),M=ne("rePB"),W=ne("Ff2n"),F=ne("ODXe"),k=ne("4IlW"),R=ne("bX4T"),g=ne("YrtM"),p=ne("TSYQ"),f=ne.n(p),d=ne("+nKL"),s=ne("8OUc"),u=function(j,G){var J=j.prefixCls,ee=j.id,ye=j.flattenOptions,he=j.childrenAsData,ge=j.values,pe=j.searchValue,oe=j.multiple,ie=j.defaultActiveFirstOption,ue=j.height,$=j.itemHeight,re=j.notFoundContent,q=j.open,be=j.menuItemSelectedIcon,Oe=j.virtual,_e=j.onSelect,xe=j.onToggleOpen,Re=j.onActiveValue,ke=j.onScroll,De=j.onMouseEnter,Le="".concat(J,"-item"),Ce=Object(g.a)(function(){return ye},[q,ye],function(Ne,ve){return ve[0]&&Ne[1]!==ve[1]}),We=N.useRef(null),Je=function(ve){ve.preventDefault()},Xe=function(ve){We.current&&We.current.scrollTo({index:ve})},Ke=function(ve){for(var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,fe=Ce.length,Q=0;Q<fe;Q+=1){var Z=(ve+Q*ce+fe)%fe,te=Ce[Z],le=te.group,me=te.data;if(!le&&!me.disabled)return Z}return-1},qe=N.useState(function(){return Ke(0)}),Be=Object(F.a)(qe,2),Ue=Be[0],we=Be[1],Ze=function(ve){we(ve);var ce=Ce[ve];if(!ce){Re(null,-1);return}Re(ce.data.value,ve)};N.useEffect(function(){Ze(ie!==!1?Ke(0):-1)},[Ce.length,pe]),N.useEffect(function(){var Ne=setTimeout(function(){if(!oe&&q&&ge.size===1){var ve=Array.from(ge)[0],ce=Ce.findIndex(function(fe){var Q=fe.data;return Q.value===ve});Ze(ce),Xe(ce)}});return function(){return clearTimeout(Ne)}},[q]);var Ve=function(ve){ve!==void 0&&_e(ve,{selected:!ge.has(ve)}),oe||xe(!1)};if(N.useImperativeHandle(G,function(){return{onKeyDown:function(ve){var ce=ve.which;switch(ce){case k.a.UP:case k.a.DOWN:{var fe=0;if(ce===k.a.UP?fe=-1:ce===k.a.DOWN&&(fe=1),fe!==0){var Q=Ke(Ue+fe,fe);Xe(Q),Ze(Q)}break}case k.a.ENTER:{var Z=Ce[Ue];Z&&!Z.data.disabled?Ve(Z.data.value):Ve(void 0),q&&ve.preventDefault();break}case k.a.ESC:xe(!1)}},onKeyUp:function(){},scrollTo:function(ve){Xe(ve)}}}),Ce.length===0)return N.createElement("div",{role:"listbox",id:"".concat(ee,"_list"),className:"".concat(Le,"-empty"),onMouseDown:Je},re);function Se(Ne){var ve=Ce[Ne];if(!ve)return null;var ce=ve.data||{},fe=ce.value,Q=ce.label,Z=ce.children,te=Object(R.a)(ce,!0),le=he?Z:Q;return ve?N.createElement("div",Object.assign({"aria-label":typeof le=="string"?le:null},te,{key:Ne,role:"option",id:"".concat(ee,"_list_").concat(Ne),"aria-selected":ge.has(fe)}),fe):null}return N.createElement(N.Fragment,null,N.createElement("div",{role:"listbox",id:"".concat(ee,"_list"),style:{height:0,width:0,overflow:"hidden"}},Se(Ue-1),Se(Ue),Se(Ue+1)),N.createElement(d.a,{itemKey:"key",ref:We,data:Ce,height:ue,itemHeight:$,fullHeight:!1,onMouseDown:Je,onScroll:ke,virtual:Oe,onMouseEnter:De},function(Ne,ve){var ce,fe=Ne.group,Q=Ne.groupOption,Z=Ne.data,te=Z.label,le=Z.key;if(fe)return N.createElement("div",{className:f()(Le,"".concat(Le,"-group"))},te!==void 0?te:le);var me=Z.disabled,Ae=Z.value,Me=Z.title,ze=Z.children,nt=Z.style,tt=Z.className,xt=Object(W.a)(Z,["disabled","value","title","children","style","className"]),ft=ge.has(Ae),it="".concat(Le,"-option"),Ot=f()(Le,it,tt,(ce={},Object(M.a)(ce,"".concat(it,"-grouped"),Q),Object(M.a)(ce,"".concat(it,"-active"),Ue===ve&&!me),Object(M.a)(ce,"".concat(it,"-disabled"),me),Object(M.a)(ce,"".concat(it,"-selected"),ft),ce)),at=he?ze:te,yt=!be||typeof be=="function"||ft;return N.createElement("div",Object.assign({},xt,{"aria-selected":ft,className:Ot,title:Me,onMouseMove:function(){if(Ue===ve||me)return;Ze(ve)},onClick:function(){me||Ve(Ae)},style:nt}),N.createElement("div",{className:"".concat(it,"-content")},at||Ae),N.isValidElement(be)||ft,yt&&N.createElement(s.a,{className:"".concat(Le,"-option-state"),customizeIcon:be,customizeIconProps:{isSelected:ft}},ft?"\u2713":null))}))},o=N.forwardRef(u);o.displayName="OptionList";var a=o,l=function(){return null};l.isSelectOption=!0;var h=l,A=function(){return null};A.isSelectOptGroup=!0;var x=A,T=ne("VTBJ"),O=ne("Zm9Q");function S(v){var j=v.key,G=v.props,J=G.children,ee=G.value,ye=Object(W.a)(G,["children","value"]);return Object(T.a)({key:j,value:ee!==void 0?ee:j,children:J},ye)}function E(v){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(v).map(function(G,J){if(!N.isValidElement(G)||!G.type)return null;var ee=G.type.isSelectOptGroup,ye=G.key,he=G.props,ge=he.children,pe=Object(W.a)(he,["children"]);return j||!ee?S(G):Object(T.a)(Object(T.a)({key:"__RC_SELECT_GRP__".concat(ye===null?J:ye,"__"),label:ye},pe),{},{options:E(ge)})}).filter(function(G){return G})}var w=ne("2Qr1"),b=ne("qNPg"),c=ne("U8pU"),y=ne("Kwbf"),m=ne("WKfj");function _(v){var j=v.mode,G=v.options,J=v.children,ee=v.backfill,ye=v.allowClear,he=v.placeholder,ge=v.getInputElement,pe=v.showSearch,oe=v.onSearch,ie=v.defaultOpen,ue=v.autoFocus,$=v.labelInValue,re=v.value,q=v.inputValue,be=v.optionLabelProp,Oe=j==="multiple"||j==="tags",_e=pe!==void 0?pe:Oe||j==="combobox",xe=G||E(J);if(Object(y.a)(j!=="tags"||xe.every(function(Le){return!Le.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),j==="tags"||j==="combobox"){var Re=xe.some(function(Le){return Le.options?Le.options.some(function(Ce){return typeof("value"in Ce?Ce.value:Ce.key)=="number"}):typeof("value"in Le?Le.value:Le.key)=="number"});Object(y.a)(!Re,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(y.a)(j!=="combobox"||!be,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(y.a)(j==="combobox"||!ee,"`backfill` only works with `combobox` mode."),Object(y.a)(j==="combobox"||!ge,"`getInputElement` only work with `combobox` mode."),Object(y.b)(j!=="combobox"||!ge||!ye||!he,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),oe&&!_e&&j!=="combobox"&&j!=="tags"&&Object(y.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(y.b)(!ie||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),re!=null){var ke=Object(m.d)(re);Object(y.a)(!$||ke.every(function(Le){return Object(c.a)(Le)==="object"&&("key"in Le||"value"in Le)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(y.a)(!Oe||Array.isArray(re),"`value` should be array when `mode` is `multiple` or `tags`")}if(J){var De=null;Object(O.a)(J).some(function(Le){if(!N.isValidElement(Le)||!Le.type)return!1;var Ce=Le.type;if(Ce.isSelectOption)return!1;if(Ce.isSelectOptGroup){var We=Object(O.a)(Le.props.children).every(function(Je){return!N.isValidElement(Je)||!Le.type||Je.type.isSelectOption?!0:(De=Je.type,!1)});return!We}return De=Ce,!0}),De&&Object(y.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(De.displayName||De.name||De,"`.")),Object(y.a)(q===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=_,I=Object(b.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:E,flattenOptions:w.d,getLabeledValue:w.e,filterOptions:w.b,isValueDisabled:w.g,findValueOption:w.c,warningProps:P,fillOptionsWithMissingValue:w.a}),B=function(v){Object(D.a)(G,v);var j=Object(z.a)(G);function G(){var J;return Object(ae.a)(this,G),J=j.apply(this,arguments),J.selectRef=N.createRef(),J.focus=function(){J.selectRef.current.focus()},J.blur=function(){J.selectRef.current.blur()},J}return Object(V.a)(G,[{key:"render",value:function(){return N.createElement(I,Object.assign({ref:this.selectRef},this.props))}}]),G}(N.Component);B.Option=h,B.OptGroup=x;var U=B,C=Qe.c=U},M8RZ:function(ut,Qe,ne){"use strict";ne.d(Qe,"a",function(){return k});var ae=ne("fWQN"),V=ne("mtLc"),D=ne("yKVA"),z=ne("879j"),N=ne("cDcd"),M=ne.n(N),W=ne("faye"),F=ne.n(W),k=function(R){Object(D.a)(p,R);var g=Object(z.a)(p);function p(f){var d;Object(ae.a)(this,p),d=g.call(this,f);var s=window.document;return d.node=s.createElement("div"),s.body.appendChild(d.node),d}return Object(V.a)(p,[{key:"render",value:function(){var d=this.props.children;return Object(W.createPortal)(d,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(M.a.Component)},Ot1p:function(ut,Qe,ne){"use strict";var ae=ne("2qtc"),V=ne("kLXV"),D=ne("rAM+"),z=ne("miYZ"),N=ne("tsqr"),M=ne("9og8"),W=ne("tJVT"),F=ne("jrin"),k=ne("WmNS"),R=ne.n(k),g=ne("cDcd"),p=ne.n(g),f=ne("VrN/"),d=ne.n(f),s=ne("bdgK"),u=ne("p77/"),o=ne("Bd2K"),a=ne("ELLl"),l=ne("19Vz"),h=ne("lZu9"),A=ne("+NIl"),x=ne("kSUc"),T=ne("9Bee"),O=function(me){var Ae=me.value,Me=Ae===void 0?"":Ae,ze=me.className,nt=me.showTextOnly,tt=me.showLines,xt=me.style,ft=xt===void 0?{}:xt,it=Object(g.useMemo)(function(){return""},[Me]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:it}}))},S=ne("0Owb"),E=ne("dejd"),w=ne("C+DQ"),b=ne("1vsH"),c=ne("m3rI"),y=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(me){var Ae=me.onActionCallback,Me=me.title,ze=me.icon,nt=me.actionName,tt=me.className,xt=tt===void 0?"":tt,ft=me.children;function it(){Ae(nt)}return p.a.createElement("a",{title:Me,className:xt,onClick:it},p.a.createElement("i",{className:"md-iconfont ".concat(ze)}),ft)}var _=function(me){var Ae=me.watch,Me=me.showNullButton,ze=me.onActionCallback,nt=me.fullScreen,tt=me.insertTemp,xt=me.hidetoolBar,ft=me.uuid,it=me.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(b.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(b.G)("_educoder_session"),"&key=").concat(ft,"&api=").concat(encodeURIComponent(c.a.PROXY_SERVER)));var Ot=[].concat(y,[{title:"".concat(Ae?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ae?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!xt&&Ot.map(function(at,yt){return p.a.createElement("li",{key:yt},at.actionName?p.a.createElement(m,Object(S.a)({},at,{onActionCallback:ze})):p.a.createElement("span",{className:"v-line"}))}),Me?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:ze},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,tt&&p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(tt),onActionCallback:ze},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(nt?"icon-shrink":"icon-enlarge"),title:nt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ze})))},P=ne("M8RZ"),I=ne("+L6B"),B=ne("2/Rp"),U=ne("y8nQ"),C=ne("Vl3Y"),v=ne("5NDa"),j=ne("5rEg"),G={labelCol:{span:4},wrapperCol:{span:20}},J=function(me){var Ae=me.callback,Me=me.onCancel;function ze(nt){Ae(nt)}return p.a.createElement(C.a,Object(S.a)({},G,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ze}),p.a.createElement(C.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(j.a,null)),p.a.createElement(C.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(j.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(B.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},ee=ne("7ahc"),ye=ne("HmJG"),he=ne("BjJ7"),ge=C.a.useForm,pe={width:280,marginRight:10},oe={labelCol:{span:5},wrapperCol:{span:19}},ie=function(me){var Ae=me.callback,Me=me.onCancel,ze=ge(),nt=Object(W.a)(ze,1),tt=nt[0];function xt(Ot){Ae(Ot)}function ft(Ot,at){if(Ot.status===-1){N.b.error(Ot.message);return}tt.setFieldsValue({src:"/api/attachments/".concat(Ot.id),type:at.type})}function it(Ot){var at=Ot.target.files[0];$(at,ft)}return p.a.createElement(C.a,Object(S.a)({form:tt},oe,{className:"upload-image-panel",onFinish:xt}),p.a.createElement(C.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(C.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(j.a,{style:pe})),p.a.createElement(ue,{onFileChange:it}))),p.a.createElement(C.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(j.a,{style:{width:264}})),p.a.createElement(C.a.Item,{style:{textAlign:"right"}},p.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(B.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))};function ue(me){var Ae=me.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:Ae}))}function $(me,Ae){if(!me)throw new String("\u6CA1\u6709\u6587\u4EF6");var Me=new FormData;Me.append("editormd-image-file",me),Me.append("file_param_name","editormd-image-file"),Me.append("byxhr","true");var ze=new window.XMLHttpRequest;ze.withCredentials=!0,ze.addEventListener("load",function(nt){Ae(JSON.parse(nt.target.responseText),me)},!1),ze.addEventListener("error",function(nt){console.error(nt)},!1),ze.open("POST","".concat(he.a,"/api/attachments.json")),ze.send(Me)}var re=ne("giR+"),q=ne("fyUT"),be=ne("7Kak"),Oe=ne("9yH6"),_e=Oe.a.Group,xe={margin:"0 8px"},Re=function(me){var Ae=me.callback,Me=me.onCancel;function ze(nt){Ae(nt)}return p.a.createElement(C.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ze},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:xe},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:xe},"\u884C\u6570"),p.a.createElement(C.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(q.a,null)),p.a.createElement("span",{style:xe},"\u5217\u6570"),p.a.createElement(C.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(q.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:xe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(C.a.Item,{name:"align"},p.a.createElement(_e,null,p.a.createElement(Oe.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(Oe.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(Oe.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(Oe.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(B.a,{type:"ghost",onClick:Me},"\u53D6\u6D88")))},ke=ne("ErOA"),De=ne("7Cbv"),Le="link",Ce="upload-image",We="code-block",Je="add-table",Xe="------------",Ke={default:Xe,left:":".concat(Xe),center:":".concat(Xe,":"),right:"".concat(Xe,":")},qe=ne("9VGf"),Be,Ue;function we(){}var Ze=0,Ve=1e4,Se="\u2581",Ne=`
|
|
**\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 ve(me){return/^\d+$/.test(me)?"".concat(me,"px"):me}var ce=navigator.platform.toUpperCase().indexOf("MAC")>=0,fe=ce?"Cmd":"Ctrl",Q=["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"],Z=(Be={},Object(F.a)(Be,fe+"-B","bold"),Object(F.a)(Be,fe+"-I","italic"),Be),te=(Ue={},Object(F.a)(Ue,Le,"\u6DFB\u52A0\u94FE\u63A5"),Object(F.a)(Ue,We,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(F.a)(Ue,Ce,"\u6DFB\u52A0\u6587\u4EF6"),Object(F.a)(Ue,Je,"\u6DFB\u52A0\u8868\u683C"),Ue),le=Qe.a=function(me){var Ae=me.defaultValue,Me=Ae===void 0?"":Ae,ze=me.onChange,nt=me.width,tt=nt===void 0?"100%":nt,xt=me.height,ft=xt===void 0?400:xt,it=me.miniToolbar,Ot=it===void 0?!1:it,at=me.isFocus,yt=at===void 0?!1:at,bt=me.watch,Ge=me.insertTemp,en=me.mode,tn=en===void 0?"markdown":en,pt=me.id,st=pt===void 0?"markdown-editor-id":pt,wt=me.showResizeBar,Dt=wt===void 0?!1:wt,jt=me.noStorage,gn=jt===void 0?!1:jt,Gr=me.showNullButton,Ft=Gr===void 0?!1:Gr,ot=me.hidetoolBar,Pn=ot===void 0?!1:ot,gr=me.fullScreen,sn=gr===void 0?!1:gr,Rt=me.onBlur,Tn=me.onCMBeforeChange,Nn=me.onFullScreen,vr=me.className,Fe=vr===void 0?"":vr,mt=me.disablePaste,zr=mt===void 0?!1:mt,yr=me.placeholder,_r=yr===void 0?"":yr,er=me.values,br=er===void 0?"":er,vt=Object(g.useState)(null),Ai=Object(W.a)(vt,2),je=Ai[0],Er=Ai[1],bn=Object(g.useState)(Me),Vr=Object(W.a)(bn,2),tr=Vr[0],xn=Vr[1],Xr=Object(g.useState)(bt),Yr=Object(W.a)(Xr,2),wn=Yr[0],$r=Yr[1],Ri=Object(g.useState)(sn),Qr=Object(W.a)(Ri,2),Sn=Qr[0],Ci=Qr[1],aa=Object(g.useState)(""),Jr=Object(W.a)(aa,2),nn=Jr[0],Gn=Jr[1],sa=Object(g.useState)(0),nr=Object(W.a)(sa,2),On=nr[0],Zr=nr[1],oa=Object(g.useState)(ft),Li=Object(W.a)(oa,2),Ii=Li[0],Tr=Li[1],Di=Object(g.useState)(!1),ki=Object(W.a)(Di,2),la=ki[0],xr=ki[1],rr=Object(g.useRef)(Object(De.a)()),ir=Object(g.useRef)(!1),wr=Object(g.useRef)(),Fn=Object(g.useRef)(),Un=Object(g.useRef)(),Bn=Object(g.useRef)(),Sr=Object(g.useRef)(),Mi=function(){var lt=Object(M.a)(R.a.mark(function gt(){var ct,Et;return R.a.wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:return kt.next=2,Object(ke.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:rr.current}});case 2:Et=kt.sent,Et!=null&&(ct=Et.attachments)!==null&&ct!==void 0&&ct.length&&(console.log("cm:",je,Fn),Et.attachments.map(function(St){St.content_type.indexOf("image")>-1?je.replaceSelection(".concat(St.content_type,")")):St.content_type.indexOf("video")>-1?je.replaceSelection('<video width="100%" controls src="'.concat(c.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):St.content_type.indexOf("pdf")>-1?je.replaceSelection('<a href="'.concat(c.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):je.replaceSelection("[".concat(St.name,"](").concat(c.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}));case 4:case"end":return kt.stop()}},gt)}));return function(){return lt.apply(this,arguments)}}();Object(g.useEffect)(function(){xn(br),je==null||je.setValue(br)},[br]),Object(g.useEffect)(function(){Nn==null||Nn(Sn)},[Sn]),Object(g.useEffect)(function(){if(Fn.current){var lt=d.a.fromTextArea(Fn.current,{mode:tn,lineNumbers:!Ot,lineWrapping:!0,value:Me,autoCloseTags:!0,autoCloseBrackets:!0});yt&<.focus();function gt(ct,Et){if(zr){Et.preventDefault();return}var At=Et.clipboardData;if(At){var kt=At.types.toString(),St=At.items;if(kt==="Files"||At.types.indexOf("Files")>-1){if(Et.preventDefault(),tn=="stex")return;try{var Kt,on=St[1];((Kt=St[0])===null||Kt===void 0?void 0:Kt.kind)==="file"&&(on=St[0]);var Tt=on.getAsFile(),jn=Tt.name.split(".").pop();$(Tt,function(Ct){if(Ct.id){var ln,Jt,En;(Tt==null||((ln=Tt.type)===null||ln===void 0)?void 0:ln.indexOf("image"))>-1?lt.replaceSelection(".concat(Ct.content_type,")")):(Tt==null||((Jt=Tt.type)===null||Jt===void 0)?void 0:Jt.indexOf("video"))>-1?lt.replaceSelection('<video width="100%" controls src="'.concat(c.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(Tt==null||((En=Tt.type)===null||En===void 0)?void 0:En.indexOf("pdf"))>-1?lt.replaceSelection('<a href="'.concat(c.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Tt.type,'&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):Q.includes(jn)?lt.replaceSelection('<a href="'.concat(c.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):lt.replaceSelection("[".concat(Tt.name,"](").concat(c.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})}catch(Ct){N.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return lt.on("paste",gt),lt.on("dragleave",function(ct,Et){Un.current.classList.remove("mouse-hover-md")}),lt.on("dragover",function(ct,Et){Un.current.classList.add("mouse-hover-md")}),lt.on("drop",function(ct,Et){Un.current.classList.add("mouse-hover-md");var At;if(At=Et.dataTransfer.files,At.length>0){Et.preventDefault(),Et.stopPropagation();for(var kt=function(on){var Tt=At[on],jn=Tt.name.split(".").pop();$(Tt,function(Ct){if(Ct.id){var ln,Jt,En;(Tt==null||((ln=Tt.type)===null||ln===void 0)?void 0:ln.indexOf("image"))>-1?lt.replaceSelection(".concat(Ct.content_type,")")):(Tt==null||((Jt=Tt.type)===null||Jt===void 0)?void 0:Jt.indexOf("video"))>-1?lt.replaceSelection('<video width="100%" controls src="'.concat(c.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(Tt==null||((En=Tt.type)===null||En===void 0)?void 0:En.indexOf("pdf"))>-1?lt.replaceSelection('<a href="'.concat(c.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Tt.type,'&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):Q.includes(jn)?lt.replaceSelection('<a href="'.concat(c.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):lt.replaceSelection("[".concat(Tt.name,"](").concat(c.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})},St=0;St<At.length;St++)kt(St)}}),Er(lt),function(){lt.off("paste",gt)}}},[]);var vn=Object(g.useCallback)(function(){if(Un.current)try{}catch(lt){console.log(lt,"---- to set md editor body height")}},[Ii,Un,Sn]);Object(g.useEffect)(function(){function lt(){var ct=new s.default(function(Et){var At=Object(D.a)(Et),kt;try{for(At.s();!(kt=At.n()).done;){var St=kt.value;(St.target.offsetHeight>0||St.target.offsetWidth>0)&&(vn(),je.setSize("100%","100%"),je.refresh())}}catch(Kt){At.e(Kt)}finally{At.f()}});return ct.observe(Fn.current.parentElement),ct}if(je){var gt=lt();return function(){gt.unobserve(Fn.current.parentElement)}}},[je,vn]),Object(g.useEffect)(function(){if(je){for(var lt=[],gt=function(){var St=Et[ct];At=Object(W.a)(St,2);var Kt=At[0],on=At[1],Tt=Object(F.a)({},Kt,function(){Pi(on)});lt.push(Tt),je.addKeyMap(Tt)},ct=0,Et=Object.entries(Z);ct<Et.length;ct++){var At;gt()}return wr.current=setInterval(function(){ir.current&&Mi()},4e3),function(){clearInterval(wr.current);var kt=Object(D.a)(lt),St;try{for(kt.s();!(St=kt.n()).done;){var Kt=St.value;je.removeKeyMap(Kt)}}catch(on){kt.e(on)}finally{kt.f()}}}},[je]),Object(g.useEffect)(function(){sn!==Sn&&Ci(sn)},[sn]),Object(qe.a)(function(){if(!gn&&On>0){var lt=new Date().getTime(),gt=window.sessionStorage.getItem(st);lt>=On+Ve&&(!gt||gt!==tr)&&(window.sessionStorage.setItem(st,tr),xr(!0))}},Ve),Object(g.useEffect)(function(){$r(bt)},[je,bt]),Object(g.useEffect)(function(){je&&(yt&&je.focus())},[je,yt]),Object(g.useEffect)(function(){if(wn&&je){var lt=je.getScrollerElement();function gt(ct){var Et=ct.target;if(Sr.current){var At=Et.scrollTop/Et.scrollHeight;Sr.current.scrollTop=Sr.current.scrollHeight*At}}return lt.addEventListener("scroll",gt),function(){lt.removeEventListener("scroll",gt)}}},[je,wn]),Object(g.useEffect)(function(){if(je&&Tn){function lt(gt,ct){Tn(gt,ct)}return je.on("beforeChange",lt),function(){je.off("beforeChange",lt)}}},[je,Tn]),Object(g.useEffect)(function(){if(je&&Rt){function lt(){Rt(je.getValue())}return je.on("blur",lt),function(){je.off("blur",lt)}}},[je,Rt]),Object(g.useEffect)(function(){if(je){function lt(gt){var ct=gt.getValue();xn(ct),Zr(new Date().getTime()),gt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ze&&ze(ct)}return je.on("change",lt),function(){je.off("change",lt)}}},[je,ze]),Object(g.useEffect)(function(){je&&(Me==null?(je.setValue(""),xn("")):Me!==je.getValue()&&(je.setValue(Me),xn(Me),je.setCursor(je.lineCount(),0)))},[je,Me]);var Pi=Object(g.useCallback)(function(lt){var gt=je.getCursor(),ct=je.getSelection(),Et=ct.split(`
|
|
`);switch(lt){case"bold":return je.replaceSelection("**"+ct+"**"),ct===""&&je.setCursor(gt.line,gt.ch+2),je.focus();case"italic":return je.replaceSelection("*"+ct+"*"),ct===""&&je.setCursor(gt.line,gt.ch+1),je.focus();case"code":return je.replaceSelection("`"+ct+"`"),ct===""&&je.setCursor(gt.line,gt.ch+1),je.focus();case"inline-latex":return je.replaceSelection("`$$"+ct+"$$`"),ct===""&&je.setCursor(gt.line,gt.ch+3),je.focus();case"latex":return je.replaceSelection("```latex\n"+ct+"\n```"),je.setCursor(gt.line+1,ct.length+1),je.focus();case"line-break":return je.replaceSelection(`<br/>
|
|
`),je.focus();case"list-ul":return ct===""?je.replaceSelection("- "+ct):je.replaceSelection(Et.map(function(At){return At===""?"":"- ".concat(At)}).join(`
|
|
`)),je.focus();case"list-ol":return ct===""?je.replaceSelection("1. "+ct):je.replaceSelection(Et.map(function(At,kt){return At===""?"":"".concat(kt+1,". ").concat(At)}).join(`
|
|
`)),je.focus();case"add-null-ch":return ct===""&&je.setCursor(gt.line,gt.ch+1),je.replaceSelection(Se),je.focus();case"inster-template-1":return ct===""&&je.setCursor(gt.line,gt.ch),je.replaceSelection(Ne),je.focus();case"eraser":return je.setValue(""),je.focus();case"trigger-watch":return $r(!wn),je.focus();case"trigger-full-screen":return Ci(!Sn),je.focus();case Le:Gn(Le);return;case We:Gn(We);return;case Ce:Gn(Ce);return;case Je:Gn(Je);return;default:throw new Error}},[je,wn,Sn]),Or=Object(g.useCallback)(function(lt){Gn("");switch(nn){case Le:var gt=lt.title,ct=lt.link;return je.replaceSelection("[".concat(gt,"](").concat(ct,")")),je.focus();case We:var Et=lt.language,At=lt.content;return je.replaceSelection(["```"+Et,At,"```"].join(`
|
|
`)),je.focus();case Ce:var kt=lt.src,St=lt.alt;return St?je.replaceSelection(".concat(kt,' "').concat(St,'" )')):je.replaceSelection("")),je.focus();case Je:for(var Kt=lt.row,on=lt.col,Tt=lt.align,jn=`
|
|
`,Ct=0;Ct<Kt;Ct++){for(var ln=[],Jt=[],En=0;En<on;En++)Ct===1&&Jt.push(Ke[Tt]),ln.push(" ");Ct===1&&(jn+="| ".concat(Jt.join(" | "),` |
|
|
`)),jn+="| ".concat(ln.join(on===1?"":" | "),` |
|
|
`)}return je.replaceSelection(jn+`
|
|
`),je.focus();default:throw new Error}},[je,nn]),qr=Object(g.useMemo)(function(){switch(nn){case Le:return p.a.createElement(J,{callback:Or,onCancel:zn});case We:return p.a.createElement(ee.b,{callback:Or,onCancel:zn});case Ce:return p.a.createElement(ie,{callback:Or,onCancel:zn});case Je:return p.a.createElement(Re,{callback:Or,onCancel:zn});default:return null}},[nn]);function zn(){Gn("")}Object(g.useEffect)(function(){if(Bn.current){var lt=Bn.current,gt=!1,ct=0;function Et(St){gt=!0,ct=St.pageY}function At(){gt=!1}function kt(St){if(gt){var Kt=St.pageY-ct;Kt<0&&(Kt=0),Kt>300&&(Kt=300);var on=ft+Kt+"px";Tr(on)}}return lt.addEventListener("mousedown",Et),document.addEventListener("mousemove",kt),document.addEventListener("mouseup",At),function(){lt.removeEventListener("mousedown",Et),document.removeEventListener("mousemove",kt),document.removeEventListener("mouseup",At)}}},[je,Bn]),Object(g.useEffect)(function(){Tr(ft)},[ft]);var In=ve(tt),ei=ve(Ii),An={width:In,height:ei},ti=Object(g.useMemo)(function(){if(On){var lt=new Date(On),gt=lt.getHours(),ct=lt.getMinutes(),Et=lt.getSeconds();return gt=gt<10?"0"+gt:gt,ct=ct<10?"0"+ct:ct,Et=Et<10?"0"+Et:Et,"".concat(gt,":").concat(ct,":").concat(Et)}return 0},[On]);function Ni(){window.sessionStorage.removeItem(st),xr(!1),Zr(0)}function ar(){xr(!1),Zr(0),je.setValue(window.sessionStorage.getItem(st))}function ua(lt,gt){var ct=je.getValue();ct=ct.replace(lt,gt),xn(ct),je==null||je.setValue(ct)}return p.a.createElement(g.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:Un},p.a.createElement("div",{className:"markdown-editor-container ".concat(Fe," ").concat(wn?"on-preview":""," ").concat(Ot?"mini":""," ").concat(Sn?"full-screen":""),style:An},p.a.createElement(_,{insertTemp:Ge,watch:wn,fullScreen:Sn,showNullButton:Ft,onActionCallback:Pi,hidetoolBar:Pn,uuid:rr.current,setOpenPhones:function(){ir.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Fn,placeholder:_r})),wn?p.a.createElement("div",{ref:Sr,className:"preview-container"},tn==="stex"&&p.a.createElement(O,{value:tr}),tn!=="stex"&&p.a.createElement(T.a,{edit:!0,value:tr,replaces:ua})):null))),Dt?p.a.createElement("a",{ref:Bn,className:"editor-resize"}):null,p.a.createElement(P.a,null,te[nn]?p.a.createElement(V.a,{centered:!0,title:te[nn],visible:!0,onCancel:zn,footer:null,className:"markdown-popup-form"},qr):null))}},SJMd:function(ut,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 ne,ae,V,D=!1,z,N;window.PR_SHOULD_USE_CONTINUATION=!0;var M,W;(function(){var F=window,k=["break,continue,do,else,for,if,return,while"],R=[k,"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=[R,"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"],s="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",u=[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",a=[k,"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=[k,"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=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],A=[p,d,f,u,o,a,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",w="lit",b="pun",c="pln",y="tag",m="dec",_="src",P="atn",I="atv",B="nocode",U="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function C(_e){for(var xe=0,Re=!1,ke=!1,De=0,Le=_e.length;De<Le;++De){var Ce=_e[De];if(Ce.ignoreCase)ke=!0;else if(/[a-z]/i.test(Ce.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,ke=!1;break}}var We={b:8,t:9,n:10,v:11,f:12,r:13};function Je(Ue){var we=Ue.charCodeAt(0);if(we!==92)return we;var Ze=Ue.charAt(1);return we=We[Ze],we||("0"<=Ze&&Ze<="7"?parseInt(Ue.substring(1),8):Ze==="u"||Ze==="x"?parseInt(Ue.substring(2),16):Ue.charCodeAt(1))}function Xe(Ue){if(Ue<32)return(Ue<16?"\\x0":"\\x")+Ue.toString(16);var we=String.fromCharCode(Ue);return we==="\\"||we==="-"||we==="]"||we==="^"?"\\"+we:we}function Ke(Ue){var we=Ue.substring(1,Ue.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Ze=[],Ve=we[0]==="^",Se=["["];Ve&&Se.push("^");for(var Ne=Ve?1:0,ve=we.length;Ne<ve;++Ne){var ce=we[Ne];if(/\\[bdsw]/i.test(ce))Se.push(ce);else{var fe=Je(ce),Q;Ne+2<ve&&we[Ne+1]==="-"?(Q=Je(we[Ne+2]),Ne+=2):Q=fe,Ze.push([fe,Q]),Q<65||fe>122||(Q<65||fe>90||Ze.push([Math.max(65,fe)|32,Math.min(Q,90)|32]),Q<97||fe>122||Ze.push([Math.max(97,fe)&~32,Math.min(Q,122)&~32]))}}Ze.sort(function(me,Ae){return me[0]-Ae[0]||Ae[1]-me[1]});for(var Z=[],te=[],Ne=0;Ne<Ze.length;++Ne){var le=Ze[Ne];le[0]<=te[1]+1?te[1]=Math.max(te[1],le[1]):Z.push(te=le)}for(var Ne=0;Ne<Z.length;++Ne){var le=Z[Ne];Se.push(Xe(le[0])),le[1]>le[0]&&(le[1]+1>le[0]&&Se.push("-"),Se.push(Xe(le[1])))}return Se.push("]"),Se.join("")}function qe(Ue){for(var we=Ue.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Ze=we.length,Ve=[],Se=0,Ne=0;Se<Ze;++Se){var ve=we[Se];if(ve==="(")++Ne;else if(ve.charAt(0)==="\\"){var ce=+ve.substring(1);ce&&(ce<=Ne?Ve[ce]=-1:we[Se]=Xe(ce))}}for(var Se=1;Se<Ve.length;++Se)Ve[Se]===-1&&(Ve[Se]=++xe);for(var Se=0,Ne=0;Se<Ze;++Se){var ve=we[Se];if(ve==="(")++Ne,Ve[Ne]||(we[Se]="(?:");else if(ve.charAt(0)==="\\"){var ce=+ve.substring(1);ce&&ce<=Ne&&(we[Se]="\\"+Ve[ce])}}for(var Se=0;Se<Ze;++Se)we[Se]==="^"&&we[Se+1]!=="^"&&(we[Se]="");if(Ue.ignoreCase&&Re)for(var Se=0;Se<Ze;++Se){var ve=we[Se],fe=ve.charAt(0);ve.length>=2&&fe==="["?we[Se]=Ke(ve):fe!=="\\"&&(we[Se]=ve.replace(/[a-zA-Z]/g,function(te){var le=te.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return we.join("")}for(var Be=[],De=0,Le=_e.length;De<Le;++De){var Ce=_e[De];if(Ce.global||Ce.multiline)throw new Error(""+Ce);Be.push("(?:"+qe(Ce)+")")}return new RegExp(Be.join("|"),ke?"gi":"g")}function v(_e,xe){var Re=/(?:^|\s)nocode(?:\s|$)/,ke=[],De=0,Le=[],Ce=0;function We(Je){var Xe=Je.nodeType;if(Xe==1){if(Re.test(Je.className))return;for(var Ke=Je.firstChild;Ke;Ke=Ke.nextSibling)We(Ke);var qe=Je.nodeName.toLowerCase();(qe==="br"||qe==="li")&&(ke[Ce]=`
|
|
`,Le[Ce<<1]=De++,Le[Ce++<<1|1]=Je)}else if(Xe==3||Xe==4){var Be=Je.nodeValue;Be.length&&(xe?Be=Be.replace(/\r\n?/g,`
|
|
`):Be=Be.replace(/[ \t\r\n]+/g," "),ke[Ce]=Be,Le[Ce<<1]=De,De+=Be.length,Le[Ce++<<1|1]=Je)}}return We(_e),{sourceCode:ke.join("").replace(/\n$/,""),spans:Le}}function j(_e,xe,Re,ke,De){if(!Re)return;var Le={sourceNode:_e,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:xe,decorations:null};ke(Le),De.push.apply(De,Le.decorations)}var G=/\S/;function J(_e){for(var xe=void 0,Re=_e.firstChild;Re;Re=Re.nextSibling){var ke=Re.nodeType;xe=ke===1?xe?_e:Re:ke===3&&G.test(Re.nodeValue)?_e:xe}return xe===_e?void 0:xe}function ee(_e,xe){var Re={},ke;(function(){for(var Ce=_e.concat(xe),We=[],Je={},Xe=0,Ke=Ce.length;Xe<Ke;++Xe){var qe=Ce[Xe],Be=qe[3];if(Be)for(var Ue=Be.length;--Ue>=0;)Re[Be.charAt(Ue)]=qe;var we=qe[1],Ze=""+we;Je.hasOwnProperty(Ze)||(We.push(we),Je[Ze]=null)}We.push(/[\0-\uffff]/),ke=C(We)})();var De=xe.length,Le=function(Ce){for(var We=Ce.sourceCode,Je=Ce.basePos,Xe=Ce.sourceNode,Ke=[Je,c],qe=0,Be=We.match(ke)||[],Ue={},we=0,Ze=Be.length;we<Ze;++we){var Ve=Be[we],Se=Ue[Ve],Ne=void 0,ve;if(typeof Se=="string")ve=!1;else{var ce=Re[Ve.charAt(0)];if(ce)Ne=Ve.match(ce[1]),Se=ce[0];else{for(var fe=0;fe<De;++fe)if(ce=xe[fe],Ne=Ve.match(ce[1]),Ne){Se=ce[0];break}Ne||(Se=c)}ve=Se.length>=5&&Se.substring(0,5)==="lang-",ve&&!(Ne&&typeof Ne[1]=="string")&&(ve=!1,Se=_),ve||(Ue[Ve]=Se)}var Q=qe;if(qe+=Ve.length,!ve)Ke.push(Je+Q,Se);else{var Z=Ne[1],te=Ve.indexOf(Z),le=te+Z.length;Ne[2]&&(le=Ve.length-Ne[2].length,te=le-Z.length);var me=Se.substring(5);j(Xe,Je+Q,Ve.substring(0,te),Le,Ke),j(Xe,Je+Q+te,Z,ue(me,Z),Ke),j(Xe,Je+Q+le,Ve.substring(le),Le,Ke)}}Ce.decorations=Ke};return Le}function ye(_e){var xe=[],Re=[];_e.tripleQuotedStrings?xe.push([T,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):_e.multiLineStrings?xe.push([T,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):xe.push([T,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),_e.verbatimStrings&&Re.push([T,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ke=_e.hashComments;ke&&(_e.cStyleComments?(ke>1?xe.push([S,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):xe.push([S,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Re.push([T,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):xe.push([S,/^#[^\r\n]*/,null,"#"])),_e.cStyleComments&&(Re.push([S,/^\/\/[^\r\n]*/,null]),Re.push([S,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var De=_e.regexLiterals;if(De){var Le=De>1?"":`
|
|
\r`,Ce=Le?".":"[\\S\\s]",We="/(?=[^/*"+Le+"])(?:[^/\\x5B\\x5C"+Le+"]|\\x5C"+Ce+"|\\x5B(?:[^\\x5C\\x5D"+Le+"]|\\x5C"+Ce+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+U+"("+We+")")])}var Je=_e.types;Je&&Re.push([E,Je]);var Xe=(""+_e.keywords).replace(/^ | $/g,"");Xe.length&&Re.push([O,new RegExp("^(?:"+Xe.replace(/[\s,]+/g,"|")+")\\b"),null]),xe.push([c,/^\s+/,null,` \r
|
|
\xA0`]);var Ke="^.[^\\s\\w.$@'\"`/\\\\]*";return _e.regexLiterals&&(Ke+="(?!s*/)"),Re.push([w,/^@[a-z_$][a-z_$@0-9]*/i,null],[E,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[c,/^[a-z_$][a-z_$@0-9]*/i,null],[w,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[c,/^\\[\s\S]?/,null],[b,new RegExp(Ke),null]),ee(xe,Re)}var he=ye({keywords:A,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ge(_e,xe,Re){for(var ke=/(?:^|\s)nocode(?:\s|$)/,De=/\r\n?|\n/,Le=_e.ownerDocument,Ce=Le.createElement("li");_e.firstChild;)Ce.appendChild(_e.firstChild);var We=[Ce];function Je(we){var Ze=we.nodeType;if(Ze==1&&!ke.test(we.className))if(we.nodeName==="br")Xe(we),we.parentNode&&we.parentNode.removeChild(we);else for(var Ve=we.firstChild;Ve;Ve=Ve.nextSibling)Je(Ve);else if((Ze==3||Ze==4)&&Re){var Se=we.nodeValue,Ne=Se.match(De);if(Ne){var ve=Se.substring(0,Ne.index);we.nodeValue=ve;var ce=Se.substring(Ne.index+Ne[0].length);if(ce){var fe=we.parentNode;fe.insertBefore(Le.createTextNode(ce),we.nextSibling)}Xe(we),ve||we.parentNode.removeChild(we)}}}function Xe(we){for(;!we.nextSibling;)if(we=we.parentNode,!we)return;function Ze(Ne,ve){var ce=ve?Ne.cloneNode(!1):Ne,fe=Ne.parentNode;if(fe){var Q=Ze(fe,1),Z=Ne.nextSibling;Q.appendChild(ce);for(var te=Z;te;te=Z)Z=te.nextSibling,Q.appendChild(te)}return ce}for(var Ve=Ze(we.nextSibling,0),Se;(Se=Ve.parentNode)&&Se.nodeType===1;)Ve=Se;We.push(Ve)}for(var Ke=0;Ke<We.length;++Ke)Je(We[Ke]);xe===(xe|0)&&We[0].setAttribute("value",xe);var qe=Le.createElement("ol");qe.className="linenums";for(var Be=Math.max(0,xe-1|0)||0,Ke=0,Ue=We.length;Ke<Ue;++Ke)Ce=We[Ke],Ce.className="L"+(Ke+Be)%10,Ce.firstChild||Ce.appendChild(Le.createTextNode("\xA0")),qe.appendChild(Ce);_e.appendChild(qe)}function pe(_e){var xe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);xe=xe&&+xe[1]<=8;var Re=/\n/g,ke=_e.sourceCode,De=ke.length,Le=0,Ce=_e.spans,We=Ce.length,Je=0,Xe=_e.decorations,Ke=Xe.length,qe=0;Xe[Ke]=De;var Be,Ue;for(Ue=Be=0;Ue<Ke;)Xe[Ue]!==Xe[Ue+2]?(Xe[Be++]=Xe[Ue++],Xe[Be++]=Xe[Ue++]):Ue+=2;for(Ke=Be,Ue=Be=0;Ue<Ke;){for(var we=Xe[Ue],Ze=Xe[Ue+1],Ve=Ue+2;Ve+2<=Ke&&Xe[Ve+1]===Ze;)Ve+=2;Xe[Be++]=we,Xe[Be++]=Ze,Ue=Ve}Ke=Xe.length=Be;var Se=_e.sourceNode,Ne="";Se&&(Ne=Se.style.display,Se.style.display="none");try{for(var ve=null;Je<We;){var ce=Ce[Je],fe=Ce[Je+2]||De,Q=Xe[qe+2]||De,Ve=Math.min(fe,Q),Z=Ce[Je+1],te;if(Z.nodeType!==1&&(te=ke.substring(Le,Ve))){xe&&(te=te.replace(Re,"\r")),Z.nodeValue=te;var le=Z.ownerDocument,me=le.createElement("span");me.className=Xe[qe+1];var Ae=Z.parentNode;Ae.replaceChild(me,Z),me.appendChild(Z),Le<fe&&(Ce[Je+1]=Z=le.createTextNode(ke.substring(Ve,fe)),Ae.insertBefore(Z,me.nextSibling))}Le=Ve,Le>=fe&&(Je+=2),Le>=Q&&(qe+=2)}}finally{Se&&(Se.style.display=Ne)}}var oe={};function ie(_e,xe){for(var Re=xe.length;--Re>=0;){var ke=xe[Re];oe.hasOwnProperty(ke)?F.console&&console.warn("cannot override language handler %s",ke):oe[ke]=_e}}function ue(_e,xe){return _e&&oe.hasOwnProperty(_e)||(_e=/^\s*</.test(xe)?"default-markup":"default-code"),oe[_e]}ie(he,["default-code"]),ie(ee([],[[c,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[S,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[b,/^(?:<[%?]|[%?]>)/],["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"]),ie(ee([[c,/^[\s]+/,null,` \r
|
|
`],[I,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[y,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[b,/^[=<>\/]+/],["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"]),ie(ee([],[[I,/^[\s\S]+/]]),["uq.val"]),ie(ye({keywords:p,hashComments:!0,cStyleComments:!0,types:x}),["c","cc","cpp","cxx","cyc","m"]),ie(ye({keywords:"null,true,false"}),["json"]),ie(ye({keywords:d,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:x}),["cs"]),ie(ye({keywords:f,cStyleComments:!0}),["java"]),ie(ye({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(ye({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(ye({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(ye({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(ye({keywords:u,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(ye({keywords:s,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(ee([],[[T,/^[\s\S]+/]]),["regex"]);function $(_e){var xe=_e.langExtension;try{var Re=v(_e.sourceNode,_e.pre),ke=Re.sourceCode;_e.sourceCode=ke,_e.spans=Re.spans,_e.basePos=0,ue(xe,ke)(_e),pe(_e)}catch(De){F.console&&console.log(De&&De.stack||De)}}function re(_e,xe,Re){var ke=Re||!1,De=xe||null,Le=document.createElement("div");Le.innerHTML="<pre>"+_e+"</pre>",Le=Le.firstChild,ke&&ge(Le,ke,!0);var Ce={langExtension:De,numberLines:ke,sourceNode:Le,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(Ce),Le.innerHTML}function q(_e,xe){var Re=xe||document.body,ke=Re.ownerDocument||document;function De(ce){return Re.getElementsByTagName(ce)}for(var Le=[De("pre"),De("code"),De("xmp")],Ce=[],We=0;We<Le.length;++We)for(var Je=0,Xe=Le[We].length;Je<Xe;++Je)Ce.push(Le[We][Je]);Le=null;var Ke=Date;Ke.now||(Ke={now:function(){return+new Date}});var qe=0,Be=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ue=/\bprettyprint\b/,we=/\bprettyprinted\b/,Ze=/pre|xmp/i,Ve=/^code$/i,Se=/^(?:pre|code|xmp)$/i,Ne={};function ve(){for(var ce=F.PR_SHOULD_USE_CONTINUATION?Ke.now()+250:Infinity;qe<Ce.length&&Ke.now()<ce;qe++){for(var fe=Ce[qe],Q=Ne,Z=fe;Z=Z.previousSibling;){var te=Z.nodeType,le=(te===7||te===8)&&Z.nodeValue;if(le?!/^\??prettify\b/.test(le):te!==3||/\S/.test(Z.nodeValue))break;if(le){Q={},le.replace(/\b(\w+)=([\w:.%+-]+)/g,function(bt,Ge,en){Q[Ge]=en});break}}var me=fe.className;if((Q!==Ne||Ue.test(me))&&!we.test(me)){for(var Ae=!1,Me=fe.parentNode;Me;Me=Me.parentNode){var ze=Me.tagName;if(Se.test(ze)&&Me.className&&Ue.test(Me.className)){Ae=!0;break}}if(!Ae){fe.className+=" prettyprinted";var nt=Q.lang;if(!nt){nt=me.match(Be);var tt;!nt&&(tt=J(fe))&&Ve.test(tt.tagName)&&(nt=tt.className.match(Be)),nt&&(nt=nt[1])}var xt;if(Ze.test(fe.tagName))xt=1;else{var ft=fe.currentStyle,it=ke.defaultView,Ot=ft?ft.whiteSpace:it&&it.getComputedStyle?it.getComputedStyle(fe,null).getPropertyValue("white-space"):0;xt=Ot&&Ot.substring(0,3)==="pre"}var at=Q.linenums;(at=at==="true"||+at)||(at=me.match(/\blinenums\b(?::(\d+))?/),at=at?at[1]&&at[1].length?+at[1]:!0:!1),at&&ge(fe,at,xt);var yt={langExtension:nt,sourceNode:fe,numberLines:at,pre:xt,sourceCode:null,basePos:null,spans:null,decorations:null};$(yt)}}}qe<Ce.length?F.setTimeout(ve,250):typeof _e=="function"&&_e()}ve()}var be=F.PR={createSimpleLexer:ee,registerLangHandler:ie,sourceDecorator:ye,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:I,PR_COMMENT:S,PR_DECLARATION:m,PR_KEYWORD:O,PR_LITERAL:w,PR_NOCODE:B,PR_PLAIN:c,PR_PUNCTUATION:b,PR_SOURCE:_,PR_STRING:T,PR_TAG:y,PR_TYPE:E,prettyPrintOne:D?F.prettyPrintOne=re:M=re,prettyPrint:W=D?F.prettyPrint=q:W=q},Oe=F.define;typeof Oe=="function"&&Oe.amd&&Oe("google-code-prettify",[],function(){return be})})()},"T+//":function(ut,Qe,ne){"use strict";ne.r(Qe);var ae=ne("Q9mQ"),V=ne("diRs"),D=ne("2qtc"),z=ne("kLXV"),N=ne("miYZ"),M=ne("tsqr"),W=ne("9og8"),F=ne("tJVT"),k=ne("B9cy"),R=ne("Ol7k"),g=ne("lUTK"),p=ne("BvKs"),f=ne("WmNS"),d=ne.n(f),s=ne("cDcd"),u=ne.n(s),o=ne("m3rI"),a=ne("p0QG"),l=ne.n(a),h=ne("ErOA"),A=ne("9kvl"),x=ne("RCxd"),T=ne("xGfz"),O=ne("xKgJ"),S=ne("5NDa"),E=ne("5rEg");function w(oe){var ie=oe.user,ue=oe.CategoryId,$=oe.IsShow,re=oe.setIsShow,q=oe.dispatch,be=oe.init,Oe=Object(s.useState)(),_e=Object(F.a)(Oe,2),xe=_e[0],Re=_e[1];return u.a.createElement(z.a,{title:ue?"\u65B0\u5EFA\u4E09\u7EA7\u7C7B\u76EE":"\u65B0\u5EFA\u4E8C\u7EA7\u7C7B\u76EE",width:424,onCancel:function(){re(!1)},onOk:Object(W.a)(d.a.mark(function ke(){var De;return d.a.wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:if(xe){Ce.next=3;break}return M.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Ce.abrupt("return");case 3:return Ce.next=5,Object(h.a)("/api/programas.json",{method:"post",body:{name:xe,parent_id:ue}});case 5:De=Ce.sent,De.status===0&&(M.b.info("\u521B\u5EFA\u6210\u529F"),re(!1),Re(""),be());case 7:case"end":return Ce.stop()}},ke)})),visible:$},u.a.createElement(E.a,{value:xe,onChange:function(De){return Re(De.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var b=Object(A.a)(function(oe){var ie=oe.user;return{user:ie}})(w);function c(oe){var ie=oe.user,ue=oe.CategoryId,$=oe.name,re=oe.IsShow,q=oe.setIsShow,be=oe.dispatch,Oe=oe.init,_e=Object(s.useState)(),xe=Object(F.a)(_e,2),Re=xe[0],ke=xe[1];return Object(s.useEffect)(function(){ke($)},[$]),u.a.createElement(z.a,{title:"\u76EE\u5F55\u91CD\u547D\u540D",width:424,onCancel:function(){q(!1)},onOk:Object(W.a)(d.a.mark(function De(){var Le;return d.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:if(Re){We.next=3;break}return M.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),We.abrupt("return");case 3:return We.next=5,Object(h.a)("/api/programas/".concat(ue,"/rename.json"),{method:"put",body:{name:Re,id:ue}});case 5:Le=We.sent,Le.status===0&&(M.b.info("\u4FEE\u6539\u6210\u529F"),q(!1),ke(""),Oe());case 7:case"end":return We.stop()}},De)})),visible:re},u.a.createElement(E.a,{value:Re,onChange:function(Le){return ke(Le.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var y=Object(A.a)(function(oe){var ie=oe.user;return{user:ie}})(c),m=ne("+L6B"),_=ne("2/Rp"),P=ne("9Bee");function I(oe){var ie,ue,$,re,q=oe.user,be=oe.ItemData,Oe=oe.setIssee,_e=oe.dispatch,xe=oe.init;return u.a.createElement("div",null,u.a.createElement("div",{style:{textAlign:"right"}},Object(O.v)()&&u.a.createElement(_.a,{onClick:function(){return Oe(!1)}},"\u7F16\u8F91")),u.a.createElement(P.a,{value:be.content}),(be==null||((ie=be.attachment)===null||ie===void 0)?void 0:ie.id)&&u.a.createElement("div",null,u.a.createElement("a",{href:be==null||((ue=be.attachment)===null||ue===void 0)?void 0:ue.url,target:"_self",download:be==null||(($=be.attachment)===null||$===void 0)?void 0:$.title},u.a.createElement("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),u.a.createElement("span",{style:{color:"#000000"}},be==null||((re=be.attachment)===null||re===void 0)?void 0:re.title))))}var B=Object(A.a)(function(oe){var ie=oe.user;return{user:ie}})(I),U=ne("DZo9"),C=ne("8z0m"),v=ne("Ot1p"),j=ne("hJwl");function G(oe){var ie=oe.user,ue=oe.ItemData,$=oe.setIssee,re=oe.CategoryId,q=oe.dispatch,be=oe.init,Oe=Object(s.useState)([]),_e=Object(F.a)(Oe,2),xe=_e[0],Re=_e[1],ke=Object(s.useState)(ue.content),De=Object(F.a)(ke,2),Le=De[0],Ce=De[1];function We(){var Be,Ue=[];return ue==null||((Be=ue.attachments)===null||Be===void 0)||Be.map(function(we){var Ze={uid:we==null?void 0:we.id,name:we.title,response:{id:we.id}};Ue.push(Ze)}),Ue}var Je={name:"file",multiple:!0,action:o.a.API_SERVER+"/api/attachments.json",defaultFileList:We(),onRemove:function(Ue){Object(j.t)({id:Ue.uid})},onChange:function(Ue){console.log("info",Ue);var we=Ue.file.status;we!=="uploading",we==="removed"&&Re(Ue.fileList),we==="done"?(Re(Ue.fileList),M.b.success("".concat(Ue.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"))):we==="error"&&M.b.error("".concat(Ue.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Ue){var we=Ue.size/1024/1024<150;return we||M.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),we}};function Xe(){return Ke.apply(this,arguments)}function Ke(){return Ke=Object(W.a)(d.a.mark(function Be(){var Ue;return d.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:return Ze.next=2,Object(h.a)("/api/programas/".concat(re,"/update_content.json"),{method:"put",body:{id:re,content:Le,attachment_id:qe(xe)}});case 2:Ue=Ze.sent,Ue&&(M.b.info("\u63D0\u4EA4\u6210\u529F"),$(!0));case 4:case"end":return Ze.stop()}},Be)})),Ke.apply(this,arguments)}function qe(Be){var Ue;return Be&&Be.map(function(we){Ue=we.response.id}),Ue}return u.a.createElement("div",null,u.a.createElement(v.a,{defaultValue:Le,onChange:function(Ue){return Ce(Ue)}}),u.a.createElement(C.a,Je,u.a.createElement(_.a,{className:"uploadBtn"},"\u4E0A\u4F20\u9644\u4EF6"),"(\u5355\u4E2A\u6587\u4EF6150M\u4EE5\u5185)"),u.a.createElement("p",{style:{marginTop:"10px"}},u.a.createElement(_.a,{style:{width:"90px"},onClick:function(){return Xe()}},"\u63D0\u4EA4"),u.a.createElement(_.a,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return $(!0)}},"\u53D6\u6D88")))}var J=Object(A.a)(function(oe){var ie=oe.user;return{user:ie}})(G),ee=p.a.SubMenu,ye=R.a.Content,he=R.a.Sider;function ge(oe){var ie,ue=oe.user,$=oe.dispatch,re=oe.globalSetting,q=Object(s.useState)(),be=Object(F.a)(q,2),Oe=be[0],_e=be[1],xe=Object(s.useState)(!1),Re=Object(F.a)(xe,2),ke=Re[0],De=Re[1],Le=Object(s.useState)(),Ce=Object(F.a)(Le,2),We=Ce[0],Je=Ce[1],Xe=Object(s.useState)(),Ke=Object(F.a)(Xe,2),qe=Ke[0],Be=Ke[1],Ue=Object(s.useState)(!1),we=Object(F.a)(Ue,2),Ze=we[0],Ve=we[1],Se=Object(s.useState)(""),Ne=Object(F.a)(Se,2),ve=Ne[0],ce=Ne[1],fe=Object(s.useState)(""),Q=Object(F.a)(fe,2),Z=Q[0],te=Q[1],le=Object(s.useState)(!0),me=Object(F.a)(le,2),Ae=me[0],Me=me[1];Object(s.useEffect)(function(){ze()},[]),console.log("globalSetting",re);function ze(){return nt.apply(this,arguments)}function nt(){return nt=Object(W.a)(d.a.mark(function at(){var yt;return d.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:return Ge.next=2,Object(h.a)("/api/programas.json",{method:"get"});case 2:yt=Ge.sent,yt&&Je(yt==null?void 0:yt.programas);case 4:case"end":return Ge.stop()}},at)})),nt.apply(this,arguments)}var tt=function(){var at=Object(W.a)(d.a.mark(function yt(bt,Ge,en){var tn;return d.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:st.t0=bt,st.next=st.t0===1?3:st.t0===2?6:st.t0===3?10:st.t0===4?15:17;break;case 3:return Be(Ge==null?void 0:Ge.id),De(!0),st.abrupt("break",17);case 6:return Be(Ge==null?void 0:Ge.id),Ve(!0),ce(Ge==null?void 0:Ge.name),st.abrupt("break",17);case 10:return st.next=12,Object(h.a)("/api/programas/".concat(Ge==null?void 0:Ge.id,"/top.json"),{method:"post",body:{id:Ge==null?void 0:Ge.id}});case 12:return tn=st.sent,tn.status===0&&ze(),st.abrupt("break",17);case 15:return xt(u.a.createElement("p",null,"\u5220\u9664\u4E4B\u540E\u4E0D\u80FD\u6062\u590D,",u.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),Object(W.a)(d.a.mark(function wt(){var Dt;return d.a.wrap(function(gn){for(;;)switch(gn.prev=gn.next){case 0:return gn.next=2,Object(h.a)("/api/programas/".concat(Ge==null?void 0:Ge.id,".json"),{method:"delete",body:{id:Ge==null?void 0:Ge.id}});case 2:Dt=gn.sent,Dt.status===0&&(M.b.info("\u5220\u9664\u6210\u529F"),ze());case 4:case"end":return gn.stop()}},wt)}))),st.abrupt("break",17);case 17:case"end":return st.stop()}},yt)}));return function(bt,Ge,en){return at.apply(this,arguments)}}(),xt=function(yt,bt){z.a.confirm({centered:!0,title:"\u63D0\u793A",icon:u.a.createElement(x.a,null),content:yt,okText:"\u786E\u8BA4",onOk:function(){return bt()},cancelText:"\u53D6\u6D88"})},ft=function(yt,bt){return u.a.createElement("div",{className:l.a.leftMenuActions},bt===1&&u.a.createElement("p",{className:"current",onClick:function(){return tt(1,yt,bt)}},"\u65B0\u5EFA"),u.a.createElement("p",{className:"current",onClick:function(){return tt(2,yt,bt)}},"\u91CD\u547D\u540D"),u.a.createElement("p",{className:"current",onClick:function(){return tt(3,yt,bt)}},"\u7F6E\u9876"),u.a.createElement("p",{className:"current",onClick:function(){return tt(4,yt,bt)}},"\u5220\u9664"))};function it(){return Ot.apply(this,arguments)}function Ot(){return Ot=Object(W.a)(d.a.mark(function at(){var yt;return d.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:return Ge.next=2,Object(h.a)("/api/programas/".concat(qe,"/content.json"),{method:"get",params:{id:qe}});case 2:yt=Ge.sent,yt&&te(yt);case 4:case"end":return Ge.stop()}},at)})),Ot.apply(this,arguments)}return u.a.createElement("div",{style:{marginBottom:"40px"}},u.a.createElement("img",{style:{width:"100%"},src:o.a.IMG_SERVER+"/".concat(re==null||((ie=re.setting)===null||ie===void 0)?void 0:ie.shixun_banner_url)}),u.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},u.a.createElement(he,{width:244,className:l.a.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"}},u.a.createElement(p.a,{mode:"inline"},We==null?void 0:We.map(function(at,yt){if((at==null?void 0:at.children.length)>0){var bt;return u.a.createElement(ee,{title:u.a.createElement("span",{className:"font16"},u.a.createElement("span",null,at.name),!Object(O.v)()&&u.a.createElement("span",null),Object(O.v)()&&u.a.createElement(V.a,{placement:"right",content:function(){return ft(at,1)},trigger:"hover"},u.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))},at==null||((bt=at.children)===null||bt===void 0)?void 0:bt.map(function(Ge,en){return u.a.createElement(p.a.Item,{className:l.a===null||l.a===void 0?void 0:l.a.SubMentItem,onClick:function(){Be(Ge==null?void 0:Ge.id),qe=Ge==null?void 0:Ge.id,it()}},u.a.createElement("span",{style:{flex:"1"}},Ge==null?void 0:Ge.name),Object(O.v)()&&u.a.createElement(V.a,{placement:"right",content:function(){return ft(Ge,2)},trigger:"hover"},u.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))}))}else return u.a.createElement(p.a.Item,{className:l.a===null||l.a===void 0?void 0:l.a.SubMentItem,onClick:function(){Be(at==null?void 0:at.id),qe=at==null?void 0:at.id,it()}},u.a.createElement("span",{style:{flex:"1"}},at==null?void 0:at.name),Object(O.v)()&&u.a.createElement(V.a,{placement:"right",content:function(){return ft(at,1)},trigger:"hover"},u.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))}),u.a.createElement(p.a.Item,{onClick:function(){Be(""),qe="",De(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:u.a.createElement(T.a,{style:{color:"#0152d9",fontSize:"16px"}})},"\u65B0\u589E\u4E8C\u7EA7\u7C7B\u76EE"))),u.a.createElement("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"}},Ae&&u.a.createElement(B,{ItemData:Z,setIssee:Me}),Ae===!1&&u.a.createElement(J,{ItemData:Z,setIssee:Me,CategoryId:qe}))),u.a.createElement(b,{CategoryId:qe,IsShow:ke,setIsShow:De,init:ze}),u.a.createElement(y,{CategoryId:qe,name:ve,IsShow:Ze,setIsShow:Ve,init:ze}))}var pe=Qe.default=Object(A.a)(function(oe){var ie=oe.user,ue=oe.globalSetting;return{user:ie,globalSetting:ue}})(ge)},TXwP:function(ut,Qe,ne){var ae,V;(function(){var D;(function(){"use strict";var N=[,,function(k){function R(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=[]}R.prototype.clone_empty=function(){var f=new R(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},R.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},R.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},R.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))},R.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)},R.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},R.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},R.prototype.is_empty=function(){return this.__items.length===0},R.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},R.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},R.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},R.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},R.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},R.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},R.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 s=this.__base_string_length;return d=d||0,f<0&&(s=0),s+=f*this.__indent_size,s+=d,s},g.prototype.get_indent_string=function(f,d){var s=this.__base_string;return d=d||0,f<0&&(f=0,s=""),d+=f*this.__indent_size,this.__ensure_cache(d),s+=this.__cache[d],s},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,s="";this.__indent_size&&f>=this.__indent_size&&(d=Math.floor(f/this.__indent_size),f-=d*this.__indent_size,s=new Array(d+1).join(this.__indent_string)),f&&(s+=new Array(f+1).join(" ")),this.__cache.push(s)};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 R(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 s=this.__lines.join(`
|
|
`);return f!==`
|
|
`&&(s=s.replace(/[\n]/g,f)),s},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 s=this.__lines.length-2;s>=0;){var u=this.__lines[s];if(u.is_empty())break;if(u.item(0).indexOf(f)!==0&&u.item(-1)!==d){this.__lines.splice(s+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},k.exports.Output=p},,,,function(k){function R(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"])}R.prototype._get_array=function(f,d){var s=this.raw_options[f],u=d||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(u=s.concat()):typeof s=="string"&&(u=s.split(/[^a-zA-Z0-9_\/\-]+/)),u},R.prototype._get_boolean=function(f,d){var s=this.raw_options[f],u=s===void 0?!!d:!!s;return u},R.prototype._get_characters=function(f,d){var s=this.raw_options[f],u=d||"";return typeof s=="string"&&(u=s.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),u},R.prototype._get_number=function(f,d){var s=this.raw_options[f];d=parseInt(d,10),isNaN(d)&&(d=0);var u=parseInt(s,10);return isNaN(u)&&(u=d),u},R.prototype._get_selection=function(f,d,s){var u=this._get_selection_list(f,d,s);if(u.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 u[0]},R.prototype._get_selection_list=function(f,d,s){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[d[0]],!this._is_valid_selection(s,d))throw new Error("Invalid Default Value!");var u=this._get_array(f,s);if(!this._is_valid_selection(u,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 u},R.prototype._is_valid_selection=function(f,d){return f.length&&d.length&&!f.some(function(s){return d.indexOf(s)===-1})};function g(f,d){var s={};f=p(f);var u;for(u in f)u!==d&&(s[u]=f[u]);if(d&&f[d])for(u in f[d])s[u]=f[d][u];return s}function p(f){var d={},s;for(s in f){var u=s.replace(/-/g,"_");d[u]=f[s]}return d}k.exports.Options=R,k.exports.normalizeOpts=p,k.exports.mergeOpts=g},,function(k){var R=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&&!(R&&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 s="",u;return p&&(u=this.match(p),u&&(s+=u[0])),f&&(u||!p)&&(s+=this.readUntil(f,d)),s},g.prototype.readUntil=function(p,f){var d="",s=this.__position;p.lastIndex=this.__position;var u=p.exec(this.__input);return u?(s=u.index,f&&(s+=u[0].length)):s=this.__input_length,d=this.__input.substring(this.__position,s),this.__position=s,d},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var d=null,s="g";return f&&R&&(s="y"),typeof p=="string"&&p!==""?d=new RegExp(p,s):p&&(d=new RegExp(p.source,s)),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},k.exports.InputScanner=g},,,,,function(k){function R(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")}R.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},R.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=R},,function(k,R,g){var p=g(16).Beautifier,f=g(17).Options;function d(s,u){var o=new p(s,u);return o.beautify()}k.exports=d,k.exports.defaultOptions=function(){return new f}},function(k,R,g){var p=g(17).Options,f=g(2).Output,d=g(8).InputScanner,s=g(13).Directives,u=new s(/\/\*/,/\*\//),o=/\r\n|[\r\n]/,a=/\r\n|[\r\n]/g,l=/\s/,h=/(?:\s|\n)+/g,A=/\/\*(?:[\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(a,`
|
|
`);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 w=0,b=!1,c=!1,y=!1,m=!1,_=!1,P=!1,I=this._ch,B=!1,U,C,v;U=this._input.read(h),C=U!=="",v=I,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),I=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var j=this._input.read(A),G=u.get_directives(j);G&&G.ignore==="start"&&(j+=u.readIgnored(this._input)),this.print_string(j),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(C),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var J=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);J.match(/[ :]$/)&&(J=this.eatString(": ").replace(/\s$/,""),this.print_string(J),this._output.space_before_token=!0),J=J.replace(/\s$/,""),J==="extend"?m=!0:J==="import"&&(_=!0),J in this.NESTED_AT_RULE?(this._nestedLevel+=1,J in this.CONDITIONAL_GROUP_RULE&&(y=!0)):!b&&w===0&&J.indexOf(":")!==-1&&(c=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(C),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")c&&(c=!1,this.outdent()),y?(y=!1,b=this._indentLevel>=this._nestedLevel):b=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&b&&(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)):(v==="("?this._output.space_before_token=!1:v!==","&&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(),v==="{"&&this._output.trim(!0),_=!1,m=!1,c&&(this.outdent(),c=!1),this.print_string(this._ch),b=!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 ee=0;ee<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;ee++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[ee])){B=!0;break}(b||y)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!m&&w===0?(this.print_string(":"),c||(c=!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 ye=v==='"'||v==="'";this.preserveSingleSpace(ye||C),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")B=!1,w===0?(c&&(this.outdent(),c=!1),m=!1,_=!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(),w++,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(")")),w&&(w--,this.outdent()));else{var he=!1;this._input.lookBack("with")&&(he=!0),this.preserveSingleSpace(C||he),this.print_string(this._ch),c&&v==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),P=!0):(this.eatWhitespace(),w++,this.indent())}else if(this._ch===")")w&&(w--,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&&(!c||P)&&w===0&&!_&&!m?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!c&&w===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(C),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 ge=v==='"'||v==="'";this.preserveSingleSpace(ge||C),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&B&&this._output.add_new_line()}var pe=this._output.get_code(S);return pe},k.exports.Beautifier=T},function(k,R,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 s=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||s;var u=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var o=0;o<u.length;o++)u[o]!=="expand"?this.brace_style="collapse":this.brace_style=u[o]}f.prototype=new p,k.exports.Options=f}],M={};function W(k){var R=M[k];if(R!==void 0)return R.exports;var g=M[k]={exports:{}};return N[k](g,g.exports,W),g.exports}var F=W(15);D=F})();var z=D;!(ae=[],V=function(){return{css_beautify:z}}.apply(Qe,ae),V!==void 0&&(ut.exports=V))})()},"VrN/":function(ut,Qe,ne){(function(ae,V){ut.exports=V()})(this,function(){"use strict";var ae=navigator.userAgent,V=navigator.platform,D=/gecko\/\d/i.test(ae),z=/MSIE \d/.test(ae),N=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ae),M=/Edge\/(\d+)/.exec(ae),W=z||N||M,F=W&&(z?document.documentMode||6:+(M||N)[1]),k=!M&&/WebKit\//.test(ae),R=k&&/Qt\/\d+\.\d+/.test(ae),g=!M&&/Chrome\//.test(ae),p=/Opera\//.test(ae),f=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ae),s=/PhantomJS/.test(ae),u=!M&&/AppleWebKit/.test(ae)&&/Mobile\/\w+/.test(ae),o=/Android/.test(ae),a=u||o||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ae),l=u||/Mac/.test(V),h=/\bCrOS\b/.test(ae),A=/win/i.test(V),x=p&&ae.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(p=!1,k=!0);var T=l&&(R||p&&(x==null||x<12.11)),O=D||W&&F>=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 w(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function b(e,t){return w(e).appendChild(t)}function c(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 L=0;L<t.length;++L)i.appendChild(t[L]);return i}function y(e,t,r,n){var i=c(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 _(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 I(e,t){var r=e.className;S(t).test(r)||(e.className+=(r?" ":"")+t)}function B(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 U=function(e){e.select()};u?U=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(U=function(e){try{e.select()}catch(t){}});function C(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function v(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 j(e,t,r,n,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var L=n||0,H=i||0;;){var K=e.indexOf(" ",L);if(K<0||K>=t)return H+(t-L);H+=K-L,H+=r-H%r,L=K+1}}var G=function(){this.id=null,this.f=null,this.time=0,this.handler=C(this.onTimeout,this)};G.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},G.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 J(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var ee=50,ye={toString:function(){return"CodeMirror.Pass"}},he={scroll:!1},ge={origin:"*mouse"},pe={origin:"+move"};function oe(e,t,r){for(var n=0,i=0;;){var L=e.indexOf(" ",n);L==-1&&(L=e.length);var H=L-n;if(L==e.length||i+H>=t)return n+Math.min(H,t-i);if(i+=L-n,i+=r-i%r,n=L+1,i>=t)return n}}var ie=[""];function ue(e){for(;ie.length<=e;)ie.push($(ie)+" ");return ie[e]}function $(e){return e[e.length-1]}function re(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function q(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}function be(){}function Oe(e,t){var r;return Object.create?r=Object.create(e):(be.prototype=e,r=new be),t&&v(t,r),r}var _e=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function xe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||_e.test(e))}function Re(e,t){return t?t.source.indexOf("\\w")>-1&&xe(e)?!0:t.test(e):xe(e)}function ke(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var De=/[\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 Le(e){return e.charCodeAt(0)>=768&&De.test(e)}function Ce(e,t,r){for(;(r<0?t>0:t<e.length)&&Le(e.charAt(t));)t+=r;return t}function We(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,L=n<0?Math.ceil(i):Math.floor(i);if(L==t)return e(L)?t:r;e(L)?r=L:t=L+n}}function Je(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,L=0;L<e.length;++L){var H=e[L];(H.from<r&&H.to>t||t==r&&H.to==t)&&(n(Math.max(H.from,t),Math.min(H.to,r),H.level==1?"rtl":"ltr",L),i=!0)}i||n(t,r,"ltr")}var Xe=null;function Ke(e,t,r){var n;Xe=null;for(var i=0;i<e.length;++i){var L=e[i];if(L.from<t&&L.to>t)return i;L.to==t&&(L.from!=L.to&&r=="before"?n=i:Xe=i),L.from==t&&(L.from!=L.to&&r!="before"?n=i:Xe=i)}return n!=null?n:Xe}var qe=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]/,L=/[LRr]/,H=/[Lb1n]/,K=/[1n]/;function X(Y,se,de){this.level=Y,this.from=se,this.to=de}return function(Y,se){var de=se=="ltr"?"L":"R";if(Y.length==0||se=="ltr"&&!n.test(Y))return!1;for(var Te=Y.length,Ee=[],Ie=0;Ie<Te;++Ie)Ee.push(r(Y.charCodeAt(Ie)));for(var Pe=0,He=de;Pe<Te;++Pe){var Ye=Ee[Pe];Ye=="m"?Ee[Pe]=He:He=Ye}for(var et=0,$e=de;et<Te;++et){var rt=Ee[et];rt=="1"&&$e=="r"?Ee[et]="n":L.test(rt)&&($e=rt,rt=="r"&&(Ee[et]="R"))}for(var ht=1,dt=Ee[0];ht<Te-1;++ht){var _t=Ee[ht];_t=="+"&&dt=="1"&&Ee[ht+1]=="1"?Ee[ht]="1":_t==","&&dt==Ee[ht+1]&&(dt=="1"||dt=="n")&&(Ee[ht]=dt),dt=_t}for(var Mt=0;Mt<Te;++Mt){var Xt=Ee[Mt];if(Xt==",")Ee[Mt]="N";else if(Xt=="%"){var Nt=void 0;for(Nt=Mt+1;Nt<Te&&Ee[Nt]=="%";++Nt);for(var mn=Mt&&Ee[Mt-1]=="!"||Nt<Te&&Ee[Nt]=="1"?"1":"N",cn=Mt;cn<Nt;++cn)Ee[cn]=mn;Mt=Nt-1}}for(var Ht=0,hn=de;Ht<Te;++Ht){var Qt=Ee[Ht];hn=="L"&&Qt=="1"?Ee[Ht]="L":L.test(Qt)&&(hn=Qt)}for(var Gt=0;Gt<Te;++Gt)if(i.test(Ee[Gt])){var Wt=void 0;for(Wt=Gt+1;Wt<Te&&i.test(Ee[Wt]);++Wt);for(var Ut=(Gt?Ee[Gt-1]:de)=="L",fn=(Wt<Te?Ee[Wt]:de)=="L",Wr=Ut==fn?Ut?"L":"R":de,qn=Gt;qn<Wt;++qn)Ee[qn]=Wr;Gt=Wt-1}for(var qt=[],Mn,Yt=0;Yt<Te;)if(H.test(Ee[Yt])){var Va=Yt;for(++Yt;Yt<Te&&H.test(Ee[Yt]);++Yt);qt.push(new X(0,Va,Yt))}else{var Kn=Yt,pr=qt.length,mr=se=="rtl"?1:0;for(++Yt;Yt<Te&&Ee[Yt]!="L";++Yt);for(var an=Kn;an<Yt;)if(K.test(Ee[an])){Kn<an&&(qt.splice(pr,0,new X(1,Kn,an)),pr+=mr);var Kr=an;for(++an;an<Yt&&K.test(Ee[an]);++an);qt.splice(pr,0,new X(2,Kr,an)),pr+=mr,Kn=an}else++an;Kn<Yt&&qt.splice(pr,0,new X(1,Kn,Yt))}return se=="ltr"&&(qt[0].level==1&&(Mn=Y.match(/^\s+/))&&(qt[0].from=Mn[0].length,qt.unshift(new X(0,0,Mn[0].length))),$(qt).level==1&&(Mn=Y.match(/\s+$/))&&($(qt).to-=Mn[0].length,qt.push(new X(0,Te-Mn[0].length,Te)))),se=="rtl"?qt.reverse():qt}}();function Be(e,t){var r=e.order;return r==null&&(r=e.order=qe(e.text,t)),r}var Ue=[],we=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]||Ue).concat(r)}};function Ze(e,t){return e._handlers&&e._handlers[t]||Ue}function Ve(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 L=J(i,r);L>-1&&(n[t]=i.slice(0,L).concat(i.slice(L+1)))}}}function Se(e,t){var r=Ze(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 Ne(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Se(e,r||t.type,e,t),te(t)||t.codemirrorIgnore}function ve(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)J(r,t[n])==-1&&r.push(t[n])}function ce(e,t){return Ze(e,t).length>0}function fe(e){e.prototype.on=function(t,r){we(this,t,r)},e.prototype.off=function(t,r){Ve(this,t,r)}}function Q(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function te(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){Q(e),Z(e)}function me(e){return e.target||e.srcElement}function Ae(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var Me=function(){if(W&&F<9)return!1;var e=c("div");return"draggable"in e||"dragDrop"in e}(),ze;function nt(e){if(ze==null){var t=c("span","\u200B");b(e,c("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ze=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&F<8))}var r=ze?c("span","\u200B"):c("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var tt;function xt(e){if(tt!=null)return tt;var t=b(e,document.createTextNode("A\u062EA")),r=m(t,0,1).getBoundingClientRect(),n=m(t,1,2).getBoundingClientRect();return w(e),!r||r.left==r.right?!1:tt=n.right-r.right<3}var ft=`
|
|
|
|
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 L=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),H=L.indexOf("\r");H!=-1?(r.push(L.slice(0,H)),t+=H+1):(r.push(L),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},it=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},Ot=function(){var e=c("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),at=null;function yt(e){if(at!=null)return at;var t=b(e,c("span","x")),r=t.getBoundingClientRect(),n=m(t,0,1).getBoundingClientRect();return at=Math.abs(r.left-n.left)>1}var bt={},Ge={};function en(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),bt[e]=t}function tn(e,t){Ge[e]=t}function pt(e){if(typeof e=="string"&&Ge.hasOwnProperty(e))e=Ge[e];else if(e&&typeof e.name=="string"&&Ge.hasOwnProperty(e.name)){var t=Ge[e.name];typeof t=="string"&&(t={name:t}),e=Oe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return pt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return pt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function st(e,t){t=pt(t);var r=bt[t.name];if(!r)return st(e,"text/plain");var n=r(e,t);if(wt.hasOwnProperty(t.name)){var i=wt[t.name];for(var L in i){if(!i.hasOwnProperty(L))continue;n.hasOwnProperty(L)&&(n["_"+L]=n[L]),n[L]=i[L]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var H in t.modeProps)n[H]=t.modeProps[H];return n}var wt={};function Dt(e,t){var r=wt.hasOwnProperty(e)?wt[e]:wt[e]={};v(t,r)}function jt(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 gn(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 Gr(e,t,r){return e.startState?e.startState(t,r):!0}var Ft=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};Ft.prototype.eol=function(){return this.pos>=this.string.length},Ft.prototype.sol=function(){return this.pos==this.lineStart},Ft.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ft.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ft.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},Ft.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ft.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ft.prototype.skipToEnd=function(){this.pos=this.string.length},Ft.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ft.prototype.backUp=function(e){this.pos-=e},Ft.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=j(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},Ft.prototype.indentation=function(){return j(this.string,null,this.tabSize)-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},Ft.prototype.match=function(e,t,r){if(typeof e=="string"){var n=function(H){return r?H.toLowerCase():H},i=this.string.substr(this.pos,e.length);if(n(i)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var L=this.string.slice(this.pos).match(e);return L&&L.index>0?null:(L&&t!==!1&&(this.pos+=L[0].length),L)}},Ft.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ft.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ft.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ft.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ot(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],L=i.chunkSize();if(t<L){r=i;break}t-=L}return r.lines[t]}function Pn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(L){var H=L.text;i==r.line&&(H=H.slice(0,r.ch)),i==t.line&&(H=H.slice(t.ch)),n.push(H),++i}),n}function gr(e,t,r){var n=[];return e.iter(t,r,function(i){n.push(i.text)}),n}function sn(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Rt(e){if(e.parent==null)return null;for(var t=e.parent,r=J(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 Tn(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],L=i.height;if(t<L){e=i;continue e}t-=L,r+=i.chunkSize()}return r}while(!e.lines);for(var H=0;H<e.lines.length;++H){var K=e.lines[H],X=K.height;if(t<X)break;t-=X}return r+H}function Nn(e,t){return t>=e.first&&t<e.first+e.size}function vr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,r){if(r===void 0&&(r=null),!(this instanceof Fe))return new Fe(e,t,r);this.line=e,this.ch=t,this.sticky=r}function mt(e,t){return e.line-t.line||e.ch-t.ch}function zr(e,t){return e.sticky==t.sticky&&mt(e,t)==0}function yr(e){return Fe(e.line,e.ch)}function _r(e,t){return mt(e,t)<0?t:e}function er(e,t){return mt(e,t)<0?e:t}function br(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function vt(e,t){if(t.line<e.first)return Fe(e.first,0);var r=e.first+e.size-1;return t.line>r?Fe(r,ot(e,r).text.length):Ai(t,ot(e,t.line).text.length)}function Ai(e,t){var r=e.ch;return r==null||r>t?Fe(e.line,t):r<0?Fe(e.line,0):e}function je(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=vt(e,t[n]);return r}var Er=function(e,t){this.state=e,this.lookAhead=t},bn=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};bn.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},bn.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}},bn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},bn.fromSaved=function(e,t,r){return t instanceof Er?new bn(e,jt(e.mode,t.state),r,t.lookAhead):new bn(e,jt(e.mode,t),r)},bn.prototype.save=function(e){var t=e!==!1?jt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Er(t,this.maxLookAhead):t};function Vr(e,t,r,n){var i=[e.state.modeGen],L={};Sn(e,t.text,e.doc.mode,r,function(Y,se){return i.push(Y,se)},L,n);for(var H=r.state,K=function(Y){r.baseTokens=i;var se=e.state.overlays[Y],de=1,Te=0;r.state=!0,Sn(e,t.text,se.mode,r,function(Ee,Ie){for(var Pe=de;Te<Ee;){var He=i[de];He>Ee&&i.splice(de,1,Ee,i[de+1],He),de+=2,Te=Math.min(Ee,He)}if(!Ie)return;if(se.opaque)i.splice(Pe,de-Pe,Ee,"overlay "+Ie),de=Pe+2;else for(;Pe<de;Pe+=2){var Ye=i[Pe+1];i[Pe+1]=(Ye?Ye+" ":"")+"overlay "+Ie}},L),r.state=H,r.baseTokens=null,r.baseTokenPos=1},X=0;X<e.state.overlays.length;++X)K(X);return{styles:i,classes:L.bgClass||L.textClass?L:null}}function tr(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=xn(e,Rt(t)),i=t.text.length>e.options.maxHighlightLength&&jt(e.doc.mode,n.state),L=Vr(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=L.styles,L.classes?t.styleClasses=L.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 xn(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new bn(n,!0,t);var L=Ci(e,t,r),H=L>n.first&&ot(n,L-1).stateAfter,K=H?bn.fromSaved(n,H,L):new bn(n,Gr(n.mode),L);return n.iter(L,t,function(X){Xr(e,X.text,K);var Y=K.line;X.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,L=new Ft(t,e.options.tabSize,r);for(L.start=L.pos=n||0,t==""&&Yr(i,r.state);!L.eol();)wn(i,L,r.state),L.start=L.pos}function Yr(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=gn(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function wn(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=gn(e,r).mode);var L=e.token(t,r);if(t.pos>t.start)return L}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 Ri(e,t,r,n){var i=e.doc,L=i.mode,H;t=vt(i,t);var K=ot(i,t.line),X=xn(e,t.line,r),Y=new Ft(K.text,e.options.tabSize,X),se;for(n&&(se=[]);(n||Y.pos<t.ch)&&!Y.eol();)Y.start=Y.pos,H=wn(L,Y,X.state),n&&se.push(new $r(Y,H,jt(i.mode,X.state)));return n?se:new $r(Y,H,X.state)}function Qr(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 Sn(e,t,r,n,i,L,H){var K=r.flattenSpans;K==null&&(K=e.options.flattenSpans);var X=0,Y=null,se=new Ft(t,e.options.tabSize,n),de,Te=e.options.addModeClass&&[null];for(t==""&&Qr(Yr(r,n.state),L);!se.eol();){if(se.pos>e.options.maxHighlightLength?(K=!1,H&&Xr(e,t,n,se.pos),se.pos=t.length,de=null):de=Qr(wn(r,se,n.state,Te),L),Te){var Ee=Te[0].name;Ee&&(de="m-"+(de?Ee+" "+de:Ee))}if(!K||Y!=de){for(;X<se.start;)X=Math.min(se.start,X+5e3),i(X,Y);Y=de}se.start=se.pos}for(;X<se.pos;){var Ie=Math.min(se.pos,X+5e3);i(Ie,Y),X=Ie}}function Ci(e,t,r){for(var n,i,L=e.doc,H=r?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>H;--K){if(K<=L.first)return L.first;var X=ot(L,K-1),Y=X.stateAfter;if(Y&&(!r||K+(Y instanceof Er?Y.lookAhead:0)<=L.modeFrontier))return K;var se=j(X.text,null,e.options.tabSize);(i==null||n>se)&&(i=K-1,n=se)}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=ot(e,n).stateAfter;if(i&&(!(i instanceof Er)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var Jr=!1,nn=!1;function Gn(){Jr=!0}function sa(){nn=!0}function nr(e,t,r){this.marker=e,this.from=t,this.to=r}function On(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 Li(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var L=e[i],H=L.marker,K=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);if(K||L.from==t&&H.type=="bookmark"&&(!r||!L.marker.insertLeft)){var X=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);(n||(n=[])).push(new nr(H,L.from,X?null:L.to))}}return n}function Ii(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var L=e[i],H=L.marker,K=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);if(K||L.from==t&&H.type=="bookmark"&&(!r||L.marker.insertLeft)){var X=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);(n||(n=[])).push(new nr(H,X?null:L.from-t,L.to==null?null:L.to-t))}}return n}function Tr(e,t){if(t.full)return null;var r=Nn(e,t.from.line)&&ot(e,t.from.line).markedSpans,n=Nn(e,t.to.line)&&ot(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,L=t.to.ch,H=mt(t.from,t.to)==0,K=Li(r,i,H),X=Ii(n,L,H),Y=t.text.length==1,se=$(t.text).length+(Y?i:0);if(K)for(var de=0;de<K.length;++de){var Te=K[de];if(Te.to==null){var Ee=On(X,Te.marker);Ee?Y&&(Te.to=Ee.to==null?null:Ee.to+se):Te.to=i}}if(X)for(var Ie=0;Ie<X.length;++Ie){var Pe=X[Ie];if(Pe.to!=null&&(Pe.to+=se),Pe.from==null){var He=On(K,Pe.marker);He||(Pe.from=se,Y&&(K||(K=[])).push(Pe))}else Pe.from+=se,Y&&(K||(K=[])).push(Pe)}K&&(K=Di(K)),X&&X!=K&&(X=Di(X));var Ye=[K];if(!Y){var et=t.text.length-2,$e;if(et>0&&K)for(var rt=0;rt<K.length;++rt)K[rt].to==null&&($e||($e=[])).push(new nr(K[rt].marker,null,null));for(var ht=0;ht<et;++ht)Ye.push($e);Ye.push(X)}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 ki(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(Ee){if(Ee.markedSpans)for(var Ie=0;Ie<Ee.markedSpans.length;++Ie){var Pe=Ee.markedSpans[Ie].marker;Pe.readOnly&&(!n||J(n,Pe)==-1)&&(n||(n=[])).push(Pe)}}),!n)return null;for(var i=[{from:t,to:r}],L=0;L<n.length;++L)for(var H=n[L],K=H.find(0),X=0;X<i.length;++X){var Y=i[X];if(mt(Y.to,K.from)<0||mt(Y.from,K.to)>0)continue;var se=[X,1],de=mt(Y.from,K.from),Te=mt(Y.to,K.to);(de<0||!H.inclusiveLeft&&!de)&&se.push({from:Y.from,to:K.from}),(Te>0||!H.inclusiveRight&&!Te)&&se.push({from:K.to,to:Y.to}),i.splice.apply(i,se),X+=se.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 xr(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function rr(e){return e.inclusiveLeft?-1:0}function ir(e){return e.inclusiveRight?1:0}function wr(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var n=e.find(),i=t.find(),L=mt(n.from,i.from)||rr(e)-rr(t);if(L)return-L;var H=mt(n.to,i.to)||ir(e)-ir(t);return H||t.id-e.id}function Fn(e,t){var r=nn&&e.markedSpans,n;if(r)for(var i=void 0,L=0;L<r.length;++L)i=r[L],i.marker.collapsed&&(t?i.from:i.to)==null&&(!n||wr(n,i.marker)<0)&&(n=i.marker);return n}function Un(e){return Fn(e,!0)}function Bn(e){return Fn(e,!1)}function Sr(e,t){var r=nn&&e.markedSpans,n;if(r)for(var i=0;i<r.length;++i){var L=r[i];L.marker.collapsed&&(L.from==null||L.from<t)&&(L.to==null||L.to>t)&&(!n||wr(n,L.marker)<0)&&(n=L.marker)}return n}function Mi(e,t,r,n,i){var L=ot(e,t),H=nn&&L.markedSpans;if(H)for(var K=0;K<H.length;++K){var X=H[K];if(!X.marker.collapsed)continue;var Y=X.marker.find(0),se=mt(Y.from,r)||rr(X.marker)-rr(i),de=mt(Y.to,n)||ir(X.marker)-ir(i);if(se>=0&&de<=0||se<=0&&de>=0)continue;if(se<=0&&(X.marker.inclusiveRight&&i.inclusiveLeft?mt(Y.to,r)>=0:mt(Y.to,r)>0)||se>=0&&(X.marker.inclusiveRight&&i.inclusiveLeft?mt(Y.from,n)<=0:mt(Y.from,n)<0))return!0}}function vn(e){for(var t;t=Un(e);)e=t.find(-1,!0).line;return e}function Pi(e){for(var t;t=Bn(e);)e=t.find(1,!0).line;return e}function Or(e){for(var t,r;t=Bn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function qr(e,t){var r=ot(e,t),n=vn(r);return r==n?t:Rt(n)}function zn(e,t){if(t>e.lastLine())return t;var r=ot(e,t),n;if(!In(e,r))return t;for(;n=Bn(r);)r=n.find(1,!0).line;return Rt(r)+1}function In(e,t){var r=nn&&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,On(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,L=0;L<t.markedSpans.length;++L)if(i=t.markedSpans[L],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 An(e){e=vn(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 L=r.parent;L;r=L,L=r.parent)for(var H=0;H<L.children.length;++H){var K=L.children[H];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=Un(n);){var i=r.find(0,!0);n=i.from.line,t+=i.from.ch-i.to.ch}for(n=e;r=Bn(n);){var L=r.find(0,!0);t-=n.text.length-L.from.ch,n=L.to.line,t+=n.text.length-L.to.ch}return t}function Ni(e){var t=e.display,r=e.doc;t.maxLine=ot(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 ar=function(e,t,r){this.text=e,xr(this,t),this.height=r?r(this):1};ar.prototype.lineNo=function(){return Rt(this)},fe(ar);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),xr(e,r);var i=n?n(e):1;i!=e.height&&sn(e,i)}function lt(e){e.parent=null,la(e)}var gt={},ct={};function Et(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?ct:gt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function At(e,t){var r=y("span",null,null,k?"padding-right: .1px":null),n={pre:y("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 L=i?t.rest[i-1]:t.line,H=void 0;n.pos=0,n.addToken=St,xt(e.display.measure)&&(H=Be(L,e.doc.direction))&&(n.addToken=on(n.addToken,H)),n.map=[];var K=t!=e.display.externalMeasured&&Rt(L);jn(L,n,tr(e,L,K)),L.styleClasses&&(L.styleClasses.bgClass&&(n.bgClass=B(L.styleClasses.bgClass,n.bgClass||"")),L.styleClasses.textClass&&(n.textClass=B(L.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(nt(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(k){var X=n.content.lastChild;(/\bcm-tab\b/.test(X.className)||X.querySelector&&X.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return Se(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=B(n.pre.className,n.textClass||"")),n}function kt(e){var t=c("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function St(e,t,r,n,i,L,H){if(!t)return;var K=e.splitSpaces?Kt(t,e.trailingSpace):t,X=e.cm.state.specialChars,Y=!1,se;if(!X.test(t))e.col+=t.length,se=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,se),W&&F<9&&(Y=!0),e.pos+=t.length;else{se=document.createDocumentFragment();for(var de=0;;){X.lastIndex=de;var Te=X.exec(t),Ee=Te?Te.index-de:t.length-de;if(Ee){var Ie=document.createTextNode(K.slice(de,de+Ee));W&&F<9?se.appendChild(c("span",[Ie])):se.appendChild(Ie),e.map.push(e.pos,e.pos+Ee,Ie),e.col+=Ee,e.pos+=Ee}if(!Te)break;de+=Ee+1;var Pe=void 0;if(Te[0]==" "){var He=e.cm.options.tabSize,Ye=He-e.col%He;Pe=se.appendChild(c("span",ue(Ye),"cm-tab")),Pe.setAttribute("role","presentation"),Pe.setAttribute("cm-text"," "),e.col+=Ye}else Te[0]=="\r"||Te[0]==`
|
|
`?(Pe=se.appendChild(c("span",Te[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Pe.setAttribute("cm-text",Te[0]),e.col+=1):(Pe=e.cm.options.specialCharPlaceholder(Te[0]),Pe.setAttribute("cm-text",Te[0]),W&&F<9?se.appendChild(c("span",[Pe])):se.appendChild(Pe),e.col+=1);e.map.push(e.pos,e.pos+1,Pe),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,r||n||i||Y||L||H){var et=r||"";n&&(et+=n),i&&(et+=i);var $e=c("span",[se],et,L);if(H)for(var rt in H)H.hasOwnProperty(rt)&&rt!="style"&&rt!="class"&&$e.setAttribute(rt,H[rt]);return e.content.appendChild($e)}e.content.appendChild(se)}function Kt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var L=e.charAt(i);L==" "&&r&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(L="\xA0"),n+=L,r=L==" "}return n}function on(e,t){return function(r,n,i,L,H,K,X){i=i?i+" cm-force-border":"cm-force-border";for(var Y=r.pos,se=Y+n.length;;){for(var de=void 0,Te=0;Te<t.length&&!(de=t[Te],de.to>Y&&de.from<=Y);Te++);if(de.to>=se)return e(r,n,i,L,H,K,X);e(r,n.slice(0,de.to-Y),i,L,null,K,X),L=null,n=n.slice(de.to-Y),Y=de.to}}}function Tt(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 jn(e,t,r){var n=e.markedSpans,i=e.text,L=0;if(!n){for(var H=1;H<r.length;H+=2)t.addToken(t,i.slice(L,L=r[H]),Et(r[H+1],t.cm.options));return}for(var K=i.length,X=0,Y=1,se="",de,Te,Ee=0,Ie,Pe,He,Ye,et;;){if(Ee==X){Ie=Pe=He=Te="",et=null,Ye=null,Ee=Infinity;for(var $e=[],rt=void 0,ht=0;ht<n.length;++ht){var dt=n[ht],_t=dt.marker;if(_t.type=="bookmark"&&dt.from==X&&_t.widgetNode)$e.push(_t);else if(dt.from<=X&&(dt.to==null||dt.to>X||_t.collapsed&&dt.to==X&&dt.from==X)){if(dt.to!=null&&dt.to!=X&&Ee>dt.to&&(Ee=dt.to,Pe=""),_t.className&&(Ie+=" "+_t.className),_t.css&&(Te=(Te?Te+";":"")+_t.css),_t.startStyle&&dt.from==X&&(He+=" "+_t.startStyle),_t.endStyle&&dt.to==Ee&&(rt||(rt=[])).push(_t.endStyle,dt.to),_t.title&&((et||(et={})).title=_t.title),_t.attributes)for(var Mt in _t.attributes)(et||(et={}))[Mt]=_t.attributes[Mt];_t.collapsed&&(!Ye||wr(Ye.marker,_t)<0)&&(Ye=dt)}else dt.from>X&&Ee>dt.from&&(Ee=dt.from)}if(rt)for(var Xt=0;Xt<rt.length;Xt+=2)rt[Xt+1]==Ee&&(Pe+=" "+rt[Xt]);if(!Ye||Ye.from==X)for(var Nt=0;Nt<$e.length;++Nt)Tt(t,0,$e[Nt]);if(Ye&&(Ye.from||0)==X){if(Tt(t,(Ye.to==null?K+1:Ye.to)-X,Ye.marker,Ye.from==null),Ye.to==null)return;Ye.to==X&&(Ye=!1)}}if(X>=K)break;for(var mn=Math.min(K,Ee);;){if(se){var cn=X+se.length;if(!Ye){var Ht=cn>mn?se.slice(0,mn-X):se;t.addToken(t,Ht,de?de+Ie:Ie,He,X+Ht.length==Ee?Pe:"",Te,et)}if(cn>=mn){se=se.slice(mn-X),X=mn;break}X=cn,He=""}se=i.slice(L,L=r[Y++]),de=Et(r[Y++],t.cm.options)}}}function Ct(e,t,r){this.line=t,this.rest=Or(t),this.size=this.rest?Rt($(this.rest))-r+1:1,this.node=this.text=null,this.hidden=In(e,t)}function ln(e,t,r){for(var n=[],i,L=t;L<r;L=i){var H=new Ct(e.doc,ot(e.doc,L),L);i=L+H.size,n.push(H)}return n}var Jt=null;function En(e){Jt?Jt.ops.push(e):e.ownsGroup=Jt={ops:[e],delayedCallbacks:[]}}function Lo(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{Lo(r)}finally{Jt=null,t(r)}}var ni=null;function $t(e,t){var r=Ze(e,t);if(!r.length)return;var n=Array.prototype.slice.call(arguments,2),i;Jt?i=Jt.delayedCallbacks:ni?i=ni:(i=ni=[],setTimeout(Do,0));for(var L=function(K){i.push(function(){return r[K].apply(null,n)})},H=0;H<r.length;++H)L(H)}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 L=t.changes[i];L=="text"?Mo(e,t):L=="gutter"?Qa(e,t,r,n):L=="class"?da(e,t):L=="widget"&&Po(e,t,n)}t.changes=null}function ri(e){return e.node==e.text&&(e.node=c("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&F<8&&(e.node.style.zIndex=2)),e.node}function ko(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(c("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):At(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){ko(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 Qa(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=c("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 L=t.line.gutterMarkers;if(e.options.lineNumbers||L){var H=ri(t),K=t.gutter=c("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),H.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!L||!L["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(c("div",vr(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),L)for(var X=0;X<e.display.gutterSpecs.length;++X){var Y=e.display.gutterSpecs[X].className,se=L.hasOwnProperty(Y)&&L[Y];se&&K.appendChild(c("div",[se],"CodeMirror-gutter-elt","left: "+n.gutterLeft[Y]+"px; width: "+n.gutterWidth[Y]+"px"))}}}function Po(e,t,r){t.alignable&&(t.alignable=null);for(var n=S("CodeMirror-linewidget"),i=t.node.firstChild,L=void 0;i;i=L)L=i.nextSibling,n.test(i.className)&&t.node.removeChild(i);Ja(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),Qa(e,t,r,n),Ja(e,t,n),t.node}function Ja(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 L=ri(r),H=0,K=t.widgets;H<K.length;++H){var X=K[H],Y=c("div",[X.node],"CodeMirror-linewidget"+(X.className?" "+X.className:""));X.handleMouseEvents||Y.setAttribute("cm-ignore-events","true"),Fo(X,Y,r,n),e.display.input.setUneditable(Y),i&&X.above?L.insertBefore(Y,r.gutter||r.text):L.appendChild(Y),$t(X,"redraw")}}function Fo(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(!_(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;"),b(t.display.measure,c("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Hn(e,t){for(var r=me(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 Fi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=b(e.measure,c("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 Dn(e){return ee-e.display.nativeBarWidth}function sr(e){return e.display.scroller.clientWidth-Dn(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-Dn(e)-e.display.barHeight}function Uo(e,t,r){var n=e.options.lineWrapping,i=n&&sr(e);if(!t.measure.heights||n&&t.measure.width!=i){var L=t.measure.heights=[];if(n){t.measure.width=i;for(var H=t.text.firstChild.getClientRects(),K=0;K<H.length-1;K++){var X=H[K],Y=H[K+1];Math.abs(X.bottom-Y.bottom)>2&&L.push((X.bottom+Y.top)/2-r.top)}}L.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(Rt(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bo(e,t){t=vn(t);var r=Rt(t),n=e.display.externalMeasured=new Ct(e.doc,t,r);n.lineN=r;var i=n.built=At(e,n);return n.text=i.pre,b(e.display.lineMeasure,i.pre),n}function ts(e,t,r,n){return kn(e,Ar(e,t),r,n)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ur(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=Rt(t),n=fa(e,r);n&&!n.text?n=null:n&&n.changes&&(Ya(e,n,r,_a(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 kn(e,t,r,n,i){t.before&&(r=-1);var L=r+(n||""),H;return t.cache.hasOwnProperty(L)?H=t.cache[L]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Uo(e,t.view,t.rect),t.hasHeights=!0),H=Ho(e,t,r,n),H.bogus||(t.cache[L]=H)),{left:H.left,right:H.right,top:i?H.rtop:H.top,bottom:i?H.rbottom:H.bottom}}var ns={left:0,right:0,top:0,bottom:0};function rs(e,t,r){for(var n,i,L,H,K,X,Y=0;Y<e.length;Y+=3)if(K=e[Y],X=e[Y+1],t<K?(i=0,L=1,H="left"):t<X?(i=t-K,L=i+1):(Y==e.length-3||t==X&&e[Y+3]>t)&&(L=X-K,i=L-1,t>=X&&(H="right")),i!=null){if(n=e[Y+2],K==X&&r==(n.insertLeft?"left":"right")&&(H=r),r=="left"&&i==0)for(;Y&&e[Y-2]==e[Y-3]&&e[Y-1].insertLeft;)n=e[(Y-=3)+2],H="left";if(r=="right"&&i==X-K)for(;Y<e.length-3&&e[Y+3]==e[Y+4]&&!e[Y+5].insertLeft;)n=e[(Y+=3)+2],H="right";break}return{node:n,start:i,end:L,collapse:H,coverStart:K,coverEnd:X}}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),L=i.node,H=i.start,K=i.end,X=i.collapse,Y;if(L.nodeType==3){for(var se=0;se<4;se++){for(;H&&Le(t.line.text.charAt(i.coverStart+H));)--H;for(;i.coverStart+K<i.coverEnd&&Le(t.line.text.charAt(i.coverStart+K));)++K;if(W&&F<9&&H==0&&K==i.coverEnd-i.coverStart?Y=L.parentNode.getBoundingClientRect():Y=jo(m(L,H,K).getClientRects(),n),Y.left||Y.right||H==0)break;K=H,H=H-1,X="right"}W&&F<11&&(Y=Wo(e.display.measure,Y))}else{H>0&&(X=n="right");var de;e.options.lineWrapping&&(de=L.getClientRects()).length>1?Y=de[n=="right"?de.length-1:0]:Y=L.getBoundingClientRect()}if(W&&F<9&&!H&&(!Y||!Y.left&&!Y.right)){var Te=L.parentNode.getClientRects()[0];Te?Y={left:Te.left,right:Te.left+Cr(e.display),top:Te.top,bottom:Te.bottom}:Y=ns}for(var Ee=Y.top-t.rect.top,Ie=Y.bottom-t.rect.top,Pe=(Ee+Ie)/2,He=t.view.measure.heights,Ye=0;Ye<He.length-1&&!(Pe<He[Ye]);Ye++);var et=Ye?He[Ye-1]:0,$e=He[Ye],rt={left:(X=="right"?Y.right:Y.left)-t.rect.left,right:(X=="left"?Y.left:Y.right)-t.rect.left,top:et,bottom:$e};return!Y.left&&!Y.right&&(rt.bogus=!0),e.options.singleCursorHeightPerLine||(rt.rtop=Ee,rt.rbottom=Ie),rt}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!yt(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,w(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 Ui(e,t,r,n,i){if(!i){var L=pa(t);r.top+=L,r.bottom+=L}if(n=="line")return r;n||(n="local");var H=An(t);if(n=="local"?H+=Fi(e.display):H-=e.display.viewOffset,n=="page"||n=="window"){var K=e.display.lineSpace.getBoundingClientRect();H+=K.top+(n=="window"?0:os());var X=K.left+(n=="window"?0:ss());r.left+=X,r.right+=X}return r.top+=H,r.bottom+=H,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 L=e.display.sizer.getBoundingClientRect();n+=L.left,i+=L.top}var H=e.display.lineSpace.getBoundingClientRect();return{left:n-H.left,top:i-H.top}}function ma(e,t,r,n,i){return n||(n=ot(e.doc,t.line)),Ui(e,n,ts(e,n,t.ch,i),r)}function Rn(e,t,r,n,i,L){n=n||ot(e.doc,t.line),i||(i=Ar(e,n));function H(Ie,Pe){var He=kn(e,i,Ie,Pe?"right":"left",L);return Pe?He.left=He.right:He.right=He.left,Ui(e,n,He,r)}var K=Be(n,e.doc.direction),X=t.ch,Y=t.sticky;if(X>=n.text.length?(X=n.text.length,Y="before"):X<=0&&(X=0,Y="after"),!K)return H(Y=="before"?X-1:X,Y=="before");function se(Ie,Pe,He){var Ye=K[Pe],et=Ye.level==1;return H(He?Ie-1:Ie,et!=He)}var de=Ke(K,X,Y),Te=Xe,Ee=se(X,de,Y=="before");return Te!=null&&(Ee.other=se(X,Te,Y!="before")),Ee}function us(e,t){var r=0;t=vt(e.doc,t),e.options.lineWrapping||(r=Cr(e.display)*t.ch);var n=ot(e.doc,t.line),i=An(n)+Fi(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function ga(e,t,r,n,i){var L=Fe(e,t,r);return L.xRel=i,n&&(L.outside=n),L}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=Tn(n,r),L=n.first+n.size-1;if(i>L)return ga(n.first+n.size-1,ot(n,L).text.length,null,1,1);t<0&&(t=0);for(var H=ot(n,i);;){var K=Ko(e,H,i,t,r),X=Sr(H,K.ch+(K.xRel>0||K.outside>0?1:0));if(!X)return K;var Y=X.find(1);if(Y.line==i)return Y;H=ot(n,i=Y.line)}}function ds(e,t,r,n){n-=pa(t);var i=t.text.length,L=We(function(H){return kn(e,r,H-1).bottom<=n},i,0);return i=We(function(H){return kn(e,r,H).top>n},L,i),{begin:L,end:i}}function cs(e,t,r,n){r||(r=Ar(e,t));var i=Ui(e,t,kn(e,r,n),"line").top;return ds(e,t,r,i)}function ya(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-=An(t);var L=Ar(e,t),H=pa(t),K=0,X=t.text.length,Y=!0,se=Be(t,e.doc.direction);if(se){var de=(e.options.lineWrapping?zo:Go)(e,t,r,L,se,n,i);Y=de.level!=1,K=Y?de.from:de.to-1,X=Y?de.to:de.from-1}var Te=null,Ee=null,Ie=We(function(ht){var dt=kn(e,L,ht);return dt.top+=H,dt.bottom+=H,ya(dt,n,i,!1)?(dt.top<=i&&dt.left<=n&&(Te=ht,Ee=dt),!0):!1},K,X),Pe,He,Ye=!1;if(Ee){var et=n-Ee.left<Ee.right-n,$e=et==Y;Ie=Te+($e?0:1),He=$e?"after":"before",Pe=et?Ee.left:Ee.right}else{!Y&&(Ie==X||Ie==K)&&Ie++,He=Ie==0?"after":Ie==t.text.length?"before":kn(e,L,Ie-(Y?1:0)).bottom+H<=i==Y?"after":"before";var rt=Rn(e,Fe(r,Ie,He),"line",t,L);Pe=rt.left,Ye=i<rt.top?-1:i>=rt.bottom?1:0}return Ie=Ce(t.text,Ie,1),ga(r,Ie,He,Ye,n-Pe)}function Go(e,t,r,n,i,L,H){var K=We(function(de){var Te=i[de],Ee=Te.level!=1;return ya(Rn(e,Fe(r,Ee?Te.to:Te.from,Ee?"before":"after"),"line",t,n),L,H,!0)},0,i.length-1),X=i[K];if(K>0){var Y=X.level!=1,se=Rn(e,Fe(r,Y?X.from:X.to,Y?"after":"before"),"line",t,n);ya(se,L,H,!0)&&se.top>H&&(X=i[K-1])}return X}function zo(e,t,r,n,i,L,H){var K=ds(e,t,n,H),X=K.begin,Y=K.end;/\s/.test(t.text.charAt(Y-1))&&Y--;for(var se=null,de=null,Te=0;Te<i.length;Te++){var Ee=i[Te];if(Ee.from>=Y||Ee.to<=X)continue;var Ie=Ee.level!=1,Pe=kn(e,n,Ie?Math.min(Y,Ee.to)-1:Math.max(X,Ee.from)).right,He=Pe<L?L-Pe+1e9:Pe-L;(!se||de>He)&&(se=Ee,de=He)}return se||(se=i[i.length-1]),se.from<X&&(se={from:X,to:se.to,level:se.level}),se.to>Y&&(se={from:se.from,to:Y,level:se.level}),se}var or;function Rr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(or==null){or=c("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)or.appendChild(document.createTextNode("x")),or.appendChild(c("br"));or.appendChild(document.createTextNode("x"))}b(e.measure,or);var r=or.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),w(e.measure),r||1}function Cr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=c("span","xxxxxxxxxx"),r=c("pre",[t],"CodeMirror-line-like");b(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function _a(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,L=t.gutters.firstChild,H=0;L;L=L.nextSibling,++H){var K=e.display.gutterSpecs[H].className;r[K]=L.offsetLeft+L.clientLeft+i,n[K]=L.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=Rr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Cr(e.display)-3);return function(i){if(In(e.doc,i))return 0;var L=0;if(i.widgets)for(var H=0;H<i.widgets.length;H++)i.widgets[H].height&&(L+=i.widgets[H].height);return r?L+(Math.ceil(i.text.length/n)||1)*t:L+t}}function Ea(e){var t=e.doc,r=hs(e);t.iter(function(n){var i=r(n);i!=n.height&&sn(n,i)})}function lr(e,t,r,n){var i=e.display;if(!r&&me(t).getAttribute("cm-not-content")=="true")return null;var L,H,K=i.lineSpace.getBoundingClientRect();try{L=t.clientX-K.left,H=t.clientY-K.top}catch(de){return null}var X=va(e,L,H),Y;if(n&&X.xRel>0&&(Y=ot(e.doc,X.line).text).length==X.ch){var se=j(Y,Y.length,e.options.tabSize)-Y.length;X=Fe(X.line,Math.max(0,Math.round((L-qa(e.display).left)/Cr(e.display))-se))}return X}function ur(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 un(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)nn&&qr(e.doc,t)<i.viewTo&&Xn(e);else if(r<=i.viewFrom)nn&&zn(e.doc,r+n)>i.viewFrom?Xn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Xn(e);else if(t<=i.viewFrom){var L=Bi(e,r,r+n,1);L?(i.view=i.view.slice(L.index),i.viewFrom=L.lineN,i.viewTo+=n):Xn(e)}else if(r>=i.viewTo){var H=Bi(e,t,t,-1);H?(i.view=i.view.slice(0,H.index),i.viewTo=H.lineN):Xn(e)}else{var K=Bi(e,t,t,-1),X=Bi(e,r,r+n,1);K&&X?(i.view=i.view.slice(0,K.index).concat(ln(e,K.lineN,X.lineN)).concat(i.view.slice(X.index)),i.viewTo+=n):Xn(e)}var Y=i.externalMeasured;Y&&(r<Y.lineN?Y.lineN+=n:t<Y.lineN+Y.size&&(i.externalMeasured=null))}function Vn(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 L=n.view[ur(e,t)];if(L.node==null)return;var H=L.changes||(L.changes=[]);J(H,r)==-1&&H.push(r)}function Xn(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=ur(e,t),L,H=e.display.view;if(!nn||r==e.doc.first+e.doc.size)return{index:i,lineN:r};for(var K=e.display.viewFrom,X=0;X<i;X++)K+=H[X].size;if(K!=t){if(n>0){if(i==H.length-1)return null;L=K+H[i].size-t,i++}else L=K-t;t+=L,r+=L}for(;qr(e.doc,r)!=r;){if(i==(n<0?0:H.length-1))return null;r+=n*H[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=ln(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=ln(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(ur(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(ln(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,ur(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(),L=n.selection=document.createDocumentFragment(),H=0;H<r.sel.ranges.length;H++){if(!t&&H==r.sel.primIndex)continue;var K=r.sel.ranges[H];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var X=K.empty();(X||e.options.showCursorWhenSelecting)&&ms(e,K.head,i),X||Xo(e,K,L)}return n}function ms(e,t,r){var n=Rn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(c("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 L=r.appendChild(c("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));L.style.display="",L.style.left=n.other.left+"px",L.style.top=n.other.top+"px",L.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,L=document.createDocumentFragment(),H=qa(e.display),K=H.left,X=Math.max(n.sizerWidth,sr(e)-n.sizer.offsetLeft)-H.right,Y=i.direction=="ltr";function se($e,rt,ht,dt){rt<0&&(rt=0),rt=Math.round(rt),dt=Math.round(dt),L.appendChild(c("div",null,"CodeMirror-selected","position: absolute; left: "+$e+`px;
|
|
top: `+rt+"px; width: "+(ht==null?X-$e:ht)+`px;
|
|
height: `+(dt-rt)+"px"))}function de($e,rt,ht){var dt=ot(i,$e),_t=dt.text.length,Mt,Xt;function Nt(Ht,hn){return ma(e,Fe($e,Ht),"div",dt,hn)}function mn(Ht,hn,Qt){var Gt=cs(e,dt,null,Ht),Wt=hn=="ltr"==(Qt=="after")?"left":"right",Ut=Qt=="after"?Gt.begin:Gt.end-(/\s/.test(dt.text.charAt(Gt.end-1))?2:1);return Nt(Ut,Wt)[Wt]}var cn=Be(dt,i.direction);return Je(cn,rt||0,ht==null?_t:ht,function(Ht,hn,Qt,Gt){var Wt=Qt=="ltr",Ut=Nt(Ht,Wt?"left":"right"),fn=Nt(hn-1,Wt?"right":"left"),Wr=rt==null&&Ht==0,qn=ht==null&&hn==_t,qt=Gt==0,Mn=!cn||Gt==cn.length-1;if(fn.top-Ut.top<=3){var Yt=(Y?Wr:qn)&&qt,Va=(Y?qn:Wr)&&Mn,Kn=Yt?K:(Wt?Ut:fn).left,pr=Va?X:(Wt?fn:Ut).right;se(Kn,Ut.top,pr-Kn,Ut.bottom)}else{var mr,an,Kr,Xa;Wt?(mr=Y&&Wr&&qt?K:Ut.left,an=Y?X:mn(Ht,Qt,"before"),Kr=Y?K:mn(hn,Qt,"after"),Xa=Y&&qn&&Mn?X:fn.right):(mr=Y?mn(Ht,Qt,"before"):K,an=!Y&&Wr&&qt?X:Ut.right,Kr=!Y&&qn&&Mn?K:fn.left,Xa=Y?mn(hn,Qt,"after"):X),se(mr,Ut.top,an-mr,Ut.bottom),Ut.bottom<fn.top&&se(K,Ut.bottom,null,fn.top),se(Kr,fn.top,Xa-Kr,fn.bottom)}(!Mt||ji(Ut,Mt)<0)&&(Mt=Ut),ji(fn,Mt)<0&&(Mt=fn),(!Xt||ji(Ut,Xt)<0)&&(Xt=Ut),ji(fn,Xt)<0&&(Xt=fn)}),{start:Mt,end:Xt}}var Te=t.from(),Ee=t.to();if(Te.line==Ee.line)de(Te.line,Te.ch,Ee.ch);else{var Ie=ot(i,Te.line),Pe=ot(i,Ee.line),He=vn(Ie)==vn(Pe),Ye=de(Te.line,Te.ch,He?Ie.text.length+1:null).end,et=de(Ee.line,He?0:null,Ee.ch).start;He&&(Ye.top<et.top-2?(se(Ye.right,Ye.top,null,Ye.bottom),se(K,et.top,et.left,et.bottom)):se(Ye.right,Ye.top,et.left-Ye.right,Ye.bottom)),Ye.bottom<et.top&&se(K,Ye.bottom,null,et.top)}r.appendChild(L)}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()||Lr(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,Lr(e))},100)}function xa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Se(e,"focus",e,t),e.state.focused=!0,I(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Lr(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Se(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],L=e.options.lineWrapping,H=void 0,K=0;if(i.hidden)continue;if(W&&F<8){var X=i.node.offsetTop+i.node.offsetHeight;H=X-r,r=X}else{var Y=i.node.getBoundingClientRect();H=Y.bottom-Y.top,!L&&i.text.firstChild&&(K=i.text.firstChild.getBoundingClientRect().right-Y.left-1)}var se=i.line.height-H;if((se>.005||se<-.005)&&(sn(i.line,H),ys(i.line),i.rest))for(var de=0;de<i.rest.length;de++)ys(i.rest[de]);if(K>e.display.sizerWidth){var Te=Math.ceil(K/Cr(e.display));Te>e.display.maxLineLength&&(e.display.maxLineLength=Te,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function ys(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-Fi(e));var i=r&&r.bottom!=null?r.bottom:n+e.wrapper.clientHeight,L=Tn(t,n),H=Tn(t,i);if(r&&r.ensure){var K=r.ensure.from.line,X=r.ensure.to.line;K<L?(L=K,H=Tn(t,An(ot(t,K))+e.wrapper.clientHeight)):Math.min(X,t.lastLine())>=H&&(L=Tn(t,An(ot(t,X))-e.wrapper.clientHeight),H=X)}return{from:L,to:Math.max(H,L+1)}}function Yo(e,t){if(Ne(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&&!s){var L=c("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-r.viewOffset-Fi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Dn(e)+r.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(L),L.scrollIntoView(i),e.display.lineSpace.removeChild(L)}}function $o(e,t,r,n){n==null&&(n=0);var i;!e.options.lineWrapping&&t==r&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var L=0;L<5;L++){var H=!1,K=Rn(e,t),X=!r||r==t?K:Rn(e,r);i={left:Math.min(K.left,X.left),top:Math.min(K.top,X.top)-n,right:Math.max(K.left,X.left),bottom:Math.max(K.bottom,X.bottom)+n};var Y=wa(e,i),se=e.doc.scrollTop,de=e.doc.scrollLeft;if(Y.scrollTop!=null&&(li(e,Y.scrollTop),Math.abs(e.doc.scrollTop-se)>1&&(H=!0)),Y.scrollLeft!=null&&(dr(e,Y.scrollLeft),Math.abs(e.doc.scrollLeft-de)>1&&(H=!0)),!H)break}return i}function Qo(e,t){var r=wa(e,t);r.scrollTop!=null&&li(e,r.scrollTop),r.scrollLeft!=null&&dr(e,r.scrollLeft)}function wa(e,t){var r=e.display,n=Rr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,L=ha(e),H={};t.bottom-t.top>L&&(t.bottom=t.top+L);var K=e.doc.height+ca(r),X=t.top<n,Y=t.bottom>K-n;if(t.top<i)H.scrollTop=X?0:t.top;else if(t.bottom>i+L){var se=Math.min(t.top,(Y?K:t.bottom)-L);se!=i&&(H.scrollTop=se)}var de=e.options.fixedGutter?0:r.gutters.offsetWidth,Te=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-de,Ee=sr(e)-r.gutters.offsetWidth,Ie=t.right-t.left>Ee;return Ie&&(t.right=t.left+Ee),t.left<10?H.scrollLeft=0:t.left<Te?H.scrollLeft=Math.max(0,t.left+de-(Ie?0:10)):t.right>Ee+Te-3&&(H.scrollLeft=t.right+(Ie?0:10)-Ee),H}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 Ir(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 Jo(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);_s(e,r,n,t.margin)}}function _s(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;D||Aa(e,{top:t}),bs(e,t,!0),D&&Aa(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 dr(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+Dn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var cr=function(e,t,r){this.cm=r;var n=this.vert=c("div",[c("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=c("div",[c("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),we(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),we(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&F<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};cr.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 L=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+L)+"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}},cr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},cr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},cr.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 G,this.disableVert=new G},cr.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var i=e.getBoundingClientRect(),L=r=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);L!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},cr.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 Dr(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:cr,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),we(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"?dr(e,t):li(e,t)},e),e.display.scrollbars.addClass&&I(e.display.wrapper,e.display.scrollbars.addClass)}var Zo=0;function hr(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},En(e.curOp)}function fr(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 L=0;L<t.length;L++)rl(t[L]);for(var H=0;H<t.length;H++)il(t[H])}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+Dn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-sr(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&&dr(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)&&Dr(t,e.barMeasure),e.updatedDisplay&&Ca(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&&dr(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$o(t,vt(n,e.scrollToPos.from),vt(n,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,i)}var L=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(L)for(var K=0;K<L.length;++K)L[K].lines.length||Se(L[K],"hide");if(H)for(var X=0;X<H.length;++X)H[X].lines.length&&Se(H[X],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Se(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function pn(e,t){if(e.curOp)return t();hr(e);try{return t()}finally{fr(e)}}function zt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);hr(e);try{return t.apply(e,arguments)}finally{fr(e)}}}function rn(e){return function(){if(this.curOp)return e.apply(this,arguments);hr(this);try{return e.apply(this,arguments)}finally{fr(this)}}}function Vt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);hr(t);try{return e.apply(this,arguments)}finally{fr(t)}}}function ci(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,C(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=xn(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(L){if(n.line>=e.display.viewFrom){var H=L.styles,K=L.text.length>e.options.maxHighlightLength?jt(t.mode,n.state):null,X=Vr(e,L,n,!0);K&&(n.state=K),L.styles=X.styles;var Y=L.styleClasses,se=X.classes;se?L.styleClasses=se:Y&&(L.styleClasses=null);for(var de=!H||H.length!=L.styles.length||Y!=se&&(!Y||!se||Y.bgClass!=se.bgClass||Y.textClass!=se.textClass),Te=0;!de&&Te<H.length;++Te)de=H[Te]!=L.styles[Te];de&&i.push(n.line),L.stateAfter=n.save(),n.nextLine()}else L.text.length<=e.options.maxHighlightLength&&Xr(e,L.text,n),L.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&&pn(e,function(){for(var L=0;L<i.length;L++)Vn(e,i[L],"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=sr(e),this.force=r,this.dims=_a(e),this.events=[]};Gi.prototype.signal=function(e,t){ce(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Se.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=Dn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Dn(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=P();if(!t||!_(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&_(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&&_(document.body,e.anchorNode)&&_(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 Xn(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)&&(Xn(e),t.dims=_a(e));var i=n.first+n.size,L=Math.max(t.visible.from-e.options.viewportMargin,n.first),H=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<L&&L-r.viewFrom<20&&(L=Math.max(n.first,r.viewFrom)),r.viewTo>H&&r.viewTo-H<20&&(H=Math.min(i,r.viewTo)),nn&&(L=qr(e.doc,L),H=zn(e.doc,H));var K=L!=r.viewFrom||H!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vo(e,L,H),r.viewOffset=An(ot(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var X=fs(e);if(!K&&X==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var Y=ol(e);return X>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),X>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(Y),w(r.cursorDiv),w(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==sr(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),Dr(e,i),Ca(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 Aa(e,t){var r=new Gi(e,t);if(Oa(e,r)){Hi(e),ws(e,r);var n=ui(e);si(e),Dr(e,n),Ca(e,n),r.finish()}}function ul(e,t,r){var n=e.display,i=e.options.lineNumbers,L=n.lineDiv,H=L.firstChild;function K(Ie){var Pe=Ie.nextSibling;return k&&l&&e.display.currentWheelTarget==Ie?Ie.style.display="none":Ie.parentNode.removeChild(Ie),Pe}for(var X=n.view,Y=n.viewFrom,se=0;se<X.length;se++){var de=X[se];if(!de.hidden)if(!de.node||de.node.parentNode!=L){var Te=No(e,de,Y,r);L.insertBefore(Te,H)}else{for(;H!=de.node;)H=K(H);var Ee=i&&t!=null&&t<=Y&&de.lineNumber;de.changes&&(J(de.changes,"gutter")>-1&&(Ee=!1),Ya(e,de,Y,r)),Ee&&(w(de.lineNumber),de.lineNumber.appendChild(document.createTextNode(vr(e.options,Y)))),H=de.node.nextSibling}Y+=de.size}for(;H;)H=K(H)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ca(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+Dn(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,L=n+"px",H=0;H<r.length;H++)if(!r[H].hidden){e.options.fixedGutter&&(r[H].gutter&&(r[H].gutter.style.left=L),r[H].gutterBackground&&(r[H].gutterBackground.style.left=L));var K=r[H].alignable;if(K)for(var X=0;X<K.length;X++)K[X].style.left=L}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}function Os(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=vr(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(c("div",[c("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),L=i.firstChild.offsetWidth,H=i.offsetWidth-L;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(L,n.lineGutter.offsetWidth-H)+1,n.lineNumWidth=n.lineNumInnerWidth+H,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Ra(e.display),!0}return!1}function La(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var L=e[i],H=null;if(typeof L!="string"&&(H=L.style,L=L.className),L=="CodeMirror-linenumbers")if(t)n=!0;else continue;r.push({className:L,style:H})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function As(e){var t=e.gutters,r=e.gutterSpecs;w(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var i=r[n],L=i.className,H=i.style,K=t.appendChild(c("div",null,"CodeMirror-gutter "+L));H&&(K.style.cssText=H),L=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Ra(e)}function hi(e){As(e.display),un(e),Ss(e)}function dl(e,t,r,n){var i=this;this.input=r,i.scrollbarFiller=c("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=c("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=y("div",null,"CodeMirror-code"),i.selectionDiv=c("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=c("div",null,"CodeMirror-cursors"),i.measure=c("div",null,"CodeMirror-measure"),i.lineMeasure=c("div",null,"CodeMirror-measure"),i.lineSpace=y("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var L=y("div",[i.lineSpace],"CodeMirror-lines");i.mover=c("div",[L],null,"position: relative"),i.sizer=c("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=c("div",null,null,"position: absolute; height: "+ee+"px; width: 1px;"),i.gutters=c("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=c("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=c("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),W&&F<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!k&&!(D&&a)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=La(n.gutters,n.lineNumbers),As(i),r.init(i)}var zi=0,yn=null;W?yn=-.53:D?yn=15:g?yn=-.7:f&&(yn=-1/3);function Rs(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=Rs(e);return t.x*=yn,t.y*=yn,t}function Cs(e,t){var r=Rs(t),n=r.x,i=r.y,L=e.display,H=L.scroller,K=H.scrollWidth>H.clientWidth,X=H.scrollHeight>H.clientHeight;if(!(n&&K||i&&X))return;if(i&&l&&k){e:for(var Y=t.target,se=L.view;Y!=H;Y=Y.parentNode)for(var de=0;de<se.length;de++)if(se[de].node==Y){e.display.currentWheelTarget=Y;break e}}if(n&&!D&&!p&&yn!=null){i&&X&&li(e,Math.max(0,H.scrollTop+i*yn)),dr(e,Math.max(0,H.scrollLeft+n*yn)),(!i||i&&X)&&Q(t),L.wheelStartX=null;return}if(i&&yn!=null){var Te=i*yn,Ee=e.doc.scrollTop,Ie=Ee+L.wrapper.clientHeight;Te<0?Ee=Math.max(0,Ee+Te-50):Ie=Math.min(e.doc.height,Ie+Te+50),Aa(e,{top:Ee,bottom:Ie})}zi<20&&(L.wheelStartX==null?(L.wheelStartX=H.scrollLeft,L.wheelStartY=H.scrollTop,L.wheelDX=n,L.wheelDY=i,setTimeout(function(){if(L.wheelStartX==null)return;var Pe=H.scrollLeft-L.wheelStartX,He=H.scrollTop-L.wheelStartY,Ye=He&&L.wheelDY&&He/L.wheelDY||Pe&&L.wheelDX&&Pe/L.wheelDX;if(L.wheelStartX=L.wheelStartY=null,!Ye)return;yn=(yn*zi+Ye)/(zi+1),++zi},200)):(L.wheelDX+=n,L.wheelDY+=i))}var _n=function(e,t){this.ranges=e,this.primIndex=t};_n.prototype.primary=function(){return this.ranges[this.primIndex]},_n.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},_n.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Lt(yr(this.ranges[t].anchor),yr(this.ranges[t].head));return new _n(e,this.primIndex)},_n.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},_n.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(mt(t,n.from())>=0&&mt(e,n.to())<=0)return r}return-1};var Lt=function(e,t){this.anchor=e,this.head=t};Lt.prototype.from=function(){return er(this.anchor,this.head)},Lt.prototype.to=function(){return _r(this.anchor,this.head)},Lt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Cn(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(Te,Ee){return mt(Te.from(),Ee.from())}),r=J(t,i);for(var L=1;L<t.length;L++){var H=t[L],K=t[L-1],X=mt(K.to(),H.from());if(n&&!H.empty()?X>0:X>=0){var Y=er(K.from(),H.from()),se=_r(K.to(),H.to()),de=K.empty()?H.from()==H.head:K.from()==K.head;L<=r&&--r,t.splice(--L,2,new Lt(de?se:Y,de?Y:se))}}return new _n(t,r)}function Yn(e,t){return new _n([new Lt(e,t||e)],0)}function $n(e){return e.text?Fe(e.from.line+e.text.length-1,$(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(mt(e,t.from)<0)return e;if(mt(e,t.to)<=0)return $n(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+=$n(t).ch-t.to.ch),Fe(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 Lt(Ls(i.anchor,t),Ls(i.head,t)))}return Cn(e.cm,r,e.sel.primIndex)}function Is(e,t,r){return e.line==t.line?Fe(r.line,e.ch-t.ch+r.ch):Fe(r.line+(e.line-t.line),e.ch)}function hl(e,t,r){for(var n=[],i=Fe(e.first,0),L=i,H=0;H<t.length;H++){var K=t[H],X=Is(K.from,i,L),Y=Is($n(K),i,L);if(i=K.to,L=Y,r=="around"){var se=e.sel.ranges[H],de=mt(se.head,se.anchor)<0;n[H]=new Lt(de?Y:X,de?X:Y)}else n[H]=new Lt(X,X)}return new _n(n,e.sel.primIndex)}function Da(e){e.doc.mode=st(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&&un(e)}function Ds(e,t){return t.from.ch==0&&t.to.ch==0&&$(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ka(e,t,r,n){function i(et){return r?r[et]:null}function L(et,$e,rt){ua(et,$e,rt,n),$t(et,"change",et,t)}function H(et,$e){for(var rt=[],ht=et;ht<$e;++ht)rt.push(new ar(Y[ht],i(ht),n));return rt}var K=t.from,X=t.to,Y=t.text,se=ot(e,K.line),de=ot(e,X.line),Te=$(Y),Ee=i(Y.length-1),Ie=X.line-K.line;if(t.full)e.insert(0,H(0,Y.length)),e.remove(Y.length,e.size-Y.length);else if(Ds(e,t)){var Pe=H(0,Y.length-1);L(de,de.text,Ee),Ie&&e.remove(K.line,Ie),Pe.length&&e.insert(K.line,Pe)}else if(se==de)if(Y.length==1)L(se,se.text.slice(0,K.ch)+Te+se.text.slice(X.ch),Ee);else{var He=H(1,Y.length-1);He.push(new ar(Te+se.text.slice(X.ch),Ee,n)),L(se,se.text.slice(0,K.ch)+Y[0],i(0)),e.insert(K.line+1,He)}else if(Y.length==1)L(se,se.text.slice(0,K.ch)+Y[0]+de.text.slice(X.ch),i(0)),e.remove(K.line+1,Ie);else{L(se,se.text.slice(0,K.ch)+Y[0],i(0)),L(de,Te+de.text.slice(X.ch),Ee);var Ye=H(1,Y.length-1);Ie>1&&e.remove(K.line+1,Ie-1),e.insert(K.line+1,Ye)}$t(e,"change",e,t)}function Qn(e,t,r){function n(i,L,H){if(i.linked)for(var K=0;K<i.linked.length;++K){var X=i.linked[K];if(X.doc==L)continue;var Y=H&&X.sharedHist;if(r&&!Y)continue;t(X.doc,Y),n(X.doc,i,Y)}}n(e,null,!0)}function ks(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,un(e)}function Ms(e){(e.doc.direction=="rtl"?I:E)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){pn(e,function(){Ms(e),un(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:$n(t),text:Pn(e,t.from,t.to)};return Fs(e,r,t.from.line,t.to.line+1),Qn(e,function(n){return Fs(n,r,t.from.line,t.to.line+1)},!0),r}function Ps(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ps(e.done),$(e.done);if(e.done.length&&!$(e.done).ranges)return $(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),$(e.done)}function Ns(e,t,r,n){var i=e.history;i.undone.length=0;var L=+new Date,H,K;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>L-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(i,i.lastOp==n)))K=$(H.changes),mt(t.from,t.to)==0&&mt(t.from,K.to)==0?K.to=$n(t):H.changes.push(Ma(e,t));else{var X=$(i.done);for((!X||!X.ranges)&&Xi(e.sel,i.done),H={changes:[Ma(e,t)],generation:i.generation},i.done.push(H);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=L,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,K||Se(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,L=n&&n.origin;r==i.lastSelOp||L&&i.lastSelOrigin==L&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==L||ml(e,L,$(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=L,i.lastSelOp=r,n&&n.clearRedo!==!1&&Ps(i.undone)}function Xi(e,t){var r=$(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Fs(e,t,r,n){var i=t["spans_"+e.id],L=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(H){H.markedSpans&&((i||(i=t["spans_"+e.id]={}))[L]=H.markedSpans),++L})}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 yl(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 Us(e,t){var r=yl(e,t),n=Tr(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var L=r[i],H=n[i];if(L&&H){e:for(var K=0;K<H.length;++K){for(var X=H[K],Y=0;Y<L.length;++Y)if(L[Y].marker==X.marker)continue e;L.push(X)}}else H&&(r[i]=H)}return r}function kr(e,t,r){for(var n=[],i=0;i<e.length;++i){var L=e[i];if(L.ranges){n.push(r?_n.prototype.deepCopy.call(L):L);continue}var H=L.changes,K=[];n.push({changes:K});for(var X=0;X<H.length;++X){var Y=H[X],se=void 0;if(K.push({from:Y.from,to:Y.to,text:Y.text}),t)for(var de in Y)(se=de.match(/^spans_(\d+)$/))&&(J(t,Number(se[1]))>-1&&($(K)[de]=Y[de],delete Y[de]))}}return n}function Pa(e,t,r,n){if(n){var i=e.anchor;if(r){var L=mt(t,i)<0;L!=mt(r,i)<0?(i=t,t=r):L!=mt(t,r)<0&&(t=r)}return new Lt(i,t)}else return new Lt(r||t,t)}function Yi(e,t,r,n,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Zt(e,new _n([Pa(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),L=0;L<e.sel.ranges.length;L++)n[L]=Pa(e.sel.ranges[L],t[L],null,i);var H=Cn(e.cm,n,e.sel.primIndex);Zt(e,H,r)}function Na(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Zt(e,Cn(e.cm,i,e.sel.primIndex),n)}function js(e,t,r,n){Zt(e,Yn(t,r),n)}function _l(e,t,r){var n={ranges:t.ranges,update:function(i){this.ranges=[];for(var L=0;L<i.length;L++)this.ranges[L]=new Lt(vt(e,i[L].anchor),vt(e,i[L].head))},origin:r&&r.origin};return Se(e,"beforeSelectionChange",e,n),e.cm&&Se(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Cn(e.cm,n.ranges,n.ranges.length-1):t}function Hs(e,t,r){var n=e.history.done,i=$(n);i&&i.ranges?(n[n.length-1]=t,$i(e,t,r)):Zt(e,t,r)}function Zt(e,t,r){$i(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function $i(e,t,r){(ce(e,"beforeSelectionChange")||e.cm&&ce(e.cm,"beforeSelectionChange"))&&(t=_l(e,t,r));var n=r&&r.bias||(mt(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,Gs(e,t,n,!0)),!(r&&r.scroll===!1)&&e.cm&&Ir(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,ve(e.cm)),$t(e,"cursorActivity",e)}function Ks(e){Ws(e,Gs(e,e.sel,null,!1))}function Gs(e,t,r,n){for(var i,L=0;L<t.ranges.length;L++){var H=t.ranges[L],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[L],X=Qi(e,H.anchor,K&&K.anchor,r,n),Y=Qi(e,H.head,K&&K.head,r,n);(i||X!=H.anchor||Y!=H.head)&&(i||(i=t.ranges.slice(0,L)),i[L]=new Lt(X,Y))}return i?Cn(e.cm,i,t.primIndex):t}function Mr(e,t,r,n,i){var L=ot(e,t.line);if(L.markedSpans)for(var H=0;H<L.markedSpans.length;++H){var K=L.markedSpans[H],X=K.marker,Y="selectLeft"in X?!X.selectLeft:X.inclusiveLeft,se="selectRight"in X?!X.selectRight:X.inclusiveRight;if((K.from==null||(Y?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(se?K.to>=t.ch:K.to>t.ch))){if(i&&(Se(X,"beforeCursorEnter"),X.explicitlyCleared))if(L.markedSpans){--H;continue}else break;if(!X.atomic)continue;if(r){var de=X.find(n<0?1:-1),Te=void 0;if((n<0?se:Y)&&(de=zs(e,de,-n,de&&de.line==t.line?L:null)),de&&de.line==t.line&&(Te=mt(de,r))&&(n<0?Te<0:Te>0))return Mr(e,de,t,n,i)}var Ee=X.find(n<0?-1:1);return(n<0?Y:se)&&(Ee=zs(e,Ee,n,Ee.line==t.line?L:null)),Ee?Mr(e,Ee,t,n,i):null}}return t}function Qi(e,t,r,n,i){var L=n||1,H=Mr(e,t,r,L,i)||!i&&Mr(e,t,r,L,!0)||Mr(e,t,r,-L,i)||!i&&Mr(e,t,r,-L,!0);return H||(e.cantEdit=!0,Fe(e.first,0))}function zs(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?vt(e,Fe(t.line-1)):null:r>0&&t.ch==(n||ot(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+r)}function Vs(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),he)}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,L,H,K){i&&(n.from=vt(e,i)),L&&(n.to=vt(e,L)),H&&(n.text=H),K!==void 0&&(n.origin=K)}),Se(e,"beforeChange",e,n),e.cm&&Se(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 Pr(e,t,r){if(e.cm){if(!e.cm.curOp)return zt(e.cm,Pr)(e,t,r);if(e.cm.state.suppressEdits)return}if((ce(e,"beforeChange")||e.cm&&ce(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var n=Jr&&!r&&ki(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]==""&&mt(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,Tr(e,t));var n=[];Qn(e,function(i,L){!L&&J(n,i.history)==-1&&(Zs(i.history,t),n.push(i.history)),pi(i,t,null,Tr(i,t))})}function Ji(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var i=e.history,L,H=e.sel,K=t=="undo"?i.done:i.undone,X=t=="undo"?i.undone:i.done,Y=0;Y<K.length&&!(L=K[Y],r?L.ranges&&!L.equals(e.sel):!L.ranges);Y++);if(Y==K.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(L=K.pop(),L.ranges){if(Xi(L,X),r&&!L.equals(e.sel)){Zt(e,L,{clearRedo:!1});return}H=L}else if(n){K.push(L);return}else break;var se=[];Xi(H,X),X.push({changes:se,generation:i.generation}),i.generation=L.generation||++i.maxGeneration;for(var de=ce(e,"beforeChange")||e.cm&&ce(e.cm,"beforeChange"),Te=function(Pe){var He=L.changes[Pe];if(He.origin=t,de&&!Xs(e,He,!1))return K.length=0,{};se.push(Ma(e,He));var Ye=Pe?Ia(e,He):$(K);pi(e,He,Ye,Us(e,He)),!Pe&&e.cm&&e.cm.scrollIntoView({from:He.from,to:$n(He)});var et=[];Qn(e,function($e,rt){!rt&&J(et,$e.history)==-1&&(Zs($e.history,He),et.push($e.history)),pi($e,He,null,Us($e,He))})},Ee=L.changes.length-1;Ee>=0;--Ee){var Ie=Te(Ee);if(Ie)return Ie.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new _n(re(e.sel.ranges,function(i){return new Lt(Fe(i.anchor.line+t,i.anchor.ch),Fe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){un(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Vn(e.cm,n,"gutter")}}function pi(e,t,r,n){if(e.cm&&!e.cm.curOp)return zt(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:Fe(e.first,0),to:Fe(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var L=e.lastLine();t.to.line>L&&(t={from:t.from,to:Fe(L,ot(e,L).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pn(e,t.from,t.to),r||(r=Ia(e,t)),e.cm?bl(e.cm,t,n):ka(e,t,n),$i(e,r,he),e.cantEdit&&Qi(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,r){var n=e.doc,i=e.display,L=t.from,H=t.to,K=!1,X=L.line;e.options.lineWrapping||(X=Rt(vn(ot(n,L.line))),n.iter(X,H.line+1,function(Ee){if(Ee==i.maxLine)return K=!0,!0})),n.sel.contains(t.from,t.to)>-1&&ve(e),ka(n,t,r,hs(e)),e.options.lineWrapping||(n.iter(X,L.line+t.text.length,function(Ee){var Ie=ti(Ee);Ie>i.maxLineLength&&(i.maxLine=Ee,i.maxLineLength=Ie,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),aa(n,L.line),ci(e,400);var Y=t.text.length-(H.line-L.line)-1;t.full?un(e):L.line==H.line&&t.text.length==1&&!Ds(e.doc,t)?Vn(e,L.line,"text"):un(e,L.line,H.line+1,Y);var se=ce(e,"changes"),de=ce(e,"change");if(de||se){var Te={from:L,to:H,text:t.text,removed:t.removed,origin:t.origin};de&&$t(e,"change",e,Te),se&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Te)}e.display.selForContextMenu=null}function Nr(e,t,r,n,i){var L;n||(n=r),mt(n,r)<0&&(L=[n,r],r=L[0],n=L[1]),typeof t=="string"&&(t=e.splitLines(t)),Pr(e,{from:r,to:n,text:t,origin:i})}function Qs(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Js(e,t,r,n){for(var i=0;i<e.length;++i){var L=e[i],H=!0;if(L.ranges){L.copied||(L=e[i]=L.deepCopy(),L.copied=!0);for(var K=0;K<L.ranges.length;K++)Qs(L.ranges[K].anchor,t,r,n),Qs(L.ranges[K].head,t,r,n);continue}for(var X=0;X<L.changes.length;++X){var Y=L.changes[X];if(r<Y.from.line)Y.from=Fe(Y.from.line+n,Y.from.ch),Y.to=Fe(Y.to.line+n,Y.to.ch);else if(t<=Y.to.line){H=!1;break}}H||(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;Js(e.done,r,n,i),Js(e.undone,r,n,i)}function mi(e,t,r,n){var i=t,L=t;return typeof t=="number"?L=ot(e,br(e,t)):i=Rt(t),i==null?null:(n(L,i)&&e.cm&&Vn(e.cm,i,r),L)}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,lt(i),$t(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 L=Math.min(t,i-e),H=n.height;if(n.removeInner(e,L),this.height-=H-n.height,i==L&&(this.children.splice(r--,1),n.parent=null),(t-=L)==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],L=i.chunkSize();if(e<=L){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var H=i.lines.length%25+25,K=H;K<i.lines.length;){var X=new gi(i.lines.slice(K,K+=25));i.height-=X.height,this.children.splice(++n,0,X),X.parent=this}i.lines=i.lines.slice(0,H),this.maybeSpill()}break}e-=L}},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=J(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],L=i.chunkSize();if(e<L){var H=Math.min(t,L-e);if(i.iterN(e,H,r))return!0;if((t-=H)==0)break;e=0}else e-=L}}};var yi=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};yi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=Rt(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 L=ii(this);sn(r,Math.max(0,r.height-L)),e&&(pn(e,function(){qs(e,r,-L),Vn(e,n,"widget")}),$t(e,"lineWidgetCleared",e,this,n))},yi.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;In(this.doc,n)||sn(n,n.height+i),r&&pn(r,function(){r.curOp.forceUpdate=!0,qs(r,n,i),$t(r,"lineWidgetChanged",r,e,Rt(n))})},fe(yi);function qs(e,t,r){An(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,r)}function El(e,t,r,n){var i=new yi(e,r,n),L=e.cm;return L&&i.noHScroll&&(L.display.alignWidgets=!0),mi(e,t,"widget",function(H){var K=H.widgets||(H.widgets=[]);if(i.insertAt==null?K.push(i):K.splice(Math.min(K.length-1,Math.max(0,i.insertAt)),0,i),i.line=H,L&&!In(e,H)){var X=An(H)<e.scrollTop;sn(H,H.height+ii(i)),X&&Sa(L,i.height),L.curOp.forceUpdate=!0}return!0}),L&&$t(L,"lineWidgetAdded",L,i,typeof t=="number"?t:Rt(t)),i}var eo=0,Jn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Jn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&hr(e),ce(this,"clear")){var r=this.find();r&&$t(this,"clear",r.from,r.to)}for(var n=null,i=null,L=0;L<this.lines.length;++L){var H=this.lines[L],K=On(H.markedSpans,this);e&&!this.collapsed?Vn(e,Rt(H),"text"):e&&(K.to!=null&&(i=Rt(H)),K.from!=null&&(n=Rt(H))),H.markedSpans=Zr(H.markedSpans,K),K.from==null&&this.collapsed&&!In(this.doc,H)&&e&&sn(H,Rr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var X=0;X<this.lines.length;++X){var Y=vn(this.lines[X]),se=ti(Y);se>e.display.maxLineLength&&(e.display.maxLine=Y,e.display.maxLineLength=se,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&un(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&&$t(e,"markerCleared",e,this,n,i),t&&fr(e),this.parent&&this.parent.clear()},Jn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var L=this.lines[i],H=On(L.markedSpans,this);if(H.from!=null&&(r=Fe(t?L:Rt(L),H.from),e==-1))return r;if(H.to!=null&&(n=Fe(t?L:Rt(L),H.to),e==1))return n}return r&&{from:r,to:n}},Jn.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;if(!t||!n)return;pn(n,function(){var i=t.line,L=Rt(t.line),H=fa(n,L);if(H&&(is(H),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!In(r.doc,i)&&r.height!=null){var K=r.height;r.height=null;var X=ii(r)-K;X&&sn(i,i.height+X)}$t(n,"markerChanged",n,e)})},Jn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||J(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Jn.prototype.detachLine=function(e){if(this.lines.splice(J(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},fe(Jn);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 zt(e.cm,Fr)(e,t,r,n,i);var L=new Jn(e,i),H=mt(t,r);if(n&&v(n,L,!1),H>0||H==0&&L.clearWhenEmpty!==!1)return L;if(L.replacedWith&&(L.collapsed=!0,L.widgetNode=y("span",[L.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||L.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(L.widgetNode.insertLeft=!0)),L.collapsed){if(Mi(e,t.line,t,r,L)||t.line!=r.line&&Mi(e,r.line,t,r,L))throw new Error("Inserting collapsed marker partially overlapping an existing one");sa()}L.addToHistory&&Ns(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var K=t.line,X=e.cm,Y;if(e.iter(K,r.line+1,function(de){X&&L.collapsed&&!X.options.lineWrapping&&vn(de)==X.display.maxLine&&(Y=!0),L.collapsed&&K!=t.line&&sn(de,0),oa(de,new nr(L,K==t.line?t.ch:null,K==r.line?r.ch:null)),++K}),L.collapsed&&e.iter(t.line,r.line+1,function(de){In(e,de)&&sn(de,0)}),L.clearOnEnter&&we(L,"beforeCursorEnter",function(){return L.clear()}),L.readOnly&&(Gn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),L.collapsed&&(L.id=++eo,L.atomic=!0),X){if(Y&&(X.curOp.updateMaxLine=!0),L.collapsed)un(X,t.line,r.line+1);else if(L.className||L.startStyle||L.endStyle||L.css||L.attributes||L.title)for(var se=t.line;se<=r.line;se++)Vn(X,se,"text");L.atomic&&Ks(X.doc),$t(X,"markerAdded",X,L)}return L}var _i=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};_i.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();$t(this,"clear")},_i.prototype.find=function(e,t){return this.primary.find(e,t)},fe(_i);function Tl(e,t,r,n,i){n=v(n),n.shared=!1;var L=[Fr(e,t,r,n,i)],H=L[0],K=n.widgetNode;return Qn(e,function(X){K&&(n.widgetNode=K.cloneNode(!0)),L.push(Fr(X,vt(X,t),vt(X,r),n,i));for(var Y=0;Y<X.linked.length;++Y)if(X.linked[Y].isParent)return;H=$(L)}),new _i(L,H)}function to(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(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(),L=e.clipPos(i.from),H=e.clipPos(i.to);if(mt(L,H)){var K=Fr(e,L,H,n.primary,n.primary.type);n.markers.push(K),K.parent=n}}}function wl(e){for(var t=function(n){var i=e[n],L=[i.primary.doc];Qn(i.primary.doc,function(X){return L.push(X)});for(var H=0;H<i.markers.length;H++){var K=i.markers[H];J(L,K.doc)==-1&&(K.parent=null,i.markers.splice(H--,1))}},r=0;r<e.length;r++)t(r)}var Sl=0,dn=function(e,t,r,n,i){if(!(this instanceof dn))return new dn(e,t,r,n,i);r==null&&(r=0),vi.call(this,[new gi([new ar("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var L=Fe(r,0);this.sel=Yn(L),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)),ka(this,{from:L,to:L,text:e}),Zt(this,Yn(L),he)};dn.prototype=Oe(vi.prototype,{constructor:dn,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=gr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Vt(function(e){var t=Fe(this.first,0),r=this.first+this.size-1;Pr(this,{from:t,to:Fe(r,ot(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),Zt(this,Yn(t),he)}),replaceRange:function(e,t,r,n){t=vt(this,t),r=r?vt(this,r):t,Nr(this,e,t,r,n)},getRange:function(e,t,r){var n=Pn(this,vt(this,e),vt(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(Nn(this,e))return ot(this,e)},getLineNumber:function(e){return Rt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ot(this,e)),vn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return vt(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:Vt(function(e,t,r){js(this,vt(this,typeof e=="number"?Fe(e,t||0):e),null,r)}),setSelection:Vt(function(e,t,r){js(this,vt(this,e),vt(this,t||e),r)}),extendSelection:Vt(function(e,t,r){Yi(this,vt(this,e),t&&vt(this,t),r)}),extendSelections:Vt(function(e,t){Bs(this,je(this,e),t)}),extendSelectionsBy:Vt(function(e,t){var r=re(this.sel.ranges,e);Bs(this,je(this,r),t)}),setSelections:Vt(function(e,t,r){if(!e.length)return;for(var n=[],i=0;i<e.length;i++)n[i]=new Lt(vt(this,e[i].anchor),vt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Zt(this,Cn(this.cm,n,t),r)}),addSelection:Vt(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Lt(vt(this,e),vt(this,t||e))),Zt(this,Cn(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=Pn(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=Pn(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:Vt(function(e,t,r){for(var n=[],i=this.sel,L=0;L<i.ranges.length;L++){var H=i.ranges[L];n[L]={from:H.from(),to:H.to(),text:this.splitLines(e[L]),origin:r}}for(var K=t&&t!="end"&&hl(this,n,t),X=n.length-1;X>=0;X--)Pr(this,n[X]);K?Hs(this,K):this.cm&&Ir(this.cm)}),undo:Vt(function(){Ji(this,"undo")}),redo:Vt(function(){Ji(this,"redo")}),undoSelection:Vt(function(){Ji(this,"undo",!0)}),redoSelection:Vt(function(){Ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,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:kr(this.history.done),undone:kr(this.history.undone)}},setHistory:function(e){var t=this.history=new Vi(this.history.maxGeneration);t.done=kr(e.done.slice(0),null,!0),t.undone=kr(e.undone.slice(0),null,!0)},setGutterMarker:Vt(function(e,t,r){return mi(this,e,"gutter",function(n){var i=n.gutterMarkers||(n.gutterMarkers={});return i[t]=r,!r&&ke(i)&&(n.gutterMarkers=null),!0})}),clearGutter:Vt(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&mi(t,r,"gutter",function(){return r.gutterMarkers[e]=null,ke(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Nn(this,e))return null;if(t=e,e=ot(this,e),!e)return null}else if(t=Rt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Vt(function(e,t,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:Vt(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",L=n[i];if(L)if(r==null)n[i]=null;else{var H=L.match(S(r));if(!H)return!1;var K=H.index+H[0].length;n[i]=L.slice(0,H.index)+(!H.index||K==L.length?"":" ")+L.slice(K)||null}else return!1;return!0})}),addLineWidget:Vt(function(e,t,r){return El(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Fr(this,vt(this,e),vt(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=vt(this,e),Fr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=vt(this,e);var t=[],r=ot(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=vt(this,e),t=vt(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(L){var H=L.markedSpans;if(H)for(var K=0;K<H.length;K++){var X=H[K];!(X.to!=null&&i==e.line&&e.ch>=X.to||X.from==null&&i!=e.line||X.from!=null&&i==t.line&&X.from>=t.ch)&&(!r||r(X.marker))&&n.push(X.marker.parent||X.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 L=i.text.length+n;if(L>e)return t=e,!0;e-=L,++r}),vt(this,Fe(r,t))},indexFromPos:function(e){e=vt(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 dn(gr(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 dn(gr(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 Pt&&(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=kr(this.history.done,n),e.history.undone=kr(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):ft(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Vt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),dn.prototype.eachLine=dn.prototype.iter;var no=0;function Ol(e){var t=this;if(ro(t),Ne(t,e)||Hn(t.display,e))return;Q(e),W&&(no=+new Date);var r=lr(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,L=Array(i),H=0,K=function(){++H==i&&zt(t,function(){r=vt(t.doc,r);var Ee={from:r,to:r,text:t.doc.splitLines(L.filter(function(Ie){return Ie!=null}).join(t.doc.lineSeparator())),origin:"paste"};Pr(t.doc,Ee),Hs(t.doc,Yn(vt(t.doc,r),vt(t.doc,$n(Ee))))})()},X=function(Ee,Ie){if(t.options.allowDropFileTypes&&J(t.options.allowDropFileTypes,Ee.type)==-1){K();return}var Pe=new FileReader;Pe.onerror=function(){return K()},Pe.onload=function(){var He=Pe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(He)){K();return}L[Ie]=He,K()},Pe.readAsText(Ee)},Y=0;Y<n.length;Y++)X(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 se=e.dataTransfer.getData("Text");if(se){var de;if(t.state.draggingText&&!t.state.draggingText.copy&&(de=t.listSelections()),$i(t.doc,Yn(r,r)),de)for(var Te=0;Te<de.length;++Te)Nr(t.doc,"",de[Te].anchor,de[Te].head,"drag");t.replaceSelection(se,"around","paste"),t.display.input.focus()}}catch(Ee){}}}function Al(e,t){if(W&&(!e.state.draggingText||+new Date-no<100)){le(t);return}if(Ne(e,t)||Hn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f){var r=c("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 Rl(e,t){var r=lr(e,t);if(!r)return;var n=document.createDocumentFragment();ms(e,r,n),e.display.dragCursor||(e.display.dragCursor=c("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),b(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 L=0;L<r.length;L++)e(r[L])})}var ao=!1;function Cl(){if(ao)return;Ll(),ao=!0}function Ll(){var e;we(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,io(Il)},100))}),we(window,"blur",function(){return io(Lr)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Zn={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++)Zn[bi+48]=Zn[bi+96]=String(bi);for(var Zi=65;Zi<=90;Zi++)Zn[Zi]=String.fromCharCode(Zi);for(var Ei=1;Ei<=12;Ei++)Zn[Ei+111]=Zn[Ei+63235]="F"+Ei;var Wn={};Wn.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"},Wn.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"},Wn.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"},Wn.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"]},Wn.default=l?Wn.macDefault:Wn.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,i,L,H=0;H<t.length-1;H++){var K=t[H];if(/^(cmd|meta|m)$/i.test(K))L=!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),L&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function kl(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=re(r.split(" "),Dl),L=0;L<i.length;L++){var H=void 0,K=void 0;L==i.length-1?(K=i.join(" "),H=n):(K=i.slice(0,L+1).join(" "),H="...");var X=t[K];if(!X)t[K]=H;else if(X!=H)throw new Error("Inconsistent bindings for "+K)}delete e[r]}for(var Y in t)e[Y]=t[Y];return e}function Ur(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 Ur(e,t.fallthrough,r,n);for(var L=0;L<t.fallthrough.length;L++){var H=Ur(e,t.fallthrough[L],r,n);if(H)return H}}}function so(e){var t=typeof e=="string"?e:Zn[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=Zn[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"?Wn[e]:e}function Br(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var L=t(r[i]);n.length&&mt(L.from,$(n).to)<=0;){var H=n.pop();if(mt(H.from,L.from)<0){L.from=H.from;break}}n.push(L)}pn(e,function(){for(var K=n.length-1;K>=0;K--)Nr(e.doc,"",n[K].from,n[K].to,"+delete");Ir(e)})}function Fa(e,t,r){var n=Ce(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Ua(e,t,r){var n=Fa(e,t.ch,r);return n==null?null:new Fe(t.line,n,r<0?"after":"before")}function Ba(e,t,r,n,i){if(e){t.doc.direction=="rtl"&&(i=-i);var L=Be(r,t.doc.direction);if(L){var H=i<0?$(L):L[0],K=i<0==(H.level==1),X=K?"after":"before",Y;if(H.level>0||t.doc.direction=="rtl"){var se=Ar(t,r);Y=i<0?r.text.length-1:0;var de=kn(t,se,Y).top;Y=We(function(Te){return kn(t,se,Te).top==de},i<0==(H.level==1)?H.from:H.to-1,Y),X=="before"&&(Y=Fa(r,Y,1))}else Y=i<0?H.to:H.from;return new Fe(n,Y,X)}}return new Fe(n,i<0?r.text.length:0,i<0?"before":"after")}function Ml(e,t,r,n){var i=Be(t,e.doc.direction);if(!i)return Ua(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 L=Ke(i,r.ch,r.sticky),H=i[L];if(e.doc.direction=="ltr"&&H.level%2==0&&(n>0?H.to>r.ch:H.from<r.ch))return Ua(t,r,n);var K=function(Ye,et){return Fa(t,Ye instanceof Fe?Ye.ch:Ye,et)},X,Y=function(Ye){return e.options.lineWrapping?(X=X||Ar(e,t),cs(e,t,X,Ye)):{begin:0,end:t.text.length}},se=Y(r.sticky=="before"?K(r,-1):r.ch);if(e.doc.direction=="rtl"||H.level==1){var de=H.level==1==n<0,Te=K(r,de?1:-1);if(Te!=null&&(de?Te<=H.to&&Te<=se.end:Te>=H.from&&Te>=se.begin)){var Ee=de?"before":"after";return new Fe(r.line,Te,Ee)}}var Ie=function(Ye,et,$e){for(var rt=function(Mt,Xt){return Xt?new Fe(r.line,K(Mt,1),"before"):new Fe(r.line,Mt,"after")};Ye>=0&&Ye<i.length;Ye+=et){var ht=i[Ye],dt=et>0==(ht.level!=1),_t=dt?$e.begin:K($e.end,-1);if(ht.from<=_t&&_t<ht.to)return rt(_t,dt);if(_t=dt?ht.from:K(ht.to,-1),$e.begin<=_t&&_t<$e.end)return rt(_t,dt)}},Pe=Ie(L+n,n,se);if(Pe)return Pe;var He=n>0?se.end:K(se.begin,-1);return He!=null&&!(n>0&&He==t.text.length)&&(Pe=Ie(n>0?0:i.length-1,n,Y(He)),Pe)?Pe:null}var Ti={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),he)},killLine:function(e){return Br(e,function(t){if(t.empty()){var r=ot(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Br(e,function(t){return{from:Fe(t.from().line,0),to:vt(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return Br(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Br(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 Br(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(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(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 Pl(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")},pe)},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")},pe)},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},pe)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var L=r[i].from(),H=j(e.getLine(L.line),L.ch,n);t.push(ue(n-H%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return pn(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var i=t[n].head,L=ot(e.doc,i.line).text;if(L){if(i.ch==L.length&&(i=new Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(L.charAt(i.ch-1)+L.charAt(i.ch-2),Fe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var H=ot(e.doc,i.line-1).text;H&&(i=new Fe(i.line,1),e.replaceRange(L.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),Fe(i.line-1,H.length-1),i,"+transpose"))}}r.push(new Lt(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return pn(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);Ir(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var r=ot(e.doc,t),n=vn(r);return n!=r&&(t=Rt(n)),Ba(!0,e,n,t,1)}function Pl(e,t){var r=ot(e.doc,t),n=Pi(r);return n!=r&&(t=Rt(n)),Ba(!0,e,r,t,-1)}function co(e,t){var r=uo(e,t.line),n=ot(e.doc,r.line),i=Be(n,e.doc.direction);if(!i||i[0].level==0){var L=Math.max(r.ch,n.text.search(/\S/)),H=t.line==r.line&&t.ch<=L&&t.ch;return Fe(r.line,H?0:L,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)!=ye}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=Ur(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Ur(t,e.options.extraKeys,r,e)||Ur(t,e.options.keyMap,r,e)}var Fl=new G;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:Fl.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"&&$t(e,"keyHandled",e,t,r),(i=="handled"||i=="multi")&&(Q(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 Ul(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(),Ne(t,e))return;W&&F<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&&!Ot&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!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;I(t,"CodeMirror-crosshair");function r(n){(n.keyCode==18||!n.altKey)&&(E(t,"CodeMirror-crosshair"),Ve(document,"keyup",r),Ve(document,"mouseover",r))}we(document,"keyup",r),we(document,"mouseover",r)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ne(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Hn(t.display,e)||Ne(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var r=e.keyCode,n=e.charCode;if(p&&r==ja){ja=null,Q(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(Ul(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&&mt(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(Ne(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,Hn(r,e)){k||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Wa(t,e))return;var n=lr(t,e),i=Ae(e),L=n?Hl(n,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),n&&Wl(t,i,n,L,e))return;i==1?n?Gl(t,n,L,e):me(e)==r.scroller&&Q(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 L="Click";return n=="double"?L="Double"+L:n=="triple"&&(L="Triple"+L),L=(t==1?"Left":t==2?"Middle":"Right")+L,xi(e,oo(L,i),i,function(H){if(typeof H=="string"&&(H=Ti[H]),!H)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=H(e,r)!=ye}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 L=h?r.shiftKey&&r.metaKey:r.altKey;i.unit=L?"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){W?setTimeout(C(gs,e),0):e.curOp.focus=P();var i=Kl(e,r,n),L=e.doc.sel,H;e.options.dragDrop&&Me&&!e.isReadOnly()&&r=="single"&&(H=L.contains(t))>-1&&(mt((H=L.ranges[H]).from(),t)<0||t.xRel>0)&&(mt(H.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,L=!1,H=zt(e,function(Y){k&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ve(i.wrapper.ownerDocument,"mouseup",H),Ve(i.wrapper.ownerDocument,"mousemove",K),Ve(i.scroller,"dragstart",X),Ve(i.scroller,"drop",H),L||(Q(Y),n.addNew||Yi(e.doc,r,null,null,n.extend),k&&!f||W&&F==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(Y){L=L||Math.abs(t.clientX-Y.clientX)+Math.abs(t.clientY-Y.clientY)>=10},X=function(){return L=!0};k&&(i.scroller.draggable=!0),e.state.draggingText=H,H.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),we(i.wrapper.ownerDocument,"mouseup",H),we(i.wrapper.ownerDocument,"mousemove",K),we(i.scroller,"dragstart",X),we(i.scroller,"drop",H),vs(e),setTimeout(function(){return i.input.focus()},20)}function yo(e,t,r){if(r=="char")return new Lt(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Lt(Fe(t.line,0),vt(e.doc,Fe(t.line+1,0)));var n=r(e,t);return new Lt(n.from,n.to)}function Vl(e,t,r,n){var i=e.display,L=e.doc;Q(t);var H,K,X=L.sel,Y=X.ranges;if(n.addNew&&!n.extend?(K=L.sel.contains(r),K>-1?H=Y[K]:H=new Lt(r,r)):(H=L.sel.primary(),K=L.sel.primIndex),n.unit=="rectangle")n.addNew||(H=new Lt(r,r)),r=lr(e,t,!0,!0),K=-1;else{var se=yo(e,r,n.unit);n.extend?H=Pa(H,se.anchor,se.head,n.extend):H=se}n.addNew?K==-1?(K=Y.length,Zt(L,Cn(e,Y.concat([H]),K),{scroll:!1,origin:"*mouse"})):Y.length>1&&Y[K].empty()&&n.unit=="char"&&!n.extend?(Zt(L,Cn(e,Y.slice(0,K).concat(Y.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),X=L.sel):Na(L,K,H,ge):(K=0,Zt(L,new _n([H],0),ge),X=L.sel);var de=r;function Te($e){if(mt(de,$e)==0)return;if(de=$e,n.unit=="rectangle"){for(var rt=[],ht=e.options.tabSize,dt=j(ot(L,r.line).text,r.ch,ht),_t=j(ot(L,$e.line).text,$e.ch,ht),Mt=Math.min(dt,_t),Xt=Math.max(dt,_t),Nt=Math.min(r.line,$e.line),mn=Math.min(e.lastLine(),Math.max(r.line,$e.line));Nt<=mn;Nt++){var cn=ot(L,Nt).text,Ht=oe(cn,Mt,ht);Mt==Xt?rt.push(new Lt(Fe(Nt,Ht),Fe(Nt,Ht))):cn.length>Ht&&rt.push(new Lt(Fe(Nt,Ht),Fe(Nt,oe(cn,Xt,ht))))}rt.length||rt.push(new Lt(r,r)),Zt(L,Cn(e,X.ranges.slice(0,K).concat(rt),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView($e)}else{var hn=H,Qt=yo(e,$e,n.unit),Gt=hn.anchor,Wt;mt(Qt.anchor,Gt)>0?(Wt=Qt.head,Gt=er(hn.from(),Qt.anchor)):(Wt=Qt.anchor,Gt=_r(hn.to(),Qt.head));var Ut=X.ranges.slice(0);Ut[K]=Xl(e,new Lt(vt(L,Gt),Wt)),Zt(L,Cn(e,Ut,K),ge)}}var Ee=i.wrapper.getBoundingClientRect(),Ie=0;function Pe($e){var rt=++Ie,ht=lr(e,$e,!0,n.unit=="rectangle");if(!ht)return;if(mt(ht,de)!=0){e.curOp.focus=P(),Te(ht);var dt=Wi(i,L);(ht.line>=dt.to||ht.line<dt.from)&&setTimeout(zt(e,function(){Ie==rt&&Pe($e)}),150)}else{var _t=$e.clientY<Ee.top?-20:$e.clientY>Ee.bottom?20:0;_t&&setTimeout(zt(e,function(){if(Ie!=rt)return;i.scroller.scrollTop+=_t,Pe($e)}),50)}}function He($e){e.state.selectingText=!1,Ie=Infinity,$e&&(Q($e),i.input.focus()),Ve(i.wrapper.ownerDocument,"mousemove",Ye),Ve(i.wrapper.ownerDocument,"mouseup",et),L.history.lastSelOrigin=null}var Ye=zt(e,function($e){$e.buttons===0||!Ae($e)?He($e):Pe($e)}),et=zt(e,He);e.state.selectingText=et,we(i.wrapper.ownerDocument,"mousemove",Ye),we(i.wrapper.ownerDocument,"mouseup",et)}function Xl(e,t){var r=t.anchor,n=t.head,i=ot(e.doc,r.line);if(mt(r,n)==0&&r.sticky==n.sticky)return t;var L=Be(i);if(!L)return t;var H=Ke(L,r.ch,r.sticky),K=L[H];if(K.from!=r.ch&&K.to!=r.ch)return t;var X=H+(K.from==r.ch==(K.level!=1)?0:1);if(X==0||X==L.length)return t;var Y;if(n.line!=r.line)Y=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var se=Ke(L,n.ch,n.sticky),de=se-H||(n.ch-r.ch)*(K.level==1?-1:1);se==X-1||se==X?Y=de<0:Y=de>0}var Te=L[X+(Y?-1:0)],Ee=Y==(Te.level==1),Ie=Ee?Te.from:Te.to,Pe=Ee?"after":"before";return r.ch==Ie&&r.sticky==Pe?t:new Lt(new Fe(r.line,Ie,Pe),n)}function _o(e,t,r,n){var i,L;if(t.touches)i=t.touches[0].clientX,L=t.touches[0].clientY;else try{i=t.clientX,L=t.clientY}catch(Te){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Q(t);var H=e.display,K=H.lineDiv.getBoundingClientRect();if(L>K.bottom||!ce(e,r))return te(t);L-=K.top-H.viewOffset;for(var X=0;X<e.display.gutterSpecs.length;++X){var Y=H.gutters.childNodes[X];if(Y&&Y.getBoundingClientRect().right>=i){var se=Tn(e.doc,L),de=e.display.gutterSpecs[X];return Se(e,r,e,se,de.className,t),te(t)}}}function Wa(e,t){return _o(e,t,"gutterClick",!0)}function bo(e,t){if(Hn(e.display,t)||Yl(e,t))return;if(Ne(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return ce(e,"gutterContextMenu")?_o(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 jr={toString:function(){return"CodeMirror.Init"}},To={},ta={};function $l(e){var t=e.optionHandlers;function r(n,i,L,H){e.defaults[n]=i,L&&(t[n]=H?function(K,X,Y){Y!=jr&&L(K,X,Y)}:L)}e.defineOption=r,e.Init=jr,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),un(n)},!0),r("lineSeparator",null,function(n,i){if(n.doc.lineSep=i,!i)return;var L=[],H=n.doc.first;n.doc.iter(function(X){for(var Y=0;;){var se=X.text.indexOf(i,Y);if(se==-1)break;Y=se+i.length,L.push(Fe(H,se))}H++});for(var K=L.length-1;K>=0;K--)Nr(n.doc,i,L[K],Fe(L[K].line,L[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,L){n.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),L!=jr&&n.refresh()}),r("specialCharPlaceholder",kt,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",a?"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",!A),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Eo(n),hi(n)},!0),r("keyMap","default",function(n,i,L){var H=qi(i),K=L!=jr&&qi(L);K&&K.detach&&K.detach(n,H),H.attach&&H.attach(n,K||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Jl,!0),r("gutters",[],function(n,i){n.display.gutterSpecs=La(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 Dr(n)},!0),r("scrollbarStyle","native",function(n){xs(n),Dr(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=La(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"&&(Lr(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,Ql),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 Ql(e,t,r){var n=r&&r!=jr;if(!t!=!n){var i=e.display.dragFunctions,L=t?we:Ve;L(e.display.scroller,"dragstart",i.start),L(e.display.scroller,"dragenter",i.enter),L(e.display.scroller,"dragover",i.over),L(e.display.scroller,"dragleave",i.leave),L(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(I(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(E(e.display.wrapper,"CodeMirror-wrap"),Ni(e)),Ea(e),un(e),ai(e),setTimeout(function(){return Dr(e)},100)}function Pt(e,t){var r=this;if(!(this instanceof Pt))return new Pt(e,t);this.options=t=t?v(t):{},v(To,t,!1);var n=t.value;typeof n=="string"?n=new dn(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new Pt.inputStyles[t.inputStyle](this),L=this.display=new dl(e,n,i,t);L.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 G,keySeq:null,specialChars:null},t.autofocus&&!a&&L.input.focus(),W&&F<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Cl(),hr(this),this.curOp.forceUpdate=!0,ks(this,n),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&xa(r)},20):Lr(this);for(var H in ta)ta.hasOwnProperty(H)&&ta[H](this,t[H],jr);Os(this),t.finishInit&&t.finishInit(this);for(var K=0;K<Ka.length;++K)Ka[K](this);fr(this),k&&t.lineWrapping&&getComputedStyle(L.lineDiv).textRendering=="optimizelegibility"&&(L.lineDiv.style.textRendering="auto")}Pt.defaults=To,Pt.optionHandlers=ta;function Zl(e){var t=e.display;we(t.scroller,"mousedown",zt(e,vo)),W&&F<11?we(t.scroller,"dblclick",zt(e,function(X){if(Ne(e,X))return;var Y=lr(e,X);if(!Y||Wa(e,X)||Hn(e.display,X))return;Q(X);var se=e.findWordAt(Y);Yi(e.doc,se.anchor,se.head)})):we(t.scroller,"dblclick",function(X){return Ne(e,X)||Q(X)}),we(t.scroller,"contextmenu",function(X){return bo(e,X)}),we(t.input.getField(),"contextmenu",function(X){t.scroller.contains(X.target)||bo(e,X)});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 L(X){if(X.touches.length!=1)return!1;var Y=X.touches[0];return Y.radiusX<=1&&Y.radiusY<=1}function H(X,Y){if(Y.left==null)return!0;var se=Y.left-X.left,de=Y.top-X.top;return se*se+de*de>20*20}we(t.scroller,"touchstart",function(X){if(!Ne(e,X)&&!L(X)&&!Wa(e,X)){t.input.ensurePolled(),clearTimeout(r);var Y=+new Date;t.activeTouch={start:Y,moved:!1,prev:Y-n.end<=300?n:null},X.touches.length==1&&(t.activeTouch.left=X.touches[0].pageX,t.activeTouch.top=X.touches[0].pageY)}}),we(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),we(t.scroller,"touchend",function(X){var Y=t.activeTouch;if(Y&&!Hn(t,X)&&Y.left!=null&&!Y.moved&&new Date-Y.start<300){var se=e.coordsChar(t.activeTouch,"page"),de;!Y.prev||H(Y,Y.prev)?de=new Lt(se,se):!Y.prev.prev||H(Y,Y.prev.prev)?de=e.findWordAt(se):de=new Lt(Fe(se.line,0),vt(e.doc,Fe(se.line+1,0))),e.setSelection(de.anchor,de.head),e.focus(),Q(X)}i()}),we(t.scroller,"touchcancel",i),we(t.scroller,"scroll",function(){t.scroller.clientHeight&&(li(e,t.scroller.scrollTop),dr(e,t.scroller.scrollLeft,!0),Se(e,"scroll",e))}),we(t.scroller,"mousewheel",function(X){return Cs(e,X)}),we(t.scroller,"DOMMouseScroll",function(X){return Cs(e,X)}),we(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(X){Ne(e,X)||le(X)},over:function(X){Ne(e,X)||(Rl(e,X),le(X))},start:function(X){return Al(e,X)},drop:zt(e,Ol),leave:function(X){Ne(e,X)||ro(e)}};var K=t.input.getField();we(K,"keyup",function(X){return mo.call(e,X)}),we(K,"keydown",zt(e,po)),we(K,"keypress",zt(e,go)),we(K,"focus",function(X){return xa(e,X)}),we(K,"blur",function(X){return Lr(e,X)})}var Ka=[];Pt.defineInitHook=function(e){return Ka.push(e)};function Oi(e,t,r,n){var i=e.doc,L;r==null&&(r="add"),r=="smart"&&(i.mode.indent?L=xn(e,t).state:r="prev");var H=e.options.tabSize,K=ot(i,t),X=j(K.text,null,H);K.stateAfter&&(K.stateAfter=null);var Y=K.text.match(/^\s*/)[0],se;if(!n&&!/\S/.test(K.text))se=0,r="not";else if(r=="smart"&&(se=i.mode.indent(L,K.text.slice(Y.length),K.text),se==ye||se>150)){if(!n)return;r="prev"}r=="prev"?t>i.first?se=j(ot(i,t-1).text,null,H):se=0:r=="add"?se=X+e.options.indentUnit:r=="subtract"?se=X-e.options.indentUnit:typeof r=="number"&&(se=X+r),se=Math.max(0,se);var de="",Te=0;if(e.options.indentWithTabs)for(var Ee=Math.floor(se/H);Ee;--Ee)Te+=H,de+=" ";if(Te<se&&(de+=ue(se-Te)),de!=Y)return Nr(i,de,Fe(t,0),Fe(t,Y.length),"+input"),K.stateAfter=null,!0;for(var Ie=0;Ie<i.sel.ranges.length;Ie++){var Pe=i.sel.ranges[Ie];if(Pe.head.line==t&&Pe.head.ch<Y.length){var He=Fe(t,Y.length);Na(i,Ie,new Lt(He,He));break}}}var Ln=null;function na(e){Ln=e}function Ga(e,t,r,n,i){var L=e.doc;e.display.shift=!1,n||(n=L.sel);var H=+new Date-200,K=i=="paste"||e.state.pasteIncoming>H,X=ft(t),Y=null;if(K&&n.ranges.length>1)if(Ln&&Ln.text.join(`
|
|
`)==t){if(n.ranges.length%Ln.text.length==0){Y=[];for(var se=0;se<Ln.text.length;se++)Y.push(L.splitLines(Ln.text[se]))}}else X.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(Y=re(X,function(Ye){return[Ye]}));for(var de=e.curOp.updateInput,Te=n.ranges.length-1;Te>=0;Te--){var Ee=n.ranges[Te],Ie=Ee.from(),Pe=Ee.to();Ee.empty()&&(r&&r>0?Ie=Fe(Ie.line,Ie.ch-r):e.state.overwrite&&!K?Pe=Fe(Pe.line,Math.min(ot(L,Pe.line).text.length,Pe.ch+$(X).length)):K&&Ln&&Ln.lineWise&&Ln.text.join(`
|
|
`)==X.join(`
|
|
`)&&(Ie=Pe=Fe(Ie.line,0)));var He={from:Ie,to:Pe,text:Y?Y[Te%Y.length]:X,origin:i||(K?"paste":e.state.cutIncoming>H?"cut":"+input")};Pr(e.doc,He),$t(e,"inputRead",e,He)}t&&!K&&wo(e,t),Ir(e),e.curOp.updateInput<2&&(e.curOp.updateInput=de),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&&pn(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 L=e.getModeAt(i.head),H=!1;if(L.electricChars){for(var K=0;K<L.electricChars.length;K++)if(t.indexOf(L.electricChars.charAt(K))>-1){H=Oi(e,i.head.line,"smart");break}}else L.electricInput&&(L.electricInput.test(ot(e.doc,i.head.line).text.slice(0,i.head.ch))&&(H=Oi(e,i.head.line,"smart")));H&&$t(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,L={anchor:Fe(i,0),head:Fe(i+1,0)};r.push(L),t.push(e.getRange(L.anchor,L.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 Ao(){var e=c("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=c("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),u&&(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 L=this.options,H=L[n];if(L[n]==i&&n!="mode")return;L[n]=i,t.hasOwnProperty(n)&&zt(this,t[n])(this,i,H),Se(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,L=0;L<i.length;++L)if(i[L]==n||i[L].name==n)return i.splice(L,1),!0},addOverlay:rn(function(n,i){var L=n.token?n:e.getMode(this.options,n);if(L.startState)throw new Error("Overlays may not be stateful.");q(this.state.overlays,{mode:L,modeSpec:n,opaque:i&&i.opaque,priority:i&&i.priority||0},function(H){return H.priority}),this.state.modeGen++,un(this)}),removeOverlay:rn(function(n){for(var i=this.state.overlays,L=0;L<i.length;++L){var H=i[L].modeSpec;if(H==n||typeof n=="string"&&H.name==n){i.splice(L,1),this.state.modeGen++,un(this);return}}}),indentLine:rn(function(n,i,L){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Nn(this.doc,n)&&Oi(this,n,i,L)}),indentSelection:rn(function(n){for(var i=this.doc.sel.ranges,L=-1,H=0;H<i.length;H++){var K=i[H];if(K.empty())K.head.line>L&&(Oi(this,K.head.line,n,!0),L=K.head.line,H==this.doc.sel.primIndex&&Ir(this));else{var X=K.from(),Y=K.to(),se=Math.max(L,X.line);L=Math.min(this.lastLine(),Y.line-(Y.ch?0:1))+1;for(var de=se;de<L;++de)Oi(this,de,n);var Te=this.doc.sel.ranges;X.ch==0&&i.length==Te.length&&Te[H].from().ch>0&&Na(this.doc,H,new Lt(X,Te[H].to()),he)}}}),getTokenAt:function(n,i){return Ri(this,n,i)},getLineTokens:function(n,i){return Ri(this,Fe(n),i,!0)},getTokenTypeAt:function(n){n=vt(this.doc,n);var i=tr(this,ot(this.doc,n.line)),L=0,H=(i.length-1)/2,K=n.ch,X;if(K==0)X=i[2];else for(;;){var Y=L+H>>1;if((Y?i[Y*2-1]:0)>=K)H=Y;else if(i[Y*2+1]<K)L=Y+1;else{X=i[Y*2+2];break}}var se=X?X.indexOf("overlay "):-1;return se<0?X:se==0?null:X.slice(0,se-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 L=[];if(!r.hasOwnProperty(i))return L;var H=r[i],K=this.getModeAt(n);if(typeof K[i]=="string")H[K[i]]&&L.push(H[K[i]]);else if(K[i])for(var X=0;X<K[i].length;X++){var Y=H[K[i][X]];Y&&L.push(Y)}else K.helperType&&H[K.helperType]?L.push(H[K.helperType]):H[K.name]&&L.push(H[K.name]);for(var se=0;se<H._global.length;se++){var de=H._global[se];de.pred(K,this)&&J(L,de.val)==-1&&L.push(de.val)}return L},getStateAfter:function(n,i){var L=this.doc;return n=br(L,n==null?L.first+L.size-1:n),xn(this,n+1,i).state},cursorCoords:function(n,i){var L,H=this.doc.sel.primary();return n==null?L=H.head:typeof n=="object"?L=vt(this.doc,n):L=n?H.from():H.to(),Rn(this,L,i||"page")},charCoords:function(n,i){return ma(this,vt(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,Tn(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,i,L){var H=!1,K;if(typeof n=="number"){var X=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>X&&(n=X,H=!0),K=ot(this.doc,n)}else K=n;return Ui(this,K,{top:0,left:0},i||"page",L||H).top+(H?this.doc.height-An(K):0)},defaultTextHeight:function(){return Rr(this.display)},defaultCharWidth:function(){return Cr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,i,L,H,K){var X=this.display;n=Rn(this,vt(this.doc,n));var Y=n.bottom,se=n.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),X.sizer.appendChild(i),H=="over")Y=n.top;else if(H=="above"||H=="near"){var de=Math.max(X.wrapper.clientHeight,this.doc.height),Te=Math.max(X.sizer.clientWidth,X.lineSpace.clientWidth);(H=="above"||n.bottom+i.offsetHeight>de)&&n.top>i.offsetHeight?Y=n.top-i.offsetHeight:n.bottom+i.offsetHeight<=de&&(Y=n.bottom),se+i.offsetWidth>Te&&(se=Te-i.offsetWidth)}i.style.top=Y+"px",i.style.left=i.style.right="",K=="right"?(se=X.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?se=0:K=="middle"&&(se=(X.sizer.clientWidth-i.offsetWidth)/2),i.style.left=se+"px"),L&&Qo(this,{left:se,top:Y,right:se+i.offsetWidth,bottom:Y+i.offsetHeight})},triggerOnKeyDown:rn(po),triggerOnKeyPress:rn(go),triggerOnKeyUp:mo,triggerOnMouseDown:rn(vo),execCommand:function(n){if(Ti.hasOwnProperty(n))return Ti[n].call(null,this)},triggerElectric:rn(function(n){wo(this,n)}),findPosH:function(n,i,L,H){var K=1;i<0&&(K=-1,i=-i);for(var X=vt(this.doc,n),Y=0;Y<i&&!(X=za(this.doc,X,K,L,H),X.hitSide);++Y);return X},moveH:rn(function(n,i){var L=this;this.extendSelectionsBy(function(H){return L.display.shift||L.doc.extend||H.empty()?za(L.doc,H.head,n,i,L.options.rtlMoveVisually):n<0?H.from():H.to()},pe)}),deleteH:rn(function(n,i){var L=this.doc.sel,H=this.doc;L.somethingSelected()?H.replaceSelection("",null,"+delete"):Br(this,function(K){var X=za(H,K.head,n,i,!1);return n<0?{from:X,to:K.head}:{from:K.head,to:X}})}),findPosV:function(n,i,L,H){var K=1,X=H;i<0&&(K=-1,i=-i);for(var Y=vt(this.doc,n),se=0;se<i;++se){var de=Rn(this,Y,"div");if(X==null?X=de.left:de.left=X,Y=Ro(this,de,K,L),Y.hitSide)break}return Y},moveV:rn(function(n,i){var L=this,H=this.doc,K=[],X=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(se){if(X)return n<0?se.from():se.to();var de=Rn(L,se.head,"div");se.goalColumn!=null&&(de.left=se.goalColumn),K.push(de.left);var Te=Ro(L,de,n,i);return i=="page"&&se==H.sel.primary()&&Sa(L,ma(L,Te,"div").top-de.top),Te},pe),K.length)for(var Y=0;Y<H.sel.ranges.length;Y++)H.sel.ranges[Y].goalColumn=K[Y]}),findWordAt:function(n){var i=this.doc,L=ot(i,n.line).text,H=n.ch,K=n.ch;if(L){var X=this.getHelper(n,"wordChars");(n.sticky=="before"||K==L.length)&&H?--H:++K;for(var Y=L.charAt(H),se=Re(Y,X)?function(de){return Re(de,X)}:/\s/.test(Y)?function(de){return/\s/.test(de)}:function(de){return!/\s/.test(de)&&!Re(de)};H>0&&se(L.charAt(H-1));)--H;for(;K<L.length&&se(L.charAt(K));)++K}return new Lt(Fe(n.line,H),Fe(n.line,K))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?I(this.display.cursorDiv,"CodeMirror-overwrite"):E(this.display.cursorDiv,"CodeMirror-overwrite"),Se(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:rn(function(n,i){oi(this,n,i)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-Dn(this)-this.display.barHeight,width:n.scrollWidth-Dn(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:sr(this)}},scrollIntoView:rn(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:Fe(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?Jo(this,n):_s(this,n.from,n.to,n.margin)}),setSize:rn(function(n,i){var L=this,H=function(X){return typeof X=="number"||/^\d+$/.test(String(X))?X+"px":X};n!=null&&(this.display.wrapper.style.width=H(n)),i!=null&&(this.display.wrapper.style.height=H(i)),this.options.lineWrapping&&as(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(X){if(X.widgets){for(var Y=0;Y<X.widgets.length;Y++)if(X.widgets[Y].noHScroll){Vn(L,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,Se(this,"refresh",this)}),operation:function(n){return pn(this,n)},startOperation:function(){return hr(this)},endOperation:function(){return fr(this)},refresh:rn(function(){var n=this.display.cachedTextHeight;un(this),this.curOp.forceUpdate=!0,ai(this),oi(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(n==null||Math.abs(n-Rr(this.display))>.5||this.options.lineWrapping)&&Ea(this),Se(this,"refresh",this)}),swapDoc:rn(function(n){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),ks(this,n),ai(this),this.display.input.reset(),oi(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,$t(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}},fe(e),e.registerHelper=function(n,i,L){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][i]=L},e.registerGlobalHelper=function(n,i,L,H){e.registerHelper(n,i,H),r[n]._global.push({pred:L,val:H})}}function za(e,t,r,n,i){var L=t,H=r,K=ot(e,t.line),X=i&&e.direction=="rtl"?-r:r;function Y(){var et=t.line+X;return et<e.first||et>=e.first+e.size?!1:(t=new Fe(et,t.ch,t.sticky),K=ot(e,et))}function se(et){var $e;if(n=="codepoint"){var rt=K.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(rt)?$e=null:$e=new Fe(t.line,Math.max(0,Math.min(K.text.length,t.ch+r*(rt>=55296&&rt<56320?2:1))),-r)}else i?$e=Ml(e.cm,K,t,r):$e=Ua(K,t,r);if($e==null)if(!et&&Y())t=Ba(i,e.cm,K,t.line,X);else return!1;else t=$e;return!0}if(n=="char"||n=="codepoint")se();else if(n=="column")se(!0);else if(n=="word"||n=="group")for(var de=null,Te=n=="group",Ee=e.cm&&e.cm.getHelper(t,"wordChars"),Ie=!0;!(r<0&&!se(!Ie));Ie=!1){var Pe=K.text.charAt(t.ch)||`
|
|
`,He=Re(Pe,Ee)?"w":Te&&Pe==`
|
|
`?"n":!Te||/\s/.test(Pe)?null:"p";if(Te&&!Ie&&!He&&(He="s"),de&&de!=He){r<0&&(r=1,se(),t.sticky="after");break}if(He&&(de=He),r>0&&!se(!Ie))break}var Ye=Qi(e,t,L,H,!0);return zr(L,Ye)&&(Ye.hitSide=!0),Ye}function Ro(e,t,r,n){var i=e.doc,L=t.left,H;if(n=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),X=Math.max(K-.5*Rr(e.display),3);H=(r>0?t.bottom:t.top)+r*X}else n=="line"&&(H=r>0?t.bottom+3:t.top-3);for(var Y;!(Y=va(e,L,H),!Y.outside);){if(r<0?H<=0:H>=i.height){Y.hitSide=!0;break}H+=r*5}return Y}var It=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new G,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};It.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 L(K){for(var X=K.target;X;X=X.parentNode){if(X==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(X.className))break}return!1}we(i,"paste",function(K){if(!L(K)||Ne(n,K)||xo(K,n))return;F<=11&&setTimeout(zt(n,function(){return t.updateFromDOM()}),20)}),we(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),we(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),we(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),we(i,"touchstart",function(){return r.forceCompositionEnd()}),we(i,"input",function(){t.composing||t.readFromDOMSoon()});function H(K){if(!L(K)||Ne(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 X=So(n);na({lineWise:!0,text:X.text}),K.type=="cut"&&n.operation(function(){n.setSelections(X.ranges,0,he),n.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var Y=Ln.text.join(`
|
|
`);if(K.clipboardData.setData("Text",Y),K.clipboardData.getData("Text")==Y){K.preventDefault();return}}var se=Ao(),de=se.firstChild;n.display.lineSpace.insertBefore(se,n.display.lineSpace.firstChild),de.value=Ln.text.join(`
|
|
`);var Te=document.activeElement;U(de),setTimeout(function(){n.display.lineSpace.removeChild(se),Te.focus(),Te==i&&r.showPrimarySelection()},50)}we(i,"copy",H),we(i,"cut",H)},It.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},It.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},It.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},It.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},It.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 L=ra(t,e.anchorNode,e.anchorOffset),H=ra(t,e.focusNode,e.focusOffset);if(L&&!L.bad&&H&&!H.bad&&mt(er(L,H),n)==0&&mt(_r(L,H),i)==0)return;var K=t.display.view,X=n.line>=t.display.viewFrom&&Co(t,n)||{node:K[0].measure.map[2],offset:0},Y=i.line<t.display.viewTo&&Co(t,i);if(!Y){var se=K[K.length-1].measure,de=se.maps?se.maps[se.maps.length-1]:se.map;Y={node:de[de.length-1],offset:de[de.length-2]-de[de.length-3]}}if(!X||!Y){e.removeAllRanges();return}var Te=e.rangeCount&&e.getRangeAt(0),Ee;try{Ee=m(X.node,X.offset,Y.offset,Y.node)}catch(Ie){}Ee&&(!D&&t.state.focused?(e.collapse(X.node,X.offset),Ee.collapsed||(e.removeAllRanges(),e.addRange(Ee))):(e.removeAllRanges(),e.addRange(Ee)),Te&&e.anchorNode==null?e.addRange(Te):D&&this.startGracePeriod()),this.rememberSelection()},It.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)},It.prototype.showMultipleSelections=function(e){b(this.cm.display.cursorDiv,e.cursors),b(this.cm.display.selectionDiv,e.selection)},It.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},It.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return _(this.div,t)},It.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},It.prototype.blur=function(){this.div.blur()},It.prototype.getField=function(){return this.div},It.prototype.supportsTouch=function(){return!0},It.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():pn(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)},It.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},It.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&&pn(t,function(){Zt(t.doc,Yn(r,n),he),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},It.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=Fe(n.line-1,ot(e.doc,n.line-1).length)),i.ch==ot(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Fe(i.line+1,0)),n.line<t.viewFrom||i.line>t.viewTo-1)return!1;var L,H,K;n.line==t.viewFrom||(L=ur(e,n.line))==0?(H=Rt(t.view[0].line),K=t.view[0].node):(H=Rt(t.view[L].line),K=t.view[L-1].node.nextSibling);var X=ur(e,i.line),Y,se;if(X==t.view.length-1?(Y=t.viewTo-1,se=t.lineDiv.lastChild):(Y=Rt(t.view[X+1].line)-1,se=t.view[X+1].node.previousSibling),!K)return!1;for(var de=e.doc.splitLines(tu(e,K,se,H,Y)),Te=Pn(e.doc,Fe(H,0),Fe(Y,ot(e.doc,Y).text.length));de.length>1&&Te.length>1;)if($(de)==$(Te))de.pop(),Te.pop(),Y--;else if(de[0]==Te[0])de.shift(),Te.shift(),H++;else break;for(var Ee=0,Ie=0,Pe=de[0],He=Te[0],Ye=Math.min(Pe.length,He.length);Ee<Ye&&Pe.charCodeAt(Ee)==He.charCodeAt(Ee);)++Ee;for(var et=$(de),$e=$(Te),rt=Math.min(et.length-(de.length==1?Ee:0),$e.length-(Te.length==1?Ee:0));Ie<rt&&et.charCodeAt(et.length-Ie-1)==$e.charCodeAt($e.length-Ie-1);)++Ie;if(de.length==1&&Te.length==1&&H==n.line)for(;Ee&&Ee>n.ch&&et.charCodeAt(et.length-Ie-1)==$e.charCodeAt($e.length-Ie-1);)Ee--,Ie++;de[de.length-1]=et.slice(0,et.length-Ie).replace(/^\u200b+/,""),de[0]=de[0].slice(Ee).replace(/\u200b+$/,"");var ht=Fe(H,Ee),dt=Fe(Y,Te.length?$(Te).length-Ie:0);if(de.length>1||de[0]||mt(ht,dt))return Nr(e.doc,de,ht,dt,"+input"),!0},It.prototype.ensurePolled=function(){this.forceCompositionEnd()},It.prototype.reset=function(){this.forceCompositionEnd()},It.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},It.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)},It.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&pn(this.cm,function(){return un(e.cm)})},It.prototype.setUneditable=function(e){e.contentEditable="false"},It.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||zt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},It.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},It.prototype.onContextMenu=function(){},It.prototype.resetPosition=function(){},It.prototype.needsContentAttribute=!0;function Co(e,t){var r=fa(e,t.line);if(!r||r.hidden)return null;var n=ot(e.doc,t.line),i=es(r,n,t.line),L=Be(n,e.doc.direction),H="left";if(L){var K=Ke(L,t.ch);H=K%2?"right":"left"}var X=rs(i.map,t.ch,H);return X.offset=X.collapse=="right"?X.end:X.start,X}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Hr(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,n,i){var L="",H=!1,K=e.doc.lineSeparator(),X=!1;function Y(Ee){return function(Ie){return Ie.id==Ee}}function se(){H&&(L+=K,X&&(L+=K),H=X=!1)}function de(Ee){Ee&&(se(),L+=Ee)}function Te(Ee){if(Ee.nodeType==1){var Ie=Ee.getAttribute("cm-text");if(Ie){de(Ie);return}var Pe=Ee.getAttribute("cm-marker"),He;if(Pe){var Ye=e.findMarks(Fe(n,0),Fe(i+1,0),Y(+Pe));Ye.length&&(He=Ye[0].find(0))&&de(Pn(e.doc,He.from,He.to).join(K));return}if(Ee.getAttribute("contenteditable")=="false")return;var et=/^(pre|div|p|li|table|br)$/i.test(Ee.nodeName);if(!/^br$/i.test(Ee.nodeName)&&Ee.textContent.length==0)return;et&&se();for(var $e=0;$e<Ee.childNodes.length;$e++)Te(Ee.childNodes[$e]);/^(pre|p)$/i.test(Ee.nodeName)&&(X=!0),et&&(H=!0)}else Ee.nodeType==3&&de(Ee.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Te(t),t==r);)t=t.nextSibling,X=!1;return L}function ra(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return Hr(e.clipPos(Fe(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 L=e.display.view[i];if(L.node==n)return nu(L,t,r)}}function nu(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!_(n,t))return Hr(Fe(Rt(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var L=e.rest?$(e.rest):e.line;return Hr(Fe(Rt(L),L.text.length),i)}var H=t.nodeType==3?t:null,K=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,r&&(r=H.nodeValue.length));K.parentNode!=n;)K=K.parentNode;var X=e.measure,Y=X.maps;function se(He,Ye,et){for(var $e=-1;$e<(Y?Y.length:0);$e++)for(var rt=$e<0?X.map:Y[$e],ht=0;ht<rt.length;ht+=3){var dt=rt[ht+2];if(dt==He||dt==Ye){var _t=Rt($e<0?e.line:e.rest[$e]),Mt=rt[ht]+et;return(et<0||dt!=He)&&(Mt=rt[ht+(et?1:0)]),Fe(_t,Mt)}}}var de=se(H,K,r);if(de)return Hr(de,i);for(var Te=K.nextSibling,Ee=H?H.nodeValue.length-r:0;Te;Te=Te.nextSibling){if(de=se(Te,Te.firstChild,0),de)return Hr(Fe(de.line,de.ch-Ee),i);Ee+=Te.textContent.length}for(var Ie=K.previousSibling,Pe=r;Ie;Ie=Ie.previousSibling){if(de=se(Ie,Ie.firstChild,-1),de)return Hr(Fe(de.line,de.ch+Pe),i);Pe+=Ie.textContent.length}}var Bt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new G,this.hasSelection=!1,this.composing=null};Bt.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),u&&(i.style.width="0px"),we(i,"input",function(){W&&F>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),we(i,"paste",function(H){if(Ne(n,H)||xo(H,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function L(H){if(Ne(n,H))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}),H.type=="cut"?n.setSelections(K.ranges,null,he):(r.prevInput="",i.value=K.text.join(`
|
|
`),U(i))}else return;H.type=="cut"&&(n.state.cutIncoming=+new Date)}we(i,"cut",L),we(i,"copy",L),we(e.scroller,"paste",function(H){if(Hn(e,H)||Ne(n,H))return;if(!i.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var K=new Event("paste");K.clipboardData=H.clipboardData,i.dispatchEvent(K)}),we(e.lineSpace,"selectstart",function(H){Hn(e,H)||Q(H)}),we(i,"compositionstart",function(){var H=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:H,range:n.markText(H,n.getCursor("to"),{className:"CodeMirror-composing"})}}),we(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Bt.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},Bt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Bt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=ps(e);if(e.options.moveInputWithCursor){var i=Rn(e,r.sel.primary().head,"div"),L=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+H.top-L.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+H.left-L.left))}return n},Bt.prototype.showSelection=function(e){var t=this.cm,r=t.display;b(r.cursorDiv,e.cursors),b(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Bt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&U(this.textarea),W&&F>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",W&&F>=9&&(this.hasSelection=null))},Bt.prototype.getField=function(){return this.textarea},Bt.prototype.supportsTouch=function(){return!1},Bt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},Bt.prototype.blur=function(){this.textarea.blur()},Bt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Bt.prototype.receivedFocus=function(){this.slowPoll()},Bt.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Bt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},Bt.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||it(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(W&&F>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var L=i.charCodeAt(0);if(L==8203&&!n&&(n="\u200B"),L==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,K=Math.min(n.length,i.length);H<K&&n.charCodeAt(H)==i.charCodeAt(H);)++H;return pn(t,function(){Ga(t,i.slice(H),n.length-H,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},Bt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Bt.prototype.onKeyPress=function(){W&&F>=9&&(this.hasSelection=null),this.fastPoll()},Bt.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var L=lr(r,e),H=n.scroller.scrollTop;if(!L||p)return;var K=r.options.resetSelectionOnContextMenu;K&&r.doc.sel.contains(L)==-1&&zt(r,Zt)(r.doc,Yn(L),he);var X=i.style.cssText,Y=t.wrapper.style.cssText,se=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-se.top-5)+"px; left: "+(e.clientX-se.left-5)+`px;
|
|
z-index: 1000; background: `+(W?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var de;k&&(de=window.scrollY),n.input.focus(),k&&window.scrollTo(null,de),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=Ee,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function Te(){if(i.selectionStart!=null){var Pe=r.somethingSelected(),He="\u200B"+(Pe?i.value:"");i.value="\u21DA",i.value=He,t.prevInput=Pe?"":"\u200B",i.selectionStart=1,i.selectionEnd=He.length,n.selForContextMenu=r.doc.sel}}function Ee(){if(t.contextMenuPending!=Ee)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=Y,i.style.cssText=X,W&&F<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=H),i.selectionStart!=null){(!W||W&&F<9)&&Te();var Pe=0,He=function(){n.selForContextMenu==r.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?zt(r,Vs)(r):Pe++<10?n.detectingSelectAll=setTimeout(He,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(He,200)}}if(W&&F>=9&&Te(),O){le(e);var Ie=function(){Ve(window,"mouseup",Ie),setTimeout(Ee,20)};we(window,"mouseup",Ie)}else setTimeout(Ee,50)},Bt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Bt.prototype.setUneditable=function(){},Bt.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?v(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&&(we(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var L=e.form;i=L.submit;try{var H=L.submit=function(){n(),L.submit=i,L.submit(),L.submit=H}}catch(X){}}t.finishInit=function(X){X.save=n,X.getTextArea=function(){return e},X.toTextArea=function(){X.toTextArea=isNaN,n(),e.parentNode.removeChild(X.getWrapperElement()),e.style.display="",e.form&&(Ve(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=Pt(function(X){return e.parentNode.insertBefore(X,e.nextSibling)},t);return K}function iu(e){e.off=Ve,e.on=we,e.wheelEventPixels=cl,e.Doc=dn,e.splitLines=ft,e.countColumn=j,e.findColumn=oe,e.isWordChar=xe,e.Pass=ye,e.signal=Se,e.Line=ar,e.changeEnd=$n,e.scrollbarModel=Ts,e.Pos=Fe,e.cmpPos=mt,e.modes=bt,e.mimeModes=Ge,e.resolveMode=pt,e.getMode=st,e.modeExtensions=wt,e.extendMode=Dt,e.copyState=jt,e.startState=Gr,e.innerMode=gn,e.commands=Ti,e.keyMap=Wn,e.keyName=lo,e.isModifierKey=so,e.lookupKey=Ur,e.normalizeKeyMap=kl,e.StringStream=Ft,e.SharedTextMarker=_i,e.TextMarker=Jn,e.LineWidget=yi,e.e_preventDefault=Q,e.e_stopPropagation=Z,e.e_stop=le,e.addClass=I,e.contains=_,e.rmClass=E,e.keyNames=Zn}$l(Pt),ql(Pt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in dn.prototype)dn.prototype.hasOwnProperty(ia)&&J(au,ia)<0&&(Pt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(dn.prototype[ia]));return fe(dn),Pt.inputStyles={textarea:Bt,contenteditable:It},Pt.defineMode=function(e){!Pt.defaults.mode&&e!="null"&&(Pt.defaults.mode=e),en.apply(this,arguments)},Pt.defineMIME=tn,Pt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Pt.defineMIME("text/plain","null"),Pt.defineExtension=function(e,t){Pt.prototype[e]=t},Pt.defineDocExtension=function(e,t){dn.prototype[e]=t},Pt.fromTextArea=ru,iu(Pt),Pt.version="5.58.2",Pt})},Y1PL:function(ut,Qe,ne){"use strict";ne.r(Qe),ne.d(Qe,"ResizableTextArea",function(){return J});var ae=ne("wx14"),V=ne("1OyB"),D=ne("vuIU"),z=ne("Ji7U"),N=ne("LK+K"),M=ne("cDcd"),W=ne("VTBJ"),F=ne("rePB"),k=ne("Zm9Q"),R=ne("Kwbf"),g=ne("c+Xe"),p=ne("m+aA"),f=ne("bdgK"),d=new Map;function s(he){he.forEach(function(ge){var pe,oe=ge.target;(pe=d.get(oe))===null||pe===void 0||pe.forEach(function(ie){return ie(oe)})})}var u=new f.default(s),o=null,a=null;function l(he,ge){d.has(he)||(d.set(he,new Set),u.observe(he)),d.get(he).add(ge)}function h(he,ge){d.has(he)&&(d.get(he).delete(ge),d.get(he).size||(u.unobserve(he),d.delete(he)))}var A=function(he){Object(z.a)(pe,he);var ge=Object(N.a)(pe);function pe(){return Object(V.a)(this,pe),ge.apply(this,arguments)}return Object(D.a)(pe,[{key:"render",value:function(){return this.props.children}}]),pe}(M.Component),x=M.createContext(null);function T(he){var ge=he.children,pe=he.onBatchResize,oe=M.useRef(0),ie=M.useRef([]),ue=M.useContext(x),$=M.useCallback(function(re,q,be){oe.current+=1;var Oe=oe.current;ie.current.push({size:re,element:q,data:be}),Promise.resolve().then(function(){Oe===oe.current&&(pe==null||pe(ie.current),ie.current=[])}),ue==null||ue(re,q,be)},[pe,ue]);return M.createElement(x.Provider,{value:$},ge)}function O(he){var ge=he.children,pe=he.disabled,oe=M.useRef(null),ie=M.useRef(null),ue=M.useContext(x),$=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),re=M.isValidElement(ge)&&Object(g.c)(ge),q=re?ge.ref:null,be=M.useMemo(function(){return Object(g.a)(q,oe)},[q,oe]),Oe=M.useRef(he);Oe.current=he;var _e=M.useCallback(function(xe){var Re=Oe.current,ke=Re.onResize,De=Re.data,Le=xe.getBoundingClientRect(),Ce=Le.width,We=Le.height,Je=xe.offsetWidth,Xe=xe.offsetHeight,Ke=Math.floor(Ce),qe=Math.floor(We);if($.current.width!==Ke||$.current.height!==qe||$.current.offsetWidth!==Je||$.current.offsetHeight!==Xe){var Be={width:Ke,height:qe,offsetWidth:Je,offsetHeight:Xe};$.current=Be;var Ue=Je===Math.round(Ce)?Ce:Je,we=Xe===Math.round(We)?We:Xe,Ze=Object(W.a)(Object(W.a)({},Be),{},{offsetWidth:Ue,offsetHeight:we});ue==null||ue(Ze,xe,De),ke&&Promise.resolve().then(function(){ke(Ze,xe)})}},[]);return M.useEffect(function(){var xe=Object(p.a)(oe.current)||Object(p.a)(ie.current);return xe&&!pe&&l(xe,_e),function(){return h(xe,_e)}},[oe.current,pe]),M.createElement(A,{ref:ie},re?M.cloneElement(ge,{ref:be}):ge)}var S="rc-observer-key";function E(he){var ge=he.children,pe=Object(k.a)(ge);return pe.map(function(oe,ie){var ue=(oe==null?void 0:oe.key)||"".concat(S,"-").concat(ie);return M.createElement(O,Object(ae.a)({},he,{key:ue}),oe)})}E.Collection=T;var w=E,b=ne("bT9E"),c=ne("TSYQ"),y=ne.n(c),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
|
|
`,_=["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={},I;function B(he){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=he.getAttribute("id")||he.getAttribute("data-reactid")||he.getAttribute("name");if(ge&&P[pe])return P[pe];var oe=window.getComputedStyle(he),ie=oe.getPropertyValue("box-sizing")||oe.getPropertyValue("-moz-box-sizing")||oe.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(oe.getPropertyValue("padding-bottom"))+parseFloat(oe.getPropertyValue("padding-top")),$=parseFloat(oe.getPropertyValue("border-bottom-width"))+parseFloat(oe.getPropertyValue("border-top-width")),re=_.map(function(be){return"".concat(be,":").concat(oe.getPropertyValue(be))}).join(";"),q={sizingStyle:re,paddingSize:ue,borderSize:$,boxSizing:ie};return ge&&pe&&(P[pe]=q),q}function U(he){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,oe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;I||(I=document.createElement("textarea"),I.setAttribute("tab-index","-1"),I.setAttribute("aria-hidden","true"),document.body.appendChild(I)),he.getAttribute("wrap")?I.setAttribute("wrap",he.getAttribute("wrap")):I.removeAttribute("wrap");var ie=B(he,ge),ue=ie.paddingSize,$=ie.borderSize,re=ie.boxSizing,q=ie.sizingStyle;I.setAttribute("style","".concat(q,";").concat(m)),I.value=he.value||he.placeholder||"";var be=Number.MIN_SAFE_INTEGER,Oe=Number.MAX_SAFE_INTEGER,_e=I.scrollHeight,xe;if(re==="border-box"?_e+=$:re==="content-box"&&(_e-=ue),pe!==null||oe!==null){I.value=" ";var Re=I.scrollHeight-ue;pe!==null&&(be=Re*pe,re==="border-box"&&(be=be+ue+$),_e=Math.max(be,_e)),oe!==null&&(Oe=Re*oe,re==="border-box"&&(Oe=Oe+ue+$),xe=_e>Oe?"":"hidden",_e=Math.min(Oe,_e))}return{height:_e,minHeight:be,maxHeight:Oe,overflowY:xe,resize:"none"}}var C=ne("Gytx"),v=ne.n(C),j;(function(he){he[he.NONE=0]="NONE",he[he.RESIZING=1]="RESIZING",he[he.RESIZED=2]="RESIZED"})(j||(j={}));var G=function(he){Object(z.a)(pe,he);var ge=Object(N.a)(pe);function pe(oe){var ie;return Object(V.a)(this,pe),ie=ge.call(this,oe),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(ue){ie.textArea=ue},ie.handleResize=function(ue){var $=ie.state.resizeStatus,re=ie.props,q=re.autoSize,be=re.onResize;if($!==j.NONE)return;typeof be=="function"&&be(ue),q&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var ue=ie.props.autoSize;if(!ue||!ie.textArea)return;var $=ue.minRows,re=ue.maxRows,q=U(ie.textArea,!1,$,re);ie.setState({textareaStyles:q,resizeStatus:j.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:j.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:j.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var ue=ie.props,$=ue.prefixCls,re=$===void 0?"rc-textarea":$,q=ue.autoSize,be=ue.onResize,Oe=ue.className,_e=ue.disabled,xe=ie.state,Re=xe.textareaStyles,ke=xe.resizeStatus,De=Object(b.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Le=y()(re,Oe,Object(F.a)({},"".concat(re,"-disabled"),_e));"value"in De&&(De.value=De.value||"");var Ce=Object(W.a)(Object(W.a)(Object(W.a)({},ie.props.style),Re),ke===j.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(w,{onResize:ie.handleResize,disabled:!(q||be)},M.createElement("textarea",Object(ae.a)({},De,{className:Le,style:Ce,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:j.NONE},ie}return Object(D.a)(pe,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!v()(ie.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 ie=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,ue)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),pe}(M.Component),J=G,ee=function(he){Object(z.a)(pe,he);var ge=Object(N.a)(pe);function pe(oe){var ie;Object(V.a)(this,pe),ie=ge.call(this,oe),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function($){ie.resizableTextArea=$},ie.handleChange=function($){var re=ie.props.onChange;ie.setValue($.target.value,function(){ie.resizableTextArea.resizeTextarea()}),re&&re($)},ie.handleKeyDown=function($){var re=ie.props,q=re.onPressEnter,be=re.onKeyDown;$.keyCode===13&&q&&q($),be&&be($)};var ue=typeof oe.value=="undefined"||oe.value===null?oe.defaultValue:oe.value;return ie.state={value:ue},ie}return Object(D.a)(pe,[{key:"setValue",value:function(ie,ue){"value"in this.props||this.setState({value:ie},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(J,Object(ae.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),pe}(M.Component),ye=Qe.default=ee},ZW9T:function(ut,Qe,ne){"use strict";ne.d(Qe,"a",function(){return U});var ae=ne("k1fw"),V=ne("miYZ"),D=ne("tsqr"),z=ne("rAM+"),N=ne("tJVT"),M=ne("PpiC"),W=ne("cDcd"),F=ne.n(W),k=ne("bdgK"),R=ne("oBTY"),g=ne("9og8"),p=ne("WmNS"),f=ne.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"]},s={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"]},u={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(`
|
|
`)}]},a=ne("5VLF"),l=ne.n(a),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"]}},A=function(v,j){return j.map(function(G){return{label:G,kind:v.languages.CompletionItemKind.Keyword,insertText:G}})},x=function(v){return Object.keys(h.tables).map(function(j){return{label:j,kind:v.languages.CompletionItemKind.Variable,insertText:j}})},T=function(v,j){var G=h.tables[v];return G?G.map(function(J){return{label:J,kind:j.languages.CompletionItemKind.Field,insertText:J}}):[]};function O(C,v,j,G,J){var ee=v.getWordUntilPosition(j),ye={startLineNumber:j.lineNumber,endLineNumber:j.lineNumber,startColumn:ee.startColumn,endColumn:ee.endColumn},he=G.map(function(ge){return{label:ge,kind:C.languages.CompletionItemKind.Keyword,insertText:ge,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ye}});return J.map(function(ge){he.push(Object(ae.a)(Object(ae.a)({},ge),{},{range:ye}))}),he}var S=function(C){h.languages.map(function(J){return C.languages.registerDocumentFormattingEditProvider(J,{provideDocumentFormattingEdits:function(ye,he,ge){return Object(g.a)(f.a.mark(function pe(){var oe;return f.a.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:return oe=l()(ye.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}),ue.abrupt("return",[{range:ye.getFullModelRange(),text:oe}]);case 2:case"end":return ue.stop()}},pe)}))()}}),J});var v=u.quickKey.map(function(J){return{label:J.label,kind:C.languages.CompletionItemKind.Method,insertText:J.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),j=o.quickKey.map(function(J){return{label:J.label,kind:C.languages.CompletionItemKind.Method,insertText:J.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),G=s.quickKey.map(function(J){return{label:J.label,kind:C.languages.CompletionItemKind.Method,insertText:J.content,insertTextRules:C.languages.CompletionItemInsertTextRule.InsertAsSnippet}});C.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(R.a)(u.keywords),Object(R.a)(u.quickKey.map(function(J){return J.label}))),provideCompletionItems:function(ee,ye){var he=ee.getValueInRange({startLineNumber:ye.lineNumber,startColumn:1,endLineNumber:ye.lineNumber,endColumn:ye.column}),ge=he.match(/cu/gim);console.log("match:",ge,ye,he,ee);var pe=[],oe=ye.lineNumber,ie=ye.column,ue=ee.getValueInRange({startLineNumber:oe,startColumn:0,endLineNumber:oe,endColumn:ie}),$=ue.trim().split(/\s+/),re=$[$.length-1];if(re.endsWith(".")){var q=re.slice(0,re.length-1);Object.keys(h.tables).includes(q)&&(pe=Object(R.a)(T(q,C)))}else re==="."?pe=[]:pe=[].concat(Object(R.a)(x(C)),Object(R.a)(A(C,u.keywords)),Object(R.a)(v));return{suggestions:pe}}}),C.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(R.a)(d.keywords)),provideCompletionItems:function(ee,ye){var he=ee.getValueInRange({startLineNumber:ye.lineNumber,startColumn:1,endLineNumber:ye.lineNumber,endColumn:ye.column}),ge=he.match(/cu/gim);console.log("match:",ge,ye,he,ee);var pe=[],oe=ye.lineNumber,ie=ye.column,ue=ee.getValueInRange({startLineNumber:oe,startColumn:0,endLineNumber:oe,endColumn:ie}),$=ue.trim().split(/\s+/),re=$[$.length-1];if(re.endsWith(".")){var q=re.slice(0,re.length-1);Object.keys(h.tables).includes(q)&&(pe=Object(R.a)(T(q,C)))}else re==="."?pe=[]:pe=[].concat(Object(R.a)(x(C)),Object(R.a)(A(C,d.keywords)));return{suggestions:pe}}}),C.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(R.a)(s.keywords)),provideCompletionItems:function(ee,ye){var he=[],ge=ye.lineNumber,pe=ye.column,oe=ee.getValueInRange({startLineNumber:ge,startColumn:0,endLineNumber:ge,endColumn:pe}),ie=oe.trim().split(/\s+/),ue=ie[ie.length-1];if(ue.endsWith(".")){var $=ue.slice(0,ue.length-1);Object.keys(h.tables).includes($)&&(he=Object(R.a)(T($,C)))}else ue==="."?he=[]:he=[].concat(Object(R.a)(x(C)),Object(R.a)(A(C,s.keywords)),Object(R.a)(G));return{suggestions:he}}}),C.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(R.a)(o.keywords)),provideCompletionItems:function(ee,ye){var he=[],ge=ye.lineNumber,pe=ye.column,oe=ee.getValueInRange({startLineNumber:ge,startColumn:0,endLineNumber:ge,endColumn:pe}),ie=oe.trim().split(/\s+/),ue=ie[ie.length-1];if(ue.endsWith(".")){var $=ue.slice(0,ue.length-1);Object.keys(h.tables).includes($)&&(he=Object(R.a)(T($,C)))}else ue==="."?he=[]:he=[].concat(Object(R.a)(x(C)),Object(R.a)(A(C,o.keywords)),Object(R.a)(j));return{suggestions:he}}})},E="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",w=ne("LvDl"),b=ne("+ua5");function c(C){return/^\d+$/.test(C)?"".concat(C,"px"):C}function y(){}var m=!1,_={"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 C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=C;if(Array.isArray(C)){for(var j=0;j<C.length;j++){var G=_[C[j]];if(G)return G}return v[0]}return _[v]||v}var I=null,B=Qe.b=function(C){var v=C.width,j=v===void 0?"100%":v,G=C.height,J=G===void 0?"100%":G,ee=C.value,ye=C.language,he=ye===void 0?"javascript":ye,ge=C.style,pe=ge===void 0?{}:ge,oe=C.options,ie=oe===void 0?{}:oe,ue=C.overrideServices,$=ue===void 0?{}:ue,re=C.theme,q=re===void 0?"vs-dark":re,be=C.onEditBlur,Oe=C.onSave,_e=C.autoHeight,xe=_e===void 0?!1:_e,Re=C.forbidCopy,ke=Re===void 0?!1:Re,De=C.onChange,Le=De===void 0?y:De,Ce=C.editorDidMount,We=Ce===void 0?y:Ce,Je=C.onFocus,Xe=Je===void 0?y:Je,Ke=C.filename,qe=Ke===void 0?"educoder.txt":Ke,Be=C.errorLine,Ue=C.errorContent,we=Ue===void 0?"":Ue,Ze=Object(M.a)(C,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Ve=Object(W.useRef)(),Se=Object(W.useRef)({}),Ne=Object(W.useRef)(),ve=Object(W.useRef)(!1),ce=Object(W.useRef)(),fe=Object(W.useState)(!1),Q=Object(N.a)(fe,2),Z=Q[0],te=Q[1];function le(){var pt;return Ve.current&&(pt=new k.default(function(st){var wt=Object(z.a)(st),Dt;try{for(wt.s();!(Dt=wt.n()).done;){var jt=Dt.value;(jt.target.offsetHeight>0||jt.target.offsetWidth>0)&&Se.current.instance.layout()}}catch(gn){wt.e(gn)}finally{wt.f()}}),pt.observe(Ve.current)),pt}function me(){D.b.warn(decodeURIComponent(E))}var Ae=function(){var st=Se.current.instance;if(ee!=null&&st&&Z){var wt=st.getModel();wt&&ee!==wt.getValue()&&(m=!0,wt.setValue(ee),st.layout(),m=!1)}};Object(W.useEffect)(function(){Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(function(){Ae()},500)},[ee,Z,Se.current]),Object(W.useEffect)(function(){if(Be&&Se.current&&Se.current.instance){var pt=Se.current.instance;pt.changeViewZones(function(wt){var Dt=document.createElement("div");Dt.style.padding="10px 20px",Dt.style.width="calc(100% - 20px)",Dt.className="my-error-line-wrp",Dt.innerHTML=we,wt.addZone({afterLineNumber:Be||11,heightInLines:3,domNode:Dt})});var st={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}};pt.addOverlayWidget(st),pt.revealPositionInCenter({lineNumber:20,column:1})}},[Be,Se.current,Z]);function Me(){var pt=Se.current.instance;if(pt){var st=pt.getSelection(),wt=Se.current.pastePos||{},Dt=new I.Range(wt.startLineNumber||st.endLineNumber,wt.startColumn||st.endColumn,wt.endLineNumber||st.endLineNumber,wt.endColumn||st.endColumn);setTimeout(function(){pt.executeEdits("",[{range:Dt,text:""}])},300)}}function ze(pt){(window.navigator.platform.match("Mac")?pt.metaKey:pt.ctrlKey)&&pt.keyCode==83&&(pt.preventDefault(),Oe())}var nt=function(){if(xe&&Se.current.instance){var st=Se.current.instance.getContentHeight();en(st<J?J:st)}else en(J)};function tt(pt){var st=document.createEvent("MouseEvents");st.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),pt.dispatchEvent(st)}function xt(pt,st){var wt=window.URL||window.webkitURL||window,Dt=new Blob([st]),jt=document.createElementNS("http://www.w3.org/1999/xhtml","a");jt.href=wt.createObjectURL(Dt),jt.download=pt,tt(jt)}Object(W.useEffect)(function(){nt()},[nt]),Object(W.useEffect)(function(){Ve.current&&!Z&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(pt){try{I=pt,Se.current.instance=I.editor.create(Ve.current,{value:ee,language:P(he),theme:q,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},$);var st=Se.current.instance;if(We(st,I),setTimeout(function(){nt(),Se.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){xt(qe||"educoder.txt",st.getValue())}})},500),Se.current.subscription=st.onDidChangeModelContent(function(Dt){ve.current?clearTimeout(ce.current):(nt(),Le(st.getValue(),Dt)),ce.current=setTimeout(function(){ve.current=!1},500)}),window.Monaco||S(I),ke&&(st.addCommand(I.KeyMod.CtrlCmd|I.KeyMod.Shift|I.KeyCode.KEY_V,function(){return me(),null}),st.addCommand(I.KeyMod.CtrlCmd|I.KeyCode.KEY_C,function(){return me(),null})),window.Monaco=I,be&&st.onDidBlurEditorWidget(function(){be(st.getValue())}),Xe&&st.onDidFocusEditorText(function(){Xe(st.getValue())}),ke){st.addCommand(I.KeyMod.CtrlCmd|I.KeyCode.KEY_V,function(){return me(),null}),st.onDidPaste(function(Dt){Se.current.pastePos=Dt});try{window.addEventListener("paste",Me)}catch(Dt){}}var wt=le();return te(!0),function(){var Dt=Se.current.instance;Dt.dispose();var jt=Dt.getModel();jt&&jt.dispose(),Se.current.subscription&&Se.current.subscription.dispose(),ke&&window.removeEventListener("paste",Me),wt.unobserve(Ve.current)}}catch(Dt){}})},[]),Object(W.useEffect)(function(){var pt=Se.current.instance;if(pt&&Z)return document.addEventListener("keydown",ze,!1),function(){document.removeEventListener("keydown",ze)}},[Oe,Z]),Object(W.useEffect)(function(){var pt=Se.current.instance;if(pt&&Z){var st=P(he);I.editor.setModelLanguage(pt.getModel(),st),console.log("language:",he,pt.getModel(),st)}},[he,Z]),Object(W.useEffect)(function(){var pt=Se.current.instance;pt&&Z&&I.editor.setTheme(q)},[q,Z]),Object(W.useEffect)(function(){var pt=Se.current.instance;pt&&Z&&(pt.updateOptions(Object(ae.a)({},ie)),setTimeout(function(){pt.getModel().updateOptions(Object(ae.a)({},ie))},200))},[JSON.stringify(ie),Z]),Object(W.useEffect)(function(){var pt=Se.current.instance;pt&&Z&&pt.layout()},[j,J,Z]);var ft=Object(W.useState)(c(j)),it=Object(N.a)(ft,2),Ot=it[0],at=it[1],yt=Object(W.useState)(c(J)),bt=Object(N.a)(yt,2),Ge=bt[0],en=bt[1],tn=Object(ae.a)(Object(ae.a)({},pe),{},{width:Ot,height:Ge});return F.a.createElement("div",{className:"my-monaco-editor",ref:Ve,style:tn})};function U(C){var v=C.width,j=v===void 0?"100%":v,G=C.height,J=G===void 0?"100%":G,ee=C.original,ye=C.modified,he=C.language,ge=C.options,pe=ge===void 0?{}:ge,oe=Object(W.useRef)(),ie=Object(W.useState)(null),ue=Object(N.a)(ie,2),$=ue[0],re=ue[1];function q(xe){var Re;return oe.current&&(Re=new k.default(function(ke){var De=Object(z.a)(ke),Le;try{for(De.s();!(Le=De.n()).done;){var Ce=Le.value;(Ce.target.offsetHeight>0||Ce.target.offsetWidth>0)&&xe.layout()}}catch(We){De.e(We)}finally{De.f()}}),Re.observe(oe.current)),Re}Object(W.useEffect)(function(){oe.current&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(xe){I=xe;var Re=I.editor.createDiffEditor(oe.current,Object(ae.a)(Object(ae.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},pe),{},{wordWrap:!0}));re(Re);var ke=q(Re);return function(){Re.dispose();var De=Re.getModel();De&&De.dispose(),ke.unobserve(oe.current)}})},[]),Object(W.useEffect)(function(){$&&$.setModel({original:I.editor.createModel(ee,he),modified:I.editor.createModel(ye,he)})},[ee,ye,he,$]);var be=c(j),Oe=c(J),_e={width:be,height:Oe};return F.a.createElement("div",{className:"my-diff-editor",ref:oe,style:_e})}},ZpRC:function(ut,Qe,ne){"use strict";function ae(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function V(g,p){return(!p||g!=="hidden")&&g!=="visible"&&g!=="clip"}function D(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 s=function(u){if(!u.ownerDocument||!u.ownerDocument.defaultView)return null;try{return u.ownerDocument.defaultView.frameElement}catch(o){return null}}(d);return!!s&&(s.clientHeight<d.scrollHeight||s.clientWidth<d.scrollWidth)}(g)}return!1}function z(g,p,f,d,s,u,o,a){return u<g&&o>p||u>g&&o<p?0:u<=g&&a<=f||o>=p&&a>=f?u-g-d:o>p&&a<f||u<g&&a>f?o-p+s:0}var N=function(g,p){var f=window,d=p.scrollMode,s=p.block,u=p.inline,o=p.boundary,a=p.skipOverflowHiddenElements,l=typeof o=="function"?o:function(Re){return Re!==o};if(!ae(g))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,A=[],x=g;ae(x)&&l(x);){if((x=x.parentElement)===h){A.push(x);break}x!=null&&x===document.body&&D(x)&&!D(document.documentElement)||x!=null&&D(x,a)&&A.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,w=g.getBoundingClientRect(),b=w.height,c=w.width,y=w.top,m=w.right,_=w.bottom,P=w.left,I=s==="start"||s==="nearest"?y:s==="end"?_:y+b/2,B=u==="center"?P+c/2:u==="end"?m:P,U=[],C=0;C<A.length;C++){var v=A[C],j=v.getBoundingClientRect(),G=j.height,J=j.width,ee=j.top,ye=j.right,he=j.bottom,ge=j.left;if(d==="if-needed"&&y>=0&&P>=0&&_<=O&&m<=T&&y>=ee&&_<=he&&P>=ge&&m<=ye)return U;var pe=getComputedStyle(v),oe=parseInt(pe.borderLeftWidth,10),ie=parseInt(pe.borderTopWidth,10),ue=parseInt(pe.borderRightWidth,10),$=parseInt(pe.borderBottomWidth,10),re=0,q=0,be="offsetWidth"in v?v.offsetWidth-v.clientWidth-oe-ue:0,Oe="offsetHeight"in v?v.offsetHeight-v.clientHeight-ie-$:0;if(h===v)re=s==="start"?I:s==="end"?I-O:s==="nearest"?z(E,E+O,O,ie,$,E+I,E+I+b,b):I-O/2,q=u==="start"?B:u==="center"?B-T/2:u==="end"?B-T:z(S,S+T,T,oe,ue,S+B,S+B+c,c),re=Math.max(0,re+E),q=Math.max(0,q+S);else{re=s==="start"?I-ee-ie:s==="end"?I-he+$+Oe:s==="nearest"?z(ee,he,G,ie,$+Oe,I,I+b,b):I-(ee+G/2)+Oe/2,q=u==="start"?B-ge-oe:u==="center"?B-(ge+J/2)+be/2:u==="end"?B-ye+ue+be:z(ge,ye,J,oe,ue+be,B,B+c,c);var _e=v.scrollLeft,xe=v.scrollTop;I+=xe-(re=Math.max(0,Math.min(xe+re,v.scrollHeight-G+Oe))),B+=_e-(q=Math.max(0,Math.min(_e+q,v.scrollWidth-J+be)))}U.push({el:v,top:re,left:q})}return U};function M(g){return g===Object(g)&&Object.keys(g).length!==0}function W(g,p){p===void 0&&(p="auto");var f="scrollBehavior"in document.body.style;g.forEach(function(d){var s=d.el,u=d.top,o=d.left;s.scroll&&f?s.scroll({top:u,left:o,behavior:p}):(s.scrollTop=u,s.scrollLeft=o)})}function F(g){return g===!1?{block:"end",inline:"nearest"}:M(g)?g:{block:"start",inline:"nearest"}}function k(g,p){var f=!g.ownerDocument.documentElement.contains(g);if(M(p)&&typeof p.behavior=="function")return p.behavior(f?[]:N(g,p));if(f)return;var d=F(p);return W(N(g,d),d.behavior)}var R=Qe.a=k},Zss7:function(ut,Qe,ne){var ae;(function(V){var D=/^\s+/,z=/\s+$/,N=0,M=V.round,W=V.min,F=V.max,k=V.random;function R($,re){if($=$||"",re=re||{},$ instanceof R)return $;if(!(this instanceof R))return new R($,re);var q=g($);this._originalInput=$,this._r=q.r,this._g=q.g,this._b=q.b,this._a=q.a,this._roundA=M(100*this._a)/100,this._format=re.format||q.format,this._gradientType=re.gradientType,this._r<1&&(this._r=M(this._r)),this._g<1&&(this._g=M(this._g)),this._b<1&&(this._b=M(this._b)),this._ok=q.ok,this._tc_id=N++}R.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var $=this.toRgb();return($.r*299+$.g*587+$.b*114)/1e3},getLuminance:function(){var $=this.toRgb(),re,q,be,Oe,_e,xe;return re=$.r/255,q=$.g/255,be=$.b/255,re<=.03928?Oe=re/12.92:Oe=V.pow((re+.055)/1.055,2.4),q<=.03928?_e=q/12.92:_e=V.pow((q+.055)/1.055,2.4),be<=.03928?xe=be/12.92:xe=V.pow((be+.055)/1.055,2.4),.2126*Oe+.7152*_e+.0722*xe},setAlpha:function($){return this._a=U($),this._roundA=M(100*this._a)/100,this},toHsv:function(){var $=s(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=s(this._r,this._g,this._b),re=M($.h*360),q=M($.s*100),be=M($.v*100);return this._a==1?"hsv("+re+", "+q+"%, "+be+"%)":"hsva("+re+", "+q+"%, "+be+"%, "+this._roundA+")"},toHsl:function(){var $=f(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=f(this._r,this._g,this._b),re=M($.h*360),q=M($.s*100),be=M($.l*100);return this._a==1?"hsl("+re+", "+q+"%, "+be+"%)":"hsla("+re+", "+q+"%, "+be+"%, "+this._roundA+")"},toHex:function($){return o(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return a(this._r,this._g,this._b,this._a,$)},toHex8String:function($){return"#"+this.toHex8($)},toRgb:function(){return{r:M(this._r),g:M(this._g),b:M(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+M(this._r)+", "+M(this._g)+", "+M(this._b)+")":"rgba("+M(this._r)+", "+M(this._g)+", "+M(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:M(C(this._r,255)*100)+"%",g:M(C(this._g,255)*100)+"%",b:M(C(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+M(C(this._r,255)*100)+"%, "+M(C(this._g,255)*100)+"%, "+M(C(this._b,255)*100)+"%)":"rgba("+M(C(this._r,255)*100)+"%, "+M(C(this._g,255)*100)+"%, "+M(C(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:I[o(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var re="#"+l(this._r,this._g,this._b,this._a),q=re,be=this._gradientType?"GradientType = 1, ":"";if($){var Oe=R($);q="#"+l(Oe._r,Oe._g,Oe._b,Oe._a)}return"progid:DXImageTransform.Microsoft.gradient("+be+"startColorstr="+re+",endColorstr="+q+")"},toString:function($){var re=!!$;$=$||this._format;var q=!1,be=this._a<1&&this._a>=0,Oe=!re&&be&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Oe?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(q=this.toRgbString()),$==="prgb"&&(q=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(q=this.toHexString()),$==="hex3"&&(q=this.toHexString(!0)),$==="hex4"&&(q=this.toHex8String(!0)),$==="hex8"&&(q=this.toHex8String()),$==="name"&&(q=this.toName()),$==="hsl"&&(q=this.toHslString()),$==="hsv"&&(q=this.toHsvString()),q||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function($,re){var q=$.apply(null,[this].concat([].slice.call(re)));return this._r=q._r,this._g=q._g,this._b=q._b,this.setAlpha(q._a),this},lighten:function(){return this._applyModification(T,arguments)},brighten:function(){return this._applyModification(O,arguments)},darken:function(){return this._applyModification(S,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(A,arguments)},greyscale:function(){return this._applyModification(x,arguments)},spin:function(){return this._applyModification(E,arguments)},_applyCombination:function($,re){return $.apply(null,[this].concat([].slice.call(re)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(w,arguments)},monochromatic:function(){return this._applyCombination(_,arguments)},splitcomplement:function(){return this._applyCombination(y,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(c,arguments)}},R.fromRatio=function($,re){if(typeof $=="object"){var q={};for(var be in $)$.hasOwnProperty(be)&&(be==="a"?q[be]=$[be]:q[be]=ye($[be]));$=q}return R($,re)};function g($){var re={r:0,g:0,b:0},q=1,be=null,Oe=null,_e=null,xe=!1,Re=!1;return typeof $=="string"&&($=ie($)),typeof $=="object"&&(oe($.r)&&oe($.g)&&oe($.b)?(re=p($.r,$.g,$.b),xe=!0,Re=String($.r).substr(-1)==="%"?"prgb":"rgb"):oe($.h)&&oe($.s)&&oe($.v)?(be=ye($.s),Oe=ye($.v),re=u($.h,be,Oe),xe=!0,Re="hsv"):oe($.h)&&oe($.s)&&oe($.l)&&(be=ye($.s),_e=ye($.l),re=d($.h,be,_e),xe=!0,Re="hsl"),$.hasOwnProperty("a")&&(q=$.a)),q=U(q),{ok:xe,format:$.format||Re,r:W(255,F(re.r,0)),g:W(255,F(re.g,0)),b:W(255,F(re.b,0)),a:q}}function p($,re,q){return{r:C($,255)*255,g:C(re,255)*255,b:C(q,255)*255}}function f($,re,q){$=C($,255),re=C(re,255),q=C(q,255);var be=F($,re,q),Oe=W($,re,q),_e,xe,Re=(be+Oe)/2;if(be==Oe)_e=xe=0;else{var ke=be-Oe;xe=Re>.5?ke/(2-be-Oe):ke/(be+Oe);switch(be){case $:_e=(re-q)/ke+(re<q?6:0);break;case re:_e=(q-$)/ke+2;break;case q:_e=($-re)/ke+4;break}_e/=6}return{h:_e,s:xe,l:Re}}function d($,re,q){var be,Oe,_e;$=C($,360),re=C(re,100),q=C(q,100);function xe(De,Le,Ce){return Ce<0&&(Ce+=1),Ce>1&&(Ce-=1),Ce<1/6?De+(Le-De)*6*Ce:Ce<1/2?Le:Ce<2/3?De+(Le-De)*(2/3-Ce)*6:De}if(re===0)be=Oe=_e=q;else{var Re=q<.5?q*(1+re):q+re-q*re,ke=2*q-Re;be=xe(ke,Re,$+1/3),Oe=xe(ke,Re,$),_e=xe(ke,Re,$-1/3)}return{r:be*255,g:Oe*255,b:_e*255}}function s($,re,q){$=C($,255),re=C(re,255),q=C(q,255);var be=F($,re,q),Oe=W($,re,q),_e,xe,Re=be,ke=be-Oe;if(xe=be===0?0:ke/be,be==Oe)_e=0;else{switch(be){case $:_e=(re-q)/ke+(re<q?6:0);break;case re:_e=(q-$)/ke+2;break;case q:_e=($-re)/ke+4;break}_e/=6}return{h:_e,s:xe,v:Re}}function u($,re,q){$=C($,360)*6,re=C(re,100),q=C(q,100);var be=V.floor($),Oe=$-be,_e=q*(1-re),xe=q*(1-Oe*re),Re=q*(1-(1-Oe)*re),ke=be%6,De=[q,xe,_e,_e,Re,q][ke],Le=[Re,q,q,xe,_e,_e][ke],Ce=[_e,_e,Re,q,q,xe][ke];return{r:De*255,g:Le*255,b:Ce*255}}function o($,re,q,be){var Oe=[ee(M($).toString(16)),ee(M(re).toString(16)),ee(M(q).toString(16))];return be&&Oe[0].charAt(0)==Oe[0].charAt(1)&&Oe[1].charAt(0)==Oe[1].charAt(1)&&Oe[2].charAt(0)==Oe[2].charAt(1)?Oe[0].charAt(0)+Oe[1].charAt(0)+Oe[2].charAt(0):Oe.join("")}function a($,re,q,be,Oe){var _e=[ee(M($).toString(16)),ee(M(re).toString(16)),ee(M(q).toString(16)),ee(he(be))];return Oe&&_e[0].charAt(0)==_e[0].charAt(1)&&_e[1].charAt(0)==_e[1].charAt(1)&&_e[2].charAt(0)==_e[2].charAt(1)&&_e[3].charAt(0)==_e[3].charAt(1)?_e[0].charAt(0)+_e[1].charAt(0)+_e[2].charAt(0)+_e[3].charAt(0):_e.join("")}function l($,re,q,be){var Oe=[ee(he(be)),ee(M($).toString(16)),ee(M(re).toString(16)),ee(M(q).toString(16))];return Oe.join("")}R.equals=function($,re){return!$||!re?!1:R($).toRgbString()==R(re).toRgbString()},R.random=function(){return R.fromRatio({r:k(),g:k(),b:k()})};function h($,re){re=re===0?0:re||10;var q=R($).toHsl();return q.s-=re/100,q.s=v(q.s),R(q)}function A($,re){re=re===0?0:re||10;var q=R($).toHsl();return q.s+=re/100,q.s=v(q.s),R(q)}function x($){return R($).desaturate(100)}function T($,re){re=re===0?0:re||10;var q=R($).toHsl();return q.l+=re/100,q.l=v(q.l),R(q)}function O($,re){re=re===0?0:re||10;var q=R($).toRgb();return q.r=F(0,W(255,q.r-M(255*-(re/100)))),q.g=F(0,W(255,q.g-M(255*-(re/100)))),q.b=F(0,W(255,q.b-M(255*-(re/100)))),R(q)}function S($,re){re=re===0?0:re||10;var q=R($).toHsl();return q.l-=re/100,q.l=v(q.l),R(q)}function E($,re){var q=R($).toHsl(),be=(q.h+re)%360;return q.h=be<0?360+be:be,R(q)}function w($){var re=R($).toHsl();return re.h=(re.h+180)%360,R(re)}function b($){var re=R($).toHsl(),q=re.h;return[R($),R({h:(q+120)%360,s:re.s,l:re.l}),R({h:(q+240)%360,s:re.s,l:re.l})]}function c($){var re=R($).toHsl(),q=re.h;return[R($),R({h:(q+90)%360,s:re.s,l:re.l}),R({h:(q+180)%360,s:re.s,l:re.l}),R({h:(q+270)%360,s:re.s,l:re.l})]}function y($){var re=R($).toHsl(),q=re.h;return[R($),R({h:(q+72)%360,s:re.s,l:re.l}),R({h:(q+216)%360,s:re.s,l:re.l})]}function m($,re,q){re=re||6,q=q||30;var be=R($).toHsl(),Oe=360/q,_e=[R($)];for(be.h=(be.h-(Oe*re>>1)+720)%360;--re;)be.h=(be.h+Oe)%360,_e.push(R(be));return _e}function _($,re){re=re||6;for(var q=R($).toHsv(),be=q.h,Oe=q.s,_e=q.v,xe=[],Re=1/re;re--;)xe.push(R({h:be,s:Oe,v:_e})),_e=(_e+Re)%1;return xe}R.mix=function($,re,q){q=q===0?0:q||50;var be=R($).toRgb(),Oe=R(re).toRgb(),_e=q/100,xe={r:(Oe.r-be.r)*_e+be.r,g:(Oe.g-be.g)*_e+be.g,b:(Oe.b-be.b)*_e+be.b,a:(Oe.a-be.a)*_e+be.a};return R(xe)},R.readability=function($,re){var q=R($),be=R(re);return(V.max(q.getLuminance(),be.getLuminance())+.05)/(V.min(q.getLuminance(),be.getLuminance())+.05)},R.isReadable=function($,re,q){var be=R.readability($,re),Oe,_e;_e=!1,Oe=ue(q);switch(Oe.level+Oe.size){case"AAsmall":case"AAAlarge":_e=be>=4.5;break;case"AAlarge":_e=be>=3;break;case"AAAsmall":_e=be>=7;break}return _e},R.mostReadable=function($,re,q){var be=null,Oe=0,_e,xe,Re,ke;q=q||{},xe=q.includeFallbackColors,Re=q.level,ke=q.size;for(var De=0;De<re.length;De++)_e=R.readability($,re[De]),_e>Oe&&(Oe=_e,be=R(re[De]));return R.isReadable($,be,{level:Re,size:ke})||!xe?be:(q.includeFallbackColors=!1,R.mostReadable($,["#fff","#000"],q))};var P=R.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},I=R.hexNames=B(P);function B($){var re={};for(var q in $)$.hasOwnProperty(q)&&(re[$[q]]=q);return re}function U($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function C($,re){G($)&&($="100%");var q=J($);return $=W(re,F(0,parseFloat($))),q&&($=parseInt($*re,10)/100),V.abs($-re)<1e-6?1:$%re/parseFloat(re)}function v($){return W(1,F(0,$))}function j($){return parseInt($,16)}function G($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function J($){return typeof $=="string"&&$.indexOf("%")!=-1}function ee($){return $.length==1?"0"+$:""+$}function ye($){return $<=1&&($=$*100+"%"),$}function he($){return V.round(parseFloat($)*255).toString(16)}function ge($){return j($)/255}var pe=function(){var $="[-\\+]?\\d+%?",re="[-\\+]?\\d*\\.\\d+%?",q="(?:"+re+")|(?:"+$+")",be="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?",Oe="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?";return{CSS_UNIT:new RegExp(q),rgb:new RegExp("rgb"+be),rgba:new RegExp("rgba"+Oe),hsl:new RegExp("hsl"+be),hsla:new RegExp("hsla"+Oe),hsv:new RegExp("hsv"+be),hsva:new RegExp("hsva"+Oe),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function oe($){return!!pe.CSS_UNIT.exec($)}function ie($){$=$.replace(D,"").replace(z,"").toLowerCase();var re=!1;if(P[$])$=P[$],re=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var q;return(q=pe.rgb.exec($))?{r:q[1],g:q[2],b:q[3]}:(q=pe.rgba.exec($))?{r:q[1],g:q[2],b:q[3],a:q[4]}:(q=pe.hsl.exec($))?{h:q[1],s:q[2],l:q[3]}:(q=pe.hsla.exec($))?{h:q[1],s:q[2],l:q[3],a:q[4]}:(q=pe.hsv.exec($))?{h:q[1],s:q[2],v:q[3]}:(q=pe.hsva.exec($))?{h:q[1],s:q[2],v:q[3],a:q[4]}:(q=pe.hex8.exec($))?{r:j(q[1]),g:j(q[2]),b:j(q[3]),a:ge(q[4]),format:re?"name":"hex8"}:(q=pe.hex6.exec($))?{r:j(q[1]),g:j(q[2]),b:j(q[3]),format:re?"name":"hex"}:(q=pe.hex4.exec($))?{r:j(q[1]+""+q[1]),g:j(q[2]+""+q[2]),b:j(q[3]+""+q[3]),a:ge(q[4]+""+q[4]),format:re?"name":"hex8"}:(q=pe.hex3.exec($))?{r:j(q[1]+""+q[1]),g:j(q[2]+""+q[2]),b:j(q[3]+""+q[3]),format:re?"name":"hex"}:!1}function ue($){var re,q;return $=$||{level:"AA",size:"small"},re=($.level||"AA").toUpperCase(),q=($.size||"small").toLowerCase(),re!=="AA"&&re!=="AAA"&&(re="AA"),q!=="small"&&q!=="large"&&(q="small"),{level:re,size:q}}ut.exports?ut.exports=R:!(ae=function(){return R}.call(Qe,ne,Qe,ut),ae!==void 0&&(ut.exports=ae))})(Math)},bT9E:function(ut,Qe,ne){"use strict";ne.d(Qe,"a",function(){return V});var ae=ne("VTBJ");function V(D,z){var N=Object(ae.a)({},D);return Array.isArray(z)&&z.forEach(function(M){delete N[M]}),N}},c5Ni:function(ut,Qe,ne){},dejd:function(ut,Qe,ne){},dmUQ:function(ut,Qe,ne){"use strict";var ae=ne("Ff2n"),V=ne("rePB"),D=ne("1OyB"),z=ne("vuIU"),N=ne("Ji7U"),M=ne("md7G"),W=ne("foSv"),F=ne("cDcd"),k=ne.n(F),R=ne("TSYQ"),g=ne.n(R),p=ne("4IlW");function f(b,c){var y=Object.keys(b);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(b);c&&(m=m.filter(function(_){return Object.getOwnPropertyDescriptor(b,_).enumerable})),y.push.apply(y,m)}return y}function d(b){for(var c=1;c<arguments.length;c++){var y=arguments[c]!=null?arguments[c]:{};c%2?f(Object(y),!0).forEach(function(m){Object(V.a)(b,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(y)):f(Object(y)).forEach(function(m){Object.defineProperty(b,m,Object.getOwnPropertyDescriptor(y,m))})}return b}function s(b){var c=u();return function(){var m=Object(W.a)(b),_;if(c){var P=Object(W.a)(this).constructor;_=Reflect.construct(m,arguments,P)}else _=m.apply(this,arguments);return Object(M.a)(this,_)}}function u(){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(b){return!1}}function o(){}function a(b){b.preventDefault()}var l=function(c){return c.replace(/[^\w.-]+/g,"")},h=200,A=600,x=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,T=function(c){return c!=null},O=function(c,y){return y===c||typeof y=="number"&&typeof c=="number"&&isNaN(y)&&isNaN(c)},S=function(b){Object(N.a)(y,b);var c=s(y);function y(m){var _;Object(D.a)(this,y),_=c.call(this,m),_.onKeyDown=function(B){var U=_.props,C=U.onKeyDown,v=U.onPressEnter;if(B.keyCode===p.a.UP){var j=_.getRatio(B);_.up(B,j,null),_.stop()}else if(B.keyCode===p.a.DOWN){var G=_.getRatio(B);_.down(B,G,null),_.stop()}else B.keyCode===p.a.ENTER&&v&&v(B);if(_.recordCursorPosition(),_.lastKeyCode=B.keyCode,C){for(var J=arguments.length,ee=new Array(J>1?J-1:0),ye=1;ye<J;ye++)ee[ye-1]=arguments[ye];C.apply(void 0,[B].concat(ee))}},_.onKeyUp=function(B){var U=_.props.onKeyUp;if(_.stop(),_.recordCursorPosition(),U){for(var C=arguments.length,v=new Array(C>1?C-1:0),j=1;j<C;j++)v[j-1]=arguments[j];U.apply(void 0,[B].concat(v))}},_.onChange=function(B){var U=_.props.onChange;_.state.focused&&(_.inputting=!0),_.rawInput=_.props.parser(_.getValueFromEvent(B)),_.setState({inputValue:_.rawInput}),U(_.toNumber(_.rawInput))},_.onMouseUp=function(){var B=_.props.onMouseUp;_.recordCursorPosition(),B&&B.apply(void 0,arguments)},_.onFocus=function(){var B;_.setState({focused:!0}),(B=_.props).onFocus.apply(B,arguments)},_.onBlur=function(){var B=_.props.onBlur;_.inputting=!1,_.setState({focused:!1});var U=_.getCurrentValidValue(_.state.inputValue),C=_.setValue(U,o);if(B){var v=_.input.value,j=_.getInputDisplayValue({focus:!1,value:C});_.input.value=j&&Number(j),B.apply(void 0,arguments),_.input.value=v}},_.getRatio=function(B){var U=1;return B.metaKey||B.ctrlKey?U=.1:B.shiftKey&&(U=10),U},_.getFullNum=function(B){return isNaN(B)?B:/e/i.test(String(B))?Number(B).toFixed(18).replace(/\.?0+$/,""):B},_.getPrecision=function(B){if(T(_.props.precision))return _.props.precision;var U=String(B);if(U.indexOf("e-")>=0)return parseInt(U.slice(U.indexOf("e-")+2),10);var C=0;return U.indexOf(".")>=0&&(C=U.length-U.indexOf(".")-1),C},_.getInputDisplayValue=function(B){var U=B||_.state,C=U.focused,v=U.inputValue,j=U.value,G;C?G=v:G=_.toPrecisionAsStep(j),G==null&&(G="");var J=_.formatWrapper(G);return T(_.props.decimalSeparator)&&(J=J.toString().replace(".",_.props.decimalSeparator)),J},_.recordCursorPosition=function(){try{_.cursorStart=_.input.selectionStart,_.cursorEnd=_.input.selectionEnd,_.currentValue=_.input.value,_.cursorBefore=_.input.value.substring(0,_.cursorStart),_.cursorAfter=_.input.value.substring(_.cursorEnd)}catch(B){}},_.restoreByAfter=function(B){if(B===void 0)return!1;var U=_.input.value,C=U.lastIndexOf(B);if(C===-1)return!1;var v=_.cursorBefore.length;return _.lastKeyCode===p.a.DELETE&&_.cursorBefore.charAt(v-1)===B[0]?(_.fixCaret(v,v),!0):C+B.length===U.length?(_.fixCaret(C,C),!0):!1},_.partRestoreByAfter=function(B){return B===void 0?!1:Array.prototype.some.call(B,function(U,C){var v=B.substring(C);return _.restoreByAfter(v)})},_.isNotCompleteNumber=function(B){return isNaN(B)||B===""||B===null||B&&B.toString().indexOf(".")===B.toString().length-1},_.stop=function(){_.autoStepTimer&&clearTimeout(_.autoStepTimer)},_.down=function(B,U,C){_.pressingUpOrDown=!0,_.step("down",B,U,C)},_.up=function(B,U,C){_.pressingUpOrDown=!0,_.step("up",B,U,C)},_.saveInput=function(B){_.input=B};var P=m.value;P===void 0&&(P=m.defaultValue),_.state={focused:m.autoFocus};var I=_.getValidValue(_.toNumber(P));return _.state=d(d({},_.state),{},{inputValue:_.toPrecisionAsStep(I),value:I}),_}return Object(z.a)(y,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(_){var P=this.props,I=P.value,B=P.onChange,U=P.max,C=P.min,v=this.state.focused;if(_){if(!O(_.value,I)||!O(_.max,U)||!O(_.min,C)){var j=v?I:this.getValidValue(I),G;this.pressingUpOrDown?G=j:this.inputting?G=this.rawInput:G=this.toPrecisionAsStep(j),this.setState({value:j,inputValue:G})}var J="value"in this.props?I:this.state.value;"max"in this.props&&_.max!==U&&typeof J=="number"&&J>U&&B&&B(U),"min"in this.props&&_.min!==C&&typeof J=="number"&&J<C&&B&&B(C)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ee=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?ee=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(ee=this.cursorStart):ee=this.input.value.length,this.fixCaret(ee,ee)}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(ye){}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(_){var P=_;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(_){var P=_.target.value.trim().replace(/。/g,".");return T(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(_){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,B=parseFloat(_);return isNaN(B)?_:(B<P&&(B=P),B>I&&(B=I),B)}},{key:"setValue",value:function(_,P){var I=this.props.precision,B=this.isNotCompleteNumber(parseFloat(_))?null:parseFloat(_),U=this.state.value,C=U===void 0?null:U,v=this.state.inputValue,j=v===void 0?null:v,G=typeof B=="number"?B.toFixed(I):"".concat(B),J=B!==C||G!=="".concat(j);return"value"in this.props?(j=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:j},P)):this.setState({value:B,inputValue:this.toPrecisionAsStep(_)},P),J&&this.props.onChange(B),B}},{key:"getMaxPrecision",value:function(_){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,I=this.props,B=I.precision,U=I.step;if(T(B))return B;var C=this.getPrecision(P),v=this.getPrecision(U),j=this.getPrecision(_);return _?Math.max(j,C+v):C+v}},{key:"getPrecisionFactor",value:function(_){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,I=this.getMaxPrecision(_,P);return Math.pow(10,I)}},{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(_){return this.props.formatter?this.props.formatter(_):_}},{key:"toPrecisionAsStep",value:function(_){if(this.isNotCompleteNumber(_)||_==="")return _;var P=Math.abs(this.getMaxPrecision(_));return isNaN(P)?_.toString():Number(_).toFixed(P)}},{key:"toNumber",value:function(_){var P=this.props.precision,I=this.state.focused,B=_&&_.length>16&&I;return this.isNotCompleteNumber(_)||B?_:T(P)?Math.round(_*Math.pow(10,P))/Math.pow(10,P):Number(_)}},{key:"upStep",value:function(_,P){var I=this.props.step,B=this.getPrecisionFactor(_,P),U=Math.abs(this.getMaxPrecision(_,P)),C=((B*_+B*I*P)/B).toFixed(U);return this.toNumber(C)}},{key:"downStep",value:function(_,P){var I=this.props.step,B=this.getPrecisionFactor(_,P),U=Math.abs(this.getMaxPrecision(_,P)),C=((B*_-B*I*P)/B).toFixed(U);return this.toNumber(C)}},{key:"step",value:function(_,P){var I=this,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,U=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var C=this.props;if(C.disabled)return;var v=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(v))return;var j=this["".concat(_,"Step")](v,B),G=j>C.max||j<C.min;if(j>C.max?j=C.max:j<C.min&&(j=C.min),this.setValue(j,null),this.setState({focused:!0},function(){I.pressingUpOrDown=!1}),G)return;this.autoStepTimer=setTimeout(function(){I[_](P,B,!0)},U?h:A)}},{key:"fixCaret",value:function(_,P){if(_===void 0||P===void 0||!this.input||!this.input.value)return;try{var I=this.input.selectionStart,B=this.input.selectionEnd;(_!==I||P!==B)&&this.input.setSelectionRange(_,P)}catch(U){}}},{key:"render",value:function(){var _,P=this.props,I=P.prefixCls,B=P.disabled,U=P.readOnly,C=P.useTouch,v=P.autoComplete,j=P.upHandler,G=P.downHandler,J=P.className,ee=P.max,ye=P.min,he=P.style,ge=P.title,pe=P.onMouseEnter,oe=P.onMouseLeave,ie=P.onMouseOver,ue=P.onMouseOut,$=P.required,re=P.onClick,q=P.tabIndex,be=P.type,Oe=P.placeholder,_e=P.id,xe=P.inputMode,Re=P.pattern,ke=P.step,De=P.maxLength,Le=P.autoFocus,Ce=P.name,We=P.onPaste,Je=P.onInput,Xe=Object(ae.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"]),Ke=this.state,qe=Ke.value,Be=Ke.focused,Ue=g()(I,(_={},Object(V.a)(_,J,!!J),Object(V.a)(_,"".concat(I,"-disabled"),B),Object(V.a)(_,"".concat(I,"-focused"),Be),_)),we={};Object.keys(Xe).forEach(function(le){(le.substr(0,5)==="data-"||le.substr(0,5)==="aria-"||le==="role")&&(we[le]=Xe[le])});var Ze=!U&&!B,Ve=this.getInputDisplayValue(null),Se=(qe||qe===0)&&(isNaN(qe)||Number(qe)>=ee),Ne=(qe||qe===0)&&(isNaN(qe)||Number(qe)<=ye),ve=Se||B||U,ce=Ne||B||U,fe=g()("".concat(I,"-handler"),"".concat(I,"-handler-up"),Object(V.a)({},"".concat(I,"-handler-up-disabled"),ve)),Q=g()("".concat(I,"-handler"),"".concat(I,"-handler-down"),Object(V.a)({},"".concat(I,"-handler-down-disabled"),ce)),Z=C?{onTouchStart:ve?o:this.up,onTouchEnd:this.stop}:{onMouseDown:ve?o:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},te=C?{onTouchStart:ce?o:this.down,onTouchEnd:this.stop}:{onMouseDown:ce?o:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:Ue,style:he,title:ge,onMouseEnter:pe,onMouseLeave:oe,onMouseOver:ie,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(I,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Increase Value","aria-disabled":ve,className:fe}),j||k.a.createElement("span",{unselectable:"on",className:"".concat(I,"-handler-up-inner"),onClick:a})),k.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Decrease Value","aria-disabled":ce,className:Q}),G||k.a.createElement("span",{unselectable:"on",className:"".concat(I,"-handler-down-inner"),onClick:a}))),k.a.createElement("div",{className:"".concat(I,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ye,"aria-valuemax":ee,"aria-valuenow":qe,required:$,type:be,placeholder:Oe,onPaste:We,onClick:re,onMouseUp:this.onMouseUp,className:"".concat(I,"-input"),tabIndex:q,autoComplete:v,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:o,onKeyUp:Ze?this.onKeyUp:o,autoFocus:Le,maxLength:De,readOnly:U,disabled:B,max:ee,min:ye,step:ke,name:Ce,title:ge,id:_e,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ve),pattern:Re,inputMode:xe,onInput:Je},we))))}}]),y}(k.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,w=Qe.a=E},h78n:function(ut,Qe,ne){"use strict";ne.d(Qe,"a",function(){return _});var ae=ne("cDcd"),V=ne.n(ae),D=ne("TSYQ"),z=ne.n(D),N={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},M=function(B){var U=B.map(function(){return Object(ae.useRef)()}),C=Object(ae.useRef)();return Object(ae.useEffect)(function(){var v=Date.now(),j=!1;Object.keys(U).forEach(function(G){var J=U[G].current;if(!J)return;j=!0;var ee=J.style;ee.transitionDuration=".3s, .3s, .3s, .06s",C.current&&v-C.current<100&&(ee.transitionDuration="0s, 0s")}),j&&(C.current=Date.now())}),[U]};function W(){return W=Object.assign||function(I){for(var B=1;B<arguments.length;B++){var U=arguments[B];for(var C in U)Object.prototype.hasOwnProperty.call(U,C)&&(I[C]=U[C])}return I},W.apply(this,arguments)}function F(I,B){return f(I)||p(I,B)||R(I,B)||k()}function k(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R(I,B){if(!I)return;if(typeof I=="string")return g(I,B);var U=Object.prototype.toString.call(I).slice(8,-1);if(U==="Object"&&I.constructor&&(U=I.constructor.name),U==="Map"||U==="Set")return Array.from(I);if(U==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(U))return g(I,B)}function g(I,B){(B==null||B>I.length)&&(B=I.length);for(var U=0,C=new Array(B);U<B;U++)C[U]=I[U];return C}function p(I,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(I)))return;var U=[],C=!0,v=!1,j=void 0;try{for(var G=I[Symbol.iterator](),J;!(C=(J=G.next()).done)&&!(U.push(J.value),B&&U.length===B);C=!0);}catch(ee){v=!0,j=ee}finally{try{!C&&G.return!=null&&G.return()}finally{if(v)throw j}}return U}function f(I){if(Array.isArray(I))return I}function d(I,B){if(I==null)return{};var U=s(I,B),C,v;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(I);for(v=0;v<j.length;v++){if(C=j[v],B.indexOf(C)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(I,C))continue;U[C]=I[C]}}return U}function s(I,B){if(I==null)return{};var U={},C=Object.keys(I),v,j;for(j=0;j<C.length;j++){if(v=C[j],B.indexOf(v)>=0)continue;U[v]=I[v]}return U}var u=function(B){var U=B.className,C=B.percent,v=B.prefixCls,j=B.strokeColor,G=B.strokeLinecap,J=B.strokeWidth,ee=B.style,ye=B.trailColor,he=B.trailWidth,ge=B.transition,pe=d(B,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete pe.gapPosition;var oe=Array.isArray(C)?C:[C],ie=Array.isArray(j)?j:[j],ue=M(oe),$=F(ue,1),re=$[0],q=J/2,be=100-J/2,Oe="M ".concat(G==="round"?q:0,",").concat(q,`
|
|
L `).concat(G==="round"?be:100,",").concat(q),_e="0 0 100 ".concat(J),xe=0;return V.a.createElement("svg",W({className:z()("".concat(v,"-line"),U),viewBox:_e,preserveAspectRatio:"none",style:ee},pe),V.a.createElement("path",{className:"".concat(v,"-line-trail"),d:Oe,strokeLinecap:G,stroke:ye,strokeWidth:he||J,fillOpacity:"0"}),oe.map(function(Re,ke){var De={strokeDasharray:"".concat(Re,"px, 100px"),strokeDashoffset:"-".concat(xe,"px"),transition:ge||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Le=ie[ke]||ie[ie.length-1];return xe+=Re,V.a.createElement("path",{key:ke,className:"".concat(v,"-line-path"),d:Oe,strokeLinecap:G,stroke:Le,strokeWidth:J,fillOpacity:"0",ref:re[ke],style:De})}))};u.defaultProps=N;var o=u;function a(){return a=Object.assign||function(I){for(var B=1;B<arguments.length;B++){var U=arguments[B];for(var C in U)Object.prototype.hasOwnProperty.call(U,C)&&(I[C]=U[C])}return I},a.apply(this,arguments)}function l(I,B){return O(I)||T(I,B)||A(I,B)||h()}function h(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(I,B){if(!I)return;if(typeof I=="string")return x(I,B);var U=Object.prototype.toString.call(I).slice(8,-1);if(U==="Object"&&I.constructor&&(U=I.constructor.name),U==="Map"||U==="Set")return Array.from(I);if(U==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(U))return x(I,B)}function x(I,B){(B==null||B>I.length)&&(B=I.length);for(var U=0,C=new Array(B);U<B;U++)C[U]=I[U];return C}function T(I,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(I)))return;var U=[],C=!0,v=!1,j=void 0;try{for(var G=I[Symbol.iterator](),J;!(C=(J=G.next()).done)&&!(U.push(J.value),B&&U.length===B);C=!0);}catch(ee){v=!0,j=ee}finally{try{!C&&G.return!=null&&G.return()}finally{if(v)throw j}}return U}function O(I){if(Array.isArray(I))return I}function S(I,B){if(I==null)return{};var U=E(I,B),C,v;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(I);for(v=0;v<j.length;v++){if(C=j[v],B.indexOf(C)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(I,C))continue;U[C]=I[C]}}return U}function E(I,B){if(I==null)return{};var U={},C=Object.keys(I),v,j;for(j=0;j<C.length;j++){if(v=C[j],B.indexOf(v)>=0)continue;U[v]=I[v]}return U}var w=0;function b(I){return+I.replace("%","")}function c(I){return Array.isArray(I)?I:[I]}function y(I,B,U,C){var v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,j=arguments.length>5?arguments[5]:void 0,G=50-C/2,J=0,ee=-G,ye=0,he=-2*G;switch(j){case"left":J=-G,ee=0,ye=2*G,he=0;break;case"right":J=G,ee=0,ye=-2*G,he=0;break;case"bottom":ee=G,he=2*G;break;default:}var ge="M 50,50 m ".concat(J,",").concat(ee,`
|
|
a `).concat(G,",").concat(G," 0 1 1 ").concat(ye,",").concat(-he,`
|
|
a `).concat(G,",").concat(G," 0 1 1 ").concat(-ye,",").concat(he),pe=Math.PI*2*G,oe={stroke:U,strokeDasharray:"".concat(B/100*(pe-v),"px ").concat(pe,"px"),strokeDashoffset:"-".concat(v/2+I/100*(pe-v),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ge,pathStyle:oe}}var m=function(B){var U=B.prefixCls,C=B.strokeWidth,v=B.trailWidth,j=B.gapDegree,G=B.gapPosition,J=B.trailColor,ee=B.strokeLinecap,ye=B.style,he=B.className,ge=B.strokeColor,pe=B.percent,oe=S(B,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ie=Object(ae.useMemo)(function(){return w+=1,w},[]),ue=y(0,100,J,C,j,G),$=ue.pathString,re=ue.pathStyle,q=c(pe),be=c(ge),Oe=be.find(function(De){return Object.prototype.toString.call(De)==="[object Object]"}),_e=M(q),xe=l(_e,1),Re=xe[0],ke=function(){var Le=0;return q.map(function(Ce,We){var Je=be[We]||be[be.length-1],Xe=Object.prototype.toString.call(Je)==="[object Object]"?"url(#".concat(U,"-gradient-").concat(ie,")"):"",Ke=y(Le,Ce,Je,C,j,G);return Le+=Ce,V.a.createElement("path",{key:We,className:"".concat(U,"-circle-path"),d:Ke.pathString,stroke:Xe,strokeLinecap:ee,strokeWidth:C,opacity:Ce===0?0:1,fillOpacity:"0",style:Ke.pathStyle,ref:Re[We]})})};return V.a.createElement("svg",a({className:z()("".concat(U,"-circle"),he),viewBox:"0 0 100 100",style:ye},oe),Oe&&V.a.createElement("defs",null,V.a.createElement("linearGradient",{id:"".concat(U,"-gradient-").concat(ie),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Oe).sort(function(De,Le){return b(De)-b(Le)}).map(function(De,Le){return V.a.createElement("stop",{key:Le,offset:De,stopColor:Oe[De]})}))),V.a.createElement("path",{className:"".concat(U,"-circle-trail"),d:$,stroke:J,strokeLinecap:ee,strokeWidth:v||C,fillOpacity:"0",style:re}),ke().reverse())};m.defaultProps=N;var _=m,P={Line:o,Circle:_}},kSUc:function(ut,Qe,ne){},lZu9:function(ut,Qe,ne){(function(ae){ae(ne("VrN/"),ne("1eCo"),ne("8EBN"))})(function(ae){"use strict";ae.defineMode("markdown",function(V,D){var z=ae.getMode(V,"text/html"),N=z.name=="null";function M(C){if(ae.findModeByName){var v=ae.findModeByName(C);v&&(C=v.mime||v.mimes[0])}var j=ae.getMode(V,C);return j.name=="null"?null:j}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var W={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var F in W)W.hasOwnProperty(F)&&D.tokenTypeOverrides[F]&&(W[F]=D.tokenTypeOverrides[F]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,p=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,d=/^[^#!\[\]*_\\<>` "'(~:]+/,s=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,u=/^\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]/,a=" ";function l(C,v,j){return v.f=v.inline=j,j(C,v)}function h(C,v,j){return v.f=v.block=j,j(C,v)}function A(C){return!C||!/\S/.test(C.string)}function x(C){if(C.linkTitle=!1,C.linkHref=!1,C.linkText=!1,C.em=!1,C.strong=!1,C.strikethrough=!1,C.quote=0,C.indentedCode=!1,C.f==O){var v=N;if(!v){var j=ae.innerMode(z,C.htmlState);v=j.mode.name=="xml"&&j.state.tagStart===null&&!j.state.context&&j.state.tokenize.isInText}v&&(C.f=b,C.block=T,C.htmlState=null)}return C.trailingSpace=0,C.trailingSpaceNewLine=!1,C.prevLine=C.thisLine,C.thisLine={stream:null},null}function T(C,v){var j=C.column()===v.indentation,G=A(v.prevLine.stream),J=v.indentedCode,ee=v.prevLine.hr,ye=v.list!==!1,he=(v.listStack[v.listStack.length-1]||0)+3;v.indentedCode=!1;var ge=v.indentation;if(v.indentationDiff===null&&(v.indentationDiff=v.indentation,ye)){for(v.list=null;ge<v.listStack[v.listStack.length-1];)v.listStack.pop(),v.listStack.length?v.indentation=v.listStack[v.listStack.length-1]:v.list=!1;v.list!==!1&&(v.indentationDiff=ge-v.listStack[v.listStack.length-1])}var pe=!G&&!ee&&!v.prevLine.header&&(!ye||!J)&&!v.prevLine.fencedCodeEnd,oe=(v.list===!1||ee||G)&&v.indentation<=he&&C.match(k),ie=null;if(v.indentationDiff>=4&&(J||v.prevLine.fencedCodeEnd||v.prevLine.header||G))return C.skipToEnd(),v.indentedCode=!0,W.code;if(C.eatSpace())return null;if(j&&v.indentation<=he&&(ie=C.match(p))&&ie[1].length<=6)return v.quote=0,v.header=ie[1].length,v.thisLine.header=!0,D.highlightFormatting&&(v.formatting="header"),v.f=v.inline,E(v);if(v.indentation<=he&&C.eat(">"))return v.quote=j?1:v.quote+1,D.highlightFormatting&&(v.formatting="quote"),C.eatSpace(),E(v);if(!oe&&!v.setext&&j&&v.indentation<=he&&(ie=C.match(R))){var ue=ie[1]?"ol":"ul";return v.indentation=ge+C.current().length,v.list=!0,v.quote=0,v.listStack.push(v.indentation),v.em=!1,v.strong=!1,v.code=!1,v.strikethrough=!1,D.taskLists&&C.match(g,!1)&&(v.taskList=!0),v.f=v.inline,D.highlightFormatting&&(v.formatting=["list","list-"+ue]),E(v)}else{if(j&&v.indentation<=he&&(ie=C.match(s,!0)))return v.quote=0,v.fencedEndRE=new RegExp(ie[1]+"+ *$"),v.localMode=D.fencedCodeBlockHighlighting&&M(ie[2]||D.fencedCodeBlockDefaultMode),v.localMode&&(v.localState=ae.startState(v.localMode)),v.f=v.block=S,D.highlightFormatting&&(v.formatting="code-block"),v.code=-1,E(v);if(v.setext||(!pe||!ye)&&!v.quote&&v.list===!1&&!v.code&&!oe&&!u.test(C.string)&&(ie=C.lookAhead(1))&&(ie=ie.match(f)))return v.setext?(v.header=v.setext,v.setext=0,C.skipToEnd(),D.highlightFormatting&&(v.formatting="header")):(v.header=ie[0].charAt(0)=="="?1:2,v.setext=v.header),v.thisLine.header=!0,v.f=v.inline,E(v);if(oe)return C.skipToEnd(),v.hr=!0,v.thisLine.hr=!0,W.hr;if(C.peek()==="[")return l(C,v,P)}return l(C,v,v.inline)}function O(C,v){var j=z.token(C,v.htmlState);if(!N){var G=ae.innerMode(z,v.htmlState);(G.mode.name=="xml"&&G.state.tagStart===null&&!G.state.context&&G.state.tokenize.isInText||v.md_inside&&C.current().indexOf(">")>-1)&&(v.f=b,v.block=T,v.htmlState=null)}return j}function S(C,v){var j=v.listStack[v.listStack.length-1]||0,G=v.indentation<j,J=j+3;if(v.fencedEndRE&&v.indentation<=J&&(G||C.match(v.fencedEndRE))){D.highlightFormatting&&(v.formatting="code-block");var ee;return G||(ee=E(v)),v.localMode=v.localState=null,v.block=T,v.f=b,v.fencedEndRE=null,v.code=0,v.thisLine.fencedCodeEnd=!0,G?h(C,v,v.block):ee}else return v.localMode?v.localMode.token(C,v.localState):(C.skipToEnd(),W.code)}function E(C){var v=[];if(C.formatting){v.push(W.formatting),typeof C.formatting=="string"&&(C.formatting=[C.formatting]);for(var j=0;j<C.formatting.length;j++)v.push(W.formatting+"-"+C.formatting[j]),C.formatting[j]==="header"&&v.push(W.formatting+"-"+C.formatting[j]+"-"+C.header),C.formatting[j]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=C.quote?v.push(W.formatting+"-"+C.formatting[j]+"-"+C.quote):v.push("error"))}if(C.taskOpen)return v.push("meta"),v.length?v.join(" "):null;if(C.taskClosed)return v.push("property"),v.length?v.join(" "):null;if(C.linkHref?v.push(W.linkHref,"url"):(C.strong&&v.push(W.strong),C.em&&v.push(W.em),C.strikethrough&&v.push(W.strikethrough),C.emoji&&v.push(W.emoji),C.linkText&&v.push(W.linkText),C.code&&v.push(W.code),C.image&&v.push(W.image),C.imageAltText&&v.push(W.imageAltText,"link"),C.imageMarker&&v.push(W.imageMarker)),C.header&&v.push(W.header,W.header+"-"+C.header),C.quote&&(v.push(W.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=C.quote?v.push(W.quote+"-"+C.quote):v.push(W.quote+"-"+D.maxBlockquoteDepth)),C.list!==!1){var G=(C.listStack.length-1)%3;G?G===1?v.push(W.list2):v.push(W.list3):v.push(W.list1)}return C.trailingSpaceNewLine?v.push("trailing-space-new-line"):C.trailingSpace&&v.push("trailing-space-"+(C.trailingSpace%2?"a":"b")),v.length?v.join(" "):null}function w(C,v){return C.match(d,!0)?E(v):void 0}function b(C,v){var j=v.text(C,v);if(typeof j!="undefined")return j;if(v.list)return v.list=null,E(v);if(v.taskList){var G=C.match(g,!0)[1]===" ";return G?v.taskOpen=!0:v.taskClosed=!0,D.highlightFormatting&&(v.formatting="task"),v.taskList=!1,E(v)}if(v.taskOpen=!1,v.taskClosed=!1,v.header&&C.match(/^#+$/,!0))return D.highlightFormatting&&(v.formatting="header"),E(v);var J=C.next();if(v.linkTitle){v.linkTitle=!1;var ee=J;J==="("&&(ee=")"),ee=(ee+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ye="^\\s*(?:[^"+ee+"\\\\]+|\\\\\\\\|\\\\.)"+ee;if(C.match(new RegExp(ye),!0))return W.linkHref}if(J==="`"){var he=v.formatting;D.highlightFormatting&&(v.formatting="code"),C.eatWhile("`");var ge=C.current().length;if(v.code==0&&(!v.quote||ge==1))return v.code=ge,E(v);if(ge==v.code){var pe=E(v);return v.code=0,pe}else return v.formatting=he,E(v)}else if(v.code)return E(v);if(J==="\\"&&(C.next(),D.highlightFormatting)){var oe=E(v),ie=W.formatting+"-escape";return oe?oe+" "+ie:ie}if(J==="!"&&C.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return v.imageMarker=!0,v.image=!0,D.highlightFormatting&&(v.formatting="image"),E(v);if(J==="["&&v.imageMarker&&C.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return v.imageMarker=!1,v.imageAltText=!0,D.highlightFormatting&&(v.formatting="image"),E(v);if(J==="]"&&v.imageAltText){D.highlightFormatting&&(v.formatting="image");var oe=E(v);return v.imageAltText=!1,v.image=!1,v.inline=v.f=y,oe}if(J==="["&&!v.image)return v.linkText&&C.match(/^.*?\]/)||(v.linkText=!0,D.highlightFormatting&&(v.formatting="link")),E(v);if(J==="]"&&v.linkText){D.highlightFormatting&&(v.formatting="link");var oe=E(v);return v.linkText=!1,v.inline=v.f=C.match(/\(.*?\)| ?\[.*?\]/,!1)?y:b,oe}if(J==="<"&&C.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){v.f=v.inline=c,D.highlightFormatting&&(v.formatting="link");var oe=E(v);return oe?oe+=" ":oe="",oe+W.linkInline}if(J==="<"&&C.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){v.f=v.inline=c,D.highlightFormatting&&(v.formatting="link");var oe=E(v);return oe?oe+=" ":oe="",oe+W.linkEmail}if(D.xml&&J==="<"&&C.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=C.string.indexOf(">",C.pos);if(ue!=-1){var $=C.string.substring(C.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(v.md_inside=!0)}return C.backUp(1),v.htmlState=ae.startState(z),h(C,v,O)}if(D.xml&&J==="<"&&C.match(/^\/\w*?>/))return v.md_inside=!1,"tag";if(J==="*"||J==="_"){for(var re=1,q=C.pos==1?" ":C.string.charAt(C.pos-2);re<3&&C.eat(J);)re++;var be=C.peek()||" ",Oe=!/\s/.test(be)&&(!o.test(be)||/\s/.test(q)||o.test(q)),_e=!/\s/.test(q)&&(!o.test(q)||/\s/.test(be)||o.test(be)),xe=null,Re=null;if(re%2&&(!v.em&&Oe&&(J==="*"||!_e||o.test(q))?xe=!0:v.em==J&&_e&&(J==="*"||!Oe||o.test(be))&&(xe=!1)),re>1&&(!v.strong&&Oe&&(J==="*"||!_e||o.test(q))?Re=!0:v.strong==J&&_e&&(J==="*"||!Oe||o.test(be))&&(Re=!1)),Re!=null||xe!=null){D.highlightFormatting&&(v.formatting=xe==null?"strong":Re==null?"em":"strong em"),xe===!0&&(v.em=J),Re===!0&&(v.strong=J);var pe=E(v);return xe===!1&&(v.em=!1),Re===!1&&(v.strong=!1),pe}}else if(J===" "&&(C.eat("*")||C.eat("_"))){if(C.peek()===" ")return E(v);C.backUp(1)}if(D.strikethrough){if(J==="~"&&C.eatWhile(J)){if(v.strikethrough){D.highlightFormatting&&(v.formatting="strikethrough");var pe=E(v);return v.strikethrough=!1,pe}else if(C.match(/^[^\s]/,!1))return v.strikethrough=!0,D.highlightFormatting&&(v.formatting="strikethrough"),E(v)}else if(J===" "&&C.match(/^~~/,!0)){if(C.peek()===" ")return E(v);C.backUp(2)}}if(D.emoji&&J===":"&&C.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){v.emoji=!0,D.highlightFormatting&&(v.formatting="emoji");var ke=E(v);return v.emoji=!1,ke}return J===" "&&(C.match(/^ +$/,!1)?v.trailingSpace++:v.trailingSpace&&(v.trailingSpaceNewLine=!0)),E(v)}function c(C,v){var j=C.next();if(j===">"){v.f=v.inline=b,D.highlightFormatting&&(v.formatting="link");var G=E(v);return G?G+=" ":G="",G+W.linkInline}return C.match(/^[^>]+/,!0),W.linkInline}function y(C,v){if(C.eatSpace())return null;var j=C.next();return j==="("||j==="["?(v.f=v.inline=_(j==="("?")":"]"),D.highlightFormatting&&(v.formatting="link-string"),v.linkHref=!0,E(v)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function _(C){return function(v,j){var G=v.next();if(G===C){j.f=j.inline=b,D.highlightFormatting&&(j.formatting="link-string");var J=E(j);return j.linkHref=!1,J}return v.match(m[C]),j.linkHref=!0,E(j)}}function P(C,v){return C.match(/^([^\]\\]|\\.)*\]:/,!1)?(v.f=I,C.next(),D.highlightFormatting&&(v.formatting="link"),v.linkText=!0,E(v)):l(C,v,b)}function I(C,v){if(C.match(/^\]:/,!0)){v.f=v.inline=B,D.highlightFormatting&&(v.formatting="link");var j=E(v);return v.linkText=!1,j}return C.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function B(C,v){return C.eatSpace()?null:(C.match(/^[^\s]+/,!0),C.peek()===void 0?v.linkTitle=!0:C.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),v.f=v.inline=b,W.linkHref+" url")}var U={startState:function(){return{f:T,prevLine:{stream:null},thisLine:{stream:null},block:T,htmlState:null,indentation:0,inline:b,text:w,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(C){return{f:C.f,prevLine:C.prevLine,thisLine:C.thisLine,block:C.block,htmlState:C.htmlState&&ae.copyState(z,C.htmlState),indentation:C.indentation,localMode:C.localMode,localState:C.localMode?ae.copyState(C.localMode,C.localState):null,inline:C.inline,text:C.text,formatting:!1,linkText:C.linkText,linkTitle:C.linkTitle,linkHref:C.linkHref,code:C.code,em:C.em,strong:C.strong,strikethrough:C.strikethrough,emoji:C.emoji,header:C.header,setext:C.setext,hr:C.hr,taskList:C.taskList,list:C.list,listStack:C.listStack.slice(0),quote:C.quote,indentedCode:C.indentedCode,trailingSpace:C.trailingSpace,trailingSpaceNewLine:C.trailingSpaceNewLine,md_inside:C.md_inside,fencedEndRE:C.fencedEndRE}},token:function(C,v){if(v.formatting=!1,C!=v.thisLine.stream){if(v.header=0,v.hr=!1,C.match(/^\s*$/,!0))return x(v),null;if(v.prevLine=v.thisLine,v.thisLine={stream:C},v.taskList=!1,v.trailingSpace=0,v.trailingSpaceNewLine=!1,!v.localState&&(v.f=v.block,v.f!=O)){var j=C.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(v.indentation=j,v.indentationDiff=null,j>0)return null}}return v.f(C,v)},innerMode:function(C){return C.block==O?{state:C.htmlState,mode:z}:C.localState?{state:C.localState,mode:C.localMode}:{state:C,mode:U}},indent:function(C,v,j){return C.block==O&&z.indent?z.indent(C.htmlState,v,j):C.localState&&C.localMode.indent?C.localMode.indent(C.localState,v,j):ae.Pass},blankLine:x,getType:E,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return U},"xml"),ae.defineMIME("text/markdown","markdown"),ae.defineMIME("text/x-markdown","markdown")})},osHv:function(ut,Qe,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";var V=ae.Pos;function D(o,a){return o.line-a.line||o.ch-a.ch}var z="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",N=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+z+"]["+N+"]*)","g");function W(o,a,l,h){this.line=a,this.ch=l,this.cm=o,this.text=o.getLine(a),this.min=h?Math.max(h.from,o.firstLine()):o.firstLine(),this.max=h?Math.min(h.to-1,o.lastLine()):o.lastLine()}function F(o,a){var l=o.cm.getTokenTypeAt(V(o.line,a));return l&&/\btag\b/.test(l)}function k(o){return o.line>=o.max?void 0:(o.ch=0,o.text=o.cm.getLine(++o.line),!0)}function R(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 a=o.text.indexOf(">",o.ch);if(a==-1){if(k(o))continue;return}if(!F(o,a+1)){o.ch=a+1;continue}var l=o.text.lastIndexOf("/",a),h=l>-1&&!/\S/.test(o.text.slice(l+1,a));return o.ch=a+1,h?"selfClose":"regular"}}function p(o){for(;;){var a=o.ch?o.text.lastIndexOf("<",o.ch-1):-1;if(a==-1){if(R(o))continue;return}if(!F(o,a+1)){o.ch=a;continue}M.lastIndex=a,o.ch=a;var l=M.exec(o.text);if(l&&l.index==a)return l}}function f(o){for(;;){M.lastIndex=o.ch;var a=M.exec(o.text);if(!a){if(k(o))continue;return}if(!F(o,a.index+1)){o.ch=a.index+1;continue}return o.ch=a.index+a[0].length,a}}function d(o){for(;;){var a=o.ch?o.text.lastIndexOf(">",o.ch-1):-1;if(a==-1){if(R(o))continue;return}if(!F(o,a+1)){o.ch=a;continue}var l=o.text.lastIndexOf("/",a),h=l>-1&&!/\S/.test(o.text.slice(l+1,a));return o.ch=a+1,h?"selfClose":"regular"}}function s(o,a){for(var l=[];;){var h=f(o),A,x=o.line,T=o.ch-(h?h[0].length:0);if(!h||!(A=g(o)))return;if(A=="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&&(!a||a==h[2]))return{tag:h[2],from:V(x,T),to:V(o.line,o.ch)}}else l.push(h[2])}}function u(o,a){for(var l=[];;){var h=d(o);if(!h)return;if(h=="selfClose"){p(o);continue}var A=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&&(!a||a==T[2]))return{tag:T[2],from:V(o.line,o.ch),to:V(A,x)}}}}ae.registerHelper("fold","xml",function(o,a){for(var l=new W(o,a.line,0);;){var h=f(l);if(!h||l.line!=a.line)return;var A=g(l);if(!A)return;if(!h[1]&&A!="selfClose"){var x=V(l.line,l.ch),T=s(l,h[2]);return T&&D(T.from,x)>0?{from:x,to:T.from}:null}}}),ae.findMatchingTag=function(o,a,l){var h=new W(o,a.line,a.ch,l);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var A=g(h),x=A&&V(h.line,h.ch),T=A&&p(h);if(!A||!T||D(h,a)>0)return;var O={from:V(h.line,h.ch),to:x,tag:T[2]};return A=="selfClose"?{open:O,close:null,at:"open"}:T[1]?{open:u(h,T[2]),close:O,at:"close"}:(h=new W(o,x.line,x.ch,l),{open:O,close:s(h,T[2]),at:"open"})},ae.findEnclosingTag=function(o,a,l,h){for(var A=new W(o,a.line,a.ch,l);;){var x=u(A,h);if(!x)break;var T=new W(o,a.line,a.ch,l),O=s(T,x.tag);if(O)return{open:x,close:O}}},ae.scanForClosingTag=function(o,a,l,h){var A=new W(o,a.line,a.ch,h?{from:0,to:h}:null);return s(A,l)}})},p0QG:function(ut,Qe,ne){ut.exports={flex_box_center:"flex_box_center___2axlI",flex_space_between:"flex_space_between___F6m1U",flex_box_vertical_center:"flex_box_vertical_center___2GovZ",flex_box_center_end:"flex_box_center_end___2h9j0",flex_box_column:"flex_box_column___1kuIs",SubMentItem:"SubMentItem___34z-Y",MenuItem:"MenuItem___1bbPM",wrp:"wrp___3LRhb",classroomInfo:"classroomInfo___Ohxoq",title:"title___22ZLP",titleLeft:"titleLeft___1MP-h",titleRight:"titleRight___3zsz9",classroomUser:"classroomUser___1ePAN",headPic:"headPic___2lEg_",teacherInfo:"teacherInfo___3C0Dn",classroomDesc:"classroomDesc____QVZX",classroomDescBg:"classroomDescBg___1e7L7",joinCouses:"joinCouses___2G4vP",bg:"bg___2QojS",leftMenus:"leftMenus___34tjX",titleSelected:"titleSelected___K6QwW",menuText:"menuText___3qMqH",totalCount:"totalCount___R2q38",actions:"actions___26Ww0",task_count:"task_count___3UQ1V",container:"container___2EGM4",leftMenuActions:"leftMenuActions___3_J-1"}},p5ED:function(ut,Qe,ne){"use strict";var ae=ne("+L6B"),V=ne("2/Rp"),D=ne("5Dmo"),z=ne("3S7+"),N=ne("k1fw"),M=ne("tJVT"),W=ne("cDcd"),F=ne.n(W),k=ne("vHTk"),R=ne.n(k),g=ne("yEEn"),p=ne("ZW9T"),f=ne("1vsH");Qe.a=function(d){var s=d.name,u=d.data,o=d.theme,a=d.type,l=d.filename,h=d.monacoEditor,A=d.className,x=d.style,T=d.close,O=d.onClose,S=d.hasMask,E=Object(W.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),w=Object(M.a)(E,2),b=w[0],c=w[1],y=Object(W.useState)(""),m=Object(M.a)(y,2),_=m[0],P=m[1],I,B=1024*1024,U=10*B,C=Object(W.useRef)();a==="office"&&(I=Object(f.V)(u).filesize,I>U&&(a="other")),l&&(h.filename=l),Object(W.useEffect)(function(){var G,J,ee=(G=document.cookie)===null||G===void 0||((J=G.replace(/\s/g,""))===null||J===void 0)?void 0:J.split(";");ee==null||ee.map(function(ye){var he=ye.split("=");he[0]==="_educoder_session"&&P(he[1])})},[]);var v=function(){if(u.startsWith("http")||u.startsWith("/")){j();return}Object(f.z)(l||"educoder",u,l)},j=function(){Object(f.x)(l||s,u)};return console.log("data:",u,"fileanme:",l," name:",s),F.a.createElement("div",{style:Object(N.a)({},x||{}),className:"".concat(S&&R.a.bgBlack," ").concat(a?R.a.wrp:"hide")},T&&F.a.createElement("div",{className:R.a.close,ref:C},F.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return C.current}},F.a.createElement("span",{onClick:j},F.a.createElement("i",{className:"icon-quxiaozhiding"}))),F.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return C.current}},F.a.createElement("span",{className:"",onClick:O},F.a.createElement("i",{className:"icon-guanbi1"})))),F.a.createElement("div",{className:"".concat(R.a[A]," ").concat(A," ").concat(R.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&F.a.createElement(p.b,h)),a==="audio"&&F.a.createElement("audio",{src:"".concat(u!=null&&u.startsWith("/")||(u==null?void 0:u.indexOf("https://"))>-1?u:"data:audio/mp3;base64,").concat(u),autoPlay:!0}),a==="video"&&F.a.createElement(F.a.Fragment,null,u!=null&&u.startsWith("/")?F.a.createElement("video",{controls:!0,src:"".concat(u),autoPlay:!0}):F.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(u),autoPlay:!0})),a==="html"&&F.a.createElement("iframe",{src:u+"&disposition=inline"}),a==="pdf"&&F.a.createElement("embed",{className:R.a.embed,src:u}),a==="image"&&F.a.createElement(F.a.Fragment,null,F.a.createElement("img",{src:"".concat(u!=null&&u.startsWith("/")||(u==null?void 0:u.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(u)})),a==="other"&&F.a.createElement("div",null,F.a.createElement(V.a,{type:"primary",size:"large",onClick:v},F.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&F.a.createElement(V.a,{type:"primary",size:"large",onClick:v},F.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ut,Qe,ne){},psGv:function(ut,Qe,ne){var ae,V;(function(){var D;(function(){"use strict";var W=[,,function(g){function p(s){this.__parent=s,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 s=new p(this.__parent);return s.set_indent(this.__indent_count,this.__alignment_count),s},p.prototype.item=function(s){return s<0?this.__items[this.__items.length+s]:this.__items[s]},p.prototype.has_match=function(s){for(var u=this.__items.length-1;u>=0;u--)if(this.__items[u].match(s))return!0;return!1},p.prototype.set_indent=function(s,u){this.is_empty()&&(this.__indent_count=s||0,this.__alignment_count=u||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 s=this.__parent.current_line;return s.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),s.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),s.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,s.__items[0]===" "&&(s.__items.splice(0,1),s.__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(s){this.__items.push(s);var u=s.lastIndexOf(`
|
|
`);u!==-1?this.__character_count=s.length-u:this.__character_count+=s.length},p.prototype.pop=function(){var s=null;return this.is_empty()||(s=this.__items.pop(),this.__character_count-=s.length),s},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 s="";return this.is_empty()?this.__parent.indent_empty_lines&&(s=this.__parent.get_indent_string(this.__indent_count)):(s=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),s+=this.__items.join("")),s};function f(s,u){this.__cache=[""],this.__indent_size=s.indent_size,this.__indent_string=s.indent_char,s.indent_with_tabs||(this.__indent_string=new Array(s.indent_size+1).join(s.indent_char)),u=u||"",s.indent_level>0&&(u=new Array(s.indent_level+1).join(this.__indent_string)),this.__base_string=u,this.__base_string_length=u.length}f.prototype.get_indent_size=function(s,u){var o=this.__base_string_length;return u=u||0,s<0&&(o=0),o+=s*this.__indent_size,o+=u,o},f.prototype.get_indent_string=function(s,u){var o=this.__base_string;return u=u||0,s<0&&(s=0,o=""),u+=s*this.__indent_size,this.__ensure_cache(u),o+=this.__cache[u],o},f.prototype.__ensure_cache=function(s){for(;s>=this.__cache.length;)this.__add_column()},f.prototype.__add_column=function(){var s=this.__cache.length,u=0,o="";this.__indent_size&&s>=this.__indent_size&&(u=Math.floor(s/this.__indent_size),s-=u*this.__indent_size,o=new Array(u+1).join(this.__indent_string)),s&&(o+=new Array(s+1).join(" ")),this.__cache.push(o)};function d(s,u){this.__indent_cache=new f(s,u),this.raw=!1,this._end_with_newline=s.end_with_newline,this.indent_size=s.indent_size,this.wrap_line_length=s.wrap_line_length,this.indent_empty_lines=s.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(s,u){return this.__indent_cache.get_indent_string(s,u)},d.prototype.get_indent_size=function(s,u){return this.__indent_cache.get_indent_size(s,u)},d.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},d.prototype.add_new_line=function(s){return this.is_empty()||!s&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},d.prototype.get_code=function(s){this.trim(!0);var u=this.current_line.pop();u&&(u[u.length-1]===`
|
|
`&&(u=u.replace(/\n+$/g,"")),this.current_line.push(u)),this._end_with_newline&&this.__add_outputline();var o=this.__lines.join(`
|
|
`);return s!==`
|
|
`&&(o=o.replace(/[\n]/g,s)),o},d.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},d.prototype.set_indent=function(s,u){return s=s||0,u=u||0,this.next_line.set_indent(s,u),this.__lines.length>1?(this.current_line.set_indent(s,u),!0):(this.current_line.set_indent(),!1)},d.prototype.add_raw_token=function(s){for(var u=0;u<s.newlines;u++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(s.whitespace_before),this.current_line.push(s.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},d.prototype.add_token=function(s){this.__add_space_before_token(),this.current_line.push(s),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(s){for(var u=this.__lines.length;s<u;)this.__lines[s]._remove_indent(),s++;this.current_line._remove_wrap_indent()},d.prototype.trim=function(s){for(s=s===void 0?!1:s,this.current_line.trim();s&&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(s,u){for(var o=this.__lines.length-2;o>=0;){var a=this.__lines[o];if(a.is_empty())break;if(a.item(0).indexOf(s)!==0&&a.item(-1)!==u){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,s,u){this.type=f,this.text=d,this.comments_before=null,this.newlines=s||0,this.whitespace_before=u||"",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(s,u){this.raw_options=f(s,u),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(s,u){var o=this.raw_options[s],a=u||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(a=o.concat()):typeof o=="string"&&(a=o.split(/[^a-zA-Z0-9_\/\-]+/)),a},p.prototype._get_boolean=function(s,u){var o=this.raw_options[s],a=o===void 0?!!u:!!o;return a},p.prototype._get_characters=function(s,u){var o=this.raw_options[s],a=u||"";return typeof o=="string"&&(a=o.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),a},p.prototype._get_number=function(s,u){var o=this.raw_options[s];u=parseInt(u,10),isNaN(u)&&(u=0);var a=parseInt(o,10);return isNaN(a)&&(a=u),a},p.prototype._get_selection=function(s,u,o){var a=this._get_selection_list(s,u,o);if(a.length!==1)throw new Error("Invalid Option Value: The option '"+s+`' can only be one of the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[s]+"'");return a[0]},p.prototype._get_selection_list=function(s,u,o){if(!u||u.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[u[0]],!this._is_valid_selection(o,u))throw new Error("Invalid Default Value!");var a=this._get_array(s,o);if(!this._is_valid_selection(a,u))throw new Error("Invalid Option Value: The option '"+s+`' can contain only the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[s]+"'");return a},p.prototype._is_valid_selection=function(s,u){return s.length&&u.length&&!s.some(function(o){return u.indexOf(o)===-1})};function f(s,u){var o={};s=d(s);var a;for(a in s)a!==u&&(o[a]=s[a]);if(u&&s[u])for(a in s[u])o[a]=s[u][a];return o}function d(s){var u={},o;for(o in s){var a=o.replace(/-/g,"_");u[a]=s[o]}return u}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 s=null;return d=d||0,d+=this.__position,d>=0&&d<this.__input_length&&(s=this.__input.charAt(d)),s},f.prototype.__match=function(d,s){d.lastIndex=s;var u=d.exec(this.__input);return u&&!(p&&d.sticky)&&(u.index!==s&&(u=null)),u},f.prototype.test=function(d,s){return s=s||0,s+=this.__position,s>=0&&s<this.__input_length?!!this.__match(d,s):!1},f.prototype.testChar=function(d,s){var u=this.peek(s);return d.lastIndex=0,u!==null&&d.test(u)},f.prototype.match=function(d){var s=this.__match(d,this.__position);return s?this.__position+=s[0].length:s=null,s},f.prototype.read=function(d,s,u){var o="",a;return d&&(a=this.match(d),a&&(o+=a[0])),s&&(a||!d)&&(o+=this.readUntil(s,u)),o},f.prototype.readUntil=function(d,s){var u="",o=this.__position;d.lastIndex=this.__position;var a=d.exec(this.__input);return a?(o=a.index,s&&(o+=a[0].length)):o=this.__input_length,u=this.__input.substring(this.__position,o),this.__position=o,u},f.prototype.readUntilAfter=function(d){return this.readUntil(d,!0)},f.prototype.get_regexp=function(d,s){var u=null,o="g";return s&&p&&(o="y"),typeof d=="string"&&d!==""?u=new RegExp(d,o):d&&(u=new RegExp(d.source,o)),u},f.prototype.get_literal_regexp=function(d){return RegExp(d.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},f.prototype.peekUntilAfter=function(d){var s=this.__position,u=this.readUntilAfter(d);return this.__position=s,u},f.prototype.lookBack=function(d){var s=this.__position-1;return s>=d.length&&this.__input.substring(s-d.length,s).toLowerCase()===d},g.exports.InputScanner=f},function(g,p,f){var d=f(8).InputScanner,s=f(3).Token,u=f(10).TokenStream,o=f(11).WhitespacePattern,a={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(h,A){this._input=new d(h),this._options=A||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new u,this._reset();for(var h,A=new s(a.START,""),x=null,T=[],O=new u;A.type!==a.EOF;){for(h=this._get_next_token(A,x);this._is_comment(h);)O.add(h),h=this._get_next_token(A,x);O.isEmpty()||(h.comments_before=O,O=new u),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=A,A.next=h,this.__tokens.add(h),A=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,A){this._readWhitespace();var x=this._input.read(/.+/g);return x?this._create_token(a.RAW,x):this._create_token(a.EOF,"")},l.prototype._is_comment=function(h){return!1},l.prototype._is_opening=function(h){return!1},l.prototype._is_closing=function(h,A){return!1},l.prototype._create_token=function(h,A){var x=new s(h,A,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=a},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 s(u,o){d.call(this,u,o),o?this._line_regexp=this._input.get_regexp(o._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}s.prototype=new d,s.prototype.__set_whitespace_patterns=function(u,o){u+="\\t ",o+="\\n\\r",this._match_pattern=this._input.get_regexp("["+u+o+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+o+"]")},s.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var u=this._input.read(this._match_pattern);if(u===" ")this.whitespace_before_token=" ";else if(u){var o=this.__split(this._newline_regexp,u);this.newline_count=o.length-1,this.whitespace_before_token=o[this.newline_count]}return u},s.prototype.matching=function(u,o){var a=this._create();return a.__set_whitespace_patterns(u,o),a._update(),a},s.prototype._create=function(){return new s(this._input,this)},s.prototype.__split=function(u,o){u.lastIndex=0;for(var a=0,l=[],h=u.exec(o);h;)l.push(o.substring(a,h.index)),a=h.index+h[0].length,h=u.exec(o);return a<o.length?l.push(o.substring(a,o.length)):l.push(""),l},g.exports.WhitespacePattern=s},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 s=this.__directive_pattern.exec(f);s;)d[s[1]]=s[2],s=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,s={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function u(o,a){d.call(this,o,a),this.__template_pattern=null,this._disabled=Object.assign({},s),this._excluded=Object.assign({},s),a&&(this.__template_pattern=this._input.get_regexp(a.__template_pattern),this._excluded=Object.assign(this._excluded,a._excluded),this._disabled=Object.assign(this._disabled,a._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}/)}}u.prototype=new d,u.prototype._create=function(){return new u(this._input,this)},u.prototype._update=function(){this.__set_templated_pattern()},u.prototype.disable=function(o){var a=this._create();return a._disabled[o]=!0,a._update(),a},u.prototype.read_options=function(o){var a=this._create();for(var l in s)a._disabled[l]=o.templating.indexOf(l)===-1;return a._update(),a},u.prototype.exclude=function(o){var a=this._create();return a._excluded[o]=!0,a._update(),a},u.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 a=this._read_template();a;)this._match_pattern?a+=this._input.read(this._match_pattern):a+=this._input.readUntil(this.__template_pattern),o+=a,a=this._read_template();return this._until_after&&(o+=this._input.readUntilAfter(this._until_pattern)),o},u.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("|")+")")},u.prototype._read_template=function(){var o="",a=this._input.peek();if(a==="<"){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 a==="{"&&(!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=u},,,,function(g,p,f){var d=f(19).Beautifier,s=f(20).Options;function u(o,a,l,h){var A=new d(o,a,l,h);return A.beautify()}g.exports=u,g.exports.defaultOptions=function(){return new s}},function(g,p,f){var d=f(20).Options,s=f(2).Output,u=f(21).Tokenizer,o=f(21).TOKEN,a=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,h=function(y,m){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=y.max_preserve_newlines,this.preserve_newlines=y.preserve_newlines,this._output=new s(y,m)};h.prototype.current_line_has_match=function(y){return this._output.current_line.has_match(y)},h.prototype.set_space_before_token=function(y,m){this._output.space_before_token=y,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(y){this._output.add_raw_token(y)},h.prototype.print_preserved_newlines=function(y){var m=0;y.type!==o.TEXT&&y.previous.type!==o.TEXT&&(m=y.newlines?1:0),this.preserve_newlines&&(m=y.newlines<this.max_preserve_newlines+1?y.newlines:this.max_preserve_newlines+1);for(var _=0;_<m;_++)this.print_newline(_>0);return m!==0},h.prototype.traverse_whitespace=function(y){return y.whitespace_before||y.newlines?(this.print_preserved_newlines(y)||(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(y){this._output.add_new_line(y)},h.prototype.print_token=function(y){y.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(y.text))},h.prototype.indent=function(){this.indent_level++},h.prototype.get_full_indent=function(y){return y=this.indent_level+(y||0),y<1?"":this._output.get_indent_string(y)};var A=function(y){for(var m=null,_=y.next;_.type!==o.EOF&&y.closed!==_;){if(_.type===o.ATTRIBUTE&&_.text==="type"){_.next&&_.next.type===o.EQUALS&&_.next.next&&_.next.next.type===o.VALUE&&(m=_.next.next.text);break}_=_.next}return m},x=function(y,m){var _=null,P=null;return m.closed?(y==="script"?_="text/javascript":y==="style"&&(_="text/css"),_=A(m)||_,_.search("text/css")>-1?P="css":_.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?P="javascript":_.search(/(text|application|dojo)\/(x-)?(html)/)>-1?P="html":_.search(/test\/null/)>-1&&(P="null"),P):null};function T(y,m){return m.indexOf(y)!==-1}function O(y,m,_){this.parent=y||null,this.tag=m?m.tag_name:"",this.indent_level=_||0,this.parser_token=m||null}function S(y){this._printer=y,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(y){var m=new O(this._current_frame,y,this._printer.indent_level);this._current_frame=m},S.prototype._try_pop_frame=function(y){var m=null;return y&&(m=y.parser_token,this._printer.indent_level=y.indent_level,this._current_frame=y.parent),m},S.prototype._get_frame=function(y,m){for(var _=this._current_frame;_&&!(y.indexOf(_.tag)!==-1);){if(m&&m.indexOf(_.tag)!==-1){_=null;break}_=_.parent}return _},S.prototype.try_pop=function(y,m){var _=this._get_frame([y],m);return this._try_pop_frame(_)},S.prototype.indent_to_tag=function(y){var m=this._get_frame(y);m&&(this._printer.indent_level=m.indent_level)};function E(y,m,_,P){this._source_text=y||"",m=m||{},this._js_beautify=_,this._css_beautify=P,this._tag_stack=null;var I=new d(m,"html");this._options=I,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 y=this._source_text,m=this._options.eol;this._options.eol==="auto"&&(m=`
|
|
`,y&&a.test(y)&&(m=y.match(a)[0])),y=y.replace(l,`
|
|
`);var _=y.match(/^[\t ]*/)[0],P={text:"",type:""},I=new w,B=new h(this._options,_),U=new u(y,this._options).tokenize();this._tag_stack=new S(B);for(var C=null,v=U.next();v.type!==o.EOF;)v.type===o.TAG_OPEN||v.type===o.COMMENT?(C=this._handle_tag_open(B,v,I,P),I=C):v.type===o.ATTRIBUTE||v.type===o.EQUALS||v.type===o.VALUE||v.type===o.TEXT&&!I.tag_complete?C=this._handle_inside_tag(B,v,I,U):v.type===o.TAG_CLOSE?C=this._handle_tag_close(B,v,I):v.type===o.TEXT?C=this._handle_text(B,v,I):B.add_raw_token(v),P=C,v=U.next();var j=B._output.get_code(m);return j},E.prototype._handle_tag_close=function(y,m,_){var P={text:m.text,type:m.type};return y.alignment_size=0,_.tag_complete=!0,y.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),_.is_unformatted?y.add_raw_token(m):(_.tag_start_char==="<"&&(y.set_space_before_token(m.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&_.has_wrapped_attrs&&y.print_newline(!1)),y.print_token(m)),_.indent_content&&!(_.is_unformatted||_.is_content_unformatted)&&(y.indent(),_.indent_content=!1),!_.is_inline_element&&!(_.is_unformatted||_.is_content_unformatted)&&y.set_wrap_point(),P},E.prototype._handle_inside_tag=function(y,m,_,P){var I=_.has_wrapped_attrs,B={text:m.text,type:m.type};if(y.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),_.is_unformatted)y.add_raw_token(m);else if(_.tag_start_char==="{"&&m.type===o.TEXT)y.print_preserved_newlines(m)?(m.newlines=0,y.add_raw_token(m)):y.print_token(m);else{if(m.type===o.ATTRIBUTE?(y.set_space_before_token(!0),_.attr_count+=1):(m.type===o.EQUALS||m.type===o.VALUE&&m.previous.type===o.EQUALS)&&y.set_space_before_token(!1),m.type===o.ATTRIBUTE&&_.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(y.traverse_whitespace(m),I=I||m.newlines!==0),this._is_wrap_attributes_force)){var U=_.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&_.attr_count===1){var C=!0,v=0,j;do{if(j=P.peek(v),j.type===o.ATTRIBUTE){C=!1;break}v+=1}while(v<4&&j.type!==o.EOF&&j.type!==o.TAG_CLOSE);U=!C}U&&(y.print_newline(!1),I=!0)}y.print_token(m),I=I||y.previous_token_wrapped(),_.has_wrapped_attrs=I}return B},E.prototype._handle_text=function(y,m,_){var P={text:m.text,type:"TK_CONTENT"};return _.custom_beautifier_name?this._print_custom_beatifier_text(y,m,_):_.is_unformatted||_.is_content_unformatted?y.add_raw_token(m):(y.traverse_whitespace(m),y.print_token(m)),P},E.prototype._print_custom_beatifier_text=function(y,m,_){var P=this;if(m.text!==""){var I=m.text,B,U=1,C="",v="";_.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?B=this._js_beautify:_.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?B=this._css_beautify:_.custom_beautifier_name==="html"&&(B=function(he,ge){var pe=new E(he,ge,P._js_beautify,P._css_beautify);return pe.beautify()}),this._options.indent_scripts==="keep"?U=0:this._options.indent_scripts==="separate"&&(U=-y.indent_level);var j=y.get_full_indent(U);if(I=I.replace(/\n[ \t]*$/,""),_.custom_beautifier_name!=="html"&&I[0]==="<"&&I.match(/^(<!--|<!\[CDATA\[)/)){var G=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(I);if(!G){y.add_raw_token(m);return}C=j+G[1]+`
|
|
`,I=G[4],G[5]&&(v=j+G[5]),I=I.replace(/\n[ \t]*$/,""),(G[2]||G[3].indexOf(`
|
|
`)!==-1)&&(G=G[3].match(/[ \t]+$/),G&&(m.whitespace_before=G[0]))}if(I)if(B){var J=function(){this.eol=`
|
|
`};J.prototype=this._options.raw_options;var ee=new J;I=B(j+I,ee)}else{var ye=m.whitespace_before;ye&&(I=I.replace(new RegExp(`
|
|
(`+ye+")?","g"),`
|
|
`)),I=j+I.replace(/\n/g,`
|
|
`+j)}C&&(I?I=C+I+`
|
|
`+v:I=C+v),y.print_newline(!1),I&&(m.text=I,m.whitespace_before="",m.newlines=0,y.add_raw_token(m),y.print_newline(!0))}},E.prototype._handle_tag_open=function(y,m,_,P){var I=this._get_tag_open_token(m);return(_.is_unformatted||_.is_content_unformatted)&&!_.is_empty_element&&m.type===o.TAG_OPEN&&m.text.indexOf("</")===0?(y.add_raw_token(m),I.start_tag_token=this._tag_stack.try_pop(I.tag_name)):(y.traverse_whitespace(m),this._set_tag_position(y,m,I,_,P),I.is_inline_element||y.set_wrap_point(),y.print_token(m)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(I.alignment_size=m.text.length+1),!I.tag_complete&&!I.is_unformatted&&(y.alignment_size=I.alignment_size),I};var w=function(y,m){if(this.parent=y||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 _;this.tag_start_char=m.text[0],this.text=m.text,this.tag_start_char==="<"?(_=m.text.match(/^<([^\s>]*)/),this.tag_check=_?_[1]:""):(_=m.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=_?_[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(y){var m=new w(this._tag_stack.get_parser_token(),y);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(y,m,_,P,I){if(_.is_empty_element||(_.is_end_tag?_.start_tag_token=this._tag_stack.try_pop(_.tag_name):(this._do_optional_end_element(_)&&(_.is_inline_element||y.print_newline(!1)),this._tag_stack.record_tag(_),(_.tag_name==="script"||_.tag_name==="style")&&!(_.is_unformatted||_.is_content_unformatted)&&(_.custom_beautifier_name=x(_.tag_check,m)))),T(_.tag_check,this._options.extra_liners)&&(y.print_newline(!1),y._output.just_added_blankline()||y.print_newline(!0)),_.is_empty_element){if(_.tag_start_char==="{"&&_.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),_.indent_content=!0;var B=y.current_line_has_match(/{{#if/);B||y.print_newline(!1)}_.tag_name==="!--"&&I.type===o.TAG_CLOSE&&P.is_end_tag&&_.text.indexOf(`
|
|
`)===-1||(_.is_inline_element||_.is_unformatted||y.print_newline(!1),this._calcluate_parent_multiline(y,_))}else if(_.is_end_tag){var U=!1;U=_.start_tag_token&&_.start_tag_token.multiline_content,U=U||!_.is_inline_element&&!(P.is_inline_element||P.is_unformatted)&&!(I.type===o.TAG_CLOSE&&_.start_tag_token===P)&&I.type!=="TK_CONTENT",(_.is_content_unformatted||_.is_unformatted)&&(U=!1),U&&y.print_newline(!1)}else _.indent_content=!_.custom_beautifier_name,_.tag_start_char==="<"&&(_.tag_name==="html"?_.indent_content=this._options.indent_inner_html:_.tag_name==="head"?_.indent_content=this._options.indent_head_inner_html:_.tag_name==="body"&&(_.indent_content=this._options.indent_body_inner_html)),!(_.is_inline_element||_.is_unformatted)&&(I.type!=="TK_CONTENT"||_.is_content_unformatted)&&y.print_newline(!1),this._calcluate_parent_multiline(y,_)},E.prototype._calcluate_parent_multiline=function(y,m){m.parent&&y._output.just_added_newline()&&!((m.is_inline_element||m.is_unformatted)&&m.parent.is_inline_element)&&(m.parent.multiline_content=!0)};var b=["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"],c=["a","audio","del","ins","map","noscript","video"];E.prototype._do_optional_end_element=function(y){var m=null;if(y.is_empty_element||!y.is_start_tag||!y.parent)return;if(y.tag_name==="body")m=m||this._tag_stack.try_pop("head");else if(y.tag_name==="li")m=m||this._tag_stack.try_pop("li",["ol","ul"]);else if(y.tag_name==="dd"||y.tag_name==="dt")m=m||this._tag_stack.try_pop("dt",["dl"]),m=m||this._tag_stack.try_pop("dd",["dl"]);else if(y.parent.tag_name==="p"&&b.indexOf(y.tag_name)!==-1){var _=y.parent.parent;(!_||c.indexOf(_.tag_name)===-1)&&(m=m||this._tag_stack.try_pop("p"))}else y.tag_name==="rp"||y.tag_name==="rt"?(m=m||this._tag_stack.try_pop("rt",["ruby","rtc"]),m=m||this._tag_stack.try_pop("rp",["ruby","rtc"])):y.tag_name==="optgroup"?m=m||this._tag_stack.try_pop("optgroup",["select"]):y.tag_name==="option"?m=m||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):y.tag_name==="colgroup"?m=m||this._tag_stack.try_pop("caption",["table"]):y.tag_name==="thead"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"])):y.tag_name==="tbody"||y.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"])):y.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"])):(y.tag_name==="th"||y.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 y.parent=this._tag_stack.get_parser_token(),m},g.exports.Beautifier=E},function(g,p,f){var d=f(6).Options;function s(u){d.call(this,u,"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"])}s.prototype=new d,g.exports.Options=s},function(g,p,f){var d=f(9).Tokenizer,s=f(9).TOKEN,u=f(13).Directives,o=f(14).TemplatablePattern,a=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:s.START,RAW:s.RAW,EOF:s.EOF},h=new u(/<\!--/,/-->/),A=function(x,T){d.call(this,x,T),this._current_tag_name="";var O=new o(this._input).read_options(this._options),S=new a(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)}};A.prototype=new d,A.prototype._is_comment=function(x){return!1},A.prototype._is_opening=function(x){return x.type===l.TAG_OPEN},A.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]==="{")},A.prototype._reset=function(){this._current_tag_name=""},A.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)},A.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},A.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},A.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},A.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},A.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},A.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 w=this._input.next();x==='"'?w+=this.__patterns.double_quote.read():w+=this.__patterns.single_quote.read(),S=this._create_token(l.VALUE,w)}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},A.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)},A.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 w=this._read_comment_or_cdata(x);if(w)return w.type=l.TEXT,w;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},A.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=A,g.exports.TOKEN=l}],F={};function k(g){var p=F[g];if(p!==void 0)return p.exports;var f=F[g]={exports:{}};return W[g](f,f.exports,k),f.exports}var R=k(18);D=R})();var z=D;if(!0)!(ae=[ne,ne("6UM0"),ne("TXwP")],V=function(W){var F=ne("6UM0"),k=ne("TXwP");return{html_beautify:function(R,g){return z(R,g,F.js_beautify,k.css_beautify)}}}.apply(Qe,ae),V!==void 0&&(ut.exports=V));else var N,M})()},"rAM+":function(ut,Qe,ne){"use strict";ne.d(Qe,"a",function(){return V});var ae=ne("Qw5x");function V(D,z){var N;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(N=Object(ae.a)(D))||z&&D&&typeof D.length=="number"){N&&(D=N);var M=0,W=function(){};return{s:W,n:function(){return M>=D.length?{done:!0}:{done:!1,value:D[M++]}},e:function(p){throw p},f:W}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var F=!0,k=!1,R;return{s:function(){N=D[Symbol.iterator]()},n:function(){var p=N.next();return F=p.done,p},e:function(p){k=!0,R=p},f:function(){try{!F&&N.return!=null&&N.return()}finally{if(k)throw R}}}}},rUJ1:function(ut,Qe){const ne=/[&<>"']/,ae=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,z={"&":"&","<":"<",">":">",'"':""","'":"'"},N=S=>z[S];function M(S,E){if(E){if(ne.test(S))return S.replace(ae,N)}else if(V.test(S))return S.replace(D,N);return S}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function F(S){return S.replace(W,(E,w)=>(w=w.toLowerCase(),w==="colon"?":":w.charAt(0)==="#"?w.charAt(1)==="x"?String.fromCharCode(parseInt(w.substring(2),16)):String.fromCharCode(+w.substring(1)):""))}const k=/(^|[^\[])\^/g;function R(S,E){S=S.source||S,E=E||"";const w={replace:(b,c)=>(c=c.source||c,c=c.replace(k,"$1"),S=S.replace(b,c),w),getRegex:()=>new RegExp(S,E)};return w}const g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(S,E,w){if(S){let b;try{b=decodeURIComponent(F(w)).replace(g,"").toLowerCase()}catch(c){return null}if(b.indexOf("javascript:")===0||b.indexOf("vbscript:")===0||b.indexOf("data:")===0)return null}E&&!p.test(w)&&(w=a(E,w));try{w=encodeURI(w).replace(/%25/g,"%")}catch(b){return null}return w}const d={},s=/^[^:]+:\/*[^/]*$/,u=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(S,E){d[" "+S]||(s.test(S)?d[" "+S]=S+"/":d[" "+S]=x(S,"/",!0)),S=d[" "+S];const w=S.indexOf(":")===-1;return E.substring(0,2)==="//"?w?E:S.replace(u,"$1")+E:E.charAt(0)==="/"?w?E:S.replace(o,"$1")+E:S+E}const l={exec:function(){}};function h(S){let E=1,w,b;for(;E<arguments.length;E++){w=arguments[E];for(b in w)Object.prototype.hasOwnProperty.call(w,b)&&(S[b]=w[b])}return S}function A(S,E){const w=S.replace(/\|/g,(y,m,_)=>{let P=!1,I=m;for(;--I>=0&&_[I]==="\\";)P=!P;return P?"|":" |"}),b=w.split(/ \|/);let c=0;if(b.length>E)b.splice(E);else for(;b.length<E;)b.push("");for(;c<b.length;c++)b[c]=b[c].trim().replace(/\\\|/g,"|");return b}function x(S,E,w){const b=S.length;if(b===0)return"";let c=0;for(;c<b;){const y=S.charAt(b-c-1);if(y===E&&!w)c++;else if(y!==E&&w)c++;else break}return S.substr(0,b-c)}function T(S,E){if(S.indexOf(E[1])===-1)return-1;const w=S.length;let b=0,c=0;for(;c<w;c++)if(S[c]==="\\")c++;else if(S[c]===E[0])b++;else if(S[c]===E[1]&&(b--,b<0))return c;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")}ut.exports={escape:M,unescape:F,edit:R,cleanUrl:f,resolveUrl:a,noopTest:l,merge:h,splitCells:A,rtrim:x,findClosingBracket:T,checkSanitizeDeprecation:O}},ulZh:function(ut,Qe,ne){typeof window!="undefined"&&function(V,D){ut.exports=D()}(this,function(){return function(ae){var V={};function D(z){if(V[z])return V[z].exports;var N=V[z]={i:z,l:!1,exports:{}};return ae[z].call(N.exports,N,N.exports,D),N.l=!0,N.exports}return D.m=ae,D.c=V,D.d=function(z,N,M){D.o(z,N)||Object.defineProperty(z,N,{enumerable:!0,get:M})},D.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},D.t=function(z,N){if(N&1&&(z=D(z)),N&8)return z;if(N&4&&typeof z=="object"&&z&&z.__esModule)return z;var M=Object.create(null);if(D.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:z}),N&2&&typeof z!="string")for(var W in z)D.d(M,W,function(F){return z[F]}.bind(null,W));return M},D.n=function(z){var N=z&&z.__esModule?function(){return z.default}:function(){return z};return D.d(N,"a",N),N},D.o=function(z,N){return Object.prototype.hasOwnProperty.call(z,N)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ae,V,D){"use strict";var z=Object.prototype.hasOwnProperty,N="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(N=!1));function W(g,p,f){this.fn=g,this.context=p,this.once=f||!1}function F(g,p,f,d,s){if(typeof f!="function")throw new TypeError("The listener must be a function");var u=new W(f,d||g,s),o=N?N+p:p;return g._events[o]?g._events[o].fn?g._events[o]=[g._events[o],u]:g._events[o].push(u):(g._events[o]=u,g._eventsCount++),g}function k(g,p){--g._eventsCount===0?g._events=new M:delete g._events[p]}function R(){this._events=new M,this._eventsCount=0}R.prototype.eventNames=function(){var p=[],f,d;if(this._eventsCount===0)return p;for(d in f=this._events)z.call(f,d)&&p.push(N?d.slice(1):d);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(f)):p},R.prototype.listeners=function(p){var f=N?N+p:p,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var s=0,u=d.length,o=new Array(u);s<u;s++)o[s]=d[s].fn;return o},R.prototype.listenerCount=function(p){var f=N?N+p:p,d=this._events[f];return d?d.fn?1:d.length:0},R.prototype.emit=function(p,f,d,s,u,o){var a=N?N+p:p;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,A,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,s),!0;case 5:return l.fn.call(l.context,f,d,s,u),!0;case 6:return l.fn.call(l.context,f,d,s,u,o),!0}for(x=1,A=new Array(h-1);x<h;x++)A[x-1]=arguments[x];l.fn.apply(l.context,A)}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,s);break;default:if(!A)for(O=1,A=new Array(h-1);O<h;O++)A[O-1]=arguments[O];l[x].fn.apply(l[x].context,A)}}}return!0},R.prototype.on=function(p,f,d){return F(this,p,f,d,!1)},R.prototype.once=function(p,f,d){return F(this,p,f,d,!0)},R.prototype.removeListener=function(p,f,d,s){var u=N?N+p:p;if(!this._events[u])return this;if(!f)return k(this,u),this;var o=this._events[u];if(o.fn)o.fn===f&&(!s||o.once)&&(!d||o.context===d)&&k(this,u);else{for(var a=0,l=[],h=o.length;a<h;a++)(o[a].fn!==f||s&&!o[a].once||d&&o[a].context!==d)&&l.push(o[a]);l.length?this._events[u]=l.length===1?l[0]:l:k(this,u)}return this},R.prototype.removeAllListeners=function(p){var f;return p?(f=N?N+p:p,this._events[f]&&k(this,f)):(this._events=new M,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=N,R.EventEmitter=R,ae.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(ae,V,D){(function(z){var N=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,F=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(R,g,p){if(p=p||{},R=R.trim(),g=g.trim(),!g){if(!p.alwaysNormalize)return R;var f=k.parseURL(R);if(!f)throw new Error("Error trying to parse base URL.");return f.path=k.normalizePath(f.path),k.buildURLFromParts(f)}var d=k.parseURL(g);if(!d)throw new Error("Error trying to parse relative URL.");if(d.scheme)return p.alwaysNormalize?(d.path=k.normalizePath(d.path),k.buildURLFromParts(d)):g;var s=k.parseURL(R);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&s.path[0]!=="/"){var u=M.exec(s.path);s.netLoc=u[1],s.path=u[2]}s.netLoc&&!s.path&&(s.path="/");var o={scheme:s.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(o.netLoc=s.netLoc,d.path[0]!=="/"))if(!d.path)o.path=s.path,d.params||(o.params=s.params,d.query||(o.query=s.query));else{var a=s.path,l=a.substring(0,a.lastIndexOf("/")+1)+d.path;o.path=k.normalizePath(l)}return o.path===null&&(o.path=p.alwaysNormalize?k.normalizePath(d.path):d.path),k.buildURLFromParts(o)},parseURL:function(R){var g=N.exec(R);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(W,"");R.length!==(R=R.replace(F,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};ae.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(ae,V,D){function z(p){var f={};function d(u){if(f[u])return f[u].exports;var o=f[u]={i:u,l:!1,exports:{}};return p[u].call(o.exports,o,o.exports,d),o.l=!0,o.exports}d.m=p,d.c=f,d.i=function(u){return u},d.d=function(u,o,a){d.o(u,o)||Object.defineProperty(u,o,{configurable:!1,enumerable:!0,get:a})},d.r=function(u){Object.defineProperty(u,"__esModule",{value:!0})},d.n=function(u){var o=u&&u.__esModule?function(){return u.default}:function(){return u};return d.d(o,"a",o),o},d.o=function(u,o){return Object.prototype.hasOwnProperty.call(u,o)},d.p="/",d.oe=function(u){throw console.error(u),u};var s=d(d.s=ENTRY_MODULE);return s.default||s}var N="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+N+").*?\\)";function W(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function F(p){return!isNaN(1*p)}function k(p,f,d){var s={};s[d]=[];var u=f.toString(),o=u.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return s;for(var a=o[1],l=new RegExp("(\\\\n|\\W)"+W(a)+M,"g"),h;h=l.exec(u);){if(h[3]==="dll-reference")continue;s[d].push(h[3])}for(l=new RegExp("\\("+W(a)+'\\("(dll-reference\\s('+N+'))"\\)\\)'+M,"g");h=l.exec(u);)p[h[2]]||(s[d].push(h[1]),p[h[2]]=D(h[1]).m),s[h[2]]=s[h[2]]||[],s[h[2]].push(h[4]);for(var A=Object.keys(s),x=0;x<A.length;x++)for(var T=0;T<s[A[x]].length;T++)F(s[A[x]][T])&&(s[A[x]][T]=1*s[A[x]][T]);return s}function R(p){var f=Object.keys(p);return f.reduce(function(d,s){return d||p[s].length>0},!1)}function g(p,f){for(var d={main:[f]},s={main:[]},u={main:{}};R(d);)for(var o=Object.keys(d),a=0;a<o.length;a++){var l=o[a],h=d[l],A=h.pop();if(u[l]=u[l]||{},u[l][A]||!p[l][A])continue;u[l][A]=!0,s[l]=s[l]||[],s[l].push(A);for(var x=k(p,p[l][A],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 s}ae.exports=function(p,f){f=f||{};var d={main:D.m},s=f.all?{main:Object.keys(d.main)}:g(d,p),u="";Object.keys(s).filter(function(A){return A!=="main"}).forEach(function(A){for(var x=0;s[A][x];)x++;s[A].push(x),d[A][x]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",u=u+"var "+A+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(x))+")({"+s[A].map(function(T){return""+JSON.stringify(T)+": "+d[A][T].toString()}).join(",")+`});
|
|
`}),u=u+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+s.main.map(function(A){return""+JSON.stringify(A)+": "+d.main[A].toString()}).join(",")+"}))(self);";var o=new window.Blob([u],{type:"text/javascript"});if(f.bare)return o;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,l=a.createObjectURL(o),h=new window.Worker(l);return h.objectURL=l,h}},"./src/config.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"hlsDefaultConfig",function(){return O}),D.d(V,"mergeConfig",function(){return E}),D.d(V,"enableStreamingMode",function(){return w});var z=D("./src/controller/abr-controller.ts"),N=D("./src/controller/audio-stream-controller.ts"),M=D("./src/controller/audio-track-controller.ts"),W=D("./src/controller/subtitle-stream-controller.ts"),F=D("./src/controller/subtitle-track-controller.ts"),k=D("./src/controller/buffer-controller.ts"),R=D("./src/controller/timeline-controller.ts"),g=D("./src/controller/cap-level-controller.ts"),p=D("./src/controller/fps-controller.ts"),f=D("./src/controller/eme-controller.ts"),d=D("./src/controller/cmcd-controller.ts"),s=D("./src/utils/xhr-loader.ts"),u=D("./src/utils/fetch-loader.ts"),o=D("./src/utils/cues.ts"),a=D("./src/utils/mediakeys-helper.ts"),l=D("./src/utils/logger.ts");function h(){return h=Object.assign||function(b){for(var c=1;c<arguments.length;c++){var y=arguments[c];for(var m in y)Object.prototype.hasOwnProperty.call(y,m)&&(b[m]=y[m])}return b},h.apply(this,arguments)}function A(b,c){var y=Object.keys(b);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(b);c&&(m=m.filter(function(_){return Object.getOwnPropertyDescriptor(b,_).enumerable})),y.push.apply(y,m)}return y}function x(b){for(var c=1;c<arguments.length;c++){var y=arguments[c]!=null?arguments[c]:{};c%2?A(Object(y),!0).forEach(function(m){T(b,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(y)):A(Object(y)).forEach(function(m){Object.defineProperty(b,m,Object.getOwnPropertyDescriptor(y,m))})}return b}function T(b,c,y){return c in b?Object.defineProperty(b,c,{value:y,enumerable:!0,configurable:!0,writable:!0}):b[c]=y,b}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:s.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:z.default,bufferController:k.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:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},S()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:F.default,timelineController:R.TimelineController,audioStreamController:N.default,audioTrackController:M.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(b,c){if((c.liveSyncDurationCount||c.liveMaxLatencyDurationCount)&&(c.liveSyncDuration||c.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(c.liveMaxLatencyDurationCount!==void 0&&(c.liveSyncDurationCount===void 0||c.liveMaxLatencyDurationCount<=c.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(c.liveMaxLatencyDuration!==void 0&&(c.liveSyncDuration===void 0||c.liveMaxLatencyDuration<=c.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},b,c)}function w(b){var c=b.loader;if(c!==u.default&&c!==s.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),b.progressive=!1;else{var y=Object(u.fetchSupported)();y&&(b.loader=u.default,b.progressive=!0,b.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/polyfills/number.ts"),N=D("./src/utils/ewma-bandwidth-estimator.ts"),M=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),F=D("./src/errors.ts"),k=D("./src/types/loader.ts"),R=D("./src/utils/logger.ts");function g(d,s){for(var u=0;u<s.length;u++){var o=s[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(d,o.key,o)}}function p(d,s,u){return s&&g(d.prototype,s),u&&g(d,u),d}var f=function(){function d(u){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=u;var o=u.config;this.bwEstimator=new N.default(o.abrEwmaSlowVoD,o.abrEwmaFastVoD,o.abrEwmaDefaultEstimate),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var o=this.hls;o.on(M.Events.FRAG_LOADING,this.onFragLoading,this),o.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(M.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var o=this.hls;o.off(M.Events.FRAG_LOADING,this.onFragLoading,this),o.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),o.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(M.Events.ERROR,this.onError,this)},s.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},s.onFragLoading=function(o,a){var l=a.frag;if(l.type===k.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=l,this.partCurrent=(h=a.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},s.onLevelLoaded=function(o,a){var l=this.hls.config;a.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},s._abandonRulesCheck=function(){var o=this.fragCurrent,a=this.partCurrent,l=this.hls,h=l.autoLevelEnabled,A=l.config,x=l.media;if(!o||!x)return;var T=a?a.stats:o.stats,O=a?a.duration:o.duration;if(T.aborted){R.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 w=l.levels,b=l.minAutoLevel,c=w[o.level],y=T.total||Math.max(T.loaded,Math.round(O*c.maxBitrate/8)),m=Math.max(1,T.bwEstimate?T.bwEstimate/8:T.loaded*1e3/S),_=(y-T.loaded)/m,P=x.currentTime,I=(W.BufferHelper.bufferInfo(x,P,A.maxBufferHole).end-P)/E;if(I>=2*O/E||_<=I)return;var B=Number.POSITIVE_INFINITY,U;for(U=o.level-1;U>b;U--){var C=w[U].maxBitrate;if(B=O*C/(8*.8*m),B<I)break}if(B>=_)return;var v=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+o.sn+(a?" part "+a.index:"")+" of level "+o.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+U+`
|
|
Current BW estimate: `+(Object(z.isFiniteNumber)(v)?(v/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+_.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+B.toFixed(3)+` s
|
|
Time to underbuffer: `+I.toFixed(3)+" s"),l.nextLoadLevel=U,this.bwEstimator.sample(S,T.loaded),this.clearTimer(),o.loader&&(this.fragCurrent=this.partCurrent=null,o.loader.abort()),l.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:a,stats:T})},s.onFragLoaded=function(o,a){var l=a.frag,h=a.part;if(l.type===k.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(l.sn)){var A=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)+A.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:A,frag:l,part:h,id:l.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,E),l.bitrateTest=!1}}},s.onFragBuffered=function(o,a){var l=a.frag,h=a.part,A=h?h.stats:l.stats;if(A.aborted)return;if(l.type!==k.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var x=A.parsing.end-A.loading.start;this.bwEstimator.sample(x,A.loaded),A.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=x/1e3:this.bitrateTestDelay=0},s.onError=function(o,a){switch(a.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},s.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},s.getNextABRAutoLevel=function(){var o=this.fragCurrent,a=this.partCurrent,l=this.hls,h=l.maxAutoLevel,A=l.config,x=l.minAutoLevel,T=l.media,O=a?a.duration:o?o.duration:0,S=T?T.currentTime:0,E=T&&T.playbackRate!==0?Math.abs(T.playbackRate):1,w=this.bwEstimator?this.bwEstimator.getEstimate():A.abrEwmaDefaultEstimate,b=(W.BufferHelper.bufferInfo(T,S,A.maxBufferHole).end-S)/E,c=this.findBestLevel(w,x,h,b,A.abrBandWidthFactor,A.abrBandWidthUpFactor);if(c>=0)return c;R.logger.trace((b?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var y=O?Math.min(O,A.maxStarvationDelay):A.maxStarvationDelay,m=A.abrBandWidthFactor,_=A.abrBandWidthUpFactor;if(!b){var P=this.bitrateTestDelay;if(P){var I=O?Math.min(O,A.maxLoadingDelay):A.maxLoadingDelay;y=I-P,R.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*y)+" ms"),m=_=1}}return c=this.findBestLevel(w,x,h,b+y,m,_),Math.max(c,0)},s.findBestLevel=function(o,a,l,h,A,x){for(var T,O=this.fragCurrent,S=this.partCurrent,E=this.lastLoadedFragLevel,w=this.hls.levels,b=w[E],c=!!(b!=null&&(T=b.details)!==null&&T!==void 0&&T.live),y=b==null?void 0:b.codecSet,m=S?S.duration:O?O.duration:0,_=l;_>=a;_--){var P=w[_];if(!P||y&&P.codecSet!==y)continue;var I=P.details,B=(S?I==null?void 0:I.partTarget:I==null?void 0:I.averagetargetduration)||m,U=void 0;_<=E?U=A*o:U=x*o;var C=w[_].maxBitrate,v=C*B/U;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+_+"/"+Math.round(U)+"/"+C+"/"+B+"/"+h+"/"+v),U>C&&(!v||c&&!this.bitrateTestDelay||v<h))return _}return-1},p(d,[{key:"nextAutoLevel",get:function(){var o=this._nextAutoLevel,a=this.bwEstimator;if(o!==-1&&(!a||!a.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(ae,V,D){"use strict";D.r(V);var z=D("./src/polyfills/number.ts"),N=D("./src/controller/base-stream-controller.ts"),M=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),F=D("./src/controller/fragment-tracker.ts"),k=D("./src/types/level.ts"),R=D("./src/types/loader.ts"),g=D("./src/loader/fragment.ts"),p=D("./src/demux/chunk-cache.ts"),f=D("./src/demux/transmuxer-interface.ts"),d=D("./src/types/transmuxer.ts"),s=D("./src/controller/fragment-finders.ts"),u=D("./src/utils/discontinuities.ts"),o=D("./src/errors.ts"),a=D("./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 w in E)Object.prototype.hasOwnProperty.call(E,w)&&(O[w]=E[w])}return O},l.apply(this,arguments)}function h(O,S){O.prototype=Object.create(S.prototype),O.prototype.constructor=O,A(O,S)}function A(O,S){return A=Object.setPrototypeOf||function(w,b){return w.__proto__=b,w},A(O,S)}var x=100,T=function(O){h(S,O);function S(w,b){var c;return c=O.call(this,w,b,"[audio-stream-controller]")||this,c.videoBuffer=null,c.videoTrackCC=-1,c.waitingVideoCC=-1,c.audioSwitch=!1,c.trackId=-1,c.waitingData=null,c.mainDetails=null,c.bufferFlushed=!1,c._registerListeners(),c}var E=S.prototype;return E.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},E._registerListeners=function(){var b=this.hls;b.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),b.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),b.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),b.on(M.Events.ERROR,this.onError,this),b.on(M.Events.BUFFER_RESET,this.onBufferReset,this),b.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),b.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),b.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),b.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var b=this.hls;b.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),b.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),b.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),b.off(M.Events.ERROR,this.onError,this),b.off(M.Events.BUFFER_RESET,this.onBufferReset,this),b.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),b.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),b.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),b.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onInitPtsFound=function(b,c){var y=c.frag,m=c.id,_=c.initPTS;if(m==="main"){var P=y.cc;this.initPTS[y.cc]=_,this.log("InitPTS for cc: "+P+" found from main: "+_),this.videoTrackCC=P,this.state===N.State.WAITING_INIT_PTS&&this.tick()}},E.startLoad=function(b){if(!this.levels){this.startPosition=b,this.state=N.State.STOPPED;return}var c=this.lastCurrentTime;this.stopLoad(),this.setInterval(x),this.fragLoadError=0,c>0&&b===-1?(this.log("Override startPosition with lastCurrentTime @"+c.toFixed(3)),this.state=N.State.IDLE):(this.loadedmetadata=!1,this.state=N.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=b,this.tick()},E.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_TRACK:{var b,c=this.levels,y=this.trackId,m=c==null||((b=c[y])===null||b===void 0)?void 0:b.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=N.State.WAITING_INIT_PTS}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var _,P=performance.now(),I=this.retryDate;(!I||P>=I||(_=this.media)!==null&&_!==void 0&&_.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=N.State.IDLE);break}case N.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var U=B.frag,C=B.part,v=B.cache,j=B.complete;if(this.initPTS[U.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.FRAG_LOADING;var G=v.flush(),J={frag:U,part:C,payload:G,networkDetails:null};this._handleFragmentLoadProgress(J),j&&O.prototype._handleFragmentLoadComplete.call(this,J)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+U.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ee=this.getLoadPosition(),ye=W.BufferHelper.bufferInfo(this.mediaBuffer,ee,this.config.maxBufferHole),he=Object(s.fragmentWithinToleranceTest)(ye.end,this.config.maxFragLookUpTolerance,U);he<0&&(a.logger.log("Waiting fragment cc ("+U.cc+") @ "+U.start+" cancelled because another fragment at "+ye.end+" is needed"),this.clearWaitingFragment())}}else this.state=N.State.IDLE}}this.onTickEnd()},E.clearWaitingFragment=function(){var b=this.waitingData;b&&(this.fragmentTracker.removeFragment(b.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.IDLE)},E.onTickEnd=function(){var b=this.media;if(!b||!b.readyState)return;var c=this.mediaBuffer?this.mediaBuffer:b,y=c.buffered;!this.loadedmetadata&&y.length&&(this.loadedmetadata=!0),this.lastCurrentTime=b.currentTime},E.doTickIdle=function(){var b,c,y=this.hls,m=this.levels,_=this.media,P=this.trackId,I=y.config;if(!m||!m[P])return;if(!_&&(this.startFragRequested||!I.startFragPrefetch))return;var B=m[P],U=B.details;if(!U||U.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(U)){this.state=N.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var C=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(C===null)return;var v=C.len,j=this.getMaxBufferLength(),G=this.audioSwitch;if(v>=j&&!G)return;if(!G&&this._streamEnded(C,U)){y.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=N.State.ENDED;return}var J=U.fragments,ee=J[0].start,ye=C.end;if(G){var he=this.getLoadPosition();ye=he,U.PTSKnown&&he<ee&&((C.end>ee||C.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),_.currentTime=ee+.05))}var ge=this.getNextFragment(ye,U);if(!ge){this.bufferFlushed=!0;return}((b=ge.decryptdata)===null||b===void 0?void 0:b.keyFormat)==="identity"&&!((c=ge.decryptdata)!==null&&c!==void 0&&c.key)?this.loadKey(ge,U):this.loadFragment(ge,U,ye)},E.getMaxBufferLength=function(){var b=O.prototype.getMaxBufferLength.call(this),c=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return c===null?b:Math.max(b,c.len)},E.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},E.onAudioTracksUpdated=function(b,c){var y=c.audioTracks;this.resetTransmuxer(),this.levels=y.map(function(m){return new k.Level(m)})},E.onAudioTrackSwitching=function(b,c){var y=!!c.url;this.trackId=c.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),y?this.setInterval(x):this.resetTransmuxer(),y?(this.audioSwitch=!0,this.state=N.State.IDLE):this.state=N.State.STOPPED,this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},E.onLevelLoaded=function(b,c){this.mainDetails=c.details},E.onAudioTrackLoaded=function(b,c){var y,m=this.levels,_=c.details,P=c.id;if(!m){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+_.startSN+","+_.endSN+"],duration:"+_.totalduration);var I=m[P],B=0;if(_.live||(y=I.details)!==null&&y!==void 0&&y.live){var U=this.mainDetails;if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed||!U)return;!I.details&&_.hasProgramDateTime&&U.hasProgramDateTime?(Object(u.alignMediaPlaylistByPDT)(_,U),B=_.fragments[0].start):B=this.alignPlaylists(_,I.details)}I.details=_,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!_.live)&&this.setStartPosition(I.details,B),this.state===N.State.WAITING_TRACK&&!this.waitForCdnTuneIn(_)&&(this.state=N.State.IDLE),this.tick()},E._handleFragmentLoadProgress=function(b){var c,y=b.frag,m=b.part,_=b.payload,P=this.config,I=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+y.sn+" of level "+y.level+" will not be buffered");return}var U=B[I];console.assert(U,"Audio track is defined on fragment load progress");var C=U.details;console.assert(C,"Audio track details are defined on fragment load progress");var v=P.defaultAudioCodec||U.audioCodec||"mp4a.40.2",j=this.transmuxer;j||(j=this.transmuxer=new f.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var G=this.initPTS[y.cc],J=(c=y.initSegment)===null||c===void 0?void 0:c.data;if(G!==void 0){var ee=!1,ye=m?m.index:-1,he=ye!==-1,ge=new d.ChunkMetadata(y.level,y.sn,y.stats.chunkCount,_.byteLength,ye,he);j.push(_,J,v,"",y,m,C.totalduration,ee,ge,G)}else{a.logger.log("Unknown video PTS for cc "+y.cc+", waiting for video PTS before demuxing audio frag "+y.sn+" of ["+C.startSN+" ,"+C.endSN+"],track "+I);var pe=this.waitingData=this.waitingData||{frag:y,part:m,cache:new p.default,complete:!1},oe=pe.cache;oe.push(new Uint8Array(_)),this.waitingVideoCC=this.videoTrackCC,this.state=N.State.WAITING_INIT_PTS}},E._handleFragmentLoadComplete=function(b){if(this.waitingData){this.waitingData.complete=!0;return}O.prototype._handleFragmentLoadComplete.call(this,b)},E.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},E.onBufferCreated=function(b,c){var y=c.tracks.audio;y&&(this.mediaBuffer=y.buffer),c.tracks.video&&(this.videoBuffer=c.tracks.video.buffer)},E.onFragBuffered=function(b,c){var y=c.frag,m=c.part;if(y.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(y)){this.warn("Fragment "+y.sn+(m?" p: "+m.index:"")+" of level "+y.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}y.sn!=="initSegment"&&(this.fragPrevious=y,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(y,m)},E.onError=function(b,c){switch(c.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(R.PlaylistLevelType.AUDIO,c);break;case o.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case o.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==N.State.ERROR&&this.state!==N.State.STOPPED&&(this.state=c.fatal?N.State.ERROR:N.State.IDLE,this.warn(c.details+" while loading frag, switching to "+this.state+" state"));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(c.parent==="audio"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var y=!0,m=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);m&&m.len>.5&&(y=!this.reduceMaxBufferLength(m.len)),y&&(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(b,c){var y=c.type;y===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},E._handleTransmuxComplete=function(b){var c,y="audio",m=this.hls,_=b.remuxResult,P=b.chunkMeta,I=this.getCurrentContext(P);if(!I){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 B=I.frag,U=I.part,C=_.audio,v=_.text,j=_.id3,G=_.initSegment;if(this.fragContextChanged(B))return;if(this.state=N.State.PARSING,this.audioSwitch&&C&&this.completeAudioSwitch(),G!=null&&G.tracks&&(this._bufferInitSegment(G.tracks,B,P),m.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:y,tracks:G.tracks})),C){var J=C.startPTS,ee=C.endPTS,ye=C.startDTS,he=C.endDTS;U&&(U.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:J,endPTS:ee,startDTS:ye,endDTS:he}),B.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,J,ee,ye,he),this.bufferFragmentData(C,B,U,P)}if(j!=null&&(c=j.samples)!==null&&c!==void 0&&c.length){var ge=l({frag:B,id:y},j);m.trigger(M.Events.FRAG_PARSING_METADATA,ge)}if(v){var pe=l({frag:B,id:y},v);m.trigger(M.Events.FRAG_PARSING_USERDATA,pe)}},E._bufferInitSegment=function(b,c,y){if(this.state!==N.State.PARSING)return;b.video&&delete b.video;var m=b.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(M.Events.BUFFER_CODECS,b);var _=m.initSegment;if(_!=null&&_.byteLength){var P={type:"audio",frag:c,part:null,chunkMeta:y,parent:c.type,data:_};this.hls.trigger(M.Events.BUFFER_APPENDING,P)}this.tick()},E.loadFragment=function(b,c,y){var m=this.fragmentTracker.getState(b);this.fragCurrent=b,(this.audioSwitch||m===F.FragmentState.NOT_LOADED||m===F.FragmentState.PARTIAL)&&(b.sn==="initSegment"?this._loadInitSegment(b):c.live&&!Object(z.isFiniteNumber)(this.initPTS[b.cc])?(this.log("Waiting for video PTS in continuity counter "+b.cc+" of live stream before loading audio fragment "+b.sn+" of level "+this.trackId),this.state=N.State.WAITING_INIT_PTS):(this.startFragRequested=!0,O.prototype.loadFragment.call(this,b,c,y)))},E.completeAudioSwitch=function(){var b=this.hls,c=this.media,y=this.trackId;c&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,b.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:y})},S}(N.default);V.default=T},"./src/controller/audio-track-controller.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/events.ts"),N=D("./src/errors.ts"),M=D("./src/controller/base-playlist-controller.ts"),W=D("./src/types/loader.ts");function F(f,d){for(var s=0;s<d.length;s++){var u=d[s];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(f,u.key,u)}}function k(f,d,s){return d&&F(f.prototype,d),s&&F(f,s),f}function R(f,d){f.prototype=Object.create(d.prototype),f.prototype.constructor=f,g(f,d)}function g(f,d){return g=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},g(f,d)}var p=function(f){R(d,f);function d(u){var o;return o=f.call(this,u,"[audio-track-controller]")||this,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.trackName="",o.selectDefaultTrack=!0,o.registerListeners(),o}var s=d.prototype;return s.registerListeners=function(){var o=this.hls;o.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(z.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var o=this.hls;o.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(z.Events.ERROR,this.onError,this)},s.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,f.prototype.destroy.call(this)},s.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},s.onManifestParsed=function(o,a){this.tracks=a.audioTracks||[]},s.onAudioTrackLoaded=function(o,a){var l=a.id,h=a.details,A=this.tracksInGroup[l];if(!A){this.warn("Invalid audio track id "+l);return}var x=A.details;A.details=a.details,this.log("audioTrack "+l+" loaded ["+h.startSN+"-"+h.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,a,x))},s.onLevelLoading=function(o,a){this.switchLevel(a.level)},s.onLevelSwitching=function(o,a){this.switchLevel(a.level)},s.switchLevel=function(o){var a=this.hls.levels[o];if(!(a!=null&&a.audioGroupIds))return;var l=a.audioGroupIds[a.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 A={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,A),this.selectInitialTrack()}},s.onError=function(o,a){if(f.prototype.onError.call(this,o,a),a.fatal||!a.context)return;a.context.type===W.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},s.setAudioTrack=function(o){var a=this.tracksInGroup;if(o<0||o>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=a[this.trackId];this.log("Now switching to audio-track index "+o);var h=a[o],A=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(z.Events.AUDIO_TRACK_SWITCHING,{id:A,groupId:T,name:O,type:S,url:E}),h.details&&!h.details.live)return;var w=this.switchParams(h.url,l==null?void 0:l.details);this.loadPlaylist(w)},s.selectInitialTrack=function(){var o=this.tracksInGroup;console.assert(o.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,l=this.findTrackId(a)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},s.findTrackId=function(o){for(var a=this.tracksInGroup,l=0;l<a.length;l++){var h=a[l];if((!this.selectDefaultTrack||h.default)&&(!o||o===h.name))return h.id}return-1},s.loadPlaylist=function(o){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var l=a.id,h=a.groupId,A=a.url;if(o)try{A=o.addDirectives(A)}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(z.Events.AUDIO_TRACK_LOADING,{url:A,id:l,groupId:h,deliveryDirectives:o||null})}},k(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}(M.default);V.default=p},"./src/controller/base-playlist-controller.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return k});var z=D("./src/polyfills/number.ts"),N=D("./src/types/level.ts"),M=D("./src/controller/level-helper.ts"),W=D("./src/utils/logger.ts"),F=D("./src/errors.ts"),k=function(){function R(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=W.logger.log.bind(W.logger,f+":"),this.warn=W.logger.warn.bind(W.logger,f+":"),this.hls=p}var g=R.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(f,d){d.fatal&&d.type===F.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 s=d==null?void 0:d.renditionReports;if(s)for(var u=0;u<s.length;u++){var o=s[u],a=""+o.URI;if(a===f.substr(-a.length)){var l=parseInt(o["LAST-MSN"]),h=parseInt(o["LAST-PART"]);if(d&&this.hls.config.lowLatencyMode){var A=Math.min(d.age-d.partTarget,d.targetduration);h!==void 0&&A>d.partTarget&&(h+=1)}if(Object(z.isFiniteNumber)(l))return new N.HlsUrlParameters(l,Object(z.isFiniteNumber)(h)?h:void 0,N.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,s){var u=this,o=d.details,a=d.stats,l=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(o.advancedDateTime=Date.now()-l,o.live||s!=null&&s.live){if(o.reloaded(s),s&&this.log("live playlist "+f+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),s&&o.fragments.length>0&&Object(M.mergeDetails)(s,o),!this.canLoad||!o.live)return;var h,A=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,w=E!==-1,b=O===S,c=T?0:E;w?(A=b?S+1:O,x=b?c:E+1):A=S+1;var y=o.age,m=y+o.ageHeader,_=Math.min(m-o.partTarget,o.targetduration*1.5);if(_>0){if(s&&_>s.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+s.tuneInGoal+" to: "+_+" with playlist age: "+o.age),_=0;else{var P=Math.floor(_/o.targetduration);if(A+=P,x!==void 0){var I=Math.round(_%o.targetduration/o.partTarget);x+=I}this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+y.toFixed(2)+"s goal: "+_+" skip sn "+P+" to part "+x)}o.tuneInGoal=_}if(h=this.getDeliveryDirectives(o,d.deliveryDirectives,A,x),T||!b){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(o,d.deliveryDirectives,A,x);var B=Object(M.computeReloadInterval)(o,a);A!==void 0&&o.canBlockReload&&(B-=o.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return u.loadPlaylist(h)},B)}else this.clearTimer()},g.getDeliveryDirectives=function(f,d,s,u){var o=Object(N.getSkipValue)(f,s);return d!=null&&d.skip&&f.deltaUpdateFailed&&(s=d.msn,u=d.part,o=N.HlsSkip.No),new N.HlsUrlParameters(s,u,o)},g.retryLoadingOrFail=function(f){var d=this,s=this.hls.config,u=this.retryCount<s.levelLoadingMaxRetry;if(u){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 a=Math.min(Math.pow(2,this.retryCount)*s.levelLoadingRetryDelay,s.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return d.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+f.details+'"')}}else this.warn('cannot recover from error "'+f.details+'"'),this.clearTimer(),f.fatal=!0;return u},R}()},"./src/controller/base-stream-controller.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"State",function(){return S}),D.d(V,"default",function(){return E});var z=D("./src/polyfills/number.ts"),N=D("./src/task-loop.ts"),M=D("./src/controller/fragment-tracker.ts"),W=D("./src/utils/buffer-helper.ts"),F=D("./src/utils/logger.ts"),k=D("./src/events.ts"),R=D("./src/errors.ts"),g=D("./src/types/transmuxer.ts"),p=D("./src/utils/mp4-tools.ts"),f=D("./src/utils/discontinuities.ts"),d=D("./src/controller/fragment-finders.ts"),s=D("./src/controller/level-helper.ts"),u=D("./src/loader/fragment-loader.ts"),o=D("./src/crypt/decrypter.ts"),a=D("./src/utils/time-ranges.ts"),l=D("./src/types/loader.ts");function h(w,b){for(var c=0;c<b.length;c++){var y=b[c];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(w,y.key,y)}}function A(w,b,c){return b&&h(w.prototype,b),c&&h(w,c),w}function x(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function T(w,b){w.prototype=Object.create(b.prototype),w.prototype.constructor=w,O(w,b)}function O(w,b){return O=Object.setPrototypeOf||function(y,m){return y.__proto__=m,y},O(w,b)}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(w){T(b,w);function b(y,m,_){var P;return P=w.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=_,P.log=F.logger.log.bind(F.logger,_+":"),P.warn=F.logger.warn.bind(F.logger,_+":"),P.hls=y,P.fragmentLoader=new u.default(y.config),P.fragmentTracker=m,P.config=y.config,P.decrypter=new o.default(y,y.config),y.on(k.Events.KEY_LOADED,P.onKeyLoaded,x(P)),P}var c=b.prototype;return c.doTick=function(){this.onTickEnd()},c.onTickEnd=function(){},c.startLoad=function(m){},c.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},c._streamEnded=function(m,_){var P=this.fragCurrent,I=this.fragmentTracker;if(!_.live&&P&&P.sn===_.endSN&&!m.nextStart){var B=I.getState(P);return B===M.FragmentState.PARTIAL||B===M.FragmentState.OK}return!1},c.onMediaAttached=function(m,_){var P=this.media=this.mediaBuffer=_.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var I=this.config;this.levels&&I.autoStartLoad&&this.state===S.STOPPED&&this.startLoad(I.startPosition)},c.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()},c.onMediaSeeking=function(){var m=this.config,_=this.fragCurrent,P=this.media,I=this.mediaBuffer,B=this.state,U=P?P.currentTime:0,C=W.BufferHelper.bufferInfo(I||P,U,m.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(U)?U.toFixed(3):U)+", state: "+B),B===S.ENDED)this.resetLoadingState();else if(_&&!C.len){var v=m.maxFragLookUpTolerance,j=_.start-v,G=_.start+_.duration+v,J=U>G;(U<j||J)&&(J&&_.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),_.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=U),!this.loadedmetadata&&!C.len&&(this.nextLoadPosition=this.startPosition=U),this.tickImmediate()},c.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},c.onKeyLoaded=function(m,_){if(this.state!==S.KEY_LOADING||_.frag!==this.fragCurrent||!this.levels)return;this.state=S.IDLE;var P=this.levels[_.frag.level].details;P&&this.loadFragment(_.frag,P,_.frag.start)},c.onHandlerDestroying=function(){this.stopLoad(),w.prototype.onHandlerDestroying.call(this)},c.onHandlerDestroyed=function(){this.state=S.STOPPED,this.hls.off(k.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,w.prototype.onHandlerDestroyed.call(this)},c.loadKey=function(m,_){this.log("Loading key for "+m.sn+" of ["+_.startSN+"-"+_.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=S.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(k.Events.KEY_LOADING,{frag:m})},c.loadFragment=function(m,_,P){this._loadFragForPlayback(m,_,P)},c._loadFragForPlayback=function(m,_,P){var I=this,B=function(C){if(I.fragContextChanged(m)){I.warn("Fragment "+m.sn+(C.part?" p: "+C.part.index:"")+" of level "+m.level+" was dropped during download."),I.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,I._handleFragmentLoadProgress(C)};this._doFragLoad(m,_,P,B).then(function(U){if(!U)return;I.fragLoadError=0;var C=I.state;if(I.fragContextChanged(m)){(C===S.FRAG_LOADING||C===S.BACKTRACKING||!I.fragCurrent&&C===S.PARSING)&&(I.fragmentTracker.removeFragment(m),I.state=S.IDLE);return}if("payload"in U&&(I.log("Loaded fragment "+m.sn+" of level "+m.level),I.hls.trigger(k.Events.FRAG_LOADED,U),I.state===S.BACKTRACKING)){I.fragmentTracker.backtrack(m,U),I.resetFragmentLoading(m);return}I._handleFragmentLoadComplete(U)}).catch(function(U){I.warn(U),I.resetFragmentLoading(m)})},c.flushMainBuffer=function(m,_,P){if(P===void 0&&(P=null),!(m-_))return;var I={startOffset:m,endOffset:_,type:P};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,I)},c._loadInitSegment=function(m){var _=this;this._doFragLoad(m).then(function(P){if(!P||_.fragContextChanged(m)||!_.levels)throw new Error("init load aborted");return P}).then(function(P){var I=_.hls,B=P.payload,U=m.decryptdata;if(B&&B.byteLength>0&&U&&U.key&&U.iv&&U.method==="AES-128"){var C=self.performance.now();return _.decrypter.webCryptoDecrypt(new Uint8Array(B),U.key.buffer,U.iv.buffer).then(function(v){var j=self.performance.now();return I.trigger(k.Events.FRAG_DECRYPTED,{frag:m,payload:v,stats:{tstart:C,tdecrypt:j}}),P.payload=v,P})}return P}).then(function(P){var I=_.fragCurrent,B=_.hls,U=_.levels;if(!U)throw new Error("init load aborted, missing levels");var C=U[m.level].details;console.assert(C,"Level details are defined when init segment is loaded");var v=m.stats;_.state=S.IDLE,_.fragLoadError=0,m.data=new Uint8Array(P.payload),v.parsing.start=v.buffering.start=self.performance.now(),v.parsing.end=v.buffering.end=self.performance.now(),P.frag===I&&B.trigger(k.Events.FRAG_BUFFERED,{stats:v,frag:I,part:null,id:m.type}),_.tick()}).catch(function(P){_.warn(P),_.resetFragmentLoading(m)})},c.fragContextChanged=function(m){var _=this.fragCurrent;return!m||!_||m.level!==_.level||m.sn!==_.sn||m.urlId!==_.urlId},c.fragBufferedComplete=function(m,_){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(_?" part: "+_.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+a.default.toString(W.BufferHelper.getBuffered(P))),this.state=S.IDLE,this.tick()},c._handleFragmentLoadComplete=function(m){var _=this.transmuxer;if(!_)return;var P=m.frag,I=m.part,B=m.partsLoaded,U=!B||B.length===0||B.some(function(v){return!v}),C=new g.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,I?I.index:-1,!U);_.flush(C)},c._handleFragmentLoadProgress=function(m){},c._doFragLoad=function(m,_,P,I){var B=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&&_){var U=_.partList;if(U&&I){P>m.end&&_.fragmentHint&&(m=_.fragmentHint);var C=this.getNextPart(U,m,P);if(C>-1){var v=U[C];return this.log("Loading part sn: "+m.sn+" p: "+v.index+" cc: "+m.cc+" of playlist ["+_.startSN+"-"+_.endSN+"] parts [0-"+C+"-"+(U.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=v.start+v.duration,this.state=S.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,part:U[C],targetBufferTime:P}),this.doFragPartsLoad(m,U,C,I).catch(function(j){return B.handleFragLoadError(j)})}else if(!m.url||this.loadedEndOfParts(U,P))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(_?"of ["+_.startSN+"-"+_.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(P.toFixed(3))),Object(z.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=S.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,targetBufferTime:P}),this.fragmentLoader.load(m,I).catch(function(j){return B.handleFragLoadError(j)})},c.doFragPartsLoad=function(m,_,P,I){var B=this;return new Promise(function(U,C){var v=[],j=function G(J){var ee=_[J];B.fragmentLoader.loadPart(m,ee,I).then(function(ye){v[ee.index]=ye;var he=ye.part;B.hls.trigger(k.Events.FRAG_LOADED,ye);var ge=_[J+1];if(ge&&ge.fragment===m)G(J+1);else return U({frag:m,part:he,partsLoaded:v})}).catch(C)};j(P)})},c.handleFragLoadError=function(m){var _=m.data;return _&&_.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(_.frag,_.part):this.hls.trigger(k.Events.ERROR,_),null},c._handleTransmuxerFlush=function(m){var _=this.getCurrentContext(m);if(!_||this.state!==S.PARSING){this.fragCurrent||(this.state=S.IDLE);return}var P=_.frag,I=_.part,B=_.level,U=self.performance.now();P.stats.parsing.end=U,I&&(I.stats.parsing.end=U),this.updateLevelTiming(P,I,B,m.partial)},c.getCurrentContext=function(m){var _=this.levels,P=m.level,I=m.sn,B=m.part;if(!_||!_[P])return this.warn("Levels object was unset while buffering fragment "+I+" of level "+P+". The current chunk will not be buffered."),null;var U=_[P],C=B>-1?Object(s.getPartWith)(U,I,B):null,v=C?C.fragment:Object(s.getFragmentWithSN)(U,I,this.fragCurrent);return v?{frag:v,part:C,level:U}:null},c.bufferFragmentData=function(m,_,P,I){if(!m||this.state!==S.PARSING)return;var B=m.data1,U=m.data2,C=B;if(B&&U&&(C=Object(p.appendUint8Array)(B,U)),!C||!C.length)return;var v={type:m.type,frag:_,part:P,chunkMeta:I,parent:_.type,data:C};this.hls.trigger(k.Events.BUFFER_APPENDING,v),m.dropped&&m.independent&&!P&&this.flushBufferGap(_)},c.flushBufferGap=function(m){var _=this.media;if(!_)return;if(!W.BufferHelper.isBuffered(_,_.currentTime)){this.flushMainBuffer(0,m.start);return}var P=_.currentTime,I=W.BufferHelper.bufferInfo(_,P,0),B=m.duration,U=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),C=Math.max(Math.min(m.start-U,I.end-U),P+U);m.start-C>U&&this.flushMainBuffer(C,m.start)},c.getFwdBufferInfo=function(m,_){var P=this.config,I=this.getLoadPosition();if(!Object(z.isFiniteNumber)(I))return null;var B=W.BufferHelper.bufferInfo(m,I,P.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var U=this.fragmentTracker.getBufferedFrag(I,_);if(U&&B.nextStart<U.end)return W.BufferHelper.bufferInfo(m,I,Math.max(B.nextStart,P.maxBufferHole))}return B},c.getMaxBufferLength=function(m){var _=this.config,P;return m?P=Math.max(8*_.maxBufferSize/m,_.maxBufferLength):P=_.maxBufferLength,Math.min(P,_.maxMaxBufferLength)},c.reduceMaxBufferLength=function(m){var _=this.config,P=m||_.maxBufferLength;return _.maxMaxBufferLength>=P?(_.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+_.maxMaxBufferLength+"s"),!0):!1},c.getNextFragment=function(m,_){var P,I,B=_.fragments,U=B.length;if(!U)return null;var C=this.config,v=B[0].start,j;if(_.live){var G=C.initialLiveManifestSize;if(U<G)return this.warn("Not enough fragments to start playback (have: "+U+", need: "+G+")"),null;!_.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(j=this.getInitialLiveFragment(_,B),this.startPosition=j?this.hls.liveSyncPosition||j.start:m)}else m<=v&&(j=B[0]);if(!j){var J=C.lowLatencyMode?_.partEnd:_.fragmentEnd;j=this.getFragmentAtPosition(m,J,_)}return(P=j)!==null&&P!==void 0&&P.initSegment&&!((I=j)!==null&&I!==void 0&&I.initSegment.data)&&!this.bitrateTest&&(j=j.initSegment),j},c.getNextPart=function(m,_,P){for(var I=-1,B=!1,U=!0,C=0,v=m.length;C<v;C++){var j=m[C];if(U=U&&!j.independent,I>-1&&P<j.start)break;var G=j.loaded;!G&&(B||j.independent||U)&&j.fragment===_&&(I=C),B=G}return I},c.loadedEndOfParts=function(m,_){var P=m[m.length-1];return P&&_>P.start&&P.loaded},c.getInitialLiveFragment=function(m,_){var P=this.fragPrevious,I=null;if(P){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),I=Object(d.findFragmentByPDT)(_,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!I){var B=P.sn+1;if(B>=m.startSN&&B<=m.endSN){var U=_[B-m.startSN];P.cc===U.cc&&(I=U,this.log("Live playlist, switching playlist, load frag with next SN: "+I.sn))}I||(I=Object(d.findFragWithCC)(_,P.cc),I&&this.log("Live playlist, switching playlist, load frag with same CC: "+I.sn))}}else{var C=this.hls.liveSyncPosition;C!==null&&(I=this.getFragmentAtPosition(C,this.bitrateTest?m.fragmentEnd:m.edge,m))}return I},c.getFragmentAtPosition=function(m,_,P){var I=this.config,B=this.fragPrevious,U=P.fragments,C=P.endSN,v=P.fragmentHint,j=I.maxFragLookUpTolerance,G=!!(I.lowLatencyMode&&P.partList&&v);G&&v&&!this.bitrateTest&&(U=U.concat(v),C=v.sn);var J;if(m<_){var ee=m>_-j?0:j;J=Object(d.findFragmentByPTS)(B,U,m,ee)}else J=U[U.length-1];if(J){var ye=J.sn-P.startSN,he=B&&J.level===B.level,ge=U[ye+1],pe=this.fragmentTracker.getState(J);if(pe===M.FragmentState.BACKTRACKED){J=null;for(var oe=ye;U[oe]&&this.fragmentTracker.getState(U[oe])===M.FragmentState.BACKTRACKED;)B?J=U[oe--]:J=U[--oe];J||(J=ge)}else B&&J.sn===B.sn&&!G&&(he&&(J.sn<C&&this.fragmentTracker.getState(ge)!==M.FragmentState.OK?(this.log("SN "+J.sn+" just loaded, load next one: "+ge.sn),J=ge):J=null))}return J},c.synchronizeToLiveEdge=function(m){var _=this.config,P=this.media;if(!P)return;var I=this.hls.liveSyncPosition,B=P.currentTime,U=m.fragments[0].start,C=m.edge,v=B>=U-_.maxFragLookUpTolerance&&B<=C;if(I!==null&&P.duration>I&&(B<I||!v)){var j=_.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:_.liveMaxLatencyDurationCount*m.targetduration;(!v&&P.readyState<4||B<C-j)&&(this.loadedmetadata||(this.nextLoadPosition=I),P.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+C+", reset currentTime to : "+I.toFixed(3)),P.currentTime=I))}},c.alignPlaylists=function(m,_){var P=this.levels,I=this.levelLastLoaded,B=this.fragPrevious,U=I!==null?P[I]:null,C=m.fragments.length;if(!C)return this.warn("No fragments in live playlist"),0;var v=m.fragments[0].start,j=!_,G=m.alignedSliding&&Object(z.isFiniteNumber)(v);if(j||!G&&!v){Object(f.alignStream)(B,U,m);var J=m.fragments[0].start;return this.log("Live playlist sliding: "+J.toFixed(2)+" start-sn: "+(_?_.startSN:"na")+"->"+m.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+C),J}return v},c.waitForCdnTuneIn=function(m){var _=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*_)},c.setStartPosition=function(m,_){var P=this.startPosition;if(P<_&&(P=-1),P===-1||this.lastCurrentTime===-1){var I=m.startTimeOffset;Object(z.isFiniteNumber)(I)?(P=_+I,I<0&&(P+=m.totalduration),P=Math.min(Math.max(_,P),_+m.totalduration),this.log("Start time offset "+I+" found in playlist, adjust startPosition to "+P),this.startPosition=P):m.live?P=this.hls.liveSyncPosition||_:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},c.getLoadPosition=function(){var m=this.media,_=0;return this.loadedmetadata&&m?_=m.currentTime:this.nextLoadPosition&&(_=this.nextLoadPosition),_},c.handleFragLoadAborted=function(m,_){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(_?" part"+_.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},c.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=S.IDLE)},c.onFragmentOrKeyLoadError=function(m,_){if(_.fatal)return;var P=_.frag;if(!P||P.type!==m)return;var I=this.fragCurrent;console.assert(I&&P.sn===I.sn&&P.level===I.level&&P.urlId===I.urlId,"Frag load error must match current frag to retry");var B=this.config;if(this.fragLoadError+1<=B.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var U=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+m+" "+P.level+" failed to load, retrying in "+U+"ms"),this.retryDate=self.performance.now()+U,this.fragLoadError++,this.state=S.FRAG_LOADING_WAITING_RETRY}else _.levelRetry?(m===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=S.IDLE):(F.logger.error(_.details+" reaches max retry, redispatch as fatal ..."),_.fatal=!0,this.hls.stopLoad(),this.state=S.ERROR)},c.afterBufferFlushed=function(m,_,P){if(!m)return;var I=W.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(_,I,P),this.state===S.ENDED&&this.resetLoadingState()},c.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=S.IDLE},c.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var _=this.levels?this.levels[m].details:null;if(_!=null&&_.live)return this.startPosition=-1,this.setStartPosition(_,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},c.updateLevelTiming=function(m,_,P,I){var B=this,U=P.details;console.assert(!!U,"level.details must be defined");var C=Object.keys(m.elementaryStreams).reduce(function(v,j){var G=m.elementaryStreams[j];if(G){var J=G.endPTS-G.startPTS;if(J<=0)return B.warn("Could not parse fragment "+m.sn+" "+j+" duration reliably ("+J+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),v||!1;var ee=I?0:Object(s.updateFragPTSDTS)(U,m,G.startPTS,G.endPTS,G.startDTS,G.endDTS);return B.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:U,level:P,drift:ee,type:j,frag:m,start:G.startPTS,end:G.endPTS}),!0}return v},!1);C?(this.state=S.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:m,part:_})):this.resetLoadingState()},c.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},A(b,[{key:"state",get:function(){return this._state},set:function(m){var _=this._state;_!==m&&(this._state=m,this.log(_+"->"+m))}}]),b}(N.default)},"./src/controller/buffer-controller.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return d});var z=D("./src/polyfills/number.ts"),N=D("./src/events.ts"),M=D("./src/utils/logger.ts"),W=D("./src/errors.ts"),F=D("./src/utils/buffer-helper.ts"),k=D("./src/utils/mediasource-helper.ts"),R=D("./src/loader/fragment.ts"),g=D("./src/controller/buffer-operation-queue.ts"),p=Object(k.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,d=function(){function s(o){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=a.hls,h=a.media,A=a.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),h&&(a.updateMediaElementDuration(),l.trigger(N.Events.MEDIA_ATTACHED,{media:h})),A&&A.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=o,this._initSourceBuffer(),this.registerListeners()}var u=s.prototype;return u.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},u.destroy=function(){this.unregisterListeners(),this.details=null},u.registerListeners=function(){var a=this.hls;a.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(N.Events.BUFFER_RESET,this.onBufferReset,this),a.on(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(N.Events.BUFFER_EOS,this.onBufferEos,this),a.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(N.Events.FRAG_PARSED,this.onFragParsed,this),a.on(N.Events.FRAG_CHANGED,this.onFragChanged,this)},u.unregisterListeners=function(){var a=this.hls;a.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(N.Events.BUFFER_RESET,this.onBufferReset,this),a.off(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(N.Events.BUFFER_EOS,this.onBufferEos,this),a.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(N.Events.FRAG_PARSED,this.onFragParsed,this),a.off(N.Events.FRAG_CHANGED,this.onFragChanged,this)},u._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},u.onManifestParsed=function(a,l){var h=2;(l.audio&&!l.video||!l.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},u.onMediaAttaching=function(a,l){var h=this.media=l.media;if(h&&p){var A=this.mediaSource=new p;A.addEventListener("sourceopen",this._onMediaSourceOpen),A.addEventListener("sourceended",this._onMediaSourceEnded),A.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(A),this._objectUrl=h.src}},u.onMediaDetaching=function(){var a=this.media,l=this.mediaSource,h=this._objectUrl;if(l){if(M.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(A){M.logger.warn("[buffer-controller]: onMediaDetaching: "+A.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(h&&self.URL.revokeObjectURL(h),a.src===h?(a.removeAttribute("src"),a.load()):M.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(N.Events.MEDIA_DETACHED,void 0)},u.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(l){var h=a.sourceBuffer[l];try{h&&(a.removeBufferListeners(l),a.mediaSource&&a.mediaSource.removeSourceBuffer(h),a.sourceBuffer[l]=void 0)}catch(A){M.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",A)}}),this._initSourceBuffer()},u.onBufferCodecs=function(a,l){var h=this,A=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(x){if(A){var T=h.tracks[x];if(T&&typeof T.buffer.changeType=="function"){var O=l[x],S=O.codec,E=O.levelCodec,w=O.container,b=(T.levelCodec||T.codec).replace(f,"$1"),c=(E||S).replace(f,"$1");if(b!==c){var y=w+";codecs="+(E||S);h.appendChangeType(x,y)}}}else h.pendingTracks[x]=l[x]}),A)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},u.appendChangeType=function(a,l){var h=this,A=this.operationQueue,x={execute:function(){var O=h.sourceBuffer[a];O&&(M.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+l),O.changeType(l)),A.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(O){M.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",O)}};A.append(x,a)},u.onBufferAppending=function(a,l){var h=this,A=this.hls,x=this.operationQueue,T=this.tracks,O=l.data,S=l.type,E=l.frag,w=l.part,b=l.chunkMeta,c=b.buffering[S],y=self.performance.now();c.start=y;var m=E.stats.buffering,_=w?w.stats.buffering:null;m.start===0&&(m.start=y),_&&_.start===0&&(_.start=y);var P=T.audio,I=S==="audio"&&b.id===1&&(P==null?void 0:P.container)==="audio/mpeg",B={execute:function(){if(c.executeStart=self.performance.now(),I){var C=h.sourceBuffer[S];if(C){var v=E.start-C.timestampOffset;Math.abs(v)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+E.start+" (delta: "+v+") sn: "+E.sn+")"),C.timestampOffset=E.start)}}h.appendExecutor(O,S)},onStart:function(){},onComplete:function(){var C=self.performance.now();c.executeEnd=c.end=C,m.first===0&&(m.first=C),_&&_.first===0&&(_.first=C);var v=h.sourceBuffer,j={};for(var G in v)j[G]=F.BufferHelper.getBuffered(v[G]);h.appendError=0,h.hls.trigger(N.Events.BUFFER_APPENDED,{type:S,frag:E,part:w,chunkMeta:b,parent:E.type,timeRanges:j})},onError:function(C){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+S+" SourceBuffer",C);var v={type:W.ErrorTypes.MEDIA_ERROR,parent:E.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:C,fatal:!1};C.code===DOMException.QUOTA_EXCEEDED_ERR?v.details=W.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,v.details=W.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>A.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+A.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),v.fatal=!0)),A.trigger(N.Events.ERROR,v)}};x.append(B,S)},u.onBufferFlushing=function(a,l){var h=this,A=this.operationQueue,x=function(O){return{execute:h.removeExecutor.bind(h,O,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(N.Events.BUFFER_FLUSHED,{type:O})},onError:function(E){M.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",E)}}};l.type?A.append(x(l.type),l.type):this.getSourceBufferTypes().forEach(function(T){A.append(x(T),T)})},u.onFragParsed=function(a,l){var h=this,A=l.frag,x=l.part,T=[],O=x?x.elementaryStreams:A.elementaryStreams;O[R.ElementaryStreamTypes.AUDIOVIDEO]?T.push("audiovideo"):(O[R.ElementaryStreamTypes.AUDIO]&&T.push("audio"),O[R.ElementaryStreamTypes.VIDEO]&&T.push("video"));var S=function(){var w=self.performance.now();A.stats.buffering.end=w,x&&(x.stats.buffering.end=w);var b=x?x.stats:A.stats;h.hls.trigger(N.Events.FRAG_BUFFERED,{frag:A,part:x,stats:b,id:A.type})};T.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+A.type+" level: "+A.level+" sn: "+A.sn),this.blockBuffers(S,T)},u.onFragChanged=function(a,l){this.flushBackBuffer()},u.onBufferEos=function(a,l){var h=this,A=this.getSourceBufferTypes().reduce(function(x,T){var O=h.sourceBuffer[T];return(!l.type||l.type===T)&&(O&&!O.ended&&(O.ended=!0,M.logger.log("[buffer-controller]: "+T+" sourceBuffer now EOS"))),x&&!!(!O||O.ended)},!0);A&&this.blockBuffers(function(){var x=h.mediaSource;if(!x||x.readyState!=="open")return;x.endOfStream()})},u.onLevelUpdated=function(a,l){var h=l.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},u.flushBackBuffer=function(){var a=this.hls,l=this.details,h=this.media,A=this.sourceBuffer;if(!h||l===null)return;var x=this.getSourceBufferTypes();if(!x.length)return;var T=l.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(z.isFiniteNumber)(T)||T<0)return;var O=h.currentTime,S=l.levelTargetDuration,E=Math.max(T,S),w=Math.floor(O/S)*S-E;x.forEach(function(b){var c=A[b];if(c){var y=F.BufferHelper.getBuffered(c);y.length>0&&w>y.start(0)&&(a.trigger(N.Events.BACK_BUFFER_REACHED,{bufferEnd:w}),l.live&&a.trigger(N.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:w}),a.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:w,type:b}))}})},u.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,l=this.hls,h=this.media,A=this.mediaSource,x=a.fragments[0].start+a.totalduration,T=h.duration,O=Object(z.isFiniteNumber)(A.duration)?A.duration:0;a.live&&l.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),A.duration=Infinity,this.updateSeekableRange(a)):(x>O&&x>T||!Object(z.isFiniteNumber)(T))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+x.toFixed(3)),A.duration=x)},u.updateSeekableRange=function(a){var l=this.mediaSource,h=a.fragments,A=h.length;if(A&&a.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var x=Math.max(0,h[0].start),T=Math.max(x,x+a.totalduration);l.setLiveSeekableRange(x,T)}},u.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,l=this.operationQueue,h=this.pendingTracks,A=Object.keys(h).length;if(A&&!a||A===2){this.createSourceBuffers(h),this.pendingTracks={};var x=this.getSourceBufferTypes();if(x.length===0){this.hls.trigger(N.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.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)})}},u.createSourceBuffers=function(a){var l=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var A=0;for(var x in a)if(!l[x]){var T=a[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;M.logger.log("[buffer-controller]: creating sourceBuffer("+S+")");try{var E=l[x]=h.addSourceBuffer(S),w=x;this.addBufferListener(w,"updatestart",this._onSBUpdateStart),this.addBufferListener(w,"updateend",this._onSBUpdateEnd),this.addBufferListener(w,"error",this._onSBUpdateError),this.tracks[x]={buffer:E,codec:O,container:T.container,levelCodec:T.levelCodec,id:T.id},A++}catch(b){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+b.message),this.hls.trigger(N.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:b,mimeType:S})}}A&&this.hls.trigger(N.Events.BUFFER_CREATED,{tracks:this.tracks})},u._onSBUpdateStart=function(a){var l=this.operationQueue,h=l.current(a);h.onStart()},u._onSBUpdateEnd=function(a){var l=this.operationQueue,h=l.current(a);h.onComplete(),l.shiftAndExecuteNext(a)},u._onSBUpdateError=function(a,l){M.logger.error("[buffer-controller]: "+a+" SourceBuffer error",l),this.hls.trigger(N.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(a);h&&h.onError(l)},u.removeExecutor=function(a,l,h){var A=this.media,x=this.mediaSource,T=this.operationQueue,O=this.sourceBuffer,S=O[a];if(!A||!x||!S){M.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),T.shiftAndExecuteNext(a);return}var E=Object(z.isFiniteNumber)(A.duration)?A.duration:Infinity,w=Object(z.isFiniteNumber)(x.duration)?x.duration:Infinity,b=Math.max(0,l),c=Math.min(h,E,w);c>b?(M.logger.log("[buffer-controller]: Removing ["+b+","+c+"] from the "+a+" SourceBuffer"),console.assert(!S.updating,a+" sourceBuffer must not be updating"),S.remove(b,c)):T.shiftAndExecuteNext(a)},u.appendExecutor=function(a,l){var h=this.operationQueue,A=this.sourceBuffer,x=A[l];if(!x){M.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(a)},u.blockBuffers=function(a,l){var h=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var A=this.operationQueue,x=l.map(function(T){return A.appendBlocker(T)});Promise.all(x).then(function(){a(),l.forEach(function(T){var O=h.sourceBuffer[T];(!O||!O.updating)&&A.shiftAndExecuteNext(T)})})},u.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},u.addBufferListener=function(a,l,h){var A=this.sourceBuffer[a];if(!A)return;var x=h.bind(this,a);this.listeners[a].push({event:l,listener:x}),A.addEventListener(l,x)},u.removeBufferListeners=function(a){var l=this.sourceBuffer[a];if(!l)return;this.listeners[a].forEach(function(h){l.removeEventListener(h.event,h.listener)})},s}()},"./src/controller/buffer-operation-queue.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return N});var z=D("./src/utils/logger.ts"),N=function(){function M(F){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=F}var W=M.prototype;return W.append=function(k,R){var g=this.queues[R];g.push(k),g.length===1&&this.buffers[R]&&this.executeNext(R)},W.insertAbort=function(k,R){var g=this.queues[R];g.unshift(k),this.executeNext(R)},W.appendBlocker=function(k){var R,g=new Promise(function(f){R=f}),p={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,k),g},W.executeNext=function(k){var R=this.buffers,g=this.queues,p=R[k],f=g[k];if(f.length){var d=f[0];try{d.execute()}catch(s){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),d.onError(s),(!p||!p.updating)&&(f.shift(),this.executeNext(k))}}},W.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},W.current=function(k){return this.queues[k][0]},M}()},"./src/controller/cap-level-controller.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/events.ts");function N(F,k){for(var R=0;R<k.length;R++){var g=k[R];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(F,g.key,g)}}function M(F,k,R){return k&&N(F.prototype,k),R&&N(F,R),F}var W=function(){function F(R){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=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var k=F.prototype;return k.setStreamController=function(g){this.streamController=g},k.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},k.registerListeners=function(){var g=this.hls;g.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var g=this.hls;g.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(g,p){F.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},k.onMediaAttaching=function(g,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},k.onManifestParsed=function(g,p){var f=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},k.onBufferCodecs=function(g,p){var f=this.hls;f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.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}}},k.getMaxLevel=function(g){var p=this,f=this.hls.levels;if(!f.length)return-1;var d=f.filter(function(s,u){return F.isLevelAllowed(u,p.restrictedLevels)&&u<=g});return this.clientRect=null,F.getMaxLevelByMediaSize(d,this.mediaWidth,this.mediaHeight)},k.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()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.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},F.isLevelAllowed=function(g,p){return p===void 0&&(p=[]),p.indexOf(g)===-1},F.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},s=g.length-1,u=0;u<g.length;u+=1){var o=g[u];if((o.width>=p||o.height>=f)&&d(o,g[u+1])){s=u;break}}return s},M(F,[{key:"mediaWidth",get:function(){return this.getDimensions().width*F.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*F.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(p){}return g}}]),F}();V.default=W},"./src/controller/cmcd-controller.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return d});var z=D("./src/events.ts"),N=D("./src/types/cmcd.ts"),M=D("./src/utils/buffer-helper.ts"),W=D("./src/utils/logger.ts");function F(s,u){for(var o=0;o<u.length;o++){var a=u[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,a.key,a)}}function k(s,u,o){return u&&F(s.prototype,u),o&&F(s,o),s}function R(s,u){var o=typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(o)return(o=o.call(s)).next.bind(o);if(Array.isArray(s)||(o=g(s))||u&&s&&typeof s.length=="number"){o&&(s=o);var a=0;return function(){return a>=s.length?{done:!0}:{done:!1,value:s[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g(s,u){if(!s)return;if(typeof s=="string")return p(s,u);var o=Object.prototype.toString.call(s).slice(8,-1);if(o==="Object"&&s.constructor&&(o=s.constructor.name),o==="Map"||o==="Set")return Array.from(s);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return p(s,u)}function p(s,u){(u==null||u>s.length)&&(u=s.length);for(var o=0,a=new Array(u);o<u;o++)a[o]=s[o];return a}function f(){return f=Object.assign||function(s){for(var u=1;u<arguments.length;u++){var o=arguments[u];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(s[a]=o[a])}return s},f.apply(this,arguments)}var d=function(){function s(o){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(A){try{a.apply(A,{ot:N.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(x){W.logger.warn("Could not generate manifest CMCD data.",x)}},this.applyFragmentData=function(A){try{var x=A.frag,T=a.hls.levels[x.level],O=a.getObjectType(x),S={d:x.duration*1e3,ot:O};(O===N.CMCDObjectType.VIDEO||O===N.CMCDObjectType.AUDIO||O==N.CMCDObjectType.MUXED)&&(S.br=T.bitrate/1e3,S.tb=a.getTopBandwidth(O),S.bl=a.getBufferLength(O)),a.apply(A,S)}catch(E){W.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||s.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var u=s.prototype;return u.registerListeners=function(){var a=this.hls;a.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},u.unregisterListeners=function(){var a=this.hls;a.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},u.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},u.onMediaAttached=function(a,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},u.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},u.onBufferCreated=function(a,l){var h,A;this.audioBuffer=(h=l.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(A=l.tracks.video)===null||A===void 0?void 0:A.buffer},u.createData=function(){var a;return{v:N.CMCDVersion,sf:N.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},u.apply=function(a,l){l===void 0&&(l={}),f(l,this.createData());var h=l.ot===N.CMCDObjectType.INIT||l.ot===N.CMCDObjectType.VIDEO||l.ot===N.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 A=s.toHeaders(l);if(!Object.keys(A).length)return;a.headers||(a.headers={}),f(a.headers,A)}else{var x=s.toQuery(l);if(!x)return;a.url=s.appendQueryToUri(a.url,x)}},u.getObjectType=function(a){var l=a.type;return l==="subtitle"?N.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?N.CMCDObjectType.INIT:l==="audio"?N.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?N.CMCDObjectType.VIDEO:N.CMCDObjectType.MUXED:void 0},u.getTopBandwidth=function(a){for(var l=0,h=a===N.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,A=R(h),x;!(x=A()).done;){var T=x.value;T.bitrate>l&&(l=T.bitrate)}return l>0?l:NaN},u.getBufferLength=function(a){var l=this.hls.media,h=a===N.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!l)return NaN;var A=M.BufferHelper.bufferInfo(h,l.currentTime,this.config.maxBufferHole);return A.len*1e3},u.createPlaylistLoader=function(){var a=this.config.pLoader,l=this.applyPlaylistData,h=a||this.config.loader;return function(){function A(T){this.loader=void 0,this.loader=new h(T)}var x=A.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)},k(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},u.createFragmentLoader=function(){var a=this.config.fLoader,l=this.applyFragmentData,h=a||this.config.loader;return function(){function A(T){this.loader=void 0,this.loader=new h(T)}var x=A.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)},k(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},s.uuid=function(){var a=URL.createObjectURL(new Blob),l=a.toString();return URL.revokeObjectURL(a),l.substr(l.lastIndexOf("/")+1)},s.serialize=function(a){for(var l=[],h=function(I){return!Number.isNaN(I)&&I!=null&&I!==""&&I!==!1},A=function(I){return Math.round(I)},x=function(I){return A(I/100)*100},T=function(I){return encodeURIComponent(I)},O={br:A,d:A,bl:x,dl:x,mtp:x,nor:T,rtp:x,tb:A},S=Object.keys(a||{}).sort(),E=R(S),w;!(w=E()).done;){var b=w.value,c=a[b];if(!h(c))continue;if(b==="v"&&c===1)continue;if(b=="pr"&&c===1)continue;var y=O[b];y&&(c=y(c));var m=typeof c,_=void 0;b==="ot"||b==="sf"||b==="st"?_=b+"="+c:m==="boolean"?_=b:m==="number"?_=b+"="+c:_=b+"="+JSON.stringify(c),l.push(_)}return l.join(",")},s.toHeaders=function(a){for(var l=Object.keys(a),h={},A=["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],w=T[E]!=null?T[E]:1;x[w][E]=a[E]}for(var b=0;b<x.length;b++){var c=s.serialize(x[b]);c&&(h["CMCD-"+A[b]]=c)}return h},s.toQuery=function(a){return"CMCD="+encodeURIComponent(s.serialize(a))},s.appendQueryToUri=function(a,l){if(!l)return a;var h=a.includes("?")?"&":"?";return""+a+h+l},s}()},"./src/controller/eme-controller.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/events.ts"),N=D("./src/errors.ts"),M=D("./src/utils/logger.ts"),W=D("./src/utils/mediakeys-helper.ts");function F(d,s){for(var u=0;u<s.length;u++){var o=s[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(d,o.key,o)}}function k(d,s,u){return s&&F(d.prototype,s),u&&F(d,u),d}var R=3,g=function(s,u,o){var a={audioCapabilities:[],videoCapabilities:[]};return s.forEach(function(l){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:o.audioRobustness||""})}),u.forEach(function(l){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:o.videoRobustness||""})}),[a]},p=function(s,u,o,a){switch(s){case W.KeySystems.WIDEVINE:return g(u,o,a);default:throw new Error("Unknown key-system: "+s)}},f=function(){function d(u){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=u,this._config=u.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var s=d.prototype;return s.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},s._registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},s._unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},s.getLicenseServerUrl=function(o){switch(o){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+o+'"')},s._attemptKeySystemAccess=function(o,a,l){var h=this,A=p(o,a,l,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var x=this.requestMediaKeySystemAccess(o,A);this.mediaKeysPromise=x.then(function(T){return h._onMediaKeySystemAccessObtained(o,T)}),x.catch(function(T){M.logger.error('Failed to obtain key-system "'+o+'" access:',T)})},s._onMediaKeySystemAccessObtained=function(o,a){var l=this;M.logger.log('Access for key-system "'+o+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:o};this._mediaKeysList.push(h);var A=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(x){return h.mediaKeys=x,M.logger.log('Media-keys created for key-system "'+o+'"'),l._onMediaKeysCreated(),x});return A.catch(function(x){M.logger.error("Failed to create media-keys:",x)}),A},s._onMediaKeysCreated=function(){var o=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),o._onNewMediaKeySession(a.mediaKeysSession))})},s._onNewMediaKeySession=function(o){var a=this;M.logger.log("New key-system session "+o.sessionId),o.addEventListener("message",function(l){a._onKeySessionMessage(o,l.message)},!1)},s._onKeySessionMessage=function(o,a){M.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(l){M.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),o.update(l)})},s.onMediaEncrypted=function(o){var a=this;if(M.logger.log('Media is encrypted using "'+o.initDataType+'" init data type'),!this.mediaKeysPromise){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(A){if(!a._media)return;a._attemptSetMediaKeys(A),a._generateRequestWithPreferredKeySession(o.initDataType,o.initData)};this.mediaKeysPromise.then(l).catch(l)},s._attemptSetMediaKeys=function(o){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},s._generateRequestWithPreferredKeySession=function(o,a){var l=this,h=this._mediaKeysList[0];if(!h){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var A=h.mediaKeysSession;if(!A){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+o+'" init data type'),h.mediaKeysSessionInitialized=!0,A.generateRequest(o,a).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(x){M.logger.error("Error generating key-session request:",x),l.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},s._createLicenseXhr=function(o,a,l){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,o,a,l);var A=this._licenseXhrSetup;if(A)try{A.call(this.hls,h,o),A=void 0}catch(x){M.logger.error(x)}try{h.readyState||h.open("POST",o,!0),A&&A.call(this.hls,h,o)}catch(x){throw new Error("issue setting up KeySystem license XHR "+x)}return h},s._onLicenseRequestReadyStageChange=function(o,a,l,h){switch(o.readyState){case 4:if(o.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var A=o.response,x=this._licenseResponseCallback;if(x)try{A=x.call(this.hls,o,a)}catch(O){M.logger.error(O)}h(A)}else{if(M.logger.error("License Request XHR failed ("+a+"). Status: "+o.status+" ("+o.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var T=R-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+T+" attempts left"),this._requestLicense(l,h)}break}},s._generateLicenseRequestChallenge=function(o,a){switch(o.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+o.mediaKeySystemDomain)},s._requestLicense=function(o,a){M.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){M.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(l.mediaKeySystemDomain),A=this._createLicenseXhr(h,o,a);M.logger.log("Sending license request to URL: "+h);var x=this._generateLicenseRequestChallenge(l,o);A.send(x)}catch(T){M.logger.error("Failure requesting DRM license: "+T),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},s.onMediaAttached=function(o,a){if(!this._emeEnabled)return;var l=a.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},s.onMediaDetached=function(){var o=this._media,a=this._mediaKeysList;if(!o)return;o.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return o.setMediaKeys(null)}).catch(function(){})},s.onManifestParsed=function(o,a){if(!this._emeEnabled)return;var l=a.levels.map(function(A){return A.audioCodec}).filter(function(A){return!!A}),h=a.levels.map(function(A){return A.videoCodec}).filter(function(A){return!!A});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,l,h)},k(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(ae,V,D){"use strict";D.r(V);var z=D("./src/events.ts"),N=D("./src/utils/logger.ts"),M=function(){function W(k){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=k,this.registerListeners()}var F=W.prototype;return F.setStreamController=function(R){this.streamController=R},F.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},F.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},F.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},F.onMediaAttaching=function(R,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)}},F.checkFPS=function(R,g,p){var f=performance.now();if(g){if(this.lastTime){var d=f-this.lastTime,s=p-this.lastDroppedFrames,u=g-this.lastDecodedFrames,o=1e3*s/d,a=this.hls;if(a.trigger(z.Events.FPS_DROP,{currentDropped:s,currentDecoded:u,totalDroppedFrames:p}),o>0&&s>a.config.fpsDroppedMonitoringThreshold*u){var l=a.currentLevel;N.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=l)&&(l=l-1,a.trigger(z.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:a.currentLevel}),a.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=f,this.lastDroppedFrames=p,this.lastDecodedFrames=g}},F.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var g=R.getVideoPlaybackQuality();this.checkFPS(R,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},W}();V.default=M},"./src/controller/fragment-finders.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"findFragmentByPDT",function(){return M}),D.d(V,"findFragmentByPTS",function(){return W}),D.d(V,"fragmentWithinToleranceTest",function(){return F}),D.d(V,"pdtWithinToleranceTest",function(){return k}),D.d(V,"findFragWithCC",function(){return R});var z=D("./src/polyfills/number.ts"),N=D("./src/utils/binary-search.ts");function M(g,p,f){if(p===null||!Array.isArray(g)||!g.length||!Object(z.isFiniteNumber)(p))return null;var d=g[0].programDateTime;if(p<(d||0))return null;var s=g[g.length-1].endProgramDateTime;if(p>=(s||0))return null;f=f||0;for(var u=0;u<g.length;++u){var o=g[u];if(k(p,f,o))return o}return null}function W(g,p,f,d){f===void 0&&(f=0),d===void 0&&(d=0);var s=null;if(g?s=p[g.sn-p[0].sn+1]||null:f===0&&p[0].start===0&&(s=p[0]),s&&F(f,d,s)===0)return s;var u=N.default.search(p,F.bind(null,f,d));return u||s}function F(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 k(g,p,f){var d=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0))*1e3,s=f.endProgramDateTime||0;return s-d>g}function R(g,p){return N.default.search(g,function(f){return f.cc<p?1:f.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"FragmentState",function(){return M}),D.d(V,"FragmentTracker",function(){return W});var z=D("./src/events.ts"),N=D("./src/types/loader.ts"),M;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(M||(M={}));var W=function(){function R(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=R.prototype;return g._registerListeners=function(){var f=this.hls;f.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var f=this.hls;f.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(f,d){if(d===N.PlaylistLevelType.MAIN){var s=this.activeFragment,u=this.activeParts;if(!s)return null;if(u)for(var o=u.length;o--;){var a=u[o],l=a?a.end:s.appendedPTS;if(a.start<=f&&l!==void 0&&f<=l)return o>9&&(this.activeParts=u.slice(o-9)),a}else if(s.start<=f&&s.appendedPTS!==void 0&&f<=s.appendedPTS)return s}return this.getBufferedFrag(f,d)},g.getBufferedFrag=function(f,d){for(var s=this.fragments,u=Object.keys(s),o=u.length;o--;){var a=s[u[o]];if((a==null?void 0:a.body.type)===d&&a.buffered){var l=a.body;if(l.start<=f&&f<=l.end)return l}}return null},g.detectEvictedFragments=function(f,d,s){var u=this;Object.keys(this.fragments).forEach(function(o){var a=u.fragments[o];if(!a)return;if(!a.buffered){a.body.type===s&&u.removeFragment(a.body);return}var l=a.range[f];if(!l)return;l.time.some(function(h){var A=!u.isTimeBuffered(h.startPTS,h.endPTS,d);return A&&u.removeFragment(a.body),A})})},g.detectPartialFragments=function(f){var d=this,s=this.timeRanges,u=f.frag,o=f.part;if(!s||u.sn==="initSegment")return;var a=k(u),l=this.fragments[a];if(!l)return;Object.keys(s).forEach(function(h){var A=u.elementaryStreams[h];if(!A)return;var x=s[h],T=o!==null||A.partial===!0;l.range[h]=d.getBufferedTimes(u,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=k(f),s=this.fragments[d];s&&(s.backtrack=s.loaded=null,s.buffered=!0)},g.getBufferedTimes=function(f,d,s,u){for(var o={time:[],partial:s},a=d?d.start:f.start,l=d?d.end:f.end,h=f.minEndPTS||l,A=f.maxStartPTS||a,x=0;x<u.length;x++){var T=u.start(x)-this.bufferPadding,O=u.end(x)+this.bufferPadding;if(A>=T&&h<=O){o.time.push({startPTS:Math.max(a,u.start(x)),endPTS:Math.min(l,u.end(x))});break}else if(a<O&&l>T)o.partial=!0,o.time.push({startPTS:Math.max(a,u.start(x)),endPTS:Math.min(l,u.end(x))});else if(l<=T)break}return o},g.getPartialFragment=function(f){var d=null,s,u,o,a=0,l=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(A){var x=h[A];if(!x)return;F(x)&&(u=x.body.start-l,o=x.body.end+l,f>=u&&f<=o&&(s=Math.min(f-u,o-f),a<=s&&(d=x.body,a=s)))}),d},g.getState=function(f){var d=k(f),s=this.fragments[d];return s?s.buffered?F(s)?M.PARTIAL:M.OK:s.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},g.backtrack=function(f,d){var s=k(f),u=this.fragments[s];if(!u||u.backtrack)return null;var o=u.backtrack=d||u.loaded;return u.loaded=null,o},g.getBacktrackData=function(f){var d=k(f),s=this.fragments[d];if(s){var u,o=s.backtrack;if(o!=null&&(u=o.payload)!==null&&u!==void 0&&u.byteLength)return o;this.removeFragment(f)}return null},g.isTimeBuffered=function(f,d,s){for(var u,o,a=0;a<s.length;a++){if(u=s.start(a)-this.bufferPadding,o=s.end(a)+this.bufferPadding,f>=u&&d<=o)return!0;if(d<=u)return!1}return!1},g.onFragLoaded=function(f,d){var s=d.frag,u=d.part;if(s.sn==="initSegment"||s.bitrateTest||u)return;var o=k(s);this.fragments[o]={body:s,loaded:d,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(f,d){var s=this,u=d.frag,o=d.part,a=d.timeRanges;if(u.type===N.PlaylistLevelType.MAIN)if(this.activeFragment=u,o){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(o)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(h){var A=a[h];if(s.detectEvictedFragments(h,A),!o)for(var x=0;x<A.length;x++)u.appendedPTS=Math.max(A.end(x),u.appendedPTS||0)})},g.onFragBuffered=function(f,d){this.detectPartialFragments(d)},g.hasFragment=function(f){var d=k(f);return!!this.fragments[d]},g.removeFragmentsInRange=function(f,d,s){var u=this;Object.keys(this.fragments).forEach(function(o){var a=u.fragments[o];if(!a)return;if(a.buffered){var l=a.body;l.type===s&&l.start<d&&l.end>f&&u.removeFragment(l)}})},g.removeFragment=function(f){var d=k(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},R}();function F(R){var g,p;return R.buffered&&(((g=R.range.video)===null||g===void 0?void 0:g.partial)||((p=R.range.audio)===null||p===void 0?void 0:p.partial))}function k(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"STALL_MINIMUM_DURATION_MS",function(){return F}),D.d(V,"MAX_START_GAP_JUMP",function(){return k}),D.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),D.d(V,"SKIP_BUFFER_RANGE_START",function(){return g}),D.d(V,"default",function(){return p});var z=D("./src/utils/buffer-helper.ts"),N=D("./src/errors.ts"),M=D("./src/events.ts"),W=D("./src/utils/logger.ts"),F=250,k=2,R=.1,g=.05,p=function(){function f(s,u,o,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=s,this.media=u,this.fragmentTracker=o,this.hls=a}var d=f.prototype;return d.destroy=function(){this.hls=this.fragmentTracker=this.media=null},d.poll=function(u){var o=this.config,a=this.media,l=this.stalled,h=a.currentTime,A=a.seeking,x=this.seeking&&!A,T=!this.seeking&&A;if(this.seeking=A,h!==u){if(this.moved=!0,l!==null){if(this.stallReported){var O=self.performance.now()-l;W.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),a.paused||a.ended||a.playbackRate===0||!z.BufferHelper.getBuffered(a).length)return;var S=z.BufferHelper.bufferInfo(a,h,0),E=S.len>0,w=S.nextStart||0;if(!E&&!w)return;if(A){var b=S.len>k,c=!w||w-h>k&&!this.fragmentTracker.getPartialFragment(h);if(b||c)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var y,m=Math.max(w,S.start||0)-h,_=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=_==null||((y=_.details)===null||y===void 0)?void 0:y.live,I=P?_.details.targetduration*2:k;if(m>0&&m<=I){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(l===null){this.stalled=B;return}var U=B-l;!A&&U>=F&&this._reportStall(S.len);var C=z.BufferHelper.bufferInfo(a,h,o.maxBufferHole);this._tryFixBufferStall(C,U)},d._tryFixBufferStall=function(u,o){var a=this.config,l=this.fragmentTracker,h=this.media,A=h.currentTime,x=l.getPartialFragment(A);if(x){var T=this._trySkipBufferHole(x);if(T)return}u.len>a.maxBufferHole&&o>a.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},d._reportStall=function(u){var o=this.hls,a=this.media,l=this.stallReported;l||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+u+")"),o.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:u}))},d._trySkipBufferHole=function(u){for(var o=this.config,a=this.hls,l=this.media,h=l.currentTime,A=0,x=z.BufferHelper.getBuffered(l),T=0;T<x.length;T++){var O=x.start(T);if(h+o.maxBufferHole>=A&&h<O){var S=Math.max(O+g,l.currentTime+R);return W.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+S),this.moved=!0,this.stalled=null,l.currentTime=S,u&&a.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+S,frag:u}),S}A=x.end(T)}return 0},d._tryNudgeBuffer=function(){var u=this.config,o=this.hls,a=this.media,l=a.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<u.nudgeMaxRetry){var A=l+h*u.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+l+" to "+A),a.currentTime=A,o.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else W.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+u.nudgeMaxRetry+" nudges"),o.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},f}()},"./src/controller/id3-track-controller.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/events.ts"),N=D("./src/utils/texttrack-utils.ts"),M=D("./src/demux/id3.ts"),W=.25,F=function(){function k(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var R=k.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var p=this.hls;p.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var p=this.hls;p.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(p,f){this.media=f.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(N.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.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(N.sendAddTrackEvent)(d,this.media),d}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(p,f){if(!this.media)return;var d=f.frag,s=f.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var u=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,o=0;o<s.length;o++){var a=M.getID3Frames(s[o].data);if(a){var l=s[o].pts,h=o<s.length-1?s[o+1].pts:d.end,A=h-l;A<=0&&(h=l+W);for(var x=0;x<a.length;x++){var T=a[x];if(!M.isTimeStampFrame(T)){var O=new u(l,h,"");O.value=T,this.id3Track.addCue(O)}}}}},R.onBufferFlushing=function(p,f){var d=f.startOffset,s=f.endOffset,u=f.type;if(!u||u==="audio"){var o=this.id3Track;o&&Object(N.removeCuesInRange)(o,d,s)}},k}();V.default=F},"./src/controller/latency-controller.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return k});var z=D("./src/errors.ts"),N=D("./src/events.ts"),M=D("./src/utils/logger.ts");function W(R,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(R,f.key,f)}}function F(R,g,p){return g&&W(R.prototype,g),p&&W(R,p),R}var k=function(){function R(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=R.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(N.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(N.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(N.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 s=d.details;this.levelDetails=s,s.advanced&&this.timeupdate(),!s.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(f,d){if(d.details!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.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 s=this.computeLatency();if(s===null)return;this._latency=s;var u=this.config,o=u.lowLatencyMode,a=u.maxLiveSyncPlaybackRate;if(!o||a===1)return;var l=this.targetLatency;if(l===null)return;var h=s-l,A=Math.min(this.maxLatency,l+d.targetduration),x=h<A;if(d.live&&x&&h>.05&&this.forwardBufferLength>1){var T=Math.min(2,Math.max(1,a)),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},F(R,[{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,s=f.partHoldBack,u=f.targetduration,o=this.config,a=o.liveSyncDuration,l=o.liveSyncDurationCount,h=o.lowLatencyMode,A=this.hls.userConfig,x=h&&s||d;(A.liveSyncDuration||A.liveSyncDurationCount||x===0)&&(x=a!==void 0?a:l*u);var T=u,O=1;return x+Math.min(this.stallCount*O,T)}},{key:"liveSyncPosition",get:function(){var f=this.estimateLiveEdge(),d=this.targetLatency,s=this.levelDetails;if(f===null||d===null||s===null)return null;var u=s.edge,o=f-d-this.edgeStalled,a=u-s.totalduration,l=u-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(a,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 s=f.buffered.length;return s?f.buffered.end(s-1):d.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return o});var z=D("./src/types/level.ts"),N=D("./src/events.ts"),M=D("./src/errors.ts"),W=D("./src/utils/codecs.ts"),F=D("./src/controller/level-helper.ts"),k=D("./src/controller/base-playlist-controller.ts"),R=D("./src/types/loader.ts");function g(){return g=Object.assign||function(a){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var A in h)Object.prototype.hasOwnProperty.call(h,A)&&(a[A]=h[A])}return a},g.apply(this,arguments)}function p(a,l){for(var h=0;h<l.length;h++){var A=l[h];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(a,A.key,A)}}function f(a,l,h){return l&&p(a.prototype,l),h&&p(a,h),a}function d(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,s(a,l)}function s(a,l){return s=Object.setPrototypeOf||function(A,x){return A.__proto__=x,A},s(a,l)}var u=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),o=function(a){d(l,a);function l(A){var x;return x=a.call(this,A,"[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(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),x.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),x.on(N.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var x=this.hls;x.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),x.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),x.off(N.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},h.startLoad=function(){var x=this._levels;x.forEach(function(T){T.loadError=0}),a.prototype.startLoad.call(this)},h.onManifestLoaded=function(x,T){var O=[],S=[],E=[],w,b={},c,y=!1,m=!1,_=!1;if(T.levels.forEach(function(U){var C=U.attrs;y=y||!!(U.width&&U.height),m=m||!!U.videoCodec,_=_||!!U.audioCodec,u&&U.audioCodec&&U.audioCodec.indexOf("mp4a.40.34")!==-1&&(U.audioCodec=void 0);var v=U.bitrate+"-"+U.attrs.RESOLUTION+"-"+U.attrs.CODECS;c=b[v],c?c.url.push(U.url):(c=new z.Level(U),b[v]=c,O.push(c)),C&&(C.AUDIO&&Object(F.addGroupId)(c,"audio",C.AUDIO),C.SUBTITLES&&Object(F.addGroupId)(c,"text",C.SUBTITLES))}),(y||m)&&_&&(O=O.filter(function(U){var C=U.videoCodec,v=U.width,j=U.height;return!!C||!!(v&&j)})),O=O.filter(function(U){var C=U.audioCodec,v=U.videoCodec;return(!C||Object(W.isCodecSupportedInMp4)(C,"audio"))&&(!v||Object(W.isCodecSupportedInMp4)(v,"video"))}),T.audioTracks&&(S=T.audioTracks.filter(function(U){return!U.audioCodec||Object(W.isCodecSupportedInMp4)(U.audioCodec,"audio")}),Object(F.assignTrackIdsByGroup)(S)),T.subtitles&&(E=T.subtitles,Object(F.assignTrackIdsByGroup)(E)),O.length>0){w=O[0].bitrate,O.sort(function(U,C){return U.bitrate-C.bitrate}),this._levels=O;for(var P=0;P<O.length;P++)if(O[P].bitrate===w){this._firstLevel=P,this.log("manifest loaded, "+O.length+" level(s) found, first bitrate: "+w);break}var I=_&&!m,B={levels:O,audioTracks:S,subtitleTracks:E,firstLevel:this._firstLevel,stats:T.stats,audio:_,video:m,altAudio:!I&&S.some(function(U){return!!U.url})};this.hls.trigger(N.Events.MANIFEST_PARSED,B),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(N.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.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(a.prototype.onError.call(this,x,T),T.fatal)return;var O=T.context,S=this._levels[this.currentLevelIndex];if(O&&(O.type===R.PlaylistContextType.AUDIO_TRACK&&S.audioGroupIds&&O.groupId===S.audioGroupIds[S.urlId]||O.type===R.PlaylistContextType.SUBTITLE_TRACK&&S.textGroupIds&&O.groupId===S.textGroupIds[S.urlId])){this.redundantFailover(this.currentLevelIndex);return}var E=!1,w=!0,b;switch(T.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(T.frag){var c=this._levels[T.frag.level];c?(c.fragmentError++,c.fragmentError>this.hls.config.fragLoadingMaxRetry&&(b=T.frag.level)):b=T.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(w=!1),b=O.level),E=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:b=T.level,E=!0;break}b!==void 0&&this.recoverLevel(T,b,E,w)},h.recoverLevel=function(x,T,O,S){var E=x.details,w=this._levels[T];if(w.loadError++,O){var b=this.retryLoadingOrFail(x);if(b)x.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(S){var c=w.url.length;if(c>1&&w.loadError<c)x.levelRetry=!0,this.redundantFailover(T);else if(this.manualLevelIndex===-1){var y=T===0?this._levels.length-1:T-1;this.currentLevelIndex!==y&&this._levels[y].loadError===0&&(this.warn(E+": switch to "+y),x.levelRetry=!0,this.hls.nextAutoLevel=y)}}},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===R.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,w=this._levels[S];if(!w){var b;this.warn("Invalid level index "+S),(b=T.deliveryDirectives)!==null&&b!==void 0&&b.skip&&(E.deltaUpdateFailed=!0);return}S===this.currentLevelIndex?(w.fragmentError===0&&(w.loadError=0,this.retryCount=0),this.playlistLoaded(S,T,w.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,w=0;w<O.audioGroupIds.length;w++)if(O.audioGroupIds[w]===E){S=w;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(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}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(N.Events.LEVEL_LOADING,{url:E,level:T,id:S,deliveryDirectives:x||null})}},h.removeLevel=function(x,T){var O=function(w,b){return b!==T},S=this._levels.filter(function(E,w){return w!==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,w){var b=E.details;return b!=null&&b.fragments&&b.fragments.forEach(function(c){c.level=w}),E});this._levels=S,this.hls.trigger(N.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(N.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.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,w=O[E],b=O[x];this.log("switching to level "+x+" from "+E),this.currentLevelIndex=x;var c=g({},b,{level:x,maxBitrate:b.maxBitrate,uri:b.uri,urlId:b.urlId});delete c._urlId,this.hls.trigger(N.Events.LEVEL_SWITCHING,c);var y=b.details;if(!y||y.live){var m=this.switchParams(b.uri,w==null?void 0:w.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}(k.default)},"./src/controller/level-helper.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"addGroupId",function(){return M}),D.d(V,"assignTrackIdsByGroup",function(){return W}),D.d(V,"updatePTS",function(){return F}),D.d(V,"updateFragPTSDTS",function(){return R}),D.d(V,"mergeDetails",function(){return g}),D.d(V,"mapPartIntersection",function(){return p}),D.d(V,"mapFragmentIntersection",function(){return f}),D.d(V,"adjustSliding",function(){return d}),D.d(V,"addSliding",function(){return s}),D.d(V,"computeReloadInterval",function(){return u}),D.d(V,"getFragmentWithSN",function(){return o}),D.d(V,"getPartWith",function(){return a});var z=D("./src/polyfills/number.ts"),N=D("./src/utils/logger.ts");function M(l,h,A){switch(h){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(A);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(A);break}}function W(l){var h={};l.forEach(function(A){var x=A.groupId||"";A.id=h[x]=h[x]||0,h[x]++})}function F(l,h,A){var x=l[h],T=l[A];k(x,T)}function k(l,h){var A=h.startPTS;if(Object(z.isFiniteNumber)(A)){var x=0,T;h.sn>l.sn?(x=A-l.start,T=l):(x=l.start-A,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 R(l,h,A,x,T,O){var S=x-A;S<=0&&(N.logger.warn("Fragment should have a positive duration",h),x=A+h.duration,O=T+h.duration);var E=A,w=x,b=h.startPTS,c=h.endPTS;if(Object(z.isFiniteNumber)(b)){var y=Math.abs(b-A);Object(z.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(y,h.deltaPTS):h.deltaPTS=y,E=Math.max(A,b),A=Math.min(A,b),T=Math.min(T,h.startDTS),w=Math.min(x,c),x=Math.max(x,c),O=Math.max(O,h.endDTS)}h.duration=x-A;var m=A-h.start;h.appendedPTS=x,h.start=h.startPTS=A,h.maxStartPTS=E,h.startDTS=T,h.endPTS=x,h.minEndPTS=w,h.endDTS=O;var _=h.sn;if(!l||_<l.startSN||_>l.endSN)return 0;var P,I=_-l.startSN,B=l.fragments;for(B[I]=h,P=I;P>0;P--)k(B[P],B[P-1]);for(P=I;P<B.length-1;P++)k(B[P],B[P+1]);return l.fragmentHint&&k(B[B.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,m}function g(l,h){for(var A=null,x=l.fragments,T=x.length-1;T>=0;T--){var O=x[T].initSegment;if(O){A=O;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var S=0,E;if(f(l,h,function(P,I){P.relurl&&(S=P.cc-I.cc),Object(z.isFiniteNumber)(P.startPTS)&&Object(z.isFiniteNumber)(P.endPTS)&&(I.start=I.startPTS=P.startPTS,I.startDTS=P.startDTS,I.appendedPTS=P.appendedPTS,I.maxStartPTS=P.maxStartPTS,I.endPTS=P.endPTS,I.endDTS=P.endDTS,I.minEndPTS=P.minEndPTS,I.duration=P.endPTS-P.startPTS,I.duration&&(E=I),h.PTSKnown=h.alignedSliding=!0),I.elementaryStreams=P.elementaryStreams,I.loader=P.loader,I.stats=P.stats,I.urlId=P.urlId,P.initSegment&&(I.initSegment=P.initSegment,A=P.initSegment)}),A){var w=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;w.forEach(function(P){var I;(!P.initSegment||P.initSegment.relurl===((I=A)===null||I===void 0?void 0:I.relurl))&&(P.initSegment=A)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(P){return!P}),h.deltaUpdateFailed)){N.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var b=h.skippedSegments;b--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var c=h.fragments;if(S){N.logger.warn("discontinuity sliding from playlist, take drift into account");for(var y=0;y<c.length;y++)c[y].cc+=S}h.skippedSegments&&(h.startCC=h.fragments[0].cc),p(l.partList,h.partList,function(P,I){I.elementaryStreams=P.elementaryStreams,I.stats=P.stats}),E?R(h,E,E.startPTS,E.endPTS,E.startDTS,E.endDTS):d(l,h),c.length&&(h.totalduration=h.edge-c[0].start),h.driftStartTime=l.driftStartTime,h.driftStart=l.driftStart;var m=h.advancedDateTime;if(h.advanced&&m){var _=h.edge;h.driftStart||(h.driftStartTime=m,h.driftStart=_),h.driftEndTime=m,h.driftEnd=_}else h.driftEndTime=l.driftEndTime,h.driftEnd=l.driftEnd,h.advancedDateTime=l.advancedDateTime}function p(l,h,A){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?A(S,E):x--}}function f(l,h,A){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,w=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,b=T;b<=O;b++){var c=w[S+b],y=E[b];x&&!y&&b<x&&(y=h.fragments[b]=c),c&&y&&A(c,y)}}function d(l,h){var A=h.startSN+h.skippedSegments-l.startSN,x=l.fragments;if(A<0||A>=x.length)return;s(h,x[A].start)}function s(l,h){if(h){for(var A=l.fragments,x=l.skippedSegments;x<A.length;x++)A[x].start+=h;l.fragmentHint&&(l.fragmentHint.start+=h)}}function u(l,h){var A=1e3*l.levelTargetDuration,x=A/2,T=l.age,O=T>0&&T<A*3,S=h.loading.end-h.loading.start,E,w=l.availabilityDelay;if(l.updated===!1)if(O){var b=333*l.misses;E=Math.max(Math.min(x,S*2),b),l.availabilityDelay=(l.availabilityDelay||0)+E}else E=x;else O?(w=Math.min(w||A/2,T),l.availabilityDelay=w,E=w+A-T):E=A-S;return Math.round(E)}function o(l,h,A){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&&A&&A.sn===h?A:null)}function a(l,h,A){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===A&&O.fragment.sn===h)return O}return null}},"./src/controller/stream-controller.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return x});var z=D("./src/polyfills/number.ts"),N=D("./src/controller/base-stream-controller.ts"),M=D("./src/is-supported.ts"),W=D("./src/events.ts"),F=D("./src/utils/buffer-helper.ts"),k=D("./src/controller/fragment-tracker.ts"),R=D("./src/types/loader.ts"),g=D("./src/loader/fragment.ts"),p=D("./src/demux/transmuxer-interface.ts"),f=D("./src/types/transmuxer.ts"),d=D("./src/controller/gap-controller.ts"),s=D("./src/errors.ts"),u=D("./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 a(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,w){return E.__proto__=w,E},h(T,O)}var A=100,x=function(T){l(O,T);function O(E,w){var b;return b=T.call(this,E,w,"[stream-controller]")||this,b.audioCodecSwap=!1,b.gapController=null,b.level=-1,b._forceStartLoad=!1,b.altAudio=!1,b.audioOnly=!1,b.fragPlaying=null,b.onvplaying=null,b.onvseeked=null,b.fragLastKbps=0,b.stalled=!1,b.couldBacktrack=!1,b.audioCodecSwitch=!1,b.videoBuffer=null,b._registerListeners(),b}var S=O.prototype;return S._registerListeners=function(){var w=this.hls;w.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),w.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),w.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),w.on(W.Events.ERROR,this.onError,this),w.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),w.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),w.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),w.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),w.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S._unregisterListeners=function(){var w=this.hls;w.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),w.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),w.off(W.Events.ERROR,this.onError,this),w.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),w.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),w.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),w.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),w.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},S.startLoad=function(w){if(this.levels){var b=this.lastCurrentTime,c=this.hls;if(this.stopLoad(),this.setInterval(A),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var y=c.startLevel;y===-1&&(c.config.testBandwidth?(y=0,this.bitrateTest=!0):y=c.nextAutoLevel),this.level=c.nextLoadLevel=y,this.loadedmetadata=!1}b>0&&w===-1&&(this.log("Override startPosition with lastCurrentTime @"+b.toFixed(3)),w=b),this.state=N.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=w,this.tick()}else this._forceStartLoad=!0,this.state=N.State.STOPPED},S.stopLoad=function(){this._forceStartLoad=!1,T.prototype.stopLoad.call(this)},S.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_LEVEL:{var w,b=this.levels,c=this.level,y=b==null||((w=b[c])===null||w===void 0)?void 0:w.details;if(y&&(!y.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(y))break;this.state=N.State.IDLE;break}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var m,_=self.performance.now(),P=this.retryDate;(!P||_>=P||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=N.State.IDLE)}break;default:break}this.onTickEnd()},S.onTickEnd=function(){T.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},S.doTickIdle=function(){var w,b,c=this.hls,y=this.levelLastLoaded,m=this.levels,_=this.media,P=c.config,I=c.nextLoadLevel;if(y===null||!_&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[I])return;var B=m[I];this.level=c.nextLoadLevel=I;var U=B.details;if(!U||this.state===N.State.WAITING_LEVEL||U.live&&this.levelLastLoaded!==I){this.state=N.State.WAITING_LEVEL;return}var C=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:_,R.PlaylistLevelType.MAIN);if(C===null)return;var v=C.len,j=this.getMaxBufferLength(B.maxBitrate);if(v>=j)return;if(this._streamEnded(C,U)){var G={};this.altAudio&&(G.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,G),this.state=N.State.ENDED;return}var J=C.end,ee=this.getNextFragment(J,U);if(this.couldBacktrack&&!this.fragPrevious&&ee&&ee.sn!=="initSegment"){var ye=ee.sn-U.startSN;ye>1&&(ee=U.fragments[ye-1],this.fragmentTracker.removeFragment(ee))}if(ee&&this.fragmentTracker.getState(ee)===k.FragmentState.OK&&this.nextLoadPosition>J){var he=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(_,he,R.PlaylistLevelType.MAIN),ee=this.getNextFragment(this.nextLoadPosition,U)}if(!ee)return;ee.initSegment&&!ee.initSegment.data&&!this.bitrateTest&&(ee=ee.initSegment),((w=ee.decryptdata)===null||w===void 0?void 0:w.keyFormat)==="identity"&&!((b=ee.decryptdata)!==null&&b!==void 0&&b.key)?this.loadKey(ee,U):this.loadFragment(ee,U,J)},S.loadFragment=function(w,b,c){var y,m=this.fragmentTracker.getState(w);if(this.fragCurrent=w,m===k.FragmentState.BACKTRACKED){var _=this.fragmentTracker.getBacktrackData(w);if(_){this._handleFragmentLoadProgress(_),this._handleFragmentLoadComplete(_);return}else m=k.FragmentState.NOT_LOADED}m===k.FragmentState.NOT_LOADED||m===k.FragmentState.PARTIAL?w.sn==="initSegment"?this._loadInitSegment(w):this.bitrateTest?(w.bitrateTest=!0,this.log("Fragment "+w.sn+" of level "+w.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(w)):(this.startFragRequested=!0,T.prototype.loadFragment.call(this,w,b,c)):m===k.FragmentState.APPENDING?this.reduceMaxBufferLength(w.duration)&&this.fragmentTracker.removeFragment(w):((y=this.media)===null||y===void 0?void 0:y.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},S.getAppendedFrag=function(w){var b=this.fragmentTracker.getAppendedFrag(w,R.PlaylistLevelType.MAIN);return b&&"fragment"in b?b.fragment:b},S.getBufferedFrag=function(w){return this.fragmentTracker.getBufferedFrag(w,R.PlaylistLevelType.MAIN)},S.followingBufferedFrag=function(w){return w?this.getBufferedFrag(w.end+.5):null},S.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},S.nextLevelSwitch=function(){var w=this.levels,b=this.media;if(b!=null&&b.readyState){var c,y=this.getAppendedFrag(b.currentTime);if(y&&y.start>1&&this.flushMainBuffer(0,y.start-1),!b.paused&&w){var m=this.hls.nextLoadLevel,_=w[m],P=this.fragLastKbps;P&&this.fragCurrent?c=this.fragCurrent.duration*_.maxBitrate/(1e3*P)+1:c=0}else c=0;var I=this.getBufferedFrag(b.currentTime+c);if(I){var B=this.followingBufferedFrag(I);if(B){this.abortCurrentFrag();var U=B.maxStartPTS?B.maxStartPTS:B.start,C=B.duration,v=Math.max(I.end,U+Math.min(Math.max(C-this.config.maxFragLookUpTolerance,C*.5),C*.75));this.flushMainBuffer(v,Number.POSITIVE_INFINITY)}}}},S.abortCurrentFrag=function(){var w=this.fragCurrent;this.fragCurrent=null,w!=null&&w.loader&&w.loader.abort(),this.state===N.State.KEY_LOADING&&(this.state=N.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},S.flushMainBuffer=function(w,b){T.prototype.flushMainBuffer.call(this,w,b,this.altAudio?"video":null)},S.onMediaAttached=function(w,b){T.prototype.onMediaAttached.call(this,w,b);var c=b.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),c.addEventListener("playing",this.onvplaying),c.addEventListener("seeked",this.onvseeked),this.gapController=new d.default(this.config,c,this.fragmentTracker,this.hls)},S.onMediaDetaching=function(){var w=this.media;w&&(w.removeEventListener("playing",this.onvplaying),w.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 w=this.media,b=w?w.currentTime:null;Object(z.isFiniteNumber)(b)&&this.log("Media seeked to "+b.toFixed(3)),this.tick()},S.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(W.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},S.onManifestParsed=function(w,b){var c=!1,y=!1,m;b.levels.forEach(function(_){m=_.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(c=!0),m.indexOf("mp4a.40.5")!==-1&&(y=!0))}),this.audioCodecSwitch=c&&y&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=b.levels,this.startFragRequested=!1},S.onLevelLoading=function(w,b){var c=this.levels;if(!c||this.state!==N.State.IDLE)return;var y=c[b.level];(!y.details||y.details.live&&this.levelLastLoaded!==b.level||this.waitForCdnTuneIn(y.details))&&(this.state=N.State.WAITING_LEVEL)},S.onLevelLoaded=function(w,b){var c,y=this.levels,m=b.level,_=b.details,P=_.totalduration;if(!y){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+_.startSN+","+_.endSN+"], cc ["+_.startCC+", "+_.endCC+"] duration:"+P);var I=this.fragCurrent;I&&(this.state===N.State.FRAG_LOADING||this.state===N.State.FRAG_LOADING_WAITING_RETRY)&&(I.level!==b.level&&I.loader&&(this.state=N.State.IDLE,I.loader.abort()));var B=y[m],U=0;if(_.live||(c=B.details)!==null&&c!==void 0&&c.live){if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed)return;U=this.alignPlaylists(_,B.details)}if(B.details=_,this.levelLastLoaded=m,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:_,level:m}),this.state===N.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(_))return;this.state=N.State.IDLE}this.startFragRequested?_.live&&this.synchronizeToLiveEdge(_):this.setStartPosition(_,U),this.tick()},S._handleFragmentLoadProgress=function(w){var b,c=w.frag,y=w.part,m=w.payload,_=this.levels;if(!_){this.warn("Levels were reset while fragment load was in progress. Fragment "+c.sn+" of level "+c.level+" will not be buffered");return}var P=_[c.level],I=P.details;if(!I){this.warn("Dropping fragment "+c.sn+" of level "+c.level+" after level details were reset");return}var B=P.videoCodec,U=I.PTSKnown||!I.live,C=(b=c.initSegment)===null||b===void 0?void 0:b.data,v=this._getAudioCodec(P),j=this.transmuxer=this.transmuxer||new p.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),G=y?y.index:-1,J=G!==-1,ee=new f.ChunkMetadata(c.level,c.sn,c.stats.chunkCount,m.byteLength,G,J),ye=this.initPTS[c.cc];j.push(m,C,v,B,c,y,I.totalduration,U,ee,ye)},S.onAudioTrackSwitching=function(w,b){var c=this.altAudio,y=!!b.url,m=b.id;if(!y){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var _=this.fragCurrent;_!=null&&_.loader&&(this.log("Switching to main audio track, cancel main fragment load"),_.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;c&&P.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:m})}},S.onAudioTrackSwitched=function(w,b){var c=b.id,y=!!this.hls.audioTracks[c].url;if(y){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=y,this.tick()},S.onBufferCreated=function(w,b){var c=b.tracks,y,m,_=!1;for(var P in c){var I=c[P];if(I.id==="main"){if(m=P,y=I,P==="video"){var B=c[P];B&&(this.videoBuffer=B.buffer)}}else _=!0}_&&y?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=y.buffer):this.mediaBuffer=this.media},S.onFragBuffered=function(w,b){var c=b.frag,y=b.part;if(c&&c.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(c)){this.warn("Fragment "+c.sn+(y?" p: "+y.index:"")+" of level "+c.level+" finished buffering, but was aborted. state: "+this.state),this.state===N.State.PARSED&&(this.state=N.State.IDLE);return}var m=y?y.stats:c.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),c.sn!=="initSegment"&&(this.fragPrevious=c),this.fragBufferedComplete(c,y)},S.onError=function(w,b){switch(b.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,b);break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==N.State.ERROR&&(b.fatal?(this.warn(""+b.details),this.state=N.State.ERROR):!b.levelRetry&&this.state===N.State.WAITING_LEVEL&&(this.state=N.State.IDLE));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(b.parent==="main"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var c=!0,y=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);y&&y.len>.5&&(c=!this.reduceMaxBufferLength(y.len)),c&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},S.checkBuffer=function(){var w=this.media,b=this.gapController;if(!w||!b||!w.readyState)return;var c=F.BufferHelper.getBuffered(w);!this.loadedmetadata&&c.length?(this.loadedmetadata=!0,this.seekToStartPos()):b.poll(this.lastCurrentTime),this.lastCurrentTime=w.currentTime},S.onFragLoadEmergencyAborted=function(){this.state=N.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},S.onBufferFlushed=function(w,b){var c=b.type;if(c!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var y=(c===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(y,c,R.PlaylistLevelType.MAIN)}},S.onLevelsUpdated=function(w,b){this.levels=b.levels},S.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},S.seekToStartPos=function(){var w=this.media,b=w.currentTime,c=this.startPosition;if(c>=0&&b<c){if(w.seeking){u.logger.log("could not seek to "+c+", already seeking at "+b);return}var y=F.BufferHelper.getBuffered(w),m=y.length?y.start(0):0,_=m-c;_>0&&(_<this.config.maxBufferHole||_<this.config.maxFragLookUpTolerance)&&(u.logger.log("adjusting start position by "+_+" to match buffer start"),c+=_,this.startPosition=c),this.log("seek to target start position "+c+" from current time "+b),w.currentTime=c}},S._getAudioCodec=function(w){var b=this.config.defaultAudioCodec||w.audioCodec;return this.audioCodecSwap&&b&&(this.log("Swapping audio codec"),b.indexOf("mp4a.40.5")!==-1?b="mp4a.40.2":b="mp4a.40.5"),b},S._loadBitrateTestFrag=function(w){var b=this;this._doFragLoad(w).then(function(c){var y=b.hls;if(!c||y.nextLoadLevel||b.fragContextChanged(w))return;b.fragLoadError=0,b.state=N.State.IDLE,b.startFragRequested=!1,b.bitrateTest=!1;var m=w.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),y.trigger(W.Events.FRAG_LOADED,c)})},S._handleTransmuxComplete=function(w){var b,c="main",y=this.hls,m=w.remuxResult,_=w.chunkMeta,P=this.getCurrentContext(_);if(!P){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var I=P.frag,B=P.part,U=P.level,C=m.video,v=m.text,j=m.id3,G=m.initSegment,J=this.altAudio?void 0:m.audio;if(this.fragContextChanged(I))return;if(this.state=N.State.PARSING,G){G.tracks&&(this._bufferInitSegment(U,G.tracks,I,_),y.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:I,id:c,tracks:G.tracks}));var ee=G.initPTS,ye=G.timescale;Object(z.isFiniteNumber)(ee)&&(this.initPTS[I.cc]=ee,y.trigger(W.Events.INIT_PTS_FOUND,{frag:I,id:c,initPTS:ee,timescale:ye}))}if(C&&m.independent!==!1){if(U.details){var he=C.startPTS,ge=C.endPTS,pe=C.startDTS,oe=C.endDTS;if(B)B.elementaryStreams[C.type]={startPTS:he,endPTS:ge,startDTS:pe,endDTS:oe};else if(C.firstKeyFrame&&C.independent&&(this.couldBacktrack=!0),C.dropped&&C.independent){var ie=this.getLoadPosition()+this.config.maxBufferHole;if(ie<he){this.backtrack(I);return}I.setElementaryStreamInfo(C.type,I.start,ge,I.start,oe,!0)}I.setElementaryStreamInfo(C.type,he,ge,pe,oe),this.bufferFragmentData(C,I,B,_)}}else if(m.independent===!1){this.backtrack(I);return}if(J){var ue=J.startPTS,$=J.endPTS,re=J.startDTS,q=J.endDTS;B&&(B.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:$,startDTS:re,endDTS:q}),I.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,ue,$,re,q),this.bufferFragmentData(J,I,B,_)}if(j!=null&&(b=j.samples)!==null&&b!==void 0&&b.length){var be={frag:I,id:c,samples:j.samples};y.trigger(W.Events.FRAG_PARSING_METADATA,be)}if(v){var Oe={frag:I,id:c,samples:v.samples};y.trigger(W.Events.FRAG_PARSING_USERDATA,Oe)}},S._bufferInitSegment=function(w,b,c,y){var m=this;if(this.state!==N.State.PARSING)return;this.audioOnly=!!b.audio&&!b.video,this.altAudio&&!this.audioOnly&&delete b.audio;var _=b.audio,P=b.video,I=b.audiovideo;if(_){var B=w.audioCodec,U=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),_.metadata.channelCount!==1&&U.indexOf("firefox")===-1&&(B="mp4a.40.5")),U.indexOf("android")!==-1&&_.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),w.audioCodec&&w.audioCodec!==B&&this.log('Swapping manifest audio codec "'+w.audioCodec+'" for "'+B+'"'),_.levelCodec=B,_.id="main",this.log("Init audio buffer, container:"+_.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(w.audioCodec||"")+"/"+_.codec+"]")}P&&(P.levelCodec=w.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(w.videoCodec||"")+"/"+P.codec+"]")),I&&this.log("Init audiovideo buffer, container:"+I.container+", codecs[level/parsed]=["+(w.attrs.CODECS||"")+"/"+I.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,b),Object.keys(b).forEach(function(C){var v=b[C],j=v.initSegment;j!=null&&j.byteLength&&m.hls.trigger(W.Events.BUFFER_APPENDING,{type:C,data:j,frag:c,part:null,chunkMeta:y,parent:c.type})}),this.tick()},S.backtrack=function(w){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(w);var b=this.fragmentTracker.backtrack(w);this.fragPrevious=null,this.nextLoadPosition=w.start,b?this.resetFragmentLoading(w):this.state=N.State.BACKTRACKING},S.checkFragmentChanged=function(){var w=this.media,b=null;if(w&&w.readyState>1&&w.seeking===!1){var c=w.currentTime;if(F.BufferHelper.isBuffered(w,c)?b=this.getAppendedFrag(c):F.BufferHelper.isBuffered(w,c+.1)&&(b=this.getAppendedFrag(c+.1)),b){var y=this.fragPlaying,m=b.level;(!y||b.sn!==y.sn||y.level!==m||b.urlId!==y.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:b}),(!y||y.level!==m)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=b)}}},a(O,[{key:"nextLevel",get:function(){var w=this.nextBufferedFrag;return w?w.level:-1}},{key:"currentLevel",get:function(){var w=this.media;if(w){var b=this.getAppendedFrag(w.currentTime);if(b)return b.level}return-1}},{key:"nextBufferedFrag",get:function(){var w=this.media;if(w){var b=this.getAppendedFrag(w.currentTime);return this.followingBufferedFrag(b)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),O}(N.default)},"./src/controller/subtitle-stream-controller.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"SubtitleStreamController",function(){return l});var z=D("./src/events.ts"),N=D("./src/utils/logger.ts"),M=D("./src/utils/buffer-helper.ts"),W=D("./src/controller/fragment-finders.ts"),F=D("./src/utils/discontinuities.ts"),k=D("./src/controller/level-helper.ts"),R=D("./src/controller/fragment-tracker.ts"),g=D("./src/controller/base-stream-controller.ts"),p=D("./src/types/loader.ts"),f=D("./src/types/level.ts");function d(h,A){for(var x=0;x<A.length;x++){var T=A[x];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(h,T.key,T)}}function s(h,A,x){return A&&d(h.prototype,A),x&&d(h,x),h}function u(h,A){h.prototype=Object.create(A.prototype),h.prototype.constructor=h,o(h,A)}function o(h,A){return o=Object.setPrototypeOf||function(T,O){return T.__proto__=O,T},o(h,A)}var a=500,l=function(h){u(A,h);function A(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=A.prototype;return x.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},x._registerListeners=function(){var O=this.hls;O.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.on(z.Events.ERROR,this.onError,this),O.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},x._unregisterListeners=function(){var O=this.hls;O.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.off(z.Events.ERROR,this.onError,this),O.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},x.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(a),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,w=S.success;if(this.fragPrevious=E,this.state=g.State.IDLE,!w)return;var b=this.tracksBuffered[this.currentTrackId];if(!b)return;for(var c,y=E.start,m=0;m<b.length;m++)if(y>=b[m].start&&y<=b[m].end){c=b[m];break}var _=E.start+E.duration;c?c.end=_:(c={start:y,end:_},b.push(c)),this.fragmentTracker.fragBuffered(E)},x.onBufferFlushing=function(O,S){var E=S.startOffset,w=S.endOffset;if(E===0&&w!==Number.POSITIVE_INFINITY){var b=this.currentTrackId,c=this.levels;if(!c.length||!c[b]||!c[b].details)return;var y=c[b].details,m=y.targetduration,_=w-m;if(_<=0)return;S.endOffsetSubtitles=Math.max(0,_),this.tracksBuffered.forEach(function(P){for(var I=0;I<P.length;){if(P[I].end<=_){P.shift();continue}else if(P[I].start<_)P[I].start=_;else break;I++}}),this.fragmentTracker.removeFragmentsInRange(E,_,p.PlaylistLevelType.SUBTITLE)}},x.onError=function(O,S){var E,w=S.frag;if(!w||w.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,w=S.subtitleTracks;this.tracksBuffered=[],this.levels=w.map(function(b){return new f.Level(b)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(b){E.tracksBuffered[b.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(a)},x.onSubtitleTrackLoaded=function(O,S){var E,w=S.details,b=S.id,c=this.currentTrackId,y=this.levels;if(!y.length)return;var m=y[c];if(b>=y.length||b!==c||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,w.live||(E=m.details)!==null&&E!==void 0&&E.live){var _=this.mainDetails;if(w.deltaUpdateFailed||!_)return;var P=_.fragments[0];if(!m.details)w.hasProgramDateTime&&_.hasProgramDateTime?Object(F.alignMediaPlaylistByPDT)(w,_):P&&Object(k.addSliding)(w,P.start);else{var I=this.alignPlaylists(w,m.details);I===0&&P&&Object(k.addSliding)(w,P.start)}}if(m.details=w,this.levelLastLoaded=b,this.tick(),w.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var B=Object(W.findFragmentByPTS)(null,w.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},x._handleFragmentLoadComplete=function(O){var S=O.frag,E=O.payload,w=S.decryptdata,b=this.hls;if(this.fragContextChanged(S))return;if(E&&E.byteLength>0&&w&&w.key&&w.iv&&w.method==="AES-128"){var c=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(E),w.key.buffer,w.iv.buffer).then(function(y){var m=performance.now();b.trigger(z.Events.FRAG_DECRYPTED,{frag:S,payload:y,stats:{tstart:c,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 w=E[S].details,b=w.targetduration,c=this.config,y=this.media,m=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,y.currentTime-b,c.maxBufferHole),_=m.end,P=m.len,I=this.getMaxBufferLength()+b;if(P>I)return;console.assert(w,"Subtitle track details are defined on idle subtitle stream controller tick");var B=w.fragments,U=B.length,C=w.edge,v,j=this.fragPrevious;if(_<C){var G=c.maxFragLookUpTolerance;j&&w.hasProgramDateTime&&(v=Object(W.findFragmentByPDT)(B,j.endProgramDateTime,G)),v||(v=Object(W.findFragmentByPTS)(j,B,_,G),!v&&j&&j.start<B[0].start&&(v=B[0]))}else v=B[U-1];(O=v)!==null&&O!==void 0&&O.encrypted?(N.logger.log("Loading key for "+v.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:v})):v&&this.fragmentTracker.getState(v)===R.FragmentState.NOT_LOADED&&this.loadFragment(v,w,_)}},x.loadFragment=function(O,S,E){this.fragCurrent=O,h.prototype.loadFragment.call(this,O,S,E)},s(A,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),A}(g.default)},"./src/controller/subtitle-track-controller.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/events.ts"),N=D("./src/utils/texttrack-utils.ts"),M=D("./src/controller/base-playlist-controller.ts"),W=D("./src/types/loader.ts");function F(d,s){for(var u=0;u<s.length;u++){var o=s[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(d,o.key,o)}}function k(d,s,u){return s&&F(d.prototype,s),u&&F(d,u),d}function R(d,s){d.prototype=Object.create(s.prototype),d.prototype.constructor=d,g(d,s)}function g(d,s){return g=Object.setPrototypeOf||function(o,a){return o.__proto__=a,o},g(d,s)}var p=function(d){R(s,d);function s(o){var a;return a=d.call(this,o,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var u=s.prototype;return u.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,d.prototype.destroy.call(this)},u.registerListeners=function(){var a=this.hls;a.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(z.Events.ERROR,this.onError,this)},u.unregisterListeners=function(){var a=this.hls;a.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(z.Events.ERROR,this.onError,this)},u.onMediaAttached=function(a,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)},u.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},u.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=f(this.media.textTracks);a.forEach(function(l){Object(N.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},u.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},u.onManifestParsed=function(a,l){this.tracks=l.subtitleTracks},u.onSubtitleTrackLoaded=function(a,l){var h=l.id,A=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 ["+A.startSN+"-"+A.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,l,O))},u.onLevelLoading=function(a,l){this.switchLevel(l.level)},u.onLevelSwitching=function(a,l){this.switchLevel(l.level)},u.switchLevel=function(a){var l=this.hls.levels[a];if(!(l!=null&&l.textGroupIds))return;var h=l.textGroupIds[l.urlId];if(this.groupId!==h){var A=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(A==null?void 0:A.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(z.Events.SUBTITLE_TRACKS_UPDATED,O),T!==-1&&this.setSubtitleTrack(T,A)}},u.findTrackId=function(a){for(var l=this.tracksInGroup,h=0;h<l.length;h++){var A=l[h];if((!this.selectDefaultTrack||A.default)&&(!a||a===A.name))return A.id}return-1},u.onError=function(a,l){if(d.prototype.onError.call(this,a,l),l.fatal||!l.context)return;l.context.type===W.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},u.loadPlaylist=function(a){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var h=l.id,A=l.groupId,x=l.url;if(a)try{x=a.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(z.Events.SUBTITLE_TRACK_LOADING,{url:x,id:h,groupId:A,deliveryDirectives:a||null})}},u.toggleTrackModes=function(a){var l=this,h=this.media,A=this.subtitleDisplay,x=this.trackId;if(!h)return;var T=f(h.textTracks),O=T.filter(function(w){return w.groupId===l.groupId});if(a===-1)[].slice.call(T).forEach(function(w){w.mode="disabled"});else{var S=O[x];S&&(S.mode="disabled")}var E=O[a];E&&(E.mode=A?"showing":"hidden")},u.setSubtitleTrack=function(a,l){var h,A=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(h=A[a])!==null&&h!==void 0&&h.details)||a<-1||a>=A.length)return;this.clearTimer();var x=A[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,x){var T=x.id,O=x.groupId,S=O===void 0?"":O,E=x.name,w=x.type,b=x.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:T,groupId:S,name:E,type:w,url:b});var c=this.switchParams(x.url,l==null?void 0:l.details);this.loadPlaylist(c)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:a})},u.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,l=f(this.media.textTracks),h=0;h<l.length;h++)if(l[h].mode==="hidden")a=h;else if(l[h].mode==="showing"){a=h;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},k(s,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,l)}}]),s}(M.default);function f(d){for(var s=[],u=0;u<d.length;u++){var o=d[u];o.kind==="subtitles"&&o.label&&s.push(d[u])}return s}V.default=p},"./src/controller/timeline-controller.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"TimelineController",function(){return f});var z=D("./src/polyfills/number.ts"),N=D("./src/events.ts"),M=D("./src/utils/cea-608-parser.ts"),W=D("./src/utils/output-filter.ts"),F=D("./src/utils/webvtt-parser.ts"),k=D("./src/utils/texttrack-utils.ts"),R=D("./src/utils/imsc1-ttml-parser.ts"),g=D("./src/types/loader.ts"),p=D("./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=u(),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 W.default(this,"textTrack1"),A=new W.default(this,"textTrack2"),x=new W.default(this,"textTrack3"),T=new W.default(this,"textTrack4");this.cea608Parser1=new M.default(1,h,A),this.cea608Parser2=new M.default(3,x,T)}l.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(N.Events.FRAG_LOADING,this.onFragLoading,this),l.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=o.prototype;return a.destroy=function(){var h=this.hls;h.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(N.Events.FRAG_LOADING,this.onFragLoading,this),h.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(h,A,x,T,O){for(var S=!1,E=O.length;E--;){var w=O[E],b=s(w[0],w[1],A,x);if(b>=0&&(w[0]=Math.min(w[0],A),w[1]=Math.max(w[1],x),S=!0,b/(x-A)>.5))return}if(S||O.push([A,x]),this.config.renderTextTracksNatively){var c=this.captionsTracks[h];this.Cues.newCue(c,A,x,T)}else{var y=this.Cues.newCue(null,A,x,T);this.hls.trigger(N.Events.CUES_PARSED,{type:"captions",cues:y,track:h})}},a.onInitPtsFound=function(h,A){var x=this,T=A.frag,O=A.id,S=A.initPTS,E=A.timescale,w=this.unparsedVttFrags;O==="main"&&(this.initPTS[T.cc]=S,this.timescale[T.cc]=E),w.length&&(this.unparsedVttFrags=[],w.forEach(function(b){x.onFragLoaded(N.Events.FRAG_LOADED,b)}))},a.getExistingTrack=function(h){var A=this.media;if(A)for(var x=0;x<A.textTracks.length;x++){var T=A.textTracks[x];if(T[h])return T}return null},a.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},a.createNativeTrack=function(h){if(this.captionsTracks[h])return;var A=this.captionsProperties,x=this.captionsTracks,T=this.media,O=A[h],S=O.label,E=O.languageCode,w=this.getExistingTrack(h);if(w)x[h]=w,Object(k.clearCurrentCues)(x[h]),Object(k.sendAddTrackEvent)(x[h],T);else{var b=this.createTextTrack("captions",S,E);b&&(b[h]=!0,x[h]=b)}},a.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var A=this.captionsProperties[h];if(!A)return;var x=A.label,T={_id:h,label:x,kind:"captions",default:A.media?!!A.media.default:!1,closedCaptions:A.media};this.nonNativeCaptionsTracks[h]=T,this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[T]})},a.createTextTrack=function(h,A,x){var T=this.media;return T?T.addTextTrack(h,A,x):void 0},a.onMediaAttaching=function(h,A){this.media=A.media,this._cleanTracks()},a.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(A){Object(k.clearCurrentCues)(h[A]),delete h[A]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=u(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var h=this.media;if(!h)return;var A=h.textTracks;if(A)for(var x=0;x<A.length;x++)Object(k.clearCurrentCues)(A[x])},a.onSubtitleTracksUpdated=function(h,A){var x=this;this.textTracks=[];var T=A.subtitleTracks||[],O=T.some(function(b){return b.textCodec===R.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(b,c){var y;if(c<E.length){for(var m=null,_=0;_<E.length;_++)if(d(E[_],b)){m=E[_];break}m&&(y=m)}y?Object(k.clearCurrentCues)(y):(y=x.createTextTrack("subtitles",b.name,b.lang),y&&(y.mode="disabled")),y&&(y.groupId=b.groupId,x.textTracks.push(y))})}else if(!S&&this.tracks&&this.tracks.length){var w=this.tracks.map(function(b){return{label:b.name,kind:b.type.toLowerCase(),default:b.default,subtitleTrack:b}});this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:w})}}},a.onManifestLoaded=function(h,A){var x=this;this.config.enableCEA708Captions&&A.captions&&A.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})},a.onFragLoading=function(h,A){var x=this.cea608Parser1,T=this.cea608Parser2,O=this.lastSn,S=this.lastPartIndex;if(!this.enabled||!(x&&T))return;if(A.frag.type===g.PlaylistLevelType.MAIN){var E,w,b=A.frag.sn,c=(E=A==null||((w=A.part)===null||w===void 0)?void 0:w.index)!=null?E:-1;b===O+1||b===O&&c===S+1||(x.reset(),T.reset()),this.lastSn=b,this.lastPartIndex=c}},a.onFragLoaded=function(h,A){var x=A.frag,T=A.payload,O=this.initPTS,S=this.unparsedVttFrags;if(x.type===g.PlaylistLevelType.SUBTITLE)if(T.byteLength){if(!Object(z.isFiniteNumber)(O[x.cc])){S.push(A),O.length&&this.hls.trigger(N.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 w=this.tracks[x.level],b=this.vttCCs;b[x.cc]||(b[x.cc]={start:x.start,prevCC:this.prevCC,new:!0},this.prevCC=x.cc),w&&w.textCodec===R.IMSC1_CODEC?this._parseIMSC1(x,T):this._parseVTTs(x,T,b)}}else this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:x,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(h,A){var x=this,T=this.hls;Object(R.parseIMSC1)(A,this.initPTS[h.cc],this.timescale[h.cc],function(O){x._appendCues(O,h.level),T.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(O){p.logger.log("Failed to parse IMSC1: "+O),T.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:O})})},a._parseVTTs=function(h,A,x){var T=this,O=this.hls;Object(F.parseWebVTT)(A,this.initPTS[h.cc],this.timescale[h.cc],x,h.cc,h.start,function(S){T._appendCues(S,h.level),O.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(S){T._fallbackToIMSC1(h,A),p.logger.log("Failed to parse VTT cue: "+S),O.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:S})})},a._fallbackToIMSC1=function(h,A){var x=this,T=this.tracks[h.level];T.textCodec||Object(R.parseIMSC1)(A,this.initPTS[h.cc],this.timescale[h.cc],function(){T.textCodec=R.IMSC1_CODEC,x._parseIMSC1(h,A)},function(){T.textCodec="wvtt"})},a._appendCues=function(h,A){var x=this.hls;if(this.config.renderTextTracksNatively){var T=this.textTracks[A];if(T.mode==="disabled")return;h.forEach(function(E){return Object(k.addCueToTrack)(T,E)})}else{var O=this.tracks[A],S=O.default?"default":"subtitles"+A;x.trigger(N.Events.CUES_PARSED,{type:"subtitles",cues:h,track:S})}},a.onFragDecrypted=function(h,A){var x=A.frag;if(x.type===g.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[x.cc])){this.unparsedVttFrags.push(A);return}this.onFragLoaded(N.Events.FRAG_LOADED,A)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(h,A){var x=this.cea608Parser1,T=this.cea608Parser2;if(!this.enabled||!(x&&T))return;for(var O=0;O<A.samples.length;O++){var S=A.samples[O].bytes;if(S){var E=this.extractCea608Data(S);x.addData(A.samples[O].pts,E[0]),T.addData(A.samples[O].pts,E[1])}}},a.onBufferFlushing=function(h,A){var x=A.startOffset,T=A.endOffset,O=A.endOffsetSubtitles,S=A.type,E=this.media;if(!E||E.currentTime<T)return;if(!S||S==="video"){var w=this.captionsTracks;Object.keys(w).forEach(function(c){return Object(k.removeCuesInRange)(w[c],x,T)})}if(this.config.renderTextTracksNatively&&(x===0&&O!==void 0)){var b=this.textTracks;Object.keys(b).forEach(function(c){return Object(k.removeCuesInRange)(b[c],x,O)})}},a.extractCea608Data=function(h){for(var A=h[0]&31,x=2,T=[[],[]],O=0;O<A;O++){var S=h[x++],E=127&h[x++],w=127&h[x++],b=(4&S)!==0,c=3&S;if(E===0&&w===0)continue;b&&((c===0||c===1)&&(T[c].push(E),T[c].push(w)))}return T},o}();function d(o,a){return o&&o.label===a.name&&!(o.textTrack1||o.textTrack2)}function s(o,a,l,h){return Math.min(a,h)-Math.max(o,l)}function u(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function N(W,F){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=F}var M=N.prototype;return M.decrypt=function(F,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,F)},N}()},"./src/crypt/aes-decryptor.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"removePadding",function(){return N}),D.d(V,"default",function(){return M});var z=D("./src/utils/typed-array.ts");function N(W){var F=W.byteLength,k=F&&new DataView(W.buffer).getUint8(F-1);return k?Object(z.sliceUint8)(W,0,F-k):W}var M=function(){function W(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var F=W.prototype;return F.uint8ArrayToUint32Array_=function(R){for(var g=new DataView(R),p=new Uint32Array(4),f=0;f<4;f++)p[f]=g.getUint32(f*4);return p},F.initTable=function(){var R=this.sBox,g=this.invSBox,p=this.subMix,f=p[0],d=p[1],s=p[2],u=p[3],o=this.invSubMix,a=o[0],l=o[1],h=o[2],A=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,R[T]=E,g[E]=T;var w=x[T],b=x[w],c=x[b],y=x[E]*257^E*16843008;f[T]=y<<24|y>>>8,d[T]=y<<16|y>>>16,s[T]=y<<8|y>>>24,u[T]=y,y=c*16843009^b*65537^w*257^T*16843008,a[E]=y<<24|y>>>8,l[E]=y<<16|y>>>16,h[E]=y<<8|y>>>24,A[E]=y,T?(T=w^x[x[x[c^w]]],O^=x[x[O]]):T=O=1}},F.expandKey=function(R){for(var g=this.uint8ArrayToUint32Array_(R),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 s=this.ksRows=(d+6+1)*4,u,o,a=this.keySchedule=new Uint32Array(s),l=this.invKeySchedule=new Uint32Array(s),h=this.sBox,A=this.rcon,x=this.invSubMix,T=x[0],O=x[1],S=x[2],E=x[3],w,b;for(u=0;u<s;u++){if(u<d){w=a[u]=g[u];continue}b=w,u%d===0?(b=b<<8|b>>>24,b=h[b>>>24]<<24|h[b>>>16&255]<<16|h[b>>>8&255]<<8|h[b&255],b^=A[u/d|0]<<24):d>6&&u%d===4&&(b=h[b>>>24]<<24|h[b>>>16&255]<<16|h[b>>>8&255]<<8|h[b&255]),a[u]=w=(a[u-d]^b)>>>0}for(o=0;o<s;o++)u=s-o,o&3?b=a[u]:b=a[u-4],o<4||u<=4?l[o]=b:l[o]=T[h[b>>>24]]^O[h[b>>>16&255]]^S[h[b>>>8&255]]^E[h[b&255]],l[o]=l[o]>>>0},F.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},F.decrypt=function(R,g,p){for(var f=this.keySize+6,d=this.invKeySchedule,s=this.invSBox,u=this.invSubMix,o=u[0],a=u[1],l=u[2],h=u[3],A=this.uint8ArrayToUint32Array_(p),x=A[0],T=A[1],O=A[2],S=A[3],E=new Int32Array(R),w=new Int32Array(E.length),b,c,y,m,_,P,I,B,U,C,v,j,G,J,ee=this.networkToHostOrderSwap;g<E.length;){for(U=ee(E[g]),C=ee(E[g+1]),v=ee(E[g+2]),j=ee(E[g+3]),_=U^d[0],P=j^d[1],I=v^d[2],B=C^d[3],G=4,J=1;J<f;J++)b=o[_>>>24]^a[P>>16&255]^l[I>>8&255]^h[B&255]^d[G],c=o[P>>>24]^a[I>>16&255]^l[B>>8&255]^h[_&255]^d[G+1],y=o[I>>>24]^a[B>>16&255]^l[_>>8&255]^h[P&255]^d[G+2],m=o[B>>>24]^a[_>>16&255]^l[P>>8&255]^h[I&255]^d[G+3],_=b,P=c,I=y,B=m,G=G+4;b=s[_>>>24]<<24^s[P>>16&255]<<16^s[I>>8&255]<<8^s[B&255]^d[G],c=s[P>>>24]<<24^s[I>>16&255]<<16^s[B>>8&255]<<8^s[_&255]^d[G+1],y=s[I>>>24]<<24^s[B>>16&255]<<16^s[_>>8&255]<<8^s[P&255]^d[G+2],m=s[B>>>24]<<24^s[_>>16&255]<<16^s[P>>8&255]<<8^s[I&255]^d[G+3],w[g]=ee(b^x),w[g+1]=ee(m^T),w[g+2]=ee(y^O),w[g+3]=ee(c^S),x=U,T=C,O=v,S=j,g=g+4}return w.buffer},W}()},"./src/crypt/decrypter.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return g});var z=D("./src/crypt/aes-crypto.ts"),N=D("./src/crypt/fast-aes-key.ts"),M=D("./src/crypt/aes-decryptor.ts"),W=D("./src/utils/logger.ts"),F=D("./src/utils/mp4-tools.ts"),k=D("./src/utils/typed-array.ts"),R=16,g=function(){function p(d,s,u){var o=u===void 0?{}:u,a=o.removePKCS7Padding,l=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=d,this.config=s,this.removePKCS7Padding=l,l)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(A){}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 s=this.currentResult;if(!s){this.reset();return}var u=new Uint8Array(s);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(u):u},f.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},f.decrypt=function(s,u,o,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(s),u,o);var l=this.flush();l&&a(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(s),u,o).then(a)},f.softwareDecrypt=function(s,u,o){var a=this.currentIV,l=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(s=Object(F.appendUint8Array)(h,s),this.remainderData=null);var A=this.getValidChunk(s);if(!A.length)return null;a&&(o=a);var x=this.softwareDecrypter;x||(x=this.softwareDecrypter=new M.default),x.expandKey(u);var T=l;return this.currentResult=x.decrypt(A.buffer,0,o),this.currentIV=Object(k.sliceUint8)(A,-16).buffer,T||null},f.webCryptoDecrypt=function(s,u,o){var a=this,l=this.subtle;return(this.key!==u||!this.fastAesKey)&&(this.key=u,this.fastAesKey=new N.default(l,u)),this.fastAesKey.expandKey().then(function(h){if(!l)return Promise.reject(new Error("web crypto not initialized"));var A=new z.default(l,o);return A.decrypt(s.buffer,h)}).catch(function(h){return a.onWebCryptoError(h,s,u,o)})},f.onWebCryptoError=function(s,u,o,a){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",s),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(u,o,a)},f.getValidChunk=function(s){var u=s,o=s.length-s.length%R;return o!==s.length&&(u=Object(k.sliceUint8)(s,0,o),this.remainderData=Object(k.sliceUint8)(s,o)),u},f.logOnce=function(s){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+s),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function N(W,F){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=F}var M=N.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},N}()},"./src/demux/aacdemuxer.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/demux/base-audio-demuxer.ts"),N=D("./src/demux/adts.ts"),M=D("./src/utils/logger.ts"),W=D("./src/demux/id3.ts");function F(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,k(g,p)}function k(g,p){return k=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},k(g,p)}var R=function(g){F(p,g);function p(d,s){var u;return u=g.call(this)||this,u.observer=void 0,u.config=void 0,u.observer=d,u.config=s,u}var f=p.prototype;return f.resetInitSegment=function(s,u,o){g.prototype.resetInitSegment.call(this,s,u,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:s,duration:o,inputTimeScale:9e4,dropped:0}},p.probe=function(s){if(!s)return!1;for(var u=W.getID3Data(s,0)||[],o=u.length,a=s.length;o<a;o++)if(N.probe(s,o))return M.logger.log("ADTS sync word found !"),!0;return!1},f.canParse=function(s,u){return N.canParse(s,u)},f.appendFrame=function(s,u,o){N.initTrackConfig(s,this.observer,u,o,s.manifestCodec);var a=N.appendFrame(s,u,o,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},p}(z.default);R.minProbeByteLength=9,V.default=R},"./src/demux/adts.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"getAudioConfig",function(){return W}),D.d(V,"isHeaderPattern",function(){return F}),D.d(V,"getHeaderLength",function(){return k}),D.d(V,"getFullFrameLength",function(){return R}),D.d(V,"canGetFrameLength",function(){return g}),D.d(V,"isHeader",function(){return p}),D.d(V,"canParse",function(){return f}),D.d(V,"probe",function(){return d}),D.d(V,"initTrackConfig",function(){return s}),D.d(V,"getFrameDuration",function(){return u}),D.d(V,"parseFrameHeader",function(){return o}),D.d(V,"appendFrame",function(){return a});var z=D("./src/utils/logger.ts"),N=D("./src/errors.ts"),M=D("./src/events.ts");function W(l,h,A,x){var T,O,S,E,w=navigator.userAgent.toLowerCase(),b=x,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];T=((h[A+2]&192)>>>6)+1;var y=(h[A+2]&60)>>>2;if(y>c.length-1){l.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+y});return}return S=(h[A+2]&1)<<2,S|=(h[A+3]&192)>>>6,z.logger.log("manifest codec:"+x+", ADTS type:"+T+", samplingIndex:"+y),/firefox/i.test(w)?y>=6?(T=5,E=new Array(4),O=y-3):(T=2,E=new Array(2),O=y):w.indexOf("android")!==-1?(T=2,E=new Array(2),O=y):(T=5,E=new Array(4),x&&(x.indexOf("mp4a.40.29")!==-1||x.indexOf("mp4a.40.5")!==-1)||!x&&y>=6?O=y-3:((x&&x.indexOf("mp4a.40.2")!==-1&&(y>=6&&S===1||/vivaldi/i.test(w))||!x&&S===1)&&(T=2,E=new Array(2)),O=y)),E[0]=T<<3,E[0]|=(y&14)>>1,E[1]|=(y&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:c[y],channelCount:S,codec:"mp4a.40."+T,manifestCodec:b}}function F(l,h){return l[h]===255&&(l[h+1]&246)===240}function k(l,h){return l[h+1]&1?7:9}function R(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&&F(l,h)}function f(l,h){return g(l,h)&&F(l,h)&&R(l,h)<=l.length-h}function d(l,h){if(p(l,h)){var A=k(l,h);if(h+A>=l.length)return!1;var x=R(l,h);if(x<=A)return!1;var T=h+x;return T===l.length||p(l,T)}return!1}function s(l,h,A,x,T){if(!l.samplerate){var O=W(h,A,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,z.logger.log("parsed codec:"+l.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function u(l){return 1024*9e4/l}function o(l,h,A,x,T){var O=k(l,h),S=R(l,h);if(S-=O,S>0){var E=A+x*T;return{headerLength:O,frameLength:S,stamp:E}}}function a(l,h,A,x,T){var O=u(l.samplerate),S=o(h,A,x,T,O);if(S){var E=S.frameLength,w=S.headerLength,b=S.stamp,c=w+E,y=Math.max(0,A+c-h.length),m;y?(m=new Uint8Array(c-w),m.set(h.subarray(A+w,h.length),0)):m=h.subarray(A+w,A+c);var _={unit:m,pts:b};return y||l.samples.push(_),{sample:_,length:c,missing:y}}}},"./src/demux/base-audio-demuxer.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"initPTSFn",function(){return R});var z=D("./src/polyfills/number.ts"),N=D("./src/demux/id3.ts"),M=D("./src/demux/dummy-demuxed-track.ts"),W=D("./src/utils/mp4-tools.ts"),F=D("./src/utils/typed-array.ts"),k=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,s,u){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,s){return!1},p.appendFrame=function(d,s,u){},p.demux=function(d,s){this.cachedData&&(d=Object(W.appendUint8Array)(this.cachedData,d),this.cachedData=null);var u=N.getID3Data(d,0),o=u?u.length:0,a,l,h=this._audioTrack,A=this._id3Track,x=u?N.getTimeStamp(u):void 0,T=d.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(x,s)),u&&u.length>0&&A.samples.push({pts:this.initPTS,dts:this.initPTS,data:u}),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,a=o):o=T}else N.canParse(d,o)?(u=N.getID3Data(d,o),A.samples.push({pts:l,dts:l,data:u}),o+=u.length,a=o):o++;if(o===T&&a!==T){var S=Object(F.sliceUint8)(d,a);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,S):this.cachedData=S}}return{audioTrack:h,avcTrack:Object(M.dummyTrack)(),id3Track:A,textTrack:Object(M.dummyTrack)()}},p.demuxSampleAes=function(d,s,u){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(d){var s=this.cachedData;return s&&(this.cachedData=null,this.demux(s,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},p.destroy=function(){},g}(),R=function(p,f){return Object(z.isFiniteNumber)(p)?p*90:f*9e4};V.default=k},"./src/demux/chunk-cache.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function M(){this.chunks=[],this.dataLength=0}var W=M.prototype;return W.push=function(k){this.chunks.push(k),this.dataLength+=k.length},W.flush=function(){var k=this.chunks,R=this.dataLength,g;if(k.length)k.length===1?g=k[0]:g=N(k,R);else return new Uint8Array(0);return this.reset(),g},W.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function N(M,W){for(var F=new Uint8Array(W),k=0,R=0;R<M.length;R++){var g=M[R];F.set(g,k),k+=g.length}return F}},"./src/demux/dummy-demuxed-track.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"dummyTrack",function(){return z});function z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/utils/logger.ts"),N=function(){function M(F){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=F,this.bytesAvailable=F.byteLength,this.word=0,this.bitsAvailable=0}var W=M.prototype;return W.loadWord=function(){var k=this.data,R=this.bytesAvailable,g=k.byteLength-R,p=new Uint8Array(4),f=Math.min(4,R);if(f===0)throw new Error("no bytes available");p.set(k.subarray(g,g+f)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=f*8,this.bytesAvailable-=f},W.skipBits=function(k){var R;this.bitsAvailable>k?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,R=k>>3,k-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},W.readBits=function(k){var R=Math.min(this.bitsAvailable,k),g=this.word>>>32-R;return k>32&&z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=k-R,R>0&&this.bitsAvailable?g<<R|this.readBits(R):g},W.skipLZ=function(){var k;for(k=0;k<this.bitsAvailable;++k)if((this.word&2147483648>>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},W.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},W.readBoolean=function(){return this.readBits(1)===1},W.readUByte=function(){return this.readBits(8)},W.readUShort=function(){return this.readBits(16)},W.readUInt=function(){return this.readBits(32)},W.skipScalingList=function(k){for(var R=8,g=8,p,f=0;f<k;f++)g!==0&&(p=this.readEG(),g=(R+p+256)%256),R=g===0?R:g},W.readSPS=function(){var k=0,R=0,g=0,p=0,f,d,s,u=this.readUByte.bind(this),o=this.readBits.bind(this),a=this.readUEG.bind(this),l=this.readBoolean.bind(this),h=this.skipBits.bind(this),A=this.skipEG.bind(this),x=this.skipUEG.bind(this),T=this.skipScalingList.bind(this);u();var O=u();if(o(5),h(3),u(),x(),O===100||O===110||O===122||O===244||O===44||O===83||O===86||O===118||O===128){var S=a();if(S===3&&h(1),x(),x(),h(1),l())for(d=S!==3?8:12,s=0;s<d;s++)l()&&(s<6?T(16):T(64))}x();var E=a();if(E===0)a();else if(E===1)for(h(1),A(),A(),f=a(),s=0;s<f;s++)A();x(),h(1);var w=a(),b=a(),c=o(1);c===0&&h(1),h(1),l()&&(k=a(),R=a(),g=a(),p=a());var y=[1,1];if(l()&&l()){var m=u();switch(m){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:{y=[u()<<8|u(),u()<<8|u()];break}}}return{width:Math.ceil((w+1)*16-k*2-R*2),height:(2-c)*(b+1)*16-(c?2:4)*(g+p),pixelRatio:y}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();V.default=N},"./src/demux/id3.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"isHeader",function(){return z}),D.d(V,"isFooter",function(){return N}),D.d(V,"getID3Data",function(){return M}),D.d(V,"canParse",function(){return F}),D.d(V,"getTimeStamp",function(){return k}),D.d(V,"isTimeStampFrame",function(){return R}),D.d(V,"getID3Frames",function(){return p}),D.d(V,"decodeFrame",function(){return f}),D.d(V,"utf8ArrayToStr",function(){return a}),D.d(V,"testables",function(){return l});var z=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)))},N=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)))},M=function(T,O){for(var S=O,E=0;z(T,O);){E+=10;var w=W(T,O+6);E+=w,N(T,O+10)&&(E+=10),O+=E}return E>0?T.subarray(S,S+E):void 0},W=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},F=function(T,O){return z(T,O)&&W(T,O+6)+10<=T.length-O},k=function(T){for(var O=p(T),S=0;S<O.length;S++){var E=O[S];if(R(E))return o(E)}return},R=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=W(T,4),E=10;return{type:O,size:S,data:T.subarray(E,E+S)}},p=function(T){for(var O=0,S=[];z(T,O);){var E=W(T,O+6);O+=10;for(var w=O+E;O+8<w;){var b=g(T.subarray(O)),c=f(b);c&&S.push(c),O+=b.size+10}N(T,O)&&(O+=10)}return S},f=function(T){return T.type==="PRIV"?d(T):T.type[0]==="W"?u(T):s(T)},d=function(T){if(T.size<2)return;var O=a(T.data,!0),S=new Uint8Array(T.data.subarray(O.length+1));return{key:T.type,info:O,data:S.buffer}},s=function(T){if(T.size<2)return;if(T.type==="TXXX"){var O=1,S=a(T.data.subarray(O),!0);O+=S.length+1;var E=a(T.data.subarray(O));return{key:T.type,info:S,data:E}}var w=a(T.data.subarray(1));return{key:T.type,data:w}},u=function(T){if(T.type==="WXXX"){if(T.size<2)return;var O=1,S=a(T.data.subarray(O),!0);O+=S.length+1;var E=a(T.data.subarray(O));return{key:T.type,info:S,data:E}}var w=a(T.data);return{key:T.type,data:w}},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},a=function(T,O){O===void 0&&(O=!1);var S=A();if(S){var E=S.decode(T);if(O){var w=E.indexOf("\0");return w!==-1?E.substring(0,w):E}return E.replace(/\0/g,"")}for(var b=T.length,c,y,m,_="",P=0;P<b;){if(c=T[P++],c===0&&O)return _;if(c===0||c===3)continue;switch(c>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:_+=String.fromCharCode(c);break;case 12:case 13:y=T[P++],_+=String.fromCharCode((c&31)<<6|y&63);break;case 14:y=T[P++],m=T[P++],_+=String.fromCharCode((c&15)<<12|(y&63)<<6|(m&63)<<0);break;default:}}return _},l={decodeTextFrame:s},h;function A(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/demux/base-audio-demuxer.ts"),N=D("./src/demux/id3.ts"),M=D("./src/utils/logger.ts"),W=D("./src/demux/mpegaudio.ts");function F(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,k(g,p)}function k(g,p){return k=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},k(g,p)}var R=function(g){F(p,g);function p(){return g.apply(this,arguments)||this}var f=p.prototype;return f.resetInitSegment=function(s,u,o){g.prototype.resetInitSegment.call(this,s,u,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:s,duration:o,inputTimeScale:9e4,dropped:0}},p.probe=function(s){if(!s)return!1;for(var u=N.getID3Data(s,0)||[],o=u.length,a=s.length;o<a;o++)if(W.probe(s,o))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},f.canParse=function(s,u){return W.canParse(s,u)},f.appendFrame=function(s,u,o){return this.initPTS===null?void 0:W.appendFrame(s,u,o,this.initPTS,this.frameIndex)},p}(z.default);R.minProbeByteLength=4,V.default=R},"./src/demux/mp4demuxer.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/utils/mp4-tools.ts"),N=D("./src/demux/dummy-demuxed-track.ts"),M=function(){function W(k,R){this.remainderData=null,this.config=void 0,this.config=R}var F=W.prototype;return F.resetTimeStamp=function(){},F.resetInitSegment=function(){},F.resetContiguity=function(){},W.probe=function(R){return Object(z.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},F.demux=function(R){var g=R,p=Object(N.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(z.appendUint8Array)(this.remainderData,R));var f=Object(z.segmentValidRange)(g);this.remainderData=f.remainder,p.samples=f.valid||new Uint8Array}else p.samples=g;return{audioTrack:Object(N.dummyTrack)(),avcTrack:p,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},F.flush=function(){var R=Object(N.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(N.dummyTrack)(),avcTrack:R,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},F.demuxSampleAes=function(R,g,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},F.destroy=function(){},W}();M.minProbeByteLength=1024,V.default=M},"./src/demux/mpegaudio.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"appendFrame",function(){return k}),D.d(V,"parseHeader",function(){return R}),D.d(V,"isHeaderPattern",function(){return g}),D.d(V,"isHeader",function(){return p}),D.d(V,"canParse",function(){return f}),D.d(V,"probe",function(){return d});var z=null,N=[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],M=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],W=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],F=[0,1,1,4];function k(s,u,o,a,l){if(o+24>u.length)return;var h=R(u,o);if(h&&o+h.frameLength<=u.length){var A=h.samplesPerFrame*9e4/h.sampleRate,x=a+l*A,T={unit:u.subarray(o,o+h.frameLength),pts:x,dts:x};return s.config=[],s.channelCount=h.channelCount,s.samplerate=h.sampleRate,s.samples.push(T),{sample:T,length:h.frameLength,missing:0}}}function R(s,u){var o=s[u+1]>>3&3,a=s[u+1]>>1&3,l=s[u+2]>>4&15,h=s[u+2]>>2&3;if(o!==1&&l!==0&&l!==15&&h!==3){var A=s[u+2]>>1&1,x=s[u+3]>>6,T=o===3?3-a:a===3?3:4,O=N[T*14+l-1]*1e3,S=o===3?0:o===2?1:2,E=M[S*3+h],w=x===3?1:2,b=W[o][a],c=F[a],y=b*8*c,m=Math.floor(b*O/E+A)*c;if(z===null){var _=navigator.userAgent||"",P=_.match(/Chrome\/(\d+)/i);z=P?parseInt(P[1]):0}var I=!!z&&z<=87;return I&&a===2&&O>=224e3&&x===0&&(s[u+3]=s[u+3]|128),{sampleRate:E,channelCount:w,frameLength:m,samplesPerFrame:y}}}function g(s,u){return s[u]===255&&(s[u+1]&224)===224&&(s[u+1]&6)!==0}function p(s,u){return u+1<s.length&&g(s,u)}function f(s,u){var o=4;return g(s,u)&&o<=s.length-u}function d(s,u){if(u+1<s.length&&g(s,u)){var o=4,a=R(s,u),l=o;a!=null&&a.frameLength&&(l=a.frameLength);var h=u+l;return h===s.length||p(s,h)}return!1}},"./src/demux/sample-aes.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/crypt/decrypter.ts"),N=D("./src/demux/tsdemuxer.ts"),M=function(){function W(k,R,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new z.default(k,R,{removePKCS7Padding:!1})}var F=W.prototype;return F.decryptBuffer=function(R,g){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,g)},F.decryptAacSample=function(R,g,p,f){var d=R[g].unit,s=d.subarray(16,d.length-d.length%16),u=s.buffer.slice(s.byteOffset,s.byteOffset+s.length),o=this;this.decryptBuffer(u,function(a){var l=new Uint8Array(a);d.set(l,16),f||o.decryptAacSamples(R,g+1,p)})},F.decryptAacSamples=function(R,g,p){for(;;g++){if(g>=R.length){p();return}if(R[g].unit.length<32)continue;var f=this.decrypter.isSync();if(this.decryptAacSample(R,g,p,f),!f)return}},F.getAvcEncryptedData=function(R){for(var g=Math.floor((R.length-48)/160)*16+16,p=new Int8Array(g),f=0,d=32;d<=R.length-16;d+=160,f+=16)p.set(R.subarray(d,d+16),f);return p},F.getAvcDecryptedUnit=function(R,g){for(var p=new Uint8Array(g),f=0,d=32;d<=R.length-16;d+=160,f+=16)R.set(p.subarray(f,f+16),d);return R},F.decryptAvcSample=function(R,g,p,f,d,s){var u=Object(N.discardEPB)(d.data),o=this.getAvcEncryptedData(u),a=this;this.decryptBuffer(o.buffer,function(l){d.data=a.getAvcDecryptedUnit(u,l),s||a.decryptAvcSamples(R,g,p+1,f)})},F.decryptAvcSamples=function(R,g,p,f){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,p=0){if(g>=R.length){f();return}for(var d=R[g].units;!(p>=d.length);p++){var s=d[p];if(s.data.length<=48||s.type!==1&&s.type!==5)continue;var u=this.decrypter.isSync();if(this.decryptAvcSample(R,g,p,f,s,u),!u)return}}},W}();V.default=M},"./src/demux/transmuxer-interface.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return d});var z=D("./node_modules/webworkify-webpack/index.js"),N=D.n(z),M=D("./src/events.ts"),W=D("./src/demux/transmuxer.ts"),F=D("./src/utils/logger.ts"),k=D("./src/errors.ts"),R=D("./src/utils/mediasource-helper.ts"),g=D("./node_modules/eventemitter3/index.js"),p=D.n(g),f=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},d=function(){function s(o,a,l,h){var A=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=a,this.onTransmuxComplete=l,this.onFlush=h;var x=o.config,T=function(b,c){c=c||{},c.frag=A.frag,c.id=A.id,o.trigger(b,c)};this.observer=new g.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,T),this.observer.on(M.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"){F.logger.log("demuxing in webworker");var E;try{E=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),E.addEventListener("message",this.onwmsg),E.onerror=function(w){o.trigger(M.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(w.message+" ("+w.filename+":"+w.lineno+")")})},E.postMessage({cmd:"init",typeSupported:O,vendor:S,id:a,config:JSON.stringify(x)})}catch(w){F.logger.warn("Error in worker:",w),F.logger.error("Error while initializing DemuxerWorker, fallback to inline"),E&&self.URL.revokeObjectURL(E.objectURL),this.transmuxer=new W.default(this.observer,O,x,S,a),this.worker=null}}else this.transmuxer=new W.default(this.observer,O,x,S,a)}var u=s.prototype;return u.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.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},u.push=function(a,l,h,A,x,T,O,S,E,w){var b=this;E.transmuxing.start=self.performance.now();var c=this.transmuxer,y=this.worker,m=T?T.start:x.start,_=x.decryptdata,P=this.frag,I=!(P&&x.cc===P.cc),B=!(P&&E.level===P.level),U=P?E.sn-P.sn:-1,C=this.part?E.part-this.part.index:1,v=!B&&(U===1||U===0&&C===1),j=self.performance.now();(B||U||x.stats.parsing.start===0)&&(x.stats.parsing.start=j),T&&(C||!v)&&(T.stats.parsing.start=j);var G=new W.TransmuxState(I,v,S,B,m);if(!v||I){F.logger.log("[transmuxer-interface, "+x.type+"]: Starting new transmux session for sn: "+E.sn+" p: "+E.part+" level: "+E.level+" id: "+E.id+`
|
|
discontinuity: `+I+`
|
|
trackSwitch: `+B+`
|
|
contiguous: `+v+`
|
|
accurateTimeOffset: `+S+`
|
|
timeOffset: `+m);var J=new W.TransmuxConfig(h,A,l,O,w);this.configureTransmuxer(J)}if(this.frag=x,this.part=T,y)y.postMessage({cmd:"demux",data:a,decryptdata:_,chunkMeta:E,state:G},a instanceof ArrayBuffer?[a]:[]);else if(c){var ee=c.push(a,_,E,G);Object(W.isPromise)(ee)?ee.then(function(ye){b.handleTransmuxComplete(ye)}):this.handleTransmuxComplete(ee)}},u.flush=function(a){var l=this;a.transmuxing.start=self.performance.now();var h=this.transmuxer,A=this.worker;if(A)A.postMessage({cmd:"flush",chunkMeta:a});else if(h){var x=h.flush(a);Object(W.isPromise)(x)?x.then(function(T){l.handleFlushResult(T,a)}):this.handleFlushResult(x,a)}},u.handleFlushResult=function(a,l){var h=this;a.forEach(function(A){h.handleTransmuxComplete(A)}),this.onFlush(l)},u.onWorkerMessage=function(a){var l=a.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}}},u.configureTransmuxer=function(a){var l=this.worker,h=this.transmuxer;l?l.postMessage({cmd:"configure",config:a}):h&&h.configure(a)},u.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},s}()},"./src/demux/transmuxer-worker.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return k});var z=D("./src/demux/transmuxer.ts"),N=D("./src/events.ts"),M=D("./src/utils/logger.ts"),W=D("./node_modules/eventemitter3/index.js"),F=D.n(W);function k(d){var s=new W.EventEmitter,u=function(a,l){d.postMessage({event:a,data:l})};s.on(N.Events.FRAG_DECRYPTED,u),s.on(N.Events.ERROR,u),d.addEventListener("message",function(o){var a=o.data;switch(a.cmd){case"init":{var l=JSON.parse(a.config);d.transmuxer=new z.default(s,a.typeSupported,l,a.vendor,a.id),Object(M.enableLogs)(l.debug),u("init",null);break}case"configure":{d.transmuxer.configure(a.config);break}case"demux":{var h=d.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(z.isPromise)(h)?h.then(function(T){R(d,T)}):R(d,h);break}case"flush":{var A=a.chunkMeta,x=d.transmuxer.flush(A);Object(z.isPromise)(x)?x.then(function(T){p(d,T,A)}):p(d,x,A);break}default:break}})}function R(d,s){if(f(s.remuxResult))return;var u=[],o=s.remuxResult,a=o.audio,l=o.video;a&&g(u,a),l&&g(u,l),d.postMessage({event:"transmuxComplete",data:s},u)}function g(d,s){s.data1&&d.push(s.data1.buffer),s.data2&&d.push(s.data2.buffer)}function p(d,s,u){s.forEach(function(o){R(d,o)}),d.postMessage({event:"flush",data:u})}function f(d){return!d.audio&&!d.video&&!d.text&&!d.id3&&!d.initSegment}},"./src/demux/transmuxer.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return l}),D.d(V,"isPromise",function(){return x}),D.d(V,"TransmuxConfig",function(){return T}),D.d(V,"TransmuxState",function(){return O});var z=D("./src/events.ts"),N=D("./src/errors.ts"),M=D("./src/crypt/decrypter.ts"),W=D("./src/demux/aacdemuxer.ts"),F=D("./src/demux/mp4demuxer.ts"),k=D("./src/demux/tsdemuxer.ts"),R=D("./src/demux/mp3demuxer.ts"),g=D("./src/remux/mp4-remuxer.ts"),p=D("./src/remux/passthrough-remuxer.ts"),f=D("./src/demux/chunk-cache.ts"),d=D("./src/utils/mp4-tools.ts"),s=D("./src/utils/logger.ts"),u;try{u=self.performance.now.bind(self.performance)}catch(S){s.logger.debug("Unable to use Performance API on this environment"),u=self.Date.now}var o=[{demux:k.default,remux:g.default},{demux:F.default,remux:p.default},{demux:W.default,remux:g.default},{demux:R.default,remux:g.default}],a=1024;o.forEach(function(S){var E=S.demux;a=Math.max(a,E.minProbeByteLength)});var l=function(){function S(w,b,c,y,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=w,this.typeSupported=b,this.config=c,this.vendor=y,this.id=m}var E=S.prototype;return E.configure=function(b){this.transmuxConfig=b,this.decrypter&&this.decrypter.reset()},E.push=function(b,c,y,m){var _=this,P=y.transmuxing;P.executeStart=u();var I=new Uint8Array(b),B=this.cache,U=this.config,C=this.currentTransmuxState,v=this.transmuxConfig;m&&(this.currentTransmuxState=m);var j=h(I,c);if(j&&j.method==="AES-128"){var G=this.getDecrypter();if(U.enableSoftwareAES){var J=G.softwareDecrypt(I,j.key.buffer,j.iv.buffer);if(!J)return P.executeEnd=u(),A(y);I=new Uint8Array(J)}else return this.decryptionPromise=G.webCryptoDecrypt(I,j.key.buffer,j.iv.buffer).then(function(xe){var Re=_.push(xe,null,y);return _.decryptionPromise=null,Re}),this.decryptionPromise}var ee=m||C,ye=ee.contiguous,he=ee.discontinuity,ge=ee.trackSwitch,pe=ee.accurateTimeOffset,oe=ee.timeOffset,ie=v.audioCodec,ue=v.videoCodec,$=v.defaultInitPts,re=v.duration,q=v.initSegmentData;if((he||ge)&&this.resetInitSegment(q,ie,ue,re),he&&this.resetInitialTimestamp($),ye||this.resetContiguity(),this.needsProbing(I,he,ge)){if(B.dataLength){var be=B.flush();I=Object(d.appendUint8Array)(be,I)}this.configureTransmuxer(I,v)}var Oe=this.transmux(I,j,oe,pe,y),_e=this.currentTransmuxState;return _e.contiguous=!0,_e.discontinuity=!1,_e.trackSwitch=!1,P.executeEnd=u(),Oe},E.flush=function(b){var c=this,y=b.transmuxing;y.executeStart=u();var m=this.decrypter,_=this.cache,P=this.currentTransmuxState,I=this.decryptionPromise;if(I)return I.then(function(){return c.flush(b)});var B=[],U=P.timeOffset;if(m){var C=m.flush();C&&B.push(this.push(C,null,b))}var v=_.dataLength;_.reset();var j=this.demuxer,G=this.remuxer;if(!j||!G)return v>=a&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),y.executeEnd=u(),[A(b)];var J=j.flush(U);return x(J)?J.then(function(ee){return c.flushRemux(B,ee,b),B}):(this.flushRemux(B,J,b),B)},E.flushRemux=function(b,c,y){var m=c.audioTrack,_=c.avcTrack,P=c.id3Track,I=c.textTrack,B=this.currentTransmuxState,U=B.accurateTimeOffset,C=B.timeOffset;s.logger.log("[transmuxer.ts]: Flushed fragment "+y.sn+(y.part>-1?" p: "+y.part:"")+" of level "+y.level);var v=this.remuxer.remux(m,_,P,I,C,U,!0,this.id);b.push({remuxResult:v,chunkMeta:y}),y.transmuxing.executeEnd=u()},E.resetInitialTimestamp=function(b){var c=this.demuxer,y=this.remuxer;if(!c||!y)return;c.resetTimeStamp(b),y.resetTimeStamp(b)},E.resetContiguity=function(){var b=this.demuxer,c=this.remuxer;if(!b||!c)return;b.resetContiguity(),c.resetNextTimestamp()},E.resetInitSegment=function(b,c,y,m){var _=this.demuxer,P=this.remuxer;if(!_||!P)return;_.resetInitSegment(c,y,m),P.resetInitSegment(b,c,y)},E.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},E.transmux=function(b,c,y,m,_){var P;return c&&c.method==="SAMPLE-AES"?P=this.transmuxSampleAes(b,c,y,m,_):P=this.transmuxUnencrypted(b,y,m,_),P},E.transmuxUnencrypted=function(b,c,y,m){var _=this.demuxer.demux(b,c,!1,!this.config.progressive),P=_.audioTrack,I=_.avcTrack,B=_.id3Track,U=_.textTrack,C=this.remuxer.remux(P,I,B,U,c,y,!1,this.id);return{remuxResult:C,chunkMeta:m}},E.transmuxSampleAes=function(b,c,y,m,_){var P=this;return this.demuxer.demuxSampleAes(b,c,y).then(function(I){var B=P.remuxer.remux(I.audioTrack,I.avcTrack,I.id3Track,I.textTrack,y,m,!1,P.id);return{remuxResult:B,chunkMeta:_}})},E.configureTransmuxer=function(b,c){for(var y=this.config,m=this.observer,_=this.typeSupported,P=this.vendor,I=c.audioCodec,B=c.defaultInitPts,U=c.duration,C=c.initSegmentData,v=c.videoCodec,j,G=0,J=o.length;G<J;G++)if(o[G].demux.probe(b)){j=o[G];break}j||(s.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),j={demux:F.default,remux:p.default});var ee=this.demuxer,ye=this.remuxer,he=j.remux,ge=j.demux;(!ye||!(ye instanceof he))&&(this.remuxer=new he(m,y,_,P)),(!ee||!(ee instanceof ge))&&(this.demuxer=new ge(m,y,_),this.probe=ge.probe),this.resetInitSegment(C,I,v,U),this.resetInitialTimestamp(B)},E.needsProbing=function(b,c,y){return!this.demuxer||!this.remuxer||c||y},E.getDecrypter=function(){var b=this.decrypter;return b||(b=this.decrypter=new M.default(this.observer,this.config)),b},S}();function h(S,E){var w=null;return S.byteLength>0&&E!=null&&E.key!=null&&E.iv!==null&&E.method!=null&&(w=E),w}var A=function(E){return{remuxResult:{},chunkMeta:E}};function x(S){return"then"in S&&S.then instanceof Function}var T=function(E,w,b,c,y){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=w,this.initSegmentData=b,this.duration=c,this.defaultInitPts=y},O=function(E,w,b,c,y){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=w,this.accurateTimeOffset=b,this.trackSwitch=c,this.timeOffset=y}},"./src/demux/tsdemuxer.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"discardEPB",function(){return A});var z=D("./src/demux/adts.ts"),N=D("./src/demux/mpegaudio.ts"),M=D("./src/demux/exp-golomb.ts"),W=D("./src/demux/id3.ts"),F=D("./src/demux/sample-aes.ts"),k=D("./src/events.ts"),R=D("./src/utils/mp4-tools.ts"),g=D("./src/utils/logger.ts"),p=D("./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),w=0;w<E;){if(S[w]===71&&S[w+188]===71&&S[w+2*188]===71)return w;w++}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,w){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=x.createTrack("video",w),this._audioTrack=x.createTrack("audio",w),this._id3Track=x.createTrack("id3",w),this._txtTrack=x.createTrack("text",w),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=S,this.videoCodec=E,this._duration=w},T.resetTimeStamp=function(){},T.resetContiguity=function(){var S=this._audioTrack,E=this._avcTrack,w=this._id3Track;S&&(S.pesData=null),E&&(E.pesData=null),w&&(w.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},T.demux=function(S,E,w,b){w===void 0&&(w=!1),b===void 0&&(b=!1),w||(this.sampleAes=null);var c,y=this._avcTrack,m=this._audioTrack,_=this._id3Track,P=y.pid,I=y.pesData,B=m.pid,U=_.pid,C=m.pesData,v=_.pesData,j=!1,G=this.pmtParsed,J=this._pmtId,ee=S.length;if(this.remainderData&&(S=Object(R.appendUint8Array)(this.remainderData,S),ee=S.length,this.remainderData=null),ee<188&&!b)return this.remainderData=S,{audioTrack:m,avcTrack:y,id3Track:_,textTrack:this._txtTrack};var ye=Math.max(0,x.syncOffset(S));ee-=(ee+ye)%188,ee<S.byteLength&&!b&&(this.remainderData=new Uint8Array(S.buffer,ee,S.buffer.byteLength-ee));for(var he=ye;he<ee;he+=188)if(S[he]===71){var ge=!!(S[he+1]&64),pe=((S[he+1]&31)<<8)+S[he+2],oe=(S[he+3]&48)>>4,ie=void 0;if(oe>1){if(ie=he+5+S[he+4],ie===he+188)continue}else ie=he+4;switch(pe){case P:ge&&(I&&(c=a(I))&&this.parseAVCPES(c,!1),I={data:[],size:0}),I&&(I.data.push(S.subarray(ie,he+188)),I.size+=he+188-ie);break;case B:ge&&(C&&(c=a(C))&&(m.isAAC?this.parseAACPES(c):this.parseMPEGPES(c)),C={data:[],size:0}),C&&(C.data.push(S.subarray(ie,he+188)),C.size+=he+188-ie);break;case U:ge&&(v&&(c=a(v))&&this.parseID3PES(c),v={data:[],size:0}),v&&(v.data.push(S.subarray(ie,he+188)),v.size+=he+188-ie);break;case 0:ge&&(ie+=S[ie]+1),J=this._pmtId=u(S,ie);break;case J:{ge&&(ie+=S[ie]+1);var ue=o(S,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,w);P=ue.avc,P>0&&(y.pid=P),B=ue.audio,B>0&&(m.pid=B,m.isAAC=ue.isAAC),U=ue.id3,U>0&&(_.pid=U),j&&!G&&(g.logger.log("reparse from beginning"),j=!1,he=ye-188),G=this.pmtParsed=!0;break}case 17:case 8191:break;default:j=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});y.pesData=I,m.pesData=C,_.pesData=v;var $={audioTrack:m,avcTrack:y,id3Track:_,textTrack:this._txtTrack};return b&&this.extractRemainingSamples($),$},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,w=S.avcTrack,b=S.id3Track,c=w.pesData,y=E.pesData,m=b.pesData,_;c&&(_=a(c))?(this.parseAVCPES(_,!0),w.pesData=null):w.pesData=c,y&&(_=a(y))?(E.isAAC?this.parseAACPES(_):this.parseMPEGPES(_),E.pesData=null):(y!=null&&y.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),E.pesData=y),m&&(_=a(m))?(this.parseID3PES(_),b.pesData=null):b.pesData=m},T.demuxSampleAes=function(S,E,w){var b=this.demux(S,w,!0,!this.config.progressive),c=this.sampleAes=new F.default(this.observer,this.config,E);return this.decrypt(b,c)},T.decrypt=function(S,E){return new Promise(function(w){var b=S.audioTrack,c=S.avcTrack;b.samples&&b.isAAC?E.decryptAacSamples(b.samples,0,function(){c.samples?E.decryptAvcSamples(c.samples,0,0,function(){w(S)}):w(S)}):c.samples&&E.decryptAvcSamples(c.samples,0,0,function(){w(S)})})},T.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},T.parseAVCPES=function(S,E){var w=this,b=this._avcTrack,c=this.parseAVCNALu(S.data),y=!1,m=this.avcSample,_,P=!1;S.data=null,m&&c.length&&!b.audFound&&(l(m,b),m=this.avcSample=s(!1,S.pts,S.dts,"")),c.forEach(function(I){switch(I.type){case 1:{_=!0,m||(m=w.avcSample=s(!0,S.pts,S.dts,"")),y&&(m.debug+="NDR "),m.frame=!0;var B=I.data;if(P&&B.length>4){var U=new M.default(B).readSliceType();(U===2||U===4||U===7||U===9)&&(m.key=!0)}break}case 5:_=!0,m||(m=w.avcSample=s(!0,S.pts,S.dts,"")),y&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{_=!0,y&&m&&(m.debug+="SEI ");var C=new M.default(A(I.data));C.readUByte();for(var v=0,j=0,G=!1,J=0;!G&&C.bytesAvailable>1;){v=0;do J=C.readUByte(),v+=J;while(J===255);j=0;do J=C.readUByte(),j+=J;while(J===255);if(v===4&&C.bytesAvailable!==0){G=!0;var ee=C.readUByte();if(ee===181){var ye=C.readUShort();if(ye===49){var he=C.readUInt();if(he===1195456820){var ge=C.readUByte();if(ge===3){for(var pe=C.readUByte(),oe=C.readUByte(),ie=31&pe,ue=[pe,oe],$=0;$<ie;$++)ue.push(C.readUByte()),ue.push(C.readUByte()),ue.push(C.readUByte());h(w._txtTrack.samples,{type:3,pts:S.pts,bytes:ue})}}}}}else if(v===5&&C.bytesAvailable!==0){if(G=!0,j>16){for(var re=[],q=0;q<16;q++)re.push(C.readUByte().toString(16)),(q===3||q===5||q===7||q===9)&&re.push("-");for(var be=j-16,Oe=new Uint8Array(be),_e=0;_e<be;_e++)Oe[_e]=C.readUByte();h(w._txtTrack.samples,{pts:S.pts,payloadType:v,uuid:re.join(""),userData:Object(W.utf8ArrayToStr)(Oe),userDataBytes:Oe})}}else if(j<C.bytesAvailable)for(var xe=0;xe<j;xe++)C.readUByte()}break}case 7:if(_=!0,P=!0,y&&m&&(m.debug+="SPS "),!b.sps){var Re=new M.default(I.data),ke=Re.readSPS();b.width=ke.width,b.height=ke.height,b.pixelRatio=ke.pixelRatio,b.sps=[I.data],b.duration=w._duration;for(var De=I.data.subarray(1,4),Le="avc1.",Ce=0;Ce<3;Ce++){var We=De[Ce].toString(16);We.length<2&&(We="0"+We),Le+=We}b.codec=Le}break;case 8:_=!0,y&&m&&(m.debug+="PPS "),b.pps||(b.pps=[I.data]);break;case 9:_=!1,b.audFound=!0,m&&l(m,b),m=w.avcSample=s(!1,S.pts,S.dts,y?"AUD ":"");break;case 12:_=!1;break;default:_=!1,m&&(m.debug+="unknown NAL "+I.type+" ");break}if(m&&_){var Je=m.units;Je.push(I)}}),E&&m&&(l(m,b),this.avcSample=null)},T.getLastNalUnit=function(){var S,E=this.avcSample,w;if(!E||E.units.length===0){var b=this._avcTrack.samples;E=b[b.length-1]}if((S=E)!==null&&S!==void 0&&S.units){var c=E.units;w=c[c.length-1]}return w},T.parseAVCNALu=function(S){var E=S.byteLength,w=this._avcTrack,b=w.naluState||0,c=b,y=[],m=0,_,P,I,B=-1,U=0;for(b===-1&&(B=0,U=S[0]&31,b=0,m=1);m<E;){if(_=S[m++],!b){b=_?0:1;continue}if(b===1){b=_?0:2;continue}if(!_)b=3;else if(_===1){if(B>=0){var C={data:S.subarray(B,m-b-1),type:U};y.push(C)}else{var v=this.getLastNalUnit();if(v&&(c&&m<=4-c&&(v.state&&(v.data=v.data.subarray(0,v.data.byteLength-c))),P=m-b-1,P>0)){var j=new Uint8Array(v.data.byteLength+P);j.set(v.data,0),j.set(S.subarray(0,P),v.data.byteLength),v.data=j,v.state=0}}m<E?(I=S[m]&31,B=m,U=I,b=0):b=-1}else b=0}if(B>=0&&b>=0){var G={data:S.subarray(B,E),type:U,state:b};y.push(G)}if(y.length===0){var J=this.getLastNalUnit();if(J){var ee=new Uint8Array(J.data.byteLength+S.byteLength);ee.set(J.data,0),ee.set(S,J.data.byteLength),J.data=ee}}return w.naluState=b,y},T.parseAACPES=function(S){var E=0,w=this._audioTrack,b=this.aacOverFlow,c=S.data;if(b){this.aacOverFlow=null;var y=b.sample.unit.byteLength,m=Math.min(b.missing,y),_=y-m;b.sample.unit.set(c.subarray(0,m),_),w.samples.push(b.sample),E=b.missing}var P,I;for(P=E,I=c.length;P<I-1&&!z.isHeader(c,P);P++);if(P!==E){var B,U;if(P<I-1?(B="AAC PES did not start with ADTS header,offset:"+P,U=!1):(B="no ADTS header found in AAC PES",U=!0),g.logger.warn("parsing error:"+B),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:U,reason:B}),U)return}z.initTrackConfig(w,this.observer,c,P,this.audioCodec);var C;if(S.pts!==void 0)C=S.pts;else if(b){var v=z.getFrameDuration(w.samplerate);C=b.sample.pts+v}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var j=0;P<I;)if(z.isHeader(c,P)){if(P+5<I){var G=z.appendFrame(w,c,P,C,j);if(G)if(G.missing)this.aacOverFlow=G;else{P+=G.length,j++;continue}}break}else P++},T.parseMPEGPES=function(S){var E=S.data,w=E.length,b=0,c=0,y=S.pts;if(y===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;c<w;)if(N.isHeader(E,c)){var m=N.appendFrame(this._audioTrack,E,c,y,b);if(m)c+=m.length,b++;else break}else c++},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 s(x,T,O,S){return{key:x,frame:!1,pts:T,dts:O,units:[],debug:S,length:0}}function u(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},w=(x[T+1]&15)<<8|x[T+2],b=T+3+w-4,c=(x[T+10]&15)<<8|x[T+11];for(T+=12+c;T<b;){var y=(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=y);break;case 21:E.id3===-1&&(E.id3=y);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=y);break;case 3:case 4:O?E.audio===-1&&(E.audio=y,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 a(x){var T=0,O,S,E,w,b,c=x.data;if(!x||x.size===0)return null;for(;c[0].length<19&&c.length>1;){var y=new Uint8Array(c[0].length+c[1].length);y.set(c[0]),y.set(c[1],c[0].length),c[0]=y,c.splice(1,1)}O=c[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 _=O[7];_&192&&(w=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,_&64?(b=(O[14]&14)*536870912+(O[15]&255)*4194304+(O[16]&254)*16384+(O[17]&255)*128+(O[18]&254)/2,w-b>60*9e4&&(g.logger.warn(Math.round((w-b)/9e4)+"s delta between PTS and DTS, align them"),w=b)):b=w),E=O[8];var P=E+9;if(x.size<=P)return null;x.size-=P;for(var I=new Uint8Array(x.size),B=0,U=c.length;B<U;B++){O=c[B];var C=O.byteLength;if(P)if(P>C){P-=C;continue}else O=O.subarray(P),C-=P,P=0;I.set(O,T),T+=C}return S&&(S-=E+3),{data:I,pts:w,dts:b,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 A(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,w=new Uint8Array(E),b=0;for(S=0;S<E;b++,S++)b===O[0]&&(b++,O.shift()),w[S]=x[b];return w}V.default=d},"./src/errors.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"ErrorTypes",function(){return z}),D.d(V,"ErrorDetails",function(){return N});var z;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(z||(z={}));var N;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.UNKNOWN="unknown"})(N||(N={}))},"./src/events.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"Events",function(){return z});var z;(function(N){N.MEDIA_ATTACHING="hlsMediaAttaching",N.MEDIA_ATTACHED="hlsMediaAttached",N.MEDIA_DETACHING="hlsMediaDetaching",N.MEDIA_DETACHED="hlsMediaDetached",N.BUFFER_RESET="hlsBufferReset",N.BUFFER_CODECS="hlsBufferCodecs",N.BUFFER_CREATED="hlsBufferCreated",N.BUFFER_APPENDING="hlsBufferAppending",N.BUFFER_APPENDED="hlsBufferAppended",N.BUFFER_EOS="hlsBufferEos",N.BUFFER_FLUSHING="hlsBufferFlushing",N.BUFFER_FLUSHED="hlsBufferFlushed",N.MANIFEST_LOADING="hlsManifestLoading",N.MANIFEST_LOADED="hlsManifestLoaded",N.MANIFEST_PARSED="hlsManifestParsed",N.LEVEL_SWITCHING="hlsLevelSwitching",N.LEVEL_SWITCHED="hlsLevelSwitched",N.LEVEL_LOADING="hlsLevelLoading",N.LEVEL_LOADED="hlsLevelLoaded",N.LEVEL_UPDATED="hlsLevelUpdated",N.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",N.LEVELS_UPDATED="hlsLevelsUpdated",N.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",N.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",N.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",N.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",N.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",N.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",N.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",N.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",N.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",N.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",N.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",N.CUES_PARSED="hlsCuesParsed",N.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",N.INIT_PTS_FOUND="hlsInitPtsFound",N.FRAG_LOADING="hlsFragLoading",N.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",N.FRAG_LOADED="hlsFragLoaded",N.FRAG_DECRYPTED="hlsFragDecrypted",N.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",N.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",N.FRAG_PARSING_METADATA="hlsFragParsingMetadata",N.FRAG_PARSED="hlsFragParsed",N.FRAG_BUFFERED="hlsFragBuffered",N.FRAG_CHANGED="hlsFragChanged",N.FPS_DROP="hlsFpsDrop",N.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",N.ERROR="hlsError",N.DESTROYING="hlsDestroying",N.KEY_LOADING="hlsKeyLoading",N.KEY_LOADED="hlsKeyLoaded",N.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",N.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return x});var z=D("./node_modules/url-toolkit/src/url-toolkit.js"),N=D.n(z),M=D("./src/loader/playlist-loader.ts"),W=D("./src/loader/key-loader.ts"),F=D("./src/controller/id3-track-controller.ts"),k=D("./src/controller/latency-controller.ts"),R=D("./src/controller/level-controller.ts"),g=D("./src/controller/fragment-tracker.ts"),p=D("./src/controller/stream-controller.ts"),f=D("./src/is-supported.ts"),d=D("./src/utils/logger.ts"),s=D("./src/config.ts"),u=D("./node_modules/eventemitter3/index.js"),o=D.n(u),a=D("./src/events.ts"),l=D("./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 A(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 u.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(s.mergeConfig)(T.DefaultConfig,S);this.userConfig=S,Object(d.enableLogs)(E.debug),this._autoLevelCapping=-1,E.progressive&&Object(s.enableStreamingMode)(E);var w=E.abrController,b=E.bufferController,c=E.capLevelController,y=E.fpsController,m=this.abrController=new w(this),_=this.bufferController=new b(this),P=this.capLevelController=new c(this),I=new y(this),B=new M.default(this),U=new W.default(this),C=new F.default(this),v=this.levelController=new R.default(this),j=new g.FragmentTracker(this),G=this.streamController=new p.default(this,j);P.setStreamController(G),I.setStreamController(G);var J=[v,G];this.networkControllers=J;var ee=[B,U,m,_,P,I,C,j];this.audioTrackController=this.createController(E.audioTrackController,null,J),this.createController(E.audioStreamController,j,J),this.subtitleTrackController=this.createController(E.subtitleTrackController,null,J),this.createController(E.subtitleStreamController,j,J),this.createController(E.timelineController,null,ee),this.emeController=this.createController(E.emeController,null,ee),this.cmcdController=this.createController(E.cmcdController,null,ee),this.latencyController=this.createController(k.default,null,ee),this.coreComponents=ee}var O=T.prototype;return O.createController=function(E,w,b){if(E){var c=w?new E(this,w):new E(this);return b&&b.push(c),c}return null},O.on=function(E,w,b){b===void 0&&(b=this),this._emitter.on(E,w,b)},O.once=function(E,w,b){b===void 0&&(b=this),this._emitter.once(E,w,b)},O.removeAllListeners=function(E){this._emitter.removeAllListeners(E)},O.off=function(E,w,b,c){b===void 0&&(b=this),this._emitter.off(E,w,b,c)},O.listeners=function(E){return this._emitter.listeners(E)},O.emit=function(E,w,b){return this._emitter.emit(E,w,b)},O.trigger=function(E,w){if(this.config.debug)return this.emit(E,E,w);try{return this.emit(E,E,w)}catch(b){d.logger.error("An internal error happened while handling event "+E+'. Error message: "'+b.message+'". Here is a stacktrace:',b),this.trigger(a.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:E,error:b})}return!1},O.listenerCount=function(E){return this._emitter.listenerCount(E)},O.destroy=function(){d.logger.log("destroy"),this.trigger(a.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(a.Events.MEDIA_ATTACHING,{media:E})},O.detachMedia=function(){d.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},O.loadSource=function(E){this.stopLoad();var w=this.media,b=this.url,c=this.url=z.buildAbsoluteURL(self.location.href,E,{alwaysNormalize:!0});d.logger.log("loadSource:"+c),w&&b&&b!==c&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(w)),this.trigger(a.Events.MANIFEST_LOADING,{url:E})},O.startLoad=function(E){E===void 0&&(E=-1),d.logger.log("startLoad("+E+")"),this.networkControllers.forEach(function(w){w.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,w){w===void 0&&(w=0),this.levelController.removeLevel(E,w)},A(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 w=!!E;w!==this.config.capLevelToPlayerSize&&(w?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=w)}},{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,w=this.config.minAutoBitrate;if(!E)return 0;for(var b=E.length,c=0;c<b;c++)if(E[c].maxBitrate>w)return c;return 0}},{key:"maxAutoLevel",get:function(){var E=this.levels,w=this.autoLevelCapping,b;return w===-1&&E&&E.length?b=E.length-1:b=w,b}},{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 w=this.audioTrackController;w&&(w.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 w=this.subtitleTrackController;w&&(w.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 w=this.subtitleTrackController;w&&(w.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 a.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return T.defaultConfig?T.defaultConfig:s.hlsDefaultConfig},set:function(E){T.defaultConfig=E}}]),T}();x.defaultConfig=void 0},"./src/is-supported.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"isSupported",function(){return M}),D.d(V,"changeTypeSupported",function(){return W});var z=D("./src/utils/mediasource-helper.ts");function N(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var F=Object(z.getMediaSource)();if(!F)return!1;var k=N(),R=F&&typeof F.isTypeSupported=="function"&&F.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!R&&!!g}function W(){var F,k=N();return typeof(k==null||((F=k.prototype)===null||F===void 0)?void 0:F.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return d}),D.d(V,"LoadError",function(){return u});var z=D("./src/polyfills/number.ts"),N=D("./src/errors.ts");function M(o,a){o.prototype=Object.create(a.prototype),o.prototype.constructor=o,g(o,a)}function W(o){var a=typeof Map=="function"?new Map:void 0;return W=function(h){if(h===null||!R(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(h))return a.get(h);a.set(h,A)}function A(){return F(h,arguments,p(this).constructor)}return A.prototype=Object.create(h.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),g(A,h)},W(o)}function F(o,a,l){return k()?F=Reflect.construct:F=function(A,x,T){var O=[null];O.push.apply(O,x);var S=Function.bind.apply(A,O),E=new S;return T&&g(E,T.prototype),E},F.apply(null,arguments)}function k(){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 R(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function g(o,a){return g=Object.setPrototypeOf||function(h,A){return h.__proto__=A,h},g(o,a)}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 a=o.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(h,A){var x=this,T=h.url;if(!T)return Promise.reject(new u({type:N.ErrorTypes.NETWORK_ERROR,details:N.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(w,b){x.loader&&x.loader.destroy();var c=x.loader=h.loader=S?new S(O):new E(O),y=s(h),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};h.stats=c.stats,c.load(y,m,{onSuccess:function(P,I,B,U){x.resetLoader(h,c),w({frag:h,part:null,payload:P.data,networkDetails:U})},onError:function(P,I,B){x.resetLoader(h,c),b(new u({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:P,networkDetails:B}))},onAbort:function(P,I,B){x.resetLoader(h,c),b(new u({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:B}))},onTimeout:function(P,I,B){x.resetLoader(h,c),b(new u({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:B}))},onProgress:function(P,I,B,U){A&&A({frag:h,part:null,payload:B,networkDetails:U})}})})},a.loadPart=function(h,A,x){var T=this;this.abort();var O=this.config,S=O.fLoader,E=O.loader;return new Promise(function(w,b){T.loader&&T.loader.destroy();var c=T.loader=h.loader=S?new S(O):new E(O),y=s(h,A),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};A.stats=c.stats,c.load(y,m,{onSuccess:function(P,I,B,U){T.resetLoader(h,c),T.updateStatsFromPart(h,A);var C={frag:h,part:A,payload:P.data,networkDetails:U};x(C),w(C)},onError:function(P,I,B){T.resetLoader(h,c),b(new u({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:A,response:P,networkDetails:B}))},onAbort:function(P,I,B){h.stats.aborted=A.stats.aborted,T.resetLoader(h,c),b(new u({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:A,networkDetails:B}))},onTimeout:function(P,I,B){T.resetLoader(h,c),b(new u({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:A,networkDetails:B}))}})})},a.updateStatsFromPart=function(h,A){var x=h.stats,T=A.stats,O=T.total;if(x.loaded+=T.loaded,O){var S=Math.round(h.duration/A.duration),E=Math.min(Math.round(x.loaded/O),S),w=S-E,b=w*Math.round(x.loaded/E);x.total=x.loaded+b}else x.total=Math.max(x.loaded,x.total);var c=x.loading,y=T.loading;c.start?c.first+=y.first-y.start:(c.start=y.start,c.first=y.first),c.end=y.end},a.resetLoader=function(h,A){h.loader=null,this.loader===A&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),A.destroy()},o}();function s(o,a){a===void 0&&(a=null);var l=a||o,h={frag:o,part:a,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},A=l.byteRangeStartOffset,x=l.byteRangeEndOffset;return Object(z.isFiniteNumber)(A)&&Object(z.isFiniteNumber)(x)&&(h.rangeStart=A,h.rangeEnd=x),h}var u=function(o){M(a,o);function a(l){for(var h,A=arguments.length,x=new Array(A>1?A-1:0),T=1;T<A;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 a}(W(Error))},"./src/loader/fragment.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"ElementaryStreamTypes",function(){return d}),D.d(V,"BaseSegment",function(){return s}),D.d(V,"Fragment",function(){return u}),D.d(V,"Part",function(){return o});var z=D("./src/polyfills/number.ts"),N=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(N),W=D("./src/utils/logger.ts"),F=D("./src/loader/level-key.ts"),k=D("./src/loader/load-stats.ts");function R(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,g(a,l)}function g(a,l){return g=Object.setPrototypeOf||function(A,x){return A.__proto__=x,A},g(a,l)}function p(a,l){for(var h=0;h<l.length;h++){var A=l[h];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(a,A.key,A)}}function f(a,l,h){return l&&p(a.prototype,l),h&&p(a,h),a}var d;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(d||(d={}));var s=function(){function a(h){var A;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(A={},A[d.AUDIO]=null,A[d.VIDEO]=null,A[d.AUDIOVIDEO]=null,A),this.baseurl=h}var l=a.prototype;return l.setByteRange=function(A,x){var T=A.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(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(N.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(A){this._url=A}}]),a}(),u=function(a){R(l,a);function l(A,x){var T;return T=a.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 k.LoadStats,T.urlId=0,T.data=void 0,T.bitrateTest=!1,T.title=null,T.initSegment=null,T.type=A,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=F.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,w){w===void 0&&(w=!1);var b=this.elementaryStreams,c=b[x];if(!c){b[x]={startPTS:T,endPTS:O,startDTS:S,endDTS:E,partial:w};return}c.startPTS=Math.min(c.startPTS,T),c.endPTS=Math.max(c.endPTS,O),c.startDTS=Math.min(c.startDTS,S),c.endDTS=Math.max(c.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&&W.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(z.isFiniteNumber)(this.programDateTime))return null;var x=Object(z.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}(s),o=function(a){R(l,a);function l(h,A,x,T,O){var S;S=a.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 k.LoadStats,S.duration=h.decimalFloatingPoint("DURATION"),S.gap=h.bool("GAP"),S.independent=h.bool("INDEPENDENT"),S.relurl=h.enumeratedString("URI"),S.fragment=A,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 A=this.elementaryStreams;return!!(A.audio||A.video||A.audiovideo)}}]),l}(s)},"./src/loader/key-loader.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return W});var z=D("./src/events.ts"),N=D("./src/errors.ts"),M=D("./src/utils/logger.ts"),W=function(){function F(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var k=F.prototype;return k._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var p=this.loaders[g];p&&p.destroy()}this.loaders={}},k.onKeyLoading=function(g,p){var f=p.frag,d=f.type,s=this.loaders[d];if(!f.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var u=f.decryptdata.uri;if(u!==this.decrypturl||this.decryptkey===null){var o=this.hls.config;if(s&&(M.logger.warn("abort previous key loader for type:"+d),s.abort()),!u){M.logger.warn("key uri is falsy");return}var a=o.loader,l=f.loader=this.loaders[d]=new a(o);this.decrypturl=u,this.decryptkey=null;var h={url:u,frag:f,responseType:"arraybuffer"},A={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,A,x)}else this.decryptkey&&(f.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:f}))},k.loadsuccess=function(g,p,f){var d=f.frag;if(!d.decryptdata){M.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(z.Events.KEY_LOADED,{frag:d})},k.loaderror=function(g,p){var f=p.frag,d=f.loader;d&&d.abort(),delete this.loaders[f.type],this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:f,response:g})},k.loadtimeout=function(g,p){var f=p.frag,d=f.loader;d&&d.abort(),delete this.loaders[f.type],this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:f})},F}()},"./src/loader/level-details.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"LevelDetails",function(){return F});var z=D("./src/polyfills/number.ts");function N(k,R){for(var g=0;g<R.length;g++){var p=R[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(k,p.key,p)}}function M(k,R,g){return R&&N(k.prototype,R),g&&N(k,g),k}var W=10,F=function(){function k(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 R=k.prototype;return R.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},M(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{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}}]),k}()},"./src/loader/level-key.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"LevelKey",function(){return F});var z=D("./node_modules/url-toolkit/src/url-toolkit.js"),N=D.n(z);function M(k,R){for(var g=0;g<R.length;g++){var p=R[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(k,p.key,p)}}function W(k,R,g){return R&&M(k.prototype,R),g&&M(k,g),k}var F=function(){k.fromURL=function(g,p){return new k(g,p)},k.fromURI=function(g){return new k(g)};function k(R,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(z.buildAbsoluteURL)(R,g,{alwaysNormalize:!0}):this._uri=R}return W(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"LoadStats",function(){return z});var z=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return l});var z=D("./src/polyfills/number.ts"),N=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(N),W=D("./src/loader/fragment.ts"),F=D("./src/loader/level-details.ts"),k=D("./src/loader/level-key.ts"),R=D("./src/utils/attr-list.ts"),g=D("./src/utils/logger.ts"),p=D("./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,s=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),u=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 a(O){var S,E;return o.test((S=(E=N.parseURL(O))===null||E===void 0?void 0:E.path)!=null?S:"")}var l=function(){function O(){}return O.findGroup=function(E,w){for(var b=0;b<E.length;b++){var c=E[b];if(c.id===w)return c}},O.convertAVC1ToAVCOTI=function(E){var w=E.split(".");if(w.length>2){var b=w.shift()+".";return b+=parseInt(w.shift()).toString(16),b+=("000"+parseInt(w.shift()).toString(16)).substr(-4),b}return E},O.resolve=function(E,w){return N.buildAbsoluteURL(w,E,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(E,w){var b=[],c={},y=!1;f.lastIndex=0;for(var m;(m=f.exec(E))!=null;)if(m[1]){var _=new R.AttrList(m[1]),P={attrs:_,bitrate:_.decimalInteger("AVERAGE-BANDWIDTH")||_.decimalInteger("BANDWIDTH"),name:_.NAME,url:O.resolve(m[2],w)},I=_.decimalResolution("RESOLUTION");I&&(P.width=I.width,P.height=I.height),h((_.CODECS||"").split(/[ ,]+/).filter(function(U){return U}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=O.convertAVC1ToAVCOTI(P.videoCodec)),b.push(P)}else if(m[3]){var B=new R.AttrList(m[3]);B["DATA-ID"]&&(y=!0,c[B["DATA-ID"]]=B)}return{levels:b,sessionData:y?c:null}},O.parseMasterPlaylistMedia=function(E,w,b,c){c===void 0&&(c=[]);var y,m=[],_=0;for(d.lastIndex=0;(y=d.exec(E))!==null;){var P=new R.AttrList(y[1]);if(P.TYPE===b){var I={attrs:P,bitrate:0,id:_++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:b,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?O.resolve(P.URI,w):""};if(c.length){var B=O.findGroup(c,I.groupId)||c[0];A(I,B,"audioCodec"),A(I,B,"textCodec")}m.push(I)}}return m},O.parseLevelPlaylist=function(E,w,b,c,y){var m=new F.LevelDetails(w),_=m.fragments,P=null,I=0,B=0,U=0,C=0,v=null,j=new W.Fragment(c,w),G,J,ee,ye=-1,he=!1;for(s.lastIndex=0,m.m3u8=E;(G=s.exec(E))!==null;){he&&(he=!1,j=new W.Fragment(c,w),j.start=U,j.sn=I,j.cc=C,j.level=b,P&&(j.initSegment=P,j.rawProgramDateTime=P.rawProgramDateTime));var ge=G[1];if(ge){j.duration=parseFloat(ge);var pe=(" "+G[2]).slice(1);j.title=pe||null,j.tagList.push(pe?["INF",ge,pe]:["INF",ge])}else if(G[3])Object(z.isFiniteNumber)(j.duration)&&(j.start=U,ee&&(j.levelkey=ee),j.sn=I,j.level=b,j.cc=C,j.urlId=y,_.push(j),j.relurl=(" "+G[3]).slice(1),T(j,v),v=j,U+=j.duration,I++,B=0,he=!0);else if(G[4]){var oe=(" "+G[4]).slice(1);v?j.setByteRange(oe,v):j.setByteRange(oe)}else if(G[5])j.rawProgramDateTime=(" "+G[5]).slice(1),j.tagList.push(["PROGRAM-DATE-TIME",j.rawProgramDateTime]),ye===-1&&(ye=_.length);else{if(G=G[0].match(u),!G){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(J=1;J<G.length&&!(typeof G[J]!="undefined");J++);var ie=(" "+G[J]).slice(1),ue=(" "+G[J+1]).slice(1),$=G[J+2]?(" "+G[J+2]).slice(1):"";switch(ie){case"PLAYLIST-TYPE":m.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":I=m.startSN=parseInt(ue);break;case"SKIP":{var re=new R.AttrList(ue),q=re.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(q)){m.skippedSegments=q;for(var be=q;be--;)_.unshift(null);I+=q}var Oe=re.enumeratedString("RECENTLY-REMOVED-DATERANGES");Oe&&(m.recentlyRemovedDateranges=Oe.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(ue);break;case"VERSION":m.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(ue||$)&&j.tagList.push($?[ue,$]:[ue]);break;case"DIS":C++;case"GAP":j.tagList.push([ie]);break;case"BITRATE":j.tagList.push([ie,ue]);break;case"DISCONTINUITY-SEQ":C=parseInt(ue);break;case"KEY":{var _e,xe=new R.AttrList(ue),Re=xe.enumeratedString("METHOD"),ke=xe.URI,De=xe.hexadecimalInteger("IV"),Le=xe.enumeratedString("KEYFORMATVERSIONS"),Ce=xe.enumeratedString("KEYID"),We=(_e=xe.enumeratedString("KEYFORMAT"))!=null?_e:"identity",Je=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Je.indexOf(We)>-1){g.logger.warn("Keyformat "+We+" is not supported from the manifest");continue}else if(We!=="identity")continue;Re&&(ee=k.LevelKey.fromURL(w,ke),ke&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Re)>=0&&(ee.method=Re,ee.keyFormat=We,Ce&&(ee.keyID=Ce),Le&&(ee.keyFormatVersions=Le),ee.iv=De));break}case"START":{var Xe=new R.AttrList(ue),Ke=Xe.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(Ke)&&(m.startTimeOffset=Ke);break}case"MAP":{var qe=new R.AttrList(ue);j.relurl=qe.URI,qe.BYTERANGE&&j.setByteRange(qe.BYTERANGE),j.level=b,j.sn="initSegment",ee&&(j.levelkey=ee),j.initSegment=null,P=j,he=!0;break}case"SERVER-CONTROL":{var Be=new R.AttrList(ue);m.canBlockReload=Be.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Be.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Be.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Be.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Be.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ue=new R.AttrList(ue);m.partTarget=Ue.decimalFloatingPoint("PART-TARGET");break}case"PART":{var we=m.partList;we||(we=m.partList=[]);var Ze=B>0?we[we.length-1]:void 0,Ve=B++,Se=new W.Part(new R.AttrList(ue),j,w,Ve,Ze);we.push(Se),j.duration+=Se.duration;break}case"PRELOAD-HINT":{var Ne=new R.AttrList(ue);m.preloadHint=Ne;break}case"RENDITION-REPORT":{var ve=new R.AttrList(ue);m.renditionReports=m.renditionReports||[],m.renditionReports.push(ve);break}default:g.logger.warn("line parsed but not handled: "+G);break}}}v&&!v.relurl?(_.pop(),U-=v.duration,m.partList&&(m.fragmentHint=v)):m.partList&&(T(j,v),j.cc=C,m.fragmentHint=j);var ce=_.length,fe=_[0],Q=_[ce-1];if(U+=m.skippedSegments*m.targetduration,U>0&&ce&&Q){m.averagetargetduration=U/ce;var Z=Q.sn;m.endSN=Z!=="initSegment"?Z:0,fe&&(m.startCC=fe.cc,fe.initSegment||m.fragments.every(function(te){return te.relurl&&a(te.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),j=new W.Fragment(c,w),j.relurl=Q.relurl,j.level=b,j.sn="initSegment",fe.initSegment=j,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(U+=m.fragmentHint.duration),m.totalduration=U,m.endCC=C,ye>0&&x(_,ye),m},O}();function h(O,S){["video","audio","text"].forEach(function(E){var w=O.filter(function(c){return Object(p.isCodecType)(c,E)});if(w.length){var b=w.filter(function(c){return c.lastIndexOf("avc1",0)===0||c.lastIndexOf("mp4a",0)===0});S[E+"Codec"]=b.length>0?b[0]:w[0],O=O.filter(function(c){return w.indexOf(c)===-1})}}),S.unknownCodecs=O}function A(O,S,E){var w=S[E];w&&(O[E]=w)}function x(O,S){for(var E=O[S],w=S;w--;){var b=O[w];if(!b)return;b.programDateTime=E.programDateTime-b.duration*1e3,E=b}}function T(O,S){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):S!=null&&S.programDateTime&&(O.programDateTime=S.endProgramDateTime),Object(z.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/polyfills/number.ts"),N=D("./src/events.ts"),M=D("./src/errors.ts"),W=D("./src/utils/logger.ts"),F=D("./src/utils/mp4-tools.ts"),k=D("./src/loader/m3u8-parser.ts"),R=D("./src/types/loader.ts"),g=D("./src/utils/attr-list.ts");function p(s){var u=s.type;switch(u){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function f(s,u){var o=s.url;return(o===void 0||o.indexOf("data:")===0)&&(o=u.url),o}var d=function(){function s(o){this.hls=void 0,this.loaders=Object.create(null),this.hls=o,this.registerListeners()}var u=s.prototype;return u.registerListeners=function(){var a=this.hls;a.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},u.unregisterListeners=function(){var a=this.hls;a.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},u.createInternalLoader=function(a){var l=this.hls.config,h=l.pLoader,A=l.loader,x=h||A,T=new x(l);return a.loader=T,this.loaders[a.type]=T,T},u.getInternalLoader=function(a){return this.loaders[a.type]},u.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},u.destroyInternalLoaders=function(){for(var a in this.loaders){var l=this.loaders[a];l&&l.destroy(),this.resetInternalLoader(a)}},u.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},u.onManifestLoading=function(a,l){var h=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},u.onLevelLoading=function(a,l){var h=l.id,A=l.level,x=l.url,T=l.deliveryDirectives;this.load({id:h,groupId:null,level:A,responseType:"text",type:R.PlaylistContextType.LEVEL,url:x,deliveryDirectives:T})},u.onAudioTrackLoading=function(a,l){var h=l.id,A=l.groupId,x=l.url,T=l.deliveryDirectives;this.load({id:h,groupId:A,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:x,deliveryDirectives:T})},u.onSubtitleTrackLoading=function(a,l){var h=l.id,A=l.groupId,x=l.url,T=l.deliveryDirectives;this.load({id:h,groupId:A,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:x,deliveryDirectives:T})},u.load=function(a){var l,h=this.hls.config,A=this.getInternalLoader(a);if(A){var x=A.context;if(x&&x.url===a.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),A.abort()}var T,O,S,E;switch(a.type){case R.PlaylistContextType.MANIFEST:T=h.manifestLoadingMaxRetry,O=h.manifestLoadingTimeOut,S=h.manifestLoadingRetryDelay,E=h.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:T=0,O=h.levelLoadingTimeOut;break;default:T=h.levelLoadingMaxRetry,O=h.levelLoadingTimeOut,S=h.levelLoadingRetryDelay,E=h.levelLoadingMaxRetryTimeout;break}if(A=this.createInternalLoader(a),(l=a.deliveryDirectives)!==null&&l!==void 0&&l.part){var w;if(a.type===R.PlaylistContextType.LEVEL&&a.level!==null?w=this.hls.levels[a.level].details:a.type===R.PlaylistContextType.AUDIO_TRACK&&a.id!==null?w=this.hls.audioTracks[a.id].details:a.type===R.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(w=this.hls.subtitleTracks[a.id].details),w){var b=w.partTarget,c=w.targetduration;b&&c&&(O=Math.min(Math.max(b*3,c*.8)*1e3,O))}}var y={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)};A.load(a,y,m)},u.loadsuccess=function(a,l,h,A){if(A===void 0&&(A=null),h.isSidxRequest){this.handleSidxRequest(a,h),this.handlePlaylistLoaded(a,l,h,A);return}this.resetInternalLoader(h.type);var x=a.data;if(x.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,h,"no EXTM3U delimiter",A);return}l.parsing.start=performance.now(),x.indexOf("#EXTINF:")>0||x.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,l,h,A):this.handleMasterPlaylist(a,l,h,A)},u.loaderror=function(a,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!1,a)},u.loadtimeout=function(a,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!0)},u.handleMasterPlaylist=function(a,l,h,A){var x=this.hls,T=a.data,O=f(a,h),S=k.default.parseMasterPlaylist(T,O),E=S.levels,w=S.sessionData;if(!E.length){this.handleManifestParsingError(a,h,"no level found in manifest",A);return}var b=E.map(function(I){return{id:I.attrs.AUDIO,audioCodec:I.audioCodec}}),c=E.map(function(I){return{id:I.attrs.SUBTITLES,textCodec:I.textCodec}}),y=k.default.parseMasterPlaylistMedia(T,O,"AUDIO",b),m=k.default.parseMasterPlaylistMedia(T,O,"SUBTITLES",c),_=k.default.parseMasterPlaylistMedia(T,O,"CLOSED-CAPTIONS");if(y.length){var P=y.some(function(I){return!I.url});!P&&E[0].audioCodec&&!E[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}x.trigger(N.Events.MANIFEST_LOADED,{levels:E,audioTracks:y,subtitles:m,captions:_,url:O,stats:l,networkDetails:A,sessionData:w})},u.handleTrackOrLevelPlaylist=function(a,l,h,A){var x=this.hls,T=h.id,O=h.level,S=h.type,E=f(a,h),w=Object(z.isFiniteNumber)(T)?T:0,b=Object(z.isFiniteNumber)(O)?O:w,c=p(h),y=k.default.parseLevelPlaylist(a.data,E,b,c,w);if(!y.fragments.length){x.trigger(N.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.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===R.PlaylistContextType.MANIFEST){var m={attrs:new g.AttrList({}),bitrate:0,details:y,name:"",url:E};x.trigger(N.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:E,stats:l,networkDetails:A,sessionData:null})}if(l.parsing.end=performance.now(),y.needSidxRanges){var _,P=(_=y.fragments[0].initSegment)===null||_===void 0?void 0:_.url;this.load({url:P,isSidxRequest:!0,type:S,level:O,levelDetails:y,id:T,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=y,this.handlePlaylistLoaded(a,l,h,A)},u.handleSidxRequest=function(a,l){var h=Object(F.parseSegmentIndex)(new Uint8Array(a.data));if(!h)return;var A=h.references,x=l.levelDetails;A.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")})},u.handleManifestParsingError=function(a,l,h,A){this.hls.trigger(N.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===R.PlaylistContextType.MANIFEST,url:a.url,reason:h,response:a,context:l,networkDetails:A})},u.handleNetworkError=function(a,l,h,A){h===void 0&&(h=!1),W.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var x=M.ErrorDetails.UNKNOWN,T=!1,O=this.getInternalLoader(a);switch(a.type){case R.PlaylistContextType.MANIFEST:x=h?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,T=!0;break;case R.PlaylistContextType.LEVEL:x=h?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,T=!1;break;case R.PlaylistContextType.AUDIO_TRACK:x=h?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:x=h?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,T=!1;break}O&&this.resetInternalLoader(a.type);var S={type:M.ErrorTypes.NETWORK_ERROR,details:x,fatal:T,url:a.url,loader:O,context:a,networkDetails:l};A&&(S.response=A),this.hls.trigger(N.Events.ERROR,S)},u.handlePlaylistLoaded=function(a,l,h,A){var x=h.type,T=h.level,O=h.id,S=h.groupId,E=h.loader,w=h.levelDetails,b=h.deliveryDirectives;if(!(w!=null&&w.targetduration)){this.handleManifestParsingError(a,h,"invalid target duration",A);return}if(!E)return;w.live&&(E.getCacheAge&&(w.ageHeader=E.getCacheAge()||0),(!E.getCacheAge||isNaN(w.ageHeader))&&(w.ageHeader=0));switch(x){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(N.Events.LEVEL_LOADED,{details:w,level:T||0,id:O||0,stats:l,networkDetails:A,deliveryDirectives:b});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(N.Events.AUDIO_TRACK_LOADED,{details:w,id:O||0,groupId:S||"",stats:l,networkDetails:A,deliveryDirectives:b});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(N.Events.SUBTITLE_TRACK_LOADED,{details:w,id:O||0,groupId:S||"",stats:l,networkDetails:A,deliveryDirectives:b});break}},s}();V.default=d},"./src/polyfills/number.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"isFiniteNumber",function(){return z}),D.d(V,"MAX_SAFE_INTEGER",function(){return N});var z=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},N=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ae,V,D){"use strict";D.r(V);var z=function(){function N(){}return N.getSilentFrame=function(W,F){switch(W){case"mp4a.40.2":if(F===1)return new Uint8Array([0,200,0,128,35,128]);if(F===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(F===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(F===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(F===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(F===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(F===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(F===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(F===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},N}();V.default=z},"./src/remux/mp4-generator.ts":function(ae,V,D){"use strict";D.r(V);var z=Math.pow(2,32)-1,N=function(){function M(){}return M.init=function(){M.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var F;for(F in M.types)M.types.hasOwnProperty(F)&&(M.types[F]=[F.charCodeAt(0),F.charCodeAt(1),F.charCodeAt(2),F.charCodeAt(3)]);var k=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]),R=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]);M.HDLR_TYPES={video:k,audio:R};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]);M.STTS=M.STSC=M.STCO=p,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.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]),s=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,f,s,f,d),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,g))},M.box=function(F){for(var k=8,R=arguments.length,g=new Array(R>1?R-1:0),p=1;p<R;p++)g[p-1]=arguments[p];for(var f=g.length,d=f;f--;)k+=g[f].byteLength;var s=new Uint8Array(k);for(s[0]=k>>24&255,s[1]=k>>16&255,s[2]=k>>8&255,s[3]=k&255,s.set(F,4),f=0,k=8;f<d;f++)s.set(g[f],k),k+=g[f].byteLength;return s},M.hdlr=function(F){return M.box(M.types.hdlr,M.HDLR_TYPES[F])},M.mdat=function(F){return M.box(M.types.mdat,F)},M.mdhd=function(F,k){k*=F;var R=Math.floor(k/(z+1)),g=Math.floor(k%(z+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,R>>24,R>>16&255,R>>8&255,R&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},M.mdia=function(F){return M.box(M.types.mdia,M.mdhd(F.timescale,F.duration),M.hdlr(F.type),M.minf(F))},M.mfhd=function(F){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255]))},M.minf=function(F){return F.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(F)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(F))},M.moof=function(F,k,R){return M.box(M.types.moof,M.mfhd(F),M.traf(R,k))},M.moov=function(F){for(var k=F.length,R=[];k--;)R[k]=M.trak(F[k]);return M.box.apply(null,[M.types.moov,M.mvhd(F[0].timescale,F[0].duration)].concat(R).concat(M.mvex(F)))},M.mvex=function(F){for(var k=F.length,R=[];k--;)R[k]=M.trex(F[k]);return M.box.apply(null,[M.types.mvex].concat(R))},M.mvhd=function(F,k){k*=F;var R=Math.floor(k/(z+1)),g=Math.floor(k%(z+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,R>>24,R>>16&255,R>>8&255,R&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 M.box(M.types.mvhd,p)},M.sdtp=function(F){var k=F.samples||[],R=new Uint8Array(4+k.length),g,p;for(g=0;g<k.length;g++)p=k[g].flags,R[g+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return M.box(M.types.sdtp,R)},M.stbl=function(F){return M.box(M.types.stbl,M.stsd(F),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(F){var k=[],R=[],g,p,f;for(g=0;g<F.sps.length;g++)p=F.sps[g],f=p.byteLength,k.push(f>>>8&255),k.push(f&255),k=k.concat(Array.prototype.slice.call(p));for(g=0;g<F.pps.length;g++)p=F.pps[g],f=p.byteLength,R.push(f>>>8&255),R.push(f&255),R=R.concat(Array.prototype.slice.call(p));var d=M.box(M.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|F.sps.length].concat(k).concat([F.pps.length]).concat(R))),s=F.width,u=F.height,o=F.pixelRatio[0],a=F.pixelRatio[1];return M.box(M.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,s>>8&255,s&255,u>>8&255,u&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,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([o>>24,o>>16&255,o>>8&255,o&255,a>>24,a>>16&255,a>>8&255,a&255])))},M.esds=function(F){var k=F.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(F.config).concat([6,1,2]))},M.mp4a=function(F){var k=F.samplerate;return M.box(M.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),M.box(M.types.esds,M.esds(F)))},M.mp3=function(F){var k=F.samplerate;return M.box(M.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},M.stsd=function(F){return F.type==="audio"?!F.isAAC&&F.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(F)):M.box(M.types.stsd,M.STSD,M.mp4a(F)):M.box(M.types.stsd,M.STSD,M.avc1(F))},M.tkhd=function(F){var k=F.id,R=F.duration*F.timescale,g=F.width,p=F.height,f=Math.floor(R/(z+1)),d=Math.floor(R%(z+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,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]))},M.traf=function(F,k){var R=M.sdtp(F),g=F.id,p=Math.floor(k/(z+1)),f=Math.floor(k%(z+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),M.box(M.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])),M.trun(F,R.length+16+20+8+16+8+8),R)},M.trak=function(F){return F.duration=F.duration||4294967295,M.box(M.types.trak,M.tkhd(F),M.mdia(F))},M.trex=function(F){var k=F.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(F,k){var R=F.samples||[],g=R.length,p=12+16*g,f=new Uint8Array(p),d,s,u,o,a,l;for(k+=8+p,f.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),d=0;d<g;d++)s=R[d],u=s.duration,o=s.size,a=s.flags,l=s.cts,f.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*d);return M.box(M.types.trun,f)},M.initSegment=function(F){M.types||M.init();var k=M.moov(F),R=new Uint8Array(M.FTYP.byteLength+k.byteLength);return R.set(M.FTYP),R.set(k,M.FTYP.byteLength),R},M}();N.types=void 0,N.HDLR_TYPES=void 0,N.STTS=void 0,N.STSC=void 0,N.STCO=void 0,N.STSZ=void 0,N.VMHD=void 0,N.SMHD=void 0,N.STSD=void 0,N.FTYP=void 0,N.DINF=void 0,V.default=N},"./src/remux/mp4-remuxer.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return l}),D.d(V,"normalizePts",function(){return h});var z=D("./src/polyfills/number.ts"),N=D("./src/remux/aac-helper.ts"),M=D("./src/remux/mp4-generator.ts"),W=D("./src/events.ts"),F=D("./src/errors.ts"),k=D("./src/utils/logger.ts"),R=D("./src/types/loader.ts"),g=D("./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 w in E)Object.prototype.hasOwnProperty.call(E,w)&&(O[w]=E[w])}return O},p.apply(this,arguments)}var f=10*1e3,d=1024,s=1152,u=null,o=null,a=!1,l=function(){function O(E,w,b,c){if(c===void 0&&(c=""),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=w,this.typeSupported=b,this.ISGenerated=!1,u===null){var y=navigator.userAgent||"",m=y.match(/Chrome\/(\d+)/i);u=m?parseInt(m[1]):0}if(o===null){var _=navigator.userAgent.match(/Safari\/(\d+)/i);o=_?parseInt(_[1]):0}a=!!u&&u<75||!!o&&o<600}var S=O.prototype;return S.destroy=function(){},S.resetTimeStamp=function(w){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=w},S.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},S.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},S.getVideoStartPts=function(w){var b=!1,c=w.reduce(function(y,m){var _=m.pts-y;return _<-4294967296?(b=!0,h(y,m.pts)):_>0?y:m.pts},w[0].pts);return b&&k.logger.debug("PTS rollover detected"),c},S.remux=function(w,b,c,y,m,_,P,I){var B,U,C,v,j,G,J=m,ee=m,ye=w.pid>-1,he=b.pid>-1,ge=b.samples.length,pe=w.samples.length>0,oe=ge>1,ie=(!ye||pe)&&(!he||oe)||this.ISGenerated||P;if(ie){this.ISGenerated||(C=this.generateIS(w,b,m));var ue=this.isVideoContiguous,$=-1;if(oe&&($=A(b.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(G=!0,$>0){k.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+ge+" video samples due to a missing keyframe");var re=this.getVideoStartPts(b.samples);b.samples=b.samples.slice($),b.dropped+=$,ee+=(b.samples[0].pts-re)/(b.timescale||9e4)}else $===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+ge+" video samples"),G=!1);if(this.ISGenerated){if(pe&&oe){var q=this.getVideoStartPts(b.samples),be=h(w.samples[0].pts,q)-q,Oe=be/b.inputTimeScale;J+=Math.max(0,Oe),ee+=Math.max(0,-Oe)}if(pe){if(w.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),C=this.generateIS(w,b,m)),U=this.remuxAudio(w,J,this.isAudioContiguous,_,he||oe||I===R.PlaylistLevelType.AUDIO?ee:void 0),oe){var _e=U?U.endPTS-U.startPTS:0;b.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),C=this.generateIS(w,b,m)),B=this.remuxVideo(b,ee,ue,_e)}}else oe&&(B=this.remuxVideo(b,ee,ue,0));B&&(B.firstKeyFrame=$,B.independent=$!==-1)}}return this.ISGenerated&&(c.samples.length&&(j=this.remuxID3(c,m)),y.samples.length&&(v=this.remuxText(y,m))),{audio:U,video:B,initSegment:C,independent:G,text:v,id3:j}},S.generateIS=function(w,b,c){var y=w.samples,m=b.samples,_=this.typeSupported,P={},I=!Object(z.isFiniteNumber)(this._initPTS),B="audio/mp4",U,C,v;if(I&&(U=C=Infinity),w.config&&y.length&&(w.timescale=w.samplerate,w.isAAC||(_.mpeg?(B="audio/mpeg",w.codec=""):_.mp3&&(w.codec="mp3")),P.audio={id:"audio",container:B,codec:w.codec,initSegment:!w.isAAC&&_.mpeg?new Uint8Array(0):M.default.initSegment([w]),metadata:{channelCount:w.channelCount}},I&&(v=w.inputTimeScale,U=C=y[0].pts-Math.round(v*c))),b.sps&&b.pps&&m.length&&(b.timescale=b.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:b.codec,initSegment:M.default.initSegment([b]),metadata:{width:b.width,height:b.height}},I)){v=b.inputTimeScale;var j=this.getVideoStartPts(m),G=Math.round(v*c);C=Math.min(C,h(m[0].dts,j)-G),U=Math.min(U,j-G)}if(Object.keys(P).length)return this.ISGenerated=!0,I&&(this._initPTS=U,this._initDTS=C),{tracks:P,initPTS:U,timescale:v}},S.remuxVideo=function(w,b,c,y){var m=w.inputTimeScale,_=w.samples,P=[],I=_.length,B=this._initPTS,U=this.nextAvcDts,C=8,v,j,G,J=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,ye=0,he=!1;if(!c||U===null){var ge=b*m,pe=_[0].pts-h(_[0].dts,_[0].pts);U=ge-pe}for(var oe=0;oe<I;oe++){var ie=_[oe];if(ie.pts=h(ie.pts-B,U),ie.dts=h(ie.dts-B,U),ie.dts>ie.pts){var ue=9e4*.2;ye=Math.max(Math.min(ye,ie.pts-ie.dts),-1*ue)}ie.dts<_[oe>0?oe-1:oe].dts&&(he=!0)}he&&_.sort(function(xt,ft){var it=xt.dts-ft.dts,Ot=xt.pts-ft.pts;return it||Ot}),j=_[0].dts,G=_[_.length-1].dts;var $=Math.round((G-j)/(I-1));if(ye<0){if(ye<$*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-$,!0)+" ms");for(var re=ye,q=0;q<I;q++)_[q].dts=re=Math.max(re,_[q].pts-$),_[q].pts=Math.max(re,_[q].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(ye,!0)+" ms to overcome this issue");for(var be=0;be<I;be++)_[be].dts=_[be].dts+ye}j=_[0].dts}if(c){var Oe=j-U,_e=Oe>$,xe=Oe<-1;if(_e||xe){_e?k.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Oe,!0)+" ms ("+Oe+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Oe,!0)+" ms ("+Oe+"dts) overlapping between fragments detected"),j=U;var Re=_[0].pts-Oe;_[0].dts=j,_[0].pts=Re,k.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(Re,!0)+"/"+Object(g.toMsFromMpegTsClock)(j,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(Oe,!0)+" ms")}}a&&(j=Math.max(0,j));for(var ke=0,De=0,Le=0;Le<I;Le++){for(var Ce=_[Le],We=Ce.units,Je=We.length,Xe=0,Ke=0;Ke<Je;Ke++)Xe+=We[Ke].data.length;De+=Xe,ke+=Je,Ce.length=Xe,Ce.dts=Math.max(Ce.dts,j),Ce.pts=Math.max(Ce.pts,Ce.dts,0),J=Math.min(Ce.pts,J),ee=Math.max(Ce.pts,ee)}G=_[I-1].dts;var qe=De+4*ke+8,Be;try{Be=new Uint8Array(qe)}catch(xt){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:qe,reason:"fail allocating video mdat "+qe});return}var Ue=new DataView(Be.buffer);Ue.setUint32(0,qe),Be.set(M.default.types.mdat,4);for(var we=0;we<I;we++){for(var Ze=_[we],Ve=Ze.units,Se=0,Ne=0,ve=Ve.length;Ne<ve;Ne++){var ce=Ve[Ne],fe=ce.data,Q=ce.data.byteLength;Ue.setUint32(C,Q),C+=4,Be.set(fe,C),C+=Q,Se+=4+Q}if(we<I-1)v=_[we+1].dts-Ze.dts;else{var Z=this.config,te=Ze.dts-_[we>0?we-1:we].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(Z.maxBufferHole*m),me=(y?J+y*m:this.nextAudioPts)-Ze.pts;me>le?(v=me-te,v<0&&(v=te),k.logger.log("[mp4-remuxer]: It is approximately "+me/90+" ms to the next segment; using duration "+v/90+" ms for the last video frame.")):v=te}else v=te}var Ae=Math.round(Ze.pts-Ze.dts);P.push(new x(Ze.key,v,Se,Ae))}if(P.length&&u&&u<70){var Me=P[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(v!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=U=G+v,this.isVideoContiguous=!0;var ze=M.default.moof(w.sequenceNumber++,j,p({},w,{samples:P})),nt="video",tt={data1:ze,data2:Be,startPTS:J/m,endPTS:(ee+v)/m,startDTS:j/m,endDTS:U/m,type:nt,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:w.dropped};return w.samples=[],w.dropped=0,console.assert(Be.length,"MDAT length must not be zero"),tt},S.remuxAudio=function(w,b,c,y,m){var _=w.inputTimeScale,P=w.samplerate?w.samplerate:_,I=_/P,B=w.isAAC?d:s,U=B*I,C=this._initPTS,v=!w.isAAC&&this.typeSupported.mpeg,j=[],G=w.samples,J=v?0:8,ee=this.nextAudioPts||-1,ye=b*_;if(this.isAudioContiguous=c=c||G.length&&ee>0&&(y&&Math.abs(ye-ee)<9e3||Math.abs(h(G[0].pts-C,ye)-ee)<20*U),G.forEach(function(fe){fe.pts=h(fe.pts-C,ye)}),!c||ee<0){if(G=G.filter(function(fe){return fe.pts>=0}),!G.length)return;m===0?ee=0:y?ee=Math.max(0,ye):ee=G[0].pts}if(w.isAAC)for(var he=m!==void 0,ge=this.config.maxAudioFramesDrift,pe=0,oe=ee;pe<G.length;pe++){var ie=G[pe],ue=ie.pts,$=ue-oe,re=Math.abs(1e3*$/_);if($<=-ge*U&&he)pe===0&&(k.logger.warn("Audio frame @ "+(ue/_).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/_)+" ms."),this.nextAudioPts=ee=oe=ue);else if($>=ge*U&&re<f&&he){var q=Math.round($/U);oe=ue-q*U,oe<0&&(q--,oe+=U),pe===0&&(this.nextAudioPts=ee=oe),k.logger.warn("[mp4-remuxer]: Injecting "+q+" audio frame @ "+(oe/_).toFixed(3)+"s due to "+Math.round(1e3*$/_)+" ms gap.");for(var be=0;be<q;be++){var Oe=Math.max(oe,0),_e=N.default.getSilentFrame(w.manifestCodec||w.codec,w.channelCount);_e||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),_e=ie.unit.subarray()),G.splice(pe,0,{unit:_e,pts:Oe}),oe+=U,pe++}}ie.pts=oe,oe+=U}for(var xe=null,Re=null,ke,De=0,Le=G.length;Le--;)De+=G[Le].unit.byteLength;for(var Ce=0,We=G.length;Ce<We;Ce++){var Je=G[Ce],Xe=Je.unit,Ke=Je.pts;if(Re!==null){var qe=j[Ce-1];qe.duration=Math.round((Ke-Re)/I)}else if(c&&w.isAAC&&(Ke=ee),xe=Ke,De>0){De+=J;try{ke=new Uint8Array(De)}catch(fe){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:De,reason:"fail allocating audio mdat "+De});return}if(!v){var Be=new DataView(ke.buffer);Be.setUint32(0,De),ke.set(M.default.types.mdat,4)}}else return;ke.set(Xe,J);var Ue=Xe.byteLength;J+=Ue,j.push(new x(!0,B,Ue,0)),Re=Ke}var we=j.length;if(!we)return;var Ze=j[j.length-1];this.nextAudioPts=ee=Re+I*Ze.duration;var Ve=v?new Uint8Array(0):M.default.moof(w.sequenceNumber++,xe/I,p({},w,{samples:j}));w.samples=[];var Se=xe/_,Ne=ee/_,ve="audio",ce={data1:Ve,data2:ke,startPTS:Se,endPTS:Ne,startDTS:Se,endDTS:Ne,type:ve,hasAudio:!0,hasVideo:!1,nb:we};return this.isAudioContiguous=!0,console.assert(ke.length,"MDAT length must not be zero"),ce},S.remuxEmptyAudio=function(w,b,c,y){var m=w.inputTimeScale,_=w.samplerate?w.samplerate:m,P=m/_,I=this.nextAudioPts,B=(I!==null?I:y.startDTS*m)+this._initDTS,U=y.endDTS*m+this._initDTS,C=P*d,v=Math.ceil((U-B)/C),j=N.default.getSilentFrame(w.manifestCodec||w.codec,w.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!j){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var G=[],J=0;J<v;J++){var ee=B+J*C;G.push({unit:j,pts:ee,dts:ee})}return w.samples=G,this.remuxAudio(w,b,c,!1)},S.remuxID3=function(w,b){var c=w.samples.length;if(!c)return;for(var y=w.inputTimeScale,m=this._initPTS,_=this._initDTS,P=0;P<c;P++){var I=w.samples[P];I.pts=h(I.pts-m,b*y)/y,I.dts=h(I.dts-_,b*y)/y}var B=w.samples;return w.samples=[],{samples:B}},S.remuxText=function(w,b){var c=w.samples.length;if(!c)return;for(var y=w.inputTimeScale,m=this._initPTS,_=0;_<c;_++){var P=w.samples[_];P.pts=h(P.pts-m,b*y)/y}w.samples.sort(function(B,U){return B.pts-U.pts});var I=w.samples;return w.samples=[],{samples:I}},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 A(O){for(var S=0;S<O.length;S++)if(O[S].key)return S;return-1}var x=function(S,E,w,b){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=E,this.size=w,this.cts=b,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(ae,V,D){"use strict";D.r(V);var z=D("./src/polyfills/number.ts"),N=D("./src/utils/mp4-tools.ts"),M=D("./src/loader/fragment.ts"),W=D("./src/utils/logger.ts"),F=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,s,u){this.audioCodec=s,this.videoCodec=u,this.generateInitSegment(d),this.emitInitSegment=!0},p.generateInitSegment=function(d){var s=this.audioCodec,u=this.videoCodec;if(!d||!d.byteLength){this.initTracks=void 0,this.initData=void 0;return}var o=this.initData=Object(N.parseInitSegment)(d);s||(s=R(o.audio,M.ElementaryStreamTypes.AUDIO)),u||(u=R(o.video,M.ElementaryStreamTypes.VIDEO));var a={};o.audio&&o.video?a.audiovideo={container:"video/mp4",codec:s+","+u,initSegment:d,id:"main"}:o.audio?a.audio={container:"audio/mp4",codec:s,initSegment:d,id:"audio"}:o.video?a.video={container:"video/mp4",codec:u,initSegment:d,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},p.remux=function(d,s,u,o,a){var l=this.initPTS,h=this.lastEndDTS,A={audio:void 0,video:void 0,text:o,id3:u,initSegment:void 0};Object(z.isFiniteNumber)(h)||(h=this.lastEndDTS=a||0);var x=s.samples;if(!x||!x.length)return A;var T={initPTS:void 0,timescale:1},O=this.initData;if((!O||!O.length)&&(this.generateInitSegment(x),O=this.initData),!O||!O.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),A;this.emitInitSegment&&(T.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(l)||(this.initPTS=T.initPTS=l=k(O,x,h));var S=Object(N.getDuration)(x,O),E=h,w=S+E;Object(N.offsetStartDTS)(O,x,l),S>0?this.lastEndDTS=w:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var b=!!O.audio,c=!!O.video,y="";b&&(y+="audio"),c&&(y+="video");var m={data1:x,startPTS:E,startDTS:E,endPTS:w,endDTS:w,type:y,hasAudio:b,hasVideo:c,nb:1,dropped:0};return A.audio=m.type==="audio"?m:void 0,A.video=m.type!=="audio"?m:void 0,A.text=o,A.id3=u,A.initSegment=T,A},g}(),k=function(p,f,d){return Object(N.getStartDTS)(p,f)-d};function R(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===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=F},"./src/task-loop.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function N(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=N.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(F){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,F),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.doTick=function(){},N}()},"./src/types/cmcd.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"CMCDVersion",function(){return z}),D.d(V,"CMCDObjectType",function(){return N}),D.d(V,"CMCDStreamingFormat",function(){return M}),D.d(V,"CMCDStreamType",function(){return W});var z=1,N;(function(F){F.MANIFEST="m",F.AUDIO="a",F.VIDEO="v",F.MUXED="av",F.INIT="i",F.CAPTION="c",F.TIMED_TEXT="tt",F.KEY="k",F.OTHER="o"})(N||(N={}));var M;(function(F){F.DASH="d",F.HLS="h",F.SMOOTH="s",F.OTHER="o"})(M||(M={}));var W;(function(F){F.VOD="v",F.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"HlsSkip",function(){return M}),D.d(V,"getSkipValue",function(){return W}),D.d(V,"HlsUrlParameters",function(){return F}),D.d(V,"Level",function(){return k});function z(R,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(R,f.key,f)}}function N(R,g,p){return g&&z(R.prototype,g),p&&z(R,p),R}var M;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(M||(M={}));function W(R,g){var p=R.canSkipUntil,f=R.canSkipDateRanges,d=R.endSN,s=g!==void 0?g-d:0;return p&&s<p?f?M.v2:M.Yes:M.No}var F=function(){function R(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=R.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()},R}(),k=function(){function R(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 N(R,[{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)}}]),R}()},"./src/types/loader.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"PlaylistContextType",function(){return z}),D.d(V,"PlaylistLevelType",function(){return N});var z;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var N;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(N||(N={}))},"./src/types/transmuxer.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"ChunkMetadata",function(){return z});var z=function(W,F,k,R,g,p){R===void 0&&(R=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=N(),this.buffering={audio:N(),video:N(),audiovideo:N()},this.level=W,this.sn=F,this.id=k,this.size=R,this.part=g,this.partial=p};function N(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"AttrList",function(){return M});var z=/^(\d+)x(\d+)$/,N=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function W(k){typeof k=="string"&&(k=W.parseAttrList(k));for(var R in k)k.hasOwnProperty(R)&&(this[R]=k[R])}var F=W.prototype;return F.decimalInteger=function(R){var g=parseInt(this[R],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},F.hexadecimalInteger=function(R){if(this[R]){var g=(this[R]||"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},F.hexadecimalIntegerAsNumber=function(R){var g=parseInt(this[R],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},F.decimalFloatingPoint=function(R){return parseFloat(this[R])},F.optionalFloat=function(R,g){var p=this[R];return p?parseFloat(p):g},F.enumeratedString=function(R){return this[R]},F.bool=function(R){return this[R]==="YES"},F.decimalResolution=function(R){var g=z.exec(this[R]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},W.parseAttrList=function(R){var g,p={},f='"';for(N.lastIndex=0;(g=N.exec(R))!==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},W}()},"./src/utils/binary-search.ts":function(ae,V,D){"use strict";D.r(V);var z={search:function(M,W){for(var F=0,k=M.length-1,R=null,g=null;F<=k;){R=(F+k)/2|0,g=M[R];var p=W(g);if(p>0)F=R+1;else if(p<0)k=R-1;else return g}return null}};V.default=z},"./src/utils/buffer-helper.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"BufferHelper",function(){return M});var z=D("./src/utils/logger.ts"),N={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function W(){}return W.isBuffered=function(k,R){try{if(k){for(var g=W.getBuffered(k),p=0;p<g.length;p++)if(R>=g.start(p)&&R<=g.end(p))return!0}}catch(f){}return!1},W.bufferInfo=function(k,R,g){try{if(k){var p=W.getBuffered(k),f=[],d;for(d=0;d<p.length;d++)f.push({start:p.start(d),end:p.end(d)});return this.bufferedInfo(f,R,g)}}catch(s){}return{len:0,start:R,end:R,nextStart:void 0}},W.bufferedInfo=function(k,R,g){R=Math.max(0,R),k.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<k.length;f++){var d=p.length;if(d){var s=p[d-1].end;k[f].start-s<g?k[f].end>s&&(p[d-1].end=k[f].end):p.push(k[f])}else p.push(k[f])}else p=k;for(var u=0,o,a=R,l=R,h=0;h<p.length;h++){var A=p[h].start,x=p[h].end;if(R+g>=A&&R<x)a=A,l=x,u=l-R;else if(R+g<A){o=A;break}}return{len:u,start:a||0,end:l||0,nextStart:o}},W.getBuffered=function(k){try{return k.buffered}catch(R){return z.logger.log("failed to get media.buffered",R),N}},W}()},"./src/utils/cea-608-parser.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"Row",function(){return l}),D.d(V,"CaptionScreen",function(){return h});var z=D("./src/utils/logger.ts"),N={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},M=function(w){var b=w;return N.hasOwnProperty(w)&&(b=N[w]),String.fromCharCode(b)},W=15,F=100,k={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={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 s=function(){function E(){this.time=null,this.verboseLevel=d.ERROR}var w=E.prototype;return w.log=function(c,y){this.verboseLevel>=c&&z.logger.log(this.time+" ["+c+"] "+y)},E}(),u=function(w){for(var b=[],c=0;c<w.length;c++)b.push(w[c].toString(16));return b},o=function(){function E(b,c,y,m,_){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=b||"white",this.underline=c||!1,this.italics=y||!1,this.background=m||"black",this.flash=_||!1}var w=E.prototype;return w.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},w.setStyles=function(c){for(var y=["foreground","underline","italics","background","flash"],m=0;m<y.length;m++){var _=y[m];c.hasOwnProperty(_)&&(this[_]=c[_])}},w.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},w.equals=function(c){return this.foreground===c.foreground&&this.underline===c.underline&&this.italics===c.italics&&this.background===c.background&&this.flash===c.flash},w.copy=function(c){this.foreground=c.foreground,this.underline=c.underline,this.italics=c.italics,this.background=c.background,this.flash=c.flash},w.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},E}(),a=function(){function E(b,c,y,m,_,P){this.uchar=void 0,this.penState=void 0,this.uchar=b||" ",this.penState=new o(c,y,m,_,P)}var w=E.prototype;return w.reset=function(){this.uchar=" ",this.penState.reset()},w.setChar=function(c,y){this.uchar=c,this.penState.copy(y)},w.setPenState=function(c){this.penState.copy(c)},w.equals=function(c){return this.uchar===c.uchar&&this.penState.equals(c.penState)},w.copy=function(c){this.uchar=c.uchar,this.penState.copy(c.penState)},w.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},E}(),l=function(){function E(b){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var c=0;c<F;c++)this.chars.push(new a);this.logger=b,this.pos=0,this.currPenState=new o}var w=E.prototype;return w.equals=function(c){for(var y=!0,m=0;m<F;m++)if(!this.chars[m].equals(c.chars[m])){y=!1;break}return y},w.copy=function(c){for(var y=0;y<F;y++)this.chars[y].copy(c.chars[y])},w.isEmpty=function(){for(var c=!0,y=0;y<F;y++)if(!this.chars[y].isEmpty()){c=!1;break}return c},w.setCursor=function(c){this.pos!==c&&(this.pos=c),this.pos<0?(this.logger.log(d.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>F&&(this.logger.log(d.DEBUG,"Too large cursor position "+this.pos),this.pos=F)},w.moveCursor=function(c){var y=this.pos+c;if(c>1)for(var m=this.pos+1;m<y+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(y)},w.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},w.insertChar=function(c){c>=144&&this.backSpace();var y=M(c);if(this.pos>=F){this.logger.log(d.ERROR,"Cannot insert "+c.toString(16)+" ("+y+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(y,this.currPenState),this.moveCursor(1)},w.clearFromPos=function(c){var y;for(y=c;y<F;y++)this.chars[y].reset()},w.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},w.clearToEndOfRow=function(){this.clearFromPos(this.pos)},w.getTextString=function(){for(var c=[],y=!0,m=0;m<F;m++){var _=this.chars[m].uchar;_!==" "&&(y=!1),c.push(_)}return y?"":c.join("")},w.setPenStyles=function(c){this.currPenState.setStyles(c);var y=this.chars[this.pos];y.setPenState(this.currPenState)},E}(),h=function(){function E(b){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var c=0;c<W;c++)this.rows.push(new l(b));this.logger=b,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var w=E.prototype;return w.reset=function(){for(var c=0;c<W;c++)this.rows[c].clear();this.currRow=W-1},w.equals=function(c){for(var y=!0,m=0;m<W;m++)if(!this.rows[m].equals(c.rows[m])){y=!1;break}return y},w.copy=function(c){for(var y=0;y<W;y++)this.rows[y].copy(c.rows[y])},w.isEmpty=function(){for(var c=!0,y=0;y<W;y++)if(!this.rows[y].isEmpty()){c=!1;break}return c},w.backSpace=function(){var c=this.rows[this.currRow];c.backSpace()},w.clearToEndOfRow=function(){var c=this.rows[this.currRow];c.clearToEndOfRow()},w.insertChar=function(c){var y=this.rows[this.currRow];y.insertChar(c)},w.setPen=function(c){var y=this.rows[this.currRow];y.setPenStyles(c)},w.moveCursor=function(c){var y=this.rows[this.currRow];y.moveCursor(c)},w.setCursor=function(c){this.logger.log(d.INFO,"setCursor: "+c);var y=this.rows[this.currRow];y.setCursor(c)},w.setPAC=function(c){this.logger.log(d.INFO,"pacData = "+JSON.stringify(c));var y=c.row-1;if(this.nrRollUpRows&&y<this.nrRollUpRows-1&&(y=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==y){for(var m=0;m<W;m++)this.rows[m].clear();var _=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var I=P.rows[_].cueStartTime,B=this.logger.time;if(I&&B!==null&&I<B)for(var U=0;U<this.nrRollUpRows;U++)this.rows[y-this.nrRollUpRows+U+1].copy(P.rows[_+U])}}this.currRow=y;var C=this.rows[this.currRow];if(c.indent!==null){var v=c.indent,j=Math.max(v-1,0);C.setCursor(c.indent),c.color=C.chars[j].penState.foreground}var G={foreground:c.color,underline:c.underline,italics:c.italics,background:"black",flash:!1};this.setPen(G)},w.setBkgData=function(c){this.logger.log(d.INFO,"bkgData = "+JSON.stringify(c)),this.backSpace(),this.setPen(c),this.insertChar(32)},w.setRollUpRows=function(c){this.nrRollUpRows=c},w.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 c=this.currRow+1-this.nrRollUpRows,y=this.rows.splice(c,1)[0];y.clear(),this.rows.splice(this.currRow,0,y),this.logger.log(d.INFO,"Rolling up")},w.getDisplayText=function(c){c=c||!1;for(var y=[],m="",_=-1,P=0;P<W;P++){var I=this.rows[P].getTextString();I&&(_=P+1,c?y.push("Row "+_+": '"+I+"'"):y.push(I.trim()))}return y.length>0&&(c?m="["+y.join(" | ")+"]":m=y.join(`
|
|
`)),m},w.getTextAndFormat=function(){return this.rows},E}(),A=function(){function E(b,c,y){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=b,this.outputFilter=c,this.mode=null,this.verbose=0,this.displayedMemory=new h(y),this.nonDisplayedMemory=new h(y),this.lastOutputScreen=new h(y),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=y}var w=E.prototype;return w.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},w.getHandler=function(){return this.outputFilter},w.setHandler=function(c){this.outputFilter=c},w.setPAC=function(c){this.writeScreen.setPAC(c)},w.setBkgData=function(c){this.writeScreen.setBkgData(c)},w.setMode=function(c){if(c===this.mode)return;this.mode=c,this.logger.log(d.INFO,"MODE="+c),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=c},w.insertChars=function(c){for(var y=0;y<c.length;y++)this.writeScreen.insertChar(c[y]);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())},w.ccRCL=function(){this.logger.log(d.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},w.ccBS=function(){if(this.logger.log(d.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},w.ccAOF=function(){},w.ccAON=function(){},w.ccDER=function(){this.logger.log(d.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},w.ccRU=function(c){this.logger.log(d.INFO,"RU("+c+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(c)},w.ccFON=function(){this.logger.log(d.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},w.ccRDC=function(){this.logger.log(d.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},w.ccTR=function(){this.logger.log(d.INFO,"TR"),this.setMode("MODE_TEXT")},w.ccRTD=function(){this.logger.log(d.INFO,"RTD"),this.setMode("MODE_TEXT")},w.ccEDM=function(){this.logger.log(d.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},w.ccCR=function(){this.logger.log(d.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},w.ccENM=function(){this.logger.log(d.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},w.ccEOC=function(){if(this.logger.log(d.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var c=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=c,this.writeScreen=this.nonDisplayedMemory,this.logger.log(d.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},w.ccTO=function(c){this.logger.log(d.INFO,"TO("+c+") - Tab Offset"),this.writeScreen.moveCursor(c)},w.ccMIDROW=function(c){var y={flash:!1};if(y.underline=c%2===1,y.italics=c>=46,y.italics)y.foreground="white";else{var m=Math.floor(c/2)-16,_=["white","green","blue","cyan","red","yellow","magenta"];y.foreground=_[m]}this.logger.log(d.INFO,"MIDROW: "+JSON.stringify(y)),this.writeScreen.setPen(y)},w.outputDataUpdate=function(c){c===void 0&&(c=!1);var y=this.logger.time;if(y===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=y:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,y,this.lastOutputScreen),c&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:y),this.lastOutputScreen.copy(this.displayedMemory))},w.cueSplitAtTime=function(c){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,c,this.displayedMemory),this.cueStartTime=c))},E}(),x=function(){function E(b,c,y){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new s;this.channels=[null,new A(b,c,m),new A(b+1,y,m)],this.cmdHistory=S(),this.logger=m}var w=E.prototype;return w.getHandler=function(c){return this.channels[c].getHandler()},w.setHandler=function(c,y){this.channels[c].setHandler(y)},w.addData=function(c,y){var m,_,P,I=!1;this.logger.time=c;for(var B=0;B<y.length;B+=2){if(_=y[B]&127,P=y[B+1]&127,_===0&&P===0)continue;if(this.logger.log(d.DATA,"["+u([y[B],y[B+1]])+"] -> ("+u([_,P])+")"),m=this.parseCmd(_,P),m||(m=this.parseMidrow(_,P)),m||(m=this.parsePAC(_,P)),m||(m=this.parseBackgroundAttributes(_,P)),!m&&(I=this.parseChars(_,P),I)){var U=this.currentChannel;if(U&&U>0){var C=this.channels[U];C.insertChars(I)}else this.logger.log(d.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!I&&this.logger.log(d.WARNING,"Couldn't parse cleaned data "+u([_,P])+" orig: "+u([y[B],y[B+1]]))}},w.parseCmd=function(c,y){var m=this.cmdHistory,_=(c===20||c===28||c===21||c===29)&&y>=32&&y<=47,P=(c===23||c===31)&&y>=33&&y<=35;if(!(_||P))return!1;if(O(c,y,m))return T(null,null,m),this.logger.log(d.DEBUG,"Repeated command ("+u([c,y])+") is dropped"),!0;var I=c===20||c===21||c===23?1:2,B=this.channels[I];return c===20||c===21||c===28||c===29?y===32?B.ccRCL():y===33?B.ccBS():y===34?B.ccAOF():y===35?B.ccAON():y===36?B.ccDER():y===37?B.ccRU(2):y===38?B.ccRU(3):y===39?B.ccRU(4):y===40?B.ccFON():y===41?B.ccRDC():y===42?B.ccTR():y===43?B.ccRTD():y===44?B.ccEDM():y===45?B.ccCR():y===46?B.ccENM():y===47&&B.ccEOC():B.ccTO(y-32),T(c,y,m),this.currentChannel=I,!0},w.parseMidrow=function(c,y){var m=0;if((c===17||c===25)&&y>=32&&y<=47){if(c===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(d.ERROR,"Mismatch channel in midrow parsing"),!1;var _=this.channels[m];return _?(_.ccMIDROW(y),this.logger.log(d.DEBUG,"MIDROW ("+u([c,y])+")"),!0):!1}return!1},w.parsePAC=function(c,y){var m,_=this.cmdHistory,P=(c>=17&&c<=23||c>=25&&c<=31)&&y>=64&&y<=127,I=(c===16||c===24)&&y>=64&&y<=95;if(!(P||I))return!1;if(O(c,y,_))return T(null,null,_),!0;var B=c<=23?1:2;y>=64&&y<=95?m=B===1?k[c]:g[c]:m=B===1?R[c]:p[c];var U=this.channels[B];return U?(U.setPAC(this.interpretPAC(m,y)),T(c,y,_),this.currentChannel=B,!0):!1},w.interpretPAC=function(c,y){var m,_={color:null,italics:!1,indent:null,underline:!1,row:c};return y>95?m=y-96:m=y-64,_.underline=(m&1)===1,m<=13?_.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(_.italics=!0,_.color="white"):_.indent=Math.floor((m-16)/2)*4,_},w.parseChars=function(c,y){var m,_=null,P=null;if(c>=25?(m=2,P=c-8):(m=1,P=c),P>=17&&P<=19){var I;P===17?I=y+80:P===18?I=y+112:I=y+144,this.logger.log(d.INFO,"Special char '"+M(I)+"' in channel "+m),_=[I]}else c>=32&&c<=127&&(_=y===0?[c]:[c,y]);if(_){var B=u(_);this.logger.log(d.DEBUG,"Char codes = "+B.join(",")),T(c,y,this.cmdHistory)}return _},w.parseBackgroundAttributes=function(c,y){var m=(c===16||c===24)&&y>=32&&y<=47,_=(c===23||c===31)&&y>=45&&y<=47;if(!(m||_))return!1;var P,I={};c===16||c===24?(P=Math.floor((y-32)/2),I.background=f[P],y%2===1&&(I.background=I.background+"_semi")):y===45?I.background="transparent":(I.foreground="black",y===47&&(I.underline=!0));var B=c<=23?1:2,U=this.channels[B];return U.setBkgData(I),T(c,y,this.cmdHistory),!0},w.reset=function(){for(var c=0;c<Object.keys(this.channels).length;c++){var y=this.channels[c];y&&y.reset()}this.cmdHistory=S()},w.cueSplitAtTime=function(c){for(var y=0;y<this.channels.length;y++){var m=this.channels[y];m&&m.cueSplitAtTime(c)}},E}();function T(E,w,b){b.a=E,b.b=w}function O(E,w,b){return b.a===E&&b.b===w}function S(){return{a:null,b:null}}V.default=x},"./src/utils/codecs.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"isCodecType",function(){return N}),D.d(V,"isCodecSupportedInMp4",function(){return M});var z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function N(W,F){var k=z[F];return!!k&&k[W.slice(0,4)]===!0}function M(W,F){return MediaSource.isTypeSupported((F||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/utils/vttparser.ts"),N=D("./src/utils/webvtt-parser.ts"),M=D("./src/utils/texttrack-utils.ts"),W=/\s/,F={newCue:function(R,g,p,f){for(var d=[],s,u,o,a,l,h=self.VTTCue||self.TextTrackCue,A=0;A<f.rows.length;A++)if(s=f.rows[A],o=!0,a=0,l="",!s.isEmpty()){for(var x=0;x<s.chars.length;x++)W.test(s.chars[x].uchar)&&o?a++:(l+=s.chars[x].uchar,o=!1);s.cueStartTime=g,g===p&&(p+=1e-4),a>=16?a--:a++;var T=Object(z.fixLineBreaks)(l.trim()),O=Object(N.generateCueId)(g,p,T);(!R||!R.cues||!R.cues.getCueById(O))&&(u=new h(g,p,T),u.id=O,u.line=A+1,u.align="left",u.position=10+Math.min(80,Math.floor(a*8/32)*10),d.push(u))}return R&&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(M.addCueToTrack)(R,S)})),d}};V.default=F},"./src/utils/discontinuities.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"findFirstFragWithCC",function(){return W}),D.d(V,"shouldAlignOnDiscontinuities",function(){return F}),D.d(V,"findDiscontinuousReferenceFrag",function(){return k}),D.d(V,"adjustSlidingStart",function(){return g}),D.d(V,"alignStream",function(){return p}),D.d(V,"alignPDT",function(){return d}),D.d(V,"alignFragmentByPDTDelta",function(){return s}),D.d(V,"alignMediaPlaylistByPDT",function(){return u});var z=D("./src/polyfills/number.ts"),N=D("./src/utils/logger.ts"),M=D("./src/controller/level-helper.ts");function W(o,a){for(var l=null,h=0,A=o.length;h<A;h++){var x=o[h];if(x&&x.cc===a){l=x;break}}return l}function F(o,a,l){return!!(a.details&&(l.endCC>l.startCC||o&&o.cc<l.startCC))}function k(o,a){var l=o.fragments,h=a.fragments;if(!h.length||!l.length){N.logger.log("No fragments to align");return}var A=W(l,h[0].cc);if(!A||A&&!A.startPTS){N.logger.log("No frag in previous level to align on");return}return A}function R(o,a){if(o){var l=o.start+a;o.start=o.startPTS=l,o.endPTS=l+o.duration}}function g(o,a){for(var l=a.fragments,h=0,A=l.length;h<A;h++)R(l[h],o);a.fragmentHint&&R(a.fragmentHint,o),a.alignedSliding=!0}function p(o,a,l){if(!a)return;f(o,l,a),!l.alignedSliding&&a.details&&d(l,a.details),!l.alignedSliding&&a.details&&!l.skippedSegments&&Object(M.adjustSliding)(a.details,l)}function f(o,a,l){if(F(o,l,a)){var h=k(l.details,a);h&&Object(z.isFiniteNumber)(h.start)&&(N.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),g(h.start,a))}}function d(o,a){if(!a.fragments.length||!o.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,h=o.fragments[0].programDateTime,A=(h-l)/1e3+a.fragments[0].start;A&&Object(z.isFiniteNumber)(A)&&(N.logger.log("Adjusting PTS using programDateTime delta "+(h-l)+"ms, sliding:"+A.toFixed(3)+" "+o.url+" "),g(A,o))}function s(o,a){var l=o.programDateTime;if(!l)return;var h=(l-a)/1e3;o.start=o.startPTS=h,o.endPTS=h+o.duration}function u(o,a){if(!a.fragments.length||!o.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,h=a.fragments[0].start,A=l-h*1e3;o.fragments.forEach(function(x){s(x,A)}),o.fragmentHint&&s(o.fragmentHint,A),o.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/utils/ewma.ts"),N=function(){function M(F,k,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new z.default(F),this.fast_=new z.default(k)}var W=M.prototype;return W.update=function(k,R){var g=this.slow_,p=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new z.default(k,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new z.default(R,p.getEstimate(),p.getTotalWeight()))},W.sample=function(k,R){k=Math.max(k,this.minDelayMs_);var g=8*R,p=k/1e3,f=g/p;this.fast_.sample(p,f),this.slow_.sample(p,f)},W.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},M}();V.default=N},"./src/utils/ewma.ts":function(ae,V,D){"use strict";D.r(V);var z=function(){function N(W,F,k){F===void 0&&(F=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=W,this.alpha_=W?Math.exp(Math.log(.5)/W):0,this.estimate_=F,this.totalWeight_=k}var M=N.prototype;return M.sample=function(F,k){var R=Math.pow(this.alpha_,F);this.estimate_=k*(1-R)+R*this.estimate_,this.totalWeight_+=F},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var F=1-Math.pow(this.alpha_,this.totalWeight_);if(F)return this.estimate_/F}return this.estimate_},N}();V.default=z},"./src/utils/fetch-loader.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"fetchSupported",function(){return s});var z=D("./src/polyfills/number.ts"),N=D("./src/loader/load-stats.ts"),M=D("./src/demux/chunk-cache.ts");function W(h,A){h.prototype=Object.create(A.prototype),h.prototype.constructor=h,p(h,A)}function F(h){var A=typeof Map=="function"?new Map:void 0;return F=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 A!="undefined"){if(A.has(T))return A.get(T);A.set(T,O)}function O(){return k(T,arguments,f(this).constructor)}return O.prototype=Object.create(T.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),p(O,T)},F(h)}function k(h,A,x){return R()?k=Reflect.construct:k=function(O,S,E){var w=[null];w.push.apply(w,S);var b=Function.bind.apply(O,w),c=new b;return E&&p(c,E.prototype),c},k.apply(null,arguments)}function R(){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,A){return p=Object.setPrototypeOf||function(T,O){return T.__proto__=O,T},p(h,A)}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 A=1;A<arguments.length;A++){var x=arguments[A];for(var T in x)Object.prototype.hasOwnProperty.call(x,T)&&(h[T]=x[T])}return h},d.apply(this,arguments)}function s(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var u=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||a,this.controller=new self.AbortController,this.stats=new N.LoadStats}var A=h.prototype;return A.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},A.abortInternal=function(){var T=this.response;(!T||!T.ok)&&(this.stats.aborted=!0,this.controller.abort())},A.abort=function(){var T;this.abortInternal(),(T=this.callbacks)!==null&&T!==void 0&&T.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},A.load=function(T,O,S){var E=this,w=this.stats;if(w.loading.start)throw new Error("Loader can only be used once.");w.loading.start=self.performance.now();var b=o(T,this.controller.signal),c=S.onProgress,y=T.responseType==="arraybuffer",m=y?"byteLength":"length";this.context=T,this.config=O,this.callbacks=S,this.request=this.fetchSetup(T,b),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){E.abortInternal(),S.onTimeout(w,T,E.response)},O.timeout),self.fetch(this.request).then(function(_){if(E.response=E.loader=_,!_.ok){var P=_.status,I=_.statusText;throw new l(I||"fetch, bad network response",P,_)}return w.loading.first=Math.max(self.performance.now(),w.loading.start),w.total=parseInt(_.headers.get("Content-Length")||"0"),c&&Object(z.isFiniteNumber)(O.highWaterMark)?E.loadProgressively(_,w,T,O.highWaterMark,c):y?_.arrayBuffer():_.text()}).then(function(_){var P=E.response;self.clearTimeout(E.requestTimeout),w.loading.end=Math.max(self.performance.now(),w.loading.first),w.loaded=w.total=_[m];var I={url:P.url,data:_};c&&!Object(z.isFiniteNumber)(O.highWaterMark)&&c(w,T,_,P),S.onSuccess(I,w,T,P)}).catch(function(_){if(self.clearTimeout(E.requestTimeout),w.aborted)return;var P=_.code||0;S.onError({code:P,text:_.message},T,_.details)})},A.getCacheAge=function(){var T=null;if(this.response){var O=this.response.headers.get("age");T=O?parseFloat(O):null}return T},A.loadProgressively=function(T,O,S,E,w){E===void 0&&(E=0);var b=new M.default,c=T.body.getReader(),y=function m(){return c.read().then(function(_){if(_.done)return b.dataLength&&w(O,S,b.flush(),T),Promise.resolve(new ArrayBuffer(0));var P=_.value,I=P.length;return O.loaded+=I,I<E||b.dataLength?(b.push(P),b.dataLength>=E&&w(O,S,b.flush(),T)):w(O,S,P,T),m()}).catch(function(){return Promise.reject()})};return y()},h}();function o(h,A){var x={method:"GET",mode:"cors",credentials:"same-origin",signal:A,headers:new self.Headers(d({},h.headers))};return h.rangeEnd&&x.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),x}function a(h,A){return new self.Request(h.url,A)}var l=function(h){W(A,h);function A(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 A}(F(Error));V.default=u},"./src/utils/imsc1-ttml-parser.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"IMSC1_CODEC",function(){return g}),D.d(V,"parseIMSC1",function(){return s});var z=D("./src/utils/mp4-tools.ts"),N=D("./src/utils/vttparser.ts"),M=D("./src/utils/vttcue.ts"),W=D("./src/demux/id3.ts"),F=D("./src/utils/timescale-conversion.ts"),k=D("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(E){for(var w=1;w<arguments.length;w++){var b=arguments[w];for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(E[c]=b[c])}return E},R.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 s(E,w,b,c,y){var m=Object(z.findBox)(new Uint8Array(E),["mdat"]);if(m.length===0){y(new Error("Could not parse IMSC1 mdat"));return}var _=m[0],P=Object(W.utf8ArrayToStr)(new Uint8Array(E,_.start,_.end-_.start)),I=Object(F.toTimescaleFromScale)(w,1,b);try{c(u(P,I))}catch(B){y(B)}}function u(E,w){var b=new DOMParser,c=b.parseFromString(E,"text/xml"),y=c.getElementsByTagName("tt")[0];if(!y)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},_=Object.keys(m).reduce(function(C,v){return C[v]=y.getAttribute("ttp:"+v)||m[v],C},{}),P=y.getAttribute("xml:space")!=="preserve",I=a(o(y,"styling","style")),B=a(o(y,"layout","region")),U=o(y,"body","[begin]");return[].map.call(U,function(C){var v=l(C,P);if(!v||!C.hasAttribute("begin"))return null;var j=T(C.getAttribute("begin"),_),G=T(C.getAttribute("dur"),_),J=T(C.getAttribute("end"),_);if(j===null)throw x(C);if(J===null){if(G===null)throw x(C);J=j+G}var ee=new M.default(j-w,J-w,v);ee.id=Object(k.generateCueId)(ee.startTime,ee.endTime,ee.text);var ye=B[C.getAttribute("region")],he=I[C.getAttribute("style")];ee.position=10,ee.size=80;var ge=h(ye,he),pe=ge.textAlign;if(pe){var oe=d[pe];oe&&(ee.lineAlign=oe),ee.align=pe}return R(ee,ge),ee}).filter(function(C){return C!==null})}function o(E,w,b){var c=E.getElementsByTagName(w)[0];return c?[].slice.call(c.querySelectorAll(b)):[]}function a(E){return E.reduce(function(w,b){var c=b.getAttribute("xml:id");return c&&(w[c]=b),w},{})}function l(E,w){return[].slice.call(E.childNodes).reduce(function(b,c,y){var m;return c.nodeName==="br"&&y?b+`
|
|
`:(m=c.childNodes)!==null&&m!==void 0&&m.length?l(c,w):w?b+c.textContent.trim().replace(/\s+/g," "):b+c.textContent},"")}function h(E,w){var b="http://www.w3.org/ns/ttml#styling",c=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return c.reduce(function(y,m){var _=A(w,b,m)||A(E,b,m);return _&&(y[m]=_),y},{})}function A(E,w,b){return E.hasAttributeNS(w,b)?E.getAttributeNS(w,b):null}function x(E){return new Error("Could not parse ttml timestamp "+E)}function T(E,w){if(!E)return null;var b=Object(N.parseTimeStamp)(E);return b===null&&(p.test(E)?b=O(E,w):f.test(E)&&(b=S(E,w))),b}function O(E,w){var b=p.exec(E),c=(b[4]|0)+(b[5]|0)/w.subFrameRate;return(b[1]|0)*3600+(b[2]|0)*60+(b[3]|0)+c/w.frameRate}function S(E,w){var b=f.exec(E),c=Number(b[1]),y=b[2];switch(y){case"h":return c*3600;case"m":return c*60;case"ms":return c*1e3;case"f":return c/w.frameRate;case"t":return c/w.tickRate}return c}},"./src/utils/logger.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"enableLogs",function(){return k}),D.d(V,"logger",function(){return R});var z=function(){},N={trace:z,debug:z,log:z,warn:z,info:z,error:z},M=N;function W(g){var p=self.console[g];return p?p.bind(self.console,"["+g+"] >"):z}function F(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(s){M[s]=g[s]?g[s].bind(g):W(s)})}function k(g){if(self.console&&g===!0||typeof g=="object"){F(g,"debug","log","info","warn","error");try{M.log()}catch(p){M=N}}else M=N}var R=M},"./src/utils/mediakeys-helper.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"KeySystems",function(){return z}),D.d(V,"requestMediaKeySystemAccess",function(){return N});var z;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})(z||(z={}));var N=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"bin2str",function(){return F}),D.d(V,"readUint16",function(){return k}),D.d(V,"readUint32",function(){return R}),D.d(V,"writeUint32",function(){return g}),D.d(V,"findBox",function(){return p}),D.d(V,"parseSegmentIndex",function(){return f}),D.d(V,"parseInitSegment",function(){return d}),D.d(V,"getStartDTS",function(){return s}),D.d(V,"getDuration",function(){return u}),D.d(V,"computeRawDurationFromSamples",function(){return o}),D.d(V,"offsetStartDTS",function(){return a}),D.d(V,"segmentValidRange",function(){return l}),D.d(V,"appendUint8Array",function(){return h});var z=D("./src/utils/typed-array.ts"),N=D("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,W=[].push;function F(A){return String.fromCharCode.apply(null,A)}function k(A,x){"data"in A&&(x+=A.start,A=A.data);var T=A[x]<<8|A[x+1];return T<0?65536+T:T}function R(A,x){"data"in A&&(x+=A.start,A=A.data);var T=A[x]<<24|A[x+1]<<16|A[x+2]<<8|A[x+3];return T<0?4294967296+T:T}function g(A,x,T){"data"in A&&(x+=A.start,A=A.data),A[x]=T>>24,A[x+1]=T>>16&255,A[x+2]=T>>8&255,A[x+3]=T&255}function p(A,x){var T=[];if(!x.length)return T;var O,S,E;"data"in A?(O=A.data,S=A.start,E=A.end):(O=A,S=0,E=O.byteLength);for(var w=S;w<E;){var b=R(O,w),c=F(O.subarray(w+4,w+8)),y=b>1?w+b:E;if(c===x[0])if(x.length===1)T.push({data:O,start:w+8,end:y});else{var m=p({data:O,start:w+8,end:y},x.slice(1));m.length&&W.apply(T,m)}w=y}return T}function f(A){var x=p(A,["moov"]),T=x[0],O=T?T.end:null,S=p(A,["sidx"]);if(!S||!S[0])return null;var E=[],w=S[0],b=w.data[0],c=b===0?8:16,y=R(w,c);c+=4;var m=0,_=0;b===0?c+=8:c+=16,c+=2;var P=w.end+_,I=k(w,c);c+=2;for(var B=0;B<I;B++){var U=c,C=R(w,U);U+=4;var v=C&2147483647,j=(C&2147483648)>>>31;if(j===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var G=R(w,U);U+=4,E.push({referenceSize:v,subsegmentDuration:G,info:{duration:G/y,start:P,end:P+v-1}}),P+=v,U+=4,c=U}return{earliestPresentationTime:m,timescale:y,version:b,referencesCount:I,references:E,moovEndOffset:O}}function d(A){for(var x=[],T=p(A,["moov","trak"]),O=0;O<T.length;O++){var S=T[O],E=p(S,["tkhd"])[0];if(E){var w=E.data[E.start],b=w===0?12:20,c=R(E,b),y=p(S,["mdia","mdhd"])[0];if(y){w=y.data[y.start],b=w===0?12:20;var m=R(y,b),_=p(S,["mdia","hdlr"])[0];if(_){var P=F(_.data.subarray(_.start+8,_.start+12)),I={soun:N.ElementaryStreamTypes.AUDIO,vide:N.ElementaryStreamTypes.VIDEO}[P];if(I){var B=p(S,["mdia","minf","stbl","stsd"])[0],U=void 0;B&&(U=F(B.data.subarray(B.start+12,B.start+16))),x[c]={timescale:m,type:I},x[I]={timescale:m,id:c,codec:U}}}}}}var C=p(A,["moov","mvex","trex"]);return C.forEach(function(v){var j=R(v,4),G=x[j];G&&(G.default={duration:R(v,12),flags:R(v,20)})}),x}function s(A,x){return p(x,["moof","traf"]).reduce(function(T,O){var S=p(O,["tfdt"])[0],E=S.data[S.start],w=p(O,["tfhd"]).reduce(function(b,c){var y=R(c,4),m=A[y];if(m){var _=R(S,4);E===1&&(_*=Math.pow(2,32),_+=R(S,8));var P=m.timescale||9e4,I=_/P;if(isFinite(I)&&(b===null||I<b))return I}return b},null);return w!==null&&isFinite(w)&&(T===null||w<T)?w:T},null)||0}function u(A,x){for(var T=0,O=0,S=0,E=p(A,["moof","traf"]),w=0;w<E.length;w++){var b=E[w],c=p(b,["tfhd"])[0],y=R(c,4),m=x[y];if(!m)continue;var _=m.default,P=R(c,0)|(_==null?void 0:_.flags),I=_==null?void 0:_.duration;P&8&&(P&2?I=R(c,12):I=R(c,8));for(var B=m.timescale||9e4,U=p(b,["trun"]),C=0;C<U.length;C++){if(I){var v=R(U[C],4);T=I*v}else T=o(U[C]);m.type===N.ElementaryStreamTypes.VIDEO?O+=T/B:m.type===N.ElementaryStreamTypes.AUDIO&&(S+=T/B)}}if(O===0&&S===0){var j=f(A);if(j!=null&&j.references)return j.references.reduce(function(G,J){return G+J.info.duration||0},0)}return O||S}function o(A){var x=R(A,0),T=8;x&1&&(T+=4),x&4&&(T+=4);for(var O=0,S=R(A,4),E=0;E<S;E++){if(x&256){var w=R(A,T);O+=w,T+=4}x&512&&(T+=4),x&1024&&(T+=4),x&2048&&(T+=4)}return O}function a(A,x,T){p(x,["moof","traf"]).forEach(function(O){p(O,["tfhd"]).forEach(function(S){var E=R(S,4),w=A[E];if(!w)return;var b=w.timescale||9e4;p(O,["tfdt"]).forEach(function(c){var y=c.data[c.start],m=R(c,4);if(y===0)g(c,4,m-T*b);else{m*=Math.pow(2,32),m+=R(c,8),m-=T*b,m=Math.max(m,0);var _=Math.floor(m/(M+1)),P=Math.floor(m%(M+1));g(c,4,_),g(c,8,P)}})})})}function l(A){var x={valid:null,remainder:null},T=p(A,["moof"]);if(T){if(T.length<2)return x.remainder=A,x}else return x;var O=T[T.length-1];return x.valid=Object(z.sliceUint8)(A,0,O.start-8),x.remainder=Object(z.sliceUint8)(A,O.start-8),x}function h(A,x){var T=new Uint8Array(A.length+x.length);return T.set(A),T.set(x,A.length),T}},"./src/utils/output-filter.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function N(W,F){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=F}var M=N.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(F,k,R){(this.startTime===null||this.startTime>F)&&(this.startTime=F),this.endTime=k,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},N}()},"./src/utils/texttrack-utils.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"sendAddTrackEvent",function(){return N}),D.d(V,"addCueToTrack",function(){return M}),D.d(V,"clearCurrentCues",function(){return W}),D.d(V,"removeCuesInRange",function(){return F}),D.d(V,"getCuesInRange",function(){return R});var z=D("./src/utils/logger.ts");function N(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 M(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(s){z.logger.debug("[texttrack-utils]: "+s);var d=new self.TextTrackCue(p.startTime,p.endTime,p.text);d.id=p.id,g.addCue(d)}f==="disabled"&&(g.mode=f)}function W(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 F(g,p,f){var d=g.mode;if(d==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var s=R(g.cues,p,f),u=0;u<s.length;u++)g.removeCue(s[u]);d==="disabled"&&(g.mode=d)}function k(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,s=f;d<=s;){var u=Math.floor((s+d)/2);if(p<g[u].startTime)s=u-1;else if(p>g[u].startTime&&d<f)d=u+1;else return u}return g[d].startTime-p<p-g[s].startTime?d:s}function R(g,p,f){var d=[],s=k(g,p);if(s>-1)for(var u=s,o=g.length;u<o;u++){var a=g[u];if(a.startTime>=p&&a.endTime<=f)d.push(a);else if(a.startTime>f)return d}return d}},"./src/utils/time-ranges.ts":function(ae,V,D){"use strict";D.r(V);var z={toString:function(M){for(var W="",F=M.length,k=0;k<F;k++)W+="["+M.start(k).toFixed(3)+","+M.end(k).toFixed(3)+"]";return W}};V.default=z},"./src/utils/timescale-conversion.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"toTimescaleFromBase",function(){return N}),D.d(V,"toTimescaleFromScale",function(){return M}),D.d(V,"toMsFromMpegTsClock",function(){return W}),D.d(V,"toMpegTsClockFromTimescale",function(){return F});var z=9e4;function N(k,R,g,p){g===void 0&&(g=1),p===void 0&&(p=!1);var f=k*R*g;return p?Math.round(f):f}function M(k,R,g,p){return g===void 0&&(g=1),p===void 0&&(p=!1),N(k,R,1/g,p)}function W(k,R){return R===void 0&&(R=!1),N(k,1e3,1/z,R)}function F(k,R){return R===void 0&&(R=1),N(k,z,1/R)}},"./src/utils/typed-array.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"sliceUint8",function(){return z});function z(N,M,W){return Uint8Array.prototype.slice?N.slice(M,W):new Uint8Array(Array.prototype.slice.call(N,M,W))}},"./src/utils/vttcue.ts":function(ae,V,D){"use strict";D.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],N=["start","middle","end","left","right"];function M(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 W(g){return M(z,g)}function F(g){return M(N,g)}function k(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 s=1;s<arguments.length;s++){var u=arguments[s];for(var o in u)g[o]=u[o]}return g}function R(g,p,f){var d=this,s={enumerable:!0};d.hasBeenReset=!1;var u="",o=!1,a=g,l=p,h=f,A=null,x="",T=!0,O="auto",S="start",E=50,w="middle",b=50,c="middle";Object.defineProperty(d,"id",k({},s,{get:function(){return u},set:function(m){u=""+m}})),Object.defineProperty(d,"pauseOnExit",k({},s,{get:function(){return o},set:function(m){o=!!m}})),Object.defineProperty(d,"startTime",k({},s,{get:function(){return a},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");a=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",k({},s,{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",k({},s,{get:function(){return h},set:function(m){h=""+m,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",k({},s,{get:function(){return A},set:function(m){A=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",k({},s,{get:function(){return x},set:function(m){var _=W(m);if(_===!1)throw new SyntaxError("An invalid or illegal string was specified.");x=_,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",k({},s,{get:function(){return T},set:function(m){T=!!m,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",k({},s,{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",k({},s,{get:function(){return S},set:function(m){var _=F(m);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");S=_,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",k({},s,{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",k({},s,{get:function(){return w},set:function(m){var _=F(m);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");w=_,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",k({},s,{get:function(){return b},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");b=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",k({},s,{get:function(){return c},set:function(m){var _=F(m);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");c=_,this.hasBeenReset=!0}})),d.displayState=void 0}return R.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"parseTimeStamp",function(){return M}),D.d(V,"fixLineBreaks",function(){return p}),D.d(V,"VTTParser",function(){return f});var z=D("./src/utils/vttcue.ts"),N=function(){function d(){}var s=d.prototype;return s.decode=function(o,a){if(!o)return"";if(typeof o!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(o))},d}();function M(d){function s(o,a,l,h){return(o|0)*3600+(a|0)*60+(l|0)+parseFloat(h||0)}var u=d.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return u?parseFloat(u[2])>59?s(u[2],u[3],0,u[4]):s(u[1],u[2],u[3],u[4]):null}var W=function(){function d(){this.values=Object.create(null)}var s=d.prototype;return s.set=function(o,a){!this.get(o)&&a!==""&&(this.values[o]=a)},s.get=function(o,a,l){return l?this.has(o)?this.values[o]:a[l]:this.has(o)?this.values[o]:a},s.has=function(o){return o in this.values},s.alt=function(o,a,l){for(var h=0;h<l.length;++h)if(a===l[h]){this.set(o,a);break}},s.integer=function(o,a){/^-?\d+$/.test(a)&&this.set(o,parseInt(a,10))},s.percent=function(o,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var l=parseFloat(a);if(l>=0&&l<=100)return this.set(o,l),!0}return!1},d}();function F(d,s,u,o){var a=o?d.split(o):[d];for(var l in a){if(typeof a[l]!="string")continue;var h=a[l].split(u);if(h.length!==2)continue;var A=h[0],x=h[1];s(A,x)}}var k=new z.default(0,0,""),R=k.align==="middle"?"middle":"center";function g(d,s,u){var o=d;function a(){var A=M(d);if(A===null)throw new Error("Malformed timestamp: "+o);return d=d.replace(/^[^\sa-zA-Z-]+/,""),A}function l(A,x){var T=new W;F(A,function(E,w){var b;switch(E){case"region":for(var c=u.length-1;c>=0;c--)if(u[c].id===w){T.set(E,u[c].region);break}break;case"vertical":T.alt(E,w,["rl","lr"]);break;case"line":b=w.split(","),T.integer(E,b[0]),T.percent(E,b[0])&&T.set("snapToLines",!1),T.alt(E,b[0],["auto"]),b.length===2&&T.alt("lineAlign",b[1],["start",R,"end"]);break;case"position":b=w.split(","),T.percent(E,b[0]),b.length===2&&T.alt("positionAlign",b[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":T.percent(E,w);break;case"align":T.alt(E,w,["start",R,"end","left","right"]);break}},/:/,/\s/),x.region=T.get("region",null),x.vertical=T.get("vertical","");var O=T.get("line","auto");O==="auto"&&k.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",R);var S=T.get("position","auto");S==="auto"&&k.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(),s.startTime=a(),h(),d.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+o);d=d.substr(3),h(),s.endTime=a(),h(),l(d,s)}function p(d){return d.replace(/<br(?: \/)?>/gi,`
|
|
`)}var f=function(){function d(){this.state="INITIAL",this.buffer="",this.decoder=new N,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var s=d.prototype;return s.parse=function(o){var a=this;o&&(a.buffer+=a.decoder.decode(o,{stream:!0}));function l(){var S=a.buffer,E=0;for(S=p(S);E<S.length&&S[E]!=="\r"&&S[E]!==`
|
|
`;)++E;var w=S.substr(0,E);return S[E]==="\r"&&++E,S[E]===`
|
|
`&&++E,a.buffer=S.substr(E),w}function h(S){F(S,function(E,w){},/:/)}try{var A="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;A=l();var x=A.match(/^()?WEBVTT([ \t].*)?$/);if(!x||!x[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var T=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;T?T=!1:A=l();switch(a.state){case"HEADER":/:/.test(A)?h(A):A||(a.state="ID");continue;case"NOTE":A||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(A)){a.state="NOTE";break}if(!A)continue;if(a.cue=new z.default(0,0,""),a.state="CUE",A.indexOf("-->")===-1){a.cue.id=A;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{g(A,a.cue,a.regionList)}catch(S){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var O=A.indexOf("-->")!==-1;if(!A||O&&(T=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
|
|
`),a.cue.text+=A}continue;case"BADCUE":A||(a.state="ID")}}}catch(S){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},s.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(a){o.onparsingerror&&o.onparsingerror(a)}return o.onflush&&o.onflush(),this},d}()},"./src/utils/webvtt-parser.ts":function(ae,V,D){"use strict";D.r(V),D.d(V,"generateCueId",function(){return f}),D.d(V,"parseWebVTT",function(){return s});var z=D("./src/polyfills/number.ts"),N=D("./src/utils/vttparser.ts"),M=D("./src/demux/id3.ts"),W=D("./src/utils/timescale-conversion.ts"),F=D("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,R=function(o,a,l){return l===void 0&&(l=0),o.substr(l,a.length)===a},g=function(o){var a=parseInt(o.substr(-3)),l=parseInt(o.substr(-6,2)),h=parseInt(o.substr(-9,2)),A=o.length>9?parseInt(o.substr(0,o.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(a)||!Object(z.isFiniteNumber)(l)||!Object(z.isFiniteNumber)(h)||!Object(z.isFiniteNumber)(A))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+o);return a+=1e3*l,a+=60*1e3*h,a+=60*60*1e3*A,a},p=function(o){for(var a=5381,l=o.length;l;)a=a*33^o.charCodeAt(--l);return(a>>>0).toString()};function f(u,o,a){return p(u.toString())+p(o.toString())+p(a)}var d=function(o,a,l){var h=o[a],A=o[h.prevCC];if(!A||!A.new&&h.new){o.ccOffset=o.presentationOffset=h.start,h.new=!1;return}for(;(x=A)!==null&&x!==void 0&&x.new;){var x;o.ccOffset+=h.start-A.start,h.new=!1,h=A,A=o[h.prevCC]}o.presentationOffset=l};function s(u,o,a,l,h,A,x,T){var O=new N.VTTParser,S=Object(M.utf8ArrayToStr)(new Uint8Array(u)).trim().replace(k,`
|
|
`).split(`
|
|
`),E=[],w=Object(W.toMpegTsClockFromTimescale)(o,a),b="00:00.000",c=0,y=0,m,_=!0,P=!1;O.oncue=function(I){var B=l[h],U=l.ccOffset,C=(c-w)/9e4;if(B!=null&&B.new&&(y!==void 0?U=l.ccOffset=B.start:d(l,h,C)),C&&(U=C-l.presentationOffset),P){var v=I.endTime-I.startTime,j=Object(F.normalizePts)((I.startTime+U-y)*9e4,A*9e4)/9e4;I.startTime=j,I.endTime=j+v}var G=I.text.trim();I.text=decodeURIComponent(encodeURIComponent(G)),I.id||(I.id=f(I.startTime,I.endTime,G)),I.endTime>0&&E.push(I)},O.onparsingerror=function(I){m=I},O.onflush=function(){if(m){T(m);return}x(E)},S.forEach(function(I){if(_)if(R(I,"X-TIMESTAMP-MAP=")){_=!1,P=!0,I.substr(16).split(",").forEach(function(B){R(B,"LOCAL:")?b=B.substr(6):R(B,"MPEGTS:")&&(c=parseInt(B.substr(7)))});try{y=g(b)/1e3}catch(B){P=!1,m=B}return}else I===""&&(_=!1);O.parse(I+`
|
|
`)}),O.flush()}},"./src/utils/xhr-loader.ts":function(ae,V,D){"use strict";D.r(V);var z=D("./src/utils/logger.ts"),N=D("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,W=function(){function F(R){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=R?R.xhrSetup:null,this.stats=new N.LoadStats,this.retryDelay=0}var k=F.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.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()))},k.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.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()},k.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 s=this.xhrSetup;try{if(s)try{s(f,p.url)}catch(a){f.open("GET",p.url,!0),s(f,p.url)}f.readyState||f.open("GET",p.url,!0);var u=this.context.headers;if(u)for(var o in u)f.setRequestHeader(o,u[o])}catch(a){this.callbacks.onError({code:f.status,text:a.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()},k.readystatechange=function(){var g=this.context,p=this.loader,f=this.stats;if(!g||!p)return;var d=p.readyState,s=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 u=p.status;if(u>=200&&u<300){f.loading.end=Math.max(self.performance.now(),f.loading.first);var o,a;if(g.responseType==="arraybuffer"?(o=p.response,a=o.byteLength):(o=p.responseText,a=o.length),f.loaded=f.total=a,!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>=s.maxRetry||u>=400&&u<499?(z.logger.error(u+" while loading "+g.url),this.callbacks.onError({code:u,text:p.statusText},g,p)):(z.logger.warn(u+" 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,s.maxRetryDelay),f.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout)},k.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(g){var p=this.stats;p.loaded=g.loaded,g.lengthComputable&&(p.total=g.total)},k.getCacheAge=function(){var g=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");g=p?parseFloat(p):null}return g},F}();V.default=W}}).default})},vHTk:function(ut,Qe,ne){ut.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|