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

208 lines
884 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[274,5,6,7],{"+NIl":function(at,Ve,te){(function(ne){ne(te("VrN/"))})(function(ne){"use strict";ne.defineMode("stex",function(V,D){"use strict";function z(d,o){d.cmdState.push(o)}function N(d){return d.cmdState.length>0?d.cmdState[d.cmdState.length-1]:null}function M(d){var o=d.cmdState.pop();o&&o.closeBracket()}function W(d){for(var o=d.cmdState,c=o.length-1;c>=0;c--){var s=o[c];if(s.name=="DEFAULT")continue;return s}return{styleIdentifier:function(){return null}}}function B(d,o,c){return function(){this.name=d,this.bracketNo=0,this.style=o,this.styles=c,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=B("importmodule","tag",["string","builtin"]),k.documentclass=B("documentclass","tag",["","atom"]),k.usepackage=B("usepackage","tag",["atom"]),k.begin=B("begin","tag",["atom"]),k.end=B("end","tag",["atom"]),k.label=B("label","tag",["atom"]),k.ref=B("ref","tag",["atom"]),k.eqref=B("eqref","tag",["atom"]),k.cite=B("cite","tag",["atom"]),k.bibitem=B("bibitem","tag",["atom"]),k.Bibitem=B("Bibitem","tag",["atom"]),k.RBibitem=B("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(d,o){d.f=o}function g(d,o){var c;if(d.match(/^\\[a-zA-Z@]+/)){var s=d.current().slice(1);return c=k.hasOwnProperty(s)?k[s]:k.DEFAULT,c=new c,z(o,c),R(o,f),c.style}if(d.match(/^\\[$&%#{}_]/))return"tag";if(d.match(/^\\[,;!\/\\]/))return"tag";if(d.match("\\["))return R(o,function(l,h){return p(l,h,"\\]")}),"keyword";if(d.match("\\("))return R(o,function(l,h){return p(l,h,"\\)")}),"keyword";if(d.match("$$"))return R(o,function(l,h){return p(l,h,"$$")}),"keyword";if(d.match("$"))return R(o,function(l,h){return p(l,h,"$")}),"keyword";var a=d.next();if(a=="%")return d.skipToEnd(),"comment";if(a=="}"||a=="]"){if(c=N(o),c)c.closeBracket(a),R(o,f);else return"error";return"bracket"}else return a=="{"||a=="["?(c=k.DEFAULT,c=new c,z(o,c),"bracket"):/\d/.test(a)?(d.eatWhile(/[\w.%]/),"atom"):(d.eatWhile(/[\w\-_]/),c=W(o),c.name=="begin"&&(c.argument=d.current()),c.styleIdentifier())}function p(d,o,c){if(d.eatSpace())return null;if(c&&d.match(c))return R(o,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 s=d.next();return s=="{"||s=="}"||s=="["||s=="]"||s=="("||s==")"?"bracket":s=="%"?(d.skipToEnd(),"comment"):"error"}function f(d,o){var c=d.peek(),s;return c=="{"||c=="["?(s=N(o),s.openBracket(c),d.eat(c),R(o,g),"bracket"):/[ \t\r]/.test(c)?(d.eat(c),null):(R(o,g),M(o),g(d,o))}return{startState:function(){var d=D.inMathMode?function(o,c){return p(o,c)}:g;return{cmdState:[],f:d}},copyState:function(d){return{cmdState:d.cmdState.slice(),f:d.f}},token:function(d,o){return o.f(d,o)},blankLine:function(d){d.f=g,d.cmdState.length=0},lineComment:"%"}}),ne.defineMIME("text/x-stex","stex"),ne.defineMIME("text/x-latex","stex")})},"+ua5":function(at,Ve,te){},"19Vz":function(at,Ve,te){(function(ne){ne(te("VrN/"))})(function(ne){ne.defineOption("placeholder","",function(B,k,R){var g=R&&R!=ne.Init;if(k&&!g)B.on("blur",N),B.on("change",M),B.on("swapDoc",M),ne.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){z(B)}),M(B);else if(!k&&g){B.off("blur",N),B.off("change",M),B.off("swapDoc",M),ne.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),V(B);var p=B.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}k&&!B.hasFocus()&&N(B)});function V(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function D(B){V(B);var k=B.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=B.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var R=B.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),k.appendChild(R),B.display.lineSpace.insertBefore(k,B.display.lineSpace.firstChild)}function z(B){setTimeout(function(){var k=!1,R=B.getInputField();R.nodeName=="TEXTAREA"?k=!R.value:B.lineCount()==1&&(k=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),k?D(B):V(B)},20)}function N(B){W(B)&&D(B)}function M(B){var k=B.getWrapperElement(),R=W(B);k.className=k.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?D(B):V(B)}function W(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(at,Ve,te){(function(ne){ne(te("VrN/"))})(function(ne){"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};ne.defineMode("xml",function(z,N){var M=z.indentUnit,W={},B=N.htmlMode?V:D;for(var k in B)W[k]=B[k];for(var k in N)W[k]=N[k];var R,g;function p(u,y){function m(I){return y.tokenize=I,I(u,y)}var b=u.next();if(b=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?m(o("atom","]]>")):null:u.match("--")?m(o("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),m(c(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),y.tokenize=o("meta","?>"),"meta"):(R=u.eat("/")?"closeTag":"openTag",y.tokenize=f,"tag bracket");if(b=="&"){var P;return u.eat("#")?u.eat("x")?P=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):P=u.eatWhile(/[\d]/)&&u.eat(";"):P=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),P?"atom":"error"}else return u.eatWhile(/[^&<]/),null}p.isInText=!0;function f(u,y){var m=u.next();if(m==">"||m=="/"&&u.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 b=y.tokenize(u,y);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(m)?(y.tokenize=d(m),y.stringStartCol=u.column(),y.tokenize(u,y)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function d(u){var y=function(m,b){for(;!m.eol();)if(m.next()==u){b.tokenize=f;break}return"string"};return y.isInAttribute=!0,y}function o(u,y){return function(m,b){for(;!m.eol();){if(m.match(y)){b.tokenize=p;break}m.next()}return u}}function c(u){return function(y,m){for(var b;(b=y.next())!=null;){if(b=="<")return m.tokenize=c(u+1),m.tokenize(y,m);if(b==">")if(u==1){m.tokenize=p;break}else return m.tokenize=c(u-1),m.tokenize(y,m)}return"meta"}}function s(u,y,m){this.prev=u.context,this.tagName=y,this.indent=u.indented,this.startOfLine=m,(W.doNotIndent.hasOwnProperty(y)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function a(u){u.context&&(u.context=u.context.prev)}function l(u,y){for(var m;;){if(!u.context)return;if(m=u.context.tagName,!W.contextGrabbers.hasOwnProperty(m)||!W.contextGrabbers[m].hasOwnProperty(y))return;a(u)}}function h(u,y,m){return u=="openTag"?(m.tagStart=y.column(),O):u=="closeTag"?w:h}function O(u,y,m){return u=="word"?(m.tagName=y.current(),g="tag",S):W.allowMissingTagName&&u=="endTag"?(g="tag bracket",S(u,y,m)):(g="error",O)}function w(u,y,m){if(u=="word"){var b=y.current();return m.context&&m.context.tagName!=b&&W.implicitlyClosed.hasOwnProperty(m.context.tagName)&&a(m),m.context&&m.context.tagName==b||W.matchClosing===!1?(g="tag",x):(g="tag error",A)}else return W.allowMissingTagName&&u=="endTag"?(g="tag bracket",x(u,y,m)):(g="error",A)}function x(u,y,m){return u!="endTag"?(g="error",x):(a(m),h)}function A(u,y,m){return g="error",x(u,y,m)}function S(u,y,m){if(u=="word")return g="attribute",T;if(u=="endTag"||u=="selfcloseTag"){var b=m.tagName,P=m.tagStart;return m.tagName=m.tagStart=null,u=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(b)?l(m,b):(l(m,b),m.context=new s(m,b,P==m.indented)),h}return g="error",S}function T(u,y,m){return u=="equals"?E:(W.allowMissing||(g="error"),S(u,y,m))}function E(u,y,m){return u=="string"?_:u=="word"&&W.allowUnquoted?(g="string",S):(g="error",S(u,y,m))}function _(u,y,m){return u=="string"?_:S(u,y,m)}return{startState:function(u){var y={tokenize:p,state:h,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(y.baseIndent=u),y},token:function(u,y){if(!y.tagName&&u.sol()&&(y.indented=u.indentation()),u.eatSpace())return null;R=null;var m=y.tokenize(u,y);return(m||R)&&m!="comment"&&(g=null,y.state=y.state(R||m,u,y),g&&(m=g=="error"?m+" error":g)),m},indent:function(u,y,m){var b=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+M;if(b&&b.noIndent)return ne.Pass;if(u.tokenize!=f&&u.tokenize!=p)return m?m.match(/^(\s*)/)[0].length:0;if(u.tagName)return W.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+M*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(y))return 0;var P=y&&/^<(\/)?([\w_:\.-]*)/.exec(y);if(P&&P[1])for(;b;)if(b.tagName==P[2]){b=b.prev;break}else if(W.implicitlyClosed.hasOwnProperty(b.tagName))b=b.prev;else break;else if(P)for(;b;){var I=W.contextGrabbers[b.tagName];if(I&&I.hasOwnProperty(P[2]))b=b.prev;else break}for(;b&&b.prev&&!b.startOfLine;)b=b.prev;return b?b.indent+M:u.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(u){u.state==E&&(u.state=S)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var y=[],m=u.context;m;m=m.prev)m.tagName&&y.push(m.tagName);return y.reverse()}}}),ne.defineMIME("text/xml","xml"),ne.defineMIME("application/xml","xml"),ne.mimeModes.hasOwnProperty("text/html")||ne.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(at,Ve,te){"use strict";te.d(Ve,"a",function(){return l});var ne=te("Ty5D"),V=te("dI71"),D=te("cDcd"),z=te.n(D),N=te("YS25"),M=te("17x9"),W=te.n(M),B=te("wx14"),k=te("zLVn"),R=te("9R94"),g=function(E){Object(V.a)(_,E);function _(){for(var y,m=arguments.length,b=new Array(m),P=0;P<m;P++)b[P]=arguments[P];return y=E.call.apply(E,[this].concat(b))||this,y.history=Object(N.a)(y.props),y}var u=_.prototype;return u.render=function(){return z.a.createElement(ne.c,{history:this.history,children:this.props.children})},_}(z.a.Component),p=function(E){Object(V.a)(_,E);function _(){for(var y,m=arguments.length,b=new Array(m),P=0;P<m;P++)b[P]=arguments[P];return y=E.call.apply(E,[this].concat(b))||this,y.history=Object(N.b)(y.props),y}var u=_.prototype;return u.render=function(){return z.a.createElement(ne.c,{history:this.history,children:this.props.children})},_}(z.a.Component),f=function(_,u){return typeof _=="function"?_(u):_},d=function(_,u){return typeof _=="string"?Object(N.c)(_,null,null,u):_},o=function(_){return _},c=z.a.forwardRef;typeof c=="undefined"&&(c=o);function s(E){return!!(E.metaKey||E.altKey||E.ctrlKey||E.shiftKey)}var a=c(function(E,_){var u=E.innerRef,y=E.navigate,m=E.onClick,b=Object(k.a)(E,["innerRef","navigate","onClick"]),P=b.target,I=Object(B.a)({},b,{onClick:function(F){try{m&&m(F)}catch(L){throw F.preventDefault(),L}!F.defaultPrevented&&F.button===0&&(!P||P==="_self")&&!s(F)&&(F.preventDefault(),y())}});return o!==c?I.ref=_||u:I.ref=u,z.a.createElement("a",I)}),l=c(function(E,_){var u=E.component,y=u===void 0?a:u,m=E.replace,b=E.to,P=E.innerRef,I=Object(k.a)(E,["component","replace","to","innerRef"]);return z.a.createElement(ne.e.Consumer,null,function(U){U||Object(R.a)(!1);var F=U.history,L=d(f(b,U.location),U.location),v=L?F.createHref(L):"",j=Object(B.a)({},I,{href:v,navigate:function(){var J=f(b,U.location),ee=m?F.replace:F.push;ee(J)}});return o!==c?j.ref=_||P:j.innerRef=P,z.a.createElement(y,j)})});if(!1)var h,O;var w=function(_){return _},x=z.a.forwardRef;typeof x=="undefined"&&(x=w);function A(){for(var E=arguments.length,_=new Array(E),u=0;u<E;u++)_[u]=arguments[u];return _.filter(function(y){return y}).join(" ")}var S=x(function(E,_){var u=E["aria-current"],y=u===void 0?"page":u,m=E.activeClassName,b=m===void 0?"active":m,P=E.activeStyle,I=E.className,U=E.exact,F=E.isActive,L=E.location,v=E.sensitive,j=E.strict,K=E.style,J=E.to,ee=E.innerRef,ve=Object(k.a)(E,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return z.a.createElement(ne.e.Consumer,null,function(de){de||Object(R.a)(!1);var me=L||de.location,ce=d(f(J,me),me),pe=ce.pathname,ae=pe&&pe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),he=ae?Object(ne.f)(me.pathname,{path:ae,exact:U,sensitive:v,strict:j}):null,$=!!(F?F(he,me):he),ie=$?A(I,b):I,q=$?Object(B.a)({},K,{},P):K,Ee=Object(B.a)({"aria-current":$&&y||null,className:ie,style:q,to:ce},ve);return w!==x?Ee.ref=_||ee:Ee.innerRef=ee,z.a.createElement(l,Ee)})});if(!1)var T},"5VLF":function(at,Ve,te){"use strict";var ne,V;function D(z,N,M){var W=function(B,k){return z.js_beautify(B,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}!(ne=[te("6UM0"),te("TXwP"),te("psGv")],V=function(z,N,M){return D(z,N,M)}.apply(Ve,ne),V!==void 0&&(at.exports=V))},"6UM0":function(at,Ve,te){var ne,V;(function(){var D;(function(){"use strict";var N=[function(k,R,g){var p=g(1).Beautifier,f=g(5).Options;function d(o,c){var s=new p(o,c);return s.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),o=g(5).Options,c=g(7).Tokenizer,s=g(7).line_starters,a=g(7).positionable_operators,l=g(7).TOKEN;function h(v,j){return j.indexOf(v)!==-1}function O(v){return v.replace(/^\s+/g,"")}function w(v){for(var j={},K=0;K<v.length;K++)j[v[K].replace(/-/g,"_")]=v[K];return j}function x(v,j){return v&&v.type===l.RESERVED&&v.text===j}function A(v,j){return v&&v.type===l.RESERVED&&h(v.text,j)}var S=["case","return","do","if","throw","else","await","break","continue","async"],T=["before-newline","after-newline","preserve-newline"],E=w(T),_=[E.before_newline,E.preserve_newline],u={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function y(v,j){if(j.multiline_frame||j.mode===u.ForInitializer||j.mode===u.Conditional)return;v.remove_indent(j.start_line_index)}function m(v){v=v.replace(d.allLineBreaks,`
`);for(var j=[],K=v.indexOf(`
`);K!==-1;)j.push(v.substring(0,K)),v=v.substring(K+1),K=v.indexOf(`
`);return v.length&&j.push(v),j}function b(v){return v===u.ArrayLiteral}function P(v){return h(v,[u.Expression,u.ForInitializer,u.Conditional])}function I(v,j){for(var K=0;K<v.length;K++){var J=v[K].trim();if(J.charAt(0)!==j)return!1}return!0}function U(v,j){for(var K=0,J=v.length,ee;K<J;K++)if(ee=v[K],ee&&ee.indexOf(j)!==0)return!1;return!0}function F(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 o(j)}F.prototype.create_flags=function(v,j){var K=0;v&&(K=v.indentation_level,!this._output.just_added_newline()&&v.line_indent_level>K&&(K=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:K,alignment:0,line_indent_level:v?v.line_indent_level:K,start_line_index:this._output.get_line_number(),ternary_depth:0};return J},F.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(u.BlockStatement);var K=new c(v,this._options);return this._tokens=K.tokenize(),v},F.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v,j=this._reset(this._source_text),K=this._options.eol;this._options.eol==="auto"&&(K=`
`,j&&d.lineBreak.test(j||"")&&(K=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(K),v},F.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)},F.prototype.handle_whitespace_and_comments=function(v,j){var K=v.newlines,J=this._options.keep_array_indentation&&b(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 ve=0;ve<K;ve+=1)this.print_newline(ve>0,j);else if(this._options.max_preserve_newlines&&K>this._options.max_preserve_newlines&&(K=this._options.max_preserve_newlines),this._options.preserve_newlines&&K>1){this.print_newline(!1,j);for(var de=1;de<K;de+=1)this.print_newline(!0,j)}};var L=["async","break","continue","return","throw","yield"];F.prototype.allow_wrap_or_preserved_newline=function(v,j){if(j=j===void 0?!1:j,this._output.just_added_newline())return;var K=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,_)||h(v.text,a);K=K&&ee}if(K)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(A(this._flags.last_token,L))return;this._output.set_wrap_point()}},F.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 K=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&x(K,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(v)&&(this._flags.multiline_frame=!0)},F.prototype.print_token_line_indentation=function(v){this._output.just_added_newline()&&(this._options.keep_array_indentation&&v.newlines&&(v.text==="["||b(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))},F.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)},F.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},F.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))},F.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)},F.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===u.Statement&&y(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},F.prototype.start_of_object_property=function(){return this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||A(this._flags.last_token,["get","set"]))},F.prototype.start_of_statement=function(v){var j=!1;return j=j||A(this._flags.last_token,["var","let","const"])&&v.type===l.WORD,j=j||x(this._flags.last_token,"do"),j=j||!(this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement)&&A(this._flags.last_token,L)&&!v.newlines,j=j||x(this._flags.last_token,"else")&&!(x(v,"if")&&!v.comments_before),j=j||this._flags.last_token.type===l.END_EXPR&&(this._previous_flags.mode===u.ForInitializer||this._previous_flags.mode===u.Conditional),j=j||this._flags.last_token.type===l.WORD&&this._flags.mode===u.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===u.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||A(this._flags.last_token,["get","set"])),j?(this.set_mode(u.Statement),this.indent(),this.handle_whitespace_and_comments(v,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v,A(v,["do","for","if","while"])),!0):!1},F.prototype.handle_start_expr=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v);var j=u.Expression;if(v.text==="["){if(this._flags.last_token.type===l.WORD||this._flags.last_token.text===")"){A(this._flags.last_token,s)&&(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=u.ArrayLiteral,b(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=u.ForInitializer):h(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,j=u.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,s)||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 K=this._tokens.peek(-3);if(this._options.space_after_named_function&&K){var J=this._tokens.peek(-4);A(K,["async","function"])||K.text==="*"&&A(J,["async","function"])?this._output.space_before_token=!0:this._flags.mode===u.ObjectLiteral?(K.text==="{"||K.text===","||K.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===u.ObjectLiteral&&h(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===l.START_BLOCK?this.print_newline():(this._flags.last_token.type===l.END_EXPR||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===l.COMMA)&&this.allow_wrap_or_preserved_newline(v,v.newlines),this.print_token(v),this.set_mode(j),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},F.prototype.handle_end_expr=function(v){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(v,v.text==="]"&&b(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===u.Conditional&&(this._previous_flags.mode=u.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},F.prototype.handle_start_block=function(v){this.handle_whitespace_and_comments(v);var j=this._tokens.peek(),K=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===l.END_EXPR?(this.set_mode(u.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(u.BlockStatement):K&&(h(K.text,[":",","])&&h(j.type,[l.STRING,l.WORD,l.RESERVED])||h(j.text,["get","set","..."])&&h(K.type,[l.WORD,l.RESERVED]))?h(this._last_last_text,["class","interface"])&&!h(K.text,[":",","])?this.set_mode(u.BlockStatement):this.set_mode(u.ObjectLiteral):this._flags.last_token.type===l.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(u.BlockStatement):h(this._flags.last_token.type,[l.EQUALS,l.START_EXPR,l.COMMA,l.OPERATOR])||A(this._flags.last_token,["return","throw","import","default"])?this.set_mode(u.ObjectLiteral):this.set_mode(u.BlockStatement),this._flags.last_token&&(A(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 ve=0,de=null;this._flags.inline_frame=!0;do if(ve+=1,de=this._tokens.peek(ve-1),de.newlines){this._flags.inline_frame=!1;break}while(de.type!==l.EOF&&!(de.type===l.END_BLOCK&&de.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||A(this._flags.last_token,S)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(b(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()},F.prototype.handle_end_block=function(v){for(this.handle_whitespace_and_comments(v);this._flags.mode===u.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||(b(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)},F.prototype.handle_word=function(v){if(v.type===l.RESERVED){if(h(v.text,["set","get"])&&this._flags.mode!==u.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===u.ObjectLiteral){var j=this._tokens.peek();j.text===":"&&(v.type=l.WORD)}}if(this.start_of_statement(v)?A(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||!A(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(x(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&&x(v,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===u.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&A(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)),x(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?A(this._flags.last_token,["get","set","new","export"])||A(this._flags.last_token,L)?this._output.space_before_token=!0:x(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)||b(this._flags.mode))||this.print_newline(),this.print_token(v),this._flags.last_word=v.text;return}var K="NONE";if(this._flags.last_token.type===l.END_BLOCK?this._previous_flags.inline_frame?K="SPACE":A(v,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines?K="NEWLINE":(K="SPACE",this._output.space_before_token=!0):K="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&this._flags.mode===u.BlockStatement?K="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&P(this._flags.mode)?K="SPACE":this._flags.last_token.type===l.STRING?K="NEWLINE":this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD||this._flags.last_token.text==="*"&&(h(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&h(this._last_last_text,["{",","]))?K="SPACE":this._flags.last_token.type===l.START_BLOCK?this._flags.inline_frame?K="SPACE":K="NEWLINE":this._flags.last_token.type===l.END_EXPR&&(this._output.space_before_token=!0,K="NEWLINE"),A(v,s)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?K="SPACE":K="NEWLINE"),A(v,["else","catch","finally"]))if((!(this._flags.last_token.type===l.END_BLOCK&&this._previous_flags.mode===u.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&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 K==="NEWLINE"?A(this._flags.last_token,S)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&A(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||!A(v,["var","let","const"]))&&this._flags.last_token.text!==":"&&(x(v,"if")&&x(v.previous,"else")?this._output.space_before_token=!0:this.print_newline()):A(v,s)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&b(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():K==="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&&x(v,"from")&&(this._flags.import_block=!1))},F.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===u.Statement&&!(this._flags.if_block&&x(j,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(v)},F.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)},F.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},F.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===u.ObjectLiteral||this._flags.mode===u.Statement&&this._flags.parent.mode===u.ObjectLiteral?(this._flags.mode===u.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)},F.prototype.handle_operator=function(v){var j=v.text==="*"&&(A(this._flags.last_token,["function","yield"])||h(this._flags.last_token.type,[l.START_BLOCK,l.COMMA,l.END_BLOCK,l.SEMICOLON])),K=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,s)||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,_)&&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,ve=!0,de=!1;if(v.text===":"?this._flags.ternary_depth===0?ee=!1:(this._flags.ternary_depth-=1,de=!0):v.text==="?"&&(this._flags.ternary_depth+=1),!K&&!j&&this._options.preserve_newlines&&h(v.text,a)){var me=v.text===":",ce=me&&de,pe=me&&!de;switch(this._options.operator_position){case E.before_newline:this._output.space_before_token=!pe,this.print_token(v),(!me||ce)&&this.allow_wrap_or_preserved_newline(v),this._output.space_before_token=!0;return;case E.after_newline:this._output.space_before_token=!0,!me||ce?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 E.preserve_newline:pe||this.allow_wrap_or_preserved_newline(v),ee=!(this._output.just_added_newline()||pe),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 ae=this._tokens.peek();ve=ae&&h(ae.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,ve=!1;else if(h(v.text,["--","++","!","~"])||K){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,ve=!1,v.newlines&&(v.text==="--"||v.text==="++"||v.text==="~")){var he=A(this._flags.last_token,S)&&v.newlines;he&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(he,!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,["--","++"])&&(ve=!0)),(this._flags.mode===u.BlockStatement&&!this._flags.inline_frame||this._flags.mode===u.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||ee,this.print_token(v),this._output.space_before_token=ve},F.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)},F.prototype.print_block_commment=function(v,j){var K=m(v.text),J,ee=!1,ve=!1,de=v.whitespace_before,me=de.length;if(this.print_newline(!1,j),this.print_token_line_indentation(v),this._output.add_token(K[0]),this.print_newline(!1,j),K.length>1){for(K=K.slice(1),ee=I(K,"*"),ve=U(K,de),ee&&(this._flags.alignment=1),J=0;J<K.length;J++)ee?(this.print_token_line_indentation(v),this._output.add_token(O(K[J]))):ve&&K[J]?(this.print_token_line_indentation(v),this._output.add_token(K[J].substring(me))):(this._output.current_line.set_indent(-1),this._output.add_token(K[J])),this.print_newline(!1,j);this._flags.alignment=0}},F.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)},F.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),A(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)},F.prototype.handle_unknown=function(v,j){this.print_token(v),v.text[v.text.length-1]===`
`&&this.print_newline(!1,j)},F.prototype.handle_eof=function(v){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v)},k.exports.Beautifier=F},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 o=this.__base_string_length;return d=d||0,f<0&&(o=0),o+=f*this.__indent_size,o+=d,o},g.prototype.get_indent_string=function(f,d){var o=this.__base_string;return d=d||0,f<0&&(f=0,o=""),d+=f*this.__indent_size,this.__ensure_cache(d),o+=this.__cache[d],o},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,o="";this.__indent_size&&f>=this.__indent_size&&(d=Math.floor(f/this.__indent_size),f-=d*this.__indent_size,o=new Array(d+1).join(this.__indent_string)),f&&(o+=new Array(f+1).join(" ")),this.__cache.push(o)};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 o=this.__lines.join(`
`);return f!==`
`&&(o=o.replace(/[\n]/g,f)),o},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 o=this.__lines.length-2;o>=0;){var c=this.__lines[o];if(c.is_empty())break;if(c.item(0).indexOf(f)!==0&&c.item(-1)!==d){this.__lines.splice(o+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},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",o="(?:\\\\u[0-9a-fA-F]{4}|["+g+f+"])",c="(?:\\\\u[0-9a-fA-F]{4}|["+p+f+d+"])*";R.identifier=new RegExp(o+c,"g"),R.identifierStart=new RegExp(o),R.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+f+d+"])+");var s=/[\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(o){p.call(this,o,"js");var c=this.raw_options.brace_style||null;c==="expand-strict"?this.raw_options.brace_style="expand":c==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var s=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<s.length;a++)s[a]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=s[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 o=this.raw_options[f],c=d||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(c=o.concat()):typeof o=="string"&&(c=o.split(/[^a-zA-Z0-9_\/\-]+/)),c},R.prototype._get_boolean=function(f,d){var o=this.raw_options[f],c=o===void 0?!!d:!!o;return c},R.prototype._get_characters=function(f,d){var o=this.raw_options[f],c=d||"";return typeof o=="string"&&(c=o.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),c},R.prototype._get_number=function(f,d){var o=this.raw_options[f];d=parseInt(d,10),isNaN(d)&&(d=0);var c=parseInt(o,10);return isNaN(c)&&(c=d),c},R.prototype._get_selection=function(f,d,o){var c=this._get_selection_list(f,d,o);if(c.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
`+d+`
You passed in: '`+this.raw_options[f]+"'");return c[0]},R.prototype._get_selection_list=function(f,d,o){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[d[0]],!this._is_valid_selection(o,d))throw new Error("Invalid Default Value!");var c=this._get_array(f,o);if(!this._is_valid_selection(c,d))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
`+d+`
You passed in: '`+this.raw_options[f]+"'");return c},R.prototype._is_valid_selection=function(f,d){return f.length&&d.length&&!f.some(function(o){return d.indexOf(o)===-1})};function g(f,d){var o={};f=p(f);var c;for(c in f)c!==d&&(o[c]=f[c]);if(d&&f[d])for(c in f[d])o[c]=f[d][c];return o}function p(f){var d={},o;for(o in f){var c=o.replace(/-/g,"_");d[c]=f[o]}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,o=g(13).Directives,c=g(4),s=g(12).Pattern,a=g(14).TemplatablePattern;function l(I,U){return U.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},O=new o(/\/\*/,/\*\//),w=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,x=/[0-9]/,A=/[^\d\.]/,S=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),T=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";T=T.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),T="\\?\\.(?!\\d) "+T,T=T.replace(/ /g,"|");var E=new RegExp(T),_="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),u=_.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),y=new RegExp("^(?:"+u.join("|")+")$"),m,b=function(I,U){f.call(this,I,U),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var F=new s(this._input),L=new a(this._input).read_options(this._options);this.__patterns={template:L,identifier:L.starting_with(c.identifier).matching(c.identifierMatch),number:F.matching(w),punct:F.matching(E),comment:F.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:F.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:F.matching(/<!--/),html_comment_end:F.matching(/-->/),include:F.starting_with(/#include/).until_after(c.lineBreak),shebang:F.starting_with(/#!/).until_after(c.lineBreak),xml:F.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:L.until(/['\\\n\r\u2028\u2029]/),double_quote:L.until(/["\\\n\r\u2028\u2029]/),template_text:L.until(/[`\\$]/),template_expression:L.until(/[`}\\]/)}};b.prototype=new f,b.prototype._is_comment=function(I){return I.type===h.COMMENT||I.type===h.BLOCK_COMMENT||I.type===h.UNKNOWN},b.prototype._is_opening=function(I){return I.type===h.START_BLOCK||I.type===h.START_EXPR},b.prototype._is_closing=function(I,U){return(I.type===h.END_BLOCK||I.type===h.END_EXPR)&&U&&(I.text==="]"&&U.text==="["||I.text===")"&&U.text==="("||I.text==="}"&&U.text==="{")},b.prototype._reset=function(){m=!1},b.prototype._get_next_token=function(I,U){var F=null;this._readWhitespace();var L=this._input.peek();return L===null?this._create_token(h.EOF,""):(F=F||this._read_non_javascript(L),F=F||this._read_string(L),F=F||this._read_word(I),F=F||this._read_singles(L),F=F||this._read_comment(L),F=F||this._read_regexp(L,I),F=F||this._read_xml(L,I),F=F||this._read_punctuation(),F=F||this._create_token(h.UNKNOWN,this._input.next()),F)},b.prototype._read_word=function(I){var U;if(U=this.__patterns.identifier.read(),U!=="")return U=U.replace(c.allLineBreaks,`
`),!(I.type===h.DOT||I.type===h.RESERVED&&(I.text==="set"||I.text==="get"))&&y.test(U)?(U==="in"||U==="of")&&(I.type===h.WORD||I.type===h.STRING)?this._create_token(h.OPERATOR,U):this._create_token(h.RESERVED,U):this._create_token(h.WORD,U);if(U=this.__patterns.number.read(),U!=="")return this._create_token(h.WORD,U)},b.prototype._read_singles=function(I){var U=null;return I==="("||I==="["?U=this._create_token(h.START_EXPR,I):I===")"||I==="]"?U=this._create_token(h.END_EXPR,I):I==="{"?U=this._create_token(h.START_BLOCK,I):I==="}"?U=this._create_token(h.END_BLOCK,I):I===";"?U=this._create_token(h.SEMICOLON,I):I==="."&&A.test(this._input.peek(1))?U=this._create_token(h.DOT,I):I===","&&(U=this._create_token(h.COMMA,I)),U&&this._input.next(),U},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)},b.prototype._read_non_javascript=function(I){var U="";if(I==="#"){if(this._is_first_token()&&(U=this.__patterns.shebang.read(),U))return this._create_token(h.UNKNOWN,U.trim()+`
`);if(U=this.__patterns.include.read(),U)return this._create_token(h.UNKNOWN,U.trim()+`
`);I=this._input.next();var F="#";if(this._input.hasNext()&&this._input.testChar(x)){do I=this._input.next(),F+=I;while(this._input.hasNext()&&I!=="#"&&I!=="=");return I==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(F+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(F+="{}",this._input.next(),this._input.next())),this._create_token(h.WORD,F)}this._input.back()}else if(I==="<"&&this._is_first_token()){if(U=this.__patterns.html_comment_start.read(),U){for(;this._input.hasNext()&&!this._input.testChar(c.newline);)U+=this._input.next();return m=!0,this._create_token(h.COMMENT,U)}}else if(m&&I==="-"&&(U=this.__patterns.html_comment_end.read(),U))return m=!1,this._create_token(h.COMMENT,U);return null},b.prototype._read_comment=function(I){var U=null;if(I==="/"){var F="";if(this._input.peek(1)==="*"){F=this.__patterns.block_comment.read();var L=O.get_directives(F);L&&L.ignore==="start"&&(F+=O.readIgnored(this._input)),F=F.replace(c.allLineBreaks,`
`),U=this._create_token(h.BLOCK_COMMENT,F),U.directives=L}else this._input.peek(1)==="/"&&(F=this.__patterns.comment.read(),U=this._create_token(h.COMMENT,F))}return U},b.prototype._read_string=function(I){if(I==="`"||I==="'"||I==='"'){var U=this._input.next();return this.has_char_escapes=!1,I==="`"?U+=this._read_string_recursive("`",!0,"${"):U+=this._read_string_recursive(I),this.has_char_escapes&&this._options.unescape_strings&&(U=P(U)),this._input.peek()===I&&(U+=this._input.next()),U=U.replace(c.allLineBreaks,`
`),this._create_token(h.STRING,U)}return null},b.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])},b.prototype._read_regexp=function(I,U){if(I==="/"&&this._allow_regexp_or_xml(U)){for(var F=this._input.next(),L=!1,v=!1;this._input.hasNext()&&(L||v||this._input.peek()!==I)&&!this._input.testChar(c.newline);)F+=this._input.peek(),L?L=!1:(L=this._input.peek()==="\\",this._input.peek()==="["?v=!0:this._input.peek()==="]"&&(v=!1)),this._input.next();return this._input.peek()===I&&(F+=this._input.next(),F+=this._input.read(c.identifier)),this._create_token(h.STRING,F)}return null},b.prototype._read_xml=function(I,U){if(this._options.e4x&&I==="<"&&this._allow_regexp_or_xml(U)){var F="",L=this.__patterns.xml.read_match();if(L){for(var v=L[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),j=v.indexOf("{")===0,K=0;L;){var J=!!L[1],ee=L[2],ve=!!L[L.length-1]||ee.slice(0,8)==="![CDATA[";if(!ve&&(ee===v||j&&ee.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(J?--K:++K),F+=L[0],K<=0)break;L=this.__patterns.xml.read_match()}return L||(F+=this._input.match(/[\s\S]*/g)[0]),F=F.replace(c.allLineBreaks,`
`),this._create_token(h.STRING,F)}}return null};function P(I){for(var U="",F=0,L=new p(I),v=null;L.hasNext();)if(v=L.match(/([\s]|[^\\]|\\\\)+/g),v&&(U+=v[0]),L.peek()==="\\"){if(L.next(),L.peek()==="x")v=L.match(/x([0-9A-Fa-f]{2})/g);else if(L.peek()==="u")v=L.match(/u([0-9A-Fa-f]{4})/g);else{U+="\\",L.hasNext()&&(U+=L.next());continue}if(!v)return I;if(F=parseInt(v[1],16),F>126&&F<=255&&v[0].indexOf("x")===0)return I;if(F>=0&&F<32){U+="\\"+v[0];continue}else F===34||F===39||F===92?U+="\\"+String.fromCharCode(F):U+=String.fromCharCode(F)}return U}b.prototype._read_string_recursive=function(I,U,F){var L,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(),K="";this._input.hasNext();){if(K=this._input.next(),K===I||!U&&c.newline.test(K)){this._input.back();break}else K==="\\"&&this._input.hasNext()?(L=this._input.peek(),L==="x"||L==="u"?this.has_char_escapes=!0:L==="\r"&&this._input.peek(1)===`
`&&this._input.next(),K+=this._input.next()):F&&(F==="${"&&K==="$"&&this._input.peek()==="{"&&(K+=this._input.next()),F===K&&(I==="`"?K+=this._read_string_recursive("}",U,"`"):K+=this._read_string_recursive("`",U,"${"),this._input.hasNext()&&(K+=this._input.next())));K+=v.read(),j+=K}return j},k.exports.Tokenizer=b,k.exports.TOKEN=h,k.exports.positionable_operators=S.slice(),k.exports.line_starters=_.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 o="",c;return p&&(c=this.match(p),c&&(o+=c[0])),f&&(c||!p)&&(o+=this.readUntil(f,d)),o},g.prototype.readUntil=function(p,f){var d="",o=this.__position;p.lastIndex=this.__position;var c=p.exec(this.__input);return c?(o=c.index,f&&(o+=c[0].length)):o=this.__input_length,d=this.__input.substring(this.__position,o),this.__position=o,d},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var d=null,o="g";return f&&R&&(o="y"),typeof p=="string"&&p!==""?d=new RegExp(p,o):p&&(d=new RegExp(p.source,o)),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,o=g(11).WhitespacePattern,c={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},s=function(a,l){this._input=new p(a),this._options=l||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};s.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var a,l=new f(c.START,""),h=null,O=[],w=new d;l.type!==c.EOF;){for(a=this._get_next_token(l,h);this._is_comment(a);)w.add(a),a=this._get_next_token(l,h);w.isEmpty()||(a.comments_before=w,w=new d),a.parent=h,this._is_opening(a)?(O.push(h),h=a):h&&this._is_closing(a,h)&&(a.opened=h,h.closed=a,h=O.pop(),a.parent=h),a.previous=l,l.next=a,this.__tokens.add(a),l=a}return this.__tokens},s.prototype._is_first_token=function(){return this.__tokens.isEmpty()},s.prototype._reset=function(){},s.prototype._get_next_token=function(a,l){this._readWhitespace();var h=this._input.read(/.+/g);return h?this._create_token(c.RAW,h):this._create_token(c.EOF,"")},s.prototype._is_comment=function(a){return!1},s.prototype._is_opening=function(a){return!1},s.prototype._is_closing=function(a,l){return!1},s.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},s.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},k.exports.Tokenizer=s,k.exports.TOKEN=c},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,o){p.call(this,d,o),o?this._line_regexp=this._input.get_regexp(o._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,o){d+="\\t ",o+="\\n\\r",this._match_pattern=this._input.get_regexp("["+d+o+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+o+"]")},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 o=this.__split(this._newline_regexp,d);this.newline_count=o.length-1,this.whitespace_before_token=o[this.newline_count]}return d},f.prototype.matching=function(d,o){var c=this._create();return c.__set_whitespace_patterns(d,o),c._update(),c},f.prototype._create=function(){return new f(this._input,this)},f.prototype.__split=function(d,o){d.lastIndex=0;for(var c=0,s=[],a=d.exec(o);a;)s.push(o.substring(c,a.index)),c=a.index+a[0].length,a=d.exec(o);return c<o.length?s.push(o.substring(c,o.length)):s.push(""),s},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(o,c){p.call(this,o,c),this.__template_pattern=null,this._disabled=Object.assign({},f),this._excluded=Object.assign({},f),c&&(this.__template_pattern=this._input.get_regexp(c.__template_pattern),this._excluded=Object.assign(this._excluded,c._excluded),this._disabled=Object.assign(this._disabled,c._disabled));var s=new p(o);this.__patterns={handlebars_comment:s.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:s.starting_with(/{{{/).until_after(/}}}/),handlebars:s.starting_with(/{{/).until_after(/}}/),php:s.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:s.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:s.starting_with(/{%/).until_after(/%}/),django_value:s.starting_with(/{{/).until_after(/}}/),django_comment:s.starting_with(/{#/).until_after(/#}/),smarty:s.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:s.starting_with(/{\*/).until_after(/\*}/),smarty_literal:s.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(o){var c=this._create();return c._disabled[o]=!0,c._update(),c},d.prototype.read_options=function(o){var c=this._create();for(var s in f)c._disabled[s]=o.templating.indexOf(s)===-1;return c._update(),c},d.prototype.exclude=function(o){var c=this._create();return c._excluded[o]=!0,c._update(),c},d.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 c=this._read_template();c;)this._match_pattern?c+=this._input.read(this._match_pattern):c+=this._input.readUntil(this.__template_pattern),o+=c,c=this._read_template();return this._until_after&&(o+=this._input.readUntilAfter(this._until_pattern)),o},d.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("|")+")")},d.prototype._read_template=function(){var o="",c=this._input.peek();if(c==="<"){var s=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&s==="?"&&(o=o||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&s==="%"&&(o=o||this.__patterns.erb.read())}else c==="{"&&(!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},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 B=W(0);D=B})();var z=D;!(ne=[],V=function(){return{js_beautify:z}}.apply(Ve,ne),V!==void 0&&(at.exports=V))})()},"7Cbv":function(at,Ve,te){"use strict";var ne=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(!ne)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ne(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=[],B=0;B<256;++B)W.push((B+256).toString(16).substr(1));function k(f){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=(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(o))throw TypeError("Stringified UUID is invalid");return o}var R=k;function g(f,d,o){f=f||{};var c=f.random||(f.rng||D)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,d){o=o||0;for(var s=0;s<16;++s)d[o+s]=c[s];return d}return R(c)}var p=Ve.a=g},"7ahc":function(at,Ve,te){"use strict";te.d(Ve,"a",function(){return O});var ne=te("k1fw"),V=te("0Owb"),D=te("+L6B"),z=te("2/Rp"),N=te("y8nQ"),M=te("Vl3Y"),W=te("tJVT"),B=te("OaEy"),k=te("2fM7"),R=te("cDcd"),g=te.n(R),p=te("VrN/"),f=te.n(p),d=te("p77/"),o=te.n(d),c=te("c5Ni"),s=te.n(c),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"]};Ve.b=function(w){var x=w.callback,A=w.onCancel,S=Object(R.useState)("python"),T=Object(W.a)(S,2),E=T[0],_=T[1];function u(m){_(h[m][1])}function y(m){x(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:u},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(O,{mode:E})),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:A},"\u53D6\u6D88")))};function O(w){var x=w.value,A=w.onChange,S=w.mode,T=w.options,E=T===void 0?{}:T,_=Object(R.useRef)(),u=Object(R.useState)(),y=Object(W.a)(u,2),m=y[0],b=y[1];return Object(R.useEffect)(function(){if(m){function P(I){var U=I.getValue();A&&A(U)}return m.on("change",P),function(){m.off("change",P)}}},[m,A]),Object(R.useEffect)(function(){m&&m.setOption("mode",S)},[m,S]),Object(R.useEffect)(function(){m&&((x!==m.getValue()||x==="")&&setTimeout(function(){m.setValue(x||" ")},300))},[m,x]),Object(R.useEffect)(function(){if(_.current&&!m){var P=f.a.fromTextArea(_.current,Object(ne.a)({mode:S,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},E));b(P)}},[_.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:_}))}},"8EBN":function(at,Ve,te){(function(ne){ne(te("VrN/"))})(function(ne){"use strict";ne.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<ne.modeInfo.length;V++){var D=ne.modeInfo[V];D.mimes&&(D.mime=D.mimes[0])}ne.findModeByMIME=function(z){z=z.toLowerCase();for(var N=0;N<ne.modeInfo.length;N++){var M=ne.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 ne.findModeByMIME("application/xml");if(/\+json$/.test(z))return ne.findModeByMIME("application/json")},ne.findModeByExtension=function(z){z=z.toLowerCase();for(var N=0;N<ne.modeInfo.length;N++){var M=ne.modeInfo[N];if(M.ext){for(var W=0;W<M.ext.length;W++)if(M.ext[W]==z)return M}}},ne.findModeByFileName=function(z){for(var N=0;N<ne.modeInfo.length;N++){var M=ne.modeInfo[N];if(M.file&&M.file.test(z))return M}var W=z.lastIndexOf("."),B=W>-1&&z.substring(W+1,z.length);if(B)return ne.findModeByExtension(B)},ne.findModeByName=function(z){z=z.toLowerCase();for(var N=0;N<ne.modeInfo.length;N++){var M=ne.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(at,Ve,te){at.exports={button:"button___1wy9m"}},"9Bee":function(at,Ve,te){"use strict";var ne=te("DYRE"),V=te("zeV3"),D=te("+L6B"),z=te("2/Rp"),N=te("k1fw"),M=te("tJVT"),W=te("cDcd"),B=te.n(W),k=te("vg9a"),R=te("DlQD"),g=te.n(R),p=te("rUJ1");function f(me,ce){var pe=me.match(/^(\s+)(?:```)/);if(pe===null)return ce;var ae=pe[1];return ce.split(`
`).map(function(he){var $=he.match(/^\s+/);if($===null)return he;var ie=Object(M.a)($,1),q=ie[0];return q.length>=ae.length?he.slice(ae.length):he}).join(`
`)}var d=[],o=["<ul>"],c=new g.a.Renderer,s=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function a(){d.length=0,o=["<ul>"]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function h(me,ce,pe,ae){if(ce>=me.length||me[ce].level<=pe)return ce;var he=me[ce];ae.push("<li><a href='#"+he.anchor+"'>"+he.text+"</a>"),ce++;var $=[];return ce=h(me,ce,he.level,$),$.length>0&&(ae.push("<ul>"),$.forEach(function(ie){ae.push(ie)}),ae.push("</ul>")),ae.push("</li>"),ce=h(me,ce,pe,ae),ce}function O(){return h(d,0,0,o),o.push("</ul>"),o.join("")}var w={heading:function(ce){var pe=s.exec(ce);if(pe)return{type:"heading",raw:pe[0],depth:pe[1].length,text:pe[2]}},fences:function(ce){var pe=this.rules.block.fences.exec(ce);if(pe){var ae=pe[0],he=f(ae,pe[3]||""),$=pe[2]?pe[2].trim():pe[2];if(["latex","katex","math"].indexOf($)>=0){var ie=S(),q=he;he=ie,T[ie]={type:"block",expression:q}}return{type:"code",raw:ae,lang:$,text:he}}}},x=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,S=function(){return"__special_katext_id_".concat(A++,"__")},T={};function E(){return T}function _(){A=0,T={}}function u(me){return me=me.replace(x,function(ce,pe){var ae=S();return T[ae]={type:"inline",expression:pe},ae}),me}var y=c.listitem;c.listitem=function(me){return y(u(me))};var m=c.paragraph;c.paragraph=function(me){return m(u(me))};var b=c.tablecell;c.tablecell=function(me,ce){return b(u(me),ce)},c.code=function(me,ce,pe){var ae=(ce||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(me,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(ce,'">').concat(pe?me:Object(p.escape)(me,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(pe?me:Object(p.escape)(me,!0))+"</code></pre>"},c.heading=function(me,ce,pe){var ae=this.options.headerPrefix+pe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:ae,level:ce,text:me}),"<h"+ce+' id="'+ae+'">'+me+"</h"+ce+">"},g.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),g.a.use({tokenizer:w,renderer:c});var P=g.a,I=te("SJMd"),U=te("ulZh"),F=te.n(U),L=te("m3rI"),v=te("Oy/b"),j=te("p5ED"),K=te("8hTe"),J=te.n(K),ee=/<pre[^>]*>/g;function ve(me){var ce=document.createElement("div");return ce.innerHTML=me,ce.childNodes.length===0?"":ce.childNodes[0].nodeValue}var de=Ve.a=function(me){var ce=me.value,pe=ce===void 0?"":ce,ae=me.edit,he=ae===void 0?!1:ae,$=me.className,ie=me.showTextOnly,q=me.showLines,Ee=me.replaces,Ae=me.zoomImg,ye=me.hasMask,we=me.style,Re=we===void 0?{}:we,ke=me.stylesPrev,Ne=ke===void 0?{}:ke,Ie=String(pe),Le=Object(W.useRef)(),Ye=Object(W.useRef)(),Qe=Object(W.useState)(""),Xe=Object(M.a)(Qe,2),We=Xe[0],Je=Xe[1],je=Object(W.useState)("office"),He=Object(M.a)(je,2),Se=He[0],qe=He[1],Ke=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;Ie=Ie.replace(fe,"("+L.a.API_SERVER+"/api/attachments/").replace(Q,'"'+L.a.API_SERVER+"/api/attachments/").replace(Z,'"'+L.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(Oe){}var re=P(Ie),oe=E();if(Ie.match(/\[TOC\]/)&&(re=re.replace("<p>[TOC]</p>",O()),a()),re=re.replace(/(__special_katext_id_\d+__)/g,function(Oe,De){var $e=oe[De],tt=$e.type,nt=$e.expression;return Object(v.renderToString)(ve(nt)||"",{displayMode:tt==="block",throwOnError:!1,output:"html"})}),re=re.replace(/▁/g,"\u2581\u2581\u2581"),_(),ie){var ge=document.createElement("div");return ge.innerHTML=re,ge.innerText}return setTimeout(function(){return _e()},500),re},[Ie]),xe=Object(W.useRef)();l.WebkitLineClamp=q,q&&(Re=Object(N.a)(Object(N.a)({},Re),l));function Pe(fe){var Q=fe.target;if(Q.tagName.toUpperCase()==="IMG"){if(Ae){var Z=Q.getAttribute("src");Je(Z),qe("image")}}else if(Q.tagName.toUpperCase()==="A"){var re=Q.getAttribute("href");if(re.indexOf("office")>-1)fe.preventDefault(),Je(re),qe("office");else if(re.indexOf("application/pdf")>-1)fe.preventDefault(),Je(re),qe("pdf");else if(re.indexOf("text/html")>-1)fe.preventDefault(),Je(re),qe("html");else if(re.startsWith("#")){fe.preventDefault();var oe=document.getElementById(re.replace("#",""));oe&&oe.scrollIntoView(!0)}}}var _e=function(){var Q,Z=(Q=xe.current)===null||Q===void 0?void 0:Q.querySelectorAll("video");Z==null||Z.forEach(function(re){if(re.oncontextmenu=function(){return!1},re.src.indexOf(".m3u8")>-1&&!re.canPlayType("application/vnd.apple.mpegurl")){if(F.a.isSupported()){var oe=new F.a;oe.loadSource(re.src),oe.attachMedia(re)}}})};Object(W.useEffect)(function(){if(xe.current&&Ke&&(Ke.match(ee)&&window.PR.prettyPrint()),xe.current)return xe.current.addEventListener("click",Pe),function(){xe.current.removeEventListener("click",Pe),_(),a()}},[Ke,xe.current,Pe]);var le=function(Q){if(!he)return;Q.target.nodeName==="IMG"?(Le.current.style.display="flex",Le.current.style.width=Q.target.clientWidth+"px",Le.current.style.height=Q.target.clientHeight+"px",Le.current.style.top=Q.target.offsetTop+"px",Le.current.style.left=Q.target.offsetLeft+"px",Ye.current.src=Q.target.getAttribute("src")):Le.current.style.display="none"};return B.a.createElement("div",{style:{position:"relative"}},B.a.createElement("div",{ref:xe,style:Object(N.a)({},Re),className:"".concat($||""," markdown-body ").concat(J.a.mdBody),onMouseOver:le,dangerouslySetInnerHTML:{__html:Ke}}),B.a.createElement("div",{ref:Le,className:J.a.button},B.a.createElement(V.a,null,B.a.createElement(z.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),B.a.createElement(z.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),B.a.createElement("img",{ref:Ye,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),B.a.createElement(j.a,{close:!0,data:We,type:We!=null&&We.length?Se:"",style:Object(N.a)({},Ne),onClose:function(){return Je("")}}))}},"9VGf":function(at,Ve,te){"use strict";te.d(Ve,"a",function(){return D});var ne=te("cDcd"),V=te.n(ne);function D(z,N){var M=Object(ne.useRef)();Object(ne.useEffect)(function(){M.current=z}),Object(ne.useEffect)(function(){function W(){M.current()}if(N!==null){var B=setInterval(W,N);return function(){return clearInterval(B)}}},[N])}},BU3w:function(at,Ve,te){"use strict";te.d(Ve,"a",function(){return M});var ne=te("MNnm"),V="rc-util-key";function D(W){if(W.attachTo)return W.attachTo;var B=document.querySelector("head");return B||document.body}function z(W){var B,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ne.a)())return null;var R=document.createElement("style");if((B=k.csp)===null||B===void 0?void 0:B.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,B){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]===B});if(f){var d,o;if(((d=k.csp)===null||d===void 0?void 0:d.nonce)&&f.nonce!==((o=k.csp)===null||o===void 0?void 0:o.nonce)){var c;f.nonce=(c=k.csp)===null||c===void 0?void 0:c.nonce}return f.innerHTML!==W&&(f.innerHTML=W),f}var s=z(W,k);return s[V]=B,s}},Bd2K:function(at,Ve,te){(function(ne){ne(te("VrN/"),te("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(k,R,g){if(g!=ne.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 ne.Pass;for(var R=k.listSelections(),g=[],p=k.getOption("autoCloseTags"),f=0;f<R.length;f++){if(!R[f].empty())return ne.Pass;var d=R[f].head,o=k.getTokenAt(d),c=ne.innerMode(k.getMode(),o.state),s=c.state,a=c.mode.xmlCurrentTag&&c.mode.xmlCurrentTag(s),l=a&&a.name;if(!l)return ne.Pass;var h=c.mode.configuration=="html",O=typeof p=="object"&&p.dontCloseTags||h&&V,w=typeof p=="object"&&p.indentTags||h&&D;o.end>d.ch&&(l=l.slice(0,l.length-o.end+d.ch));var x=l.toLowerCase();if(!l||o.type=="string"&&(o.end!=d.ch||!/[\"\']/.test(o.string.charAt(o.string.length-1))||o.string.length==1)||o.type=="tag"&&a.close||o.string.indexOf("/")==d.ch-o.start-1||O&&W(O,x)>-1||B(k,c.mode.xmlCurrentContext&&c.mode.xmlCurrentContext(s)||[],l,d,!0))return ne.Pass;var A=typeof p=="object"&&p.emptyTags;if(A&&W(A,l)>-1){g[f]={text:"/>",newPos:ne.Pos(d.line,d.ch+2)};continue}var S=w&&W(w,x)>-1;g[f]={indent:S,text:">"+(S?`
`:"")+"</"+l+">",newPos:S?ne.Pos(d.line+1,0):ne.Pos(d.line,d.ch+1)}}for(var T=typeof p=="object"&&p.dontIndentOnAutoClose,f=R.length-1;f>=0;f--){var E=g[f];k.replaceRange(E.text,R[f].head,R[f].anchor,"+insert");var _=k.listSelections().slice(0);_[f]={head:E.newPos,anchor:E.newPos},k.setSelections(_),!T&&E.indent&&(k.indentLine(E.newPos.line,null,!0),k.indentLine(E.newPos.line+1,null,!0))}}function N(k,R){for(var g=k.listSelections(),p=[],f=R?"/":"</",d=k.getOption("autoCloseTags"),o=typeof d=="object"&&d.dontIndentOnSlash,c=0;c<g.length;c++){if(!g[c].empty())return ne.Pass;var s=g[c].head,a=k.getTokenAt(s),l=ne.innerMode(k.getMode(),a.state),h=l.state;if(R&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=s.ch-1))return ne.Pass;var O,w=l.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(w&&l.mode.name=="javascript")O=f+"script";else if(w&&l.mode.name=="css")O=f+"style";else{var x=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(h);if(!x||x.length&&B(k,x,x[x.length-1],s))return ne.Pass;O=f+x[x.length-1]}k.getLine(s.line).charAt(a.end)!=">"&&(O+=">"),p[c]=O}if(k.replaceSelections(p),g=k.listSelections(),!o)for(var c=0;c<g.length;c++)(c==g.length-1||g[c].head.line<g[c+1].head.line)&&k.indentLine(g[c].head.line)}function M(k){return k.getOption("disableInput")?ne.Pass:N(k,!0)}ne.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 B(k,R,g,p,f){if(!ne.scanForClosingTag)return!1;var d=Math.min(k.lastLine()+1,p.line+500),o=ne.scanForClosingTag(k,p,null,d);if(!o||o.tag!=g)return!1;for(var c=f?1:0,s=R.length-1;s>=0&&R[s]==g;s--)++c;p=o.to;for(var s=1;s<c;s++){var a=ne.scanForClosingTag(k,p,null,d);if(!a||a.tag!=g)return!1;p=a.to}return!0}})},BjJ7:function(at,Ve,te){"use strict";te.d(Ve,"d",function(){return V}),te.d(Ve,"c",function(){return D}),te.d(Ve,"e",function(){return z}),te.d(Ve,"b",function(){return N}),te.d(Ve,"a",function(){return W});var ne=te("m3rI");function V(B){var k=!0;if(B.length>0){for(var R=0;R<B.length;R++)if(B[R].compile_success==0||!B[R].compile_success){k=!1;break}}else k=!1;return k}function D(B){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],g=0;g<B.length;g++){var p=B[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(B,k,R){for(var g=0;g<B.length;g++){var p=B[g];if(p.key===k){p.children=R;break}p.children&&z(p.children,k,R)}return B}function N(B,k,R){var g;return function(){var p=this,f=arguments,d=function(){g=null,R||B.apply(p,f)},o=R&&!g;clearTimeout(g),g=setTimeout(d,k),o&&B.apply(p,f)}}var M=!0,W=ne.a.API_SERVER},"C+DQ":function(at,Ve,te){},DlQD:function(at,Ve,te){(function(ne,V){at.exports=V()})(this,function(){"use strict";function ne(_e,le){for(var fe=0;fe<le.length;fe++){var Q=le[fe];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(_e,Q.key,Q)}}function V(_e,le,fe){return le&&ne(_e.prototype,le),fe&&ne(_e,fe),_e}function D(_e,le){if(!_e)return;if(typeof _e=="string")return z(_e,le);var fe=Object.prototype.toString.call(_e).slice(8,-1);if(fe==="Object"&&_e.constructor&&(fe=_e.constructor.name),fe==="Map"||fe==="Set")return Array.from(_e);if(fe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(fe))return z(_e,le)}function z(_e,le){(le==null||le>_e.length)&&(le=_e.length);for(var fe=0,Q=new Array(le);fe<le;fe++)Q[fe]=_e[fe];return Q}function N(_e,le){var fe;if(typeof Symbol=="undefined"||_e[Symbol.iterator]==null){if(Array.isArray(_e)||(fe=D(_e))||le&&_e&&typeof _e.length=="number"){fe&&(_e=fe);var Q=0;return function(){return Q>=_e.length?{done:!0}:{done:!1,value:_e[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=_e[Symbol.iterator](),fe.next.bind(fe)}function M(_e,le){return le={exports:{}},_e(le,le.exports),le.exports}var W=M(function(_e){function le(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function fe(Q){_e.exports.defaults=Q}_e.exports={defaults:le(),getDefaults:le,changeDefaults:fe}}),B=W.defaults,k=W.getDefaults,R=W.changeDefaults,g=/[&<>"']/,p=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,d=/[<>"']|&(?!#?\w+;)/g,o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},c=function(le){return o[le]};function s(_e,le){if(le){if(g.test(_e))return _e.replace(p,c)}else if(f.test(_e))return _e.replace(d,c);return _e}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(_e){return _e.replace(a,function(le,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 O(_e,le){_e=_e.source||_e,le=le||"";var fe={replace:function(Z,re){return re=re.source||re,re=re.replace(h,"$1"),_e=_e.replace(Z,re),fe},getRegex:function(){return new RegExp(_e,le)}};return fe}var w=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(_e,le,fe){if(_e){var Q;try{Q=decodeURIComponent(l(fe)).replace(w,"").toLowerCase()}catch(Z){return null}if(Q.indexOf("javascript:")===0||Q.indexOf("vbscript:")===0||Q.indexOf("data:")===0)return null}le&&!x.test(fe)&&(fe=u(le,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch(Z){return null}return fe}var S={},T=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,_=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(_e,le){S[" "+_e]||(T.test(_e)?S[" "+_e]=_e+"/":S[" "+_e]=P(_e,"/",!0)),_e=S[" "+_e];var fe=_e.indexOf(":")===-1;return le.substring(0,2)==="//"?fe?le:_e.replace(E,"$1")+le:le.charAt(0)==="/"?fe?le:_e.replace(_,"$1")+le:_e+le}var y={exec:function(){}};function m(_e){for(var le=1,fe,Q;le<arguments.length;le++){fe=arguments[le];for(Q in fe)Object.prototype.hasOwnProperty.call(fe,Q)&&(_e[Q]=fe[Q])}return _e}function b(_e,le){var fe=_e.replace(/\|/g,function(re,oe,ge){for(var Oe=!1,De=oe;--De>=0&&ge[De]==="\\";)Oe=!Oe;return Oe?"|":" |"}),Q=fe.split(/ \|/),Z=0;if(Q.length>le)Q.splice(le);else for(;Q.length<le;)Q.push("");for(;Z<Q.length;Z++)Q[Z]=Q[Z].trim().replace(/\\\|/g,"|");return Q}function P(_e,le,fe){var Q=_e.length;if(Q===0)return"";for(var Z=0;Z<Q;){var re=_e.charAt(Q-Z-1);if(re===le&&!fe)Z++;else if(re!==le&&fe)Z++;else break}return _e.substr(0,Q-Z)}function I(_e,le){if(_e.indexOf(le[1])===-1)return-1;for(var fe=_e.length,Q=0,Z=0;Z<fe;Z++)if(_e[Z]==="\\")Z++;else if(_e[Z]===le[0])Q++;else if(_e[Z]===le[1]&&(Q--,Q<0))return Z;return-1}function U(_e){_e&&_e.sanitize&&!_e.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 F={escape:s,unescape:l,edit:O,cleanUrl:A,resolveUrl:u,noopTest:y,merge:m,splitCells:b,rtrim:P,findClosingBracket:I,checkSanitizeDeprecation:U},L=W.defaults,v=F.rtrim,j=F.splitCells,K=F.escape,J=F.findClosingBracket;function ee(_e,le,fe){var Q=le.href,Z=le.title?K(le.title):null,re=_e[1].replace(/\\([\[\]])/g,"$1");return _e[0].charAt(0)!=="!"?{type:"link",raw:fe,href:Q,title:Z,text:re}:{type:"image",raw:fe,href:Q,title:Z,text:K(re)}}function ve(_e,le){var fe=_e.match(/^(\s+)(?:```)/);if(fe===null)return le;var Q=fe[1];return le.split(`
`).map(function(Z){var re=Z.match(/^\s+/);if(re===null)return Z;var oe=re[0];return oe.length>=Q.length?Z.slice(Q.length):Z}).join(`
`)}var de=function(){function _e(fe){this.options=fe||L}var le=_e.prototype;return le.space=function(Q){var Z=this.rules.block.newline.exec(Q);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:`
`}},le.code=function(Q,Z){var re=this.rules.block.code.exec(Q);if(re){var oe=Z[Z.length-1];if(oe&&oe.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var ge=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?ge:v(ge,`
`)}}},le.fences=function(Q){var Z=this.rules.block.fences.exec(Q);if(Z){var re=Z[0],oe=ve(re,Z[3]||"");return{type:"code",raw:re,lang:Z[2]?Z[2].trim():Z[2],text:oe}}},le.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]}},le.nptable=function(Q){var Z=this.rules.block.nptable.exec(Q);if(Z){var re={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(re.header.length===re.align.length){var oe=re.align.length,ge;for(ge=0;ge<oe;ge++)/^ *-+: *$/.test(re.align[ge])?re.align[ge]="right":/^ *:-+: *$/.test(re.align[ge])?re.align[ge]="center":/^ *:-+ *$/.test(re.align[ge])?re.align[ge]="left":re.align[ge]=null;for(oe=re.cells.length,ge=0;ge<oe;ge++)re.cells[ge]=j(re.cells[ge],re.header.length);return re}}},le.hr=function(Q){var Z=this.rules.block.hr.exec(Q);if(Z)return{type:"hr",raw:Z[0]}},le.blockquote=function(Q){var Z=this.rules.block.blockquote.exec(Q);if(Z){var re=Z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Z[0],text:re}}},le.list=function(Q){var Z=this.rules.block.list.exec(Q);if(Z){for(var re=Z[0],oe=Z[2],ge=oe.length>1,Oe=oe[oe.length-1]===")",De={type:"list",raw:re,ordered:ge,start:ge?+oe.slice(0,-1):"",loose:!1,items:[]},$e=Z[0].match(this.rules.block.item),tt=!1,nt,Et,ct,st,Ot,Tt,Bt,Mt=$e.length,yt=0;yt<Mt;yt++)nt=$e[yt],re=nt,Et=nt.length,nt=nt.replace(/^ *([*+-]|\d+[.)]) */,""),~nt.indexOf(`
`)&&(Et-=nt.length,nt=this.options.pedantic?nt.replace(/^ {1,4}/gm,""):nt.replace(new RegExp("^ {1,"+Et+"}","gm"),"")),yt!==Mt-1&&(ct=this.rules.block.bullet.exec($e[yt+1])[0],(ge?ct.length===1||!Oe&&ct[ct.length-1]===")":ct.length>1||this.options.smartLists&&ct!==oe)&&(st=$e.slice(yt+1).join(`
`),De.raw=De.raw.substring(0,De.raw.length-st.length),yt=Mt-1)),Ot=tt||/\n\n(?!\s*$)/.test(nt),yt!==Mt-1&&(tt=nt.charAt(nt.length-1)===`
`,Ot||(Ot=tt)),Ot&&(De.loose=!0),Tt=/^\[[ xX]\] /.test(nt),Bt=void 0,Tt&&(Bt=nt[1]!==" ",nt=nt.replace(/^\[[ xX]\] +/,"")),De.items.push({type:"list_item",raw:re,task:Tt,checked:Bt,loose:Ot,text:nt});return De}},le.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]):K(Z[0]):Z[0]}},le.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 re=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:Z[0],href:Z[2],title:Z[3]}}},le.table=function(Q){var Z=this.rules.block.table.exec(Q);if(Z){var re={type:"table",header:j(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
`):[]};if(re.header.length===re.align.length){re.raw=Z[0];var oe=re.align.length,ge;for(ge=0;ge<oe;ge++)/^ *-+: *$/.test(re.align[ge])?re.align[ge]="right":/^ *:-+: *$/.test(re.align[ge])?re.align[ge]="center":/^ *:-+ *$/.test(re.align[ge])?re.align[ge]="left":re.align[ge]=null;for(oe=re.cells.length,ge=0;ge<oe;ge++)re.cells[ge]=j(re.cells[ge].replace(/^ *\| *| *\| *$/g,""),re.header.length);return re}}},le.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]}},le.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]}},le.text=function(Q,Z){var re=this.rules.block.text.exec(Q);if(re){var oe=Z[Z.length-1];return oe&&oe.type==="text"?{raw:re[0],text:re[0]}:{type:"text",raw:re[0],text:re[0]}}},le.escape=function(Q){var Z=this.rules.inline.escape.exec(Q);if(Z)return{type:"escape",raw:Z[0],text:K(Z[1])}},le.tag=function(Q,Z,re){var oe=this.rules.inline.tag.exec(Q);if(oe)return!Z&&/^<a /i.test(oe[0])?Z=!0:Z&&/^<\/a>/i.test(oe[0])&&(Z=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(oe[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(oe[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:oe[0],inLink:Z,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):K(oe[0]):oe[0]}},le.link=function(Q){var Z=this.rules.inline.link.exec(Q);if(Z){var re=J(Z[2],"()");if(re>-1){var oe=Z[0].indexOf("!")===0?5:4,ge=oe+Z[1].length+re;Z[2]=Z[2].substring(0,re),Z[0]=Z[0].substring(0,ge).trim(),Z[3]=""}var Oe=Z[2],De="";if(this.options.pedantic){var $e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Oe);$e?(Oe=$e[1],De=$e[3]):De=""}else De=Z[3]?Z[3].slice(1,-1):"";Oe=Oe.trim().replace(/^<([\s\S]*)>$/,"$1");var tt=ee(Z,{href:Oe&&Oe.replace(this.rules.inline._escapes,"$1"),title:De&&De.replace(this.rules.inline._escapes,"$1")},Z[0]);return tt}},le.reflink=function(Q,Z){var re;if((re=this.rules.inline.reflink.exec(Q))||(re=this.rules.inline.nolink.exec(Q))){var oe=(re[2]||re[1]).replace(/\s+/g," ");if(oe=Z[oe.toLowerCase()],!oe||!oe.href){var ge=re[0].charAt(0);return{type:"text",raw:ge,text:ge}}var Oe=ee(re,oe,re[0]);return Oe}},le.strong=function(Q,Z,re){re===void 0&&(re="");var oe=this.rules.inline.strong.start.exec(Q);if(oe&&(!oe[1]||oe[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){Z=Z.slice(-1*Q.length);var ge=oe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ge.lastIndex=0;for(var Oe;(oe=ge.exec(Z))!=null;)if(Oe=this.rules.inline.strong.middle.exec(Z.slice(0,oe.index+3)),Oe)return{type:"strong",raw:Q.slice(0,Oe[0].length),text:Q.slice(2,Oe[0].length-2)}}},le.em=function(Q,Z,re){re===void 0&&(re="");var oe=this.rules.inline.em.start.exec(Q);if(oe&&(!oe[1]||oe[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){Z=Z.slice(-1*Q.length);var ge=oe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ge.lastIndex=0;for(var Oe;(oe=ge.exec(Z))!=null;)if(Oe=this.rules.inline.em.middle.exec(Z.slice(0,oe.index+2)),Oe)return{type:"em",raw:Q.slice(0,Oe[0].length),text:Q.slice(1,Oe[0].length-1)}}},le.codespan=function(Q){var Z=this.rules.inline.code.exec(Q);if(Z){var re=Z[2].replace(/\n/g," "),oe=/[^ ]/.test(re),ge=re.startsWith(" ")&&re.endsWith(" ");return oe&&ge&&(re=re.substring(1,re.length-1)),re=K(re,!0),{type:"codespan",raw:Z[0],text:re}}},le.br=function(Q){var Z=this.rules.inline.br.exec(Q);if(Z)return{type:"br",raw:Z[0]}},le.del=function(Q){var Z=this.rules.inline.del.exec(Q);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},le.autolink=function(Q,Z){var re=this.rules.inline.autolink.exec(Q);if(re){var oe,ge;return re[2]==="@"?(oe=K(this.options.mangle?Z(re[1]):re[1]),ge="mailto:"+oe):(oe=K(re[1]),ge=oe),{type:"link",raw:re[0],text:oe,href:ge,tokens:[{type:"text",raw:oe,text:oe}]}}},le.url=function(Q,Z){var re;if(re=this.rules.inline.url.exec(Q)){var oe,ge;if(re[2]==="@")oe=K(this.options.mangle?Z(re[0]):re[0]),ge="mailto:"+oe;else{var Oe;do Oe=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(Oe!==re[0]);oe=K(re[0]),re[1]==="www."?ge="http://"+oe:ge=oe}return{type:"link",raw:re[0],text:oe,href:ge,tokens:[{type:"text",raw:oe,text:oe}]}}},le.inlineText=function(Q,Z,re){var oe=this.rules.inline.text.exec(Q);if(oe){var ge;return Z?ge=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):K(oe[0]):oe[0]:ge=K(this.options.smartypants?re(oe[0]):oe[0]),{type:"text",raw:oe[0],text:ge}}},_e}(),me=F.noopTest,ce=F.edit,pe=F.merge,ae={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:me,table:me,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ae._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ae._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ae.def=ce(ae.def).replace("label",ae._label).replace("title",ae._title).getRegex(),ae.bullet=/(?:[*+-]|\d{1,9}[.)])/,ae.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ae.item=ce(ae.item,"gm").replace(/bull/g,ae.bullet).getRegex(),ae.list=ce(ae.list).replace(/bull/g,ae.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ae.def.source+")").getRegex(),ae._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ae._comment=/<!--(?!-?>)[\s\S]*?-->/,ae.html=ce(ae.html,"i").replace("comment",ae._comment).replace("tag",ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae.paragraph=ce(ae._paragraph).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.blockquote=ce(ae.blockquote).replace("paragraph",ae.paragraph).getRegex(),ae.normal=pe({},ae),ae.gfm=pe({},ae.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ae.gfm.nptable=ce(ae.gfm.nptable).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.gfm.table=ce(ae.gfm.table).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.pedantic=pe({},ae.normal,{html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:me,paragraph:ce(ae.normal._paragraph).replace("hr",ae.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ae.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var he={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:me,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:me,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};he._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",he.punctuation=ce(he.punctuation).replace(/punctuation/g,he._punctuation).getRegex(),he._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",he._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",he.em.start=ce(he.em.start).replace(/punctuation/g,he._punctuation).getRegex(),he.em.middle=ce(he.em.middle).replace(/punctuation/g,he._punctuation).replace(/overlapSkip/g,he._overlapSkip).getRegex(),he.em.endAst=ce(he.em.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.em.endUnd=ce(he.em.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.start=ce(he.strong.start).replace(/punctuation/g,he._punctuation).getRegex(),he.strong.middle=ce(he.strong.middle).replace(/punctuation/g,he._punctuation).replace(/blockSkip/g,he._blockSkip).getRegex(),he.strong.endAst=ce(he.strong.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.endUnd=ce(he.strong.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.blockSkip=ce(he._blockSkip,"g").getRegex(),he.overlapSkip=ce(he._overlapSkip,"g").getRegex(),he._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,he._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,he._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,he.autolink=ce(he.autolink).replace("scheme",he._scheme).replace("email",he._email).getRegex(),he._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,he.tag=ce(he.tag).replace("comment",ae._comment).replace("attribute",he._attribute).getRegex(),he._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,he._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,he._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,he.link=ce(he.link).replace("label",he._label).replace("href",he._href).replace("title",he._title).getRegex(),he.reflink=ce(he.reflink).replace("label",he._label).getRegex(),he.reflinkSearch=ce(he.reflinkSearch,"g").replace("reflink",he.reflink).replace("nolink",he.nolink).getRegex(),he.normal=pe({},he),he.pedantic=pe({},he.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ce(/^!?\[(label)\]\((.*?)\)/).replace("label",he._label).getRegex(),reflink:ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he._label).getRegex()}),he.gfm=pe({},he.normal,{escape:ce(he.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),he.gfm.url=ce(he.gfm.url,"i").replace("email",he.gfm._extended_email).getRegex(),he.breaks=pe({},he.gfm,{br:ce(he.br).replace("{2,}","*").getRegex(),text:ce(he.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $={block:ae,inline:he},ie=W.defaults,q=$.block,Ee=$.inline;function Ae(_e){return _e.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 ye(_e){var le="",fe,Q,Z=_e.length;for(fe=0;fe<Z;fe++)Q=_e.charCodeAt(fe),Math.random()>.5&&(Q="x"+Q.toString(16)),le+="&#"+Q+";";return le}var we=function(){function _e(fe){this.tokens=[],this.tokens.links=Object.create(null),this.options=fe||ie,this.options.tokenizer=this.options.tokenizer||new de,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Q={block:q.normal,inline:Ee.normal};this.options.pedantic?(Q.block=q.pedantic,Q.inline=Ee.pedantic):this.options.gfm&&(Q.block=q.gfm,this.options.breaks?Q.inline=Ee.breaks:Q.inline=Ee.gfm),this.tokenizer.rules=Q}_e.lex=function(Q,Z){var re=new _e(Z);return re.lex(Q)};var le=_e.prototype;return le.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},le.blockTokens=function(Q,Z,re){Z===void 0&&(Z=[]),re===void 0&&(re=!0),Q=Q.replace(/^ +$/gm,"");for(var oe,ge,Oe,De;Q;){if(oe=this.tokenizer.space(Q)){Q=Q.substring(oe.raw.length),oe.type&&Z.push(oe);continue}if(oe=this.tokenizer.code(Q,Z)){Q=Q.substring(oe.raw.length),oe.type?Z.push(oe):(De=Z[Z.length-1],De.raw+=`
`+oe.raw,De.text+=`
`+oe.text);continue}if(oe=this.tokenizer.fences(Q)){Q=Q.substring(oe.raw.length),Z.push(oe);continue}if(oe=this.tokenizer.heading(Q)){Q=Q.substring(oe.raw.length),Z.push(oe);continue}if(oe=this.tokenizer.nptable(Q)){Q=Q.substring(oe.raw.length),Z.push(oe);continue}if(oe=this.tokenizer.hr(Q)){Q=Q.substring(oe.raw.length),Z.push(oe);continue}if(oe=this.tokenizer.blockquote(Q)){Q=Q.substring(oe.raw.length),oe.tokens=this.blockTokens(oe.text,[],re),Z.push(oe);continue}if(oe=this.tokenizer.list(Q)){for(Q=Q.substring(oe.raw.length),Oe=oe.items.length,ge=0;ge<Oe;ge++)oe.items[ge].tokens=this.blockTokens(oe.items[ge].text,[],!1);Z.push(oe);continue}if(oe=this.tokenizer.html(Q)){Q=Q.substring(oe.raw.length),Z.push(oe);continue}if(re&&(oe=this.tokenizer.def(Q))){Q=Q.substring(oe.raw.length),this.tokens.links[oe.tag]||(this.tokens.links[oe.tag]={href:oe.href,title:oe.title});continue}if(oe=this.tokenizer.table(Q)){Q=Q.substring(oe.raw.length),Z.push(oe);continue}if(oe=this.tokenizer.lheading(Q)){Q=Q.substring(oe.raw.length),Z.push(oe);continue}if(re&&(oe=this.tokenizer.paragraph(Q))){Q=Q.substring(oe.raw.length),Z.push(oe);continue}if(oe=this.tokenizer.text(Q,Z)){Q=Q.substring(oe.raw.length),oe.type?Z.push(oe):(De=Z[Z.length-1],De.raw+=`
`+oe.raw,De.text+=`
`+oe.text);continue}if(Q){var $e="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error($e);break}else throw new Error($e)}}return Z},le.inline=function(Q){var Z,re,oe,ge,Oe,De,$e=Q.length;for(Z=0;Z<$e;Z++){De=Q[Z];switch(De.type){case"paragraph":case"text":case"heading":{De.tokens=[],this.inlineTokens(De.text,De.tokens);break}case"table":{for(De.tokens={header:[],cells:[]},ge=De.header.length,re=0;re<ge;re++)De.tokens.header[re]=[],this.inlineTokens(De.header[re],De.tokens.header[re]);for(ge=De.cells.length,re=0;re<ge;re++)for(Oe=De.cells[re],De.tokens.cells[re]=[],oe=0;oe<Oe.length;oe++)De.tokens.cells[re][oe]=[],this.inlineTokens(Oe[oe],De.tokens.cells[re][oe]);break}case"blockquote":{this.inline(De.tokens);break}case"list":{for(ge=De.items.length,re=0;re<ge;re++)this.inline(De.items[re].tokens);break}}}return Q},le.inlineTokens=function(Q,Z,re,oe,ge){Z===void 0&&(Z=[]),re===void 0&&(re=!1),oe===void 0&&(oe=!1),ge===void 0&&(ge="");var Oe,De=Q,$e;if(this.tokens.links){var tt=Object.keys(this.tokens.links);if(tt.length>0)for(;($e=this.tokenizer.rules.inline.reflinkSearch.exec(De))!=null;)tt.includes($e[0].slice($e[0].lastIndexOf("[")+1,-1))&&(De=De.slice(0,$e.index)+"["+"a".repeat($e[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;($e=this.tokenizer.rules.inline.blockSkip.exec(De))!=null;)De=De.slice(0,$e.index)+"["+"a".repeat($e[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Q;){if(Oe=this.tokenizer.escape(Q)){Q=Q.substring(Oe.raw.length),Z.push(Oe);continue}if(Oe=this.tokenizer.tag(Q,re,oe)){Q=Q.substring(Oe.raw.length),re=Oe.inLink,oe=Oe.inRawBlock,Z.push(Oe);continue}if(Oe=this.tokenizer.link(Q)){Q=Q.substring(Oe.raw.length),Oe.type==="link"&&(Oe.tokens=this.inlineTokens(Oe.text,[],!0,oe)),Z.push(Oe);continue}if(Oe=this.tokenizer.reflink(Q,this.tokens.links)){Q=Q.substring(Oe.raw.length),Oe.type==="link"&&(Oe.tokens=this.inlineTokens(Oe.text,[],!0,oe)),Z.push(Oe);continue}if(Oe=this.tokenizer.strong(Q,De,ge)){Q=Q.substring(Oe.raw.length),Oe.tokens=this.inlineTokens(Oe.text,[],re,oe),Z.push(Oe);continue}if(Oe=this.tokenizer.em(Q,De,ge)){Q=Q.substring(Oe.raw.length),Oe.tokens=this.inlineTokens(Oe.text,[],re,oe),Z.push(Oe);continue}if(Oe=this.tokenizer.codespan(Q)){Q=Q.substring(Oe.raw.length),Z.push(Oe);continue}if(Oe=this.tokenizer.br(Q)){Q=Q.substring(Oe.raw.length),Z.push(Oe);continue}if(Oe=this.tokenizer.del(Q)){Q=Q.substring(Oe.raw.length),Oe.tokens=this.inlineTokens(Oe.text,[],re,oe),Z.push(Oe);continue}if(Oe=this.tokenizer.autolink(Q,ye)){Q=Q.substring(Oe.raw.length),Z.push(Oe);continue}if(!re&&(Oe=this.tokenizer.url(Q,ye))){Q=Q.substring(Oe.raw.length),Z.push(Oe);continue}if(Oe=this.tokenizer.inlineText(Q,oe,Ae)){Q=Q.substring(Oe.raw.length),ge=Oe.raw.slice(-1),Z.push(Oe);continue}if(Q){var nt="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(nt);break}else throw new Error(nt)}}return Z},V(_e,null,[{key:"rules",get:function(){return{block:q,inline:Ee}}}]),_e}(),Re=W.defaults,ke=F.cleanUrl,Ne=F.escape,Ie=function(){function _e(fe){this.options=fe||Re}var le=_e.prototype;return le.code=function(Q,Z,re){var oe=(Z||"").match(/\S*/)[0];if(this.options.highlight){var ge=this.options.highlight(Q,oe);ge!=null&&ge!==Q&&(re=!0,Q=ge)}return oe?'<pre><code class="'+this.options.langPrefix+Ne(oe,!0)+'">'+(re?Q:Ne(Q,!0))+`</code></pre>
`:"<pre><code>"+(re?Q:Ne(Q,!0))+`</code></pre>
`},le.blockquote=function(Q){return`<blockquote>
`+Q+`</blockquote>
`},le.html=function(Q){return Q},le.heading=function(Q,Z,re,oe){return this.options.headerIds?"<h"+Z+' id="'+this.options.headerPrefix+oe.slug(re)+'">'+Q+"</h"+Z+`>
`:"<h"+Z+">"+Q+"</h"+Z+`>
`},le.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},le.list=function(Q,Z,re){var oe=Z?"ol":"ul",ge=Z&&re!==1?' start="'+re+'"':"";return"<"+oe+ge+`>
`+Q+"</"+oe+`>
`},le.listitem=function(Q){return"<li>"+Q+`</li>
`},le.checkbox=function(Q){return"<input "+(Q?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},le.paragraph=function(Q){return"<p>"+Q+`</p>
`},le.table=function(Q,Z){return Z&&(Z="<tbody>"+Z+"</tbody>"),`<table>
<thead>
`+Q+`</thead>
`+Z+`</table>
`},le.tablerow=function(Q){return`<tr>
`+Q+`</tr>
`},le.tablecell=function(Q,Z){var re=Z.header?"th":"td",oe=Z.align?"<"+re+' align="'+Z.align+'">':"<"+re+">";return oe+Q+"</"+re+`>
`},le.strong=function(Q){return"<strong>"+Q+"</strong>"},le.em=function(Q){return"<em>"+Q+"</em>"},le.codespan=function(Q){return"<code>"+Q+"</code>"},le.br=function(){return this.options.xhtml?"<br/>":"<br>"},le.del=function(Q){return"<del>"+Q+"</del>"},le.link=function(Q,Z,re){if(Q=ke(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var oe='<a href="'+Ne(Q)+'"';return Z&&(oe+=' title="'+Z+'"'),oe+=">"+re+"</a>",oe},le.image=function(Q,Z,re){if(Q=ke(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var oe='<img src="'+Q+'" alt="'+re+'"';return Z&&(oe+=' title="'+Z+'"'),oe+=this.options.xhtml?"/>":">",oe},le.text=function(Q){return Q},_e}(),Le=function(){function _e(){}var le=_e.prototype;return le.strong=function(Q){return Q},le.em=function(Q){return Q},le.codespan=function(Q){return Q},le.del=function(Q){return Q},le.html=function(Q){return Q},le.text=function(Q){return Q},le.link=function(Q,Z,re){return""+re},le.image=function(Q,Z,re){return""+re},le.br=function(){return""},_e}(),Ye=function(){function _e(){this.seen={}}var le=_e.prototype;return le.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 re=Z;do this.seen[re]++,Z=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},_e}(),Qe=W.defaults,Xe=F.unescape,We=function(){function _e(fe){this.options=fe||Qe,this.options.renderer=this.options.renderer||new Ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Le,this.slugger=new Ye}_e.parse=function(Q,Z){var re=new _e(Z);return re.parse(Q)};var le=_e.prototype;return le.parse=function(Q,Z){Z===void 0&&(Z=!0);var re="",oe,ge,Oe,De,$e,tt,nt,Et,ct,st,Ot,Tt,Bt,Mt,yt,pn,bn,dt,mt=Q.length;for(oe=0;oe<mt;oe++){st=Q[oe];switch(st.type){case"space":continue;case"hr":{re+=this.renderer.hr();continue}case"heading":{re+=this.renderer.heading(this.parseInline(st.tokens),st.depth,Xe(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{re+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(Et="",nt="",De=st.header.length,ge=0;ge<De;ge++)nt+=this.renderer.tablecell(this.parseInline(st.tokens.header[ge]),{header:!0,align:st.align[ge]});for(Et+=this.renderer.tablerow(nt),ct="",De=st.cells.length,ge=0;ge<De;ge++){for(tt=st.tokens.cells[ge],nt="",$e=tt.length,Oe=0;Oe<$e;Oe++)nt+=this.renderer.tablecell(this.parseInline(tt[Oe]),{header:!1,align:st.align[Oe]});ct+=this.renderer.tablerow(nt)}re+=this.renderer.table(Et,ct);continue}case"blockquote":{ct=this.parse(st.tokens),re+=this.renderer.blockquote(ct);continue}case"list":{for(Ot=st.ordered,Tt=st.start,Bt=st.loose,De=st.items.length,ct="",ge=0;ge<De;ge++)yt=st.items[ge],pn=yt.checked,bn=yt.task,Mt="",yt.task&&(dt=this.renderer.checkbox(pn),Bt?yt.tokens.length>0&&yt.tokens[0].type==="text"?(yt.tokens[0].text=dt+" "+yt.tokens[0].text,yt.tokens[0].tokens&&yt.tokens[0].tokens.length>0&&yt.tokens[0].tokens[0].type==="text"&&(yt.tokens[0].tokens[0].text=dt+" "+yt.tokens[0].tokens[0].text)):yt.tokens.unshift({type:"text",text:dt}):Mt+=dt),Mt+=this.parse(yt.tokens,Bt),ct+=this.renderer.listitem(Mt,bn,pn);re+=this.renderer.list(ct,Ot,Tt);continue}case"html":{re+=this.renderer.html(st.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(ct=st.tokens?this.parseInline(st.tokens):st.text;oe+1<mt&&Q[oe+1].type==="text";)st=Q[++oe],ct+=`
`+(st.tokens?this.parseInline(st.tokens):st.text);re+=Z?this.renderer.paragraph(ct):ct;continue}default:{var xt='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(xt);return}else throw new Error(xt)}}}return re},le.parseInline=function(Q,Z){Z=Z||this.renderer;var re="",oe,ge,Oe=Q.length;for(oe=0;oe<Oe;oe++){ge=Q[oe];switch(ge.type){case"escape":{re+=Z.text(ge.text);break}case"html":{re+=Z.html(ge.text);break}case"link":{re+=Z.link(ge.href,ge.title,this.parseInline(ge.tokens,Z));break}case"image":{re+=Z.image(ge.href,ge.title,ge.text);break}case"strong":{re+=Z.strong(this.parseInline(ge.tokens,Z));break}case"em":{re+=Z.em(this.parseInline(ge.tokens,Z));break}case"codespan":{re+=Z.codespan(ge.text);break}case"br":{re+=Z.br();break}case"del":{re+=Z.del(this.parseInline(ge.tokens,Z));break}case"text":{re+=Z.text(ge.text);break}default:{var De='Token with "'+ge.type+'" type was not found.';if(this.options.silent){console.error(De);return}else throw new Error(De)}}}return re},_e}(),Je=F.merge,je=F.checkSanitizeDeprecation,He=F.escape,Se=W.getDefaults,qe=W.changeDefaults,Ke=W.defaults;function xe(_e,le,fe){if(typeof _e=="undefined"||_e===null)throw new Error("marked(): input parameter is undefined or null");if(typeof _e!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(_e)+", string expected");if(typeof le=="function"&&(fe=le,le=null),le=Je({},xe.defaults,le||{}),je(le),fe){var Q=le.highlight,Z;try{Z=we.lex(_e,le)}catch(Oe){return fe(Oe)}var re=function(De){var $e;if(!De)try{$e=We.parse(Z,le)}catch(tt){De=tt}return le.highlight=Q,De?fe(De):fe(null,$e)};if(!Q||Q.length<3)return re();if(delete le.highlight,!Z.length)return re();var oe=0;xe.walkTokens(Z,function(Oe){Oe.type==="code"&&(oe++,setTimeout(function(){Q(Oe.text,Oe.lang,function(De,$e){if(De)return re(De);$e!=null&&$e!==Oe.text&&(Oe.text=$e,Oe.escaped=!0),oe--,oe===0&&re()})},0))}),oe===0&&re();return}try{var ge=we.lex(_e,le);return le.walkTokens&&xe.walkTokens(ge,le.walkTokens),We.parse(ge,le)}catch(Oe){if(Oe.message+=`
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+He(Oe.message+"",!0)+"</pre>";throw Oe}}xe.options=xe.setOptions=function(_e){return Je(xe.defaults,_e),qe(xe.defaults),xe},xe.getDefaults=Se,xe.defaults=Ke,xe.use=function(_e){var le=Je({},_e);if(_e.renderer&&function(){var Q=xe.defaults.renderer||new Ie,Z=function(ge){var Oe=Q[ge];Q[ge]=function(){for(var De=arguments.length,$e=new Array(De),tt=0;tt<De;tt++)$e[tt]=arguments[tt];var nt=_e.renderer[ge].apply(Q,$e);return nt===!1&&(nt=Oe.apply(Q,$e)),nt}};for(var re in _e.renderer)Z(re);le.renderer=Q}(),_e.tokenizer&&function(){var Q=xe.defaults.tokenizer||new de,Z=function(ge){var Oe=Q[ge];Q[ge]=function(){for(var De=arguments.length,$e=new Array(De),tt=0;tt<De;tt++)$e[tt]=arguments[tt];var nt=_e.tokenizer[ge].apply(Q,$e);return nt===!1&&(nt=Oe.apply(Q,$e)),nt}};for(var re in _e.tokenizer)Z(re);le.tokenizer=Q}(),_e.walkTokens){var fe=xe.defaults.walkTokens;le.walkTokens=function(Q){_e.walkTokens(Q),fe&&fe(Q)}}xe.setOptions(le)},xe.walkTokens=function(_e,le){for(var fe=N(_e),Q;!(Q=fe()).done;){var Z=Q.value;le(Z);switch(Z.type){case"table":{for(var re=N(Z.tokens.header),oe;!(oe=re()).done;){var ge=oe.value;xe.walkTokens(ge,le)}for(var Oe=N(Z.tokens.cells),De;!(De=Oe()).done;)for(var $e=De.value,tt=N($e),nt;!(nt=tt()).done;){var Et=nt.value;xe.walkTokens(Et,le)}break}case"list":{xe.walkTokens(Z.items,le);break}default:Z.tokens&&xe.walkTokens(Z.tokens,le)}}},xe.Parser=We,xe.parser=We.parse,xe.Renderer=Ie,xe.TextRenderer=Le,xe.Lexer=we,xe.lexer=we.lex,xe.Tokenizer=de,xe.Slugger=Ye,xe.parse=xe;var Pe=xe;return Pe})},ELLl:function(at,Ve,te){(function(ne){ne(te("VrN/"))})(function(ne){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=ne.Pos;ne.defineOption("autoCloseBrackets",!1,function(o,c,s){s&&s!=ne.Init&&(o.removeKeyMap(N),o.state.closeBrackets=null),c&&(M(z(c,"pairs")),o.state.closeBrackets=c,o.addKeyMap(N))});function z(o,c){return c=="pairs"&&typeof o=="string"?o:typeof o=="object"&&o[c]!=null?o[c]:V[c]}var N={Backspace:k,Enter:R};function M(o){for(var c=0;c<o.length;c++){var s=o.charAt(c),a="'"+s+"'";N[a]||(N[a]=W(s))}}M(V.pairs+"`");function W(o){return function(c){return p(c,o)}}function B(o){var c=o.state.closeBrackets;if(!c||c.override)return c;var s=o.getModeAt(o.getCursor());return s.closeBrackets||c}function k(o){var c=B(o);if(!c||o.getOption("disableInput"))return ne.Pass;for(var s=z(c,"pairs"),a=o.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return ne.Pass;var h=f(o,a[l].head);if(!h||s.indexOf(h)%2!=0)return ne.Pass}for(var l=a.length-1;l>=0;l--){var O=a[l].head;o.replaceRange("",D(O.line,O.ch-1),D(O.line,O.ch+1),"+delete")}}function R(o){var c=B(o),s=c&&z(c,"explode");if(!s||o.getOption("disableInput"))return ne.Pass;for(var a=o.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return ne.Pass;var h=f(o,a[l].head);if(!h||s.indexOf(h)%2!=0)return ne.Pass}o.operation(function(){var O=o.lineSeparator()||`
`;o.replaceSelection(O+O,null),o.execCommand("goCharLeft"),a=o.listSelections();for(var w=0;w<a.length;w++){var x=a[w].head.line;o.indentLine(x,null,!0),o.indentLine(x+1,null,!0)}})}function g(o){var c=ne.cmpPos(o.anchor,o.head)>0;return{anchor:new D(o.anchor.line,o.anchor.ch+(c?-1:1)),head:new D(o.head.line,o.head.ch+(c?1:-1))}}function p(o,c){var s=B(o);if(!s||o.getOption("disableInput"))return ne.Pass;var a=z(s,"pairs"),l=a.indexOf(c);if(l==-1)return ne.Pass;for(var h=z(s,"closeBefore"),O=z(s,"triples"),w=a.charAt(l+1)==c,x=o.listSelections(),A=l%2==0,S,T=0;T<x.length;T++){var E=x[T],_=E.head,u,y=o.getRange(_,D(_.line,_.ch+1));if(A&&!E.empty())u="surround";else if((w||!A)&&y==c)w&&d(o,_)?u="both":O.indexOf(c)>=0&&o.getRange(_,D(_.line,_.ch+3))==c+c+c?u="skipThree":u="skip";else if(w&&_.ch>1&&O.indexOf(c)>=0&&o.getRange(D(_.line,_.ch-2),_)==c+c){if(_.ch>2&&/\bstring/.test(o.getTokenTypeAt(D(_.line,_.ch-2))))return ne.Pass;u="addFour"}else if(w){var m=_.ch==0?" ":o.getRange(D(_.line,_.ch-1),_);if(!ne.isWordChar(y)&&m!=c&&!ne.isWordChar(m))u="both";else return ne.Pass}else if(A&&(y.length===0||/\s/.test(y)||h.indexOf(y)>-1))u="both";else return ne.Pass;if(!S)S=u;else if(S!=u)return ne.Pass}var b=l%2?a.charAt(l-1):c,P=l%2?c:a.charAt(l+1);o.operation(function(){if(S=="skip")o.execCommand("goCharRight");else if(S=="skipThree")for(var I=0;I<3;I++)o.execCommand("goCharRight");else if(S=="surround"){for(var U=o.getSelections(),I=0;I<U.length;I++)U[I]=b+U[I]+P;o.replaceSelections(U,"around"),U=o.listSelections().slice();for(var I=0;I<U.length;I++)U[I]=g(U[I]);o.setSelections(U)}else S=="both"?(o.replaceSelection(b+P,null),o.triggerElectric(b+P),o.execCommand("goCharLeft")):S=="addFour"&&(o.replaceSelection(b+b+b+b,"before"),o.execCommand("goCharRight"))})}function f(o,c){var s=o.getRange(D(c.line,c.ch-1),D(c.line,c.ch+1));return s.length==2?s:null}function d(o,c){var s=o.getTokenAt(D(c.line,c.ch+1));return/\bstring/.test(s.type)&&s.start==c.ch&&(c.ch==0||!/\bstring/.test(o.getTokenTypeAt(c)))}})},GfqC:function(at,Ve,te){"use strict";var ne=te("cDcd"),V=te.n(ne),D=te("TSYQ"),z=te.n(D);function N(F,L){var v="cannot "+F.method+" "+F.action+" "+L.status+"'",j=new Error(v);return j.status=L.status,j.method=F.method,j.url=F.action,j}function M(F){var L=F.responseText||F.response;if(!L)return L;try{return JSON.parse(L)}catch(v){return L}}function W(F){var L=new XMLHttpRequest;F.onProgress&&L.upload&&(L.upload.onprogress=function(J){J.total>0&&(J.percent=J.loaded/J.total*100),F.onProgress(J)});var v=new FormData;F.data&&Object.keys(F.data).forEach(function(K){var J=F.data[K];if(Array.isArray(J)){J.forEach(function(ee){v.append(K+"[]",ee)});return}v.append(K,F.data[K])}),F.file instanceof Blob?v.append(F.filename,F.file,F.file.name):v.append(F.filename,F.file),L.onerror=function(J){F.onError(J)},L.onload=function(){return L.status<200||L.status>=300?F.onError(N(F,L),M(L)):F.onSuccess(M(L),L)},L.open(F.method,F.action,!0),F.withCredentials&&"withCredentials"in L&&(L.withCredentials=!0);var j=F.headers||{};return j["X-Requested-With"]!==null&&L.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(j).forEach(function(K){j[K]!==null&&L.setRequestHeader(K,j[K])}),L.send(v),{abort:function(){L.abort()}}}var B=+new Date,k=0;function R(){return"rc-upload-"+B+"-"+ ++k}function g(F,L){return F.indexOf(L,F.length-L.length)!==-1}var p=function(F,L){if(F&&L){var v=Array.isArray(L)?L:L.split(","),j=F.name||"",K=F.type||"",J=K.replace(/\/.*$/,"");return v.some(function(ee){var ve=ee.trim();return ve.charAt(0)==="."?g(j.toLowerCase(),ve.toLowerCase()):/\/\*$/.test(ve)?J===ve.replace(/\/.*$/,""):K===ve})}return!0};function f(F,L){var v=F.createReader(),j=[];function K(){v.readEntries(function(J){var ee=Array.prototype.slice.apply(J);j=j.concat(ee);var ve=!ee.length;ve?L(j):K()})}K()}var d=function(L,v,j){var K=function J(ee,ve){ve=ve||"",ee.isFile?ee.file(function(de){j(de)&&(ee.fullPath&&!de.webkitRelativePath&&(Object.defineProperties(de,{webkitRelativePath:{writable:!0}}),de.webkitRelativePath=ee.fullPath.replace(/^\//,""),Object.defineProperties(de,{webkitRelativePath:{writable:!1}})),v([de]))}):ee.isDirectory&&f(ee,function(de){de.forEach(function(me){J(me,""+ve+ee.name+"/")})})};L.forEach(function(J){K(J.webkitGetAsEntry())})},o=d,c=Object.assign||function(F){for(var L=1;L<arguments.length;L++){var v=arguments[L];for(var j in v)Object.prototype.hasOwnProperty.call(v,j)&&(F[j]=v[j])}return F},s=function(){function F(L,v){var j=[],K=!0,J=!1,ee=void 0;try{for(var ve=L[Symbol.iterator](),de;!(K=(de=ve.next()).done)&&!(j.push(de.value),v&&j.length===v);K=!0);}catch(me){J=!0,ee=me}finally{try{!K&&ve.return&&ve.return()}finally{if(J)throw ee}}return j}return function(L,v){if(Array.isArray(L))return L;if(Symbol.iterator in Object(L))return F(L,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function F(L,v){for(var j=0;j<v.length;j++){var K=v[j];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(L,K.key,K)}}return function(L,v,j){return v&&F(L.prototype,v),j&&F(L,j),L}}();function l(F,L,v){return L in F?Object.defineProperty(F,L,{value:v,enumerable:!0,configurable:!0,writable:!0}):F[L]=v,F}function h(F,L){var v={};for(var j in F){if(L.indexOf(j)>=0)continue;if(!Object.prototype.hasOwnProperty.call(F,j))continue;v[j]=F[j]}return v}function O(F,L){if(!(F instanceof L))throw new TypeError("Cannot call a class as a function")}function w(F,L){if(!F)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return L&&(typeof L=="object"||typeof L=="function")?L:F}function x(F,L){if(typeof L!="function"&&L!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof L);F.prototype=Object.create(L&&L.prototype,{constructor:{value:F,enumerable:!1,writable:!0,configurable:!0}}),L&&(Object.setPrototypeOf?Object.setPrototypeOf(F,L):F.__proto__=L)}var A=function(L){return Object.keys(L).reduce(function(v,j){return(j.substr(0,5)==="data-"||j.substr(0,5)==="aria-"||j==="role")&&(v[j]=L[j]),v},{})},S=function(F){x(L,F);function L(){var v,j,K,J;O(this,L);for(var ee=arguments.length,ve=Array(ee),de=0;de<ee;de++)ve[de]=arguments[de];return J=(j=(K=w(this,(v=L.__proto__||Object.getPrototypeOf(L)).call.apply(v,[this].concat(ve))),K),K.state={uid:R()},K.reqs={},K.onChange=function(me){var ce=me.target.files;K.uploadFiles(ce),K.reset()},K.onClick=function(me){var ce=K.fileInput;if(!ce)return;var pe=K.props,ae=pe.children,he=pe.onClick;ae&&ae.type==="button"&&(ce.parentNode.focus(),ce.parentNode.querySelector("button").blur()),ce.click(),he&&he(me)},K.onKeyDown=function(me){me.key==="Enter"&&K.onClick()},K.onFileDrop=function(me){var ce=K.props.multiple;if(me.preventDefault(),me.type==="dragover")return;if(K.props.directory)o(Array.prototype.slice.call(me.dataTransfer.items),K.uploadFiles,function(ae){return p(ae,K.props.accept)});else{var pe=Array.prototype.slice.call(me.dataTransfer.files).filter(function(ae){return p(ae,K.props.accept)});ce===!1&&(pe=pe.slice(0,1)),K.uploadFiles(pe)}},K.uploadFiles=function(me){var ce=Array.prototype.slice.call(me);ce.map(function(pe){return pe.uid=R(),pe}).forEach(function(pe){K.upload(pe,ce)})},K.saveFileInput=function(me){K.fileInput=me},j),w(K,J)}return a(L,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(j,K){var J=this,ee=this.props;if(!ee.beforeUpload)return setTimeout(function(){return J.post(j)},0);var ve=ee.beforeUpload(j,K);ve&&ve.then?ve.then(function(de){var me=Object.prototype.toString.call(de);return me==="[object File]"||me==="[object Blob]"?J.post(de):J.post(j)}).catch(function(de){console.log(de)}):ve!==!1&&setTimeout(function(){return J.post(j)},0);return}},{key:"post",value:function(j){var K=this;if(!this._isMounted)return;var J=this.props,ee=J.onStart,ve=J.onProgress,de=J.transformFile,me=de===void 0?function(ce){return ce}:de;new Promise(function(ce){var pe=J.action;return typeof pe=="function"&&(pe=pe(j)),ce(pe)}).then(function(ce){var pe=j.uid,ae=J.customRequest||W,he=Promise.resolve(me(j)).then(function($){var ie=J.data;return typeof ie=="function"&&(ie=ie($)),Promise.all([$,ie])}).catch(function($){console.error($)});he.then(function($){var ie=s($,2),q=ie[0],Ee=ie[1],Ae={action:ce,filename:J.name,data:Ee,file:q,headers:J.headers,withCredentials:J.withCredentials,method:J.method||"post",onProgress:ve?function(ye){ve(ye,j)}:null,onSuccess:function(we,Re){delete K.reqs[pe],J.onSuccess(we,j,Re)},onError:function(we,Re){delete K.reqs[pe],J.onError(we,Re,j)}};ee(j),K.reqs[pe]=ae(Ae)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function(j){var K=this.reqs;if(j){var J=j;j&&j.uid&&(J=j.uid),K[J]&&K[J].abort&&K[J].abort(),delete K[J]}else Object.keys(K).forEach(function(ee){K[ee]&&K[ee].abort&&K[ee].abort(),delete K[ee]})}},{key:"render",value:function(){var j,K=this.props,J=K.component,ee=K.prefixCls,ve=K.className,de=K.disabled,me=K.id,ce=K.style,pe=K.multiple,ae=K.accept,he=K.children,$=K.directory,ie=K.openFileDialogOnClick,q=K.onMouseEnter,Ee=K.onMouseLeave,Ae=h(K,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ye=z()((j={},l(j,ee,!0),l(j,ee+"-disabled",de),l(j,ve,ve),j)),we=de?{}:{onClick:ie?this.onClick:function(){},onKeyDown:ie?this.onKeyDown:function(){},onMouseEnter:q,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return V.a.createElement(J,c({},we,{className:ye,role:"button",style:ce}),V.a.createElement("input",c({},A(Ae),{id:me,type:"file",ref:this.saveFileInput,onClick:function(ke){return ke.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ae,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:pe,onChange:this.onChange})),he)}}]),L}(ne.Component),T=S,E=Object.assign||function(F){for(var L=1;L<arguments.length;L++){var v=arguments[L];for(var j in v)Object.prototype.hasOwnProperty.call(v,j)&&(F[j]=v[j])}return F},_=function(){function F(L,v){for(var j=0;j<v.length;j++){var K=v[j];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(L,K.key,K)}}return function(L,v,j){return v&&F(L.prototype,v),j&&F(L,j),L}}();function u(F,L){if(!(F instanceof L))throw new TypeError("Cannot call a class as a function")}function y(F,L){if(!F)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return L&&(typeof L=="object"||typeof L=="function")?L:F}function m(F,L){if(typeof L!="function"&&L!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof L);F.prototype=Object.create(L&&L.prototype,{constructor:{value:F,enumerable:!1,writable:!0,configurable:!0}}),L&&(Object.setPrototypeOf?Object.setPrototypeOf(F,L):F.__proto__=L)}function b(){}var P=function(F){m(L,F);function L(){var v,j,K,J;u(this,L);for(var ee=arguments.length,ve=Array(ee),de=0;de<ee;de++)ve[de]=arguments[de];return J=(j=(K=y(this,(v=L.__proto__||Object.getPrototypeOf(L)).call.apply(v,[this].concat(ve))),K),K.saveUploader=function(me){K.uploader=me},j),y(K,J)}return _(L,[{key:"abort",value:function(j){this.uploader.abort(j)}},{key:"render",value:function(){return V.a.createElement(T,E({},this.props,{ref:this.saveUploader}))}}]),L}(ne.Component);P.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:b,onError:b,onSuccess:b,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var I=P,U=Ve.a=I},HmJG:function(at,Ve,te){},LdHM:function(at,Ve,te){"use strict";te.d(Ve,"b",function(){return h}),te.d(Ve,"a",function(){return w});var ne=te("1OyB"),V=te("vuIU"),D=te("Ji7U"),z=te("LK+K"),N=te("cDcd"),M=te("rePB"),W=te("Ff2n"),B=te("ODXe"),k=te("4IlW"),R=te("bX4T"),g=te("YrtM"),p=te("TSYQ"),f=te.n(p),d=te("+nKL"),o=te("8OUc"),c=function(j,K){var J=j.prefixCls,ee=j.id,ve=j.flattenOptions,de=j.childrenAsData,me=j.values,ce=j.searchValue,pe=j.multiple,ae=j.defaultActiveFirstOption,he=j.height,$=j.itemHeight,ie=j.notFoundContent,q=j.open,Ee=j.menuItemSelectedIcon,Ae=j.virtual,ye=j.onSelect,we=j.onToggleOpen,Re=j.onActiveValue,ke=j.onScroll,Ne=j.onMouseEnter,Ie="".concat(J,"-item"),Le=Object(g.a)(function(){return ve},[q,ve],function(Pe,_e){return _e[0]&&Pe[1]!==_e[1]}),Ye=N.useRef(null),Qe=function(_e){_e.preventDefault()},Xe=function(_e){Ye.current&&Ye.current.scrollTo({index:_e})},We=function(_e){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,fe=Le.length,Q=0;Q<fe;Q+=1){var Z=(_e+Q*le+fe)%fe,re=Le[Z],oe=re.group,ge=re.data;if(!oe&&!ge.disabled)return Z}return-1},Je=N.useState(function(){return We(0)}),je=Object(B.a)(Je,2),He=je[0],Se=je[1],qe=function(_e){Se(_e);var le=Le[_e];if(!le){Re(null,-1);return}Re(le.data.value,_e)};N.useEffect(function(){qe(ae!==!1?We(0):-1)},[Le.length,ce]),N.useEffect(function(){var Pe=setTimeout(function(){if(!pe&&q&&me.size===1){var _e=Array.from(me)[0],le=Le.findIndex(function(fe){var Q=fe.data;return Q.value===_e});qe(le),Xe(le)}});return function(){return clearTimeout(Pe)}},[q]);var Ke=function(_e){_e!==void 0&&ye(_e,{selected:!me.has(_e)}),pe||we(!1)};if(N.useImperativeHandle(K,function(){return{onKeyDown:function(_e){var le=_e.which;switch(le){case k.a.UP:case k.a.DOWN:{var fe=0;if(le===k.a.UP?fe=-1:le===k.a.DOWN&&(fe=1),fe!==0){var Q=We(He+fe,fe);Xe(Q),qe(Q)}break}case k.a.ENTER:{var Z=Le[He];Z&&!Z.data.disabled?Ke(Z.data.value):Ke(void 0),q&&_e.preventDefault();break}case k.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(_e){Xe(_e)}}}),Le.length===0)return N.createElement("div",{role:"listbox",id:"".concat(ee,"_list"),className:"".concat(Ie,"-empty"),onMouseDown:Qe},ie);function xe(Pe){var _e=Le[Pe];if(!_e)return null;var le=_e.data||{},fe=le.value,Q=le.label,Z=le.children,re=Object(R.a)(le,!0),oe=de?Z:Q;return _e?N.createElement("div",Object.assign({"aria-label":typeof oe=="string"?oe:null},re,{key:Pe,role:"option",id:"".concat(ee,"_list_").concat(Pe),"aria-selected":me.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"}},xe(He-1),xe(He),xe(He+1)),N.createElement(d.a,{itemKey:"key",ref:Ye,data:Le,height:he,itemHeight:$,fullHeight:!1,onMouseDown:Qe,onScroll:ke,virtual:Ae,onMouseEnter:Ne},function(Pe,_e){var le,fe=Pe.group,Q=Pe.groupOption,Z=Pe.data,re=Z.label,oe=Z.key;if(fe)return N.createElement("div",{className:f()(Ie,"".concat(Ie,"-group"))},re!==void 0?re:oe);var ge=Z.disabled,Oe=Z.value,De=Z.title,$e=Z.children,tt=Z.style,nt=Z.className,Et=Object(W.a)(Z,["disabled","value","title","children","style","className"]),ct=me.has(Oe),st="".concat(Ie,"-option"),Ot=f()(Ie,st,nt,(le={},Object(M.a)(le,"".concat(st,"-grouped"),Q),Object(M.a)(le,"".concat(st,"-active"),He===_e&&!ge),Object(M.a)(le,"".concat(st,"-disabled"),ge),Object(M.a)(le,"".concat(st,"-selected"),ct),le)),Tt=de?$e:re,Bt=!Ee||typeof Ee=="function"||ct;return N.createElement("div",Object.assign({},Et,{"aria-selected":ct,className:Ot,title:De,onMouseMove:function(){if(He===_e||ge)return;qe(_e)},onClick:function(){ge||Ke(Oe)},style:tt}),N.createElement("div",{className:"".concat(st,"-content")},Tt||Oe),N.isValidElement(Ee)||ct,Bt&&N.createElement(o.a,{className:"".concat(Ie,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:ct}},ct?"\u2713":null))}))},s=N.forwardRef(c);s.displayName="OptionList";var a=s,l=function(){return null};l.isSelectOption=!0;var h=l,O=function(){return null};O.isSelectOptGroup=!0;var w=O,x=te("VTBJ"),A=te("Zm9Q");function S(v){var j=v.key,K=v.props,J=K.children,ee=K.value,ve=Object(W.a)(K,["children","value"]);return Object(x.a)({key:j,value:ee!==void 0?ee:j,children:J},ve)}function T(v){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(v).map(function(K,J){if(!N.isValidElement(K)||!K.type)return null;var ee=K.type.isSelectOptGroup,ve=K.key,de=K.props,me=de.children,ce=Object(W.a)(de,["children"]);return j||!ee?S(K):Object(x.a)(Object(x.a)({key:"__RC_SELECT_GRP__".concat(ve===null?J:ve,"__"),label:ve},ce),{},{options:T(me)})}).filter(function(K){return K})}var E=te("2Qr1"),_=te("qNPg"),u=te("U8pU"),y=te("Kwbf"),m=te("WKfj");function b(v){var j=v.mode,K=v.options,J=v.children,ee=v.backfill,ve=v.allowClear,de=v.placeholder,me=v.getInputElement,ce=v.showSearch,pe=v.onSearch,ae=v.defaultOpen,he=v.autoFocus,$=v.labelInValue,ie=v.value,q=v.inputValue,Ee=v.optionLabelProp,Ae=j==="multiple"||j==="tags",ye=ce!==void 0?ce:Ae||j==="combobox",we=K||T(J);if(Object(y.a)(j!=="tags"||we.every(function(Ie){return!Ie.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),j==="tags"||j==="combobox"){var Re=we.some(function(Ie){return Ie.options?Ie.options.some(function(Le){return typeof("value"in Le?Le.value:Le.key)=="number"}):typeof("value"in Ie?Ie.value:Ie.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"||!Ee,"`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"||!me,"`getInputElement` only work with `combobox` mode."),Object(y.b)(j!=="combobox"||!me||!ve||!de,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),pe&&!ye&&j!=="combobox"&&j!=="tags"&&Object(y.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(y.b)(!ae||he,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ie!=null){var ke=Object(m.d)(ie);Object(y.a)(!$||ke.every(function(Ie){return Object(u.a)(Ie)==="object"&&("key"in Ie||"value"in Ie)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(y.a)(!Ae||Array.isArray(ie),"`value` should be array when `mode` is `multiple` or `tags`")}if(J){var Ne=null;Object(A.a)(J).some(function(Ie){if(!N.isValidElement(Ie)||!Ie.type)return!1;var Le=Ie.type;if(Le.isSelectOption)return!1;if(Le.isSelectOptGroup){var Ye=Object(A.a)(Ie.props.children).every(function(Qe){return!N.isValidElement(Qe)||!Ie.type||Qe.type.isSelectOption?!0:(Ne=Qe.type,!1)});return!Ye}return Ne=Le,!0}),Ne&&Object(y.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ne.displayName||Ne.name||Ne,"`.")),Object(y.a)(q===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=b,I=Object(_.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:T,flattenOptions:E.d,getLabeledValue:E.e,filterOptions:E.b,isValueDisabled:E.g,findValueOption:E.c,warningProps:P,fillOptionsWithMissingValue:E.a}),U=function(v){Object(D.a)(K,v);var j=Object(z.a)(K);function K(){var J;return Object(ne.a)(this,K),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)(K,[{key:"render",value:function(){return N.createElement(I,Object.assign({ref:this.selectRef},this.props))}}]),K}(N.Component);U.Option=h,U.OptGroup=w;var F=U,L=Ve.c=F},M8RZ:function(at,Ve,te){"use strict";te.d(Ve,"a",function(){return k});var ne=te("fWQN"),V=te("mtLc"),D=te("yKVA"),z=te("879j"),N=te("cDcd"),M=te.n(N),W=te("faye"),B=te.n(W),k=function(R){Object(D.a)(p,R);var g=Object(z.a)(p);function p(f){var d;Object(ne.a)(this,p),d=g.call(this,f);var o=window.document;return d.node=o.createElement("div"),o.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(at,Ve,te){"use strict";var ne=te("2qtc"),V=te("kLXV"),D=te("rAM+"),z=te("miYZ"),N=te("tsqr"),M=te("9og8"),W=te("tJVT"),B=te("jrin"),k=te("WmNS"),R=te.n(k),g=te("cDcd"),p=te.n(g),f=te("VrN/"),d=te.n(f),o=te("bdgK"),c=te("p77/"),s=te("Bd2K"),a=te("ELLl"),l=te("19Vz"),h=te("lZu9"),O=te("+NIl"),w=te("kSUc"),x=te("9Bee"),A=function(ge){var Oe=ge.value,De=Oe===void 0?"":Oe,$e=ge.className,tt=ge.showTextOnly,nt=ge.showLines,Et=ge.style,ct=Et===void 0?{}:Et,st=Object(g.useMemo)(function(){return""},[De]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},S=te("0Owb"),T=te("dejd"),E=te("C+DQ"),_=te("1vsH"),u=te("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(ge){var Oe=ge.onActionCallback,De=ge.title,$e=ge.icon,tt=ge.actionName,nt=ge.className,Et=nt===void 0?"":nt,ct=ge.children;function st(){Oe(tt)}return p.a.createElement("a",{title:De,className:Et,onClick:st},p.a.createElement("i",{className:"md-iconfont ".concat($e)}),ct)}var b=function(ge){var Oe=ge.watch,De=ge.showNullButton,$e=ge.onActionCallback,tt=ge.fullScreen,nt=ge.insertTemp,Et=ge.hidetoolBar,ct=ge.uuid,st=ge.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(_.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(_.G)("_educoder_session"),"&key=").concat(ct,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var Ot=[].concat(y,[{title:"".concat(Oe?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Oe?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!Et&&Ot.map(function(Tt,Bt){return p.a.createElement("li",{key:Bt},Tt.actionName?p.a.createElement(m,Object(S.a)({},Tt,{onActionCallback:$e})):p.a.createElement("span",{className:"v-line"}))}),De?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:$e},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,nt&&p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(nt),onActionCallback:$e},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(tt?"icon-shrink":"icon-enlarge"),title:tt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:$e})))},P=te("M8RZ"),I=te("+L6B"),U=te("2/Rp"),F=te("y8nQ"),L=te("Vl3Y"),v=te("5NDa"),j=te("5rEg"),K={labelCol:{span:4},wrapperCol:{span:20}},J=function(ge){var Oe=ge.callback,De=ge.onCancel;function $e(tt){Oe(tt)}return p.a.createElement(L.a,Object(S.a)({},K,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:$e}),p.a.createElement(L.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(L.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(U.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(U.a,{type:"ghost",onClick:De},"\u53D6\u6D88")))},ee=te("7ahc"),ve=te("HmJG"),de=te("BjJ7"),me=L.a.useForm,ce={width:280,marginRight:10},pe={labelCol:{span:5},wrapperCol:{span:19}},ae=function(ge){var Oe=ge.callback,De=ge.onCancel,$e=me(),tt=Object(W.a)($e,1),nt=tt[0];function Et(Ot){Oe(Ot)}function ct(Ot,Tt){if(Ot.status===-1){N.b.error(Ot.message);return}nt.setFieldsValue({src:"/api/attachments/".concat(Ot.id),type:Tt.type})}function st(Ot){var Tt=Ot.target.files[0];$(Tt,ct)}return p.a.createElement(L.a,Object(S.a)({form:nt},pe,{className:"upload-image-panel",onFinish:Et}),p.a.createElement(L.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(L.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(j.a,{style:ce})),p.a.createElement(he,{onFileChange:st}))),p.a.createElement(L.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(j.a,{style:{width:264}})),p.a.createElement(L.a.Item,{style:{textAlign:"right"}},p.a.createElement(U.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(U.a,{type:"ghost",onClick:De},"\u53D6\u6D88")))};function he(ge){var Oe=ge.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:Oe}))}function $(ge,Oe){if(!ge)throw new String("\u6CA1\u6709\u6587\u4EF6");var De=new FormData;De.append("editormd-image-file",ge),De.append("file_param_name","editormd-image-file"),De.append("byxhr","true");var $e=new window.XMLHttpRequest;$e.withCredentials=!0,$e.addEventListener("load",function(tt){Oe(JSON.parse(tt.target.responseText),ge)},!1),$e.addEventListener("error",function(tt){console.error(tt)},!1),$e.open("POST","".concat(de.a,"/api/attachments.json")),$e.send(De)}var ie=te("giR+"),q=te("fyUT"),Ee=te("7Kak"),Ae=te("9yH6"),ye=Ae.a.Group,we={margin:"0 8px"},Re=function(ge){var Oe=ge.callback,De=ge.onCancel;function $e(tt){Oe(tt)}return p.a.createElement(L.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:$e},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:we},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:we},"\u884C\u6570"),p.a.createElement(L.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(q.a,null)),p.a.createElement("span",{style:we},"\u5217\u6570"),p.a.createElement(L.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:we},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(L.a.Item,{name:"align"},p.a.createElement(ye,null,p.a.createElement(Ae.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(Ae.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(Ae.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(Ae.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(U.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(U.a,{type:"ghost",onClick:De},"\u53D6\u6D88")))},ke=te("ErOA"),Ne=te("7Cbv"),Ie="link",Le="upload-image",Ye="code-block",Qe="add-table",Xe="------------",We={default:Xe,left:":".concat(Xe),center:":".concat(Xe,":"),right:"".concat(Xe,":")},Je=te("9VGf"),je,He;function Se(){}var qe=0,Ke=1e4,xe="\u2581",Pe=`
**\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 _e(ge){return/^\d+$/.test(ge)?"".concat(ge,"px"):ge}var le=navigator.platform.toUpperCase().indexOf("MAC")>=0,fe=le?"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=(je={},Object(B.a)(je,fe+"-B","bold"),Object(B.a)(je,fe+"-I","italic"),je),re=(He={},Object(B.a)(He,Ie,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(He,Ye,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(He,Le,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)(He,Qe,"\u6DFB\u52A0\u8868\u683C"),He),oe=Ve.a=function(ge){var Oe=ge.defaultValue,De=Oe===void 0?"":Oe,$e=ge.onChange,tt=ge.width,nt=tt===void 0?"100%":tt,Et=ge.height,ct=Et===void 0?400:Et,st=ge.miniToolbar,Ot=st===void 0?!1:st,Tt=ge.isFocus,Bt=Tt===void 0?!1:Tt,Mt=ge.watch,yt=ge.insertTemp,pn=ge.mode,bn=pn===void 0?"markdown":pn,dt=ge.id,mt=dt===void 0?"markdown-editor-id":dt,xt=ge.showResizeBar,Dt=xt===void 0?!1:xt,Wt=ge.noStorage,qn=Wt===void 0?!1:Wt,Gr=ge.showNullButton,Nt=Gr===void 0?!1:Gr,rt=ge.hidetoolBar,Pn=rt===void 0?!1:rt,gr=ge.fullScreen,rn=gr===void 0?!1:gr,St=ge.onBlur,En=ge.onCMBeforeChange,Mn=ge.onFullScreen,vr=ge.className,Fe=vr===void 0?"":vr,ht=ge.disablePaste,zr=ht===void 0?!1:ht,_r=ge.placeholder,yr=_r===void 0?"":_r,er=ge.values,br=er===void 0?"":er,pt=Object(g.useState)(null),Ai=Object(W.a)(pt,2),Ue=Ai[0],Er=Ai[1],_n=Object(g.useState)(De),Vr=Object(W.a)(_n,2),tr=Vr[0],Tn=Vr[1],Xr=Object(g.useState)(Mt),Yr=Object(W.a)(Xr,2),xn=Yr[0],$r=Yr[1],Ri=Object(g.useState)(rn),Qr=Object(W.a)(Ri,2),wn=Qr[0],Li=Qr[1],aa=Object(g.useState)(""),Jr=Object(W.a)(aa,2),en=Jr[0],Kn=Jr[1],sa=Object(g.useState)(0),nr=Object(W.a)(sa,2),Sn=nr[0],Zr=nr[1],oa=Object(g.useState)(ct),Ci=Object(W.a)(oa,2),Ii=Ci[0],Tr=Ci[1],Di=Object(g.useState)(!1),ki=Object(W.a)(Di,2),la=ki[0],xr=ki[1],rr=Object(g.useRef)(Object(Ne.a)()),ir=Object(g.useRef)(!1),wr=Object(g.useRef)(),Nn=Object(g.useRef)(),Fn=Object(g.useRef)(),Un=Object(g.useRef)(),Sr=Object(g.useRef)(),Pi=function(){var it=Object(M.a)(R.a.mark(function ft(){var lt,vt;return R.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return Ct.next=2,Object(ke.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:rr.current}});case 2:vt=Ct.sent,vt!=null&&(lt=vt.attachments)!==null&&lt!==void 0&&lt.length&&(console.log("cm:",Ue,Nn),vt.attachments.map(function(bt){bt.content_type.indexOf("image")>-1?Ue.replaceSelection("![,](/api/attachments/".concat(bt.id,"?type=").concat(bt.content_type,")")):bt.content_type.indexOf("video")>-1?Ue.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):bt.content_type.indexOf("pdf")>-1?Ue.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(bt.id,"?type=").concat(bt.content_type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Ue.replaceSelection("[".concat(bt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(bt.id,"?type=").concat(bt.content_type,")"))}));case 4:case"end":return Ct.stop()}},ft)}));return function(){return it.apply(this,arguments)}}();Object(g.useEffect)(function(){Tn(br),Ue==null||Ue.setValue(br)},[br]),Object(g.useEffect)(function(){Mn==null||Mn(wn)},[wn]),Object(g.useEffect)(function(){if(Nn.current){var it=d.a.fromTextArea(Nn.current,{mode:bn,lineNumbers:!Ot,lineWrapping:!0,value:De,autoCloseTags:!0,autoCloseBrackets:!0});Bt&&it.focus();function ft(lt,vt){if(zr){vt.preventDefault();return}var wt=vt.clipboardData;if(wt){var Ct=wt.types.toString(),bt=wt.items;if(Ct==="Files"||wt.types.indexOf("Files")>-1){if(vt.preventDefault(),bn=="stex")return;try{var Kt,an=bt[1];((Kt=bt[0])===null||Kt===void 0?void 0:Kt.kind)==="file"&&(an=bt[0]);var _t=an.getAsFile(),Bn=_t.name.split(".").pop();$(_t,function(At){if(At.id){var sn,Jt,yn;(_t==null||((sn=_t.type)===null||sn===void 0)?void 0:sn.indexOf("image"))>-1?it.replaceSelection("![,](/api/attachments/".concat(At.id,"?type=").concat(At.content_type,")")):(_t==null||((Jt=_t.type)===null||Jt===void 0)?void 0:Jt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(At.id,'"></video>')):(_t==null||((yn=_t.type)===null||yn===void 0)?void 0:yn.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(_t.type,'&disposition=inline" target="_blank">').concat(_t.name,"</a>")):Q.includes(Bn)?it.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(At.id,'?type=office&disposition=inline" target="_blank">').concat(_t.name,"</a>")):it.replaceSelection("[".concat(_t.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(At.content_type,")"))}else(At==null?void 0:At.status)===401&&(document.location.href="/user/login")})}catch(At){N.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",ft),it.on("dragleave",function(lt,vt){Fn.current.classList.remove("mouse-hover-md")}),it.on("dragover",function(lt,vt){Fn.current.classList.add("mouse-hover-md")}),it.on("drop",function(lt,vt){Fn.current.classList.add("mouse-hover-md");var wt;if(wt=vt.dataTransfer.files,wt.length>0){vt.preventDefault(),vt.stopPropagation();for(var Ct=function(an){var _t=wt[an],Bn=_t.name.split(".").pop();$(_t,function(At){if(At.id){var sn,Jt,yn;(_t==null||((sn=_t.type)===null||sn===void 0)?void 0:sn.indexOf("image"))>-1?it.replaceSelection("![,](/api/attachments/".concat(At.id,"?type=").concat(At.content_type,")")):(_t==null||((Jt=_t.type)===null||Jt===void 0)?void 0:Jt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(At.id,'"></video>')):(_t==null||((yn=_t.type)===null||yn===void 0)?void 0:yn.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(_t.type,'&disposition=inline" target="_blank">').concat(_t.name,"</a>")):Q.includes(Bn)?it.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(At.id,'?type=office&disposition=inline" target="_blank">').concat(_t.name,"</a>")):it.replaceSelection("[".concat(_t.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(At.content_type,")"))}else(At==null?void 0:At.status)===401&&(document.location.href="/user/login")})},bt=0;bt<wt.length;bt++)Ct(bt)}}),Er(it),function(){it.off("paste",ft)}}},[]);var mn=Object(g.useCallback)(function(){if(Fn.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Ii,Fn,wn]);Object(g.useEffect)(function(){function it(){var lt=new o.default(function(vt){var wt=Object(D.a)(vt),Ct;try{for(wt.s();!(Ct=wt.n()).done;){var bt=Ct.value;(bt.target.offsetHeight>0||bt.target.offsetWidth>0)&&(mn(),Ue.setSize("100%","100%"),Ue.refresh())}}catch(Kt){wt.e(Kt)}finally{wt.f()}});return lt.observe(Nn.current.parentElement),lt}if(Ue){var ft=it();return function(){ft.unobserve(Nn.current.parentElement)}}},[Ue,mn]),Object(g.useEffect)(function(){if(Ue){for(var it=[],ft=function(){var bt=vt[lt];wt=Object(W.a)(bt,2);var Kt=wt[0],an=wt[1],_t=Object(B.a)({},Kt,function(){Mi(an)});it.push(_t),Ue.addKeyMap(_t)},lt=0,vt=Object.entries(Z);lt<vt.length;lt++){var wt;ft()}return wr.current=setInterval(function(){ir.current&&Pi()},4e3),function(){clearInterval(wr.current);var Ct=Object(D.a)(it),bt;try{for(Ct.s();!(bt=Ct.n()).done;){var Kt=bt.value;Ue.removeKeyMap(Kt)}}catch(an){Ct.e(an)}finally{Ct.f()}}}},[Ue]),Object(g.useEffect)(function(){rn!==wn&&Li(rn)},[rn]),Object(Je.a)(function(){if(!qn&&Sn>0){var it=new Date().getTime(),ft=window.sessionStorage.getItem(mt);it>=Sn+Ke&&(!ft||ft!==tr)&&(window.sessionStorage.setItem(mt,tr),xr(!0))}},Ke),Object(g.useEffect)(function(){$r(Mt)},[Ue,Mt]),Object(g.useEffect)(function(){Ue&&(Bt&&Ue.focus())},[Ue,Bt]),Object(g.useEffect)(function(){if(xn&&Ue){var it=Ue.getScrollerElement();function ft(lt){var vt=lt.target;if(Sr.current){var wt=vt.scrollTop/vt.scrollHeight;Sr.current.scrollTop=Sr.current.scrollHeight*wt}}return it.addEventListener("scroll",ft),function(){it.removeEventListener("scroll",ft)}}},[Ue,xn]),Object(g.useEffect)(function(){if(Ue&&En){function it(ft,lt){En(ft,lt)}return Ue.on("beforeChange",it),function(){Ue.off("beforeChange",it)}}},[Ue,En]),Object(g.useEffect)(function(){if(Ue&&St){function it(){St(Ue.getValue())}return Ue.on("blur",it),function(){Ue.off("blur",it)}}},[Ue,St]),Object(g.useEffect)(function(){if(Ue){function it(ft){var lt=ft.getValue();Tn(lt),Zr(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),$e&&$e(lt)}return Ue.on("change",it),function(){Ue.off("change",it)}}},[Ue,$e]),Object(g.useEffect)(function(){Ue&&(De==null?(Ue.setValue(""),Tn("")):De!==Ue.getValue()&&(Ue.setValue(De),Tn(De),Ue.setCursor(Ue.lineCount(),0)))},[Ue,De]);var Mi=Object(g.useCallback)(function(it){var ft=Ue.getCursor(),lt=Ue.getSelection(),vt=lt.split(`
`);switch(it){case"bold":return Ue.replaceSelection("**"+lt+"**"),lt===""&&Ue.setCursor(ft.line,ft.ch+2),Ue.focus();case"italic":return Ue.replaceSelection("*"+lt+"*"),lt===""&&Ue.setCursor(ft.line,ft.ch+1),Ue.focus();case"code":return Ue.replaceSelection("`"+lt+"`"),lt===""&&Ue.setCursor(ft.line,ft.ch+1),Ue.focus();case"inline-latex":return Ue.replaceSelection("`$$"+lt+"$$`"),lt===""&&Ue.setCursor(ft.line,ft.ch+3),Ue.focus();case"latex":return Ue.replaceSelection("```latex\n"+lt+"\n```"),Ue.setCursor(ft.line+1,lt.length+1),Ue.focus();case"line-break":return Ue.replaceSelection(`<br/>
`),Ue.focus();case"list-ul":return lt===""?Ue.replaceSelection("- "+lt):Ue.replaceSelection(vt.map(function(wt){return wt===""?"":"- ".concat(wt)}).join(`
`)),Ue.focus();case"list-ol":return lt===""?Ue.replaceSelection("1. "+lt):Ue.replaceSelection(vt.map(function(wt,Ct){return wt===""?"":"".concat(Ct+1,". ").concat(wt)}).join(`
`)),Ue.focus();case"add-null-ch":return lt===""&&Ue.setCursor(ft.line,ft.ch+1),Ue.replaceSelection(xe),Ue.focus();case"inster-template-1":return lt===""&&Ue.setCursor(ft.line,ft.ch),Ue.replaceSelection(Pe),Ue.focus();case"eraser":return Ue.setValue(""),Ue.focus();case"trigger-watch":return $r(!xn),Ue.focus();case"trigger-full-screen":return Li(!wn),Ue.focus();case Ie:Kn(Ie);return;case Ye:Kn(Ye);return;case Le:Kn(Le);return;case Qe:Kn(Qe);return;default:throw new Error}},[Ue,xn,wn]),Or=Object(g.useCallback)(function(it){Kn("");switch(en){case Ie:var ft=it.title,lt=it.link;return Ue.replaceSelection("[".concat(ft,"](").concat(lt,")")),Ue.focus();case Ye:var vt=it.language,wt=it.content;return Ue.replaceSelection(["```"+vt,wt,"```"].join(`
`)),Ue.focus();case Le:var Ct=it.src,bt=it.alt;return bt?Ue.replaceSelection("![ ".concat(bt," ]( ").concat(Ct,' "').concat(bt,'" )')):Ue.replaceSelection("![,](".concat(Ct,")")),Ue.focus();case Qe:for(var Kt=it.row,an=it.col,_t=it.align,Bn=`
`,At=0;At<Kt;At++){for(var sn=[],Jt=[],yn=0;yn<an;yn++)At===1&&Jt.push(We[_t]),sn.push(" ");At===1&&(Bn+="| ".concat(Jt.join(" | "),` |
`)),Bn+="| ".concat(sn.join(an===1?"":" | "),` |
`)}return Ue.replaceSelection(Bn+`
`),Ue.focus();default:throw new Error}},[Ue,en]),qr=Object(g.useMemo)(function(){switch(en){case Ie:return p.a.createElement(J,{callback:Or,onCancel:Gn});case Ye:return p.a.createElement(ee.b,{callback:Or,onCancel:Gn});case Le:return p.a.createElement(ae,{callback:Or,onCancel:Gn});case Qe:return p.a.createElement(Re,{callback:Or,onCancel:Gn});default:return null}},[en]);function Gn(){Kn("")}Object(g.useEffect)(function(){if(Un.current){var it=Un.current,ft=!1,lt=0;function vt(bt){ft=!0,lt=bt.pageY}function wt(){ft=!1}function Ct(bt){if(ft){var Kt=bt.pageY-lt;Kt<0&&(Kt=0),Kt>300&&(Kt=300);var an=ct+Kt+"px";Tr(an)}}return it.addEventListener("mousedown",vt),document.addEventListener("mousemove",Ct),document.addEventListener("mouseup",wt),function(){it.removeEventListener("mousedown",vt),document.removeEventListener("mousemove",Ct),document.removeEventListener("mouseup",wt)}}},[Ue,Un]),Object(g.useEffect)(function(){Tr(ct)},[ct]);var Cn=_e(nt),ei=_e(Ii),On={width:Cn,height:ei},ti=Object(g.useMemo)(function(){if(Sn){var it=new Date(Sn),ft=it.getHours(),lt=it.getMinutes(),vt=it.getSeconds();return ft=ft<10?"0"+ft:ft,lt=lt<10?"0"+lt:lt,vt=vt<10?"0"+vt:vt,"".concat(ft,":").concat(lt,":").concat(vt)}return 0},[Sn]);function Ni(){window.sessionStorage.removeItem(mt),xr(!1),Zr(0)}function ar(){xr(!1),Zr(0),Ue.setValue(window.sessionStorage.getItem(mt))}function ua(it,ft){var lt=Ue.getValue();lt=lt.replace(it,ft),Tn(lt),Ue==null||Ue.setValue(lt)}return p.a.createElement(g.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:Fn},p.a.createElement("div",{className:"markdown-editor-container ".concat(Fe," ").concat(xn?"on-preview":""," ").concat(Ot?"mini":""," ").concat(wn?"full-screen":""),style:On},p.a.createElement(b,{insertTemp:yt,watch:xn,fullScreen:wn,showNullButton:Nt,onActionCallback:Mi,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:Nn,placeholder:yr})),xn?p.a.createElement("div",{ref:Sr,className:"preview-container"},bn==="stex"&&p.a.createElement(A,{value:tr}),bn!=="stex"&&p.a.createElement(x.a,{edit:!0,value:tr,replaces:ua})):null))),Dt?p.a.createElement("a",{ref:Un,className:"editor-resize"}):null,p.a.createElement(P.a,null,re[en]?p.a.createElement(V.a,{centered:!0,title:re[en],visible:!0,onCancel:Gn,footer:null,className:"markdown-popup-form"},qr):null))}},R7cW:function(at,Ve,te){"use strict";te.r(Ve);var ne=te("+L6B"),V=te("2/Rp"),D=te("DZo9"),z=te("8z0m"),N=te("0Owb"),M=te("5NDa"),W=te("5rEg"),B=te("sPJy"),k=te("bE4q"),R=te("k1fw"),g=te("oBTY"),p=te("9og8"),f=te("miYZ"),d=te("tsqr"),o=te("y8nQ"),c=te("Vl3Y"),s=te("tJVT"),a=te("WmNS"),l=te.n(a),h=te("cDcd"),O=te.n(h),w=te("Ty5D"),x=te("9kvl"),A=te("55Ip"),S=te("Ot1p"),T=te("XYT7"),E=te("m3rI"),_=te("YiJy"),u=te.n(_),y=function(b){var P,I=b.shixunHomeworks,U=b.newCourse,F=b.globalSetting,L=b.loading,v=b.dispatch,j=b.match,K=Object(w.i)(),J=c.a.useForm(),ee=Object(s.a)(J,1),ve=ee[0],de=Object(h.useState)({}),me=Object(s.a)(de,2),ce=me[0],pe=me[1],ae=Object(h.useState)(!1),he=Object(s.a)(ae,2),$=he[0],ie=he[1],q=Object(h.useState)([]),Ee=Object(s.a)(q,2),Ae=Ee[0],ye=Ee[1],we=Object(h.useState)([]),Re=Object(s.a)(we,2),ke=Re[0],Ne=Re[1],Ie=I.commonHomeWorkEditDefaultData,Le={name:"file",multiple:!0,action:E.a.API_SERVER+"/api/attachments.json",defaultFileList:Ae,onChange:function(Je){var je=Je.file.status;je!=="uploading",je==="done"?d.b.success("".concat(Je.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")):je==="error"&&d.b.error("".concat(Je.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))}};Object(h.useEffect)(function(){Qe()},[K.topicId]);var Ye=function(Je){return Je==null?void 0:Je.map(function(je){return{uid:je.id,response:{id:je.id},name:je.title,status:"done",url:je.url}})},Qe=function(){var We=Object(p.a)(l.a.mark(function Je(){var je;return l.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return Se.next=2,v({type:"shixunHomeworks/editCommonHomeWorkDefaultBankData",payload:{id:K.topicId}});case 2:je=Se.sent,je&&(ve.setFieldsValue({name:je.name}),ve.setFieldsValue({description:je.description}),ve.setFieldsValue({reference_answer:je.reference_answer}),ye(Object(g.a)(Ye(je.attachments))),Ne(Object(g.a)(Ye(je.reference_attachments))),ie(!0));case 4:case"end":return Se.stop()}},Je)}));return function(){return We.apply(this,arguments)}}(),Xe=function(){var We=Object(p.a)(l.a.mark(function Je(je){var He,Se,qe,Ke;return l.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:return He=Object(R.a)({},ce),He.attachment_ids&&(He.attachment_ids=He==null||((Se=He.attachment_ids.fileList)===null||Se===void 0)?void 0:Se.map(function(_e){var le;return(le=_e.response)===null||le===void 0?void 0:le.id})),He.reference_attachment_ids&&(He.reference_attachment_ids=He==null||((qe=He.reference_attachment_ids.fileList)===null||qe===void 0)?void 0:qe.map(function(_e){var le;return(le=_e.response)===null||le===void 0?void 0:le.id})),Pe.next=5,Object(T.n)(Object(R.a)(Object(R.a)({id:K.topicId},He),{},{base_on_project:null,type:1}));case 5:Ke=Pe.sent,Ke&&x.d.push("/users/".concat(K.username,"/topics/").concat(K.topicId,"/").concat(K.topictype,"/normal/detail"));case 7:case"end":return Pe.stop()}},Je)}));return function(je){return We.apply(this,arguments)}}();return O.a.createElement("section",{className:u.a.bg},O.a.createElement("section",{className:"animated fadeIn"},O.a.createElement("aside",{className:"mt10"},O.a.createElement(k.a,{separator:">"},O.a.createElement(k.a.Item,null,O.a.createElement(A.a,{to:"/users/".concat(K.username,"/").concat(K.topictype==="personal"?"topics":"topicbank","/").concat(K.topictype)},K.topictype==="personal"?"\u6211\u7684\u8BFE\u5802\u8D44\u6E90":"\u516C\u5171\u9898\u5E93")),O.a.createElement(k.a.Item,null,O.a.createElement(A.a,{to:"/users/".concat(K.username,"/topics/").concat(K.topicId,"/").concat(K.topictype,"/normal/detail")},"\u8BE6\u60C5")),O.a.createElement(k.a.Item,null,"\u7F16\u8F91")))),O.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u7F16\u8F91"),O.a.createElement(c.a,{form:ve,className:u.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){pe(Object(R.a)({},ve.getFieldsValue()))},onFinish:Xe},O.a.createElement("div",{className:u.a.fieldWrap},O.a.createElement(c.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},O.a.createElement(W.a,{maxLength:60,suffix:"".concat(((P=ce.name)===null||P===void 0?void 0:P.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),O.a.createElement("div",{className:u.a.mdWrap},O.a.createElement(c.a.Item,{name:"description",label:"\u7B80\u4ECB:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},O.a.createElement(S.a,{id:"topic-normal-description",watch:!0,defaultValue:Ie.description})),O.a.createElement("div",null,O.a.createElement(c.a.Item,{name:"attachment_ids"},$&&O.a.createElement(z.a,Object(N.a)({defaultFileList:Ae},Le),O.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),O.a.createElement("div",{className:u.a.mdWrap},O.a.createElement(c.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},O.a.createElement(S.a,{id:"topic-normal-reference_answer",defaultValue:Ie.reference_answer,watch:!0})),O.a.createElement("div",null,O.a.createElement(c.a.Item,{name:"reference_attachment_ids"},$&&O.a.createElement(z.a,Object(N.a)({},Le,{defaultFileList:ke}),O.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),O.a.createElement("div",{className:u.a.backgroundFa},O.a.createElement("div",{className:"pt40 mb30"},O.a.createElement(c.a.Item,null,O.a.createElement(V.a,{size:"large",type:"primary",className:"".concat(u.a.button," mr20"),htmlType:"submit"},"\u63D0\u4EA4"),O.a.createElement(V.a,{size:"large",type:"primary",ghost:!0,className:u.a.button,onClick:function(){return x.d.push("/users/".concat(K.username,"/topics/").concat(K.topicId,"/").concat(K.topictype,"/normal/detail"))}},"\u53D6\u6D88"))))))};Ve.default=Object(x.a)(function(m){var b=m.shixunHomeworks,P=m.newCourse,I=m.loading,U=m.globalSetting;return{shixunHomeworks:b,newCourse:P,globalSetting:U,loading:I.effects}})(y)},SJMd:function(at,Ve){/**
* @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 te,ne,V,D=!1,z,N;window.PR_SHOULD_USE_CONTINUATION=!0;var M,W;(function(){var B=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"],o="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",c=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],s="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"],O=[p,d,f,c,s,a,l,h],w=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,x="str",A="kwd",S="com",T="typ",E="lit",_="pun",u="pln",y="tag",m="dec",b="src",P="atn",I="atv",U="nocode",F="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function L(ye){for(var we=0,Re=!1,ke=!1,Ne=0,Ie=ye.length;Ne<Ie;++Ne){var Le=ye[Ne];if(Le.ignoreCase)ke=!0;else if(/[a-z]/i.test(Le.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,ke=!1;break}}var Ye={b:8,t:9,n:10,v:11,f:12,r:13};function Qe(He){var Se=He.charCodeAt(0);if(Se!==92)return Se;var qe=He.charAt(1);return Se=Ye[qe],Se||("0"<=qe&&qe<="7"?parseInt(He.substring(1),8):qe==="u"||qe==="x"?parseInt(He.substring(2),16):He.charCodeAt(1))}function Xe(He){if(He<32)return(He<16?"\\x0":"\\x")+He.toString(16);var Se=String.fromCharCode(He);return Se==="\\"||Se==="-"||Se==="]"||Se==="^"?"\\"+Se:Se}function We(He){var Se=He.substring(1,He.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),qe=[],Ke=Se[0]==="^",xe=["["];Ke&&xe.push("^");for(var Pe=Ke?1:0,_e=Se.length;Pe<_e;++Pe){var le=Se[Pe];if(/\\[bdsw]/i.test(le))xe.push(le);else{var fe=Qe(le),Q;Pe+2<_e&&Se[Pe+1]==="-"?(Q=Qe(Se[Pe+2]),Pe+=2):Q=fe,qe.push([fe,Q]),Q<65||fe>122||(Q<65||fe>90||qe.push([Math.max(65,fe)|32,Math.min(Q,90)|32]),Q<97||fe>122||qe.push([Math.max(97,fe)&~32,Math.min(Q,122)&~32]))}}qe.sort(function(ge,Oe){return ge[0]-Oe[0]||Oe[1]-ge[1]});for(var Z=[],re=[],Pe=0;Pe<qe.length;++Pe){var oe=qe[Pe];oe[0]<=re[1]+1?re[1]=Math.max(re[1],oe[1]):Z.push(re=oe)}for(var Pe=0;Pe<Z.length;++Pe){var oe=Z[Pe];xe.push(Xe(oe[0])),oe[1]>oe[0]&&(oe[1]+1>oe[0]&&xe.push("-"),xe.push(Xe(oe[1])))}return xe.push("]"),xe.join("")}function Je(He){for(var Se=He.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),qe=Se.length,Ke=[],xe=0,Pe=0;xe<qe;++xe){var _e=Se[xe];if(_e==="(")++Pe;else if(_e.charAt(0)==="\\"){var le=+_e.substring(1);le&&(le<=Pe?Ke[le]=-1:Se[xe]=Xe(le))}}for(var xe=1;xe<Ke.length;++xe)Ke[xe]===-1&&(Ke[xe]=++we);for(var xe=0,Pe=0;xe<qe;++xe){var _e=Se[xe];if(_e==="(")++Pe,Ke[Pe]||(Se[xe]="(?:");else if(_e.charAt(0)==="\\"){var le=+_e.substring(1);le&&le<=Pe&&(Se[xe]="\\"+Ke[le])}}for(var xe=0;xe<qe;++xe)Se[xe]==="^"&&Se[xe+1]!=="^"&&(Se[xe]="");if(He.ignoreCase&&Re)for(var xe=0;xe<qe;++xe){var _e=Se[xe],fe=_e.charAt(0);_e.length>=2&&fe==="["?Se[xe]=We(_e):fe!=="\\"&&(Se[xe]=_e.replace(/[a-zA-Z]/g,function(re){var oe=re.charCodeAt(0);return"["+String.fromCharCode(oe&~32,oe|32)+"]"}))}return Se.join("")}for(var je=[],Ne=0,Ie=ye.length;Ne<Ie;++Ne){var Le=ye[Ne];if(Le.global||Le.multiline)throw new Error(""+Le);je.push("(?:"+Je(Le)+")")}return new RegExp(je.join("|"),ke?"gi":"g")}function v(ye,we){var Re=/(?:^|\s)nocode(?:\s|$)/,ke=[],Ne=0,Ie=[],Le=0;function Ye(Qe){var Xe=Qe.nodeType;if(Xe==1){if(Re.test(Qe.className))return;for(var We=Qe.firstChild;We;We=We.nextSibling)Ye(We);var Je=Qe.nodeName.toLowerCase();(Je==="br"||Je==="li")&&(ke[Le]=`
`,Ie[Le<<1]=Ne++,Ie[Le++<<1|1]=Qe)}else if(Xe==3||Xe==4){var je=Qe.nodeValue;je.length&&(we?je=je.replace(/\r\n?/g,`
`):je=je.replace(/[ \t\r\n]+/g," "),ke[Le]=je,Ie[Le<<1]=Ne,Ne+=je.length,Ie[Le++<<1|1]=Qe)}}return Ye(ye),{sourceCode:ke.join("").replace(/\n$/,""),spans:Ie}}function j(ye,we,Re,ke,Ne){if(!Re)return;var Ie={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:we,decorations:null};ke(Ie),Ne.push.apply(Ne,Ie.decorations)}var K=/\S/;function J(ye){for(var we=void 0,Re=ye.firstChild;Re;Re=Re.nextSibling){var ke=Re.nodeType;we=ke===1?we?ye:Re:ke===3&&K.test(Re.nodeValue)?ye:we}return we===ye?void 0:we}function ee(ye,we){var Re={},ke;(function(){for(var Le=ye.concat(we),Ye=[],Qe={},Xe=0,We=Le.length;Xe<We;++Xe){var Je=Le[Xe],je=Je[3];if(je)for(var He=je.length;--He>=0;)Re[je.charAt(He)]=Je;var Se=Je[1],qe=""+Se;Qe.hasOwnProperty(qe)||(Ye.push(Se),Qe[qe]=null)}Ye.push(/[\0-\uffff]/),ke=L(Ye)})();var Ne=we.length,Ie=function(Le){for(var Ye=Le.sourceCode,Qe=Le.basePos,Xe=Le.sourceNode,We=[Qe,u],Je=0,je=Ye.match(ke)||[],He={},Se=0,qe=je.length;Se<qe;++Se){var Ke=je[Se],xe=He[Ke],Pe=void 0,_e;if(typeof xe=="string")_e=!1;else{var le=Re[Ke.charAt(0)];if(le)Pe=Ke.match(le[1]),xe=le[0];else{for(var fe=0;fe<Ne;++fe)if(le=we[fe],Pe=Ke.match(le[1]),Pe){xe=le[0];break}Pe||(xe=u)}_e=xe.length>=5&&xe.substring(0,5)==="lang-",_e&&!(Pe&&typeof Pe[1]=="string")&&(_e=!1,xe=b),_e||(He[Ke]=xe)}var Q=Je;if(Je+=Ke.length,!_e)We.push(Qe+Q,xe);else{var Z=Pe[1],re=Ke.indexOf(Z),oe=re+Z.length;Pe[2]&&(oe=Ke.length-Pe[2].length,re=oe-Z.length);var ge=xe.substring(5);j(Xe,Qe+Q,Ke.substring(0,re),Ie,We),j(Xe,Qe+Q+re,Z,he(ge,Z),We),j(Xe,Qe+Q+oe,Ke.substring(oe),Ie,We)}}Le.decorations=We};return Ie}function ve(ye){var we=[],Re=[];ye.tripleQuotedStrings?we.push([x,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?we.push([x,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([x,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&Re.push([x,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ke=ye.hashComments;ke&&(ye.cStyleComments?(ke>1?we.push([S,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([S,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Re.push([x,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([S,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(Re.push([S,/^\/\/[^\r\n]*/,null]),Re.push([S,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ne=ye.regexLiterals;if(Ne){var Ie=Ne>1?"":`
\r`,Le=Ie?".":"[\\S\\s]",Ye="/(?=[^/*"+Ie+"])(?:[^/\\x5B\\x5C"+Ie+"]|\\x5C"+Le+"|\\x5B(?:[^\\x5C\\x5D"+Ie+"]|\\x5C"+Le+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+F+"("+Ye+")")])}var Qe=ye.types;Qe&&Re.push([T,Qe]);var Xe=(""+ye.keywords).replace(/^ | $/g,"");Xe.length&&Re.push([A,new RegExp("^(?:"+Xe.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([u,/^\s+/,null,` \r
\xA0`]);var We="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(We+="(?!s*/)"),Re.push([E,/^@[a-z_$][a-z_$@0-9]*/i,null],[T,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[E,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[_,new RegExp(We),null]),ee(we,Re)}var de=ve({keywords:O,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function me(ye,we,Re){for(var ke=/(?:^|\s)nocode(?:\s|$)/,Ne=/\r\n?|\n/,Ie=ye.ownerDocument,Le=Ie.createElement("li");ye.firstChild;)Le.appendChild(ye.firstChild);var Ye=[Le];function Qe(Se){var qe=Se.nodeType;if(qe==1&&!ke.test(Se.className))if(Se.nodeName==="br")Xe(Se),Se.parentNode&&Se.parentNode.removeChild(Se);else for(var Ke=Se.firstChild;Ke;Ke=Ke.nextSibling)Qe(Ke);else if((qe==3||qe==4)&&Re){var xe=Se.nodeValue,Pe=xe.match(Ne);if(Pe){var _e=xe.substring(0,Pe.index);Se.nodeValue=_e;var le=xe.substring(Pe.index+Pe[0].length);if(le){var fe=Se.parentNode;fe.insertBefore(Ie.createTextNode(le),Se.nextSibling)}Xe(Se),_e||Se.parentNode.removeChild(Se)}}}function Xe(Se){for(;!Se.nextSibling;)if(Se=Se.parentNode,!Se)return;function qe(Pe,_e){var le=_e?Pe.cloneNode(!1):Pe,fe=Pe.parentNode;if(fe){var Q=qe(fe,1),Z=Pe.nextSibling;Q.appendChild(le);for(var re=Z;re;re=Z)Z=re.nextSibling,Q.appendChild(re)}return le}for(var Ke=qe(Se.nextSibling,0),xe;(xe=Ke.parentNode)&&xe.nodeType===1;)Ke=xe;Ye.push(Ke)}for(var We=0;We<Ye.length;++We)Qe(Ye[We]);we===(we|0)&&Ye[0].setAttribute("value",we);var Je=Ie.createElement("ol");Je.className="linenums";for(var je=Math.max(0,we-1|0)||0,We=0,He=Ye.length;We<He;++We)Le=Ye[We],Le.className="L"+(We+je)%10,Le.firstChild||Le.appendChild(Ie.createTextNode("\xA0")),Je.appendChild(Le);ye.appendChild(Je)}function ce(ye){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var Re=/\n/g,ke=ye.sourceCode,Ne=ke.length,Ie=0,Le=ye.spans,Ye=Le.length,Qe=0,Xe=ye.decorations,We=Xe.length,Je=0;Xe[We]=Ne;var je,He;for(He=je=0;He<We;)Xe[He]!==Xe[He+2]?(Xe[je++]=Xe[He++],Xe[je++]=Xe[He++]):He+=2;for(We=je,He=je=0;He<We;){for(var Se=Xe[He],qe=Xe[He+1],Ke=He+2;Ke+2<=We&&Xe[Ke+1]===qe;)Ke+=2;Xe[je++]=Se,Xe[je++]=qe,He=Ke}We=Xe.length=je;var xe=ye.sourceNode,Pe="";xe&&(Pe=xe.style.display,xe.style.display="none");try{for(var _e=null;Qe<Ye;){var le=Le[Qe],fe=Le[Qe+2]||Ne,Q=Xe[Je+2]||Ne,Ke=Math.min(fe,Q),Z=Le[Qe+1],re;if(Z.nodeType!==1&&(re=ke.substring(Ie,Ke))){we&&(re=re.replace(Re,"\r")),Z.nodeValue=re;var oe=Z.ownerDocument,ge=oe.createElement("span");ge.className=Xe[Je+1];var Oe=Z.parentNode;Oe.replaceChild(ge,Z),ge.appendChild(Z),Ie<fe&&(Le[Qe+1]=Z=oe.createTextNode(ke.substring(Ke,fe)),Oe.insertBefore(Z,ge.nextSibling))}Ie=Ke,Ie>=fe&&(Qe+=2),Ie>=Q&&(Je+=2)}}finally{xe&&(xe.style.display=Pe)}}var pe={};function ae(ye,we){for(var Re=we.length;--Re>=0;){var ke=we[Re];pe.hasOwnProperty(ke)?B.console&&console.warn("cannot override language handler %s",ke):pe[ke]=ye}}function he(ye,we){return ye&&pe.hasOwnProperty(ye)||(ye=/^\s*</.test(we)?"default-markup":"default-code"),pe[ye]}ae(de,["default-code"]),ae(ee([],[[u,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[S,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[_,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ae(ee([[u,/^[\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)))/],[_,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ae(ee([],[[I,/^[\s\S]+/]]),["uq.val"]),ae(ve({keywords:p,hashComments:!0,cStyleComments:!0,types:w}),["c","cc","cpp","cxx","cyc","m"]),ae(ve({keywords:"null,true,false"}),["json"]),ae(ve({keywords:d,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:w}),["cs"]),ae(ve({keywords:f,cStyleComments:!0}),["java"]),ae(ve({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ae(ve({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ae(ve({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ae(ve({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ae(ve({keywords:c,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ae(ve({keywords:o,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ae(ee([],[[x,/^[\s\S]+/]]),["regex"]);function $(ye){var we=ye.langExtension;try{var Re=v(ye.sourceNode,ye.pre),ke=Re.sourceCode;ye.sourceCode=ke,ye.spans=Re.spans,ye.basePos=0,he(we,ke)(ye),ce(ye)}catch(Ne){B.console&&console.log(Ne&&Ne.stack||Ne)}}function ie(ye,we,Re){var ke=Re||!1,Ne=we||null,Ie=document.createElement("div");Ie.innerHTML="<pre>"+ye+"</pre>",Ie=Ie.firstChild,ke&&me(Ie,ke,!0);var Le={langExtension:Ne,numberLines:ke,sourceNode:Ie,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(Le),Ie.innerHTML}function q(ye,we){var Re=we||document.body,ke=Re.ownerDocument||document;function Ne(le){return Re.getElementsByTagName(le)}for(var Ie=[Ne("pre"),Ne("code"),Ne("xmp")],Le=[],Ye=0;Ye<Ie.length;++Ye)for(var Qe=0,Xe=Ie[Ye].length;Qe<Xe;++Qe)Le.push(Ie[Ye][Qe]);Ie=null;var We=Date;We.now||(We={now:function(){return+new Date}});var Je=0,je=/\blang(?:uage)?-([\w.]+)(?!\S)/,He=/\bprettyprint\b/,Se=/\bprettyprinted\b/,qe=/pre|xmp/i,Ke=/^code$/i,xe=/^(?:pre|code|xmp)$/i,Pe={};function _e(){for(var le=B.PR_SHOULD_USE_CONTINUATION?We.now()+250:Infinity;Je<Le.length&&We.now()<le;Je++){for(var fe=Le[Je],Q=Pe,Z=fe;Z=Z.previousSibling;){var re=Z.nodeType,oe=(re===7||re===8)&&Z.nodeValue;if(oe?!/^\??prettify\b/.test(oe):re!==3||/\S/.test(Z.nodeValue))break;if(oe){Q={},oe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Mt,yt,pn){Q[yt]=pn});break}}var ge=fe.className;if((Q!==Pe||He.test(ge))&&!Se.test(ge)){for(var Oe=!1,De=fe.parentNode;De;De=De.parentNode){var $e=De.tagName;if(xe.test($e)&&De.className&&He.test(De.className)){Oe=!0;break}}if(!Oe){fe.className+=" prettyprinted";var tt=Q.lang;if(!tt){tt=ge.match(je);var nt;!tt&&(nt=J(fe))&&Ke.test(nt.tagName)&&(tt=nt.className.match(je)),tt&&(tt=tt[1])}var Et;if(qe.test(fe.tagName))Et=1;else{var ct=fe.currentStyle,st=ke.defaultView,Ot=ct?ct.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(fe,null).getPropertyValue("white-space"):0;Et=Ot&&Ot.substring(0,3)==="pre"}var Tt=Q.linenums;(Tt=Tt==="true"||+Tt)||(Tt=ge.match(/\blinenums\b(?::(\d+))?/),Tt=Tt?Tt[1]&&Tt[1].length?+Tt[1]:!0:!1),Tt&&me(fe,Tt,Et);var Bt={langExtension:tt,sourceNode:fe,numberLines:Tt,pre:Et,sourceCode:null,basePos:null,spans:null,decorations:null};$(Bt)}}}Je<Le.length?B.setTimeout(_e,250):typeof ye=="function"&&ye()}_e()}var Ee=B.PR={createSimpleLexer:ee,registerLangHandler:ae,sourceDecorator:ve,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:I,PR_COMMENT:S,PR_DECLARATION:m,PR_KEYWORD:A,PR_LITERAL:E,PR_NOCODE:U,PR_PLAIN:u,PR_PUNCTUATION:_,PR_SOURCE:b,PR_STRING:x,PR_TAG:y,PR_TYPE:T,prettyPrintOne:D?B.prettyPrintOne=ie:M=ie,prettyPrint:W=D?B.prettyPrint=q:W=q},Ae=B.define;typeof Ae=="function"&&Ae.amd&&Ae("google-code-prettify",[],function(){return Ee})})()},TXwP:function(at,Ve,te){var ne,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 o=this.__base_string_length;return d=d||0,f<0&&(o=0),o+=f*this.__indent_size,o+=d,o},g.prototype.get_indent_string=function(f,d){var o=this.__base_string;return d=d||0,f<0&&(f=0,o=""),d+=f*this.__indent_size,this.__ensure_cache(d),o+=this.__cache[d],o},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,o="";this.__indent_size&&f>=this.__indent_size&&(d=Math.floor(f/this.__indent_size),f-=d*this.__indent_size,o=new Array(d+1).join(this.__indent_string)),f&&(o+=new Array(f+1).join(" ")),this.__cache.push(o)};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 o=this.__lines.join(`
`);return f!==`
`&&(o=o.replace(/[\n]/g,f)),o},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 o=this.__lines.length-2;o>=0;){var c=this.__lines[o];if(c.is_empty())break;if(c.item(0).indexOf(f)!==0&&c.item(-1)!==d){this.__lines.splice(o+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},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 o=this.raw_options[f],c=d||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(c=o.concat()):typeof o=="string"&&(c=o.split(/[^a-zA-Z0-9_\/\-]+/)),c},R.prototype._get_boolean=function(f,d){var o=this.raw_options[f],c=o===void 0?!!d:!!o;return c},R.prototype._get_characters=function(f,d){var o=this.raw_options[f],c=d||"";return typeof o=="string"&&(c=o.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),c},R.prototype._get_number=function(f,d){var o=this.raw_options[f];d=parseInt(d,10),isNaN(d)&&(d=0);var c=parseInt(o,10);return isNaN(c)&&(c=d),c},R.prototype._get_selection=function(f,d,o){var c=this._get_selection_list(f,d,o);if(c.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
`+d+`
You passed in: '`+this.raw_options[f]+"'");return c[0]},R.prototype._get_selection_list=function(f,d,o){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[d[0]],!this._is_valid_selection(o,d))throw new Error("Invalid Default Value!");var c=this._get_array(f,o);if(!this._is_valid_selection(c,d))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
`+d+`
You passed in: '`+this.raw_options[f]+"'");return c},R.prototype._is_valid_selection=function(f,d){return f.length&&d.length&&!f.some(function(o){return d.indexOf(o)===-1})};function g(f,d){var o={};f=p(f);var c;for(c in f)c!==d&&(o[c]=f[c]);if(d&&f[d])for(c in f[d])o[c]=f[d][c];return o}function p(f){var d={},o;for(o in f){var c=o.replace(/-/g,"_");d[c]=f[o]}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 o="",c;return p&&(c=this.match(p),c&&(o+=c[0])),f&&(c||!p)&&(o+=this.readUntil(f,d)),o},g.prototype.readUntil=function(p,f){var d="",o=this.__position;p.lastIndex=this.__position;var c=p.exec(this.__input);return c?(o=c.index,f&&(o+=c[0].length)):o=this.__input_length,d=this.__input.substring(this.__position,o),this.__position=o,d},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var d=null,o="g";return f&&R&&(o="y"),typeof p=="string"&&p!==""?d=new RegExp(p,o):p&&(d=new RegExp(p.source,o)),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(o,c){var s=new p(o,c);return s.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,o=g(13).Directives,c=new o(/\/\*/,/\*\//),s=/\r\n|[\r\n]/,a=/\r\n|[\r\n]/g,l=/\s/,h=/(?:\s|\n)+/g,O=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function x(A,S){this._source_text=A||"",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"]}x.prototype.eatString=function(A){var S="";for(this._ch=this._input.next();this._ch;){if(S+=this._ch,this._ch==="\\")S+=this._input.next();else if(A.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return S},x.prototype.eatWhitespace=function(A){for(var S=l.test(this._input.peek()),T=0;l.test(this._input.peek());)this._ch=this._input.next(),A&&this._ch===`
`&&((T===0||T<this._options.max_preserve_newlines)&&(T++,this._output.add_new_line(!0)));return S},x.prototype.foundNestedPseudoClass=function(){for(var A=0,S=1,T=this._input.peek(S);T;){if(T==="{")return!0;if(T==="(")A+=1;else if(T===")"){if(A===0)return!1;A-=1}else if(T===";"||T==="}")return!1;S++,T=this._input.peek(S)}return!1},x.prototype.print_string=function(A){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(A)},x.prototype.preserveSingleSpace=function(A){A&&(this._output.space_before_token=!0)},x.prototype.indent=function(){this._indentLevel++},x.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},x.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var A=this._source_text,S=this._options.eol;S==="auto"&&(S=`
`,A&&s.test(A||"")&&(S=A.match(s)[0])),A=A.replace(a,`
`);var T=A.match(/^[\t ]*/)[0];this._output=new f(this._options,T),this._input=new d(A),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var E=0,_=!1,u=!1,y=!1,m=!1,b=!1,P=!1,I=this._ch,U=!1,F,L,v;F=this._input.read(h),L=F!=="",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(O),K=c.get_directives(j);K&&K.ignore==="start"&&(j+=c.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(w)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(L),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"&&(b=!0),J in this.NESTED_AT_RULE?(this._nestedLevel+=1,J in this.CONDITIONAL_GROUP_RULE&&(y=!0)):!_&&E===0&&J.indexOf(":")!==-1&&(u=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(L),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")u&&(u=!1,this.outdent()),y?(y=!1,_=this._indentLevel>=this._nestedLevel):_=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&_&&(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),b=!1,m=!1,u&&(this.outdent(),u=!1),this.print_string(this._ch),_=!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])){U=!0;break}(_||y)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!m&&E===0?(this.print_string(":"),u||(u=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var ve=v==='"'||v==="'";this.preserveSingleSpace(ve||L),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")U=!1,E===0?(u&&(this.outdent(),u=!1),m=!1,b=!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(),E++,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(")")),E&&(E--,this.outdent()));else{var de=!1;this._input.lookBack("with")&&(de=!0),this.preserveSingleSpace(L||de),this.print_string(this._ch),u&&v==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),P=!0):(this.eatWhitespace(),E++,this.indent())}else if(this._ch===")")E&&(E--,this.outdent()),P&&this._input.peek()===";"&&this._options.selector_separator_newline&&(P=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!u||P)&&E===0&&!b&&!m?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!u&&E===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(L),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 me=v==='"'||v==="'";this.preserveSingleSpace(me||L),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&U&&this._output.add_new_line()}var ce=this._output.get_code(S);return ce},k.exports.Beautifier=x},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 o=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||o;var c=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var s=0;s<c.length;s++)c[s]!=="expand"?this.brace_style="collapse":this.brace_style=c[s]}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 B=W(15);D=B})();var z=D;!(ne=[],V=function(){return{css_beautify:z}}.apply(Ve,ne),V!==void 0&&(at.exports=V))})()},"VrN/":function(at,Ve,te){(function(ne,V){at.exports=V()})(this,function(){"use strict";var ne=navigator.userAgent,V=navigator.platform,D=/gecko\/\d/i.test(ne),z=/MSIE \d/.test(ne),N=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ne),M=/Edge\/(\d+)/.exec(ne),W=z||N||M,B=W&&(z?document.documentMode||6:+(M||N)[1]),k=!M&&/WebKit\//.test(ne),R=k&&/Qt\/\d+\.\d+/.test(ne),g=!M&&/Chrome\//.test(ne),p=/Opera\//.test(ne),f=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ne),o=/PhantomJS/.test(ne),c=!M&&/AppleWebKit/.test(ne)&&/Mobile\/\w+/.test(ne),s=/Android/.test(ne),a=c||s||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ne),l=c||/Mac/.test(V),h=/\bCrOS\b/.test(ne),O=/win/i.test(V),w=p&&ne.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(p=!1,k=!0);var x=l&&(R||p&&(w==null||w<12.11)),A=D||W&&B>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T=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 E(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function _(e,t){return E(e).appendChild(t)}function u(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var C=0;C<t.length;++C)i.appendChild(t[C]);return i}function y(e,t,r,n){var i=u(e,t,r,n);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:m=function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};function b(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function 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 U(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 F=function(e){e.select()};c?F=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(F=function(e){try{e.select()}catch(t){}});function L(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 C=n||0,H=i||0;;){var G=e.indexOf(" ",C);if(G<0||G>=t)return H+(t-C);H+=G-C,H+=r-H%r,C=G+1}}var K=function(){this.id=null,this.f=null,this.time=0,this.handler=L(this.onTimeout,this)};K.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},K.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,ve={toString:function(){return"CodeMirror.Pass"}},de={scroll:!1},me={origin:"*mouse"},ce={origin:"+move"};function pe(e,t,r){for(var n=0,i=0;;){var C=e.indexOf(" ",n);C==-1&&(C=e.length);var H=C-n;if(C==e.length||i+H>=t)return n+Math.min(H,t-i);if(i+=C-n,i+=r-i%r,n=C+1,i>=t)return n}}var ae=[""];function he(e){for(;ae.length<=e;)ae.push($(ae)+" ");return ae[e]}function $(e){return e[e.length-1]}function ie(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 Ee(){}function Ae(e,t){var r;return Object.create?r=Object.create(e):(Ee.prototype=e,r=new Ee),t&&v(t,r),r}var ye=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function we(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ye.test(e))}function Re(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function ke(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ne=/[\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 Ie(e){return e.charCodeAt(0)>=768&&Ne.test(e)}function Le(e,t,r){for(;(r<0?t>0:t<e.length)&&Ie(e.charAt(t));)t+=r;return t}function Ye(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,C=n<0?Math.ceil(i):Math.floor(i);if(C==t)return e(C)?t:r;e(C)?r=C:t=C+n}}function Qe(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,C=0;C<e.length;++C){var H=e[C];(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",C),i=!0)}i||n(t,r,"ltr")}var Xe=null;function We(e,t,r){var n;Xe=null;for(var i=0;i<e.length;++i){var C=e[i];if(C.from<t&&C.to>t)return i;C.to==t&&(C.from!=C.to&&r=="before"?n=i:Xe=i),C.from==t&&(C.from!=C.to&&r!="before"?n=i:Xe=i)}return n!=null?n:Xe}var Je=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]/,C=/[LRr]/,H=/[Lb1n]/,G=/[1n]/;function X(Y,se,ue){this.level=Y,this.from=se,this.to=ue}return function(Y,se){var ue=se=="ltr"?"L":"R";if(Y.length==0||se=="ltr"&&!n.test(Y))return!1;for(var Te=Y.length,be=[],Ce=0;Ce<Te;++Ce)be.push(r(Y.charCodeAt(Ce)));for(var Me=0,Be=ue;Me<Te;++Me){var Ge=be[Me];Ge=="m"?be[Me]=Be:Be=Ge}for(var Ze=0,ze=ue;Ze<Te;++Ze){var et=be[Ze];et=="1"&&ze=="r"?be[Ze]="n":C.test(et)&&(ze=et,et=="r"&&(be[Ze]="R"))}for(var ut=1,ot=be[0];ut<Te-1;++ut){var gt=be[ut];gt=="+"&&ot=="1"&&be[ut+1]=="1"?be[ut]="1":gt==","&&ot==be[ut+1]&&(ot=="1"||ot=="n")&&(be[ut]=ot),ot=gt}for(var It=0;It<Te;++It){var Xt=be[It];if(Xt==",")be[It]="N";else if(Xt=="%"){var Pt=void 0;for(Pt=It+1;Pt<Te&&be[Pt]=="%";++Pt);for(var fn=It&&be[It-1]=="!"||Pt<Te&&be[Pt]=="1"?"1":"N",un=It;un<Pt;++un)be[un]=fn;It=Pt-1}}for(var jt=0,dn=ue;jt<Te;++jt){var Qt=be[jt];dn=="L"&&Qt=="1"?be[jt]="L":C.test(Qt)&&(dn=Qt)}for(var Gt=0;Gt<Te;++Gt)if(i.test(be[Gt])){var Ht=void 0;for(Ht=Gt+1;Ht<Te&&i.test(be[Ht]);++Ht);for(var Ft=(Gt?be[Gt-1]:ue)=="L",cn=(Ht<Te?be[Ht]:ue)=="L",Wr=Ft==cn?Ft?"L":"R":ue,Zn=Gt;Zn<Ht;++Zn)be[Zn]=Wr;Gt=Ht-1}for(var qt=[],kn,Yt=0;Yt<Te;)if(H.test(be[Yt])){var Va=Yt;for(++Yt;Yt<Te&&H.test(be[Yt]);++Yt);qt.push(new X(0,Va,Yt))}else{var Wn=Yt,pr=qt.length,mr=se=="rtl"?1:0;for(++Yt;Yt<Te&&be[Yt]!="L";++Yt);for(var nn=Wn;nn<Yt;)if(G.test(be[nn])){Wn<nn&&(qt.splice(pr,0,new X(1,Wn,nn)),pr+=mr);var Kr=nn;for(++nn;nn<Yt&&G.test(be[nn]);++nn);qt.splice(pr,0,new X(2,Kr,nn)),pr+=mr,Wn=nn}else++nn;Wn<Yt&&qt.splice(pr,0,new X(1,Wn,Yt))}return se=="ltr"&&(qt[0].level==1&&(kn=Y.match(/^\s+/))&&(qt[0].from=kn[0].length,qt.unshift(new X(0,0,kn[0].length))),$(qt).level==1&&(kn=Y.match(/\s+$/))&&($(qt).to-=kn[0].length,qt.push(new X(0,Te-kn[0].length,Te)))),se=="rtl"?qt.reverse():qt}}();function je(e,t){var r=e.order;return r==null&&(r=e.order=Je(e.text,t)),r}var He=[],Se=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]||He).concat(r)}};function qe(e,t){return e._handlers&&e._handlers[t]||He}function Ke(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 C=J(i,r);C>-1&&(n[t]=i.slice(0,C).concat(i.slice(C+1)))}}}function xe(e,t){var r=qe(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 Pe(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),xe(e,r||t.type,e,t),re(t)||t.codemirrorIgnore}function _e(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 le(e,t){return qe(e,t).length>0}function fe(e){e.prototype.on=function(t,r){Se(this,t,r)},e.prototype.off=function(t,r){Ke(this,t,r)}}function Q(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function re(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function oe(e){Q(e),Z(e)}function ge(e){return e.target||e.srcElement}function Oe(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 De=function(){if(W&&B<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),$e;function tt(e){if($e==null){var t=u("span","\u200B");_(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&($e=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&B<8))}var r=$e?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var nt;function Et(e){if(nt!=null)return nt;var t=_(e,document.createTextNode("A\u062EA")),r=m(t,0,1).getBoundingClientRect(),n=m(t,1,2).getBoundingClientRect();return E(e),!r||r.left==r.right?!1:nt=n.right-r.right<3}var ct=`
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 C=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),H=C.indexOf("\r");H!=-1?(r.push(C.slice(0,H)),t+=H+1):(r.push(C),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},st=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ot=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Tt=null;function Bt(e){if(Tt!=null)return Tt;var t=_(e,u("span","x")),r=t.getBoundingClientRect(),n=m(t,0,1).getBoundingClientRect();return Tt=Math.abs(r.left-n.left)>1}var Mt={},yt={};function pn(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Mt[e]=t}function bn(e,t){yt[e]=t}function dt(e){if(typeof e=="string"&&yt.hasOwnProperty(e))e=yt[e];else if(e&&typeof e.name=="string"&&yt.hasOwnProperty(e.name)){var t=yt[e.name];typeof t=="string"&&(t={name:t}),e=Ae(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return dt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return dt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function mt(e,t){t=dt(t);var r=Mt[t.name];if(!r)return mt(e,"text/plain");var n=r(e,t);if(xt.hasOwnProperty(t.name)){var i=xt[t.name];for(var C in i){if(!i.hasOwnProperty(C))continue;n.hasOwnProperty(C)&&(n["_"+C]=n[C]),n[C]=i[C]}}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 xt={};function Dt(e,t){var r=xt.hasOwnProperty(e)?xt[e]:xt[e]={};v(t,r)}function Wt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function qn(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 Nt=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};Nt.prototype.eol=function(){return this.pos>=this.string.length},Nt.prototype.sol=function(){return this.pos==this.lineStart},Nt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Nt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Nt.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},Nt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Nt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Nt.prototype.skipToEnd=function(){this.pos=this.string.length},Nt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Nt.prototype.backUp=function(e){this.pos-=e},Nt.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)},Nt.prototype.indentation=function(){return j(this.string,null,this.tabSize)-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},Nt.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 C=this.string.slice(this.pos).match(e);return C&&C.index>0?null:(C&&t!==!1&&(this.pos+=C[0].length),C)}},Nt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Nt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Nt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Nt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function rt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],C=i.chunkSize();if(t<C){r=i;break}t-=C}return r.lines[t]}function Pn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(C){var H=C.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 rn(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function St(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 En(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],C=i.height;if(t<C){e=i;continue e}t-=C,r+=i.chunkSize()}return r}while(!e.lines);for(var H=0;H<e.lines.length;++H){var G=e.lines[H],X=G.height;if(t<X)break;t-=X}return r+H}function Mn(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 ht(e,t){return e.line-t.line||e.ch-t.ch}function zr(e,t){return e.sticky==t.sticky&&ht(e,t)==0}function _r(e){return Fe(e.line,e.ch)}function yr(e,t){return ht(e,t)<0?t:e}function er(e,t){return ht(e,t)<0?e:t}function br(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function pt(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,rt(e,r).text.length):Ai(t,rt(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 Ue(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=pt(e,t[n]);return r}var Er=function(e,t){this.state=e,this.lookAhead=t},_n=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};_n.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},_n.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}},_n.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},_n.fromSaved=function(e,t,r){return t instanceof Er?new _n(e,Wt(e.mode,t.state),r,t.lookAhead):new _n(e,Wt(e.mode,t),r)},_n.prototype.save=function(e){var t=e!==!1?Wt(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],C={};wn(e,t.text,e.doc.mode,r,function(Y,se){return i.push(Y,se)},C,n);for(var H=r.state,G=function(Y){r.baseTokens=i;var se=e.state.overlays[Y],ue=1,Te=0;r.state=!0,wn(e,t.text,se.mode,r,function(be,Ce){for(var Me=ue;Te<be;){var Be=i[ue];Be>be&&i.splice(ue,1,be,i[ue+1],Be),ue+=2,Te=Math.min(be,Be)}if(!Ce)return;if(se.opaque)i.splice(Me,ue-Me,be,"overlay "+Ce),ue=Me+2;else for(;Me<ue;Me+=2){var Ge=i[Me+1];i[Me+1]=(Ge?Ge+" ":"")+"overlay "+Ce}},C),r.state=H,r.baseTokens=null,r.baseTokenPos=1},X=0;X<e.state.overlays.length;++X)G(X);return{styles:i,classes:C.bgClass||C.textClass?C:null}}function tr(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Tn(e,St(t)),i=t.text.length>e.options.maxHighlightLength&&Wt(e.doc.mode,n.state),C=Vr(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=C.styles,C.classes?t.styleClasses=C.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 Tn(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new _n(n,!0,t);var C=Li(e,t,r),H=C>n.first&&rt(n,C-1).stateAfter,G=H?_n.fromSaved(n,H,C):new _n(n,Gr(n.mode),C);return n.iter(C,t,function(X){Xr(e,X.text,G);var Y=G.line;X.stateAfter=Y==t-1||Y%5==0||Y>=i.viewFrom&&Y<i.viewTo?G.save():null,G.nextLine()}),r&&(n.modeFrontier=G.line),G}function Xr(e,t,r,n){var i=e.doc.mode,C=new Nt(t,e.options.tabSize,r);for(C.start=C.pos=n||0,t==""&&Yr(i,r.state);!C.eol();)xn(i,C,r.state),C.start=C.pos}function Yr(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=qn(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function xn(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=qn(e,r).mode);var C=e.token(t,r);if(t.pos>t.start)return C}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,C=i.mode,H;t=pt(i,t);var G=rt(i,t.line),X=Tn(e,t.line,r),Y=new Nt(G.text,e.options.tabSize,X),se;for(n&&(se=[]);(n||Y.pos<t.ch)&&!Y.eol();)Y.start=Y.pos,H=xn(C,Y,X.state),n&&se.push(new $r(Y,H,Wt(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 wn(e,t,r,n,i,C,H){var G=r.flattenSpans;G==null&&(G=e.options.flattenSpans);var X=0,Y=null,se=new Nt(t,e.options.tabSize,n),ue,Te=e.options.addModeClass&&[null];for(t==""&&Qr(Yr(r,n.state),C);!se.eol();){if(se.pos>e.options.maxHighlightLength?(G=!1,H&&Xr(e,t,n,se.pos),se.pos=t.length,ue=null):ue=Qr(xn(r,se,n.state,Te),C),Te){var be=Te[0].name;be&&(ue="m-"+(ue?be+" "+ue:be))}if(!G||Y!=ue){for(;X<se.start;)X=Math.min(se.start,X+5e3),i(X,Y);Y=ue}se.start=se.pos}for(;X<se.pos;){var Ce=Math.min(se.pos,X+5e3);i(Ce,Y),X=Ce}}function Li(e,t,r){for(var n,i,C=e.doc,H=r?-1:t-(e.doc.mode.innerMode?1e3:100),G=t;G>H;--G){if(G<=C.first)return C.first;var X=rt(C,G-1),Y=X.stateAfter;if(Y&&(!r||G+(Y instanceof Er?Y.lookAhead:0)<=C.modeFrontier))return G;var se=j(X.text,null,e.options.tabSize);(i==null||n>se)&&(i=G-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=rt(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,en=!1;function Kn(){Jr=!0}function sa(){en=!0}function nr(e,t,r){this.marker=e,this.from=t,this.to=r}function Sn(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Zr(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function oa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Ci(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var C=e[i],H=C.marker,G=C.from==null||(H.inclusiveLeft?C.from<=t:C.from<t);if(G||C.from==t&&H.type=="bookmark"&&(!r||!C.marker.insertLeft)){var X=C.to==null||(H.inclusiveRight?C.to>=t:C.to>t);(n||(n=[])).push(new nr(H,C.from,X?null:C.to))}}return n}function Ii(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var C=e[i],H=C.marker,G=C.to==null||(H.inclusiveRight?C.to>=t:C.to>t);if(G||C.from==t&&H.type=="bookmark"&&(!r||C.marker.insertLeft)){var X=C.from==null||(H.inclusiveLeft?C.from<=t:C.from<t);(n||(n=[])).push(new nr(H,X?null:C.from-t,C.to==null?null:C.to-t))}}return n}function Tr(e,t){if(t.full)return null;var r=Mn(e,t.from.line)&&rt(e,t.from.line).markedSpans,n=Mn(e,t.to.line)&&rt(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,C=t.to.ch,H=ht(t.from,t.to)==0,G=Ci(r,i,H),X=Ii(n,C,H),Y=t.text.length==1,se=$(t.text).length+(Y?i:0);if(G)for(var ue=0;ue<G.length;++ue){var Te=G[ue];if(Te.to==null){var be=Sn(X,Te.marker);be?Y&&(Te.to=be.to==null?null:be.to+se):Te.to=i}}if(X)for(var Ce=0;Ce<X.length;++Ce){var Me=X[Ce];if(Me.to!=null&&(Me.to+=se),Me.from==null){var Be=Sn(G,Me.marker);Be||(Me.from=se,Y&&(G||(G=[])).push(Me))}else Me.from+=se,Y&&(G||(G=[])).push(Me)}G&&(G=Di(G)),X&&X!=G&&(X=Di(X));var Ge=[G];if(!Y){var Ze=t.text.length-2,ze;if(Ze>0&&G)for(var et=0;et<G.length;++et)G[et].to==null&&(ze||(ze=[])).push(new nr(G[et].marker,null,null));for(var ut=0;ut<Ze;++ut)Ge.push(ze);Ge.push(X)}return Ge}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(be){if(be.markedSpans)for(var Ce=0;Ce<be.markedSpans.length;++Ce){var Me=be.markedSpans[Ce].marker;Me.readOnly&&(!n||J(n,Me)==-1)&&(n||(n=[])).push(Me)}}),!n)return null;for(var i=[{from:t,to:r}],C=0;C<n.length;++C)for(var H=n[C],G=H.find(0),X=0;X<i.length;++X){var Y=i[X];if(ht(Y.to,G.from)<0||ht(Y.from,G.to)>0)continue;var se=[X,1],ue=ht(Y.from,G.from),Te=ht(Y.to,G.to);(ue<0||!H.inclusiveLeft&&!ue)&&se.push({from:Y.from,to:G.from}),(Te>0||!H.inclusiveRight&&!Te)&&se.push({from:G.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(),C=ht(n.from,i.from)||rr(e)-rr(t);if(C)return-C;var H=ht(n.to,i.to)||ir(e)-ir(t);return H||t.id-e.id}function Nn(e,t){var r=en&&e.markedSpans,n;if(r)for(var i=void 0,C=0;C<r.length;++C)i=r[C],i.marker.collapsed&&(t?i.from:i.to)==null&&(!n||wr(n,i.marker)<0)&&(n=i.marker);return n}function Fn(e){return Nn(e,!0)}function Un(e){return Nn(e,!1)}function Sr(e,t){var r=en&&e.markedSpans,n;if(r)for(var i=0;i<r.length;++i){var C=r[i];C.marker.collapsed&&(C.from==null||C.from<t)&&(C.to==null||C.to>t)&&(!n||wr(n,C.marker)<0)&&(n=C.marker)}return n}function Pi(e,t,r,n,i){var C=rt(e,t),H=en&&C.markedSpans;if(H)for(var G=0;G<H.length;++G){var X=H[G];if(!X.marker.collapsed)continue;var Y=X.marker.find(0),se=ht(Y.from,r)||rr(X.marker)-rr(i),ue=ht(Y.to,n)||ir(X.marker)-ir(i);if(se>=0&&ue<=0||se<=0&&ue>=0)continue;if(se<=0&&(X.marker.inclusiveRight&&i.inclusiveLeft?ht(Y.to,r)>=0:ht(Y.to,r)>0)||se>=0&&(X.marker.inclusiveRight&&i.inclusiveLeft?ht(Y.from,n)<=0:ht(Y.from,n)<0))return!0}}function mn(e){for(var t;t=Fn(e);)e=t.find(-1,!0).line;return e}function Mi(e){for(var t;t=Un(e);)e=t.find(1,!0).line;return e}function Or(e){for(var t,r;t=Un(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function qr(e,t){var r=rt(e,t),n=mn(r);return r==n?t:St(n)}function Gn(e,t){if(t>e.lastLine())return t;var r=rt(e,t),n;if(!Cn(e,r))return t;for(;n=Un(r);)r=n.find(1,!0).line;return St(r)+1}function Cn(e,t){var r=en&&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,Sn(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,C=0;C<t.markedSpans.length;++C)if(i=t.markedSpans[C],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 On(e){e=mn(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 C=r.parent;C;r=C,C=r.parent)for(var H=0;H<C.children.length;++H){var G=C.children[H];if(G==r)break;t+=G.height}return t}function ti(e){if(e.height==0)return 0;for(var t=e.text.length,r,n=e;r=Fn(n);){var i=r.find(0,!0);n=i.from.line,t+=i.from.ch-i.to.ch}for(n=e;r=Un(n);){var C=r.find(0,!0);t-=n.text.length-C.from.ch,n=C.to.line,t+=n.text.length-C.to.ch}return t}function Ni(e){var t=e.display,r=e.doc;t.maxLine=rt(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 St(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&&rn(e,i)}function it(e){e.parent=null,la(e)}var ft={},lt={};function vt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?lt:ft;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function wt(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 C=i?t.rest[i-1]:t.line,H=void 0;n.pos=0,n.addToken=bt,Et(e.display.measure)&&(H=je(C,e.doc.direction))&&(n.addToken=an(n.addToken,H)),n.map=[];var G=t!=e.display.externalMeasured&&St(C);Bn(C,n,tr(e,C,G)),C.styleClasses&&(C.styleClasses.bgClass&&(n.bgClass=U(C.styleClasses.bgClass,n.bgClass||"")),C.styleClasses.textClass&&(n.textClass=U(C.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(tt(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 xe(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=U(n.pre.className,n.textClass||"")),n}function Ct(e){var t=u("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function bt(e,t,r,n,i,C,H){if(!t)return;var G=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(G),e.map.push(e.pos,e.pos+t.length,se),W&&B<9&&(Y=!0),e.pos+=t.length;else{se=document.createDocumentFragment();for(var ue=0;;){X.lastIndex=ue;var Te=X.exec(t),be=Te?Te.index-ue:t.length-ue;if(be){var Ce=document.createTextNode(G.slice(ue,ue+be));W&&B<9?se.appendChild(u("span",[Ce])):se.appendChild(Ce),e.map.push(e.pos,e.pos+be,Ce),e.col+=be,e.pos+=be}if(!Te)break;ue+=be+1;var Me=void 0;if(Te[0]==" "){var Be=e.cm.options.tabSize,Ge=Be-e.col%Be;Me=se.appendChild(u("span",he(Ge),"cm-tab")),Me.setAttribute("role","presentation"),Me.setAttribute("cm-text"," "),e.col+=Ge}else Te[0]=="\r"||Te[0]==`
`?(Me=se.appendChild(u("span",Te[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Me.setAttribute("cm-text",Te[0]),e.col+=1):(Me=e.cm.options.specialCharPlaceholder(Te[0]),Me.setAttribute("cm-text",Te[0]),W&&B<9?se.appendChild(u("span",[Me])):se.appendChild(Me),e.col+=1);e.map.push(e.pos,e.pos+1,Me),e.pos++}}if(e.trailingSpace=G.charCodeAt(t.length-1)==32,r||n||i||Y||C||H){var Ze=r||"";n&&(Ze+=n),i&&(Ze+=i);var ze=u("span",[se],Ze,C);if(H)for(var et in H)H.hasOwnProperty(et)&&et!="style"&&et!="class"&&ze.setAttribute(et,H[et]);return e.content.appendChild(ze)}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 C=e.charAt(i);C==" "&&r&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(C="\xA0"),n+=C,r=C==" "}return n}function an(e,t){return function(r,n,i,C,H,G,X){i=i?i+" cm-force-border":"cm-force-border";for(var Y=r.pos,se=Y+n.length;;){for(var ue=void 0,Te=0;Te<t.length&&!(ue=t[Te],ue.to>Y&&ue.from<=Y);Te++);if(ue.to>=se)return e(r,n,i,C,H,G,X);e(r,n.slice(0,ue.to-Y),i,C,null,G,X),C=null,n=n.slice(ue.to-Y),Y=ue.to}}}function _t(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 Bn(e,t,r){var n=e.markedSpans,i=e.text,C=0;if(!n){for(var H=1;H<r.length;H+=2)t.addToken(t,i.slice(C,C=r[H]),vt(r[H+1],t.cm.options));return}for(var G=i.length,X=0,Y=1,se="",ue,Te,be=0,Ce,Me,Be,Ge,Ze;;){if(be==X){Ce=Me=Be=Te="",Ze=null,Ge=null,be=Infinity;for(var ze=[],et=void 0,ut=0;ut<n.length;++ut){var ot=n[ut],gt=ot.marker;if(gt.type=="bookmark"&&ot.from==X&&gt.widgetNode)ze.push(gt);else if(ot.from<=X&&(ot.to==null||ot.to>X||gt.collapsed&&ot.to==X&&ot.from==X)){if(ot.to!=null&&ot.to!=X&&be>ot.to&&(be=ot.to,Me=""),gt.className&&(Ce+=" "+gt.className),gt.css&&(Te=(Te?Te+";":"")+gt.css),gt.startStyle&&ot.from==X&&(Be+=" "+gt.startStyle),gt.endStyle&&ot.to==be&&(et||(et=[])).push(gt.endStyle,ot.to),gt.title&&((Ze||(Ze={})).title=gt.title),gt.attributes)for(var It in gt.attributes)(Ze||(Ze={}))[It]=gt.attributes[It];gt.collapsed&&(!Ge||wr(Ge.marker,gt)<0)&&(Ge=ot)}else ot.from>X&&be>ot.from&&(be=ot.from)}if(et)for(var Xt=0;Xt<et.length;Xt+=2)et[Xt+1]==be&&(Me+=" "+et[Xt]);if(!Ge||Ge.from==X)for(var Pt=0;Pt<ze.length;++Pt)_t(t,0,ze[Pt]);if(Ge&&(Ge.from||0)==X){if(_t(t,(Ge.to==null?G+1:Ge.to)-X,Ge.marker,Ge.from==null),Ge.to==null)return;Ge.to==X&&(Ge=!1)}}if(X>=G)break;for(var fn=Math.min(G,be);;){if(se){var un=X+se.length;if(!Ge){var jt=un>fn?se.slice(0,fn-X):se;t.addToken(t,jt,ue?ue+Ce:Ce,Be,X+jt.length==be?Me:"",Te,Ze)}if(un>=fn){se=se.slice(fn-X),X=fn;break}X=un,Be=""}se=i.slice(C,C=r[Y++]),ue=vt(r[Y++],t.cm.options)}}}function At(e,t,r){this.line=t,this.rest=Or(t),this.size=this.rest?St($(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Cn(e,t)}function sn(e,t,r){for(var n=[],i,C=t;C<r;C=i){var H=new At(e.doc,rt(e.doc,C),C);i=C+H.size,n.push(H)}return n}var Jt=null;function yn(e){Jt?Jt.ops.push(e):e.ownsGroup=Jt={ops:[e],delayedCallbacks:[]}}function Co(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function Io(e,t){var r=e.ownsGroup;if(!r)return;try{Co(r)}finally{Jt=null,t(r)}}var ni=null;function $t(e,t){var r=qe(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 C=function(G){i.push(function(){return r[G].apply(null,n)})},H=0;H<r.length;++H)C(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 C=t.changes[i];C=="text"?Po(e,t):C=="gutter"?Qa(e,t,r,n):C=="class"?da(e,t):C=="widget"&&Mo(e,t,n)}t.changes=null}function ri(e){return e.node==e.text&&(e.node=u("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&B<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(u("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):wt(e,t)}function Po(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=u("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var C=t.line.gutterMarkers;if(e.options.lineNumbers||C){var H=ri(t),G=t.gutter=u("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(G),H.insertBefore(G,t.text),t.line.gutterClass&&(G.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!C||!C["CodeMirror-linenumbers"])&&(t.lineNumber=G.appendChild(u("div",vr(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),C)for(var X=0;X<e.display.gutterSpecs.length;++X){var Y=e.display.gutterSpecs[X].className,se=C.hasOwnProperty(Y)&&C[Y];se&&G.appendChild(u("div",[se],"CodeMirror-gutter-elt","left: "+n.gutterLeft[Y]+"px; width: "+n.gutterWidth[Y]+"px"))}}}function Mo(e,t,r){t.alignable&&(t.alignable=null);for(var n=S("CodeMirror-linewidget"),i=t.node.firstChild,C=void 0;i;i=C)C=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 C=ri(r),H=0,G=t.widgets;H<G.length;++H){var X=G[H],Y=u("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?C.insertBefore(Y,r.gutter||r.text):C.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(!b(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;"),_(t.display.measure,u("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function jn(e,t){for(var r=ge(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=_(e.measure,u("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(n.left)&&!isNaN(n.right)&&(e.cachedPaddingH=n),n}function In(e){return ee-e.display.nativeBarWidth}function sr(e){return e.display.scroller.clientWidth-In(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-In(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 C=t.measure.heights=[];if(n){t.measure.width=i;for(var H=t.text.firstChild.getClientRects(),G=0;G<H.length-1;G++){var X=H[G],Y=H[G+1];Math.abs(X.bottom-Y.bottom)>2&&C.push((X.bottom+Y.top)/2-r.top)}}C.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(St(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bo(e,t){t=mn(t);var r=St(t),n=e.display.externalMeasured=new At(e.doc,t,r);n.lineN=r;var i=n.built=wt(e,n);return n.text=i.pre,_(e.display.lineMeasure,i.pre),n}function ts(e,t,r,n){return Dn(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=St(t),n=fa(e,r);n&&!n.text?n=null:n&&n.changes&&(Ya(e,n,r,ya(e)),e.curOp.forceUpdate=!0),n||(n=Bo(e,t));var i=es(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Dn(e,t,r,n,i){t.before&&(r=-1);var C=r+(n||""),H;return t.cache.hasOwnProperty(C)?H=t.cache[C]:(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[C]=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,C,H,G,X,Y=0;Y<e.length;Y+=3)if(G=e[Y],X=e[Y+1],t<G?(i=0,C=1,H="left"):t<X?(i=t-G,C=i+1):(Y==e.length-3||t==X&&e[Y+3]>t)&&(C=X-G,i=C-1,t>=X&&(H="right")),i!=null){if(n=e[Y+2],G==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-G)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:C,collapse:H,coverStart:G,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),C=i.node,H=i.start,G=i.end,X=i.collapse,Y;if(C.nodeType==3){for(var se=0;se<4;se++){for(;H&&Ie(t.line.text.charAt(i.coverStart+H));)--H;for(;i.coverStart+G<i.coverEnd&&Ie(t.line.text.charAt(i.coverStart+G));)++G;if(W&&B<9&&H==0&&G==i.coverEnd-i.coverStart?Y=C.parentNode.getBoundingClientRect():Y=jo(m(C,H,G).getClientRects(),n),Y.left||Y.right||H==0)break;G=H,H=H-1,X="right"}W&&B<11&&(Y=Wo(e.display.measure,Y))}else{H>0&&(X=n="right");var ue;e.options.lineWrapping&&(ue=C.getClientRects()).length>1?Y=ue[n=="right"?ue.length-1:0]:Y=C.getBoundingClientRect()}if(W&&B<9&&!H&&(!Y||!Y.left&&!Y.right)){var Te=C.parentNode.getClientRects()[0];Te?Y={left:Te.left,right:Te.left+Lr(e.display),top:Te.top,bottom:Te.bottom}:Y=ns}for(var be=Y.top-t.rect.top,Ce=Y.bottom-t.rect.top,Me=(be+Ce)/2,Be=t.view.measure.heights,Ge=0;Ge<Be.length-1&&!(Me<Be[Ge]);Ge++);var Ze=Ge?Be[Ge-1]:0,ze=Be[Ge],et={left:(X=="right"?Y.right:Y.left)-t.rect.left,right:(X=="left"?Y.left:Y.right)-t.rect.left,top:Ze,bottom:ze};return!Y.left&&!Y.right&&(et.bogus=!0),e.options.singleCursorHeightPerLine||(et.rtop=be,et.rbottom=Ce),et}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Bt(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,E(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&&s?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return g&&s?-(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 C=pa(t);r.top+=C,r.bottom+=C}if(n=="line")return r;n||(n="local");var H=On(t);if(n=="local"?H+=Fi(e.display):H-=e.display.viewOffset,n=="page"||n=="window"){var G=e.display.lineSpace.getBoundingClientRect();H+=G.top+(n=="window"?0:os());var X=G.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 C=e.display.sizer.getBoundingClientRect();n+=C.left,i+=C.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=rt(e.doc,t.line)),Ui(e,n,ts(e,n,t.ch,i),r)}function An(e,t,r,n,i,C){n=n||rt(e.doc,t.line),i||(i=Ar(e,n));function H(Ce,Me){var Be=Dn(e,i,Ce,Me?"right":"left",C);return Me?Be.left=Be.right:Be.right=Be.left,Ui(e,n,Be,r)}var G=je(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"),!G)return H(Y=="before"?X-1:X,Y=="before");function se(Ce,Me,Be){var Ge=G[Me],Ze=Ge.level==1;return H(Be?Ce-1:Ce,Ze!=Be)}var ue=We(G,X,Y),Te=Xe,be=se(X,ue,Y=="before");return Te!=null&&(be.other=se(X,Te,Y!="before")),be}function us(e,t){var r=0;t=pt(e.doc,t),e.options.lineWrapping||(r=Lr(e.display)*t.ch);var n=rt(e.doc,t.line),i=On(n)+Fi(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function ga(e,t,r,n,i){var C=Fe(e,t,r);return C.xRel=i,n&&(C.outside=n),C}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=En(n,r),C=n.first+n.size-1;if(i>C)return ga(n.first+n.size-1,rt(n,C).text.length,null,1,1);t<0&&(t=0);for(var H=rt(n,i);;){var G=Ko(e,H,i,t,r),X=Sr(H,G.ch+(G.xRel>0||G.outside>0?1:0));if(!X)return G;var Y=X.find(1);if(Y.line==i)return Y;H=rt(n,i=Y.line)}}function ds(e,t,r,n){n-=pa(t);var i=t.text.length,C=Ye(function(H){return Dn(e,r,H-1).bottom<=n},i,0);return i=Ye(function(H){return Dn(e,r,H).top>n},C,i),{begin:C,end:i}}function cs(e,t,r,n){r||(r=Ar(e,t));var i=Ui(e,t,Dn(e,r,n),"line").top;return ds(e,t,r,i)}function _a(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function Ko(e,t,r,n,i){i-=On(t);var C=Ar(e,t),H=pa(t),G=0,X=t.text.length,Y=!0,se=je(t,e.doc.direction);if(se){var ue=(e.options.lineWrapping?zo:Go)(e,t,r,C,se,n,i);Y=ue.level!=1,G=Y?ue.from:ue.to-1,X=Y?ue.to:ue.from-1}var Te=null,be=null,Ce=Ye(function(ut){var ot=Dn(e,C,ut);return ot.top+=H,ot.bottom+=H,_a(ot,n,i,!1)?(ot.top<=i&&ot.left<=n&&(Te=ut,be=ot),!0):!1},G,X),Me,Be,Ge=!1;if(be){var Ze=n-be.left<be.right-n,ze=Ze==Y;Ce=Te+(ze?0:1),Be=ze?"after":"before",Me=Ze?be.left:be.right}else{!Y&&(Ce==X||Ce==G)&&Ce++,Be=Ce==0?"after":Ce==t.text.length?"before":Dn(e,C,Ce-(Y?1:0)).bottom+H<=i==Y?"after":"before";var et=An(e,Fe(r,Ce,Be),"line",t,C);Me=et.left,Ge=i<et.top?-1:i>=et.bottom?1:0}return Ce=Le(t.text,Ce,1),ga(r,Ce,Be,Ge,n-Me)}function Go(e,t,r,n,i,C,H){var G=Ye(function(ue){var Te=i[ue],be=Te.level!=1;return _a(An(e,Fe(r,be?Te.to:Te.from,be?"before":"after"),"line",t,n),C,H,!0)},0,i.length-1),X=i[G];if(G>0){var Y=X.level!=1,se=An(e,Fe(r,Y?X.from:X.to,Y?"after":"before"),"line",t,n);_a(se,C,H,!0)&&se.top>H&&(X=i[G-1])}return X}function zo(e,t,r,n,i,C,H){var G=ds(e,t,n,H),X=G.begin,Y=G.end;/\s/.test(t.text.charAt(Y-1))&&Y--;for(var se=null,ue=null,Te=0;Te<i.length;Te++){var be=i[Te];if(be.from>=Y||be.to<=X)continue;var Ce=be.level!=1,Me=Dn(e,n,Ce?Math.min(Y,be.to)-1:Math.max(X,be.from)).right,Be=Me<C?C-Me+1e9:Me-C;(!se||ue>Be)&&(se=be,ue=Be)}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=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)or.appendChild(document.createTextNode("x")),or.appendChild(u("br"));or.appendChild(document.createTextNode("x"))}_(e.measure,or);var r=or.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),E(e.measure),r||1}function Lr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),r=u("pre",[t],"CodeMirror-line-like");_(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ya(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,C=t.gutters.firstChild,H=0;C;C=C.nextSibling,++H){var G=e.display.gutterSpecs[H].className;r[G]=C.offsetLeft+C.clientLeft+i,n[G]=C.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/Lr(e.display)-3);return function(i){if(Cn(e.doc,i))return 0;var C=0;if(i.widgets)for(var H=0;H<i.widgets.length;H++)i.widgets[H].height&&(C+=i.widgets[H].height);return r?C+(Math.ceil(i.text.length/n)||1)*t:C+t}}function Ea(e){var t=e.doc,r=hs(e);t.iter(function(n){var i=r(n);i!=n.height&&rn(n,i)})}function lr(e,t,r,n){var i=e.display;if(!r&&ge(t).getAttribute("cm-not-content")=="true")return null;var C,H,G=i.lineSpace.getBoundingClientRect();try{C=t.clientX-G.left,H=t.clientY-G.top}catch(ue){return null}var X=va(e,C,H),Y;if(n&&X.xRel>0&&(Y=rt(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((C-qa(e.display).left)/Lr(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 on(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)en&&qr(e.doc,t)<i.viewTo&&Vn(e);else if(r<=i.viewFrom)en&&Gn(e.doc,r+n)>i.viewFrom?Vn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Vn(e);else if(t<=i.viewFrom){var C=Bi(e,r,r+n,1);C?(i.view=i.view.slice(C.index),i.viewFrom=C.lineN,i.viewTo+=n):Vn(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):Vn(e)}else{var G=Bi(e,t,t,-1),X=Bi(e,r,r+n,1);G&&X?(i.view=i.view.slice(0,G.index).concat(sn(e,G.lineN,X.lineN)).concat(i.view.slice(X.index)),i.viewTo+=n):Vn(e)}var Y=i.externalMeasured;Y&&(r<Y.lineN?Y.lineN+=n:t<Y.lineN+Y.size&&(i.externalMeasured=null))}function zn(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 C=n.view[ur(e,t)];if(C.node==null)return;var H=C.changes||(C.changes=[]);J(H,r)==-1&&H.push(r)}function Vn(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),C,H=e.display.view;if(!en||r==e.doc.first+e.doc.size)return{index:i,lineN:r};for(var G=e.display.viewFrom,X=0;X<i;X++)G+=H[X].size;if(G!=t){if(n>0){if(i==H.length-1)return null;C=G+H[i].size-t,i++}else C=G-t;t+=C,r+=C}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=sn(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=sn(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(sn(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(),C=n.selection=document.createDocumentFragment(),H=0;H<r.sel.ranges.length;H++){if(!t&&H==r.sel.primIndex)continue;var G=r.sel.ranges[H];if(G.from().line>=e.display.viewTo||G.to().line<e.display.viewFrom)continue;var X=G.empty();(X||e.options.showCursorWhenSelecting)&&ms(e,G.head,i),X||Xo(e,G,C)}return n}function ms(e,t,r){var n=An(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(u("div","\xA0","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var C=r.appendChild(u("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));C.style.display="",C.style.left=n.other.left+"px",C.style.top=n.other.top+"px",C.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,C=document.createDocumentFragment(),H=qa(e.display),G=H.left,X=Math.max(n.sizerWidth,sr(e)-n.sizer.offsetLeft)-H.right,Y=i.direction=="ltr";function se(ze,et,ut,ot){et<0&&(et=0),et=Math.round(et),ot=Math.round(ot),C.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+ze+`px;
top: `+et+"px; width: "+(ut==null?X-ze:ut)+`px;
height: `+(ot-et)+"px"))}function ue(ze,et,ut){var ot=rt(i,ze),gt=ot.text.length,It,Xt;function Pt(jt,dn){return ma(e,Fe(ze,jt),"div",ot,dn)}function fn(jt,dn,Qt){var Gt=cs(e,ot,null,jt),Ht=dn=="ltr"==(Qt=="after")?"left":"right",Ft=Qt=="after"?Gt.begin:Gt.end-(/\s/.test(ot.text.charAt(Gt.end-1))?2:1);return Pt(Ft,Ht)[Ht]}var un=je(ot,i.direction);return Qe(un,et||0,ut==null?gt:ut,function(jt,dn,Qt,Gt){var Ht=Qt=="ltr",Ft=Pt(jt,Ht?"left":"right"),cn=Pt(dn-1,Ht?"right":"left"),Wr=et==null&&jt==0,Zn=ut==null&&dn==gt,qt=Gt==0,kn=!un||Gt==un.length-1;if(cn.top-Ft.top<=3){var Yt=(Y?Wr:Zn)&&qt,Va=(Y?Zn:Wr)&&kn,Wn=Yt?G:(Ht?Ft:cn).left,pr=Va?X:(Ht?cn:Ft).right;se(Wn,Ft.top,pr-Wn,Ft.bottom)}else{var mr,nn,Kr,Xa;Ht?(mr=Y&&Wr&&qt?G:Ft.left,nn=Y?X:fn(jt,Qt,"before"),Kr=Y?G:fn(dn,Qt,"after"),Xa=Y&&Zn&&kn?X:cn.right):(mr=Y?fn(jt,Qt,"before"):G,nn=!Y&&Wr&&qt?X:Ft.right,Kr=!Y&&Zn&&kn?G:cn.left,Xa=Y?fn(dn,Qt,"after"):X),se(mr,Ft.top,nn-mr,Ft.bottom),Ft.bottom<cn.top&&se(G,Ft.bottom,null,cn.top),se(Kr,cn.top,Xa-Kr,cn.bottom)}(!It||ji(Ft,It)<0)&&(It=Ft),ji(cn,It)<0&&(It=cn),(!Xt||ji(Ft,Xt)<0)&&(Xt=Ft),ji(cn,Xt)<0&&(Xt=cn)}),{start:It,end:Xt}}var Te=t.from(),be=t.to();if(Te.line==be.line)ue(Te.line,Te.ch,be.ch);else{var Ce=rt(i,Te.line),Me=rt(i,be.line),Be=mn(Ce)==mn(Me),Ge=ue(Te.line,Te.ch,Be?Ce.text.length+1:null).end,Ze=ue(be.line,Be?0:null,be.ch).start;Be&&(Ge.top<Ze.top-2?(se(Ge.right,Ge.top,null,Ge.bottom),se(G,Ze.top,Ze.left,Ze.bottom)):se(Ge.right,Ge.top,Ze.left-Ge.right,Ge.bottom)),Ge.bottom<Ze.top&&se(G,Ge.bottom,null,Ze.top)}r.appendChild(C)}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()||Cr(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,Cr(e))},100)}function xa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(xe(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 Cr(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(xe(e,"blur",e,t),e.state.focused=!1,T(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],C=e.options.lineWrapping,H=void 0,G=0;if(i.hidden)continue;if(W&&B<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,!C&&i.text.firstChild&&(G=i.text.firstChild.getBoundingClientRect().right-Y.left-1)}var se=i.line.height-H;if((se>.005||se<-.005)&&(rn(i.line,H),_s(i.line),i.rest))for(var ue=0;ue<i.rest.length;ue++)_s(i.rest[ue]);if(G>e.display.sizerWidth){var Te=Math.ceil(G/Lr(e.display));Te>e.display.maxLineLength&&(e.display.maxLineLength=Te,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function _s(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function Wi(e,t,r){var n=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Fi(e));var i=r&&r.bottom!=null?r.bottom:n+e.wrapper.clientHeight,C=En(t,n),H=En(t,i);if(r&&r.ensure){var G=r.ensure.from.line,X=r.ensure.to.line;G<C?(C=G,H=En(t,On(rt(t,G))+e.wrapper.clientHeight)):Math.min(X,t.lastLine())>=H&&(C=En(t,On(rt(t,X))-e.wrapper.clientHeight),H=X)}return{from:C,to:Math.max(H,C+1)}}function Yo(e,t){if(Pe(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&&!o){var C=u("div","\u200B",null,`position: absolute;
top: `+(t.top-r.viewOffset-Fi(e.display))+`px;
height: `+(t.bottom-t.top+In(e)+r.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(C),C.scrollIntoView(i),e.display.lineSpace.removeChild(C)}}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 C=0;C<5;C++){var H=!1,G=An(e,t),X=!r||r==t?G:An(e,r);i={left:Math.min(G.left,X.left),top:Math.min(G.top,X.top)-n,right:Math.max(G.left,X.left),bottom:Math.max(G.bottom,X.bottom)+n};var Y=wa(e,i),se=e.doc.scrollTop,ue=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-ue)>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,C=ha(e),H={};t.bottom-t.top>C&&(t.bottom=t.top+C);var G=e.doc.height+ca(r),X=t.top<n,Y=t.bottom>G-n;if(t.top<i)H.scrollTop=X?0:t.top;else if(t.bottom>i+C){var se=Math.min(t.top,(Y?G:t.bottom)-C);se!=i&&(H.scrollTop=se)}var ue=e.options.fixedGutter?0:r.gutters.offsetWidth,Te=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-ue,be=sr(e)-r.gutters.offsetWidth,Ce=t.right-t.left>be;return Ce&&(t.right=t.left+be),t.left<10?H.scrollLeft=0:t.left<Te?H.scrollLeft=Math.max(0,t.left+ue-(Ce?0:10)):t.right>be+Te-3&&(H.scrollLeft=t.right+(Ce?0:10)-be),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);ys(e,r,n,t.margin)}}function ys(e,t,r,n){var i=wa(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});oi(e,i.scrollLeft,i.scrollTop)}function li(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;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+In(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var cr=function(e,t,r){this.cm=r;var n=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),Se(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Se(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&B<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 C=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+C)+"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 K,this.disableVert=new K},cr.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var i=e.getBoundingClientRect(),C=r=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);C!=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&&T(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),Se(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},yn(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 C=0;C<t.length;C++)rl(t[C]);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+In(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&&La(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&gs(e.cm)}function il(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&ws(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&bs(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&dr(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$o(t,pt(n,e.scrollToPos.from),pt(n,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,i)}var C=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(C)for(var G=0;G<C.length;++G)C[G].lines.length||xe(C[G],"hide");if(H)for(var X=0;X<H.length;++X)H[X].lines.length&&xe(H[X],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&xe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function hn(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 tn(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,L(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=Tn(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(C){if(n.line>=e.display.viewFrom){var H=C.styles,G=C.text.length>e.options.maxHighlightLength?Wt(t.mode,n.state):null,X=Vr(e,C,n,!0);G&&(n.state=G),C.styles=X.styles;var Y=C.styleClasses,se=X.classes;se?C.styleClasses=se:Y&&(C.styleClasses=null);for(var ue=!H||H.length!=C.styles.length||Y!=se&&(!Y||!se||Y.bgClass!=se.bgClass||Y.textClass!=se.textClass),Te=0;!ue&&Te<H.length;++Te)ue=H[Te]!=C.styles[Te];ue&&i.push(n.line),C.stateAfter=n.save(),n.nextLine()}else C.text.length<=e.options.maxHighlightLength&&Xr(e,C.text,n),C.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&&hn(e,function(){for(var C=0;C<i.length;C++)zn(e,i[C],"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=ya(e),this.events=[]};Gi.prototype.signal=function(e,t){le(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)xe.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=In(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=In(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=P();if(!t||!b(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&b(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&&b(document.body,e.anchorNode)&&b(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 Vn(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)&&(Vn(e),t.dims=ya(e));var i=n.first+n.size,C=Math.max(t.visible.from-e.options.viewportMargin,n.first),H=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<C&&C-r.viewFrom<20&&(C=Math.max(n.first,r.viewFrom)),r.viewTo>H&&r.viewTo-H<20&&(H=Math.min(i,r.viewTo)),en&&(C=qr(e.doc,C),H=Gn(e.doc,H));var G=C!=r.viewFrom||H!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vo(e,C,H),r.viewOffset=On(rt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var X=fs(e);if(!G&&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),E(r.cursorDiv),E(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,G&&(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),La(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function 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),La(e,n),r.finish()}}function ul(e,t,r){var n=e.display,i=e.options.lineNumbers,C=n.lineDiv,H=C.firstChild;function G(Ce){var Me=Ce.nextSibling;return k&&l&&e.display.currentWheelTarget==Ce?Ce.style.display="none":Ce.parentNode.removeChild(Ce),Me}for(var X=n.view,Y=n.viewFrom,se=0;se<X.length;se++){var ue=X[se];if(!ue.hidden)if(!ue.node||ue.node.parentNode!=C){var Te=No(e,ue,Y,r);C.insertBefore(Te,H)}else{for(;H!=ue.node;)H=G(H);var be=i&&t!=null&&t<=Y&&ue.lineNumber;ue.changes&&(J(ue.changes,"gutter")>-1&&(be=!1),Ya(e,ue,Y,r)),be&&(E(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(vr(e.options,Y)))),H=ue.node.nextSibling}Y+=ue.size}for(;H;)H=G(H)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function La(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+In(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,C=n+"px",H=0;H<r.length;H++)if(!r[H].hidden){e.options.fixedGutter&&(r[H].gutter&&(r[H].gutter.style.left=C),r[H].gutterBackground&&(r[H].gutterBackground.style.left=C));var G=r[H].alignable;if(G)for(var X=0;X<G.length;X++)G[X].style.left=C}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(u("div",[u("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),C=i.firstChild.offsetWidth,H=i.offsetWidth-C;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(C,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 Ca(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var C=e[i],H=null;if(typeof C!="string"&&(H=C.style,C=C.className),C=="CodeMirror-linenumbers")if(t)n=!0;else continue;r.push({className:C,style:H})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function As(e){var t=e.gutters,r=e.gutterSpecs;E(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var i=r[n],C=i.className,H=i.style,G=t.appendChild(u("div",null,"CodeMirror-gutter "+C));H&&(G.style.cssText=H),C=="CodeMirror-linenumbers"&&(e.lineGutter=G,G.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Ra(e)}function hi(e){As(e.display),on(e),Ss(e)}function dl(e,t,r,n){var i=this;this.input=r,i.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=u("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=y("div",null,"CodeMirror-code"),i.selectionDiv=u("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=u("div",null,"CodeMirror-cursors"),i.measure=u("div",null,"CodeMirror-measure"),i.lineMeasure=u("div",null,"CodeMirror-measure"),i.lineSpace=y("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var C=y("div",[i.lineSpace],"CodeMirror-lines");i.mover=u("div",[C],null,"position: relative"),i.sizer=u("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=u("div",null,null,"position: absolute; height: "+ee+"px; width: 1px;"),i.gutters=u("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=u("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=u("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),W&&B<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=Ca(n.gutters,n.lineNumbers),As(i),r.init(i)}var zi=0,gn=null;W?gn=-.53:D?gn=15:g?gn=-.7:f&&(gn=-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*=gn,t.y*=gn,t}function Ls(e,t){var r=Rs(t),n=r.x,i=r.y,C=e.display,H=C.scroller,G=H.scrollWidth>H.clientWidth,X=H.scrollHeight>H.clientHeight;if(!(n&&G||i&&X))return;if(i&&l&&k){e:for(var Y=t.target,se=C.view;Y!=H;Y=Y.parentNode)for(var ue=0;ue<se.length;ue++)if(se[ue].node==Y){e.display.currentWheelTarget=Y;break e}}if(n&&!D&&!p&&gn!=null){i&&X&&li(e,Math.max(0,H.scrollTop+i*gn)),dr(e,Math.max(0,H.scrollLeft+n*gn)),(!i||i&&X)&&Q(t),C.wheelStartX=null;return}if(i&&gn!=null){var Te=i*gn,be=e.doc.scrollTop,Ce=be+C.wrapper.clientHeight;Te<0?be=Math.max(0,be+Te-50):Ce=Math.min(e.doc.height,Ce+Te+50),Aa(e,{top:be,bottom:Ce})}zi<20&&(C.wheelStartX==null?(C.wheelStartX=H.scrollLeft,C.wheelStartY=H.scrollTop,C.wheelDX=n,C.wheelDY=i,setTimeout(function(){if(C.wheelStartX==null)return;var Me=H.scrollLeft-C.wheelStartX,Be=H.scrollTop-C.wheelStartY,Ge=Be&&C.wheelDY&&Be/C.wheelDY||Me&&C.wheelDX&&Me/C.wheelDX;if(C.wheelStartX=C.wheelStartY=null,!Ge)return;gn=(gn*zi+Ge)/(zi+1),++zi},200)):(C.wheelDX+=n,C.wheelDY+=i))}var vn=function(e,t){this.ranges=e,this.primIndex=t};vn.prototype.primary=function(){return this.ranges[this.primIndex]},vn.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},vn.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Rt(_r(this.ranges[t].anchor),_r(this.ranges[t].head));return new vn(e,this.primIndex)},vn.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},vn.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(ht(t,n.from())>=0&&ht(e,n.to())<=0)return r}return-1};var Rt=function(e,t){this.anchor=e,this.head=t};Rt.prototype.from=function(){return er(this.anchor,this.head)},Rt.prototype.to=function(){return yr(this.anchor,this.head)},Rt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Rn(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(Te,be){return ht(Te.from(),be.from())}),r=J(t,i);for(var C=1;C<t.length;C++){var H=t[C],G=t[C-1],X=ht(G.to(),H.from());if(n&&!H.empty()?X>0:X>=0){var Y=er(G.from(),H.from()),se=yr(G.to(),H.to()),ue=G.empty()?H.from()==H.head:G.from()==G.head;C<=r&&--r,t.splice(--C,2,new Rt(ue?se:Y,ue?Y:se))}}return new vn(t,r)}function Xn(e,t){return new vn([new Rt(e,t||e)],0)}function Yn(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 Cs(e,t){if(ht(e,t.from)<0)return e;if(ht(e,t.to)<=0)return Yn(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+=Yn(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 Rt(Cs(i.anchor,t),Cs(i.head,t)))}return Rn(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),C=i,H=0;H<t.length;H++){var G=t[H],X=Is(G.from,i,C),Y=Is(Yn(G),i,C);if(i=G.to,C=Y,r=="around"){var se=e.sel.ranges[H],ue=ht(se.head,se.anchor)<0;n[H]=new Rt(ue?Y:X,ue?X:Y)}else n[H]=new Rt(X,X)}return new vn(n,e.sel.primIndex)}function Da(e){e.doc.mode=mt(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&&on(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(Ze){return r?r[Ze]:null}function C(Ze,ze,et){ua(Ze,ze,et,n),$t(Ze,"change",Ze,t)}function H(Ze,ze){for(var et=[],ut=Ze;ut<ze;++ut)et.push(new ar(Y[ut],i(ut),n));return et}var G=t.from,X=t.to,Y=t.text,se=rt(e,G.line),ue=rt(e,X.line),Te=$(Y),be=i(Y.length-1),Ce=X.line-G.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 Me=H(0,Y.length-1);C(ue,ue.text,be),Ce&&e.remove(G.line,Ce),Me.length&&e.insert(G.line,Me)}else if(se==ue)if(Y.length==1)C(se,se.text.slice(0,G.ch)+Te+se.text.slice(X.ch),be);else{var Be=H(1,Y.length-1);Be.push(new ar(Te+se.text.slice(X.ch),be,n)),C(se,se.text.slice(0,G.ch)+Y[0],i(0)),e.insert(G.line+1,Be)}else if(Y.length==1)C(se,se.text.slice(0,G.ch)+Y[0]+ue.text.slice(X.ch),i(0)),e.remove(G.line+1,Ce);else{C(se,se.text.slice(0,G.ch)+Y[0],i(0)),C(ue,Te+ue.text.slice(X.ch),be);var Ge=H(1,Y.length-1);Ce>1&&e.remove(G.line+1,Ce-1),e.insert(G.line+1,Ge)}$t(e,"change",e,t)}function $n(e,t,r){function n(i,C,H){if(i.linked)for(var G=0;G<i.linked.length;++G){var X=i.linked[G];if(X.doc==C)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),Ps(e),e.options.lineWrapping||Ni(e),e.options.mode=t.modeOption,on(e)}function Ps(e){(e.doc.direction=="rtl"?I:T)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){hn(e,function(){Ps(e),on(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 Pa(e,t){var r={from:_r(t.from),to:Yn(t),text:Pn(e,t.from,t.to)};return Fs(e,r,t.from.line,t.to.line+1),$n(e,function(n){return Fs(n,r,t.from.line,t.to.line+1)},!0),r}function Ms(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ms(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 C=+new Date,H,G;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>C-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(i,i.lastOp==n)))G=$(H.changes),ht(t.from,t.to)==0&&ht(t.from,G.to)==0?G.to=Yn(t):H.changes.push(Pa(e,t));else{var X=$(i.done);for((!X||!X.ranges)&&Xi(e.sel,i.done),H={changes:[Pa(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=C,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,G||xe(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,C=n&&n.origin;r==i.lastSelOp||C&&i.lastSelOrigin==C&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==C||ml(e,C,$(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=C,i.lastSelOp=r,n&&n.clearRedo!==!1&&Ms(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],C=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]={}))[C]=H.markedSpans),++C})}function vl(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function _l(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(vl(r[i]));return n}function Us(e,t){var r=_l(e,t),n=Tr(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var C=r[i],H=n[i];if(C&&H){e:for(var G=0;G<H.length;++G){for(var X=H[G],Y=0;Y<C.length;++Y)if(C[Y].marker==X.marker)continue e;C.push(X)}}else H&&(r[i]=H)}return r}function kr(e,t,r){for(var n=[],i=0;i<e.length;++i){var C=e[i];if(C.ranges){n.push(r?vn.prototype.deepCopy.call(C):C);continue}var H=C.changes,G=[];n.push({changes:G});for(var X=0;X<H.length;++X){var Y=H[X],se=void 0;if(G.push({from:Y.from,to:Y.to,text:Y.text}),t)for(var ue in Y)(se=ue.match(/^spans_(\d+)$/))&&(J(t,Number(se[1]))>-1&&($(G)[ue]=Y[ue],delete Y[ue]))}}return n}function Ma(e,t,r,n){if(n){var i=e.anchor;if(r){var C=ht(t,i)<0;C!=ht(r,i)<0?(i=t,t=r):C!=ht(t,r)<0&&(t=r)}return new Rt(i,t)}else return new Rt(r||t,t)}function Yi(e,t,r,n,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Zt(e,new vn([Ma(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),C=0;C<e.sel.ranges.length;C++)n[C]=Ma(e.sel.ranges[C],t[C],null,i);var H=Rn(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,Rn(e.cm,i,e.sel.primIndex),n)}function js(e,t,r,n){Zt(e,Xn(t,r),n)}function yl(e,t,r){var n={ranges:t.ranges,update:function(i){this.ranges=[];for(var C=0;C<i.length;C++)this.ranges[C]=new Rt(pt(e,i[C].anchor),pt(e,i[C].head))},origin:r&&r.origin};return xe(e,"beforeSelectionChange",e,n),e.cm&&xe(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Rn(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){(le(e,"beforeSelectionChange")||e.cm&&le(e.cm,"beforeSelectionChange"))&&(t=yl(e,t,r));var n=r&&r.bias||(ht(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,_e(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,C=0;C<t.ranges.length;C++){var H=t.ranges[C],G=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[C],X=Qi(e,H.anchor,G&&G.anchor,r,n),Y=Qi(e,H.head,G&&G.head,r,n);(i||X!=H.anchor||Y!=H.head)&&(i||(i=t.ranges.slice(0,C)),i[C]=new Rt(X,Y))}return i?Rn(e.cm,i,t.primIndex):t}function Pr(e,t,r,n,i){var C=rt(e,t.line);if(C.markedSpans)for(var H=0;H<C.markedSpans.length;++H){var G=C.markedSpans[H],X=G.marker,Y="selectLeft"in X?!X.selectLeft:X.inclusiveLeft,se="selectRight"in X?!X.selectRight:X.inclusiveRight;if((G.from==null||(Y?G.from<=t.ch:G.from<t.ch))&&(G.to==null||(se?G.to>=t.ch:G.to>t.ch))){if(i&&(xe(X,"beforeCursorEnter"),X.explicitlyCleared))if(C.markedSpans){--H;continue}else break;if(!X.atomic)continue;if(r){var ue=X.find(n<0?1:-1),Te=void 0;if((n<0?se:Y)&&(ue=zs(e,ue,-n,ue&&ue.line==t.line?C:null)),ue&&ue.line==t.line&&(Te=ht(ue,r))&&(n<0?Te<0:Te>0))return Pr(e,ue,t,n,i)}var be=X.find(n<0?-1:1);return(n<0?Y:se)&&(be=zs(e,be,n,be.line==t.line?C:null)),be?Pr(e,be,t,n,i):null}}return t}function Qi(e,t,r,n,i){var C=n||1,H=Pr(e,t,r,C,i)||!i&&Pr(e,t,r,C,!0)||Pr(e,t,r,-C,i)||!i&&Pr(e,t,r,-C,!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?pt(e,Fe(t.line-1)):null:r>0&&t.ch==(n||rt(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+r)}function Vs(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),de)}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,C,H,G){i&&(n.from=pt(e,i)),C&&(n.to=pt(e,C)),H&&(n.text=H),G!==void 0&&(n.origin=G)}),xe(e,"beforeChange",e,n),e.cm&&xe(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 Mr(e,t,r){if(e.cm){if(!e.cm.curOp)return zt(e.cm,Mr)(e,t,r);if(e.cm.state.suppressEdits)return}if((le(e,"beforeChange")||e.cm&&le(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]==""&&ht(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=[];$n(e,function(i,C){!C&&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,C,H=e.sel,G=t=="undo"?i.done:i.undone,X=t=="undo"?i.undone:i.done,Y=0;Y<G.length&&!(C=G[Y],r?C.ranges&&!C.equals(e.sel):!C.ranges);Y++);if(Y==G.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(C=G.pop(),C.ranges){if(Xi(C,X),r&&!C.equals(e.sel)){Zt(e,C,{clearRedo:!1});return}H=C}else if(n){G.push(C);return}else break;var se=[];Xi(H,X),X.push({changes:se,generation:i.generation}),i.generation=C.generation||++i.maxGeneration;for(var ue=le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"),Te=function(Me){var Be=C.changes[Me];if(Be.origin=t,ue&&!Xs(e,Be,!1))return G.length=0,{};se.push(Pa(e,Be));var Ge=Me?Ia(e,Be):$(G);pi(e,Be,Ge,Us(e,Be)),!Me&&e.cm&&e.cm.scrollIntoView({from:Be.from,to:Yn(Be)});var Ze=[];$n(e,function(ze,et){!et&&J(Ze,ze.history)==-1&&(Zs(ze.history,Be),Ze.push(ze.history)),pi(ze,Be,null,Us(ze,Be))})},be=C.changes.length-1;be>=0;--be){var Ce=Te(be);if(Ce)return Ce.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new vn(ie(e.sel.ranges,function(i){return new Rt(Fe(i.anchor.line+t,i.anchor.ch),Fe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){on(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)zn(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 C=e.lastLine();t.to.line>C&&(t={from:t.from,to:Fe(C,rt(e,C).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,de),e.cantEdit&&Qi(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,r){var n=e.doc,i=e.display,C=t.from,H=t.to,G=!1,X=C.line;e.options.lineWrapping||(X=St(mn(rt(n,C.line))),n.iter(X,H.line+1,function(be){if(be==i.maxLine)return G=!0,!0})),n.sel.contains(t.from,t.to)>-1&&_e(e),ka(n,t,r,hs(e)),e.options.lineWrapping||(n.iter(X,C.line+t.text.length,function(be){var Ce=ti(be);Ce>i.maxLineLength&&(i.maxLine=be,i.maxLineLength=Ce,i.maxLineChanged=!0,G=!1)}),G&&(e.curOp.updateMaxLine=!0)),aa(n,C.line),ci(e,400);var Y=t.text.length-(H.line-C.line)-1;t.full?on(e):C.line==H.line&&t.text.length==1&&!Ds(e.doc,t)?zn(e,C.line,"text"):on(e,C.line,H.line+1,Y);var se=le(e,"changes"),ue=le(e,"change");if(ue||se){var Te={from:C,to:H,text:t.text,removed:t.removed,origin:t.origin};ue&&$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 C;n||(n=r),ht(n,r)<0&&(C=[n,r],r=C[0],n=C[1]),typeof t=="string"&&(t=e.splitLines(t)),Mr(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 C=e[i],H=!0;if(C.ranges){C.copied||(C=e[i]=C.deepCopy(),C.copied=!0);for(var G=0;G<C.ranges.length;G++)Qs(C.ranges[G].anchor,t,r,n),Qs(C.ranges[G].head,t,r,n);continue}for(var X=0;X<C.changes.length;++X){var Y=C.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,C=t;return typeof t=="number"?C=rt(e,br(e,t)):i=St(t),i==null?null:(n(C,i)&&e.cm&&zn(e.cm,i,r),C)}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,it(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 C=Math.min(t,i-e),H=n.height;if(n.removeInner(e,C),this.height-=H-n.height,i==C&&(this.children.splice(r--,1),n.parent=null),(t-=C)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof gi))){var G=[];this.collapse(G),this.children=[new gi(G)],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],C=i.chunkSize();if(e<=C){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var H=i.lines.length%25+25,G=H;G<i.lines.length;){var X=new gi(i.lines.slice(G,G+=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-=C}},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],C=i.chunkSize();if(e<C){var H=Math.min(t,C-e);if(i.iterN(e,H,r))return!0;if((t-=H)==0)break;e=0}else e-=C}}};var _i=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};_i.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=St(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 C=ii(this);rn(r,Math.max(0,r.height-C)),e&&(hn(e,function(){qs(e,r,-C),zn(e,n,"widget")}),$t(e,"lineWidgetCleared",e,this,n))},_i.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=ii(this)-t;if(!i)return;Cn(this.doc,n)||rn(n,n.height+i),r&&hn(r,function(){r.curOp.forceUpdate=!0,qs(r,n,i),$t(r,"lineWidgetChanged",r,e,St(n))})},fe(_i);function qs(e,t,r){On(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,r)}function El(e,t,r,n){var i=new _i(e,r,n),C=e.cm;return C&&i.noHScroll&&(C.display.alignWidgets=!0),mi(e,t,"widget",function(H){var G=H.widgets||(H.widgets=[]);if(i.insertAt==null?G.push(i):G.splice(Math.min(G.length-1,Math.max(0,i.insertAt)),0,i),i.line=H,C&&!Cn(e,H)){var X=On(H)<e.scrollTop;rn(H,H.height+ii(i)),X&&Sa(C,i.height),C.curOp.forceUpdate=!0}return!0}),C&&$t(C,"lineWidgetAdded",C,i,typeof t=="number"?t:St(t)),i}var eo=0,Qn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Qn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&hr(e),le(this,"clear")){var r=this.find();r&&$t(this,"clear",r.from,r.to)}for(var n=null,i=null,C=0;C<this.lines.length;++C){var H=this.lines[C],G=Sn(H.markedSpans,this);e&&!this.collapsed?zn(e,St(H),"text"):e&&(G.to!=null&&(i=St(H)),G.from!=null&&(n=St(H))),H.markedSpans=Zr(H.markedSpans,G),G.from==null&&this.collapsed&&!Cn(this.doc,H)&&e&&rn(H,Rr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var X=0;X<this.lines.length;++X){var Y=mn(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&&on(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()},Qn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var C=this.lines[i],H=Sn(C.markedSpans,this);if(H.from!=null&&(r=Fe(t?C:St(C),H.from),e==-1))return r;if(H.to!=null&&(n=Fe(t?C:St(C),H.to),e==1))return n}return r&&{from:r,to:n}},Qn.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;if(!t||!n)return;hn(n,function(){var i=t.line,C=St(t.line),H=fa(n,C);if(H&&(is(H),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Cn(r.doc,i)&&r.height!=null){var G=r.height;r.height=null;var X=ii(r)-G;X&&rn(i,i.height+X)}$t(n,"markerChanged",n,e)})},Qn.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)},Qn.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(Qn);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 C=new Qn(e,i),H=ht(t,r);if(n&&v(n,C,!1),H>0||H==0&&C.clearWhenEmpty!==!1)return C;if(C.replacedWith&&(C.collapsed=!0,C.widgetNode=y("span",[C.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||C.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(C.widgetNode.insertLeft=!0)),C.collapsed){if(Pi(e,t.line,t,r,C)||t.line!=r.line&&Pi(e,r.line,t,r,C))throw new Error("Inserting collapsed marker partially overlapping an existing one");sa()}C.addToHistory&&Ns(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var G=t.line,X=e.cm,Y;if(e.iter(G,r.line+1,function(ue){X&&C.collapsed&&!X.options.lineWrapping&&mn(ue)==X.display.maxLine&&(Y=!0),C.collapsed&&G!=t.line&&rn(ue,0),oa(ue,new nr(C,G==t.line?t.ch:null,G==r.line?r.ch:null)),++G}),C.collapsed&&e.iter(t.line,r.line+1,function(ue){Cn(e,ue)&&rn(ue,0)}),C.clearOnEnter&&Se(C,"beforeCursorEnter",function(){return C.clear()}),C.readOnly&&(Kn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),C.collapsed&&(C.id=++eo,C.atomic=!0),X){if(Y&&(X.curOp.updateMaxLine=!0),C.collapsed)on(X,t.line,r.line+1);else if(C.className||C.startStyle||C.endStyle||C.css||C.attributes||C.title)for(var se=t.line;se<=r.line;se++)zn(X,se,"text");C.atomic&&Ks(X.doc),$t(X,"markerAdded",X,C)}return C}var yi=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};yi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();$t(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},fe(yi);function Tl(e,t,r,n,i){n=v(n),n.shared=!1;var C=[Fr(e,t,r,n,i)],H=C[0],G=n.widgetNode;return $n(e,function(X){G&&(n.widgetNode=G.cloneNode(!0)),C.push(Fr(X,pt(X,t),pt(X,r),n,i));for(var Y=0;Y<X.linked.length;++Y)if(X.linked[Y].isParent)return;H=$(C)}),new yi(C,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(),C=e.clipPos(i.from),H=e.clipPos(i.to);if(ht(C,H)){var G=Fr(e,C,H,n.primary,n.primary.type);n.markers.push(G),G.parent=n}}}function wl(e){for(var t=function(n){var i=e[n],C=[i.primary.doc];$n(i.primary.doc,function(X){return C.push(X)});for(var H=0;H<i.markers.length;H++){var G=i.markers[H];J(C,G.doc)==-1&&(G.parent=null,i.markers.splice(H--,1))}},r=0;r<e.length;r++)t(r)}var Sl=0,ln=function(e,t,r,n,i){if(!(this instanceof ln))return new ln(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 C=Fe(r,0);this.sel=Xn(C),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:C,to:C,text:e}),Zt(this,Xn(C),de)};ln.prototype=Ae(vi.prototype,{constructor:ln,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;Mr(this,{from:t,to:Fe(r,rt(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),Zt(this,Xn(t),de)}),replaceRange:function(e,t,r,n){t=pt(this,t),r=r?pt(this,r):t,Nr(this,e,t,r,n)},getRange:function(e,t,r){var n=Pn(this,pt(this,e),pt(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(Mn(this,e))return rt(this,e)},getLineNumber:function(e){return St(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=rt(this,e)),mn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return pt(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,pt(this,typeof e=="number"?Fe(e,t||0):e),null,r)}),setSelection:Vt(function(e,t,r){js(this,pt(this,e),pt(this,t||e),r)}),extendSelection:Vt(function(e,t,r){Yi(this,pt(this,e),t&&pt(this,t),r)}),extendSelections:Vt(function(e,t){Bs(this,Ue(this,e),t)}),extendSelectionsBy:Vt(function(e,t){var r=ie(this.sel.ranges,e);Bs(this,Ue(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 Rt(pt(this,e[i].anchor),pt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Zt(this,Rn(this.cm,n,t),r)}),addSelection:Vt(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Rt(pt(this,e),pt(this,t||e))),Zt(this,Rn(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,C=0;C<i.ranges.length;C++){var H=i.ranges[C];n[C]={from:H.from(),to:H.to(),text:this.splitLines(e[C]),origin:r}}for(var G=t&&t!="end"&&hl(this,n,t),X=n.length-1;X>=0;X--)Mr(this,n[X]);G?Hs(this,G):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),$n(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(!Mn(this,e))return null;if(t=e,e=rt(this,e),!e)return null}else if(t=St(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",C=n[i];if(C)if(r==null)n[i]=null;else{var H=C.match(S(r));if(!H)return!1;var G=H.index+H[0].length;n[i]=C.slice(0,H.index)+(!H.index||G==C.length?"":" ")+C.slice(G)||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,pt(this,e),pt(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=pt(this,e),Fr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=pt(this,e);var t=[],r=rt(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=pt(this,e),t=pt(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(C){var H=C.markedSpans;if(H)for(var G=0;G<H.length;G++){var X=H[G];!(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 C=i.text.length+n;if(C>e)return t=e,!0;e-=C,++r}),pt(this,Fe(r,t))},indexFromPos:function(e){e=pt(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 ln(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 ln(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 kt&&(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];$n(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){$n(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ct(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)})}),ln.prototype.eachLine=ln.prototype.iter;var no=0;function Ol(e){var t=this;if(ro(t),Pe(t,e)||jn(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,C=Array(i),H=0,G=function(){++H==i&&zt(t,function(){r=pt(t.doc,r);var be={from:r,to:r,text:t.doc.splitLines(C.filter(function(Ce){return Ce!=null}).join(t.doc.lineSeparator())),origin:"paste"};Mr(t.doc,be),Hs(t.doc,Xn(pt(t.doc,r),pt(t.doc,Yn(be))))})()},X=function(be,Ce){if(t.options.allowDropFileTypes&&J(t.options.allowDropFileTypes,be.type)==-1){G();return}var Me=new FileReader;Me.onerror=function(){return G()},Me.onload=function(){var Be=Me.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Be)){G();return}C[Ce]=Be,G()},Me.readAsText(be)},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 ue;if(t.state.draggingText&&!t.state.draggingText.copy&&(ue=t.listSelections()),$i(t.doc,Xn(r,r)),ue)for(var Te=0;Te<ue.length;++Te)Nr(t.doc,"",ue[Te].anchor,ue[Te].head,"drag");t.replaceSelection(se,"around","paste"),t.display.input.focus()}}catch(be){}}}function Al(e,t){if(W&&(!e.state.draggingText||+new Date-no<100)){oe(t);return}if(Pe(e,t)||jn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f){var r=u("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),p&&r.parentNode.removeChild(r)}}function 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=u("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),_(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 C=0;C<r.length;C++)e(r[C])})}var ao=!1;function Ll(){if(ao)return;Cl(),ao=!0}function Cl(){var e;Se(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,io(Il)},100))}),Se(window,"blur",function(){return io(Cr)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Jn={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++)Jn[bi+48]=Jn[bi+96]=String(bi);for(var Zi=65;Zi<=90;Zi++)Jn[Zi]=String.fromCharCode(Zi);for(var Ei=1;Ei<=12;Ei++)Jn[Ei+111]=Jn[Ei+63235]="F"+Ei;var Hn={};Hn.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"},Hn.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"},Hn.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"},Hn.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"]},Hn.default=l?Hn.macDefault:Hn.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,i,C,H=0;H<t.length-1;H++){var G=t[H];if(/^(cmd|meta|m)$/i.test(G))C=!0;else if(/^a(lt)?$/i.test(G))r=!0;else if(/^(c|ctrl|control)$/i.test(G))n=!0;else if(/^s(hift)?$/i.test(G))i=!0;else throw new Error("Unrecognized modifier name: "+G)}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),C&&(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=ie(r.split(" "),Dl),C=0;C<i.length;C++){var H=void 0,G=void 0;C==i.length-1?(G=i.join(" "),H=n):(G=i.slice(0,C+1).join(" "),H="...");var X=t[G];if(!X)t[G]=H;else if(X!=H)throw new Error("Inconsistent bindings for "+G)}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 C=0;C<t.fallthrough.length;C++){var H=Ur(e,t.fallthrough[C],r,n);if(H)return H}}}function so(e){var t=typeof e=="string"?e:Jn[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),(x?t.metaKey:t.ctrlKey)&&n!="Ctrl"&&(e="Ctrl-"+e),(x?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=Jn[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"?Hn[e]:e}function Br(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var C=t(r[i]);n.length&&ht(C.from,$(n).to)<=0;){var H=n.pop();if(ht(H.from,C.from)<0){C.from=H.from;break}}n.push(C)}hn(e,function(){for(var G=n.length-1;G>=0;G--)Nr(e.doc,"",n[G].from,n[G].to,"+delete");Ir(e)})}function Fa(e,t,r){var n=Le(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 C=je(r,t.doc.direction);if(C){var H=i<0?$(C):C[0],G=i<0==(H.level==1),X=G?"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 ue=Dn(t,se,Y).top;Y=Ye(function(Te){return Dn(t,se,Te).top==ue},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 Pl(e,t,r,n){var i=je(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 C=We(i,r.ch,r.sticky),H=i[C];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 G=function(Ge,Ze){return Fa(t,Ge instanceof Fe?Ge.ch:Ge,Ze)},X,Y=function(Ge){return e.options.lineWrapping?(X=X||Ar(e,t),cs(e,t,X,Ge)):{begin:0,end:t.text.length}},se=Y(r.sticky=="before"?G(r,-1):r.ch);if(e.doc.direction=="rtl"||H.level==1){var ue=H.level==1==n<0,Te=G(r,ue?1:-1);if(Te!=null&&(ue?Te<=H.to&&Te<=se.end:Te>=H.from&&Te>=se.begin)){var be=ue?"before":"after";return new Fe(r.line,Te,be)}}var Ce=function(Ge,Ze,ze){for(var et=function(It,Xt){return Xt?new Fe(r.line,G(It,1),"before"):new Fe(r.line,It,"after")};Ge>=0&&Ge<i.length;Ge+=Ze){var ut=i[Ge],ot=Ze>0==(ut.level!=1),gt=ot?ze.begin:G(ze.end,-1);if(ut.from<=gt&&gt<ut.to)return et(gt,ot);if(gt=ot?ut.from:G(ut.to,-1),ze.begin<=gt&&gt<ze.end)return et(gt,ot)}},Me=Ce(C+n,n,se);if(Me)return Me;var Be=n>0?se.end:G(se.begin,-1);return Be!=null&&!(n>0&&Be==t.text.length)&&(Me=Ce(n>0?0:i.length-1,n,Y(Be)),Me)?Me:null}var Ti={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),de)},killLine:function(e){return Br(e,function(t){if(t.empty()){var r=rt(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:pt(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 Ml(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")},ce)},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")},ce)},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},ce)},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 C=r[i].from(),H=j(e.getLine(C.line),C.ch,n);t.push(he(n-H%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return hn(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var i=t[n].head,C=rt(e.doc,i.line).text;if(C){if(i.ch==C.length&&(i=new Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(C.charAt(i.ch-1)+C.charAt(i.ch-2),Fe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var H=rt(e.doc,i.line-1).text;H&&(i=new Fe(i.line,1),e.replaceRange(C.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),Fe(i.line-1,H.length-1),i,"+transpose"))}}r.push(new Rt(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return hn(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=rt(e.doc,t),n=mn(r);return n!=r&&(t=St(n)),Ba(!0,e,n,t,1)}function Ml(e,t){var r=rt(e.doc,t),n=Mi(r);return n!=r&&(t=St(n)),Ba(!0,e,r,t,-1)}function co(e,t){var r=uo(e,t.line),n=rt(e.doc,r.line),i=je(n,e.doc.direction);if(!i||i[0].level==0){var C=Math.max(r.ch,n.text.search(/\S/)),H=t.line==r.line&&t.ch<=C&&t.ch;return Fe(r.line,H?0:C,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)!=ve}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 K;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(),Pe(t,e))return;W&&B<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)&&(T(t,"CodeMirror-crosshair"),Ke(document,"keyup",r),Ke(document,"mouseover",r))}Se(document,"keyup",r),Se(document,"mouseover",r)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),Pe(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(jn(t.display,e)||Pe(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&&ht(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(Pe(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,jn(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=Oe(e),C=n?Hl(n,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),n&&Wl(t,i,n,C,e))return;i==1?n?Gl(t,n,C,e):ge(e)==r.scroller&&Q(e):i==2?(n&&Yi(t.doc,n),setTimeout(function(){return r.input.focus()},20)):i==3&&(A?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,r,n,i){var C="Click";return n=="double"?C="Double"+C:n=="triple"&&(C="Triple"+C),C=(t==1?"Left":t==2?"Middle":"Right")+C,xi(e,oo(C,i),i,function(H){if(typeof H=="string"&&(H=Ti[H]),!H)return!1;var G=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),G=H(e,r)!=ve}finally{e.state.suppressEdits=!1}return G})}function Kl(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(i.unit==null){var C=h?r.shiftKey&&r.metaKey:r.altKey;i.unit=C?"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(L(gs,e),0):e.curOp.focus=P();var i=Kl(e,r,n),C=e.doc.sel,H;e.options.dragDrop&&De&&!e.isReadOnly()&&r=="single"&&(H=C.contains(t))>-1&&(ht((H=C.ranges[H]).from(),t)<0||t.xRel>0)&&(ht(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,C=!1,H=zt(e,function(Y){k&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ke(i.wrapper.ownerDocument,"mouseup",H),Ke(i.wrapper.ownerDocument,"mousemove",G),Ke(i.scroller,"dragstart",X),Ke(i.scroller,"drop",H),C||(Q(Y),n.addNew||Yi(e.doc,r,null,null,n.extend),k&&!f||W&&B==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),G=function(Y){C=C||Math.abs(t.clientX-Y.clientX)+Math.abs(t.clientY-Y.clientY)>=10},X=function(){return C=!0};k&&(i.scroller.draggable=!0),e.state.draggingText=H,H.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Se(i.wrapper.ownerDocument,"mouseup",H),Se(i.wrapper.ownerDocument,"mousemove",G),Se(i.scroller,"dragstart",X),Se(i.scroller,"drop",H),vs(e),setTimeout(function(){return i.input.focus()},20)}function _o(e,t,r){if(r=="char")return new Rt(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Rt(Fe(t.line,0),pt(e.doc,Fe(t.line+1,0)));var n=r(e,t);return new Rt(n.from,n.to)}function Vl(e,t,r,n){var i=e.display,C=e.doc;Q(t);var H,G,X=C.sel,Y=X.ranges;if(n.addNew&&!n.extend?(G=C.sel.contains(r),G>-1?H=Y[G]:H=new Rt(r,r)):(H=C.sel.primary(),G=C.sel.primIndex),n.unit=="rectangle")n.addNew||(H=new Rt(r,r)),r=lr(e,t,!0,!0),G=-1;else{var se=_o(e,r,n.unit);n.extend?H=Ma(H,se.anchor,se.head,n.extend):H=se}n.addNew?G==-1?(G=Y.length,Zt(C,Rn(e,Y.concat([H]),G),{scroll:!1,origin:"*mouse"})):Y.length>1&&Y[G].empty()&&n.unit=="char"&&!n.extend?(Zt(C,Rn(e,Y.slice(0,G).concat(Y.slice(G+1)),0),{scroll:!1,origin:"*mouse"}),X=C.sel):Na(C,G,H,me):(G=0,Zt(C,new vn([H],0),me),X=C.sel);var ue=r;function Te(ze){if(ht(ue,ze)==0)return;if(ue=ze,n.unit=="rectangle"){for(var et=[],ut=e.options.tabSize,ot=j(rt(C,r.line).text,r.ch,ut),gt=j(rt(C,ze.line).text,ze.ch,ut),It=Math.min(ot,gt),Xt=Math.max(ot,gt),Pt=Math.min(r.line,ze.line),fn=Math.min(e.lastLine(),Math.max(r.line,ze.line));Pt<=fn;Pt++){var un=rt(C,Pt).text,jt=pe(un,It,ut);It==Xt?et.push(new Rt(Fe(Pt,jt),Fe(Pt,jt))):un.length>jt&&et.push(new Rt(Fe(Pt,jt),Fe(Pt,pe(un,Xt,ut))))}et.length||et.push(new Rt(r,r)),Zt(C,Rn(e,X.ranges.slice(0,G).concat(et),G),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ze)}else{var dn=H,Qt=_o(e,ze,n.unit),Gt=dn.anchor,Ht;ht(Qt.anchor,Gt)>0?(Ht=Qt.head,Gt=er(dn.from(),Qt.anchor)):(Ht=Qt.anchor,Gt=yr(dn.to(),Qt.head));var Ft=X.ranges.slice(0);Ft[G]=Xl(e,new Rt(pt(C,Gt),Ht)),Zt(C,Rn(e,Ft,G),me)}}var be=i.wrapper.getBoundingClientRect(),Ce=0;function Me(ze){var et=++Ce,ut=lr(e,ze,!0,n.unit=="rectangle");if(!ut)return;if(ht(ut,ue)!=0){e.curOp.focus=P(),Te(ut);var ot=Wi(i,C);(ut.line>=ot.to||ut.line<ot.from)&&setTimeout(zt(e,function(){Ce==et&&Me(ze)}),150)}else{var gt=ze.clientY<be.top?-20:ze.clientY>be.bottom?20:0;gt&&setTimeout(zt(e,function(){if(Ce!=et)return;i.scroller.scrollTop+=gt,Me(ze)}),50)}}function Be(ze){e.state.selectingText=!1,Ce=Infinity,ze&&(Q(ze),i.input.focus()),Ke(i.wrapper.ownerDocument,"mousemove",Ge),Ke(i.wrapper.ownerDocument,"mouseup",Ze),C.history.lastSelOrigin=null}var Ge=zt(e,function(ze){ze.buttons===0||!Oe(ze)?Be(ze):Me(ze)}),Ze=zt(e,Be);e.state.selectingText=Ze,Se(i.wrapper.ownerDocument,"mousemove",Ge),Se(i.wrapper.ownerDocument,"mouseup",Ze)}function Xl(e,t){var r=t.anchor,n=t.head,i=rt(e.doc,r.line);if(ht(r,n)==0&&r.sticky==n.sticky)return t;var C=je(i);if(!C)return t;var H=We(C,r.ch,r.sticky),G=C[H];if(G.from!=r.ch&&G.to!=r.ch)return t;var X=H+(G.from==r.ch==(G.level!=1)?0:1);if(X==0||X==C.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=We(C,n.ch,n.sticky),ue=se-H||(n.ch-r.ch)*(G.level==1?-1:1);se==X-1||se==X?Y=ue<0:Y=ue>0}var Te=C[X+(Y?-1:0)],be=Y==(Te.level==1),Ce=be?Te.from:Te.to,Me=be?"after":"before";return r.ch==Ce&&r.sticky==Me?t:new Rt(new Fe(r.line,Ce,Me),n)}function yo(e,t,r,n){var i,C;if(t.touches)i=t.touches[0].clientX,C=t.touches[0].clientY;else try{i=t.clientX,C=t.clientY}catch(Te){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Q(t);var H=e.display,G=H.lineDiv.getBoundingClientRect();if(C>G.bottom||!le(e,r))return re(t);C-=G.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=En(e.doc,C),ue=e.display.gutterSpecs[X];return xe(e,r,e,se,ue.className,t),re(t)}}}function Wa(e,t){return yo(e,t,"gutterClick",!0)}function bo(e,t){if(jn(e.display,t)||Yl(e,t))return;if(Pe(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return le(e,"gutterContextMenu")?yo(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ai(e)}var jr={toString:function(){return"CodeMirror.Init"}},To={},ta={};function $l(e){var t=e.optionHandlers;function r(n,i,C,H){e.defaults[n]=i,C&&(t[n]=H?function(G,X,Y){Y!=jr&&C(G,X,Y)}:C)}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),on(n)},!0),r("lineSeparator",null,function(n,i){if(n.doc.lineSep=i,!i)return;var C=[],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,C.push(Fe(H,se))}H++});for(var G=C.length-1;G>=0;G--)Nr(n.doc,i,C[G],Fe(C[G].line,C[G].ch+i.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,i,C){n.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),C!=jr&&n.refresh()}),r("specialCharPlaceholder",Ct,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",!O),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Eo(n),hi(n)},!0),r("keyMap","default",function(n,i,C){var H=qi(i),G=C!=jr&&qi(C);G&&G.detach&&G.detach(n,H),H.attach&&H.attach(n,G||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Jl,!0),r("gutters",[],function(n,i){n.display.gutterSpecs=Ca(i,n.options.lineNumbers),hi(n)},!0),r("fixedGutter",!0,function(n,i){n.display.gutters.style.left=i?ba(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return 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=Ca(n.options.gutters,i),hi(n)},!0),r("firstLineNumber",1,hi,!0),r("lineNumberFormatter",function(n){return n},hi,!0),r("showCursorWhenSelecting",!1,si,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,i){i=="nocursor"&&(Cr(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,C=t?Se:Ke;C(e.display.scroller,"dragstart",i.start),C(e.display.scroller,"dragenter",i.enter),C(e.display.scroller,"dragover",i.over),C(e.display.scroller,"dragleave",i.leave),C(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):(T(e.display.wrapper,"CodeMirror-wrap"),Ni(e)),Ea(e),on(e),ai(e),setTimeout(function(){return Dr(e)},100)}function kt(e,t){var r=this;if(!(this instanceof kt))return new kt(e,t);this.options=t=t?v(t):{},v(To,t,!1);var n=t.value;typeof n=="string"?n=new ln(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new kt.inputStyles[t.inputStyle](this),C=this.display=new dl(e,n,i,t);C.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 K,keySeq:null,specialChars:null},t.autofocus&&!a&&C.input.focus(),W&&B<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Ll(),hr(this),this.curOp.forceUpdate=!0,ks(this,n),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&xa(r)},20):Cr(this);for(var H in ta)ta.hasOwnProperty(H)&&ta[H](this,t[H],jr);Os(this),t.finishInit&&t.finishInit(this);for(var G=0;G<Ka.length;++G)Ka[G](this);fr(this),k&&t.lineWrapping&&getComputedStyle(C.lineDiv).textRendering=="optimizelegibility"&&(C.lineDiv.style.textRendering="auto")}kt.defaults=To,kt.optionHandlers=ta;function Zl(e){var t=e.display;Se(t.scroller,"mousedown",zt(e,vo)),W&&B<11?Se(t.scroller,"dblclick",zt(e,function(X){if(Pe(e,X))return;var Y=lr(e,X);if(!Y||Wa(e,X)||jn(e.display,X))return;Q(X);var se=e.findWordAt(Y);Yi(e.doc,se.anchor,se.head)})):Se(t.scroller,"dblclick",function(X){return Pe(e,X)||Q(X)}),Se(t.scroller,"contextmenu",function(X){return bo(e,X)}),Se(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 C(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,ue=Y.top-X.top;return se*se+ue*ue>20*20}Se(t.scroller,"touchstart",function(X){if(!Pe(e,X)&&!C(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)}}),Se(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Se(t.scroller,"touchend",function(X){var Y=t.activeTouch;if(Y&&!jn(t,X)&&Y.left!=null&&!Y.moved&&new Date-Y.start<300){var se=e.coordsChar(t.activeTouch,"page"),ue;!Y.prev||H(Y,Y.prev)?ue=new Rt(se,se):!Y.prev.prev||H(Y,Y.prev.prev)?ue=e.findWordAt(se):ue=new Rt(Fe(se.line,0),pt(e.doc,Fe(se.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),Q(X)}i()}),Se(t.scroller,"touchcancel",i),Se(t.scroller,"scroll",function(){t.scroller.clientHeight&&(li(e,t.scroller.scrollTop),dr(e,t.scroller.scrollLeft,!0),xe(e,"scroll",e))}),Se(t.scroller,"mousewheel",function(X){return Ls(e,X)}),Se(t.scroller,"DOMMouseScroll",function(X){return Ls(e,X)}),Se(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(X){Pe(e,X)||oe(X)},over:function(X){Pe(e,X)||(Rl(e,X),oe(X))},start:function(X){return Al(e,X)},drop:zt(e,Ol),leave:function(X){Pe(e,X)||ro(e)}};var G=t.input.getField();Se(G,"keyup",function(X){return mo.call(e,X)}),Se(G,"keydown",zt(e,po)),Se(G,"keypress",zt(e,go)),Se(G,"focus",function(X){return xa(e,X)}),Se(G,"blur",function(X){return Cr(e,X)})}var Ka=[];kt.defineInitHook=function(e){return Ka.push(e)};function Oi(e,t,r,n){var i=e.doc,C;r==null&&(r="add"),r=="smart"&&(i.mode.indent?C=Tn(e,t).state:r="prev");var H=e.options.tabSize,G=rt(i,t),X=j(G.text,null,H);G.stateAfter&&(G.stateAfter=null);var Y=G.text.match(/^\s*/)[0],se;if(!n&&!/\S/.test(G.text))se=0,r="not";else if(r=="smart"&&(se=i.mode.indent(C,G.text.slice(Y.length),G.text),se==ve||se>150)){if(!n)return;r="prev"}r=="prev"?t>i.first?se=j(rt(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 ue="",Te=0;if(e.options.indentWithTabs)for(var be=Math.floor(se/H);be;--be)Te+=H,ue+=" ";if(Te<se&&(ue+=he(se-Te)),ue!=Y)return Nr(i,ue,Fe(t,0),Fe(t,Y.length),"+input"),G.stateAfter=null,!0;for(var Ce=0;Ce<i.sel.ranges.length;Ce++){var Me=i.sel.ranges[Ce];if(Me.head.line==t&&Me.head.ch<Y.length){var Be=Fe(t,Y.length);Na(i,Ce,new Rt(Be,Be));break}}}var Ln=null;function na(e){Ln=e}function Ga(e,t,r,n,i){var C=e.doc;e.display.shift=!1,n||(n=C.sel);var H=+new Date-200,G=i=="paste"||e.state.pasteIncoming>H,X=ct(t),Y=null;if(G&&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(C.splitLines(Ln.text[se]))}}else X.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(Y=ie(X,function(Ge){return[Ge]}));for(var ue=e.curOp.updateInput,Te=n.ranges.length-1;Te>=0;Te--){var be=n.ranges[Te],Ce=be.from(),Me=be.to();be.empty()&&(r&&r>0?Ce=Fe(Ce.line,Ce.ch-r):e.state.overwrite&&!G?Me=Fe(Me.line,Math.min(rt(C,Me.line).text.length,Me.ch+$(X).length)):G&&Ln&&Ln.lineWise&&Ln.text.join(`
`)==X.join(`
`)&&(Ce=Me=Fe(Ce.line,0)));var Be={from:Ce,to:Me,text:Y?Y[Te%Y.length]:X,origin:i||(G?"paste":e.state.cutIncoming>H?"cut":"+input")};Mr(e.doc,Be),$t(e,"inputRead",e,Be)}t&&!G&&wo(e,t),Ir(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),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&&hn(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 C=e.getModeAt(i.head),H=!1;if(C.electricChars){for(var G=0;G<C.electricChars.length;G++)if(t.indexOf(C.electricChars.charAt(G))>-1){H=Oi(e,i.head.line,"smart");break}}else C.electricInput&&(C.electricInput.test(rt(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,C={anchor:Fe(i,0),head:Fe(i+1,0)};r.push(C),t.push(e.getRange(C.anchor,C.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=u("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=u("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),c&&(e.style.border="1px solid black"),Oo(e),t}function ql(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(n,i){var C=this.options,H=C[n];if(C[n]==i&&n!="mode")return;C[n]=i,t.hasOwnProperty(n)&&zt(this,t[n])(this,i,H),xe(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,C=0;C<i.length;++C)if(i[C]==n||i[C].name==n)return i.splice(C,1),!0},addOverlay:tn(function(n,i){var C=n.token?n:e.getMode(this.options,n);if(C.startState)throw new Error("Overlays may not be stateful.");q(this.state.overlays,{mode:C,modeSpec:n,opaque:i&&i.opaque,priority:i&&i.priority||0},function(H){return H.priority}),this.state.modeGen++,on(this)}),removeOverlay:tn(function(n){for(var i=this.state.overlays,C=0;C<i.length;++C){var H=i[C].modeSpec;if(H==n||typeof n=="string"&&H.name==n){i.splice(C,1),this.state.modeGen++,on(this);return}}}),indentLine:tn(function(n,i,C){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Mn(this.doc,n)&&Oi(this,n,i,C)}),indentSelection:tn(function(n){for(var i=this.doc.sel.ranges,C=-1,H=0;H<i.length;H++){var G=i[H];if(G.empty())G.head.line>C&&(Oi(this,G.head.line,n,!0),C=G.head.line,H==this.doc.sel.primIndex&&Ir(this));else{var X=G.from(),Y=G.to(),se=Math.max(C,X.line);C=Math.min(this.lastLine(),Y.line-(Y.ch?0:1))+1;for(var ue=se;ue<C;++ue)Oi(this,ue,n);var Te=this.doc.sel.ranges;X.ch==0&&i.length==Te.length&&Te[H].from().ch>0&&Na(this.doc,H,new Rt(X,Te[H].to()),de)}}}),getTokenAt:function(n,i){return Ri(this,n,i)},getLineTokens:function(n,i){return Ri(this,Fe(n),i,!0)},getTokenTypeAt:function(n){n=pt(this.doc,n);var i=tr(this,rt(this.doc,n.line)),C=0,H=(i.length-1)/2,G=n.ch,X;if(G==0)X=i[2];else for(;;){var Y=C+H>>1;if((Y?i[Y*2-1]:0)>=G)H=Y;else if(i[Y*2+1]<G)C=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 C=[];if(!r.hasOwnProperty(i))return C;var H=r[i],G=this.getModeAt(n);if(typeof G[i]=="string")H[G[i]]&&C.push(H[G[i]]);else if(G[i])for(var X=0;X<G[i].length;X++){var Y=H[G[i][X]];Y&&C.push(Y)}else G.helperType&&H[G.helperType]?C.push(H[G.helperType]):H[G.name]&&C.push(H[G.name]);for(var se=0;se<H._global.length;se++){var ue=H._global[se];ue.pred(G,this)&&J(C,ue.val)==-1&&C.push(ue.val)}return C},getStateAfter:function(n,i){var C=this.doc;return n=br(C,n==null?C.first+C.size-1:n),Tn(this,n+1,i).state},cursorCoords:function(n,i){var C,H=this.doc.sel.primary();return n==null?C=H.head:typeof n=="object"?C=pt(this.doc,n):C=n?H.from():H.to(),An(this,C,i||"page")},charCoords:function(n,i){return ma(this,pt(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,En(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,i,C){var H=!1,G;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),G=rt(this.doc,n)}else G=n;return Ui(this,G,{top:0,left:0},i||"page",C||H).top+(H?this.doc.height-On(G):0)},defaultTextHeight:function(){return Rr(this.display)},defaultCharWidth:function(){return Lr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,i,C,H,G){var X=this.display;n=An(this,pt(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 ue=Math.max(X.wrapper.clientHeight,this.doc.height),Te=Math.max(X.sizer.clientWidth,X.lineSpace.clientWidth);(H=="above"||n.bottom+i.offsetHeight>ue)&&n.top>i.offsetHeight?Y=n.top-i.offsetHeight:n.bottom+i.offsetHeight<=ue&&(Y=n.bottom),se+i.offsetWidth>Te&&(se=Te-i.offsetWidth)}i.style.top=Y+"px",i.style.left=i.style.right="",G=="right"?(se=X.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(G=="left"?se=0:G=="middle"&&(se=(X.sizer.clientWidth-i.offsetWidth)/2),i.style.left=se+"px"),C&&Qo(this,{left:se,top:Y,right:se+i.offsetWidth,bottom:Y+i.offsetHeight})},triggerOnKeyDown:tn(po),triggerOnKeyPress:tn(go),triggerOnKeyUp:mo,triggerOnMouseDown:tn(vo),execCommand:function(n){if(Ti.hasOwnProperty(n))return Ti[n].call(null,this)},triggerElectric:tn(function(n){wo(this,n)}),findPosH:function(n,i,C,H){var G=1;i<0&&(G=-1,i=-i);for(var X=pt(this.doc,n),Y=0;Y<i&&!(X=za(this.doc,X,G,C,H),X.hitSide);++Y);return X},moveH:tn(function(n,i){var C=this;this.extendSelectionsBy(function(H){return C.display.shift||C.doc.extend||H.empty()?za(C.doc,H.head,n,i,C.options.rtlMoveVisually):n<0?H.from():H.to()},ce)}),deleteH:tn(function(n,i){var C=this.doc.sel,H=this.doc;C.somethingSelected()?H.replaceSelection("",null,"+delete"):Br(this,function(G){var X=za(H,G.head,n,i,!1);return n<0?{from:X,to:G.head}:{from:G.head,to:X}})}),findPosV:function(n,i,C,H){var G=1,X=H;i<0&&(G=-1,i=-i);for(var Y=pt(this.doc,n),se=0;se<i;++se){var ue=An(this,Y,"div");if(X==null?X=ue.left:ue.left=X,Y=Ro(this,ue,G,C),Y.hitSide)break}return Y},moveV:tn(function(n,i){var C=this,H=this.doc,G=[],X=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(se){if(X)return n<0?se.from():se.to();var ue=An(C,se.head,"div");se.goalColumn!=null&&(ue.left=se.goalColumn),G.push(ue.left);var Te=Ro(C,ue,n,i);return i=="page"&&se==H.sel.primary()&&Sa(C,ma(C,Te,"div").top-ue.top),Te},ce),G.length)for(var Y=0;Y<H.sel.ranges.length;Y++)H.sel.ranges[Y].goalColumn=G[Y]}),findWordAt:function(n){var i=this.doc,C=rt(i,n.line).text,H=n.ch,G=n.ch;if(C){var X=this.getHelper(n,"wordChars");(n.sticky=="before"||G==C.length)&&H?--H:++G;for(var Y=C.charAt(H),se=Re(Y,X)?function(ue){return Re(ue,X)}:/\s/.test(Y)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!Re(ue)};H>0&&se(C.charAt(H-1));)--H;for(;G<C.length&&se(C.charAt(G));)++G}return new Rt(Fe(n.line,H),Fe(n.line,G))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?I(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),xe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:tn(function(n,i){oi(this,n,i)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-In(this)-this.display.barHeight,width:n.scrollWidth-In(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:sr(this)}},scrollIntoView:tn(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):ys(this,n.from,n.to,n.margin)}),setSize:tn(function(n,i){var C=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 G=this.display.viewFrom;this.doc.iter(G,this.display.viewTo,function(X){if(X.widgets){for(var Y=0;Y<X.widgets.length;Y++)if(X.widgets[Y].noHScroll){zn(C,G,"widget");break}}++G}),this.curOp.forceUpdate=!0,xe(this,"refresh",this)}),operation:function(n){return hn(this,n)},startOperation:function(){return hr(this)},endOperation:function(){return fr(this)},refresh:tn(function(){var n=this.display.cachedTextHeight;on(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),xe(this,"refresh",this)}),swapDoc:tn(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,C){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][i]=C},e.registerGlobalHelper=function(n,i,C,H){e.registerHelper(n,i,H),r[n]._global.push({pred:C,val:H})}}function za(e,t,r,n,i){var C=t,H=r,G=rt(e,t.line),X=i&&e.direction=="rtl"?-r:r;function Y(){var Ze=t.line+X;return Ze<e.first||Ze>=e.first+e.size?!1:(t=new Fe(Ze,t.ch,t.sticky),G=rt(e,Ze))}function se(Ze){var ze;if(n=="codepoint"){var et=G.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(et)?ze=null:ze=new Fe(t.line,Math.max(0,Math.min(G.text.length,t.ch+r*(et>=55296&&et<56320?2:1))),-r)}else i?ze=Pl(e.cm,G,t,r):ze=Ua(G,t,r);if(ze==null)if(!Ze&&Y())t=Ba(i,e.cm,G,t.line,X);else return!1;else t=ze;return!0}if(n=="char"||n=="codepoint")se();else if(n=="column")se(!0);else if(n=="word"||n=="group")for(var ue=null,Te=n=="group",be=e.cm&&e.cm.getHelper(t,"wordChars"),Ce=!0;!(r<0&&!se(!Ce));Ce=!1){var Me=G.text.charAt(t.ch)||`
`,Be=Re(Me,be)?"w":Te&&Me==`
`?"n":!Te||/\s/.test(Me)?null:"p";if(Te&&!Ce&&!Be&&(Be="s"),ue&&ue!=Be){r<0&&(r=1,se(),t.sticky="after");break}if(Be&&(ue=Be),r>0&&!se(!Ce))break}var Ge=Qi(e,t,C,H,!0);return zr(C,Ge)&&(Ge.hitSide=!0),Ge}function Ro(e,t,r,n){var i=e.doc,C=t.left,H;if(n=="page"){var G=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),X=Math.max(G-.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,C,H),!Y.outside);){if(r<0?H<=0:H>=i.height){Y.hitSide=!0;break}H+=r*5}return Y}var Lt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new K,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Lt.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 C(G){for(var X=G.target;X;X=X.parentNode){if(X==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(X.className))break}return!1}Se(i,"paste",function(G){if(!C(G)||Pe(n,G)||xo(G,n))return;B<=11&&setTimeout(zt(n,function(){return t.updateFromDOM()}),20)}),Se(i,"compositionstart",function(G){t.composing={data:G.data,done:!1}}),Se(i,"compositionupdate",function(G){t.composing||(t.composing={data:G.data,done:!1})}),Se(i,"compositionend",function(G){t.composing&&(G.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Se(i,"touchstart",function(){return r.forceCompositionEnd()}),Se(i,"input",function(){t.composing||t.readFromDOMSoon()});function H(G){if(!C(G)||Pe(n,G))return;if(n.somethingSelected())na({lineWise:!1,text:n.getSelections()}),G.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var X=So(n);na({lineWise:!0,text:X.text}),G.type=="cut"&&n.operation(function(){n.setSelections(X.ranges,0,de),n.replaceSelection("",null,"cut")})}else return;if(G.clipboardData){G.clipboardData.clearData();var Y=Ln.text.join(`
`);if(G.clipboardData.setData("Text",Y),G.clipboardData.getData("Text")==Y){G.preventDefault();return}}var se=Ao(),ue=se.firstChild;n.display.lineSpace.insertBefore(se,n.display.lineSpace.firstChild),ue.value=Ln.text.join(`
`);var Te=document.activeElement;F(ue),setTimeout(function(){n.display.lineSpace.removeChild(se),Te.focus(),Te==i&&r.showPrimarySelection()},50)}Se(i,"copy",H),Se(i,"cut",H)},Lt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Lt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Lt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Lt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Lt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,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 C=ra(t,e.anchorNode,e.anchorOffset),H=ra(t,e.focusNode,e.focusOffset);if(C&&!C.bad&&H&&!H.bad&&ht(er(C,H),n)==0&&ht(yr(C,H),i)==0)return;var G=t.display.view,X=n.line>=t.display.viewFrom&&Lo(t,n)||{node:G[0].measure.map[2],offset:0},Y=i.line<t.display.viewTo&&Lo(t,i);if(!Y){var se=G[G.length-1].measure,ue=se.maps?se.maps[se.maps.length-1]:se.map;Y={node:ue[ue.length-1],offset:ue[ue.length-2]-ue[ue.length-3]}}if(!X||!Y){e.removeAllRanges();return}var Te=e.rangeCount&&e.getRangeAt(0),be;try{be=m(X.node,X.offset,Y.offset,Y.node)}catch(Ce){}be&&(!D&&t.state.focused?(e.collapse(X.node,X.offset),be.collapsed||(e.removeAllRanges(),e.addRange(be))):(e.removeAllRanges(),e.addRange(be)),Te&&e.anchorNode==null?e.addRange(Te):D&&this.startGracePeriod()),this.rememberSelection()},Lt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Lt.prototype.showMultipleSelections=function(e){_(this.cm.display.cursorDiv,e.cursors),_(this.cm.display.selectionDiv,e.selection)},Lt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Lt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return b(this.div,t)},Lt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Lt.prototype.blur=function(){this.div.blur()},Lt.prototype.getField=function(){return this.div},Lt.prototype.supportsTouch=function(){return!0},Lt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():hn(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Lt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Lt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(s&&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&&hn(t,function(){Zt(t.doc,Xn(r,n),de),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},Lt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.ch==0&&n.line>e.firstLine()&&(n=Fe(n.line-1,rt(e.doc,n.line-1).length)),i.ch==rt(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 C,H,G;n.line==t.viewFrom||(C=ur(e,n.line))==0?(H=St(t.view[0].line),G=t.view[0].node):(H=St(t.view[C].line),G=t.view[C-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=St(t.view[X+1].line)-1,se=t.view[X+1].node.previousSibling),!G)return!1;for(var ue=e.doc.splitLines(tu(e,G,se,H,Y)),Te=Pn(e.doc,Fe(H,0),Fe(Y,rt(e.doc,Y).text.length));ue.length>1&&Te.length>1;)if($(ue)==$(Te))ue.pop(),Te.pop(),Y--;else if(ue[0]==Te[0])ue.shift(),Te.shift(),H++;else break;for(var be=0,Ce=0,Me=ue[0],Be=Te[0],Ge=Math.min(Me.length,Be.length);be<Ge&&Me.charCodeAt(be)==Be.charCodeAt(be);)++be;for(var Ze=$(ue),ze=$(Te),et=Math.min(Ze.length-(ue.length==1?be:0),ze.length-(Te.length==1?be:0));Ce<et&&Ze.charCodeAt(Ze.length-Ce-1)==ze.charCodeAt(ze.length-Ce-1);)++Ce;if(ue.length==1&&Te.length==1&&H==n.line)for(;be&&be>n.ch&&Ze.charCodeAt(Ze.length-Ce-1)==ze.charCodeAt(ze.length-Ce-1);)be--,Ce++;ue[ue.length-1]=Ze.slice(0,Ze.length-Ce).replace(/^\u200b+/,""),ue[0]=ue[0].slice(be).replace(/\u200b+$/,"");var ut=Fe(H,be),ot=Fe(Y,Te.length?$(Te).length-Ce:0);if(ue.length>1||ue[0]||ht(ut,ot))return Nr(e.doc,ue,ut,ot,"+input"),!0},Lt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Lt.prototype.reset=function(){this.forceCompositionEnd()},Lt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Lt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Lt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&hn(this.cm,function(){return on(e.cm)})},Lt.prototype.setUneditable=function(e){e.contentEditable="false"},Lt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||zt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Lt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Lt.prototype.onContextMenu=function(){},Lt.prototype.resetPosition=function(){},Lt.prototype.needsContentAttribute=!0;function Lo(e,t){var r=fa(e,t.line);if(!r||r.hidden)return null;var n=rt(e.doc,t.line),i=es(r,n,t.line),C=je(n,e.doc.direction),H="left";if(C){var G=We(C,t.ch);H=G%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 C="",H=!1,G=e.doc.lineSeparator(),X=!1;function Y(be){return function(Ce){return Ce.id==be}}function se(){H&&(C+=G,X&&(C+=G),H=X=!1)}function ue(be){be&&(se(),C+=be)}function Te(be){if(be.nodeType==1){var Ce=be.getAttribute("cm-text");if(Ce){ue(Ce);return}var Me=be.getAttribute("cm-marker"),Be;if(Me){var Ge=e.findMarks(Fe(n,0),Fe(i+1,0),Y(+Me));Ge.length&&(Be=Ge[0].find(0))&&ue(Pn(e.doc,Be.from,Be.to).join(G));return}if(be.getAttribute("contenteditable")=="false")return;var Ze=/^(pre|div|p|li|table|br)$/i.test(be.nodeName);if(!/^br$/i.test(be.nodeName)&&be.textContent.length==0)return;Ze&&se();for(var ze=0;ze<be.childNodes.length;ze++)Te(be.childNodes[ze]);/^(pre|p)$/i.test(be.nodeName)&&(X=!0),Ze&&(H=!0)}else be.nodeType==3&&ue(be.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Te(t),t==r);)t=t.nextSibling,X=!1;return C}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 C=e.display.view[i];if(C.node==n)return nu(C,t,r)}}function nu(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!b(n,t))return Hr(Fe(St(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var C=e.rest?$(e.rest):e.line;return Hr(Fe(St(C),C.text.length),i)}var H=t.nodeType==3?t:null,G=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,r&&(r=H.nodeValue.length));G.parentNode!=n;)G=G.parentNode;var X=e.measure,Y=X.maps;function se(Be,Ge,Ze){for(var ze=-1;ze<(Y?Y.length:0);ze++)for(var et=ze<0?X.map:Y[ze],ut=0;ut<et.length;ut+=3){var ot=et[ut+2];if(ot==Be||ot==Ge){var gt=St(ze<0?e.line:e.rest[ze]),It=et[ut]+Ze;return(Ze<0||ot!=Be)&&(It=et[ut+(Ze?1:0)]),Fe(gt,It)}}}var ue=se(H,G,r);if(ue)return Hr(ue,i);for(var Te=G.nextSibling,be=H?H.nodeValue.length-r:0;Te;Te=Te.nextSibling){if(ue=se(Te,Te.firstChild,0),ue)return Hr(Fe(ue.line,ue.ch-be),i);be+=Te.textContent.length}for(var Ce=G.previousSibling,Me=r;Ce;Ce=Ce.previousSibling){if(ue=se(Ce,Ce.firstChild,-1),ue)return Hr(Fe(ue.line,ue.ch+Me),i);Me+=Ce.textContent.length}}var Ut=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new K,this.hasSelection=!1,this.composing=null};Ut.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),c&&(i.style.width="0px"),Se(i,"input",function(){W&&B>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Se(i,"paste",function(H){if(Pe(n,H)||xo(H,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function C(H){if(Pe(n,H))return;if(n.somethingSelected())na({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var G=So(n);na({lineWise:!0,text:G.text}),H.type=="cut"?n.setSelections(G.ranges,null,de):(r.prevInput="",i.value=G.text.join(`
`),F(i))}else return;H.type=="cut"&&(n.state.cutIncoming=+new Date)}Se(i,"cut",C),Se(i,"copy",C),Se(e.scroller,"paste",function(H){if(jn(e,H)||Pe(n,H))return;if(!i.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var G=new Event("paste");G.clipboardData=H.clipboardData,i.dispatchEvent(G)}),Se(e.lineSpace,"selectstart",function(H){jn(e,H)||Q(H)}),Se(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"})}}),Se(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Ut.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},Ut.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ut.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=ps(e);if(e.options.moveInputWithCursor){var i=An(e,r.sel.primary().head,"div"),C=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+H.top-C.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+H.left-C.left))}return n},Ut.prototype.showSelection=function(e){var t=this.cm,r=t.display;_(r.cursorDiv,e.cursors),_(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ut.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&F(this.textarea),W&&B>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",W&&B>=9&&(this.hasSelection=null))},Ut.prototype.getField=function(){return this.textarea},Ut.prototype.supportsTouch=function(){return!1},Ut.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ut.prototype.blur=function(){this.textarea.blur()},Ut.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ut.prototype.receivedFocus=function(){this.slowPoll()},Ut.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ut.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},Ut.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||st(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&&B>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var C=i.charCodeAt(0);if(C==8203&&!n&&(n="\u200B"),C==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,G=Math.min(n.length,i.length);H<G&&n.charCodeAt(H)==i.charCodeAt(H);)++H;return hn(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},Ut.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ut.prototype.onKeyPress=function(){W&&B>=9&&(this.hasSelection=null),this.fastPoll()},Ut.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var C=lr(r,e),H=n.scroller.scrollTop;if(!C||p)return;var G=r.options.resetSelectionOnContextMenu;G&&r.doc.sel.contains(C)==-1&&zt(r,Zt)(r.doc,Xn(C),de);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 ue;k&&(ue=window.scrollY),n.input.focus(),k&&window.scrollTo(null,ue),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=be,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function Te(){if(i.selectionStart!=null){var Me=r.somethingSelected(),Be="\u200B"+(Me?i.value:"");i.value="\u21DA",i.value=Be,t.prevInput=Me?"":"\u200B",i.selectionStart=1,i.selectionEnd=Be.length,n.selForContextMenu=r.doc.sel}}function be(){if(t.contextMenuPending!=be)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=Y,i.style.cssText=X,W&&B<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=H),i.selectionStart!=null){(!W||W&&B<9)&&Te();var Me=0,Be=function(){n.selForContextMenu==r.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?zt(r,Vs)(r):Me++<10?n.detectingSelectAll=setTimeout(Be,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(Be,200)}}if(W&&B>=9&&Te(),A){oe(e);var Ce=function(){Ke(window,"mouseup",Ce),setTimeout(be,20)};Se(window,"mouseup",Ce)}else setTimeout(be,50)},Ut.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ut.prototype.setUneditable=function(){},Ut.prototype.needsContentAttribute=!1;function 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=G.getValue()}var i;if(e.form&&(Se(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var C=e.form;i=C.submit;try{var H=C.submit=function(){n(),C.submit=i,C.submit(),C.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&&(Ke(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var G=kt(function(X){return e.parentNode.insertBefore(X,e.nextSibling)},t);return G}function iu(e){e.off=Ke,e.on=Se,e.wheelEventPixels=cl,e.Doc=ln,e.splitLines=ct,e.countColumn=j,e.findColumn=pe,e.isWordChar=we,e.Pass=ve,e.signal=xe,e.Line=ar,e.changeEnd=Yn,e.scrollbarModel=Ts,e.Pos=Fe,e.cmpPos=ht,e.modes=Mt,e.mimeModes=yt,e.resolveMode=dt,e.getMode=mt,e.modeExtensions=xt,e.extendMode=Dt,e.copyState=Wt,e.startState=Gr,e.innerMode=qn,e.commands=Ti,e.keyMap=Hn,e.keyName=lo,e.isModifierKey=so,e.lookupKey=Ur,e.normalizeKeyMap=kl,e.StringStream=Nt,e.SharedTextMarker=yi,e.TextMarker=Qn,e.LineWidget=_i,e.e_preventDefault=Q,e.e_stopPropagation=Z,e.e_stop=oe,e.addClass=I,e.contains=b,e.rmClass=T,e.keyNames=Jn}$l(kt),ql(kt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in ln.prototype)ln.prototype.hasOwnProperty(ia)&&J(au,ia)<0&&(kt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(ln.prototype[ia]));return fe(ln),kt.inputStyles={textarea:Ut,contenteditable:Lt},kt.defineMode=function(e){!kt.defaults.mode&&e!="null"&&(kt.defaults.mode=e),pn.apply(this,arguments)},kt.defineMIME=bn,kt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),kt.defineMIME("text/plain","null"),kt.defineExtension=function(e,t){kt.prototype[e]=t},kt.defineDocExtension=function(e,t){ln.prototype[e]=t},kt.fromTextArea=ru,iu(kt),kt.version="5.58.2",kt})},Y1PL:function(at,Ve,te){"use strict";te.r(Ve),te.d(Ve,"ResizableTextArea",function(){return J});var ne=te("wx14"),V=te("1OyB"),D=te("vuIU"),z=te("Ji7U"),N=te("LK+K"),M=te("cDcd"),W=te("VTBJ"),B=te("rePB"),k=te("Zm9Q"),R=te("Kwbf"),g=te("c+Xe"),p=te("m+aA"),f=te("bdgK"),d=new Map;function o(de){de.forEach(function(me){var ce,pe=me.target;(ce=d.get(pe))===null||ce===void 0||ce.forEach(function(ae){return ae(pe)})})}var c=new f.default(o),s=null,a=null;function l(de,me){d.has(de)||(d.set(de,new Set),c.observe(de)),d.get(de).add(me)}function h(de,me){d.has(de)&&(d.get(de).delete(me),d.get(de).size||(c.unobserve(de),d.delete(de)))}var O=function(de){Object(z.a)(ce,de);var me=Object(N.a)(ce);function ce(){return Object(V.a)(this,ce),me.apply(this,arguments)}return Object(D.a)(ce,[{key:"render",value:function(){return this.props.children}}]),ce}(M.Component),w=M.createContext(null);function x(de){var me=de.children,ce=de.onBatchResize,pe=M.useRef(0),ae=M.useRef([]),he=M.useContext(w),$=M.useCallback(function(ie,q,Ee){pe.current+=1;var Ae=pe.current;ae.current.push({size:ie,element:q,data:Ee}),Promise.resolve().then(function(){Ae===pe.current&&(ce==null||ce(ae.current),ae.current=[])}),he==null||he(ie,q,Ee)},[ce,he]);return M.createElement(w.Provider,{value:$},me)}function A(de){var me=de.children,ce=de.disabled,pe=M.useRef(null),ae=M.useRef(null),he=M.useContext(w),$=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ie=M.isValidElement(me)&&Object(g.c)(me),q=ie?me.ref:null,Ee=M.useMemo(function(){return Object(g.a)(q,pe)},[q,pe]),Ae=M.useRef(de);Ae.current=de;var ye=M.useCallback(function(we){var Re=Ae.current,ke=Re.onResize,Ne=Re.data,Ie=we.getBoundingClientRect(),Le=Ie.width,Ye=Ie.height,Qe=we.offsetWidth,Xe=we.offsetHeight,We=Math.floor(Le),Je=Math.floor(Ye);if($.current.width!==We||$.current.height!==Je||$.current.offsetWidth!==Qe||$.current.offsetHeight!==Xe){var je={width:We,height:Je,offsetWidth:Qe,offsetHeight:Xe};$.current=je;var He=Qe===Math.round(Le)?Le:Qe,Se=Xe===Math.round(Ye)?Ye:Xe,qe=Object(W.a)(Object(W.a)({},je),{},{offsetWidth:He,offsetHeight:Se});he==null||he(qe,we,Ne),ke&&Promise.resolve().then(function(){ke(qe,we)})}},[]);return M.useEffect(function(){var we=Object(p.a)(pe.current)||Object(p.a)(ae.current);return we&&!ce&&l(we,ye),function(){return h(we,ye)}},[pe.current,ce]),M.createElement(O,{ref:ae},ie?M.cloneElement(me,{ref:Ee}):me)}var S="rc-observer-key";function T(de){var me=de.children,ce=Object(k.a)(me);return ce.map(function(pe,ae){var he=(pe==null?void 0:pe.key)||"".concat(S,"-").concat(ae);return M.createElement(A,Object(ne.a)({},de,{key:he}),pe)})}T.Collection=x;var E=T,_=te("bT9E"),u=te("TSYQ"),y=te.n(u),m=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,b=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],P={},I;function U(de){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ce=de.getAttribute("id")||de.getAttribute("data-reactid")||de.getAttribute("name");if(me&&P[ce])return P[ce];var pe=window.getComputedStyle(de),ae=pe.getPropertyValue("box-sizing")||pe.getPropertyValue("-moz-box-sizing")||pe.getPropertyValue("-webkit-box-sizing"),he=parseFloat(pe.getPropertyValue("padding-bottom"))+parseFloat(pe.getPropertyValue("padding-top")),$=parseFloat(pe.getPropertyValue("border-bottom-width"))+parseFloat(pe.getPropertyValue("border-top-width")),ie=b.map(function(Ee){return"".concat(Ee,":").concat(pe.getPropertyValue(Ee))}).join(";"),q={sizingStyle:ie,paddingSize:he,borderSize:$,boxSizing:ae};return me&&ce&&(P[ce]=q),q}function F(de){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,pe=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)),de.getAttribute("wrap")?I.setAttribute("wrap",de.getAttribute("wrap")):I.removeAttribute("wrap");var ae=U(de,me),he=ae.paddingSize,$=ae.borderSize,ie=ae.boxSizing,q=ae.sizingStyle;I.setAttribute("style","".concat(q,";").concat(m)),I.value=de.value||de.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,Ae=Number.MAX_SAFE_INTEGER,ye=I.scrollHeight,we;if(ie==="border-box"?ye+=$:ie==="content-box"&&(ye-=he),ce!==null||pe!==null){I.value=" ";var Re=I.scrollHeight-he;ce!==null&&(Ee=Re*ce,ie==="border-box"&&(Ee=Ee+he+$),ye=Math.max(Ee,ye)),pe!==null&&(Ae=Re*pe,ie==="border-box"&&(Ae=Ae+he+$),we=ye>Ae?"":"hidden",ye=Math.min(Ae,ye))}return{height:ye,minHeight:Ee,maxHeight:Ae,overflowY:we,resize:"none"}}var L=te("Gytx"),v=te.n(L),j;(function(de){de[de.NONE=0]="NONE",de[de.RESIZING=1]="RESIZING",de[de.RESIZED=2]="RESIZED"})(j||(j={}));var K=function(de){Object(z.a)(ce,de);var me=Object(N.a)(ce);function ce(pe){var ae;return Object(V.a)(this,ce),ae=me.call(this,pe),ae.nextFrameActionId=void 0,ae.resizeFrameId=void 0,ae.textArea=void 0,ae.saveTextArea=function(he){ae.textArea=he},ae.handleResize=function(he){var $=ae.state.resizeStatus,ie=ae.props,q=ie.autoSize,Ee=ie.onResize;if($!==j.NONE)return;typeof Ee=="function"&&Ee(he),q&&ae.resizeOnNextFrame()},ae.resizeOnNextFrame=function(){cancelAnimationFrame(ae.nextFrameActionId),ae.nextFrameActionId=requestAnimationFrame(ae.resizeTextarea)},ae.resizeTextarea=function(){var he=ae.props.autoSize;if(!he||!ae.textArea)return;var $=he.minRows,ie=he.maxRows,q=F(ae.textArea,!1,$,ie);ae.setState({textareaStyles:q,resizeStatus:j.RESIZING},function(){cancelAnimationFrame(ae.resizeFrameId),ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:j.RESIZED},function(){ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:j.NONE}),ae.fixFirefoxAutoScroll()})})})})},ae.renderTextArea=function(){var he=ae.props,$=he.prefixCls,ie=$===void 0?"rc-textarea":$,q=he.autoSize,Ee=he.onResize,Ae=he.className,ye=he.disabled,we=ae.state,Re=we.textareaStyles,ke=we.resizeStatus,Ne=Object(_.a)(ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ie=y()(ie,Ae,Object(B.a)({},"".concat(ie,"-disabled"),ye));"value"in Ne&&(Ne.value=Ne.value||"");var Le=Object(W.a)(Object(W.a)(Object(W.a)({},ae.props.style),Re),ke===j.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(E,{onResize:ae.handleResize,disabled:!(q||Ee)},M.createElement("textarea",Object(ne.a)({},Ne,{className:Ie,style:Le,ref:ae.saveTextArea})))},ae.state={textareaStyles:{},resizeStatus:j.NONE},ae}return Object(D.a)(ce,[{key:"componentDidUpdate",value:function(ae){(ae.value!==this.props.value||!v()(ae.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ae=this.textArea.selectionStart,he=this.textArea.selectionEnd;this.textArea.setSelectionRange(ae,he)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ce}(M.Component),J=K,ee=function(de){Object(z.a)(ce,de);var me=Object(N.a)(ce);function ce(pe){var ae;Object(V.a)(this,ce),ae=me.call(this,pe),ae.resizableTextArea=void 0,ae.focus=function(){ae.resizableTextArea.textArea.focus()},ae.saveTextArea=function($){ae.resizableTextArea=$},ae.handleChange=function($){var ie=ae.props.onChange;ae.setValue($.target.value,function(){ae.resizableTextArea.resizeTextarea()}),ie&&ie($)},ae.handleKeyDown=function($){var ie=ae.props,q=ie.onPressEnter,Ee=ie.onKeyDown;$.keyCode===13&&q&&q($),Ee&&Ee($)};var he=typeof pe.value=="undefined"||pe.value===null?pe.defaultValue:pe.value;return ae.state={value:he},ae}return Object(D.a)(ce,[{key:"setValue",value:function(ae,he){"value"in this.props||this.setState({value:ae},he)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(J,Object(ne.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ae){return"value"in ae?{value:ae.value}:null}}]),ce}(M.Component),ve=Ve.default=ee},YiJy:function(at,Ve,te){at.exports={bg:"bg___2xkgh",flexRow:"flexRow___3_RB8",flexJustifyCenter:"flexJustifyCenter___3Rbeo",flexAlignEnd:"flexAlignEnd___Up4h1",flexAlignCenter:"flexAlignCenter___hv6Pr",flexColumn:"flexColumn___kNPED",formWrap:"formWrap___2LY7l",titleWrap:"titleWrap___1TXK0",fieldWrap:"fieldWrap___2Bk37",mdWrap:"mdWrap___3VsOd",backgroundFa:"backgroundFa___13msX",button:"button___2BNet"}},ZW9T:function(at,Ve,te){"use strict";te.d(Ve,"a",function(){return F});var ne=te("k1fw"),V=te("miYZ"),D=te("tsqr"),z=te("rAM+"),N=te("tJVT"),M=te("PpiC"),W=te("cDcd"),B=te.n(W),k=te("bdgK"),R=te("oBTY"),g=te("9og8"),p=te("WmNS"),f=te.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"]},o={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},c={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"#include <string>",content:["#include <string>"].join(`
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
`)}]},s={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=te("5VLF"),l=te.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"]}},O=function(v,j){return j.map(function(K){return{label:K,kind:v.languages.CompletionItemKind.Keyword,insertText:K}})},w=function(v){return Object.keys(h.tables).map(function(j){return{label:j,kind:v.languages.CompletionItemKind.Variable,insertText:j}})},x=function(v,j){var K=h.tables[v];return K?K.map(function(J){return{label:J,kind:j.languages.CompletionItemKind.Field,insertText:J}}):[]};function A(L,v,j,K,J){var ee=v.getWordUntilPosition(j),ve={startLineNumber:j.lineNumber,endLineNumber:j.lineNumber,startColumn:ee.startColumn,endColumn:ee.endColumn},de=K.map(function(me){return{label:me,kind:L.languages.CompletionItemKind.Keyword,insertText:me,insertTextRules:L.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ve}});return J.map(function(me){de.push(Object(ne.a)(Object(ne.a)({},me),{},{range:ve}))}),de}var S=function(L){h.languages.map(function(J){return L.languages.registerDocumentFormattingEditProvider(J,{provideDocumentFormattingEdits:function(ve,de,me){return Object(g.a)(f.a.mark(function ce(){var pe;return f.a.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:return pe=l()(ve.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}),he.abrupt("return",[{range:ve.getFullModelRange(),text:pe}]);case 2:case"end":return he.stop()}},ce)}))()}}),J});var v=c.quickKey.map(function(J){return{label:J.label,kind:L.languages.CompletionItemKind.Method,insertText:J.content,insertTextRules:L.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),j=s.quickKey.map(function(J){return{label:J.label,kind:L.languages.CompletionItemKind.Method,insertText:J.content,insertTextRules:L.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),K=o.quickKey.map(function(J){return{label:J.label,kind:L.languages.CompletionItemKind.Method,insertText:J.content,insertTextRules:L.languages.CompletionItemInsertTextRule.InsertAsSnippet}});L.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(R.a)(c.keywords),Object(R.a)(c.quickKey.map(function(J){return J.label}))),provideCompletionItems:function(ee,ve){var de=ee.getValueInRange({startLineNumber:ve.lineNumber,startColumn:1,endLineNumber:ve.lineNumber,endColumn:ve.column}),me=de.match(/cu/gim);console.log("match:",me,ve,de,ee);var ce=[],pe=ve.lineNumber,ae=ve.column,he=ee.getValueInRange({startLineNumber:pe,startColumn:0,endLineNumber:pe,endColumn:ae}),$=he.trim().split(/\s+/),ie=$[$.length-1];if(ie.endsWith(".")){var q=ie.slice(0,ie.length-1);Object.keys(h.tables).includes(q)&&(ce=Object(R.a)(x(q,L)))}else ie==="."?ce=[]:ce=[].concat(Object(R.a)(w(L)),Object(R.a)(O(L,c.keywords)),Object(R.a)(v));return{suggestions:ce}}}),L.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(R.a)(d.keywords)),provideCompletionItems:function(ee,ve){var de=ee.getValueInRange({startLineNumber:ve.lineNumber,startColumn:1,endLineNumber:ve.lineNumber,endColumn:ve.column}),me=de.match(/cu/gim);console.log("match:",me,ve,de,ee);var ce=[],pe=ve.lineNumber,ae=ve.column,he=ee.getValueInRange({startLineNumber:pe,startColumn:0,endLineNumber:pe,endColumn:ae}),$=he.trim().split(/\s+/),ie=$[$.length-1];if(ie.endsWith(".")){var q=ie.slice(0,ie.length-1);Object.keys(h.tables).includes(q)&&(ce=Object(R.a)(x(q,L)))}else ie==="."?ce=[]:ce=[].concat(Object(R.a)(w(L)),Object(R.a)(O(L,d.keywords)));return{suggestions:ce}}}),L.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(R.a)(o.keywords)),provideCompletionItems:function(ee,ve){var de=[],me=ve.lineNumber,ce=ve.column,pe=ee.getValueInRange({startLineNumber:me,startColumn:0,endLineNumber:me,endColumn:ce}),ae=pe.trim().split(/\s+/),he=ae[ae.length-1];if(he.endsWith(".")){var $=he.slice(0,he.length-1);Object.keys(h.tables).includes($)&&(de=Object(R.a)(x($,L)))}else he==="."?de=[]:de=[].concat(Object(R.a)(w(L)),Object(R.a)(O(L,o.keywords)),Object(R.a)(K));return{suggestions:de}}}),L.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(R.a)(s.keywords)),provideCompletionItems:function(ee,ve){var de=[],me=ve.lineNumber,ce=ve.column,pe=ee.getValueInRange({startLineNumber:me,startColumn:0,endLineNumber:me,endColumn:ce}),ae=pe.trim().split(/\s+/),he=ae[ae.length-1];if(he.endsWith(".")){var $=he.slice(0,he.length-1);Object.keys(h.tables).includes($)&&(de=Object(R.a)(x($,L)))}else he==="."?de=[]:de=[].concat(Object(R.a)(w(L)),Object(R.a)(O(L,s.keywords)),Object(R.a)(j));return{suggestions:de}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",E=te("LvDl"),_=te("+ua5");function u(L){return/^\d+$/.test(L)?"".concat(L,"px"):L}function y(){}var m=!1,b={"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 L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=L;if(Array.isArray(L)){for(var j=0;j<L.length;j++){var K=b[L[j]];if(K)return K}return v[0]}return b[v]||v}var I=null,U=Ve.b=function(L){var v=L.width,j=v===void 0?"100%":v,K=L.height,J=K===void 0?"100%":K,ee=L.value,ve=L.language,de=ve===void 0?"javascript":ve,me=L.style,ce=me===void 0?{}:me,pe=L.options,ae=pe===void 0?{}:pe,he=L.overrideServices,$=he===void 0?{}:he,ie=L.theme,q=ie===void 0?"vs-dark":ie,Ee=L.onEditBlur,Ae=L.onSave,ye=L.autoHeight,we=ye===void 0?!1:ye,Re=L.forbidCopy,ke=Re===void 0?!1:Re,Ne=L.onChange,Ie=Ne===void 0?y:Ne,Le=L.editorDidMount,Ye=Le===void 0?y:Le,Qe=L.onFocus,Xe=Qe===void 0?y:Qe,We=L.filename,Je=We===void 0?"educoder.txt":We,je=L.errorLine,He=L.errorContent,Se=He===void 0?"":He,qe=Object(M.a)(L,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Ke=Object(W.useRef)(),xe=Object(W.useRef)({}),Pe=Object(W.useRef)(),_e=Object(W.useRef)(!1),le=Object(W.useRef)(),fe=Object(W.useState)(!1),Q=Object(N.a)(fe,2),Z=Q[0],re=Q[1];function oe(){var dt;return Ke.current&&(dt=new k.default(function(mt){var xt=Object(z.a)(mt),Dt;try{for(xt.s();!(Dt=xt.n()).done;){var Wt=Dt.value;(Wt.target.offsetHeight>0||Wt.target.offsetWidth>0)&&xe.current.instance.layout()}}catch(qn){xt.e(qn)}finally{xt.f()}}),dt.observe(Ke.current)),dt}function ge(){D.b.warn(decodeURIComponent(T))}var Oe=function(){var mt=xe.current.instance;if(ee!=null&&mt&&Z){var xt=mt.getModel();xt&&ee!==xt.getValue()&&(m=!0,xt.setValue(ee),mt.layout(),m=!1)}};Object(W.useEffect)(function(){Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(function(){Oe()},500)},[ee,Z,xe.current]),Object(W.useEffect)(function(){if(je&&xe.current&&xe.current.instance){var dt=xe.current.instance;dt.changeViewZones(function(xt){var Dt=document.createElement("div");Dt.style.padding="10px 20px",Dt.style.width="calc(100% - 20px)",Dt.className="my-error-line-wrp",Dt.innerHTML=Se,xt.addZone({afterLineNumber:je||11,heightInLines:3,domNode:Dt})});var mt={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}};dt.addOverlayWidget(mt),dt.revealPositionInCenter({lineNumber:20,column:1})}},[je,xe.current,Z]);function De(){var dt=xe.current.instance;if(dt){var mt=dt.getSelection(),xt=xe.current.pastePos||{},Dt=new I.Range(xt.startLineNumber||mt.endLineNumber,xt.startColumn||mt.endColumn,xt.endLineNumber||mt.endLineNumber,xt.endColumn||mt.endColumn);setTimeout(function(){dt.executeEdits("",[{range:Dt,text:""}])},300)}}function $e(dt){(window.navigator.platform.match("Mac")?dt.metaKey:dt.ctrlKey)&&dt.keyCode==83&&(dt.preventDefault(),Ae())}var tt=function(){if(we&&xe.current.instance){var mt=xe.current.instance.getContentHeight();pn(mt<J?J:mt)}else pn(J)};function nt(dt){var mt=document.createEvent("MouseEvents");mt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),dt.dispatchEvent(mt)}function Et(dt,mt){var xt=window.URL||window.webkitURL||window,Dt=new Blob([mt]),Wt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Wt.href=xt.createObjectURL(Dt),Wt.download=dt,nt(Wt)}Object(W.useEffect)(function(){tt()},[tt]),Object(W.useEffect)(function(){Ke.current&&!Z&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(dt){try{I=dt,xe.current.instance=I.editor.create(Ke.current,{value:ee,language:P(de),theme:q,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},$);var mt=xe.current.instance;if(Ye(mt,I),setTimeout(function(){tt(),xe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Et(Je||"educoder.txt",mt.getValue())}})},500),xe.current.subscription=mt.onDidChangeModelContent(function(Dt){_e.current?clearTimeout(le.current):(tt(),Ie(mt.getValue(),Dt)),le.current=setTimeout(function(){_e.current=!1},500)}),window.Monaco||S(I),ke&&(mt.addCommand(I.KeyMod.CtrlCmd|I.KeyMod.Shift|I.KeyCode.KEY_V,function(){return ge(),null}),mt.addCommand(I.KeyMod.CtrlCmd|I.KeyCode.KEY_C,function(){return ge(),null})),window.Monaco=I,Ee&&mt.onDidBlurEditorWidget(function(){Ee(mt.getValue())}),Xe&&mt.onDidFocusEditorText(function(){Xe(mt.getValue())}),ke){mt.addCommand(I.KeyMod.CtrlCmd|I.KeyCode.KEY_V,function(){return ge(),null}),mt.onDidPaste(function(Dt){xe.current.pastePos=Dt});try{window.addEventListener("paste",De)}catch(Dt){}}var xt=oe();return re(!0),function(){var Dt=xe.current.instance;Dt.dispose();var Wt=Dt.getModel();Wt&&Wt.dispose(),xe.current.subscription&&xe.current.subscription.dispose(),ke&&window.removeEventListener("paste",De),xt.unobserve(Ke.current)}}catch(Dt){}})},[]),Object(W.useEffect)(function(){var dt=xe.current.instance;if(dt&&Z)return document.addEventListener("keydown",$e,!1),function(){document.removeEventListener("keydown",$e)}},[Ae,Z]),Object(W.useEffect)(function(){var dt=xe.current.instance;if(dt&&Z){var mt=P(de);I.editor.setModelLanguage(dt.getModel(),mt),console.log("language:",de,dt.getModel(),mt)}},[de,Z]),Object(W.useEffect)(function(){var dt=xe.current.instance;dt&&Z&&I.editor.setTheme(q)},[q,Z]),Object(W.useEffect)(function(){var dt=xe.current.instance;dt&&Z&&(dt.updateOptions(Object(ne.a)({},ae)),setTimeout(function(){dt.getModel().updateOptions(Object(ne.a)({},ae))},200))},[JSON.stringify(ae),Z]),Object(W.useEffect)(function(){var dt=xe.current.instance;dt&&Z&&dt.layout()},[j,J,Z]);var ct=Object(W.useState)(u(j)),st=Object(N.a)(ct,2),Ot=st[0],Tt=st[1],Bt=Object(W.useState)(u(J)),Mt=Object(N.a)(Bt,2),yt=Mt[0],pn=Mt[1],bn=Object(ne.a)(Object(ne.a)({},ce),{},{width:Ot,height:yt});return B.a.createElement("div",{className:"my-monaco-editor",ref:Ke,style:bn})};function F(L){var v=L.width,j=v===void 0?"100%":v,K=L.height,J=K===void 0?"100%":K,ee=L.original,ve=L.modified,de=L.language,me=L.options,ce=me===void 0?{}:me,pe=Object(W.useRef)(),ae=Object(W.useState)(null),he=Object(N.a)(ae,2),$=he[0],ie=he[1];function q(we){var Re;return pe.current&&(Re=new k.default(function(ke){var Ne=Object(z.a)(ke),Ie;try{for(Ne.s();!(Ie=Ne.n()).done;){var Le=Ie.value;(Le.target.offsetHeight>0||Le.target.offsetWidth>0)&&we.layout()}}catch(Ye){Ne.e(Ye)}finally{Ne.f()}}),Re.observe(pe.current)),Re}Object(W.useEffect)(function(){pe.current&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(we){I=we;var Re=I.editor.createDiffEditor(pe.current,Object(ne.a)(Object(ne.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},ce),{},{wordWrap:!0}));ie(Re);var ke=q(Re);return function(){Re.dispose();var Ne=Re.getModel();Ne&&Ne.dispose(),ke.unobserve(pe.current)}})},[]),Object(W.useEffect)(function(){$&&$.setModel({original:I.editor.createModel(ee,de),modified:I.editor.createModel(ve,de)})},[ee,ve,de,$]);var Ee=u(j),Ae=u(J),ye={width:Ee,height:Ae};return B.a.createElement("div",{className:"my-diff-editor",ref:pe,style:ye})}},ZpRC:function(at,Ve,te){"use strict";function ne(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 o=function(c){if(!c.ownerDocument||!c.ownerDocument.defaultView)return null;try{return c.ownerDocument.defaultView.frameElement}catch(s){return null}}(d);return!!o&&(o.clientHeight<d.scrollHeight||o.clientWidth<d.scrollWidth)}(g)}return!1}function z(g,p,f,d,o,c,s,a){return c<g&&s>p||c>g&&s<p?0:c<=g&&a<=f||s>=p&&a>=f?c-g-d:s>p&&a<f||c<g&&a>f?s-p+o:0}var N=function(g,p){var f=window,d=p.scrollMode,o=p.block,c=p.inline,s=p.boundary,a=p.skipOverflowHiddenElements,l=typeof s=="function"?s:function(Re){return Re!==s};if(!ne(g))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,O=[],w=g;ne(w)&&l(w);){if((w=w.parentElement)===h){O.push(w);break}w!=null&&w===document.body&&D(w)&&!D(document.documentElement)||w!=null&&D(w,a)&&O.push(w)}for(var x=f.visualViewport?f.visualViewport.width:innerWidth,A=f.visualViewport?f.visualViewport.height:innerHeight,S=window.scrollX||pageXOffset,T=window.scrollY||pageYOffset,E=g.getBoundingClientRect(),_=E.height,u=E.width,y=E.top,m=E.right,b=E.bottom,P=E.left,I=o==="start"||o==="nearest"?y:o==="end"?b:y+_/2,U=c==="center"?P+u/2:c==="end"?m:P,F=[],L=0;L<O.length;L++){var v=O[L],j=v.getBoundingClientRect(),K=j.height,J=j.width,ee=j.top,ve=j.right,de=j.bottom,me=j.left;if(d==="if-needed"&&y>=0&&P>=0&&b<=A&&m<=x&&y>=ee&&b<=de&&P>=me&&m<=ve)return F;var ce=getComputedStyle(v),pe=parseInt(ce.borderLeftWidth,10),ae=parseInt(ce.borderTopWidth,10),he=parseInt(ce.borderRightWidth,10),$=parseInt(ce.borderBottomWidth,10),ie=0,q=0,Ee="offsetWidth"in v?v.offsetWidth-v.clientWidth-pe-he:0,Ae="offsetHeight"in v?v.offsetHeight-v.clientHeight-ae-$:0;if(h===v)ie=o==="start"?I:o==="end"?I-A:o==="nearest"?z(T,T+A,A,ae,$,T+I,T+I+_,_):I-A/2,q=c==="start"?U:c==="center"?U-x/2:c==="end"?U-x:z(S,S+x,x,pe,he,S+U,S+U+u,u),ie=Math.max(0,ie+T),q=Math.max(0,q+S);else{ie=o==="start"?I-ee-ae:o==="end"?I-de+$+Ae:o==="nearest"?z(ee,de,K,ae,$+Ae,I,I+_,_):I-(ee+K/2)+Ae/2,q=c==="start"?U-me-pe:c==="center"?U-(me+J/2)+Ee/2:c==="end"?U-ve+he+Ee:z(me,ve,J,pe,he+Ee,U,U+u,u);var ye=v.scrollLeft,we=v.scrollTop;I+=we-(ie=Math.max(0,Math.min(we+ie,v.scrollHeight-K+Ae))),U+=ye-(q=Math.max(0,Math.min(ye+q,v.scrollWidth-J+Ee)))}F.push({el:v,top:ie,left:q})}return F};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 o=d.el,c=d.top,s=d.left;o.scroll&&f?o.scroll({top:c,left:s,behavior:p}):(o.scrollTop=c,o.scrollLeft=s)})}function B(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=B(p);return W(N(g,d),d.behavior)}var R=Ve.a=k},Zss7:function(at,Ve,te){var ne;(function(V){var D=/^\s+/,z=/\s+$/,N=0,M=V.round,W=V.min,B=V.max,k=V.random;function R($,ie){if($=$||"",ie=ie||{},$ instanceof R)return $;if(!(this instanceof R))return new R($,ie);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=ie.format||q.format,this._gradientType=ie.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(),ie,q,Ee,Ae,ye,we;return ie=$.r/255,q=$.g/255,Ee=$.b/255,ie<=.03928?Ae=ie/12.92:Ae=V.pow((ie+.055)/1.055,2.4),q<=.03928?ye=q/12.92:ye=V.pow((q+.055)/1.055,2.4),Ee<=.03928?we=Ee/12.92:we=V.pow((Ee+.055)/1.055,2.4),.2126*Ae+.7152*ye+.0722*we},setAlpha:function($){return this._a=F($),this._roundA=M(100*this._a)/100,this},toHsv:function(){var $=o(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=o(this._r,this._g,this._b),ie=M($.h*360),q=M($.s*100),Ee=M($.v*100);return this._a==1?"hsv("+ie+", "+q+"%, "+Ee+"%)":"hsva("+ie+", "+q+"%, "+Ee+"%, "+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),ie=M($.h*360),q=M($.s*100),Ee=M($.l*100);return this._a==1?"hsl("+ie+", "+q+"%, "+Ee+"%)":"hsla("+ie+", "+q+"%, "+Ee+"%, "+this._roundA+")"},toHex:function($){return s(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(L(this._r,255)*100)+"%",g:M(L(this._g,255)*100)+"%",b:M(L(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+M(L(this._r,255)*100)+"%, "+M(L(this._g,255)*100)+"%, "+M(L(this._b,255)*100)+"%)":"rgba("+M(L(this._r,255)*100)+"%, "+M(L(this._g,255)*100)+"%, "+M(L(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:I[s(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var ie="#"+l(this._r,this._g,this._b,this._a),q=ie,Ee=this._gradientType?"GradientType = 1, ":"";if($){var Ae=R($);q="#"+l(Ae._r,Ae._g,Ae._b,Ae._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ie+",endColorstr="+q+")"},toString:function($){var ie=!!$;$=$||this._format;var q=!1,Ee=this._a<1&&this._a>=0,Ae=!ie&&Ee&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Ae?$==="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($,ie){var q=$.apply(null,[this].concat([].slice.call(ie)));return this._r=q._r,this._g=q._g,this._b=q._b,this.setAlpha(q._a),this},lighten:function(){return this._applyModification(x,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(S,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(O,arguments)},greyscale:function(){return this._applyModification(w,arguments)},spin:function(){return this._applyModification(T,arguments)},_applyCombination:function($,ie){return $.apply(null,[this].concat([].slice.call(ie)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(E,arguments)},monochromatic:function(){return this._applyCombination(b,arguments)},splitcomplement:function(){return this._applyCombination(y,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(u,arguments)}},R.fromRatio=function($,ie){if(typeof $=="object"){var q={};for(var Ee in $)$.hasOwnProperty(Ee)&&(Ee==="a"?q[Ee]=$[Ee]:q[Ee]=ve($[Ee]));$=q}return R($,ie)};function g($){var ie={r:0,g:0,b:0},q=1,Ee=null,Ae=null,ye=null,we=!1,Re=!1;return typeof $=="string"&&($=ae($)),typeof $=="object"&&(pe($.r)&&pe($.g)&&pe($.b)?(ie=p($.r,$.g,$.b),we=!0,Re=String($.r).substr(-1)==="%"?"prgb":"rgb"):pe($.h)&&pe($.s)&&pe($.v)?(Ee=ve($.s),Ae=ve($.v),ie=c($.h,Ee,Ae),we=!0,Re="hsv"):pe($.h)&&pe($.s)&&pe($.l)&&(Ee=ve($.s),ye=ve($.l),ie=d($.h,Ee,ye),we=!0,Re="hsl"),$.hasOwnProperty("a")&&(q=$.a)),q=F(q),{ok:we,format:$.format||Re,r:W(255,B(ie.r,0)),g:W(255,B(ie.g,0)),b:W(255,B(ie.b,0)),a:q}}function p($,ie,q){return{r:L($,255)*255,g:L(ie,255)*255,b:L(q,255)*255}}function f($,ie,q){$=L($,255),ie=L(ie,255),q=L(q,255);var Ee=B($,ie,q),Ae=W($,ie,q),ye,we,Re=(Ee+Ae)/2;if(Ee==Ae)ye=we=0;else{var ke=Ee-Ae;we=Re>.5?ke/(2-Ee-Ae):ke/(Ee+Ae);switch(Ee){case $:ye=(ie-q)/ke+(ie<q?6:0);break;case ie:ye=(q-$)/ke+2;break;case q:ye=($-ie)/ke+4;break}ye/=6}return{h:ye,s:we,l:Re}}function d($,ie,q){var Ee,Ae,ye;$=L($,360),ie=L(ie,100),q=L(q,100);function we(Ne,Ie,Le){return Le<0&&(Le+=1),Le>1&&(Le-=1),Le<1/6?Ne+(Ie-Ne)*6*Le:Le<1/2?Ie:Le<2/3?Ne+(Ie-Ne)*(2/3-Le)*6:Ne}if(ie===0)Ee=Ae=ye=q;else{var Re=q<.5?q*(1+ie):q+ie-q*ie,ke=2*q-Re;Ee=we(ke,Re,$+1/3),Ae=we(ke,Re,$),ye=we(ke,Re,$-1/3)}return{r:Ee*255,g:Ae*255,b:ye*255}}function o($,ie,q){$=L($,255),ie=L(ie,255),q=L(q,255);var Ee=B($,ie,q),Ae=W($,ie,q),ye,we,Re=Ee,ke=Ee-Ae;if(we=Ee===0?0:ke/Ee,Ee==Ae)ye=0;else{switch(Ee){case $:ye=(ie-q)/ke+(ie<q?6:0);break;case ie:ye=(q-$)/ke+2;break;case q:ye=($-ie)/ke+4;break}ye/=6}return{h:ye,s:we,v:Re}}function c($,ie,q){$=L($,360)*6,ie=L(ie,100),q=L(q,100);var Ee=V.floor($),Ae=$-Ee,ye=q*(1-ie),we=q*(1-Ae*ie),Re=q*(1-(1-Ae)*ie),ke=Ee%6,Ne=[q,we,ye,ye,Re,q][ke],Ie=[Re,q,q,we,ye,ye][ke],Le=[ye,ye,Re,q,q,we][ke];return{r:Ne*255,g:Ie*255,b:Le*255}}function s($,ie,q,Ee){var Ae=[ee(M($).toString(16)),ee(M(ie).toString(16)),ee(M(q).toString(16))];return Ee&&Ae[0].charAt(0)==Ae[0].charAt(1)&&Ae[1].charAt(0)==Ae[1].charAt(1)&&Ae[2].charAt(0)==Ae[2].charAt(1)?Ae[0].charAt(0)+Ae[1].charAt(0)+Ae[2].charAt(0):Ae.join("")}function a($,ie,q,Ee,Ae){var ye=[ee(M($).toString(16)),ee(M(ie).toString(16)),ee(M(q).toString(16)),ee(de(Ee))];return Ae&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)&&ye[3].charAt(0)==ye[3].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0)+ye[3].charAt(0):ye.join("")}function l($,ie,q,Ee){var Ae=[ee(de(Ee)),ee(M($).toString(16)),ee(M(ie).toString(16)),ee(M(q).toString(16))];return Ae.join("")}R.equals=function($,ie){return!$||!ie?!1:R($).toRgbString()==R(ie).toRgbString()},R.random=function(){return R.fromRatio({r:k(),g:k(),b:k()})};function h($,ie){ie=ie===0?0:ie||10;var q=R($).toHsl();return q.s-=ie/100,q.s=v(q.s),R(q)}function O($,ie){ie=ie===0?0:ie||10;var q=R($).toHsl();return q.s+=ie/100,q.s=v(q.s),R(q)}function w($){return R($).desaturate(100)}function x($,ie){ie=ie===0?0:ie||10;var q=R($).toHsl();return q.l+=ie/100,q.l=v(q.l),R(q)}function A($,ie){ie=ie===0?0:ie||10;var q=R($).toRgb();return q.r=B(0,W(255,q.r-M(255*-(ie/100)))),q.g=B(0,W(255,q.g-M(255*-(ie/100)))),q.b=B(0,W(255,q.b-M(255*-(ie/100)))),R(q)}function S($,ie){ie=ie===0?0:ie||10;var q=R($).toHsl();return q.l-=ie/100,q.l=v(q.l),R(q)}function T($,ie){var q=R($).toHsl(),Ee=(q.h+ie)%360;return q.h=Ee<0?360+Ee:Ee,R(q)}function E($){var ie=R($).toHsl();return ie.h=(ie.h+180)%360,R(ie)}function _($){var ie=R($).toHsl(),q=ie.h;return[R($),R({h:(q+120)%360,s:ie.s,l:ie.l}),R({h:(q+240)%360,s:ie.s,l:ie.l})]}function u($){var ie=R($).toHsl(),q=ie.h;return[R($),R({h:(q+90)%360,s:ie.s,l:ie.l}),R({h:(q+180)%360,s:ie.s,l:ie.l}),R({h:(q+270)%360,s:ie.s,l:ie.l})]}function y($){var ie=R($).toHsl(),q=ie.h;return[R($),R({h:(q+72)%360,s:ie.s,l:ie.l}),R({h:(q+216)%360,s:ie.s,l:ie.l})]}function m($,ie,q){ie=ie||6,q=q||30;var Ee=R($).toHsl(),Ae=360/q,ye=[R($)];for(Ee.h=(Ee.h-(Ae*ie>>1)+720)%360;--ie;)Ee.h=(Ee.h+Ae)%360,ye.push(R(Ee));return ye}function b($,ie){ie=ie||6;for(var q=R($).toHsv(),Ee=q.h,Ae=q.s,ye=q.v,we=[],Re=1/ie;ie--;)we.push(R({h:Ee,s:Ae,v:ye})),ye=(ye+Re)%1;return we}R.mix=function($,ie,q){q=q===0?0:q||50;var Ee=R($).toRgb(),Ae=R(ie).toRgb(),ye=q/100,we={r:(Ae.r-Ee.r)*ye+Ee.r,g:(Ae.g-Ee.g)*ye+Ee.g,b:(Ae.b-Ee.b)*ye+Ee.b,a:(Ae.a-Ee.a)*ye+Ee.a};return R(we)},R.readability=function($,ie){var q=R($),Ee=R(ie);return(V.max(q.getLuminance(),Ee.getLuminance())+.05)/(V.min(q.getLuminance(),Ee.getLuminance())+.05)},R.isReadable=function($,ie,q){var Ee=R.readability($,ie),Ae,ye;ye=!1,Ae=he(q);switch(Ae.level+Ae.size){case"AAsmall":case"AAAlarge":ye=Ee>=4.5;break;case"AAlarge":ye=Ee>=3;break;case"AAAsmall":ye=Ee>=7;break}return ye},R.mostReadable=function($,ie,q){var Ee=null,Ae=0,ye,we,Re,ke;q=q||{},we=q.includeFallbackColors,Re=q.level,ke=q.size;for(var Ne=0;Ne<ie.length;Ne++)ye=R.readability($,ie[Ne]),ye>Ae&&(Ae=ye,Ee=R(ie[Ne]));return R.isReadable($,Ee,{level:Re,size:ke})||!we?Ee:(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=U(P);function U($){var ie={};for(var q in $)$.hasOwnProperty(q)&&(ie[$[q]]=q);return ie}function F($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function L($,ie){K($)&&($="100%");var q=J($);return $=W(ie,B(0,parseFloat($))),q&&($=parseInt($*ie,10)/100),V.abs($-ie)<1e-6?1:$%ie/parseFloat(ie)}function v($){return W(1,B(0,$))}function j($){return parseInt($,16)}function K($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function J($){return typeof $=="string"&&$.indexOf("%")!=-1}function ee($){return $.length==1?"0"+$:""+$}function ve($){return $<=1&&($=$*100+"%"),$}function de($){return V.round(parseFloat($)*255).toString(16)}function me($){return j($)/255}var ce=function(){var $="[-\\+]?\\d+%?",ie="[-\\+]?\\d*\\.\\d+%?",q="(?:"+ie+")|(?:"+$+")",Ee="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?",Ae="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?";return{CSS_UNIT:new RegExp(q),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+Ae),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+Ae),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+Ae),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function pe($){return!!ce.CSS_UNIT.exec($)}function ae($){$=$.replace(D,"").replace(z,"").toLowerCase();var ie=!1;if(P[$])$=P[$],ie=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var q;return(q=ce.rgb.exec($))?{r:q[1],g:q[2],b:q[3]}:(q=ce.rgba.exec($))?{r:q[1],g:q[2],b:q[3],a:q[4]}:(q=ce.hsl.exec($))?{h:q[1],s:q[2],l:q[3]}:(q=ce.hsla.exec($))?{h:q[1],s:q[2],l:q[3],a:q[4]}:(q=ce.hsv.exec($))?{h:q[1],s:q[2],v:q[3]}:(q=ce.hsva.exec($))?{h:q[1],s:q[2],v:q[3],a:q[4]}:(q=ce.hex8.exec($))?{r:j(q[1]),g:j(q[2]),b:j(q[3]),a:me(q[4]),format:ie?"name":"hex8"}:(q=ce.hex6.exec($))?{r:j(q[1]),g:j(q[2]),b:j(q[3]),format:ie?"name":"hex"}:(q=ce.hex4.exec($))?{r:j(q[1]+""+q[1]),g:j(q[2]+""+q[2]),b:j(q[3]+""+q[3]),a:me(q[4]+""+q[4]),format:ie?"name":"hex8"}:(q=ce.hex3.exec($))?{r:j(q[1]+""+q[1]),g:j(q[2]+""+q[2]),b:j(q[3]+""+q[3]),format:ie?"name":"hex"}:!1}function he($){var ie,q;return $=$||{level:"AA",size:"small"},ie=($.level||"AA").toUpperCase(),q=($.size||"small").toLowerCase(),ie!=="AA"&&ie!=="AAA"&&(ie="AA"),q!=="small"&&q!=="large"&&(q="small"),{level:ie,size:q}}at.exports?at.exports=R:!(ne=function(){return R}.call(Ve,te,Ve,at),ne!==void 0&&(at.exports=ne))})(Math)},bT9E:function(at,Ve,te){"use strict";te.d(Ve,"a",function(){return V});var ne=te("VTBJ");function V(D,z){var N=Object(ne.a)({},D);return Array.isArray(z)&&z.forEach(function(M){delete N[M]}),N}},c5Ni:function(at,Ve,te){},dejd:function(at,Ve,te){},dmUQ:function(at,Ve,te){"use strict";var ne=te("Ff2n"),V=te("rePB"),D=te("1OyB"),z=te("vuIU"),N=te("Ji7U"),M=te("md7G"),W=te("foSv"),B=te("cDcd"),k=te.n(B),R=te("TSYQ"),g=te.n(R),p=te("4IlW");function f(_,u){var y=Object.keys(_);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(_);u&&(m=m.filter(function(b){return Object.getOwnPropertyDescriptor(_,b).enumerable})),y.push.apply(y,m)}return y}function d(_){for(var u=1;u<arguments.length;u++){var y=arguments[u]!=null?arguments[u]:{};u%2?f(Object(y),!0).forEach(function(m){Object(V.a)(_,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(y)):f(Object(y)).forEach(function(m){Object.defineProperty(_,m,Object.getOwnPropertyDescriptor(y,m))})}return _}function o(_){var u=c();return function(){var m=Object(W.a)(_),b;if(u){var P=Object(W.a)(this).constructor;b=Reflect.construct(m,arguments,P)}else b=m.apply(this,arguments);return Object(M.a)(this,b)}}function c(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(_){return!1}}function s(){}function a(_){_.preventDefault()}var l=function(u){return u.replace(/[^\w.-]+/g,"")},h=200,O=600,w=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,x=function(u){return u!=null},A=function(u,y){return y===u||typeof y=="number"&&typeof u=="number"&&isNaN(y)&&isNaN(u)},S=function(_){Object(N.a)(y,_);var u=o(y);function y(m){var b;Object(D.a)(this,y),b=u.call(this,m),b.onKeyDown=function(U){var F=b.props,L=F.onKeyDown,v=F.onPressEnter;if(U.keyCode===p.a.UP){var j=b.getRatio(U);b.up(U,j,null),b.stop()}else if(U.keyCode===p.a.DOWN){var K=b.getRatio(U);b.down(U,K,null),b.stop()}else U.keyCode===p.a.ENTER&&v&&v(U);if(b.recordCursorPosition(),b.lastKeyCode=U.keyCode,L){for(var J=arguments.length,ee=new Array(J>1?J-1:0),ve=1;ve<J;ve++)ee[ve-1]=arguments[ve];L.apply(void 0,[U].concat(ee))}},b.onKeyUp=function(U){var F=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),F){for(var L=arguments.length,v=new Array(L>1?L-1:0),j=1;j<L;j++)v[j-1]=arguments[j];F.apply(void 0,[U].concat(v))}},b.onChange=function(U){var F=b.props.onChange;b.state.focused&&(b.inputting=!0),b.rawInput=b.props.parser(b.getValueFromEvent(U)),b.setState({inputValue:b.rawInput}),F(b.toNumber(b.rawInput))},b.onMouseUp=function(){var U=b.props.onMouseUp;b.recordCursorPosition(),U&&U.apply(void 0,arguments)},b.onFocus=function(){var U;b.setState({focused:!0}),(U=b.props).onFocus.apply(U,arguments)},b.onBlur=function(){var U=b.props.onBlur;b.inputting=!1,b.setState({focused:!1});var F=b.getCurrentValidValue(b.state.inputValue),L=b.setValue(F,s);if(U){var v=b.input.value,j=b.getInputDisplayValue({focus:!1,value:L});b.input.value=j&&Number(j),U.apply(void 0,arguments),b.input.value=v}},b.getRatio=function(U){var F=1;return U.metaKey||U.ctrlKey?F=.1:U.shiftKey&&(F=10),F},b.getFullNum=function(U){return isNaN(U)?U:/e/i.test(String(U))?Number(U).toFixed(18).replace(/\.?0+$/,""):U},b.getPrecision=function(U){if(x(b.props.precision))return b.props.precision;var F=String(U);if(F.indexOf("e-")>=0)return parseInt(F.slice(F.indexOf("e-")+2),10);var L=0;return F.indexOf(".")>=0&&(L=F.length-F.indexOf(".")-1),L},b.getInputDisplayValue=function(U){var F=U||b.state,L=F.focused,v=F.inputValue,j=F.value,K;L?K=v:K=b.toPrecisionAsStep(j),K==null&&(K="");var J=b.formatWrapper(K);return x(b.props.decimalSeparator)&&(J=J.toString().replace(".",b.props.decimalSeparator)),J},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch(U){}},b.restoreByAfter=function(U){if(U===void 0)return!1;var F=b.input.value,L=F.lastIndexOf(U);if(L===-1)return!1;var v=b.cursorBefore.length;return b.lastKeyCode===p.a.DELETE&&b.cursorBefore.charAt(v-1)===U[0]?(b.fixCaret(v,v),!0):L+U.length===F.length?(b.fixCaret(L,L),!0):!1},b.partRestoreByAfter=function(U){return U===void 0?!1:Array.prototype.some.call(U,function(F,L){var v=U.substring(L);return b.restoreByAfter(v)})},b.isNotCompleteNumber=function(U){return isNaN(U)||U===""||U===null||U&&U.toString().indexOf(".")===U.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(U,F,L){b.pressingUpOrDown=!0,b.step("down",U,F,L)},b.up=function(U,F,L){b.pressingUpOrDown=!0,b.step("up",U,F,L)},b.saveInput=function(U){b.input=U};var P=m.value;P===void 0&&(P=m.defaultValue),b.state={focused:m.autoFocus};var I=b.getValidValue(b.toNumber(P));return b.state=d(d({},b.state),{},{inputValue:b.toPrecisionAsStep(I),value:I}),b}return Object(z.a)(y,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var P=this.props,I=P.value,U=P.onChange,F=P.max,L=P.min,v=this.state.focused;if(b){if(!A(b.value,I)||!A(b.max,F)||!A(b.min,L)){var j=v?I:this.getValidValue(I),K;this.pressingUpOrDown?K=j:this.inputting?K=this.rawInput:K=this.toPrecisionAsStep(j),this.setState({value:j,inputValue:K})}var J="value"in this.props?I:this.state.value;"max"in this.props&&b.max!==F&&typeof J=="number"&&J>F&&U&&U(F),"min"in this.props&&b.min!==L&&typeof J=="number"&&J<L&&U&&U(L)}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(ve){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(b){var P=b;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(b){var P=b.target.value.trim().replace(/。/g,".");return x(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(b){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,U=parseFloat(b);return isNaN(U)?b:(U<P&&(U=P),U>I&&(U=I),U)}},{key:"setValue",value:function(b,P){var I=this.props.precision,U=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),F=this.state.value,L=F===void 0?null:F,v=this.state.inputValue,j=v===void 0?null:v,K=typeof U=="number"?U.toFixed(I):"".concat(U),J=U!==L||K!=="".concat(j);return"value"in this.props?(j=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:j},P)):this.setState({value:U,inputValue:this.toPrecisionAsStep(b)},P),J&&this.props.onChange(U),U}},{key:"getMaxPrecision",value:function(b){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,I=this.props,U=I.precision,F=I.step;if(x(U))return U;var L=this.getPrecision(P),v=this.getPrecision(F),j=this.getPrecision(b);return b?Math.max(j,L+v):L+v}},{key:"getPrecisionFactor",value:function(b){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,I=this.getMaxPrecision(b,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(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var P=Math.abs(this.getMaxPrecision(b));return isNaN(P)?b.toString():Number(b).toFixed(P)}},{key:"toNumber",value:function(b){var P=this.props.precision,I=this.state.focused,U=b&&b.length>16&&I;return this.isNotCompleteNumber(b)||U?b:x(P)?Math.round(b*Math.pow(10,P))/Math.pow(10,P):Number(b)}},{key:"upStep",value:function(b,P){var I=this.props.step,U=this.getPrecisionFactor(b,P),F=Math.abs(this.getMaxPrecision(b,P)),L=((U*b+U*I*P)/U).toFixed(F);return this.toNumber(L)}},{key:"downStep",value:function(b,P){var I=this.props.step,U=this.getPrecisionFactor(b,P),F=Math.abs(this.getMaxPrecision(b,P)),L=((U*b-U*I*P)/U).toFixed(F);return this.toNumber(L)}},{key:"step",value:function(b,P){var I=this,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,F=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var L=this.props;if(L.disabled)return;var v=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(v))return;var j=this["".concat(b,"Step")](v,U),K=j>L.max||j<L.min;if(j>L.max?j=L.max:j<L.min&&(j=L.min),this.setValue(j,null),this.setState({focused:!0},function(){I.pressingUpOrDown=!1}),K)return;this.autoStepTimer=setTimeout(function(){I[b](P,U,!0)},F?h:O)}},{key:"fixCaret",value:function(b,P){if(b===void 0||P===void 0||!this.input||!this.input.value)return;try{var I=this.input.selectionStart,U=this.input.selectionEnd;(b!==I||P!==U)&&this.input.setSelectionRange(b,P)}catch(F){}}},{key:"render",value:function(){var b,P=this.props,I=P.prefixCls,U=P.disabled,F=P.readOnly,L=P.useTouch,v=P.autoComplete,j=P.upHandler,K=P.downHandler,J=P.className,ee=P.max,ve=P.min,de=P.style,me=P.title,ce=P.onMouseEnter,pe=P.onMouseLeave,ae=P.onMouseOver,he=P.onMouseOut,$=P.required,ie=P.onClick,q=P.tabIndex,Ee=P.type,Ae=P.placeholder,ye=P.id,we=P.inputMode,Re=P.pattern,ke=P.step,Ne=P.maxLength,Ie=P.autoFocus,Le=P.name,Ye=P.onPaste,Qe=P.onInput,Xe=Object(ne.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"]),We=this.state,Je=We.value,je=We.focused,He=g()(I,(b={},Object(V.a)(b,J,!!J),Object(V.a)(b,"".concat(I,"-disabled"),U),Object(V.a)(b,"".concat(I,"-focused"),je),b)),Se={};Object.keys(Xe).forEach(function(oe){(oe.substr(0,5)==="data-"||oe.substr(0,5)==="aria-"||oe==="role")&&(Se[oe]=Xe[oe])});var qe=!F&&!U,Ke=this.getInputDisplayValue(null),xe=(Je||Je===0)&&(isNaN(Je)||Number(Je)>=ee),Pe=(Je||Je===0)&&(isNaN(Je)||Number(Je)<=ve),_e=xe||U||F,le=Pe||U||F,fe=g()("".concat(I,"-handler"),"".concat(I,"-handler-up"),Object(V.a)({},"".concat(I,"-handler-up-disabled"),_e)),Q=g()("".concat(I,"-handler"),"".concat(I,"-handler-down"),Object(V.a)({},"".concat(I,"-handler-down-disabled"),le)),Z=L?{onTouchStart:_e?s:this.up,onTouchEnd:this.stop}:{onMouseDown:_e?s:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},re=L?{onTouchStart:le?s:this.down,onTouchEnd:this.stop}:{onMouseDown:le?s:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:He,style:de,title:me,onMouseEnter:ce,onMouseLeave:pe,onMouseOver:ae,onMouseOut:he,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":_e,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"},re,{role:"button","aria-label":"Decrease Value","aria-disabled":le,className:Q}),K||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":ve,"aria-valuemax":ee,"aria-valuenow":Je,required:$,type:Ee,placeholder:Ae,onPaste:Ye,onClick:ie,onMouseUp:this.onMouseUp,className:"".concat(I,"-input"),tabIndex:q,autoComplete:v,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:qe?this.onKeyDown:s,onKeyUp:qe?this.onKeyUp:s,autoFocus:Ie,maxLength:Ne,readOnly:F,disabled:U,max:ee,min:ve,step:ke,name:Le,title:me,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ke),pattern:Re,inputMode:we,onInput:Qe},Se))))}}]),y}(k.a.Component);S.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:w,min:-w,step:1,style:{},onChange:s,onKeyDown:s,onPressEnter:s,onFocus:s,onBlur:s,parser:l,required:!1,autoComplete:"off"};var T=S,E=Ve.a=T},h78n:function(at,Ve,te){"use strict";te.d(Ve,"a",function(){return b});var ne=te("cDcd"),V=te.n(ne),D=te("TSYQ"),z=te.n(D),N={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},M=function(U){var F=U.map(function(){return Object(ne.useRef)()}),L=Object(ne.useRef)();return Object(ne.useEffect)(function(){var v=Date.now(),j=!1;Object.keys(F).forEach(function(K){var J=F[K].current;if(!J)return;j=!0;var ee=J.style;ee.transitionDuration=".3s, .3s, .3s, .06s",L.current&&v-L.current<100&&(ee.transitionDuration="0s, 0s")}),j&&(L.current=Date.now())}),[F]};function W(){return W=Object.assign||function(I){for(var U=1;U<arguments.length;U++){var F=arguments[U];for(var L in F)Object.prototype.hasOwnProperty.call(F,L)&&(I[L]=F[L])}return I},W.apply(this,arguments)}function B(I,U){return f(I)||p(I,U)||R(I,U)||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,U){if(!I)return;if(typeof I=="string")return g(I,U);var F=Object.prototype.toString.call(I).slice(8,-1);if(F==="Object"&&I.constructor&&(F=I.constructor.name),F==="Map"||F==="Set")return Array.from(I);if(F==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(F))return g(I,U)}function g(I,U){(U==null||U>I.length)&&(U=I.length);for(var F=0,L=new Array(U);F<U;F++)L[F]=I[F];return L}function p(I,U){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(I)))return;var F=[],L=!0,v=!1,j=void 0;try{for(var K=I[Symbol.iterator](),J;!(L=(J=K.next()).done)&&!(F.push(J.value),U&&F.length===U);L=!0);}catch(ee){v=!0,j=ee}finally{try{!L&&K.return!=null&&K.return()}finally{if(v)throw j}}return F}function f(I){if(Array.isArray(I))return I}function d(I,U){if(I==null)return{};var F=o(I,U),L,v;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(I);for(v=0;v<j.length;v++){if(L=j[v],U.indexOf(L)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(I,L))continue;F[L]=I[L]}}return F}function o(I,U){if(I==null)return{};var F={},L=Object.keys(I),v,j;for(j=0;j<L.length;j++){if(v=L[j],U.indexOf(v)>=0)continue;F[v]=I[v]}return F}var c=function(U){var F=U.className,L=U.percent,v=U.prefixCls,j=U.strokeColor,K=U.strokeLinecap,J=U.strokeWidth,ee=U.style,ve=U.trailColor,de=U.trailWidth,me=U.transition,ce=d(U,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete ce.gapPosition;var pe=Array.isArray(L)?L:[L],ae=Array.isArray(j)?j:[j],he=M(pe),$=B(he,1),ie=$[0],q=J/2,Ee=100-J/2,Ae="M ".concat(K==="round"?q:0,",").concat(q,`
L `).concat(K==="round"?Ee:100,",").concat(q),ye="0 0 100 ".concat(J),we=0;return V.a.createElement("svg",W({className:z()("".concat(v,"-line"),F),viewBox:ye,preserveAspectRatio:"none",style:ee},ce),V.a.createElement("path",{className:"".concat(v,"-line-trail"),d:Ae,strokeLinecap:K,stroke:ve,strokeWidth:de||J,fillOpacity:"0"}),pe.map(function(Re,ke){var Ne={strokeDasharray:"".concat(Re,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:me||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ie=ae[ke]||ae[ae.length-1];return we+=Re,V.a.createElement("path",{key:ke,className:"".concat(v,"-line-path"),d:Ae,strokeLinecap:K,stroke:Ie,strokeWidth:J,fillOpacity:"0",ref:ie[ke],style:Ne})}))};c.defaultProps=N;var s=c;function a(){return a=Object.assign||function(I){for(var U=1;U<arguments.length;U++){var F=arguments[U];for(var L in F)Object.prototype.hasOwnProperty.call(F,L)&&(I[L]=F[L])}return I},a.apply(this,arguments)}function l(I,U){return A(I)||x(I,U)||O(I,U)||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 O(I,U){if(!I)return;if(typeof I=="string")return w(I,U);var F=Object.prototype.toString.call(I).slice(8,-1);if(F==="Object"&&I.constructor&&(F=I.constructor.name),F==="Map"||F==="Set")return Array.from(I);if(F==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(F))return w(I,U)}function w(I,U){(U==null||U>I.length)&&(U=I.length);for(var F=0,L=new Array(U);F<U;F++)L[F]=I[F];return L}function x(I,U){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(I)))return;var F=[],L=!0,v=!1,j=void 0;try{for(var K=I[Symbol.iterator](),J;!(L=(J=K.next()).done)&&!(F.push(J.value),U&&F.length===U);L=!0);}catch(ee){v=!0,j=ee}finally{try{!L&&K.return!=null&&K.return()}finally{if(v)throw j}}return F}function A(I){if(Array.isArray(I))return I}function S(I,U){if(I==null)return{};var F=T(I,U),L,v;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(I);for(v=0;v<j.length;v++){if(L=j[v],U.indexOf(L)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(I,L))continue;F[L]=I[L]}}return F}function T(I,U){if(I==null)return{};var F={},L=Object.keys(I),v,j;for(j=0;j<L.length;j++){if(v=L[j],U.indexOf(v)>=0)continue;F[v]=I[v]}return F}var E=0;function _(I){return+I.replace("%","")}function u(I){return Array.isArray(I)?I:[I]}function y(I,U,F,L){var v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,j=arguments.length>5?arguments[5]:void 0,K=50-L/2,J=0,ee=-K,ve=0,de=-2*K;switch(j){case"left":J=-K,ee=0,ve=2*K,de=0;break;case"right":J=K,ee=0,ve=-2*K,de=0;break;case"bottom":ee=K,de=2*K;break;default:}var me="M 50,50 m ".concat(J,",").concat(ee,`
a `).concat(K,",").concat(K," 0 1 1 ").concat(ve,",").concat(-de,`
a `).concat(K,",").concat(K," 0 1 1 ").concat(-ve,",").concat(de),ce=Math.PI*2*K,pe={stroke:F,strokeDasharray:"".concat(U/100*(ce-v),"px ").concat(ce,"px"),strokeDashoffset:"-".concat(v/2+I/100*(ce-v),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:me,pathStyle:pe}}var m=function(U){var F=U.prefixCls,L=U.strokeWidth,v=U.trailWidth,j=U.gapDegree,K=U.gapPosition,J=U.trailColor,ee=U.strokeLinecap,ve=U.style,de=U.className,me=U.strokeColor,ce=U.percent,pe=S(U,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ae=Object(ne.useMemo)(function(){return E+=1,E},[]),he=y(0,100,J,L,j,K),$=he.pathString,ie=he.pathStyle,q=u(ce),Ee=u(me),Ae=Ee.find(function(Ne){return Object.prototype.toString.call(Ne)==="[object Object]"}),ye=M(q),we=l(ye,1),Re=we[0],ke=function(){var Ie=0;return q.map(function(Le,Ye){var Qe=Ee[Ye]||Ee[Ee.length-1],Xe=Object.prototype.toString.call(Qe)==="[object Object]"?"url(#".concat(F,"-gradient-").concat(ae,")"):"",We=y(Ie,Le,Qe,L,j,K);return Ie+=Le,V.a.createElement("path",{key:Ye,className:"".concat(F,"-circle-path"),d:We.pathString,stroke:Xe,strokeLinecap:ee,strokeWidth:L,opacity:Le===0?0:1,fillOpacity:"0",style:We.pathStyle,ref:Re[Ye]})})};return V.a.createElement("svg",a({className:z()("".concat(F,"-circle"),de),viewBox:"0 0 100 100",style:ve},pe),Ae&&V.a.createElement("defs",null,V.a.createElement("linearGradient",{id:"".concat(F,"-gradient-").concat(ae),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ae).sort(function(Ne,Ie){return _(Ne)-_(Ie)}).map(function(Ne,Ie){return V.a.createElement("stop",{key:Ie,offset:Ne,stopColor:Ae[Ne]})}))),V.a.createElement("path",{className:"".concat(F,"-circle-trail"),d:$,stroke:J,strokeLinecap:ee,strokeWidth:v||L,fillOpacity:"0",style:ie}),ke().reverse())};m.defaultProps=N;var b=m,P={Line:s,Circle:b}},kSUc:function(at,Ve,te){},lZu9:function(at,Ve,te){(function(ne){ne(te("VrN/"),te("1eCo"),te("8EBN"))})(function(ne){"use strict";ne.defineMode("markdown",function(V,D){var z=ne.getMode(V,"text/html"),N=z.name=="null";function M(L){if(ne.findModeByName){var v=ne.findModeByName(L);v&&(L=v.mime||v.mimes[0])}var j=ne.getMode(V,L);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 B in W)W.hasOwnProperty(B)&&D.tokenTypeOverrides[B]&&(W[B]=D.tokenTypeOverrides[B]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,p=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,d=/^[^#!\[\]*_\\<>` "'(~:]+/,o=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,c=/^\s*\[[^\]]+?\]:.*$/,s=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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(L,v,j){return v.f=v.inline=j,j(L,v)}function h(L,v,j){return v.f=v.block=j,j(L,v)}function O(L){return!L||!/\S/.test(L.string)}function w(L){if(L.linkTitle=!1,L.linkHref=!1,L.linkText=!1,L.em=!1,L.strong=!1,L.strikethrough=!1,L.quote=0,L.indentedCode=!1,L.f==A){var v=N;if(!v){var j=ne.innerMode(z,L.htmlState);v=j.mode.name=="xml"&&j.state.tagStart===null&&!j.state.context&&j.state.tokenize.isInText}v&&(L.f=_,L.block=x,L.htmlState=null)}return L.trailingSpace=0,L.trailingSpaceNewLine=!1,L.prevLine=L.thisLine,L.thisLine={stream:null},null}function x(L,v){var j=L.column()===v.indentation,K=O(v.prevLine.stream),J=v.indentedCode,ee=v.prevLine.hr,ve=v.list!==!1,de=(v.listStack[v.listStack.length-1]||0)+3;v.indentedCode=!1;var me=v.indentation;if(v.indentationDiff===null&&(v.indentationDiff=v.indentation,ve)){for(v.list=null;me<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=me-v.listStack[v.listStack.length-1])}var ce=!K&&!ee&&!v.prevLine.header&&(!ve||!J)&&!v.prevLine.fencedCodeEnd,pe=(v.list===!1||ee||K)&&v.indentation<=de&&L.match(k),ae=null;if(v.indentationDiff>=4&&(J||v.prevLine.fencedCodeEnd||v.prevLine.header||K))return L.skipToEnd(),v.indentedCode=!0,W.code;if(L.eatSpace())return null;if(j&&v.indentation<=de&&(ae=L.match(p))&&ae[1].length<=6)return v.quote=0,v.header=ae[1].length,v.thisLine.header=!0,D.highlightFormatting&&(v.formatting="header"),v.f=v.inline,T(v);if(v.indentation<=de&&L.eat(">"))return v.quote=j?1:v.quote+1,D.highlightFormatting&&(v.formatting="quote"),L.eatSpace(),T(v);if(!pe&&!v.setext&&j&&v.indentation<=de&&(ae=L.match(R))){var he=ae[1]?"ol":"ul";return v.indentation=me+L.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&&L.match(g,!1)&&(v.taskList=!0),v.f=v.inline,D.highlightFormatting&&(v.formatting=["list","list-"+he]),T(v)}else{if(j&&v.indentation<=de&&(ae=L.match(o,!0)))return v.quote=0,v.fencedEndRE=new RegExp(ae[1]+"+ *$"),v.localMode=D.fencedCodeBlockHighlighting&&M(ae[2]||D.fencedCodeBlockDefaultMode),v.localMode&&(v.localState=ne.startState(v.localMode)),v.f=v.block=S,D.highlightFormatting&&(v.formatting="code-block"),v.code=-1,T(v);if(v.setext||(!ce||!ve)&&!v.quote&&v.list===!1&&!v.code&&!pe&&!c.test(L.string)&&(ae=L.lookAhead(1))&&(ae=ae.match(f)))return v.setext?(v.header=v.setext,v.setext=0,L.skipToEnd(),D.highlightFormatting&&(v.formatting="header")):(v.header=ae[0].charAt(0)=="="?1:2,v.setext=v.header),v.thisLine.header=!0,v.f=v.inline,T(v);if(pe)return L.skipToEnd(),v.hr=!0,v.thisLine.hr=!0,W.hr;if(L.peek()==="[")return l(L,v,P)}return l(L,v,v.inline)}function A(L,v){var j=z.token(L,v.htmlState);if(!N){var K=ne.innerMode(z,v.htmlState);(K.mode.name=="xml"&&K.state.tagStart===null&&!K.state.context&&K.state.tokenize.isInText||v.md_inside&&L.current().indexOf(">")>-1)&&(v.f=_,v.block=x,v.htmlState=null)}return j}function S(L,v){var j=v.listStack[v.listStack.length-1]||0,K=v.indentation<j,J=j+3;if(v.fencedEndRE&&v.indentation<=J&&(K||L.match(v.fencedEndRE))){D.highlightFormatting&&(v.formatting="code-block");var ee;return K||(ee=T(v)),v.localMode=v.localState=null,v.block=x,v.f=_,v.fencedEndRE=null,v.code=0,v.thisLine.fencedCodeEnd=!0,K?h(L,v,v.block):ee}else return v.localMode?v.localMode.token(L,v.localState):(L.skipToEnd(),W.code)}function T(L){var v=[];if(L.formatting){v.push(W.formatting),typeof L.formatting=="string"&&(L.formatting=[L.formatting]);for(var j=0;j<L.formatting.length;j++)v.push(W.formatting+"-"+L.formatting[j]),L.formatting[j]==="header"&&v.push(W.formatting+"-"+L.formatting[j]+"-"+L.header),L.formatting[j]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=L.quote?v.push(W.formatting+"-"+L.formatting[j]+"-"+L.quote):v.push("error"))}if(L.taskOpen)return v.push("meta"),v.length?v.join(" "):null;if(L.taskClosed)return v.push("property"),v.length?v.join(" "):null;if(L.linkHref?v.push(W.linkHref,"url"):(L.strong&&v.push(W.strong),L.em&&v.push(W.em),L.strikethrough&&v.push(W.strikethrough),L.emoji&&v.push(W.emoji),L.linkText&&v.push(W.linkText),L.code&&v.push(W.code),L.image&&v.push(W.image),L.imageAltText&&v.push(W.imageAltText,"link"),L.imageMarker&&v.push(W.imageMarker)),L.header&&v.push(W.header,W.header+"-"+L.header),L.quote&&(v.push(W.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=L.quote?v.push(W.quote+"-"+L.quote):v.push(W.quote+"-"+D.maxBlockquoteDepth)),L.list!==!1){var K=(L.listStack.length-1)%3;K?K===1?v.push(W.list2):v.push(W.list3):v.push(W.list1)}return L.trailingSpaceNewLine?v.push("trailing-space-new-line"):L.trailingSpace&&v.push("trailing-space-"+(L.trailingSpace%2?"a":"b")),v.length?v.join(" "):null}function E(L,v){return L.match(d,!0)?T(v):void 0}function _(L,v){var j=v.text(L,v);if(typeof j!="undefined")return j;if(v.list)return v.list=null,T(v);if(v.taskList){var K=L.match(g,!0)[1]===" ";return K?v.taskOpen=!0:v.taskClosed=!0,D.highlightFormatting&&(v.formatting="task"),v.taskList=!1,T(v)}if(v.taskOpen=!1,v.taskClosed=!1,v.header&&L.match(/^#+$/,!0))return D.highlightFormatting&&(v.formatting="header"),T(v);var J=L.next();if(v.linkTitle){v.linkTitle=!1;var ee=J;J==="("&&(ee=")"),ee=(ee+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ve="^\\s*(?:[^"+ee+"\\\\]+|\\\\\\\\|\\\\.)"+ee;if(L.match(new RegExp(ve),!0))return W.linkHref}if(J==="`"){var de=v.formatting;D.highlightFormatting&&(v.formatting="code"),L.eatWhile("`");var me=L.current().length;if(v.code==0&&(!v.quote||me==1))return v.code=me,T(v);if(me==v.code){var ce=T(v);return v.code=0,ce}else return v.formatting=de,T(v)}else if(v.code)return T(v);if(J==="\\"&&(L.next(),D.highlightFormatting)){var pe=T(v),ae=W.formatting+"-escape";return pe?pe+" "+ae:ae}if(J==="!"&&L.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return v.imageMarker=!0,v.image=!0,D.highlightFormatting&&(v.formatting="image"),T(v);if(J==="["&&v.imageMarker&&L.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return v.imageMarker=!1,v.imageAltText=!0,D.highlightFormatting&&(v.formatting="image"),T(v);if(J==="]"&&v.imageAltText){D.highlightFormatting&&(v.formatting="image");var pe=T(v);return v.imageAltText=!1,v.image=!1,v.inline=v.f=y,pe}if(J==="["&&!v.image)return v.linkText&&L.match(/^.*?\]/)||(v.linkText=!0,D.highlightFormatting&&(v.formatting="link")),T(v);if(J==="]"&&v.linkText){D.highlightFormatting&&(v.formatting="link");var pe=T(v);return v.linkText=!1,v.inline=v.f=L.match(/\(.*?\)| ?\[.*?\]/,!1)?y:_,pe}if(J==="<"&&L.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){v.f=v.inline=u,D.highlightFormatting&&(v.formatting="link");var pe=T(v);return pe?pe+=" ":pe="",pe+W.linkInline}if(J==="<"&&L.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){v.f=v.inline=u,D.highlightFormatting&&(v.formatting="link");var pe=T(v);return pe?pe+=" ":pe="",pe+W.linkEmail}if(D.xml&&J==="<"&&L.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var he=L.string.indexOf(">",L.pos);if(he!=-1){var $=L.string.substring(L.start,he);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(v.md_inside=!0)}return L.backUp(1),v.htmlState=ne.startState(z),h(L,v,A)}if(D.xml&&J==="<"&&L.match(/^\/\w*?>/))return v.md_inside=!1,"tag";if(J==="*"||J==="_"){for(var ie=1,q=L.pos==1?" ":L.string.charAt(L.pos-2);ie<3&&L.eat(J);)ie++;var Ee=L.peek()||" ",Ae=!/\s/.test(Ee)&&(!s.test(Ee)||/\s/.test(q)||s.test(q)),ye=!/\s/.test(q)&&(!s.test(q)||/\s/.test(Ee)||s.test(Ee)),we=null,Re=null;if(ie%2&&(!v.em&&Ae&&(J==="*"||!ye||s.test(q))?we=!0:v.em==J&&ye&&(J==="*"||!Ae||s.test(Ee))&&(we=!1)),ie>1&&(!v.strong&&Ae&&(J==="*"||!ye||s.test(q))?Re=!0:v.strong==J&&ye&&(J==="*"||!Ae||s.test(Ee))&&(Re=!1)),Re!=null||we!=null){D.highlightFormatting&&(v.formatting=we==null?"strong":Re==null?"em":"strong em"),we===!0&&(v.em=J),Re===!0&&(v.strong=J);var ce=T(v);return we===!1&&(v.em=!1),Re===!1&&(v.strong=!1),ce}}else if(J===" "&&(L.eat("*")||L.eat("_"))){if(L.peek()===" ")return T(v);L.backUp(1)}if(D.strikethrough){if(J==="~"&&L.eatWhile(J)){if(v.strikethrough){D.highlightFormatting&&(v.formatting="strikethrough");var ce=T(v);return v.strikethrough=!1,ce}else if(L.match(/^[^\s]/,!1))return v.strikethrough=!0,D.highlightFormatting&&(v.formatting="strikethrough"),T(v)}else if(J===" "&&L.match(/^~~/,!0)){if(L.peek()===" ")return T(v);L.backUp(2)}}if(D.emoji&&J===":"&&L.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){v.emoji=!0,D.highlightFormatting&&(v.formatting="emoji");var ke=T(v);return v.emoji=!1,ke}return J===" "&&(L.match(/^ +$/,!1)?v.trailingSpace++:v.trailingSpace&&(v.trailingSpaceNewLine=!0)),T(v)}function u(L,v){var j=L.next();if(j===">"){v.f=v.inline=_,D.highlightFormatting&&(v.formatting="link");var K=T(v);return K?K+=" ":K="",K+W.linkInline}return L.match(/^[^>]+/,!0),W.linkInline}function y(L,v){if(L.eatSpace())return null;var j=L.next();return j==="("||j==="["?(v.f=v.inline=b(j==="("?")":"]"),D.highlightFormatting&&(v.formatting="link-string"),v.linkHref=!0,T(v)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(L){return function(v,j){var K=v.next();if(K===L){j.f=j.inline=_,D.highlightFormatting&&(j.formatting="link-string");var J=T(j);return j.linkHref=!1,J}return v.match(m[L]),j.linkHref=!0,T(j)}}function P(L,v){return L.match(/^([^\]\\]|\\.)*\]:/,!1)?(v.f=I,L.next(),D.highlightFormatting&&(v.formatting="link"),v.linkText=!0,T(v)):l(L,v,_)}function I(L,v){if(L.match(/^\]:/,!0)){v.f=v.inline=U,D.highlightFormatting&&(v.formatting="link");var j=T(v);return v.linkText=!1,j}return L.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function U(L,v){return L.eatSpace()?null:(L.match(/^[^\s]+/,!0),L.peek()===void 0?v.linkTitle=!0:L.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),v.f=v.inline=_,W.linkHref+" url")}var F={startState:function(){return{f:x,prevLine:{stream:null},thisLine:{stream:null},block:x,htmlState:null,indentation:0,inline:_,text:E,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(L){return{f:L.f,prevLine:L.prevLine,thisLine:L.thisLine,block:L.block,htmlState:L.htmlState&&ne.copyState(z,L.htmlState),indentation:L.indentation,localMode:L.localMode,localState:L.localMode?ne.copyState(L.localMode,L.localState):null,inline:L.inline,text:L.text,formatting:!1,linkText:L.linkText,linkTitle:L.linkTitle,linkHref:L.linkHref,code:L.code,em:L.em,strong:L.strong,strikethrough:L.strikethrough,emoji:L.emoji,header:L.header,setext:L.setext,hr:L.hr,taskList:L.taskList,list:L.list,listStack:L.listStack.slice(0),quote:L.quote,indentedCode:L.indentedCode,trailingSpace:L.trailingSpace,trailingSpaceNewLine:L.trailingSpaceNewLine,md_inside:L.md_inside,fencedEndRE:L.fencedEndRE}},token:function(L,v){if(v.formatting=!1,L!=v.thisLine.stream){if(v.header=0,v.hr=!1,L.match(/^\s*$/,!0))return w(v),null;if(v.prevLine=v.thisLine,v.thisLine={stream:L},v.taskList=!1,v.trailingSpace=0,v.trailingSpaceNewLine=!1,!v.localState&&(v.f=v.block,v.f!=A)){var j=L.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(v.indentation=j,v.indentationDiff=null,j>0)return null}}return v.f(L,v)},innerMode:function(L){return L.block==A?{state:L.htmlState,mode:z}:L.localState?{state:L.localState,mode:L.localMode}:{state:L,mode:F}},indent:function(L,v,j){return L.block==A&&z.indent?z.indent(L.htmlState,v,j):L.localState&&L.localMode.indent?L.localMode.indent(L.localState,v,j):ne.Pass},blankLine:w,getType:T,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return F},"xml"),ne.defineMIME("text/markdown","markdown"),ne.defineMIME("text/x-markdown","markdown")})},osHv:function(at,Ve,te){(function(ne){ne(te("VrN/"))})(function(ne){"use strict";var V=ne.Pos;function D(s,a){return s.line-a.line||s.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(s,a,l,h){this.line=a,this.ch=l,this.cm=s,this.text=s.getLine(a),this.min=h?Math.max(h.from,s.firstLine()):s.firstLine(),this.max=h?Math.min(h.to-1,s.lastLine()):s.lastLine()}function B(s,a){var l=s.cm.getTokenTypeAt(V(s.line,a));return l&&/\btag\b/.test(l)}function k(s){return s.line>=s.max?void 0:(s.ch=0,s.text=s.cm.getLine(++s.line),!0)}function R(s){return s.line<=s.min?void 0:(s.text=s.cm.getLine(--s.line),s.ch=s.text.length,!0)}function g(s){for(;;){var a=s.text.indexOf(">",s.ch);if(a==-1){if(k(s))continue;return}if(!B(s,a+1)){s.ch=a+1;continue}var l=s.text.lastIndexOf("/",a),h=l>-1&&!/\S/.test(s.text.slice(l+1,a));return s.ch=a+1,h?"selfClose":"regular"}}function p(s){for(;;){var a=s.ch?s.text.lastIndexOf("<",s.ch-1):-1;if(a==-1){if(R(s))continue;return}if(!B(s,a+1)){s.ch=a;continue}M.lastIndex=a,s.ch=a;var l=M.exec(s.text);if(l&&l.index==a)return l}}function f(s){for(;;){M.lastIndex=s.ch;var a=M.exec(s.text);if(!a){if(k(s))continue;return}if(!B(s,a.index+1)){s.ch=a.index+1;continue}return s.ch=a.index+a[0].length,a}}function d(s){for(;;){var a=s.ch?s.text.lastIndexOf(">",s.ch-1):-1;if(a==-1){if(R(s))continue;return}if(!B(s,a+1)){s.ch=a;continue}var l=s.text.lastIndexOf("/",a),h=l>-1&&!/\S/.test(s.text.slice(l+1,a));return s.ch=a+1,h?"selfClose":"regular"}}function o(s,a){for(var l=[];;){var h=f(s),O,w=s.line,x=s.ch-(h?h[0].length:0);if(!h||!(O=g(s)))return;if(O=="selfClose")continue;if(h[1]){for(var A=l.length-1;A>=0;--A)if(l[A]==h[2]){l.length=A;break}if(A<0&&(!a||a==h[2]))return{tag:h[2],from:V(w,x),to:V(s.line,s.ch)}}else l.push(h[2])}}function c(s,a){for(var l=[];;){var h=d(s);if(!h)return;if(h=="selfClose"){p(s);continue}var O=s.line,w=s.ch,x=p(s);if(!x)return;if(x[1])l.push(x[2]);else{for(var A=l.length-1;A>=0;--A)if(l[A]==x[2]){l.length=A;break}if(A<0&&(!a||a==x[2]))return{tag:x[2],from:V(s.line,s.ch),to:V(O,w)}}}}ne.registerHelper("fold","xml",function(s,a){for(var l=new W(s,a.line,0);;){var h=f(l);if(!h||l.line!=a.line)return;var O=g(l);if(!O)return;if(!h[1]&&O!="selfClose"){var w=V(l.line,l.ch),x=o(l,h[2]);return x&&D(x.from,w)>0?{from:w,to:x.from}:null}}}),ne.findMatchingTag=function(s,a,l){var h=new W(s,a.line,a.ch,l);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var O=g(h),w=O&&V(h.line,h.ch),x=O&&p(h);if(!O||!x||D(h,a)>0)return;var A={from:V(h.line,h.ch),to:w,tag:x[2]};return O=="selfClose"?{open:A,close:null,at:"open"}:x[1]?{open:c(h,x[2]),close:A,at:"close"}:(h=new W(s,w.line,w.ch,l),{open:A,close:o(h,x[2]),at:"open"})},ne.findEnclosingTag=function(s,a,l,h){for(var O=new W(s,a.line,a.ch,l);;){var w=c(O,h);if(!w)break;var x=new W(s,a.line,a.ch,l),A=o(x,w.tag);if(A)return{open:w,close:A}}},ne.scanForClosingTag=function(s,a,l,h){var O=new W(s,a.line,a.ch,h?{from:0,to:h}:null);return o(O,l)}})},p5ED:function(at,Ve,te){"use strict";var ne=te("+L6B"),V=te("2/Rp"),D=te("5Dmo"),z=te("3S7+"),N=te("k1fw"),M=te("tJVT"),W=te("cDcd"),B=te.n(W),k=te("vHTk"),R=te.n(k),g=te("yEEn"),p=te("ZW9T"),f=te("1vsH");Ve.a=function(d){var o=d.name,c=d.data,s=d.theme,a=d.type,l=d.filename,h=d.monacoEditor,O=d.className,w=d.style,x=d.close,A=d.onClose,S=d.hasMask,T=Object(W.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),E=Object(M.a)(T,2),_=E[0],u=E[1],y=Object(W.useState)(""),m=Object(M.a)(y,2),b=m[0],P=m[1],I,U=1024*1024,F=10*U,L=Object(W.useRef)();a==="office"&&(I=Object(f.V)(c).filesize,I>F&&(a="other")),l&&(h.filename=l),Object(W.useEffect)(function(){var K,J,ee=(K=document.cookie)===null||K===void 0||((J=K.replace(/\s/g,""))===null||J===void 0)?void 0:J.split(";");ee==null||ee.map(function(ve){var de=ve.split("=");de[0]==="_educoder_session"&&P(de[1])})},[]);var v=function(){if(c.startsWith("http")||c.startsWith("/")){j();return}Object(f.z)(l||"educoder",c,l)},j=function(){Object(f.x)(l||o,c)};return console.log("data:",c,"fileanme:",l," name:",o),B.a.createElement("div",{style:Object(N.a)({},w||{}),className:"".concat(S&&R.a.bgBlack," ").concat(a?R.a.wrp:"hide")},x&&B.a.createElement("div",{className:R.a.close,ref:L},B.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return L.current}},B.a.createElement("span",{onClick:j},B.a.createElement("i",{className:"icon-quxiaozhiding"}))),B.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return L.current}},B.a.createElement("span",{className:"",onClick:A},B.a.createElement("i",{className:"icon-guanbi1"})))),B.a.createElement("div",{className:"".concat(R.a[O]," ").concat(O," ").concat(R.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&B.a.createElement(p.b,h)),a==="audio"&&B.a.createElement("audio",{src:"".concat(c!=null&&c.startsWith("/")||(c==null?void 0:c.indexOf("https://"))>-1?c:"data:audio/mp3;base64,").concat(c),autoPlay:!0}),a==="video"&&B.a.createElement(B.a.Fragment,null,c!=null&&c.startsWith("/")?B.a.createElement("video",{controls:!0,src:"".concat(c),autoPlay:!0}):B.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(c),autoPlay:!0})),a==="html"&&B.a.createElement("iframe",{src:c+"&disposition=inline"}),a==="pdf"&&B.a.createElement("embed",{className:R.a.embed,src:c}),a==="image"&&B.a.createElement(B.a.Fragment,null,B.a.createElement("img",{src:"".concat(c!=null&&c.startsWith("/")||(c==null?void 0:c.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(c)})),a==="other"&&B.a.createElement("div",null,B.a.createElement(V.a,{type:"primary",size:"large",onClick:v},B.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&B.a.createElement(V.a,{type:"primary",size:"large",onClick:v},B.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(at,Ve,te){},psGv:function(at,Ve,te){var ne,V;(function(){var D;(function(){"use strict";var W=[,,function(g){function p(o){this.__parent=o,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 o=new p(this.__parent);return o.set_indent(this.__indent_count,this.__alignment_count),o},p.prototype.item=function(o){return o<0?this.__items[this.__items.length+o]:this.__items[o]},p.prototype.has_match=function(o){for(var c=this.__items.length-1;c>=0;c--)if(this.__items[c].match(o))return!0;return!1},p.prototype.set_indent=function(o,c){this.is_empty()&&(this.__indent_count=o||0,this.__alignment_count=c||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},p.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},p.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},p.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var o=this.__parent.current_line;return o.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),o.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),o.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,o.__items[0]===" "&&(o.__items.splice(0,1),o.__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(o){this.__items.push(o);var c=o.lastIndexOf(`
`);c!==-1?this.__character_count=o.length-c:this.__character_count+=o.length},p.prototype.pop=function(){var o=null;return this.is_empty()||(o=this.__items.pop(),this.__character_count-=o.length),o},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 o="";return this.is_empty()?this.__parent.indent_empty_lines&&(o=this.__parent.get_indent_string(this.__indent_count)):(o=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),o+=this.__items.join("")),o};function f(o,c){this.__cache=[""],this.__indent_size=o.indent_size,this.__indent_string=o.indent_char,o.indent_with_tabs||(this.__indent_string=new Array(o.indent_size+1).join(o.indent_char)),c=c||"",o.indent_level>0&&(c=new Array(o.indent_level+1).join(this.__indent_string)),this.__base_string=c,this.__base_string_length=c.length}f.prototype.get_indent_size=function(o,c){var s=this.__base_string_length;return c=c||0,o<0&&(s=0),s+=o*this.__indent_size,s+=c,s},f.prototype.get_indent_string=function(o,c){var s=this.__base_string;return c=c||0,o<0&&(o=0,s=""),c+=o*this.__indent_size,this.__ensure_cache(c),s+=this.__cache[c],s},f.prototype.__ensure_cache=function(o){for(;o>=this.__cache.length;)this.__add_column()},f.prototype.__add_column=function(){var o=this.__cache.length,c=0,s="";this.__indent_size&&o>=this.__indent_size&&(c=Math.floor(o/this.__indent_size),o-=c*this.__indent_size,s=new Array(c+1).join(this.__indent_string)),o&&(s+=new Array(o+1).join(" ")),this.__cache.push(s)};function d(o,c){this.__indent_cache=new f(o,c),this.raw=!1,this._end_with_newline=o.end_with_newline,this.indent_size=o.indent_size,this.wrap_line_length=o.wrap_line_length,this.indent_empty_lines=o.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(o,c){return this.__indent_cache.get_indent_string(o,c)},d.prototype.get_indent_size=function(o,c){return this.__indent_cache.get_indent_size(o,c)},d.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},d.prototype.add_new_line=function(o){return this.is_empty()||!o&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},d.prototype.get_code=function(o){this.trim(!0);var c=this.current_line.pop();c&&(c[c.length-1]===`
`&&(c=c.replace(/\n+$/g,"")),this.current_line.push(c)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(`
`);return o!==`
`&&(s=s.replace(/[\n]/g,o)),s},d.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},d.prototype.set_indent=function(o,c){return o=o||0,c=c||0,this.next_line.set_indent(o,c),this.__lines.length>1?(this.current_line.set_indent(o,c),!0):(this.current_line.set_indent(),!1)},d.prototype.add_raw_token=function(o){for(var c=0;c<o.newlines;c++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(o.whitespace_before),this.current_line.push(o.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},d.prototype.add_token=function(o){this.__add_space_before_token(),this.current_line.push(o),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(o){for(var c=this.__lines.length;o<c;)this.__lines[o]._remove_indent(),o++;this.current_line._remove_wrap_indent()},d.prototype.trim=function(o){for(o=o===void 0?!1:o,this.current_line.trim();o&&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(o,c){for(var s=this.__lines.length-2;s>=0;){var a=this.__lines[s];if(a.is_empty())break;if(a.item(0).indexOf(o)!==0&&a.item(-1)!==c){this.__lines.splice(s+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},g.exports.Output=d},function(g){function p(f,d,o,c){this.type=f,this.text=d,this.comments_before=null,this.newlines=o||0,this.whitespace_before=c||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}g.exports.Token=p},,,function(g){function p(o,c){this.raw_options=f(o,c),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}p.prototype._get_array=function(o,c){var s=this.raw_options[o],a=c||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(a=s.concat()):typeof s=="string"&&(a=s.split(/[^a-zA-Z0-9_\/\-]+/)),a},p.prototype._get_boolean=function(o,c){var s=this.raw_options[o],a=s===void 0?!!c:!!s;return a},p.prototype._get_characters=function(o,c){var s=this.raw_options[o],a=c||"";return typeof s=="string"&&(a=s.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),a},p.prototype._get_number=function(o,c){var s=this.raw_options[o];c=parseInt(c,10),isNaN(c)&&(c=0);var a=parseInt(s,10);return isNaN(a)&&(a=c),a},p.prototype._get_selection=function(o,c,s){var a=this._get_selection_list(o,c,s);if(a.length!==1)throw new Error("Invalid Option Value: The option '"+o+`' can only be one of the following values:
`+c+`
You passed in: '`+this.raw_options[o]+"'");return a[0]},p.prototype._get_selection_list=function(o,c,s){if(!c||c.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[c[0]],!this._is_valid_selection(s,c))throw new Error("Invalid Default Value!");var a=this._get_array(o,s);if(!this._is_valid_selection(a,c))throw new Error("Invalid Option Value: The option '"+o+`' can contain only the following values:
`+c+`
You passed in: '`+this.raw_options[o]+"'");return a},p.prototype._is_valid_selection=function(o,c){return o.length&&c.length&&!o.some(function(s){return c.indexOf(s)===-1})};function f(o,c){var s={};o=d(o);var a;for(a in o)a!==c&&(s[a]=o[a]);if(c&&o[c])for(a in o[c])s[a]=o[c][a];return s}function d(o){var c={},s;for(s in o){var a=s.replace(/-/g,"_");c[a]=o[s]}return c}g.exports.Options=p,g.exports.normalizeOpts=d,g.exports.mergeOpts=f},,function(g){var p=RegExp.prototype.hasOwnProperty("sticky");function f(d){this.__input=d||"",this.__input_length=this.__input.length,this.__position=0}f.prototype.restart=function(){this.__position=0},f.prototype.back=function(){this.__position>0&&(this.__position-=1)},f.prototype.hasNext=function(){return this.__position<this.__input_length},f.prototype.next=function(){var d=null;return this.hasNext()&&(d=this.__input.charAt(this.__position),this.__position+=1),d},f.prototype.peek=function(d){var o=null;return d=d||0,d+=this.__position,d>=0&&d<this.__input_length&&(o=this.__input.charAt(d)),o},f.prototype.__match=function(d,o){d.lastIndex=o;var c=d.exec(this.__input);return c&&!(p&&d.sticky)&&(c.index!==o&&(c=null)),c},f.prototype.test=function(d,o){return o=o||0,o+=this.__position,o>=0&&o<this.__input_length?!!this.__match(d,o):!1},f.prototype.testChar=function(d,o){var c=this.peek(o);return d.lastIndex=0,c!==null&&d.test(c)},f.prototype.match=function(d){var o=this.__match(d,this.__position);return o?this.__position+=o[0].length:o=null,o},f.prototype.read=function(d,o,c){var s="",a;return d&&(a=this.match(d),a&&(s+=a[0])),o&&(a||!d)&&(s+=this.readUntil(o,c)),s},f.prototype.readUntil=function(d,o){var c="",s=this.__position;d.lastIndex=this.__position;var a=d.exec(this.__input);return a?(s=a.index,o&&(s+=a[0].length)):s=this.__input_length,c=this.__input.substring(this.__position,s),this.__position=s,c},f.prototype.readUntilAfter=function(d){return this.readUntil(d,!0)},f.prototype.get_regexp=function(d,o){var c=null,s="g";return o&&p&&(s="y"),typeof d=="string"&&d!==""?c=new RegExp(d,s):d&&(c=new RegExp(d.source,s)),c},f.prototype.get_literal_regexp=function(d){return RegExp(d.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},f.prototype.peekUntilAfter=function(d){var o=this.__position,c=this.readUntilAfter(d);return this.__position=o,c},f.prototype.lookBack=function(d){var o=this.__position-1;return o>=d.length&&this.__input.substring(o-d.length,o).toLowerCase()===d},g.exports.InputScanner=f},function(g,p,f){var d=f(8).InputScanner,o=f(3).Token,c=f(10).TokenStream,s=f(11).WhitespacePattern,a={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(h,O){this._input=new d(h),this._options=O||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new c,this._reset();for(var h,O=new o(a.START,""),w=null,x=[],A=new c;O.type!==a.EOF;){for(h=this._get_next_token(O,w);this._is_comment(h);)A.add(h),h=this._get_next_token(O,w);A.isEmpty()||(h.comments_before=A,A=new c),h.parent=w,this._is_opening(h)?(x.push(w),w=h):w&&this._is_closing(h,w)&&(h.opened=w,w.closed=h,w=x.pop(),h.parent=w),h.previous=O,O.next=h,this.__tokens.add(h),O=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,O){this._readWhitespace();var w=this._input.read(/.+/g);return w?this._create_token(a.RAW,w):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,O){return!1},l.prototype._create_token=function(h,O){var w=new o(h,O,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},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 o(c,s){d.call(this,c,s),s?this._line_regexp=this._input.get_regexp(s._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}o.prototype=new d,o.prototype.__set_whitespace_patterns=function(c,s){c+="\\t ",s+="\\n\\r",this._match_pattern=this._input.get_regexp("["+c+s+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+s+"]")},o.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var c=this._input.read(this._match_pattern);if(c===" ")this.whitespace_before_token=" ";else if(c){var s=this.__split(this._newline_regexp,c);this.newline_count=s.length-1,this.whitespace_before_token=s[this.newline_count]}return c},o.prototype.matching=function(c,s){var a=this._create();return a.__set_whitespace_patterns(c,s),a._update(),a},o.prototype._create=function(){return new o(this._input,this)},o.prototype.__split=function(c,s){c.lastIndex=0;for(var a=0,l=[],h=c.exec(s);h;)l.push(s.substring(a,h.index)),a=h.index+h[0].length,h=c.exec(s);return a<s.length?l.push(s.substring(a,s.length)):l.push(""),l},g.exports.WhitespacePattern=o},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 o=this.__directive_pattern.exec(f);o;)d[o[1]]=o[2],o=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,o={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function c(s,a){d.call(this,s,a),this.__template_pattern=null,this._disabled=Object.assign({},o),this._excluded=Object.assign({},o),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(s);this.__patterns={handlebars_comment:l.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:l.starting_with(/{{{/).until_after(/}}}/),handlebars:l.starting_with(/{{/).until_after(/}}/),php:l.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}c.prototype=new d,c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){this.__set_templated_pattern()},c.prototype.disable=function(s){var a=this._create();return a._disabled[s]=!0,a._update(),a},c.prototype.read_options=function(s){var a=this._create();for(var l in o)a._disabled[l]=s.templating.indexOf(l)===-1;return a._update(),a},c.prototype.exclude=function(s){var a=this._create();return a._excluded[s]=!0,a._update(),a},c.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 a=this._read_template();a;)this._match_pattern?a+=this._input.read(this._match_pattern):a+=this._input.readUntil(this.__template_pattern),s+=a,a=this._read_template();return this._until_after&&(s+=this._input.readUntilAfter(this._until_pattern)),s},c.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("|")+")")},c.prototype._read_template=function(){var s="",a=this._input.peek();if(a==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(s=s||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(s=s||this.__patterns.erb.read())}else a==="{"&&(!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},g.exports.TemplatablePattern=c},,,,function(g,p,f){var d=f(19).Beautifier,o=f(20).Options;function c(s,a,l,h){var O=new d(s,a,l,h);return O.beautify()}g.exports=c,g.exports.defaultOptions=function(){return new o}},function(g,p,f){var d=f(20).Options,o=f(2).Output,c=f(21).Tokenizer,s=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 o(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!==s.TEXT&&y.previous.type!==s.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 b=0;b<m;b++)this.print_newline(b>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 O=function(y){for(var m=null,b=y.next;b.type!==s.EOF&&y.closed!==b;){if(b.type===s.ATTRIBUTE&&b.text==="type"){b.next&&b.next.type===s.EQUALS&&b.next.next&&b.next.next.type===s.VALUE&&(m=b.next.next.text);break}b=b.next}return m},w=function(y,m){var b=null,P=null;return m.closed?(y==="script"?b="text/javascript":y==="style"&&(b="text/css"),b=O(m)||b,b.search("text/css")>-1?P="css":b.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?P="javascript":b.search(/(text|application|dojo)\/(x-)?(html)/)>-1?P="html":b.search(/test\/null/)>-1&&(P="null"),P):null};function x(y,m){return m.indexOf(y)!==-1}function A(y,m,b){this.parent=y||null,this.tag=m?m.tag_name:"",this.indent_level=b||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 A(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 b=this._current_frame;b&&!(y.indexOf(b.tag)!==-1);){if(m&&m.indexOf(b.tag)!==-1){b=null;break}b=b.parent}return b},S.prototype.try_pop=function(y,m){var b=this._get_frame([y],m);return this._try_pop_frame(b)},S.prototype.indent_to_tag=function(y){var m=this._get_frame(y);m&&(this._printer.indent_level=m.indent_level)};function T(y,m,b,P){this._source_text=y||"",m=m||{},this._js_beautify=b,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"}T.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 b=y.match(/^[\t ]*/)[0],P={text:"",type:""},I=new E,U=new h(this._options,b),F=new c(y,this._options).tokenize();this._tag_stack=new S(U);for(var L=null,v=F.next();v.type!==s.EOF;)v.type===s.TAG_OPEN||v.type===s.COMMENT?(L=this._handle_tag_open(U,v,I,P),I=L):v.type===s.ATTRIBUTE||v.type===s.EQUALS||v.type===s.VALUE||v.type===s.TEXT&&!I.tag_complete?L=this._handle_inside_tag(U,v,I,F):v.type===s.TAG_CLOSE?L=this._handle_tag_close(U,v,I):v.type===s.TEXT?L=this._handle_text(U,v,I):U.add_raw_token(v),P=L,v=F.next();var j=U._output.get_code(m);return j},T.prototype._handle_tag_close=function(y,m,b){var P={text:m.text,type:m.type};return y.alignment_size=0,b.tag_complete=!0,y.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),b.is_unformatted?y.add_raw_token(m):(b.tag_start_char==="<"&&(y.set_space_before_token(m.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&b.has_wrapped_attrs&&y.print_newline(!1)),y.print_token(m)),b.indent_content&&!(b.is_unformatted||b.is_content_unformatted)&&(y.indent(),b.indent_content=!1),!b.is_inline_element&&!(b.is_unformatted||b.is_content_unformatted)&&y.set_wrap_point(),P},T.prototype._handle_inside_tag=function(y,m,b,P){var I=b.has_wrapped_attrs,U={text:m.text,type:m.type};if(y.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),b.is_unformatted)y.add_raw_token(m);else if(b.tag_start_char==="{"&&m.type===s.TEXT)y.print_preserved_newlines(m)?(m.newlines=0,y.add_raw_token(m)):y.print_token(m);else{if(m.type===s.ATTRIBUTE?(y.set_space_before_token(!0),b.attr_count+=1):(m.type===s.EQUALS||m.type===s.VALUE&&m.previous.type===s.EQUALS)&&y.set_space_before_token(!1),m.type===s.ATTRIBUTE&&b.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 F=b.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&b.attr_count===1){var L=!0,v=0,j;do{if(j=P.peek(v),j.type===s.ATTRIBUTE){L=!1;break}v+=1}while(v<4&&j.type!==s.EOF&&j.type!==s.TAG_CLOSE);F=!L}F&&(y.print_newline(!1),I=!0)}y.print_token(m),I=I||y.previous_token_wrapped(),b.has_wrapped_attrs=I}return U},T.prototype._handle_text=function(y,m,b){var P={text:m.text,type:"TK_CONTENT"};return b.custom_beautifier_name?this._print_custom_beatifier_text(y,m,b):b.is_unformatted||b.is_content_unformatted?y.add_raw_token(m):(y.traverse_whitespace(m),y.print_token(m)),P},T.prototype._print_custom_beatifier_text=function(y,m,b){var P=this;if(m.text!==""){var I=m.text,U,F=1,L="",v="";b.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?U=this._js_beautify:b.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?U=this._css_beautify:b.custom_beautifier_name==="html"&&(U=function(de,me){var ce=new T(de,me,P._js_beautify,P._css_beautify);return ce.beautify()}),this._options.indent_scripts==="keep"?F=0:this._options.indent_scripts==="separate"&&(F=-y.indent_level);var j=y.get_full_indent(F);if(I=I.replace(/\n[ \t]*$/,""),b.custom_beautifier_name!=="html"&&I[0]==="<"&&I.match(/^(<!--|<!\[CDATA\[)/)){var K=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(I);if(!K){y.add_raw_token(m);return}L=j+K[1]+`
`,I=K[4],K[5]&&(v=j+K[5]),I=I.replace(/\n[ \t]*$/,""),(K[2]||K[3].indexOf(`
`)!==-1)&&(K=K[3].match(/[ \t]+$/),K&&(m.whitespace_before=K[0]))}if(I)if(U){var J=function(){this.eol=`
`};J.prototype=this._options.raw_options;var ee=new J;I=U(j+I,ee)}else{var ve=m.whitespace_before;ve&&(I=I.replace(new RegExp(`
(`+ve+")?","g"),`
`)),I=j+I.replace(/\n/g,`
`+j)}L&&(I?I=L+I+`
`+v:I=L+v),y.print_newline(!1),I&&(m.text=I,m.whitespace_before="",m.newlines=0,y.add_raw_token(m),y.print_newline(!0))}},T.prototype._handle_tag_open=function(y,m,b,P){var I=this._get_tag_open_token(m);return(b.is_unformatted||b.is_content_unformatted)&&!b.is_empty_element&&m.type===s.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,b,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 E=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 b;this.tag_start_char=m.text[0],this.text=m.text,this.tag_start_char==="<"?(b=m.text.match(/^<([^\s>]*)/),this.tag_check=b?b[1]:""):(b=m.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=b?b[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===s.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)))}};T.prototype._get_tag_open_token=function(y){var m=new E(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||x(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&&x(m.tag_check,this._options.unformatted),m.is_content_unformatted=!m.is_empty_element&&x(m.tag_check,this._options.content_unformatted),m.is_inline_element=x(m.tag_name,this._options.inline)||m.tag_name.includes("-")||m.tag_start_char==="{",m},T.prototype._set_tag_position=function(y,m,b,P,I){if(b.is_empty_element||(b.is_end_tag?b.start_tag_token=this._tag_stack.try_pop(b.tag_name):(this._do_optional_end_element(b)&&(b.is_inline_element||y.print_newline(!1)),this._tag_stack.record_tag(b),(b.tag_name==="script"||b.tag_name==="style")&&!(b.is_unformatted||b.is_content_unformatted)&&(b.custom_beautifier_name=w(b.tag_check,m)))),x(b.tag_check,this._options.extra_liners)&&(y.print_newline(!1),y._output.just_added_blankline()||y.print_newline(!0)),b.is_empty_element){if(b.tag_start_char==="{"&&b.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),b.indent_content=!0;var U=y.current_line_has_match(/{{#if/);U||y.print_newline(!1)}b.tag_name==="!--"&&I.type===s.TAG_CLOSE&&P.is_end_tag&&b.text.indexOf(`
`)===-1||(b.is_inline_element||b.is_unformatted||y.print_newline(!1),this._calcluate_parent_multiline(y,b))}else if(b.is_end_tag){var F=!1;F=b.start_tag_token&&b.start_tag_token.multiline_content,F=F||!b.is_inline_element&&!(P.is_inline_element||P.is_unformatted)&&!(I.type===s.TAG_CLOSE&&b.start_tag_token===P)&&I.type!=="TK_CONTENT",(b.is_content_unformatted||b.is_unformatted)&&(F=!1),F&&y.print_newline(!1)}else b.indent_content=!b.custom_beautifier_name,b.tag_start_char==="<"&&(b.tag_name==="html"?b.indent_content=this._options.indent_inner_html:b.tag_name==="head"?b.indent_content=this._options.indent_head_inner_html:b.tag_name==="body"&&(b.indent_content=this._options.indent_body_inner_html)),!(b.is_inline_element||b.is_unformatted)&&(I.type!=="TK_CONTENT"||b.is_content_unformatted)&&y.print_newline(!1),this._calcluate_parent_multiline(y,b)},T.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 _=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],u=["a","audio","del","ins","map","noscript","video"];T.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"&&_.indexOf(y.tag_name)!==-1){var b=y.parent.parent;(!b||u.indexOf(b.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=T},function(g,p,f){var d=f(6).Options;function o(c){d.call(this,c,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}o.prototype=new d,g.exports.Options=o},function(g,p,f){var d=f(9).Tokenizer,o=f(9).TOKEN,c=f(13).Directives,s=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:o.START,RAW:o.RAW,EOF:o.EOF},h=new c(/<\!--/,/-->/),O=function(w,x){d.call(this,w,x),this._current_tag_name="";var A=new s(this._input).read_options(this._options),S=new a(this._input);if(this.__patterns={word:A.until(/[\n\r\t <]/),single_quote:A.until_after(/'/),double_quote:A.until_after(/"/),attribute:A.until(/[\n\r\t =>]|\/>/),element_name:A.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 T=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=S.matching(T).until_after(T)}};O.prototype=new d,O.prototype._is_comment=function(w){return!1},O.prototype._is_opening=function(w){return w.type===l.TAG_OPEN},O.prototype._is_closing=function(w,x){return w.type===l.TAG_CLOSE&&x&&((w.text===">"||w.text==="/>")&&x.text[0]==="<"||w.text==="}}"&&x.text[0]==="{"&&x.text[1]==="{")},O.prototype._reset=function(){this._current_tag_name=""},O.prototype._get_next_token=function(w,x){var A=null;this._readWhitespace();var S=this._input.peek();return S===null?this._create_token(l.EOF,""):(A=A||this._read_open_handlebars(S,x),A=A||this._read_attribute(S,w,x),A=A||this._read_close(S,x),A=A||this._read_raw_content(S,w,x),A=A||this._read_content_word(S),A=A||this._read_comment_or_cdata(S),A=A||this._read_processing(S),A=A||this._read_open(S,x),A=A||this._create_token(l.UNKNOWN,this._input.next()),A)},O.prototype._read_comment_or_cdata=function(w){var x=null,A=null,S=null;if(w==="<"){var T=this._input.peek(1);T==="!"&&(A=this.__patterns.comment.read(),A?(S=h.get_directives(A),S&&S.ignore==="start"&&(A+=h.readIgnored(this._input))):A=this.__patterns.cdata.read()),A&&(x=this._create_token(l.COMMENT,A),x.directives=S)}return x},O.prototype._read_processing=function(w){var x=null,A=null,S=null;if(w==="<"){var T=this._input.peek(1);(T==="!"||T==="?")&&(A=this.__patterns.conditional_comment.read(),A=A||this.__patterns.processing.read()),A&&(x=this._create_token(l.COMMENT,A),x.directives=S)}return x},O.prototype._read_open=function(w,x){var A=null,S=null;return x||w==="<"&&(A=this._input.next(),this._input.peek()==="/"&&(A+=this._input.next()),A+=this.__patterns.element_name.read(),S=this._create_token(l.TAG_OPEN,A)),S},O.prototype._read_open_handlebars=function(w,x){var A=null,S=null;return x||this._options.indent_handlebars&&w==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(A=this.__patterns.handlebars_comment.read(),A=A||this.__patterns.handlebars.read(),S=this._create_token(l.COMMENT,A)):(A=this.__patterns.handlebars_open.read(),S=this._create_token(l.TAG_OPEN,A))),S},O.prototype._read_close=function(w,x){var A=null,S=null;return x&&(x.text[0]==="<"&&(w===">"||w==="/"&&this._input.peek(1)===">")?(A=this._input.next(),w==="/"&&(A+=this._input.next()),S=this._create_token(l.TAG_CLOSE,A)):x.text[0]==="{"&&w==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),S=this._create_token(l.TAG_CLOSE,"}}"))),S},O.prototype._read_attribute=function(w,x,A){var S=null,T="";if(A&&A.text[0]==="<")if(w==="=")S=this._create_token(l.EQUALS,this._input.next());else if(w==='"'||w==="'"){var E=this._input.next();w==='"'?E+=this.__patterns.double_quote.read():E+=this.__patterns.single_quote.read(),S=this._create_token(l.VALUE,E)}else T=this.__patterns.attribute.read(),T&&(x.type===l.EQUALS?S=this._create_token(l.VALUE,T):S=this._create_token(l.ATTRIBUTE,T));return S},O.prototype._is_content_unformatted=function(w){return this._options.void_elements.indexOf(w)===-1&&(this._options.content_unformatted.indexOf(w)!==-1||this._options.unformatted.indexOf(w)!==-1)},O.prototype._read_raw_content=function(w,x,A){var S="";if(A&&A.text[0]==="{")S=this.__patterns.handlebars_raw_close.read();else if(x.type===l.TAG_CLOSE&&x.opened.text[0]==="<"&&x.text[0]!=="/"){var T=x.opened.text.substr(1).toLowerCase();if(T==="script"||T==="style"){var E=this._read_comment_or_cdata(w);if(E)return E.type=l.TEXT,E;S=this._input.readUntil(new RegExp("</"+T+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(T)&&(S=this._input.readUntil(new RegExp("</"+T+"[\\n\\r\\t ]*?>","ig")))}return S?this._create_token(l.TEXT,S):null},O.prototype._read_content_word=function(w){var x="";if(this._options.unformatted_content_delimiter&&(w===this._options.unformatted_content_delimiter[0]&&(x=this.__patterns.unformatted_content_delimiter.read())),x||(x=this.__patterns.word.read()),x)return this._create_token(l.TEXT,x)},g.exports.Tokenizer=O,g.exports.TOKEN=l}],B={};function k(g){var p=B[g];if(p!==void 0)return p.exports;var f=B[g]={exports:{}};return W[g](f,f.exports,k),f.exports}var R=k(18);D=R})();var z=D;if(!0)!(ne=[te,te("6UM0"),te("TXwP")],V=function(W){var B=te("6UM0"),k=te("TXwP");return{html_beautify:function(R,g){return z(R,g,B.js_beautify,k.css_beautify)}}}.apply(Ve,ne),V!==void 0&&(at.exports=V));else var N,M})()},"rAM+":function(at,Ve,te){"use strict";te.d(Ve,"a",function(){return V});var ne=te("Qw5x");function V(D,z){var N;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(N=Object(ne.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 B=!0,k=!1,R;return{s:function(){N=D[Symbol.iterator]()},n:function(){var p=N.next();return B=p.done,p},e:function(p){k=!0,R=p},f:function(){try{!B&&N.return!=null&&N.return()}finally{if(k)throw R}}}}},rUJ1:function(at,Ve){const te=/[&<>"']/,ne=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},N=S=>z[S];function M(S,T){if(T){if(te.test(S))return S.replace(ne,N)}else if(V.test(S))return S.replace(D,N);return S}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(S){return S.replace(W,(T,E)=>(E=E.toLowerCase(),E==="colon"?":":E.charAt(0)==="#"?E.charAt(1)==="x"?String.fromCharCode(parseInt(E.substring(2),16)):String.fromCharCode(+E.substring(1)):""))}const k=/(^|[^\[])\^/g;function R(S,T){S=S.source||S,T=T||"";const E={replace:(_,u)=>(u=u.source||u,u=u.replace(k,"$1"),S=S.replace(_,u),E),getRegex:()=>new RegExp(S,T)};return E}const g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(S,T,E){if(S){let _;try{_=decodeURIComponent(B(E)).replace(g,"").toLowerCase()}catch(u){return null}if(_.indexOf("javascript:")===0||_.indexOf("vbscript:")===0||_.indexOf("data:")===0)return null}T&&!p.test(E)&&(E=a(T,E));try{E=encodeURI(E).replace(/%25/g,"%")}catch(_){return null}return E}const d={},o=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(S,T){d[" "+S]||(o.test(S)?d[" "+S]=S+"/":d[" "+S]=w(S,"/",!0)),S=d[" "+S];const E=S.indexOf(":")===-1;return T.substring(0,2)==="//"?E?T:S.replace(c,"$1")+T:T.charAt(0)==="/"?E?T:S.replace(s,"$1")+T:S+T}const l={exec:function(){}};function h(S){let T=1,E,_;for(;T<arguments.length;T++){E=arguments[T];for(_ in E)Object.prototype.hasOwnProperty.call(E,_)&&(S[_]=E[_])}return S}function O(S,T){const E=S.replace(/\|/g,(y,m,b)=>{let P=!1,I=m;for(;--I>=0&&b[I]==="\\";)P=!P;return P?"|":" |"}),_=E.split(/ \|/);let u=0;if(_.length>T)_.splice(T);else for(;_.length<T;)_.push("");for(;u<_.length;u++)_[u]=_[u].trim().replace(/\\\|/g,"|");return _}function w(S,T,E){const _=S.length;if(_===0)return"";let u=0;for(;u<_;){const y=S.charAt(_-u-1);if(y===T&&!E)u++;else if(y!==T&&E)u++;else break}return S.substr(0,_-u)}function x(S,T){if(S.indexOf(T[1])===-1)return-1;const E=S.length;let _=0,u=0;for(;u<E;u++)if(S[u]==="\\")u++;else if(S[u]===T[0])_++;else if(S[u]===T[1]&&(_--,_<0))return u;return-1}function A(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")}at.exports={escape:M,unescape:B,edit:R,cleanUrl:f,resolveUrl:a,noopTest:l,merge:h,splitCells:O,rtrim:w,findClosingBracket:x,checkSanitizeDeprecation:A}},ulZh:function(at,Ve,te){typeof window!="undefined"&&function(V,D){at.exports=D()}(this,function(){return function(ne){var V={};function D(z){if(V[z])return V[z].exports;var N=V[z]={i:z,l:!1,exports:{}};return ne[z].call(N.exports,N,N.exports,D),N.l=!0,N.exports}return D.m=ne,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(B){return z[B]}.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(ne,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 B(g,p,f,d,o){if(typeof f!="function")throw new TypeError("The listener must be a function");var c=new W(f,d||g,o),s=N?N+p:p;return g._events[s]?g._events[s].fn?g._events[s]=[g._events[s],c]:g._events[s].push(c):(g._events[s]=c,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 o=0,c=d.length,s=new Array(c);o<c;o++)s[o]=d[o].fn;return s},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,o,c,s){var a=N?N+p:p;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,O,w;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,o),!0;case 5:return l.fn.call(l.context,f,d,o,c),!0;case 6:return l.fn.call(l.context,f,d,o,c,s),!0}for(w=1,O=new Array(h-1);w<h;w++)O[w-1]=arguments[w];l.fn.apply(l.context,O)}else{var x=l.length,A;for(w=0;w<x;w++){l[w].once&&this.removeListener(p,l[w].fn,void 0,!0);switch(h){case 1:l[w].fn.call(l[w].context);break;case 2:l[w].fn.call(l[w].context,f);break;case 3:l[w].fn.call(l[w].context,f,d);break;case 4:l[w].fn.call(l[w].context,f,d,o);break;default:if(!O)for(A=1,O=new Array(h-1);A<h;A++)O[A-1]=arguments[A];l[w].fn.apply(l[w].context,O)}}}return!0},R.prototype.on=function(p,f,d){return B(this,p,f,d,!1)},R.prototype.once=function(p,f,d){return B(this,p,f,d,!0)},R.prototype.removeListener=function(p,f,d,o){var c=N?N+p:p;if(!this._events[c])return this;if(!f)return k(this,c),this;var s=this._events[c];if(s.fn)s.fn===f&&(!o||s.once)&&(!d||s.context===d)&&k(this,c);else{for(var a=0,l=[],h=s.length;a<h;a++)(s[a].fn!==f||o&&!s[a].once||d&&s[a].context!==d)&&l.push(s[a]);l.length?this._events[c]=l.length===1?l[0]:l:k(this,c)}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,ne.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(ne,V,D){(function(z){var N=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/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 o=k.parseURL(R);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&o.path[0]!=="/"){var c=M.exec(o.path);o.netLoc=c[1],o.path=c[2]}o.netLoc&&!o.path&&(o.path="/");var s={scheme:o.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(s.netLoc=o.netLoc,d.path[0]!=="/"))if(!d.path)s.path=o.path,d.params||(s.params=o.params,d.query||(s.query=o.query));else{var a=o.path,l=a.substring(0,a.lastIndexOf("/")+1)+d.path;s.path=k.normalizePath(l)}return s.path===null&&(s.path=p.alwaysNormalize?k.normalizePath(d.path):d.path),k.buildURLFromParts(s)},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(B,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};ne.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(ne,V,D){function z(p){var f={};function d(c){if(f[c])return f[c].exports;var s=f[c]={i:c,l:!1,exports:{}};return p[c].call(s.exports,s,s.exports,d),s.l=!0,s.exports}d.m=p,d.c=f,d.i=function(c){return c},d.d=function(c,s,a){d.o(c,s)||Object.defineProperty(c,s,{configurable:!1,enumerable:!0,get:a})},d.r=function(c){Object.defineProperty(c,"__esModule",{value:!0})},d.n=function(c){var s=c&&c.__esModule?function(){return c.default}:function(){return c};return d.d(s,"a",s),s},d.o=function(c,s){return Object.prototype.hasOwnProperty.call(c,s)},d.p="/",d.oe=function(c){throw console.error(c),c};var o=d(d.s=ENTRY_MODULE);return o.default||o}var N="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+N+").*?\\)";function W(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(p){return!isNaN(1*p)}function k(p,f,d){var o={};o[d]=[];var c=f.toString(),s=c.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return o;for(var a=s[1],l=new RegExp("(\\\\n|\\W)"+W(a)+M,"g"),h;h=l.exec(c);){if(h[3]==="dll-reference")continue;o[d].push(h[3])}for(l=new RegExp("\\("+W(a)+'\\("(dll-reference\\s('+N+'))"\\)\\)'+M,"g");h=l.exec(c);)p[h[2]]||(o[d].push(h[1]),p[h[2]]=D(h[1]).m),o[h[2]]=o[h[2]]||[],o[h[2]].push(h[4]);for(var O=Object.keys(o),w=0;w<O.length;w++)for(var x=0;x<o[O[w]].length;x++)B(o[O[w]][x])&&(o[O[w]][x]=1*o[O[w]][x]);return o}function R(p){var f=Object.keys(p);return f.reduce(function(d,o){return d||p[o].length>0},!1)}function g(p,f){for(var d={main:[f]},o={main:[]},c={main:{}};R(d);)for(var s=Object.keys(d),a=0;a<s.length;a++){var l=s[a],h=d[l],O=h.pop();if(c[l]=c[l]||{},c[l][O]||!p[l][O])continue;c[l][O]=!0,o[l]=o[l]||[],o[l].push(O);for(var w=k(p,p[l][O],l),x=Object.keys(w),A=0;A<x.length;A++)d[x[A]]=d[x[A]]||[],d[x[A]]=d[x[A]].concat(w[x[A]])}return o}ne.exports=function(p,f){f=f||{};var d={main:D.m},o=f.all?{main:Object.keys(d.main)}:g(d,p),c="";Object.keys(o).filter(function(O){return O!=="main"}).forEach(function(O){for(var w=0;o[O][w];)w++;o[O].push(w),d[O][w]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",c=c+"var "+O+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+o[O].map(function(x){return""+JSON.stringify(x)+": "+d[O][x].toString()}).join(",")+`});
`}),c=c+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+o.main.map(function(O){return""+JSON.stringify(O)+": "+d.main[O].toString()}).join(",")+"}))(self);";var s=new window.Blob([c],{type:"text/javascript"});if(f.bare)return s;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,l=a.createObjectURL(s),h=new window.Worker(l);return h.objectURL=l,h}},"./src/config.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"hlsDefaultConfig",function(){return A}),D.d(V,"mergeConfig",function(){return T}),D.d(V,"enableStreamingMode",function(){return E});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"),B=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"),o=D("./src/utils/xhr-loader.ts"),c=D("./src/utils/fetch-loader.ts"),s=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(_){for(var u=1;u<arguments.length;u++){var y=arguments[u];for(var m in y)Object.prototype.hasOwnProperty.call(y,m)&&(_[m]=y[m])}return _},h.apply(this,arguments)}function O(_,u){var y=Object.keys(_);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(_);u&&(m=m.filter(function(b){return Object.getOwnPropertyDescriptor(_,b).enumerable})),y.push.apply(y,m)}return y}function w(_){for(var u=1;u<arguments.length;u++){var y=arguments[u]!=null?arguments[u]:{};u%2?O(Object(y),!0).forEach(function(m){x(_,m,y[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(y)):O(Object(y)).forEach(function(m){Object.defineProperty(_,m,Object.getOwnPropertyDescriptor(y,m))})}return _}function x(_,u,y){return u in _?Object.defineProperty(_,u,{value:y,enumerable:!0,configurable:!0,writable:!0}):_[u]=y,_}var A=w(w({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:o.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:B.default,timelineController:R.TimelineController,audioStreamController:N.default,audioTrackController:M.default,emeController:f.default,cmcdController:d.default});function S(){return{cueHandler:s.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 T(_,u){if((u.liveSyncDurationCount||u.liveMaxLatencyDurationCount)&&(u.liveSyncDuration||u.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(u.liveMaxLatencyDurationCount!==void 0&&(u.liveSyncDurationCount===void 0||u.liveMaxLatencyDurationCount<=u.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(u.liveMaxLatencyDuration!==void 0&&(u.liveSyncDuration===void 0||u.liveMaxLatencyDuration<=u.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},_,u)}function E(_){var u=_.loader;if(u!==c.default&&u!==o.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),_.progressive=!1;else{var y=Object(c.fetchSupported)();y&&(_.loader=c.default,_.progressive=!0,_.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ne,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"),B=D("./src/errors.ts"),k=D("./src/types/loader.ts"),R=D("./src/utils/logger.ts");function g(d,o){for(var c=0;c<o.length;c++){var s=o[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(d,s.key,s)}}function p(d,o,c){return o&&g(d.prototype,o),c&&g(d,c),d}var f=function(){function d(c){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=c;var s=c.config;this.bwEstimator=new N.default(s.abrEwmaSlowVoD,s.abrEwmaFastVoD,s.abrEwmaDefaultEstimate),this.registerListeners()}var o=d.prototype;return o.registerListeners=function(){var s=this.hls;s.on(M.Events.FRAG_LOADING,this.onFragLoading,this),s.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(M.Events.ERROR,this.onError,this)},o.unregisterListeners=function(){var s=this.hls;s.off(M.Events.FRAG_LOADING,this.onFragLoading,this),s.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(M.Events.ERROR,this.onError,this)},o.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},o.onFragLoading=function(s,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)}},o.onLevelLoaded=function(s,a){var l=this.hls.config;a.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},o._abandonRulesCheck=function(){var s=this.fragCurrent,a=this.partCurrent,l=this.hls,h=l.autoLevelEnabled,O=l.config,w=l.media;if(!s||!w)return;var x=a?a.stats:s.stats,A=a?a.duration:s.duration;if(x.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||w.paused||!w.playbackRate||!w.readyState)return;var S=performance.now()-x.loading.start,T=Math.abs(w.playbackRate);if(S<=500*A/T)return;var E=l.levels,_=l.minAutoLevel,u=E[s.level],y=x.total||Math.max(x.loaded,Math.round(A*u.maxBitrate/8)),m=Math.max(1,x.bwEstimate?x.bwEstimate/8:x.loaded*1e3/S),b=(y-x.loaded)/m,P=w.currentTime,I=(W.BufferHelper.bufferInfo(w,P,O.maxBufferHole).end-P)/T;if(I>=2*A/T||b<=I)return;var U=Number.POSITIVE_INFINITY,F;for(F=s.level-1;F>_;F--){var L=E[F].maxBitrate;if(U=A*L/(8*.8*m),U<I)break}if(U>=b)return;var v=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+s.sn+(a?" part "+a.index:"")+" of level "+s.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+F+`
Current BW estimate: `+(Object(z.isFiniteNumber)(v)?(v/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+b.toFixed(3)+` s
Estimated load time for the next fragment: `+U.toFixed(3)+` s
Time to underbuffer: `+I.toFixed(3)+" s"),l.nextLoadLevel=F,this.bwEstimator.sample(S,x.loaded),this.clearTimer(),s.loader&&(this.fragCurrent=this.partCurrent=null,s.loader.abort()),l.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:a,stats:x})},o.onFragLoaded=function(s,a){var l=a.frag,h=a.part;if(l.type===k.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(l.sn)){var O=h?h.stats:l.stats,w=h?h.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var x=this.hls.levels[l.level],A=(x.loaded?x.loaded.bytes:0)+O.loaded,S=(x.loaded?x.loaded.duration:0)+w;x.loaded={bytes:A,duration:S},x.realBitrate=Math.round(8*A/S)}if(l.bitrateTest){var T={stats:O,frag:l,part:h,id:l.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,T),l.bitrateTest=!1}}},o.onFragBuffered=function(s,a){var l=a.frag,h=a.part,O=h?h.stats:l.stats;if(O.aborted)return;if(l.type!==k.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var w=O.parsing.end-O.loading.start;this.bwEstimator.sample(w,O.loaded),O.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=w/1e3:this.bitrateTestDelay=0},o.onError=function(s,a){switch(a.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},o.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},o.getNextABRAutoLevel=function(){var s=this.fragCurrent,a=this.partCurrent,l=this.hls,h=l.maxAutoLevel,O=l.config,w=l.minAutoLevel,x=l.media,A=a?a.duration:s?s.duration:0,S=x?x.currentTime:0,T=x&&x.playbackRate!==0?Math.abs(x.playbackRate):1,E=this.bwEstimator?this.bwEstimator.getEstimate():O.abrEwmaDefaultEstimate,_=(W.BufferHelper.bufferInfo(x,S,O.maxBufferHole).end-S)/T,u=this.findBestLevel(E,w,h,_,O.abrBandWidthFactor,O.abrBandWidthUpFactor);if(u>=0)return u;R.logger.trace((_?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var y=A?Math.min(A,O.maxStarvationDelay):O.maxStarvationDelay,m=O.abrBandWidthFactor,b=O.abrBandWidthUpFactor;if(!_){var P=this.bitrateTestDelay;if(P){var I=A?Math.min(A,O.maxLoadingDelay):O.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=b=1}}return u=this.findBestLevel(E,w,h,_+y,m,b),Math.max(u,0)},o.findBestLevel=function(s,a,l,h,O,w){for(var x,A=this.fragCurrent,S=this.partCurrent,T=this.lastLoadedFragLevel,E=this.hls.levels,_=E[T],u=!!(_!=null&&(x=_.details)!==null&&x!==void 0&&x.live),y=_==null?void 0:_.codecSet,m=S?S.duration:A?A.duration:0,b=l;b>=a;b--){var P=E[b];if(!P||y&&P.codecSet!==y)continue;var I=P.details,U=(S?I==null?void 0:I.partTarget:I==null?void 0:I.averagetargetduration)||m,F=void 0;b<=T?F=O*s:F=w*s;var L=E[b].maxBitrate,v=L*U/F;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(F)+"/"+L+"/"+U+"/"+h+"/"+v),F>L&&(!v||u&&!this.bitrateTestDelay||v<h))return b}return-1},p(d,[{key:"nextAutoLevel",get:function(){var s=this._nextAutoLevel,a=this.bwEstimator;if(s!==-1&&(!a||!a.canEstimate()))return s;var l=this.getNextABRAutoLevel();return s!==-1&&(l=Math.min(s,l)),l},set:function(s){this._nextAutoLevel=s}}]),d}();V.default=f},"./src/controller/audio-stream-controller.ts":function(ne,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"),B=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"),o=D("./src/controller/fragment-finders.ts"),c=D("./src/utils/discontinuities.ts"),s=D("./src/errors.ts"),a=D("./src/utils/logger.ts");function l(){return l=Object.assign||function(A){for(var S=1;S<arguments.length;S++){var T=arguments[S];for(var E in T)Object.prototype.hasOwnProperty.call(T,E)&&(A[E]=T[E])}return A},l.apply(this,arguments)}function h(A,S){A.prototype=Object.create(S.prototype),A.prototype.constructor=A,O(A,S)}function O(A,S){return O=Object.setPrototypeOf||function(E,_){return E.__proto__=_,E},O(A,S)}var w=100,x=function(A){h(S,A);function S(E,_){var u;return u=A.call(this,E,_,"[audio-stream-controller]")||this,u.videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u._registerListeners(),u}var T=S.prototype;return T.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},T._registerListeners=function(){var _=this.hls;_.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),_.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),_.on(M.Events.ERROR,this.onError,this),_.on(M.Events.BUFFER_RESET,this.onBufferReset,this),_.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),_.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),_.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var _=this.hls;_.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),_.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),_.off(M.Events.ERROR,this.onError,this),_.off(M.Events.BUFFER_RESET,this.onBufferReset,this),_.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),_.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),_.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onInitPtsFound=function(_,u){var y=u.frag,m=u.id,b=u.initPTS;if(m==="main"){var P=y.cc;this.initPTS[y.cc]=b,this.log("InitPTS for cc: "+P+" found from main: "+b),this.videoTrackCC=P,this.state===N.State.WAITING_INIT_PTS&&this.tick()}},T.startLoad=function(_){if(!this.levels){this.startPosition=_,this.state=N.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(w),this.fragLoadError=0,u>0&&_===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=N.State.IDLE):(this.loadedmetadata=!1,this.state=N.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=_,this.tick()},T.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_TRACK:{var _,u=this.levels,y=this.trackId,m=u==null||((_=u[y])===null||_===void 0)?void 0:_.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=N.State.WAITING_INIT_PTS}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var b,P=performance.now(),I=this.retryDate;(!I||P>=I||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=N.State.IDLE);break}case N.State.WAITING_INIT_PTS:{var U=this.waitingData;if(U){var F=U.frag,L=U.part,v=U.cache,j=U.complete;if(this.initPTS[F.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.FRAG_LOADING;var K=v.flush(),J={frag:F,part:L,payload:K,networkDetails:null};this._handleFragmentLoadProgress(J),j&&A.prototype._handleFragmentLoadComplete.call(this,J)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+F.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ee=this.getLoadPosition(),ve=W.BufferHelper.bufferInfo(this.mediaBuffer,ee,this.config.maxBufferHole),de=Object(o.fragmentWithinToleranceTest)(ve.end,this.config.maxFragLookUpTolerance,F);de<0&&(a.logger.log("Waiting fragment cc ("+F.cc+") @ "+F.start+" cancelled because another fragment at "+ve.end+" is needed"),this.clearWaitingFragment())}}else this.state=N.State.IDLE}}this.onTickEnd()},T.clearWaitingFragment=function(){var _=this.waitingData;_&&(this.fragmentTracker.removeFragment(_.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.IDLE)},T.onTickEnd=function(){var _=this.media;if(!_||!_.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:_,y=u.buffered;!this.loadedmetadata&&y.length&&(this.loadedmetadata=!0),this.lastCurrentTime=_.currentTime},T.doTickIdle=function(){var _,u,y=this.hls,m=this.levels,b=this.media,P=this.trackId,I=y.config;if(!m||!m[P])return;if(!b&&(this.startFragRequested||!I.startFragPrefetch))return;var U=m[P],F=U.details;if(!F||F.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(F)){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 L=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(L===null)return;var v=L.len,j=this.getMaxBufferLength(),K=this.audioSwitch;if(v>=j&&!K)return;if(!K&&this._streamEnded(L,F)){y.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=N.State.ENDED;return}var J=F.fragments,ee=J[0].start,ve=L.end;if(K){var de=this.getLoadPosition();ve=de,F.PTSKnown&&de<ee&&((L.end>ee||L.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=ee+.05))}var me=this.getNextFragment(ve,F);if(!me){this.bufferFlushed=!0;return}((_=me.decryptdata)===null||_===void 0?void 0:_.keyFormat)==="identity"&&!((u=me.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(me,F):this.loadFragment(me,F,ve)},T.getMaxBufferLength=function(){var _=A.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return u===null?_:Math.max(_,u.len)},T.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},T.onAudioTracksUpdated=function(_,u){var y=u.audioTracks;this.resetTransmuxer(),this.levels=y.map(function(m){return new k.Level(m)})},T.onAudioTrackSwitching=function(_,u){var y=!!u.url;this.trackId=u.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),y?this.setInterval(w):this.resetTransmuxer(),y?(this.audioSwitch=!0,this.state=N.State.IDLE):this.state=N.State.STOPPED,this.tick()},T.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},T.onLevelLoaded=function(_,u){this.mainDetails=u.details},T.onAudioTrackLoaded=function(_,u){var y,m=this.levels,b=u.details,P=u.id;if(!m){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var I=m[P],U=0;if(b.live||(y=I.details)!==null&&y!==void 0&&y.live){var F=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!F)return;!I.details&&b.hasProgramDateTime&&F.hasProgramDateTime?(Object(c.alignMediaPlaylistByPDT)(b,F),U=b.fragments[0].start):U=this.alignPlaylists(b,I.details)}I.details=b,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(I.details,U),this.state===N.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=N.State.IDLE),this.tick()},T._handleFragmentLoadProgress=function(_){var u,y=_.frag,m=_.part,b=_.payload,P=this.config,I=this.trackId,U=this.levels;if(!U){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 F=U[I];console.assert(F,"Audio track is defined on fragment load progress");var L=F.details;console.assert(L,"Audio track details are defined on fragment load progress");var v=P.defaultAudioCodec||F.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 K=this.initPTS[y.cc],J=(u=y.initSegment)===null||u===void 0?void 0:u.data;if(K!==void 0){var ee=!1,ve=m?m.index:-1,de=ve!==-1,me=new d.ChunkMetadata(y.level,y.sn,y.stats.chunkCount,b.byteLength,ve,de);j.push(b,J,v,"",y,m,L.totalduration,ee,me,K)}else{a.logger.log("Unknown video PTS for cc "+y.cc+", waiting for video PTS before demuxing audio frag "+y.sn+" of ["+L.startSN+" ,"+L.endSN+"],track "+I);var ce=this.waitingData=this.waitingData||{frag:y,part:m,cache:new p.default,complete:!1},pe=ce.cache;pe.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=N.State.WAITING_INIT_PTS}},T._handleFragmentLoadComplete=function(_){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,_)},T.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},T.onBufferCreated=function(_,u){var y=u.tracks.audio;y&&(this.mediaBuffer=y.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},T.onFragBuffered=function(_,u){var y=u.frag,m=u.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)},T.onError=function(_,u){switch(u.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.AUDIO,u);break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==N.State.ERROR&&this.state!==N.State.STOPPED&&(this.state=u.fatal?N.State.ERROR:N.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(u.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,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},T.onBufferFlushed=function(_,u){var y=u.type;y===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},T._handleTransmuxComplete=function(_){var u,y="audio",m=this.hls,b=_.remuxResult,P=_.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 U=I.frag,F=I.part,L=b.audio,v=b.text,j=b.id3,K=b.initSegment;if(this.fragContextChanged(U))return;if(this.state=N.State.PARSING,this.audioSwitch&&L&&this.completeAudioSwitch(),K!=null&&K.tracks&&(this._bufferInitSegment(K.tracks,U,P),m.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:y,tracks:K.tracks})),L){var J=L.startPTS,ee=L.endPTS,ve=L.startDTS,de=L.endDTS;F&&(F.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:J,endPTS:ee,startDTS:ve,endDTS:de}),U.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,J,ee,ve,de),this.bufferFragmentData(L,U,F,P)}if(j!=null&&(u=j.samples)!==null&&u!==void 0&&u.length){var me=l({frag:U,id:y},j);m.trigger(M.Events.FRAG_PARSING_METADATA,me)}if(v){var ce=l({frag:U,id:y},v);m.trigger(M.Events.FRAG_PARSING_USERDATA,ce)}},T._bufferInitSegment=function(_,u,y){if(this.state!==N.State.PARSING)return;_.video&&delete _.video;var m=_.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,_);var b=m.initSegment;if(b!=null&&b.byteLength){var P={type:"audio",frag:u,part:null,chunkMeta:y,parent:u.type,data:b};this.hls.trigger(M.Events.BUFFER_APPENDING,P)}this.tick()},T.loadFragment=function(_,u,y){var m=this.fragmentTracker.getState(_);this.fragCurrent=_,(this.audioSwitch||m===B.FragmentState.NOT_LOADED||m===B.FragmentState.PARTIAL)&&(_.sn==="initSegment"?this._loadInitSegment(_):u.live&&!Object(z.isFiniteNumber)(this.initPTS[_.cc])?(this.log("Waiting for video PTS in continuity counter "+_.cc+" of live stream before loading audio fragment "+_.sn+" of level "+this.trackId),this.state=N.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,_,u,y)))},T.completeAudioSwitch=function(){var _=this.hls,u=this.media,y=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,_.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:y})},S}(N.default);V.default=x},"./src/controller/audio-track-controller.ts":function(ne,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 B(f,d){for(var o=0;o<d.length;o++){var c=d[o];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(f,c.key,c)}}function k(f,d,o){return d&&B(f.prototype,d),o&&B(f,o),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(c,s){return c.__proto__=s,c},g(f,d)}var p=function(f){R(d,f);function d(c){var s;return s=f.call(this,c,"[audio-track-controller]")||this,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.trackName="",s.selectDefaultTrack=!0,s.registerListeners(),s}var o=d.prototype;return o.registerListeners=function(){var s=this.hls;s.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(z.Events.ERROR,this.onError,this)},o.unregisterListeners=function(){var s=this.hls;s.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(z.Events.ERROR,this.onError,this)},o.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,f.prototype.destroy.call(this)},o.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},o.onManifestParsed=function(s,a){this.tracks=a.audioTracks||[]},o.onAudioTrackLoaded=function(s,a){var l=a.id,h=a.details,O=this.tracksInGroup[l];if(!O){this.warn("Invalid audio track id "+l);return}var w=O.details;O.details=a.details,this.log("audioTrack "+l+" loaded ["+h.startSN+"-"+h.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,a,w))},o.onLevelLoading=function(s,a){this.switchLevel(a.level)},o.onLevelSwitching=function(s,a){this.switchLevel(a.level)},o.switchLevel=function(s){var a=this.hls.levels[s];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(w){return!l||w.groupId===l});this.selectDefaultTrack&&!h.some(function(w){return w.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var O={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,O),this.selectInitialTrack()}},o.onError=function(s,a){if(f.prototype.onError.call(this,s,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)},o.setAudioTrack=function(s){var a=this.tracksInGroup;if(s<0||s>=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 "+s);var h=a[s],O=h.id,w=h.groupId,x=w===void 0?"":w,A=h.name,S=h.type,T=h.url;if(this.trackId=s,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:O,groupId:x,name:A,type:S,url:T}),h.details&&!h.details.live)return;var E=this.switchParams(h.url,l==null?void 0:l.details);this.loadPlaylist(E)},o.selectInitialTrack=function(){var s=this.tracksInGroup;console.assert(s.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}))},o.findTrackId=function(s){for(var a=this.tracksInGroup,l=0;l<a.length;l++){var h=a[l];if((!this.selectDefaultTrack||h.default)&&(!s||s===h.name))return h.id}return-1},o.loadPlaylist=function(s){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var l=a.id,h=a.groupId,O=a.url;if(s)try{O=s.addDirectives(O)}catch(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:O,id:l,groupId:h,deliveryDirectives:s||null})}},k(d,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1,this.setAudioTrack(s)}}]),d}(M.default);V.default=p},"./src/controller/base-playlist-controller.ts":function(ne,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"),B=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===B.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 o=d==null?void 0:d.renditionReports;if(o)for(var c=0;c<o.length;c++){var s=o[c],a=""+s.URI;if(a===f.substr(-a.length)){var l=parseInt(s["LAST-MSN"]),h=parseInt(s["LAST-PART"]);if(d&&this.hls.config.lowLatencyMode){var O=Math.min(d.age-d.partTarget,d.targetduration);h!==void 0&&O>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,o){var c=this,s=d.details,a=d.stats,l=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(s.advancedDateTime=Date.now()-l,s.live||o!=null&&o.live){if(s.reloaded(o),o&&this.log("live playlist "+f+" "+(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:"MISSED")),o&&s.fragments.length>0&&Object(M.mergeDetails)(o,s),!this.canLoad||!s.live)return;var h,O=void 0,w=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var x=this.hls.config.lowLatencyMode,A=s.lastPartSn,S=s.endSN,T=s.lastPartIndex,E=T!==-1,_=A===S,u=x?0:T;E?(O=_?S+1:A,w=_?u:T+1):O=S+1;var y=s.age,m=y+s.ageHeader,b=Math.min(m-s.partTarget,s.targetduration*1.5);if(b>0){if(o&&b>o.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+o.tuneInGoal+" to: "+b+" with playlist age: "+s.age),b=0;else{var P=Math.floor(b/s.targetduration);if(O+=P,w!==void 0){var I=Math.round(b%s.targetduration/s.partTarget);w+=I}this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+y.toFixed(2)+"s goal: "+b+" skip sn "+P+" to part "+w)}s.tuneInGoal=b}if(h=this.getDeliveryDirectives(s,d.deliveryDirectives,O,w),x||!_){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(s,d.deliveryDirectives,O,w);var U=Object(M.computeReloadInterval)(s,a);O!==void 0&&s.canBlockReload&&(U-=s.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(U)+" ms"),this.timer=self.setTimeout(function(){return c.loadPlaylist(h)},U)}else this.clearTimer()},g.getDeliveryDirectives=function(f,d,o,c){var s=Object(N.getSkipValue)(f,o);return d!=null&&d.skip&&f.deltaUpdateFailed&&(o=d.msn,c=d.part,s=N.HlsSkip.No),new N.HlsUrlParameters(o,c,s)},g.retryLoadingOrFail=function(f){var d=this,o=this.hls.config,c=this.retryCount<o.levelLoadingMaxRetry;if(c){var s;if(this.retryCount++,f.details.indexOf("LoadTimeOut")>-1&&(s=f.context)!==null&&s!==void 0&&s.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+f.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*o.levelLoadingRetryDelay,o.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 c},R}()},"./src/controller/base-stream-controller.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"State",function(){return S}),D.d(V,"default",function(){return T});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"),B=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"),o=D("./src/controller/level-helper.ts"),c=D("./src/loader/fragment-loader.ts"),s=D("./src/crypt/decrypter.ts"),a=D("./src/utils/time-ranges.ts"),l=D("./src/types/loader.ts");function h(E,_){for(var u=0;u<_.length;u++){var y=_[u];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(E,y.key,y)}}function O(E,_,u){return _&&h(E.prototype,_),u&&h(E,u),E}function w(E){if(E===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E}function x(E,_){E.prototype=Object.create(_.prototype),E.prototype.constructor=E,A(E,_)}function A(E,_){return A=Object.setPrototypeOf||function(y,m){return y.__proto__=m,y},A(E,_)}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"},T=function(E){x(_,E);function _(y,m,b){var P;return P=E.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=b,P.log=B.logger.log.bind(B.logger,b+":"),P.warn=B.logger.warn.bind(B.logger,b+":"),P.hls=y,P.fragmentLoader=new c.default(y.config),P.fragmentTracker=m,P.config=y.config,P.decrypter=new s.default(y,y.config),y.on(k.Events.KEY_LOADED,P.onKeyLoaded,w(P)),P}var u=_.prototype;return u.doTick=function(){this.onTickEnd()},u.onTickEnd=function(){},u.startLoad=function(m){},u.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=S.STOPPED},u._streamEnded=function(m,b){var P=this.fragCurrent,I=this.fragmentTracker;if(!b.live&&P&&P.sn===b.endSN&&!m.nextStart){var U=I.getState(P);return U===M.FragmentState.PARTIAL||U===M.FragmentState.OK}return!1},u.onMediaAttached=function(m,b){var P=this.media=this.mediaBuffer=b.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)},u.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},u.onMediaSeeking=function(){var m=this.config,b=this.fragCurrent,P=this.media,I=this.mediaBuffer,U=this.state,F=P?P.currentTime:0,L=W.BufferHelper.bufferInfo(I||P,F,m.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(F)?F.toFixed(3):F)+", state: "+U),U===S.ENDED)this.resetLoadingState();else if(b&&!L.len){var v=m.maxFragLookUpTolerance,j=b.start-v,K=b.start+b.duration+v,J=F>K;(F<j||J)&&(J&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=F),!this.loadedmetadata&&!L.len&&(this.nextLoadPosition=this.startPosition=F),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(m,b){if(this.state!==S.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=S.IDLE;var P=this.levels[b.frag.level].details;P&&this.loadFragment(b.frag,P,b.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),E.prototype.onHandlerDestroying.call(this)},u.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,E.prototype.onHandlerDestroyed.call(this)},u.loadKey=function(m,b){this.log("Loading key for "+m.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=S.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(k.Events.KEY_LOADING,{frag:m})},u.loadFragment=function(m,b,P){this._loadFragForPlayback(m,b,P)},u._loadFragForPlayback=function(m,b,P){var I=this,U=function(L){if(I.fragContextChanged(m)){I.warn("Fragment "+m.sn+(L.part?" p: "+L.part.index:"")+" of level "+m.level+" was dropped during download."),I.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,I._handleFragmentLoadProgress(L)};this._doFragLoad(m,b,P,U).then(function(F){if(!F)return;I.fragLoadError=0;var L=I.state;if(I.fragContextChanged(m)){(L===S.FRAG_LOADING||L===S.BACKTRACKING||!I.fragCurrent&&L===S.PARSING)&&(I.fragmentTracker.removeFragment(m),I.state=S.IDLE);return}if("payload"in F&&(I.log("Loaded fragment "+m.sn+" of level "+m.level),I.hls.trigger(k.Events.FRAG_LOADED,F),I.state===S.BACKTRACKING)){I.fragmentTracker.backtrack(m,F),I.resetFragmentLoading(m);return}I._handleFragmentLoadComplete(F)}).catch(function(F){I.warn(F),I.resetFragmentLoading(m)})},u.flushMainBuffer=function(m,b,P){if(P===void 0&&(P=null),!(m-b))return;var I={startOffset:m,endOffset:b,type:P};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,I)},u._loadInitSegment=function(m){var b=this;this._doFragLoad(m).then(function(P){if(!P||b.fragContextChanged(m)||!b.levels)throw new Error("init load aborted");return P}).then(function(P){var I=b.hls,U=P.payload,F=m.decryptdata;if(U&&U.byteLength>0&&F&&F.key&&F.iv&&F.method==="AES-128"){var L=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(U),F.key.buffer,F.iv.buffer).then(function(v){var j=self.performance.now();return I.trigger(k.Events.FRAG_DECRYPTED,{frag:m,payload:v,stats:{tstart:L,tdecrypt:j}}),P.payload=v,P})}return P}).then(function(P){var I=b.fragCurrent,U=b.hls,F=b.levels;if(!F)throw new Error("init load aborted, missing levels");var L=F[m.level].details;console.assert(L,"Level details are defined when init segment is loaded");var v=m.stats;b.state=S.IDLE,b.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&&U.trigger(k.Events.FRAG_BUFFERED,{stats:v,frag:I,part:null,id:m.type}),b.tick()}).catch(function(P){b.warn(P),b.resetFragmentLoading(m)})},u.fragContextChanged=function(m){var b=this.fragCurrent;return!m||!b||m.level!==b.level||m.sn!==b.sn||m.urlId!==b.urlId},u.fragBufferedComplete=function(m,b){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+a.default.toString(W.BufferHelper.getBuffered(P))),this.state=S.IDLE,this.tick()},u._handleFragmentLoadComplete=function(m){var b=this.transmuxer;if(!b)return;var P=m.frag,I=m.part,U=m.partsLoaded,F=!U||U.length===0||U.some(function(v){return!v}),L=new g.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,I?I.index:-1,!F);b.flush(L)},u._handleFragmentLoadProgress=function(m){},u._doFragLoad=function(m,b,P,I){var U=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&&b){var F=b.partList;if(F&&I){P>m.end&&b.fragmentHint&&(m=b.fragmentHint);var L=this.getNextPart(F,m,P);if(L>-1){var v=F[L];return this.log("Loading part sn: "+m.sn+" p: "+v.index+" cc: "+m.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+L+"-"+(F.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:F[L],targetBufferTime:P}),this.doFragPartsLoad(m,F,L,I).catch(function(j){return U.handleFragLoadError(j)})}else if(!m.url||this.loadedEndOfParts(F,P))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(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 U.handleFragLoadError(j)})},u.doFragPartsLoad=function(m,b,P,I){var U=this;return new Promise(function(F,L){var v=[],j=function K(J){var ee=b[J];U.fragmentLoader.loadPart(m,ee,I).then(function(ve){v[ee.index]=ve;var de=ve.part;U.hls.trigger(k.Events.FRAG_LOADED,ve);var me=b[J+1];if(me&&me.fragment===m)K(J+1);else return F({frag:m,part:de,partsLoaded:v})}).catch(L)};j(P)})},u.handleFragLoadError=function(m){var b=m.data;return b&&b.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(k.Events.ERROR,b),null},u._handleTransmuxerFlush=function(m){var b=this.getCurrentContext(m);if(!b||this.state!==S.PARSING){this.fragCurrent||(this.state=S.IDLE);return}var P=b.frag,I=b.part,U=b.level,F=self.performance.now();P.stats.parsing.end=F,I&&(I.stats.parsing.end=F),this.updateLevelTiming(P,I,U,m.partial)},u.getCurrentContext=function(m){var b=this.levels,P=m.level,I=m.sn,U=m.part;if(!b||!b[P])return this.warn("Levels object was unset while buffering fragment "+I+" of level "+P+". The current chunk will not be buffered."),null;var F=b[P],L=U>-1?Object(o.getPartWith)(F,I,U):null,v=L?L.fragment:Object(o.getFragmentWithSN)(F,I,this.fragCurrent);return v?{frag:v,part:L,level:F}:null},u.bufferFragmentData=function(m,b,P,I){if(!m||this.state!==S.PARSING)return;var U=m.data1,F=m.data2,L=U;if(U&&F&&(L=Object(p.appendUint8Array)(U,F)),!L||!L.length)return;var v={type:m.type,frag:b,part:P,chunkMeta:I,parent:b.type,data:L};this.hls.trigger(k.Events.BUFFER_APPENDING,v),m.dropped&&m.independent&&!P&&this.flushBufferGap(b)},u.flushBufferGap=function(m){var b=this.media;if(!b)return;if(!W.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,m.start);return}var P=b.currentTime,I=W.BufferHelper.bufferInfo(b,P,0),U=m.duration,F=Math.min(this.config.maxFragLookUpTolerance*2,U*.25),L=Math.max(Math.min(m.start-F,I.end-F),P+F);m.start-L>F&&this.flushMainBuffer(L,m.start)},u.getFwdBufferInfo=function(m,b){var P=this.config,I=this.getLoadPosition();if(!Object(z.isFiniteNumber)(I))return null;var U=W.BufferHelper.bufferInfo(m,I,P.maxBufferHole);if(U.len===0&&U.nextStart!==void 0){var F=this.fragmentTracker.getBufferedFrag(I,b);if(F&&U.nextStart<F.end)return W.BufferHelper.bufferInfo(m,I,Math.max(U.nextStart,P.maxBufferHole))}return U},u.getMaxBufferLength=function(m){var b=this.config,P;return m?P=Math.max(8*b.maxBufferSize/m,b.maxBufferLength):P=b.maxBufferLength,Math.min(P,b.maxMaxBufferLength)},u.reduceMaxBufferLength=function(m){var b=this.config,P=m||b.maxBufferLength;return b.maxMaxBufferLength>=P?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(m,b){var P,I,U=b.fragments,F=U.length;if(!F)return null;var L=this.config,v=U[0].start,j;if(b.live){var K=L.initialLiveManifestSize;if(F<K)return this.warn("Not enough fragments to start playback (have: "+F+", need: "+K+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(j=this.getInitialLiveFragment(b,U),this.startPosition=j?this.hls.liveSyncPosition||j.start:m)}else m<=v&&(j=U[0]);if(!j){var J=L.lowLatencyMode?b.partEnd:b.fragmentEnd;j=this.getFragmentAtPosition(m,J,b)}return(P=j)!==null&&P!==void 0&&P.initSegment&&!((I=j)!==null&&I!==void 0&&I.initSegment.data)&&!this.bitrateTest&&(j=j.initSegment),j},u.getNextPart=function(m,b,P){for(var I=-1,U=!1,F=!0,L=0,v=m.length;L<v;L++){var j=m[L];if(F=F&&!j.independent,I>-1&&P<j.start)break;var K=j.loaded;!K&&(U||j.independent||F)&&j.fragment===b&&(I=L),U=K}return I},u.loadedEndOfParts=function(m,b){var P=m[m.length-1];return P&&b>P.start&&P.loaded},u.getInitialLiveFragment=function(m,b){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)(b,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!I){var U=P.sn+1;if(U>=m.startSN&&U<=m.endSN){var F=b[U-m.startSN];P.cc===F.cc&&(I=F,this.log("Live playlist, switching playlist, load frag with next SN: "+I.sn))}I||(I=Object(d.findFragWithCC)(b,P.cc),I&&this.log("Live playlist, switching playlist, load frag with same CC: "+I.sn))}}else{var L=this.hls.liveSyncPosition;L!==null&&(I=this.getFragmentAtPosition(L,this.bitrateTest?m.fragmentEnd:m.edge,m))}return I},u.getFragmentAtPosition=function(m,b,P){var I=this.config,U=this.fragPrevious,F=P.fragments,L=P.endSN,v=P.fragmentHint,j=I.maxFragLookUpTolerance,K=!!(I.lowLatencyMode&&P.partList&&v);K&&v&&!this.bitrateTest&&(F=F.concat(v),L=v.sn);var J;if(m<b){var ee=m>b-j?0:j;J=Object(d.findFragmentByPTS)(U,F,m,ee)}else J=F[F.length-1];if(J){var ve=J.sn-P.startSN,de=U&&J.level===U.level,me=F[ve+1],ce=this.fragmentTracker.getState(J);if(ce===M.FragmentState.BACKTRACKED){J=null;for(var pe=ve;F[pe]&&this.fragmentTracker.getState(F[pe])===M.FragmentState.BACKTRACKED;)U?J=F[pe--]:J=F[--pe];J||(J=me)}else U&&J.sn===U.sn&&!K&&(de&&(J.sn<L&&this.fragmentTracker.getState(me)!==M.FragmentState.OK?(this.log("SN "+J.sn+" just loaded, load next one: "+me.sn),J=me):J=null))}return J},u.synchronizeToLiveEdge=function(m){var b=this.config,P=this.media;if(!P)return;var I=this.hls.liveSyncPosition,U=P.currentTime,F=m.fragments[0].start,L=m.edge,v=U>=F-b.maxFragLookUpTolerance&&U<=L;if(I!==null&&P.duration>I&&(U<I||!v)){var j=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*m.targetduration;(!v&&P.readyState<4||U<L-j)&&(this.loadedmetadata||(this.nextLoadPosition=I),P.readyState&&(this.warn("Playback: "+U.toFixed(3)+" is located too far from the end of live sliding playlist: "+L+", reset currentTime to : "+I.toFixed(3)),P.currentTime=I))}},u.alignPlaylists=function(m,b){var P=this.levels,I=this.levelLastLoaded,U=this.fragPrevious,F=I!==null?P[I]:null,L=m.fragments.length;if(!L)return this.warn("No fragments in live playlist"),0;var v=m.fragments[0].start,j=!b,K=m.alignedSliding&&Object(z.isFiniteNumber)(v);if(j||!K&&!v){Object(f.alignStream)(U,F,m);var J=m.fragments[0].start;return this.log("Live playlist sliding: "+J.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+m.startSN+" prev-sn: "+(U?U.sn:"na")+" fragments: "+L),J}return v},u.waitForCdnTuneIn=function(m){var b=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*b)},u.setStartPosition=function(m,b){var P=this.startPosition;if(P<b&&(P=-1),P===-1||this.lastCurrentTime===-1){var I=m.startTimeOffset;Object(z.isFiniteNumber)(I)?(P=b+I,I<0&&(P+=m.totalduration),P=Math.min(Math.max(b,P),b+m.totalduration),this.log("Start time offset "+I+" found in playlist, adjust startPosition to "+P),this.startPosition=P):m.live?P=this.hls.liveSyncPosition||b:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},u.getLoadPosition=function(){var m=this.media,b=0;return this.loadedmetadata&&m?b=m.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},u.handleFragLoadAborted=function(m,b){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(b?" part"+b.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},u.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=S.IDLE)},u.onFragmentOrKeyLoadError=function(m,b){if(b.fatal)return;var P=b.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 U=this.config;if(this.fragLoadError+1<=U.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var F=Math.min(Math.pow(2,this.fragLoadError)*U.fragLoadingRetryDelay,U.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+m+" "+P.level+" failed to load, retrying in "+F+"ms"),this.retryDate=self.performance.now()+F,this.fragLoadError++,this.state=S.FRAG_LOADING_WAITING_RETRY}else b.levelRetry?(m===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=S.IDLE):(B.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=S.ERROR)},u.afterBufferFlushed=function(m,b,P){if(!m)return;var I=W.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(b,I,P),this.state===S.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=S.IDLE},u.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[m].details:null;if(b!=null&&b.live)return this.startPosition=-1,this.setStartPosition(b,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(m,b,P,I){var U=this,F=P.details;console.assert(!!F,"level.details must be defined");var L=Object.keys(m.elementaryStreams).reduce(function(v,j){var K=m.elementaryStreams[j];if(K){var J=K.endPTS-K.startPTS;if(J<=0)return U.warn("Could not parse fragment "+m.sn+" "+j+" duration reliably ("+J+") resetting transmuxer to fallback to playlist timing"),U.resetTransmuxer(),v||!1;var ee=I?0:Object(o.updateFragPTSDTS)(F,m,K.startPTS,K.endPTS,K.startDTS,K.endDTS);return U.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:F,level:P,drift:ee,type:j,frag:m,start:K.startPTS,end:K.endPTS}),!0}return v},!1);L?(this.state=S.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:m,part:b})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},O(_,[{key:"state",get:function(){return this._state},set:function(m){var b=this._state;b!==m&&(this._state=m,this.log(b+"->"+m))}}]),_}(N.default)},"./src/controller/buffer-controller.ts":function(ne,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"),B=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 o(s){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,O=a.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),h&&(a.updateMediaElementDuration(),l.trigger(N.Events.MEDIA_ATTACHED,{media:h})),O&&O.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=s,this._initSourceBuffer(),this.registerListeners()}var c=o.prototype;return c.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},c.destroy=function(){this.unregisterListeners(),this.details=null},c.registerListeners=function(){var 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)},c.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)},c._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},c.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")},c.onMediaAttaching=function(a,l){var h=this.media=l.media;if(h&&p){var O=this.mediaSource=new p;O.addEventListener("sourceopen",this._onMediaSourceOpen),O.addEventListener("sourceended",this._onMediaSourceEnded),O.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(O),this._objectUrl=h.src}},c.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(O){M.logger.warn("[buffer-controller]: onMediaDetaching: "+O.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)},c.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(O){M.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",O)}}),this._initSourceBuffer()},c.onBufferCodecs=function(a,l){var h=this,O=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(w){if(O){var x=h.tracks[w];if(x&&typeof x.buffer.changeType=="function"){var A=l[w],S=A.codec,T=A.levelCodec,E=A.container,_=(x.levelCodec||x.codec).replace(f,"$1"),u=(T||S).replace(f,"$1");if(_!==u){var y=E+";codecs="+(T||S);h.appendChangeType(w,y)}}}else h.pendingTracks[w]=l[w]}),O)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},c.appendChangeType=function(a,l){var h=this,O=this.operationQueue,w={execute:function(){var A=h.sourceBuffer[a];A&&(M.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+l),A.changeType(l)),O.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(A){M.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",A)}};O.append(w,a)},c.onBufferAppending=function(a,l){var h=this,O=this.hls,w=this.operationQueue,x=this.tracks,A=l.data,S=l.type,T=l.frag,E=l.part,_=l.chunkMeta,u=_.buffering[S],y=self.performance.now();u.start=y;var m=T.stats.buffering,b=E?E.stats.buffering:null;m.start===0&&(m.start=y),b&&b.start===0&&(b.start=y);var P=x.audio,I=S==="audio"&&_.id===1&&(P==null?void 0:P.container)==="audio/mpeg",U={execute:function(){if(u.executeStart=self.performance.now(),I){var L=h.sourceBuffer[S];if(L){var v=T.start-L.timestampOffset;Math.abs(v)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+T.start+" (delta: "+v+") sn: "+T.sn+")"),L.timestampOffset=T.start)}}h.appendExecutor(A,S)},onStart:function(){},onComplete:function(){var L=self.performance.now();u.executeEnd=u.end=L,m.first===0&&(m.first=L),b&&b.first===0&&(b.first=L);var v=h.sourceBuffer,j={};for(var K in v)j[K]=B.BufferHelper.getBuffered(v[K]);h.appendError=0,h.hls.trigger(N.Events.BUFFER_APPENDED,{type:S,frag:T,part:E,chunkMeta:_,parent:T.type,timeRanges:j})},onError:function(L){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+S+" SourceBuffer",L);var v={type:W.ErrorTypes.MEDIA_ERROR,parent:T.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:L,fatal:!1};L.code===DOMException.QUOTA_EXCEEDED_ERR?v.details=W.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,v.details=W.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>O.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+O.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),v.fatal=!0)),O.trigger(N.Events.ERROR,v)}};w.append(U,S)},c.onBufferFlushing=function(a,l){var h=this,O=this.operationQueue,w=function(A){return{execute:h.removeExecutor.bind(h,A,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(N.Events.BUFFER_FLUSHED,{type:A})},onError:function(T){M.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",T)}}};l.type?O.append(w(l.type),l.type):this.getSourceBufferTypes().forEach(function(x){O.append(w(x),x)})},c.onFragParsed=function(a,l){var h=this,O=l.frag,w=l.part,x=[],A=w?w.elementaryStreams:O.elementaryStreams;A[R.ElementaryStreamTypes.AUDIOVIDEO]?x.push("audiovideo"):(A[R.ElementaryStreamTypes.AUDIO]&&x.push("audio"),A[R.ElementaryStreamTypes.VIDEO]&&x.push("video"));var S=function(){var E=self.performance.now();O.stats.buffering.end=E,w&&(w.stats.buffering.end=E);var _=w?w.stats:O.stats;h.hls.trigger(N.Events.FRAG_BUFFERED,{frag:O,part:w,stats:_,id:O.type})};x.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+O.type+" level: "+O.level+" sn: "+O.sn),this.blockBuffers(S,x)},c.onFragChanged=function(a,l){this.flushBackBuffer()},c.onBufferEos=function(a,l){var h=this,O=this.getSourceBufferTypes().reduce(function(w,x){var A=h.sourceBuffer[x];return(!l.type||l.type===x)&&(A&&!A.ended&&(A.ended=!0,M.logger.log("[buffer-controller]: "+x+" sourceBuffer now EOS"))),w&&!!(!A||A.ended)},!0);O&&this.blockBuffers(function(){var w=h.mediaSource;if(!w||w.readyState!=="open")return;w.endOfStream()})},c.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()},c.flushBackBuffer=function(){var a=this.hls,l=this.details,h=this.media,O=this.sourceBuffer;if(!h||l===null)return;var w=this.getSourceBufferTypes();if(!w.length)return;var x=l.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(z.isFiniteNumber)(x)||x<0)return;var A=h.currentTime,S=l.levelTargetDuration,T=Math.max(x,S),E=Math.floor(A/S)*S-T;w.forEach(function(_){var u=O[_];if(u){var y=B.BufferHelper.getBuffered(u);y.length>0&&E>y.start(0)&&(a.trigger(N.Events.BACK_BUFFER_REACHED,{bufferEnd:E}),l.live&&a.trigger(N.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:E}),a.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:E,type:_}))}})},c.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,l=this.hls,h=this.media,O=this.mediaSource,w=a.fragments[0].start+a.totalduration,x=h.duration,A=Object(z.isFiniteNumber)(O.duration)?O.duration:0;a.live&&l.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),O.duration=Infinity,this.updateSeekableRange(a)):(w>A&&w>x||!Object(z.isFiniteNumber)(x))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+w.toFixed(3)),O.duration=w)},c.updateSeekableRange=function(a){var l=this.mediaSource,h=a.fragments,O=h.length;if(O&&a.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var w=Math.max(0,h[0].start),x=Math.max(w,w+a.totalduration);l.setLiveSeekableRange(w,x)}},c.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,l=this.operationQueue,h=this.pendingTracks,O=Object.keys(h).length;if(O&&!a||O===2){this.createSourceBuffers(h),this.pendingTracks={};var w=this.getSourceBufferTypes();if(w.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}w.forEach(function(x){l.executeNext(x)})}},c.createSourceBuffers=function(a){var l=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var O=0;for(var w in a)if(!l[w]){var x=a[w];if(!x)throw Error("source buffer exists for track "+w+", however track does not");var A=x.levelCodec||x.codec,S=x.container+";codecs="+A;M.logger.log("[buffer-controller]: creating sourceBuffer("+S+")");try{var T=l[w]=h.addSourceBuffer(S),E=w;this.addBufferListener(E,"updatestart",this._onSBUpdateStart),this.addBufferListener(E,"updateend",this._onSBUpdateEnd),this.addBufferListener(E,"error",this._onSBUpdateError),this.tracks[w]={buffer:T,codec:A,container:x.container,levelCodec:x.levelCodec,id:x.id},O++}catch(_){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+_.message),this.hls.trigger(N.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:_,mimeType:S})}}O&&this.hls.trigger(N.Events.BUFFER_CREATED,{tracks:this.tracks})},c._onSBUpdateStart=function(a){var l=this.operationQueue,h=l.current(a);h.onStart()},c._onSBUpdateEnd=function(a){var l=this.operationQueue,h=l.current(a);h.onComplete(),l.shiftAndExecuteNext(a)},c._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)},c.removeExecutor=function(a,l,h){var O=this.media,w=this.mediaSource,x=this.operationQueue,A=this.sourceBuffer,S=A[a];if(!O||!w||!S){M.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),x.shiftAndExecuteNext(a);return}var T=Object(z.isFiniteNumber)(O.duration)?O.duration:Infinity,E=Object(z.isFiniteNumber)(w.duration)?w.duration:Infinity,_=Math.max(0,l),u=Math.min(h,T,E);u>_?(M.logger.log("[buffer-controller]: Removing ["+_+","+u+"] from the "+a+" SourceBuffer"),console.assert(!S.updating,a+" sourceBuffer must not be updating"),S.remove(_,u)):x.shiftAndExecuteNext(a)},c.appendExecutor=function(a,l){var h=this.operationQueue,O=this.sourceBuffer,w=O[l];if(!w){M.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(l);return}w.ended=!1,console.assert(!w.updating,l+" sourceBuffer must not be updating"),w.appendBuffer(a)},c.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 O=this.operationQueue,w=l.map(function(x){return O.appendBlocker(x)});Promise.all(w).then(function(){a(),l.forEach(function(x){var A=h.sourceBuffer[x];(!A||!A.updating)&&O.shiftAndExecuteNext(x)})})},c.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},c.addBufferListener=function(a,l,h){var O=this.sourceBuffer[a];if(!O)return;var w=h.bind(this,a);this.listeners[a].push({event:l,listener:w}),O.addEventListener(l,w)},c.removeBufferListeners=function(a){var l=this.sourceBuffer[a];if(!l)return;this.listeners[a].forEach(function(h){l.removeEventListener(h.event,h.listener)})},o}()},"./src/controller/buffer-operation-queue.ts":function(ne,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(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}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(o){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),d.onError(o),(!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(ne,V,D){"use strict";D.r(V);var z=D("./src/events.ts");function N(B,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(B,g.key,g)}}function M(B,k,R){return k&&N(B.prototype,k),R&&N(B,R),B}var W=function(){function B(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=B.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){B.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(o,c){return B.isLevelAllowed(c,p.restrictedLevels)&&c<=g});return this.clientRect=null,B.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},B.isLevelAllowed=function(g,p){return p===void 0&&(p=[]),p.indexOf(g)===-1},B.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},o=g.length-1,c=0;c<g.length;c+=1){var s=g[c];if((s.width>=p||s.height>=f)&&d(s,g[c+1])){o=c;break}}return o},M(B,[{key:"mediaWidth",get:function(){return this.getDimensions().width*B.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*B.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(p){}return g}}]),B}();V.default=W},"./src/controller/cmcd-controller.ts":function(ne,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 B(o,c){for(var s=0;s<c.length;s++){var a=c[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(o,a.key,a)}}function k(o,c,s){return c&&B(o.prototype,c),s&&B(o,s),o}function R(o,c){var s=typeof Symbol!="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(s)return(s=s.call(o)).next.bind(s);if(Array.isArray(o)||(s=g(o))||c&&o&&typeof o.length=="number"){s&&(o=s);var a=0;return function(){return a>=o.length?{done:!0}:{done:!1,value:o[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(o,c){if(!o)return;if(typeof o=="string")return p(o,c);var s=Object.prototype.toString.call(o).slice(8,-1);if(s==="Object"&&o.constructor&&(s=o.constructor.name),s==="Map"||s==="Set")return Array.from(o);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return p(o,c)}function p(o,c){(c==null||c>o.length)&&(c=o.length);for(var s=0,a=new Array(c);s<c;s++)a[s]=o[s];return a}function f(){return f=Object.assign||function(o){for(var c=1;c<arguments.length;c++){var s=arguments[c];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(o[a]=s[a])}return o},f.apply(this,arguments)}var d=function(){function o(s){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(O){try{a.apply(O,{ot:N.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(w){W.logger.warn("Could not generate manifest CMCD data.",w)}},this.applyFragmentData=function(O){try{var w=O.frag,x=a.hls.levels[w.level],A=a.getObjectType(w),S={d:w.duration*1e3,ot:A};(A===N.CMCDObjectType.VIDEO||A===N.CMCDObjectType.AUDIO||A==N.CMCDObjectType.MUXED)&&(S.br=x.bitrate/1e3,S.tb=a.getTopBandwidth(A),S.bl=a.getBufferLength(A)),a.apply(O,S)}catch(T){W.logger.warn("Could not generate segment CMCD data.",T)}},this.hls=s;var l=this.config=s.config,h=l.cmcd;h!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||o.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var c=o.prototype;return c.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)},c.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()},c.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},c.onMediaAttached=function(a,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},c.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},c.onBufferCreated=function(a,l){var h,O;this.audioBuffer=(h=l.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(O=l.tracks.video)===null||O===void 0?void 0:O.buffer},c.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}},c.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 O=o.toHeaders(l);if(!Object.keys(O).length)return;a.headers||(a.headers={}),f(a.headers,O)}else{var w=o.toQuery(l);if(!w)return;a.url=o.appendQueryToUri(a.url,w)}},c.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},c.getTopBandwidth=function(a){for(var l=0,h=a===N.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,O=R(h),w;!(w=O()).done;){var x=w.value;x.bitrate>l&&(l=x.bitrate)}return l>0?l:NaN},c.getBufferLength=function(a){var l=this.hls.media,h=a===N.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!l)return NaN;var O=M.BufferHelper.bufferInfo(h,l.currentTime,this.config.maxBufferHole);return O.len*1e3},c.createPlaylistLoader=function(){var a=this.config.pLoader,l=this.applyPlaylistData,h=a||this.config.loader;return function(){function O(x){this.loader=void 0,this.loader=new h(x)}var w=O.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(A,S,T){l(A),this.loader.load(A,S,T)},k(O,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),O}()},c.createFragmentLoader=function(){var a=this.config.fLoader,l=this.applyFragmentData,h=a||this.config.loader;return function(){function O(x){this.loader=void 0,this.loader=new h(x)}var w=O.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(A,S,T){l(A),this.loader.load(A,S,T)},k(O,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),O}()},o.uuid=function(){var a=URL.createObjectURL(new Blob),l=a.toString();return URL.revokeObjectURL(a),l.substr(l.lastIndexOf("/")+1)},o.serialize=function(a){for(var l=[],h=function(I){return!Number.isNaN(I)&&I!=null&&I!==""&&I!==!1},O=function(I){return Math.round(I)},w=function(I){return O(I/100)*100},x=function(I){return encodeURIComponent(I)},A={br:O,d:O,bl:w,dl:w,mtp:w,nor:x,rtp:w,tb:O},S=Object.keys(a||{}).sort(),T=R(S),E;!(E=T()).done;){var _=E.value,u=a[_];if(!h(u))continue;if(_==="v"&&u===1)continue;if(_=="pr"&&u===1)continue;var y=A[_];y&&(u=y(u));var m=typeof u,b=void 0;_==="ot"||_==="sf"||_==="st"?b=_+"="+u:m==="boolean"?b=_:m==="number"?b=_+"="+u:b=_+"="+JSON.stringify(u),l.push(b)}return l.join(",")},o.toHeaders=function(a){for(var l=Object.keys(a),h={},O=["Object","Request","Session","Status"],w=[{},{},{},{}],x={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},A=0,S=l;A<S.length;A++){var T=S[A],E=x[T]!=null?x[T]:1;w[E][T]=a[T]}for(var _=0;_<w.length;_++){var u=o.serialize(w[_]);u&&(h["CMCD-"+O[_]]=u)}return h},o.toQuery=function(a){return"CMCD="+encodeURIComponent(o.serialize(a))},o.appendQueryToUri=function(a,l){if(!l)return a;var h=a.includes("?")?"&":"?";return""+a+h+l},o}()},"./src/controller/eme-controller.ts":function(ne,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 B(d,o){for(var c=0;c<o.length;c++){var s=o[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(d,s.key,s)}}function k(d,o,c){return o&&B(d.prototype,o),c&&B(d,c),d}var R=3,g=function(o,c,s){var a={audioCapabilities:[],videoCapabilities:[]};return o.forEach(function(l){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:s.audioRobustness||""})}),c.forEach(function(l){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:s.videoRobustness||""})}),[a]},p=function(o,c,s,a){switch(o){case W.KeySystems.WIDEVINE:return g(c,s,a);default:throw new Error("Unknown key-system: "+o)}},f=function(){function d(c){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=c,this._config=c.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var o=d.prototype;return o.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},o._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)},o._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)},o.getLicenseServerUrl=function(s){switch(s){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+s+'"')},o._attemptKeySystemAccess=function(s,a,l){var h=this,O=p(s,a,l,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var w=this.requestMediaKeySystemAccess(s,O);this.mediaKeysPromise=w.then(function(x){return h._onMediaKeySystemAccessObtained(s,x)}),w.catch(function(x){M.logger.error('Failed to obtain key-system "'+s+'" access:',x)})},o._onMediaKeySystemAccessObtained=function(s,a){var l=this;M.logger.log('Access for key-system "'+s+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:s};this._mediaKeysList.push(h);var O=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(w){return h.mediaKeys=w,M.logger.log('Media-keys created for key-system "'+s+'"'),l._onMediaKeysCreated(),w});return O.catch(function(w){M.logger.error("Failed to create media-keys:",w)}),O},o._onMediaKeysCreated=function(){var s=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),s._onNewMediaKeySession(a.mediaKeysSession))})},o._onNewMediaKeySession=function(s){var a=this;M.logger.log("New key-system session "+s.sessionId),s.addEventListener("message",function(l){a._onKeySessionMessage(s,l.message)},!1)},o._onKeySessionMessage=function(s,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"),s.update(l)})},o.onMediaEncrypted=function(s){var a=this;if(M.logger.log('Media is encrypted using "'+s.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(O){if(!a._media)return;a._attemptSetMediaKeys(O),a._generateRequestWithPreferredKeySession(s.initDataType,s.initData)};this.mediaKeysPromise.then(l).catch(l)},o._attemptSetMediaKeys=function(s){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}},o._generateRequestWithPreferredKeySession=function(s,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 O=h.mediaKeysSession;if(!O){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 "'+s+'" init data type'),h.mediaKeysSessionInitialized=!0,O.generateRequest(s,a).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(w){M.logger.error("Error generating key-session request:",w),l.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},o._createLicenseXhr=function(s,a,l){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,s,a,l);var O=this._licenseXhrSetup;if(O)try{O.call(this.hls,h,s),O=void 0}catch(w){M.logger.error(w)}try{h.readyState||h.open("POST",s,!0),O&&O.call(this.hls,h,s)}catch(w){throw new Error("issue setting up KeySystem license XHR "+w)}return h},o._onLicenseRequestReadyStageChange=function(s,a,l,h){switch(s.readyState){case 4:if(s.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var O=s.response,w=this._licenseResponseCallback;if(w)try{O=w.call(this.hls,s,a)}catch(A){M.logger.error(A)}h(O)}else{if(M.logger.error("License Request XHR failed ("+a+"). Status: "+s.status+" ("+s.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 x=R-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+x+" attempts left"),this._requestLicense(l,h)}break}},o._generateLicenseRequestChallenge=function(s,a){switch(s.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+s.mediaKeySystemDomain)},o._requestLicense=function(s,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),O=this._createLicenseXhr(h,s,a);M.logger.log("Sending license request to URL: "+h);var w=this._generateLicenseRequestChallenge(l,s);O.send(w)}catch(x){M.logger.error("Failure requesting DRM license: "+x),this.hls.trigger(z.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},o.onMediaAttached=function(s,a){if(!this._emeEnabled)return;var l=a.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},o.onMediaDetached=function(){var s=this._media,a=this._mediaKeysList;if(!s)return;s.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 s.setMediaKeys(null)}).catch(function(){})},o.onManifestParsed=function(s,a){if(!this._emeEnabled)return;var l=a.levels.map(function(O){return O.audioCodec}).filter(function(O){return!!O}),h=a.levels.map(function(O){return O.videoCodec}).filter(function(O){return!!O});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(ne,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 B=W.prototype;return B.setStreamController=function(R){this.streamController=R},B.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},B.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},B.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)}},B.checkFPS=function(R,g,p){var f=performance.now();if(g){if(this.lastTime){var d=f-this.lastTime,o=p-this.lastDroppedFrames,c=g-this.lastDecodedFrames,s=1e3*o/d,a=this.hls;if(a.trigger(z.Events.FPS_DROP,{currentDropped:o,currentDecoded:c,totalDroppedFrames:p}),s>0&&o>a.config.fpsDroppedMonitoringThreshold*c){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}},B.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(ne,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 B}),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 o=g[g.length-1].endProgramDateTime;if(p>=(o||0))return null;f=f||0;for(var c=0;c<g.length;++c){var s=g[c];if(k(p,f,s))return s}return null}function W(g,p,f,d){f===void 0&&(f=0),d===void 0&&(d=0);var o=null;if(g?o=p[g.sn-p[0].sn+1]||null:f===0&&p[0].start===0&&(o=p[0]),o&&B(f,d,o)===0)return o;var c=N.default.search(p,B.bind(null,f,d));return c||o}function B(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,o=f.endProgramDateTime||0;return o-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(ne,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 o=this.activeFragment,c=this.activeParts;if(!o)return null;if(c)for(var s=c.length;s--;){var a=c[s],l=a?a.end:o.appendedPTS;if(a.start<=f&&l!==void 0&&f<=l)return s>9&&(this.activeParts=c.slice(s-9)),a}else if(o.start<=f&&o.appendedPTS!==void 0&&f<=o.appendedPTS)return o}return this.getBufferedFrag(f,d)},g.getBufferedFrag=function(f,d){for(var o=this.fragments,c=Object.keys(o),s=c.length;s--;){var a=o[c[s]];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,o){var c=this;Object.keys(this.fragments).forEach(function(s){var a=c.fragments[s];if(!a)return;if(!a.buffered){a.body.type===o&&c.removeFragment(a.body);return}var l=a.range[f];if(!l)return;l.time.some(function(h){var O=!c.isTimeBuffered(h.startPTS,h.endPTS,d);return O&&c.removeFragment(a.body),O})})},g.detectPartialFragments=function(f){var d=this,o=this.timeRanges,c=f.frag,s=f.part;if(!o||c.sn==="initSegment")return;var a=k(c),l=this.fragments[a];if(!l)return;Object.keys(o).forEach(function(h){var O=c.elementaryStreams[h];if(!O)return;var w=o[h],x=s!==null||O.partial===!0;l.range[h]=d.getBufferedTimes(c,s,x,w)}),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),o=this.fragments[d];o&&(o.backtrack=o.loaded=null,o.buffered=!0)},g.getBufferedTimes=function(f,d,o,c){for(var s={time:[],partial:o},a=d?d.start:f.start,l=d?d.end:f.end,h=f.minEndPTS||l,O=f.maxStartPTS||a,w=0;w<c.length;w++){var x=c.start(w)-this.bufferPadding,A=c.end(w)+this.bufferPadding;if(O>=x&&h<=A){s.time.push({startPTS:Math.max(a,c.start(w)),endPTS:Math.min(l,c.end(w))});break}else if(a<A&&l>x)s.partial=!0,s.time.push({startPTS:Math.max(a,c.start(w)),endPTS:Math.min(l,c.end(w))});else if(l<=x)break}return s},g.getPartialFragment=function(f){var d=null,o,c,s,a=0,l=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(O){var w=h[O];if(!w)return;B(w)&&(c=w.body.start-l,s=w.body.end+l,f>=c&&f<=s&&(o=Math.min(f-c,s-f),a<=o&&(d=w.body,a=o)))}),d},g.getState=function(f){var d=k(f),o=this.fragments[d];return o?o.buffered?B(o)?M.PARTIAL:M.OK:o.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},g.backtrack=function(f,d){var o=k(f),c=this.fragments[o];if(!c||c.backtrack)return null;var s=c.backtrack=d||c.loaded;return c.loaded=null,s},g.getBacktrackData=function(f){var d=k(f),o=this.fragments[d];if(o){var c,s=o.backtrack;if(s!=null&&(c=s.payload)!==null&&c!==void 0&&c.byteLength)return s;this.removeFragment(f)}return null},g.isTimeBuffered=function(f,d,o){for(var c,s,a=0;a<o.length;a++){if(c=o.start(a)-this.bufferPadding,s=o.end(a)+this.bufferPadding,f>=c&&d<=s)return!0;if(d<=c)return!1}return!1},g.onFragLoaded=function(f,d){var o=d.frag,c=d.part;if(o.sn==="initSegment"||o.bitrateTest||c)return;var s=k(o);this.fragments[s]={body:o,loaded:d,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(f,d){var o=this,c=d.frag,s=d.part,a=d.timeRanges;if(c.type===N.PlaylistLevelType.MAIN)if(this.activeFragment=c,s){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(s)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(h){var O=a[h];if(o.detectEvictedFragments(h,O),!s)for(var w=0;w<O.length;w++)c.appendedPTS=Math.max(O.end(w),c.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,o){var c=this;Object.keys(this.fragments).forEach(function(s){var a=c.fragments[s];if(!a)return;if(a.buffered){var l=a.body;l.type===o&&l.start<d&&l.end>f&&c.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 B(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(ne,V,D){"use strict";D.r(V),D.d(V,"STALL_MINIMUM_DURATION_MS",function(){return B}),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"),B=250,k=2,R=.1,g=.05,p=function(){function f(o,c,s,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=o,this.media=c,this.fragmentTracker=s,this.hls=a}var d=f.prototype;return d.destroy=function(){this.hls=this.fragmentTracker=this.media=null},d.poll=function(c){var s=this.config,a=this.media,l=this.stalled,h=a.currentTime,O=a.seeking,w=this.seeking&&!O,x=!this.seeking&&O;if(this.seeking=O,h!==c){if(this.moved=!0,l!==null){if(this.stallReported){var A=self.performance.now()-l;W.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((x||w)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!z.BufferHelper.getBuffered(a).length)return;var S=z.BufferHelper.bufferInfo(a,h,0),T=S.len>0,E=S.nextStart||0;if(!T&&!E)return;if(O){var _=S.len>k,u=!E||E-h>k&&!this.fragmentTracker.getPartialFragment(h);if(_||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var y,m=Math.max(E,S.start||0)-h,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=b==null||((y=b.details)===null||y===void 0)?void 0:y.live,I=P?b.details.targetduration*2:k;if(m>0&&m<=I){this._trySkipBufferHole(null);return}}var U=self.performance.now();if(l===null){this.stalled=U;return}var F=U-l;!O&&F>=B&&this._reportStall(S.len);var L=z.BufferHelper.bufferInfo(a,h,s.maxBufferHole);this._tryFixBufferStall(L,F)},d._tryFixBufferStall=function(c,s){var a=this.config,l=this.fragmentTracker,h=this.media,O=h.currentTime,w=l.getPartialFragment(O);if(w){var x=this._trySkipBufferHole(w);if(x)return}c.len>a.maxBufferHole&&s>a.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},d._reportStall=function(c){var s=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="+c+")"),s.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:c}))},d._trySkipBufferHole=function(c){for(var s=this.config,a=this.hls,l=this.media,h=l.currentTime,O=0,w=z.BufferHelper.getBuffered(l),x=0;x<w.length;x++){var A=w.start(x);if(h+s.maxBufferHole>=O&&h<A){var S=Math.max(A+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,c&&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:c}),S}O=w.end(x)}return 0},d._tryNudgeBuffer=function(){var c=this.config,s=this.hls,a=this.media,l=a.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<c.nudgeMaxRetry){var O=l+h*c.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+l+" to "+O),a.currentTime=O,s.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 "+c.nudgeMaxRetry+" nudges"),s.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(ne,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,B=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,o=f.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var c=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<o.length;s++){var a=M.getID3Frames(o[s].data);if(a){var l=o[s].pts,h=s<o.length-1?o[s+1].pts:d.end,O=h-l;O<=0&&(h=l+W);for(var w=0;w<a.length;w++){var x=a[w];if(!M.isTimeStampFrame(x)){var A=new c(l,h,"");A.value=x,this.id3Track.addCue(A)}}}}},R.onBufferFlushing=function(p,f){var d=f.startOffset,o=f.endOffset,c=f.type;if(!c||c==="audio"){var s=this.id3Track;s&&Object(N.removeCuesInRange)(s,d,o)}},k}();V.default=B},"./src/controller/latency-controller.ts":function(ne,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 B(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 o=d.details;this.levelDetails=o,o.advanced&&this.timeupdate(),!o.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 o=this.computeLatency();if(o===null)return;this._latency=o;var c=this.config,s=c.lowLatencyMode,a=c.maxLiveSyncPlaybackRate;if(!s||a===1)return;var l=this.targetLatency;if(l===null)return;var h=o-l,O=Math.min(this.maxLatency,l+d.targetduration),w=h<O;if(d.live&&w&&h>.05&&this.forwardBufferLength>1){var x=Math.min(2,Math.max(1,a)),A=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;f.playbackRate=Math.min(x,Math.max(1,A))}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},B(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,o=f.partHoldBack,c=f.targetduration,s=this.config,a=s.liveSyncDuration,l=s.liveSyncDurationCount,h=s.lowLatencyMode,O=this.hls.userConfig,w=h&&o||d;(O.liveSyncDuration||O.liveSyncDurationCount||w===0)&&(w=a!==void 0?a:l*c);var x=c,A=1;return w+Math.min(this.stallCount*A,x)}},{key:"liveSyncPosition",get:function(){var f=this.estimateLiveEdge(),d=this.targetLatency,o=this.levelDetails;if(f===null||d===null||o===null)return null;var c=o.edge,s=f-d-this.edgeStalled,a=c-o.totalduration,l=c-(this.config.lowLatencyMode&&o.partTarget||o.targetduration);return Math.min(Math.max(a,s),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 o=f.buffered.length;return o?f.buffered.end(o-1):d.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"default",function(){return s});var z=D("./src/types/level.ts"),N=D("./src/events.ts"),M=D("./src/errors.ts"),W=D("./src/utils/codecs.ts"),B=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 O in h)Object.prototype.hasOwnProperty.call(h,O)&&(a[O]=h[O])}return a},g.apply(this,arguments)}function p(a,l){for(var h=0;h<l.length;h++){var O=l[h];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(a,O.key,O)}}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,o(a,l)}function o(a,l){return o=Object.setPrototypeOf||function(O,w){return O.__proto__=w,O},o(a,l)}var c=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),s=function(a){d(l,a);function l(O){var w;return w=a.call(this,O,"[level-controller]")||this,w._levels=[],w._firstLevel=-1,w._startLevel=void 0,w.currentLevelIndex=-1,w.manualLevelIndex=-1,w.onParsedComplete=void 0,w._registerListeners(),w}var h=l.prototype;return h._registerListeners=function(){var w=this.hls;w.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),w.on(N.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var w=this.hls;w.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),w.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 w=this._levels;w.forEach(function(x){x.loadError=0}),a.prototype.startLoad.call(this)},h.onManifestLoaded=function(w,x){var A=[],S=[],T=[],E,_={},u,y=!1,m=!1,b=!1;if(x.levels.forEach(function(F){var L=F.attrs;y=y||!!(F.width&&F.height),m=m||!!F.videoCodec,b=b||!!F.audioCodec,c&&F.audioCodec&&F.audioCodec.indexOf("mp4a.40.34")!==-1&&(F.audioCodec=void 0);var v=F.bitrate+"-"+F.attrs.RESOLUTION+"-"+F.attrs.CODECS;u=_[v],u?u.url.push(F.url):(u=new z.Level(F),_[v]=u,A.push(u)),L&&(L.AUDIO&&Object(B.addGroupId)(u,"audio",L.AUDIO),L.SUBTITLES&&Object(B.addGroupId)(u,"text",L.SUBTITLES))}),(y||m)&&b&&(A=A.filter(function(F){var L=F.videoCodec,v=F.width,j=F.height;return!!L||!!(v&&j)})),A=A.filter(function(F){var L=F.audioCodec,v=F.videoCodec;return(!L||Object(W.isCodecSupportedInMp4)(L,"audio"))&&(!v||Object(W.isCodecSupportedInMp4)(v,"video"))}),x.audioTracks&&(S=x.audioTracks.filter(function(F){return!F.audioCodec||Object(W.isCodecSupportedInMp4)(F.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(S)),x.subtitles&&(T=x.subtitles,Object(B.assignTrackIdsByGroup)(T)),A.length>0){E=A[0].bitrate,A.sort(function(F,L){return F.bitrate-L.bitrate}),this._levels=A;for(var P=0;P<A.length;P++)if(A[P].bitrate===E){this._firstLevel=P,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+E);break}var I=b&&!m,U={levels:A,audioTracks:S,subtitleTracks:T,firstLevel:this._firstLevel,stats:x.stats,audio:b,video:m,altAudio:!I&&S.some(function(F){return!!F.url})};this.hls.trigger(N.Events.MANIFEST_PARSED,U),(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:x.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(w,x){if(a.prototype.onError.call(this,w,x),x.fatal)return;var A=x.context,S=this._levels[this.currentLevelIndex];if(A&&(A.type===R.PlaylistContextType.AUDIO_TRACK&&S.audioGroupIds&&A.groupId===S.audioGroupIds[S.urlId]||A.type===R.PlaylistContextType.SUBTITLE_TRACK&&S.textGroupIds&&A.groupId===S.textGroupIds[S.urlId])){this.redundantFailover(this.currentLevelIndex);return}var T=!1,E=!0,_;switch(x.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(x.frag){var u=this._levels[x.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(_=x.frag.level)):_=x.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(E=!1),_=A.level),T=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:_=x.level,T=!0;break}_!==void 0&&this.recoverLevel(x,_,T,E)},h.recoverLevel=function(w,x,A,S){var T=w.details,E=this._levels[x];if(E.loadError++,A){var _=this.retryLoadingOrFail(w);if(_)w.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(S){var u=E.url.length;if(u>1&&E.loadError<u)w.levelRetry=!0,this.redundantFailover(x);else if(this.manualLevelIndex===-1){var y=x===0?this._levels.length-1:x-1;this.currentLevelIndex!==y&&this._levels[y].loadError===0&&(this.warn(T+": switch to "+y),w.levelRetry=!0,this.hls.nextAutoLevel=y)}}},h.redundantFailover=function(w){var x=this._levels[w],A=x.url.length;if(A>1){var S=(x.urlId+1)%A;this.warn("Switching to redundant URL-id "+S),this._levels.forEach(function(T){T.urlId=S}),this.level=w}},h.onFragLoaded=function(w,x){var A=x.frag;if(A!==void 0&&A.type===R.PlaylistLevelType.MAIN){var S=this._levels[A.level];S!==void 0&&(S.fragmentError=0,S.loadError=0)}},h.onLevelLoaded=function(w,x){var A,S=x.level,T=x.details,E=this._levels[S];if(!E){var _;this.warn("Invalid level index "+S),(_=x.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(T.deltaUpdateFailed=!0);return}S===this.currentLevelIndex?(E.fragmentError===0&&(E.loadError=0,this.retryCount=0),this.playlistLoaded(S,x,E.details)):(A=x.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(T.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(w,x){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var S=-1,T=this.hls.audioTracks[x.id].groupId,E=0;E<A.audioGroupIds.length;E++)if(A.audioGroupIds[E]===T){S=E;break}S!==A.urlId&&(A.urlId=S,this.startLoad())}},h.loadPlaylist=function(w){var x=this.currentLevelIndex,A=this._levels[x];if(this.canLoad&&A&&A.url.length>0){var S=A.urlId,T=A.url[S];if(w)try{T=w.addDirectives(T)}catch(E){this.warn("Could not construct new URL with HLS Delivery Directives: "+E)}this.log("Attempt loading level index "+x+(w?" at sn "+w.msn+" part "+w.part:"")+" with URL-id "+S+" "+T),this.clearTimer(),this.hls.trigger(N.Events.LEVEL_LOADING,{url:T,level:x,id:S,deliveryDirectives:w||null})}},h.removeLevel=function(w,x){var A=function(E,_){return _!==x},S=this._levels.filter(function(T,E){return E!==w?!0:T.url.length>1&&x!==void 0?(T.url=T.url.filter(A),T.audioGroupIds&&(T.audioGroupIds=T.audioGroupIds.filter(A)),T.textGroupIds&&(T.textGroupIds=T.textGroupIds.filter(A)),T.urlId=0,!0):!1}).map(function(T,E){var _=T.details;return _!=null&&_.fragments&&_.fragments.forEach(function(u){u.level=E}),T});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(w){var x,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===w&&(x=A[w])!==null&&x!==void 0&&x.details)return;if(w<0||w>=A.length){var S=w<0;if(this.hls.trigger(N.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:w,fatal:S,reason:"invalid level idx"}),S)return;w=Math.min(w,A.length-1)}this.clearTimer();var T=this.currentLevelIndex,E=A[T],_=A[w];this.log("switching to level "+w+" from "+T),this.currentLevelIndex=w;var u=g({},_,{level:w,maxBitrate:_.maxBitrate,uri:_.uri,urlId:_.urlId});delete u._urlId,this.hls.trigger(N.Events.LEVEL_SWITCHING,u);var y=_.details;if(!y||y.live){var m=this.switchParams(_.uri,E==null?void 0:E.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(w){this.manualLevelIndex=w,this._startLevel===void 0&&(this._startLevel=w),w!==-1&&(this.level=w)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(w){this._firstLevel=w}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var w=this.hls.config.startLevel;return w!==void 0?w:this._firstLevel}else return this._startLevel},set:function(w){this._startLevel=w}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(w){this.level=w,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=w)}}]),l}(k.default)},"./src/controller/level-helper.ts":function(ne,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 B}),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 o}),D.d(V,"computeReloadInterval",function(){return c}),D.d(V,"getFragmentWithSN",function(){return s}),D.d(V,"getPartWith",function(){return a});var z=D("./src/polyfills/number.ts"),N=D("./src/utils/logger.ts");function M(l,h,O){switch(h){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(O);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(O);break}}function W(l){var h={};l.forEach(function(O){var w=O.groupId||"";O.id=h[w]=h[w]||0,h[w]++})}function B(l,h,O){var w=l[h],x=l[O];k(w,x)}function k(l,h){var O=h.startPTS;if(Object(z.isFiniteNumber)(O)){var w=0,x;h.sn>l.sn?(w=O-l.start,x=l):(w=l.start-O,x=h),x.duration!==w&&(x.duration=w)}else if(h.sn>l.sn){var A=l.cc===h.cc;A&&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,O,w,x,A){var S=w-O;S<=0&&(N.logger.warn("Fragment should have a positive duration",h),w=O+h.duration,A=x+h.duration);var T=O,E=w,_=h.startPTS,u=h.endPTS;if(Object(z.isFiniteNumber)(_)){var y=Math.abs(_-O);Object(z.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(y,h.deltaPTS):h.deltaPTS=y,T=Math.max(O,_),O=Math.min(O,_),x=Math.min(x,h.startDTS),E=Math.min(w,u),w=Math.max(w,u),A=Math.max(A,h.endDTS)}h.duration=w-O;var m=O-h.start;h.appendedPTS=w,h.start=h.startPTS=O,h.maxStartPTS=T,h.startDTS=x,h.endPTS=w,h.minEndPTS=E,h.endDTS=A;var b=h.sn;if(!l||b<l.startSN||b>l.endSN)return 0;var P,I=b-l.startSN,U=l.fragments;for(U[I]=h,P=I;P>0;P--)k(U[P],U[P-1]);for(P=I;P<U.length-1;P++)k(U[P],U[P+1]);return l.fragmentHint&&k(U[U.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,m}function g(l,h){for(var O=null,w=l.fragments,x=w.length-1;x>=0;x--){var A=w[x].initSegment;if(A){O=A;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var S=0,T;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&&(T=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,O=P.initSegment)}),O){var E=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;E.forEach(function(P){var I;(!P.initSegment||P.initSegment.relurl===((I=O)===null||I===void 0?void 0:I.relurl))&&(P.initSegment=O)})}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 _=h.skippedSegments;_--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var u=h.fragments;if(S){N.logger.warn("discontinuity sliding from playlist, take drift into account");for(var y=0;y<u.length;y++)u[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}),T?R(h,T,T.startPTS,T.endPTS,T.startDTS,T.endDTS):d(l,h),u.length&&(h.totalduration=h.edge-u[0].start),h.driftStartTime=l.driftStartTime,h.driftStart=l.driftStart;var m=h.advancedDateTime;if(h.advanced&&m){var b=h.edge;h.driftStart||(h.driftStartTime=m,h.driftStart=b),h.driftEndTime=m,h.driftEnd=b}else h.driftEndTime=l.driftEndTime,h.driftEnd=l.driftEnd,h.advancedDateTime=l.advancedDateTime}function p(l,h,O){if(l&&h)for(var w=0,x=0,A=l.length;x<=A;x++){var S=l[x],T=h[x+w];S&&T&&S.index===T.index&&S.fragment.sn===T.fragment.sn?O(S,T):w--}}function f(l,h,O){for(var w=h.skippedSegments,x=Math.max(l.startSN,h.startSN)-h.startSN,A=(l.fragmentHint?1:0)+(w?h.endSN:Math.min(l.endSN,h.endSN))-h.startSN,S=h.startSN-l.startSN,T=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,E=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,_=x;_<=A;_++){var u=E[S+_],y=T[_];w&&!y&&_<w&&(y=h.fragments[_]=u),u&&y&&O(u,y)}}function d(l,h){var O=h.startSN+h.skippedSegments-l.startSN,w=l.fragments;if(O<0||O>=w.length)return;o(h,w[O].start)}function o(l,h){if(h){for(var O=l.fragments,w=l.skippedSegments;w<O.length;w++)O[w].start+=h;l.fragmentHint&&(l.fragmentHint.start+=h)}}function c(l,h){var O=1e3*l.levelTargetDuration,w=O/2,x=l.age,A=x>0&&x<O*3,S=h.loading.end-h.loading.start,T,E=l.availabilityDelay;if(l.updated===!1)if(A){var _=333*l.misses;T=Math.max(Math.min(w,S*2),_),l.availabilityDelay=(l.availabilityDelay||0)+T}else T=w;else A?(E=Math.min(E||O/2,x),l.availabilityDelay=E,T=E+O-x):T=O-S;return Math.round(T)}function s(l,h,O){if(!l||!l.details)return null;var w=l.details,x=w.fragments[h-w.startSN];return x||(x=w.fragmentHint,x&&x.sn===h?x:h<w.startSN&&O&&O.sn===h?O:null)}function a(l,h,O){if(!l||!l.details)return null;var w=l.details.partList;if(w)for(var x=w.length;x--;){var A=w[x];if(A.index===O&&A.fragment.sn===h)return A}return null}},"./src/controller/stream-controller.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"default",function(){return w});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"),B=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"),o=D("./src/errors.ts"),c=D("./src/utils/logger.ts");function s(x,A){for(var S=0;S<A.length;S++){var T=A[S];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(x,T.key,T)}}function a(x,A,S){return A&&s(x.prototype,A),S&&s(x,S),x}function l(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,h(x,A)}function h(x,A){return h=Object.setPrototypeOf||function(T,E){return T.__proto__=E,T},h(x,A)}var O=100,w=function(x){l(A,x);function A(T,E){var _;return _=x.call(this,T,E,"[stream-controller]")||this,_.audioCodecSwap=!1,_.gapController=null,_.level=-1,_._forceStartLoad=!1,_.altAudio=!1,_.audioOnly=!1,_.fragPlaying=null,_.onvplaying=null,_.onvseeked=null,_.fragLastKbps=0,_.stalled=!1,_.couldBacktrack=!1,_.audioCodecSwitch=!1,_.videoBuffer=null,_._registerListeners(),_}var S=A.prototype;return S._registerListeners=function(){var E=this.hls;E.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),E.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.on(W.Events.ERROR,this.onError,this),E.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),E.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S._unregisterListeners=function(){var E=this.hls;E.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.off(W.Events.ERROR,this.onError,this),E.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),E.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},S.startLoad=function(E){if(this.levels){var _=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(O),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var y=u.startLevel;y===-1&&(u.config.testBandwidth?(y=0,this.bitrateTest=!0):y=u.nextAutoLevel),this.level=u.nextLoadLevel=y,this.loadedmetadata=!1}_>0&&E===-1&&(this.log("Override startPosition with lastCurrentTime @"+_.toFixed(3)),E=_),this.state=N.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=E,this.tick()}else this._forceStartLoad=!0,this.state=N.State.STOPPED},S.stopLoad=function(){this._forceStartLoad=!1,x.prototype.stopLoad.call(this)},S.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_LEVEL:{var E,_=this.levels,u=this.level,y=_==null||((E=_[u])===null||E===void 0)?void 0:E.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,b=self.performance.now(),P=this.retryDate;(!P||b>=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(){x.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},S.doTickIdle=function(){var E,_,u=this.hls,y=this.levelLastLoaded,m=this.levels,b=this.media,P=u.config,I=u.nextLoadLevel;if(y===null||!b&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[I])return;var U=m[I];this.level=u.nextLoadLevel=I;var F=U.details;if(!F||this.state===N.State.WAITING_LEVEL||F.live&&this.levelLastLoaded!==I){this.state=N.State.WAITING_LEVEL;return}var L=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,R.PlaylistLevelType.MAIN);if(L===null)return;var v=L.len,j=this.getMaxBufferLength(U.maxBitrate);if(v>=j)return;if(this._streamEnded(L,F)){var K={};this.altAudio&&(K.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,K),this.state=N.State.ENDED;return}var J=L.end,ee=this.getNextFragment(J,F);if(this.couldBacktrack&&!this.fragPrevious&&ee&&ee.sn!=="initSegment"){var ve=ee.sn-F.startSN;ve>1&&(ee=F.fragments[ve-1],this.fragmentTracker.removeFragment(ee))}if(ee&&this.fragmentTracker.getState(ee)===k.FragmentState.OK&&this.nextLoadPosition>J){var de=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,de,R.PlaylistLevelType.MAIN),ee=this.getNextFragment(this.nextLoadPosition,F)}if(!ee)return;ee.initSegment&&!ee.initSegment.data&&!this.bitrateTest&&(ee=ee.initSegment),((E=ee.decryptdata)===null||E===void 0?void 0:E.keyFormat)==="identity"&&!((_=ee.decryptdata)!==null&&_!==void 0&&_.key)?this.loadKey(ee,F):this.loadFragment(ee,F,J)},S.loadFragment=function(E,_,u){var y,m=this.fragmentTracker.getState(E);if(this.fragCurrent=E,m===k.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(E);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else m=k.FragmentState.NOT_LOADED}m===k.FragmentState.NOT_LOADED||m===k.FragmentState.PARTIAL?E.sn==="initSegment"?this._loadInitSegment(E):this.bitrateTest?(E.bitrateTest=!0,this.log("Fragment "+E.sn+" of level "+E.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(E)):(this.startFragRequested=!0,x.prototype.loadFragment.call(this,E,_,u)):m===k.FragmentState.APPENDING?this.reduceMaxBufferLength(E.duration)&&this.fragmentTracker.removeFragment(E):((y=this.media)===null||y===void 0?void 0:y.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},S.getAppendedFrag=function(E){var _=this.fragmentTracker.getAppendedFrag(E,R.PlaylistLevelType.MAIN);return _&&"fragment"in _?_.fragment:_},S.getBufferedFrag=function(E){return this.fragmentTracker.getBufferedFrag(E,R.PlaylistLevelType.MAIN)},S.followingBufferedFrag=function(E){return E?this.getBufferedFrag(E.end+.5):null},S.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},S.nextLevelSwitch=function(){var E=this.levels,_=this.media;if(_!=null&&_.readyState){var u,y=this.getAppendedFrag(_.currentTime);if(y&&y.start>1&&this.flushMainBuffer(0,y.start-1),!_.paused&&E){var m=this.hls.nextLoadLevel,b=E[m],P=this.fragLastKbps;P&&this.fragCurrent?u=this.fragCurrent.duration*b.maxBitrate/(1e3*P)+1:u=0}else u=0;var I=this.getBufferedFrag(_.currentTime+u);if(I){var U=this.followingBufferedFrag(I);if(U){this.abortCurrentFrag();var F=U.maxStartPTS?U.maxStartPTS:U.start,L=U.duration,v=Math.max(I.end,F+Math.min(Math.max(L-this.config.maxFragLookUpTolerance,L*.5),L*.75));this.flushMainBuffer(v,Number.POSITIVE_INFINITY)}}}},S.abortCurrentFrag=function(){var E=this.fragCurrent;this.fragCurrent=null,E!=null&&E.loader&&E.loader.abort(),this.state===N.State.KEY_LOADING&&(this.state=N.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},S.flushMainBuffer=function(E,_){x.prototype.flushMainBuffer.call(this,E,_,this.altAudio?"video":null)},S.onMediaAttached=function(E,_){x.prototype.onMediaAttached.call(this,E,_);var u=_.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),u.addEventListener("playing",this.onvplaying),u.addEventListener("seeked",this.onvseeked),this.gapController=new d.default(this.config,u,this.fragmentTracker,this.hls)},S.onMediaDetaching=function(){var E=this.media;E&&(E.removeEventListener("playing",this.onvplaying),E.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),x.prototype.onMediaDetaching.call(this)},S.onMediaPlaying=function(){this.tick()},S.onMediaSeeked=function(){var E=this.media,_=E?E.currentTime:null;Object(z.isFiniteNumber)(_)&&this.log("Media seeked to "+_.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(E,_){var u=!1,y=!1,m;_.levels.forEach(function(b){m=b.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(u=!0),m.indexOf("mp4a.40.5")!==-1&&(y=!0))}),this.audioCodecSwitch=u&&y&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=_.levels,this.startFragRequested=!1},S.onLevelLoading=function(E,_){var u=this.levels;if(!u||this.state!==N.State.IDLE)return;var y=u[_.level];(!y.details||y.details.live&&this.levelLastLoaded!==_.level||this.waitForCdnTuneIn(y.details))&&(this.state=N.State.WAITING_LEVEL)},S.onLevelLoaded=function(E,_){var u,y=this.levels,m=_.level,b=_.details,P=b.totalduration;if(!y){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+P);var I=this.fragCurrent;I&&(this.state===N.State.FRAG_LOADING||this.state===N.State.FRAG_LOADING_WAITING_RETRY)&&(I.level!==_.level&&I.loader&&(this.state=N.State.IDLE,I.loader.abort()));var U=y[m],F=0;if(b.live||(u=U.details)!==null&&u!==void 0&&u.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;F=this.alignPlaylists(b,U.details)}if(U.details=b,this.levelLastLoaded=m,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:b,level:m}),this.state===N.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=N.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,F),this.tick()},S._handleFragmentLoadProgress=function(E){var _,u=E.frag,y=E.part,m=E.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var P=b[u.level],I=P.details;if(!I){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var U=P.videoCodec,F=I.PTSKnown||!I.live,L=(_=u.initSegment)===null||_===void 0?void 0:_.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)),K=y?y.index:-1,J=K!==-1,ee=new f.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,m.byteLength,K,J),ve=this.initPTS[u.cc];j.push(m,L,v,U,u,y,I.totalduration,F,ee,ve)},S.onAudioTrackSwitching=function(E,_){var u=this.altAudio,y=!!_.url,m=_.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 b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;u&&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(E,_){var u=_.id,y=!!this.hls.audioTracks[u].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(E,_){var u=_.tracks,y,m,b=!1;for(var P in u){var I=u[P];if(I.id==="main"){if(m=P,y=I,P==="video"){var U=u[P];U&&(this.videoBuffer=U.buffer)}}else b=!0}b&&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(E,_){var u=_.frag,y=_.part;if(u&&u.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(y?" p: "+y.index:"")+" of level "+u.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:u.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,y)},S.onError=function(E,_){switch(_.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.MAIN,_);break;case o.ErrorDetails.LEVEL_LOAD_ERROR:case o.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==N.State.ERROR&&(_.fatal?(this.warn(""+_.details),this.state=N.State.ERROR):!_.levelRetry&&this.state===N.State.WAITING_LEVEL&&(this.state=N.State.IDLE));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(_.parent==="main"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var u=!0,y=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);y&&y.len>.5&&(u=!this.reduceMaxBufferLength(y.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},S.checkBuffer=function(){var E=this.media,_=this.gapController;if(!E||!_||!E.readyState)return;var u=B.BufferHelper.getBuffered(E);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):_.poll(this.lastCurrentTime),this.lastCurrentTime=E.currentTime},S.onFragLoadEmergencyAborted=function(){this.state=N.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},S.onBufferFlushed=function(E,_){var u=_.type;if(u!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var y=(u===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(y,u,R.PlaylistLevelType.MAIN)}},S.onLevelsUpdated=function(E,_){this.levels=_.levels},S.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},S.seekToStartPos=function(){var E=this.media,_=E.currentTime,u=this.startPosition;if(u>=0&&_<u){if(E.seeking){c.logger.log("could not seek to "+u+", already seeking at "+_);return}var y=B.BufferHelper.getBuffered(E),m=y.length?y.start(0):0,b=m-u;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(c.logger.log("adjusting start position by "+b+" to match buffer start"),u+=b,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+_),E.currentTime=u}},S._getAudioCodec=function(E){var _=this.config.defaultAudioCodec||E.audioCodec;return this.audioCodecSwap&&_&&(this.log("Swapping audio codec"),_.indexOf("mp4a.40.5")!==-1?_="mp4a.40.2":_="mp4a.40.5"),_},S._loadBitrateTestFrag=function(E){var _=this;this._doFragLoad(E).then(function(u){var y=_.hls;if(!u||y.nextLoadLevel||_.fragContextChanged(E))return;_.fragLoadError=0,_.state=N.State.IDLE,_.startFragRequested=!1,_.bitrateTest=!1;var m=E.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),y.trigger(W.Events.FRAG_LOADED,u)})},S._handleTransmuxComplete=function(E){var _,u="main",y=this.hls,m=E.remuxResult,b=E.chunkMeta,P=this.getCurrentContext(b);if(!P){this.warn("The loading context changed while buffering fragment "+b.sn+" of level "+b.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(b.level);return}var I=P.frag,U=P.part,F=P.level,L=m.video,v=m.text,j=m.id3,K=m.initSegment,J=this.altAudio?void 0:m.audio;if(this.fragContextChanged(I))return;if(this.state=N.State.PARSING,K){K.tracks&&(this._bufferInitSegment(F,K.tracks,I,b),y.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:I,id:u,tracks:K.tracks}));var ee=K.initPTS,ve=K.timescale;Object(z.isFiniteNumber)(ee)&&(this.initPTS[I.cc]=ee,y.trigger(W.Events.INIT_PTS_FOUND,{frag:I,id:u,initPTS:ee,timescale:ve}))}if(L&&m.independent!==!1){if(F.details){var de=L.startPTS,me=L.endPTS,ce=L.startDTS,pe=L.endDTS;if(U)U.elementaryStreams[L.type]={startPTS:de,endPTS:me,startDTS:ce,endDTS:pe};else if(L.firstKeyFrame&&L.independent&&(this.couldBacktrack=!0),L.dropped&&L.independent){var ae=this.getLoadPosition()+this.config.maxBufferHole;if(ae<de){this.backtrack(I);return}I.setElementaryStreamInfo(L.type,I.start,me,I.start,pe,!0)}I.setElementaryStreamInfo(L.type,de,me,ce,pe),this.bufferFragmentData(L,I,U,b)}}else if(m.independent===!1){this.backtrack(I);return}if(J){var he=J.startPTS,$=J.endPTS,ie=J.startDTS,q=J.endDTS;U&&(U.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:$,startDTS:ie,endDTS:q}),I.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,he,$,ie,q),this.bufferFragmentData(J,I,U,b)}if(j!=null&&(_=j.samples)!==null&&_!==void 0&&_.length){var Ee={frag:I,id:u,samples:j.samples};y.trigger(W.Events.FRAG_PARSING_METADATA,Ee)}if(v){var Ae={frag:I,id:u,samples:v.samples};y.trigger(W.Events.FRAG_PARSING_USERDATA,Ae)}},S._bufferInitSegment=function(E,_,u,y){var m=this;if(this.state!==N.State.PARSING)return;this.audioOnly=!!_.audio&&!_.video,this.altAudio&&!this.audioOnly&&delete _.audio;var b=_.audio,P=_.video,I=_.audiovideo;if(b){var U=E.audioCodec,F=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(U&&(U.indexOf("mp4a.40.5")!==-1?U="mp4a.40.2":U="mp4a.40.5"),b.metadata.channelCount!==1&&F.indexOf("firefox")===-1&&(U="mp4a.40.5")),F.indexOf("android")!==-1&&b.container!=="audio/mpeg"&&(U="mp4a.40.2",this.log("Android: force audio codec to "+U)),E.audioCodec&&E.audioCodec!==U&&this.log('Swapping manifest audio codec "'+E.audioCodec+'" for "'+U+'"'),b.levelCodec=U,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+(U||"")+"/"+(E.audioCodec||"")+"/"+b.codec+"]")}P&&(P.levelCodec=E.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(E.videoCodec||"")+"/"+P.codec+"]")),I&&this.log("Init audiovideo buffer, container:"+I.container+", codecs[level/parsed]=["+(E.attrs.CODECS||"")+"/"+I.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,_),Object.keys(_).forEach(function(L){var v=_[L],j=v.initSegment;j!=null&&j.byteLength&&m.hls.trigger(W.Events.BUFFER_APPENDING,{type:L,data:j,frag:u,part:null,chunkMeta:y,parent:u.type})}),this.tick()},S.backtrack=function(E){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(E);var _=this.fragmentTracker.backtrack(E);this.fragPrevious=null,this.nextLoadPosition=E.start,_?this.resetFragmentLoading(E):this.state=N.State.BACKTRACKING},S.checkFragmentChanged=function(){var E=this.media,_=null;if(E&&E.readyState>1&&E.seeking===!1){var u=E.currentTime;if(B.BufferHelper.isBuffered(E,u)?_=this.getAppendedFrag(u):B.BufferHelper.isBuffered(E,u+.1)&&(_=this.getAppendedFrag(u+.1)),_){var y=this.fragPlaying,m=_.level;(!y||_.sn!==y.sn||y.level!==m||_.urlId!==y.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:_}),(!y||y.level!==m)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=_)}}},a(A,[{key:"nextLevel",get:function(){var E=this.nextBufferedFrag;return E?E.level:-1}},{key:"currentLevel",get:function(){var E=this.media;if(E){var _=this.getAppendedFrag(E.currentTime);if(_)return _.level}return-1}},{key:"nextBufferedFrag",get:function(){var E=this.media;if(E){var _=this.getAppendedFrag(E.currentTime);return this.followingBufferedFrag(_)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(N.default)},"./src/controller/subtitle-stream-controller.ts":function(ne,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"),B=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,O){for(var w=0;w<O.length;w++){var x=O[w];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(h,x.key,x)}}function o(h,O,w){return O&&d(h.prototype,O),w&&d(h,w),h}function c(h,O){h.prototype=Object.create(O.prototype),h.prototype.constructor=h,s(h,O)}function s(h,O){return s=Object.setPrototypeOf||function(x,A){return x.__proto__=A,x},s(h,O)}var a=500,l=function(h){c(O,h);function O(x,A){var S;return S=h.call(this,x,A,"[subtitle-stream-controller]")||this,S.levels=[],S.currentTrackId=-1,S.tracksBuffered=[],S.mainDetails=null,S._registerListeners(),S}var w=O.prototype;return w.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},w._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.LEVEL_LOADED,this.onLevelLoaded,this),A.on(z.Events.ERROR,this.onError,this),A.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._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.LEVEL_LOADED,this.onLevelLoaded,this),A.off(z.Events.ERROR,this.onError,this),A.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(a),this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},w.onLevelLoaded=function(A,S){this.mainDetails=S.details},w.onSubtitleFragProcessed=function(A,S){var T=S.frag,E=S.success;if(this.fragPrevious=T,this.state=g.State.IDLE,!E)return;var _=this.tracksBuffered[this.currentTrackId];if(!_)return;for(var u,y=T.start,m=0;m<_.length;m++)if(y>=_[m].start&&y<=_[m].end){u=_[m];break}var b=T.start+T.duration;u?u.end=b:(u={start:y,end:b},_.push(u)),this.fragmentTracker.fragBuffered(T)},w.onBufferFlushing=function(A,S){var T=S.startOffset,E=S.endOffset;if(T===0&&E!==Number.POSITIVE_INFINITY){var _=this.currentTrackId,u=this.levels;if(!u.length||!u[_]||!u[_].details)return;var y=u[_].details,m=y.targetduration,b=E-m;if(b<=0)return;S.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(P){for(var I=0;I<P.length;){if(P[I].end<=b){P.shift();continue}else if(P[I].start<b)P[I].start=b;else break;I++}}),this.fragmentTracker.removeFragmentsInRange(T,b,p.PlaylistLevelType.SUBTITLE)}},w.onError=function(A,S){var T,E=S.frag;if(!E||E.type!==p.PlaylistLevelType.SUBTITLE)return;(T=this.fragCurrent)!==null&&T!==void 0&&T.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},w.onSubtitleTracksUpdated=function(A,S){var T=this,E=S.subtitleTracks;this.tracksBuffered=[],this.levels=E.map(function(_){return new f.Level(_)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(_){T.tracksBuffered[_.id]=[]}),this.mediaBuffer=null},w.onSubtitleTrackSwitch=function(A,S){if(this.currentTrackId=S.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var T=this.levels[this.currentTrackId];T!=null&&T.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,T&&this.setInterval(a)},w.onSubtitleTrackLoaded=function(A,S){var T,E=S.details,_=S.id,u=this.currentTrackId,y=this.levels;if(!y.length)return;var m=y[u];if(_>=y.length||_!==u||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,E.live||(T=m.details)!==null&&T!==void 0&&T.live){var b=this.mainDetails;if(E.deltaUpdateFailed||!b)return;var P=b.fragments[0];if(!m.details)E.hasProgramDateTime&&b.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(E,b):P&&Object(k.addSliding)(E,P.start);else{var I=this.alignPlaylists(E,m.details);I===0&&P&&Object(k.addSliding)(E,P.start)}}if(m.details=E,this.levelLastLoaded=_,this.tick(),E.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var U=Object(W.findFragmentByPTS)(null,E.fragments,this.media.currentTime,0);U||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},w._handleFragmentLoadComplete=function(A){var S=A.frag,T=A.payload,E=S.decryptdata,_=this.hls;if(this.fragContextChanged(S))return;if(T&&T.byteLength>0&&E&&E.key&&E.iv&&E.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(T),E.key.buffer,E.iv.buffer).then(function(y){var m=performance.now();_.trigger(z.Events.FRAG_DECRYPTED,{frag:S,payload:y,stats:{tstart:u,tdecrypt:m}})})}},w.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var A,S=this.currentTrackId,T=this.levels;if(!T.length||!T[S]||!T[S].details)return;var E=T[S].details,_=E.targetduration,u=this.config,y=this.media,m=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,y.currentTime-_,u.maxBufferHole),b=m.end,P=m.len,I=this.getMaxBufferLength()+_;if(P>I)return;console.assert(E,"Subtitle track details are defined on idle subtitle stream controller tick");var U=E.fragments,F=U.length,L=E.edge,v,j=this.fragPrevious;if(b<L){var K=u.maxFragLookUpTolerance;j&&E.hasProgramDateTime&&(v=Object(W.findFragmentByPDT)(U,j.endProgramDateTime,K)),v||(v=Object(W.findFragmentByPTS)(j,U,b,K),!v&&j&&j.start<U[0].start&&(v=U[0]))}else v=U[F-1];(A=v)!==null&&A!==void 0&&A.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,E,b)}},w.loadFragment=function(A,S,T){this.fragCurrent=A,h.prototype.loadFragment.call(this,A,S,T)},o(O,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),O}(g.default)},"./src/controller/subtitle-track-controller.ts":function(ne,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 B(d,o){for(var c=0;c<o.length;c++){var s=o[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(d,s.key,s)}}function k(d,o,c){return o&&B(d.prototype,o),c&&B(d,c),d}function R(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,g(d,o)}function g(d,o){return g=Object.setPrototypeOf||function(s,a){return s.__proto__=a,s},g(d,o)}var p=function(d){R(o,d);function o(s){var a;return a=d.call(this,s,"[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 c=o.prototype;return c.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,d.prototype.destroy.call(this)},c.registerListeners=function(){var 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)},c.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)},c.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)},c.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},c.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=f(this.media.textTracks);a.forEach(function(l){Object(N.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},c.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},c.onManifestParsed=function(a,l){this.tracks=l.subtitleTracks},c.onSubtitleTrackLoaded=function(a,l){var h=l.id,O=l.details,w=this.trackId,x=this.tracksInGroup[w];if(!x){this.warn("Invalid subtitle track id "+h);return}var A=x.details;x.details=l.details,this.log("subtitle track "+h+" loaded ["+O.startSN+"-"+O.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,l,A))},c.onLevelLoading=function(a,l){this.switchLevel(l.level)},c.onLevelSwitching=function(a,l){this.switchLevel(l.level)},c.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 O=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,w=this.tracks.filter(function(S){return!h||S.groupId===h});this.tracksInGroup=w;var x=this.findTrackId(O==null?void 0:O.name)||this.findTrackId();this.groupId=h;var A={subtitleTracks:w};this.log("Updating subtitle tracks, "+w.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(z.Events.SUBTITLE_TRACKS_UPDATED,A),x!==-1&&this.setSubtitleTrack(x,O)}},c.findTrackId=function(a){for(var l=this.tracksInGroup,h=0;h<l.length;h++){var O=l[h];if((!this.selectDefaultTrack||O.default)&&(!a||a===O.name))return O.id}return-1},c.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)},c.loadPlaylist=function(a){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var h=l.id,O=l.groupId,w=l.url;if(a)try{w=a.addDirectives(w)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:w,id:h,groupId:O,deliveryDirectives:a||null})}},c.toggleTrackModes=function(a){var l=this,h=this.media,O=this.subtitleDisplay,w=this.trackId;if(!h)return;var x=f(h.textTracks),A=x.filter(function(E){return E.groupId===l.groupId});if(a===-1)[].slice.call(x).forEach(function(E){E.mode="disabled"});else{var S=A[w];S&&(S.mode="disabled")}var T=A[a];T&&(T.mode=O?"showing":"hidden")},c.setSubtitleTrack=function(a,l){var h,O=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(h=O[a])!==null&&h!==void 0&&h.details)||a<-1||a>=O.length)return;this.clearTimer();var w=O[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,w){var x=w.id,A=w.groupId,S=A===void 0?"":A,T=w.name,E=w.type,_=w.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:x,groupId:S,name:T,type:E,url:_});var u=this.switchParams(w.url,l==null?void 0:l.details);this.loadPlaylist(u)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:a})},c.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(o,[{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)}}]),o}(M.default);function f(d){for(var o=[],c=0;c<d.length;c++){var s=d[c];s.kind==="subtitles"&&s.label&&o.push(d[c])}return o}V.default=p},"./src/controller/timeline-controller.ts":function(ne,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"),B=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 s(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=c(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var h=new W.default(this,"textTrack1"),O=new W.default(this,"textTrack2"),w=new W.default(this,"textTrack3"),x=new W.default(this,"textTrack4");this.cea608Parser1=new M.default(1,h,O),this.cea608Parser2=new M.default(3,w,x)}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=s.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,O,w,x,A){for(var S=!1,T=A.length;T--;){var E=A[T],_=o(E[0],E[1],O,w);if(_>=0&&(E[0]=Math.min(E[0],O),E[1]=Math.max(E[1],w),S=!0,_/(w-O)>.5))return}if(S||A.push([O,w]),this.config.renderTextTracksNatively){var u=this.captionsTracks[h];this.Cues.newCue(u,O,w,x)}else{var y=this.Cues.newCue(null,O,w,x);this.hls.trigger(N.Events.CUES_PARSED,{type:"captions",cues:y,track:h})}},a.onInitPtsFound=function(h,O){var w=this,x=O.frag,A=O.id,S=O.initPTS,T=O.timescale,E=this.unparsedVttFrags;A==="main"&&(this.initPTS[x.cc]=S,this.timescale[x.cc]=T),E.length&&(this.unparsedVttFrags=[],E.forEach(function(_){w.onFragLoaded(N.Events.FRAG_LOADED,_)}))},a.getExistingTrack=function(h){var O=this.media;if(O)for(var w=0;w<O.textTracks.length;w++){var x=O.textTracks[w];if(x[h])return x}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 O=this.captionsProperties,w=this.captionsTracks,x=this.media,A=O[h],S=A.label,T=A.languageCode,E=this.getExistingTrack(h);if(E)w[h]=E,Object(k.clearCurrentCues)(w[h]),Object(k.sendAddTrackEvent)(w[h],x);else{var _=this.createTextTrack("captions",S,T);_&&(_[h]=!0,w[h]=_)}},a.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var O=this.captionsProperties[h];if(!O)return;var w=O.label,x={_id:h,label:w,kind:"captions",default:O.media?!!O.media.default:!1,closedCaptions:O.media};this.nonNativeCaptionsTracks[h]=x,this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[x]})},a.createTextTrack=function(h,O,w){var x=this.media;return x?x.addTextTrack(h,O,w):void 0},a.onMediaAttaching=function(h,O){this.media=O.media,this._cleanTracks()},a.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(O){Object(k.clearCurrentCues)(h[O]),delete h[O]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=c(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var h=this.media;if(!h)return;var O=h.textTracks;if(O)for(var w=0;w<O.length;w++)Object(k.clearCurrentCues)(O[w])},a.onSubtitleTracksUpdated=function(h,O){var w=this;this.textTracks=[];var x=O.subtitleTracks||[],A=x.some(function(_){return _.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var S=this.tracks&&x&&this.tracks.length===x.length;if(this.tracks=x||[],this.config.renderTextTracksNatively){var T=this.media?this.media.textTracks:[];this.tracks.forEach(function(_,u){var y;if(u<T.length){for(var m=null,b=0;b<T.length;b++)if(d(T[b],_)){m=T[b];break}m&&(y=m)}y?Object(k.clearCurrentCues)(y):(y=w.createTextTrack("subtitles",_.name,_.lang),y&&(y.mode="disabled")),y&&(y.groupId=_.groupId,w.textTracks.push(y))})}else if(!S&&this.tracks&&this.tracks.length){var E=this.tracks.map(function(_){return{label:_.name,kind:_.type.toLowerCase(),default:_.default,subtitleTrack:_}});this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:E})}}},a.onManifestLoaded=function(h,O){var w=this;this.config.enableCEA708Captions&&O.captions&&O.captions.forEach(function(x){var A=/(?:CC|SERVICE)([1-4])/.exec(x.instreamId);if(!A)return;var S="textTrack"+A[1],T=w.captionsProperties[S];if(!T)return;T.label=x.name,x.lang&&(T.languageCode=x.lang),T.media=x})},a.onFragLoading=function(h,O){var w=this.cea608Parser1,x=this.cea608Parser2,A=this.lastSn,S=this.lastPartIndex;if(!this.enabled||!(w&&x))return;if(O.frag.type===g.PlaylistLevelType.MAIN){var T,E,_=O.frag.sn,u=(T=O==null||((E=O.part)===null||E===void 0)?void 0:E.index)!=null?T:-1;_===A+1||_===A&&u===S+1||(w.reset(),x.reset()),this.lastSn=_,this.lastPartIndex=u}},a.onFragLoaded=function(h,O){var w=O.frag,x=O.payload,A=this.initPTS,S=this.unparsedVttFrags;if(w.type===g.PlaylistLevelType.SUBTITLE)if(x.byteLength){if(!Object(z.isFiniteNumber)(A[w.cc])){S.push(O),A.length&&this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Missing initial subtitle PTS")});return}var T=w.decryptdata;if(T==null||T.key==null||T.method!=="AES-128"){var E=this.tracks[w.level],_=this.vttCCs;_[w.cc]||(_[w.cc]={start:w.start,prevCC:this.prevCC,new:!0},this.prevCC=w.cc),E&&E.textCodec===R.IMSC1_CODEC?this._parseIMSC1(w,x):this._parseVTTs(w,x,_)}}else this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(h,O){var w=this,x=this.hls;Object(R.parseIMSC1)(O,this.initPTS[h.cc],this.timescale[h.cc],function(A){w._appendCues(A,h.level),x.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(A){p.logger.log("Failed to parse IMSC1: "+A),x.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:A})})},a._parseVTTs=function(h,O,w){var x=this,A=this.hls;Object(B.parseWebVTT)(O,this.initPTS[h.cc],this.timescale[h.cc],w,h.cc,h.start,function(S){x._appendCues(S,h.level),A.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(S){x._fallbackToIMSC1(h,O),p.logger.log("Failed to parse VTT cue: "+S),A.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:S})})},a._fallbackToIMSC1=function(h,O){var w=this,x=this.tracks[h.level];x.textCodec||Object(R.parseIMSC1)(O,this.initPTS[h.cc],this.timescale[h.cc],function(){x.textCodec=R.IMSC1_CODEC,w._parseIMSC1(h,O)},function(){x.textCodec="wvtt"})},a._appendCues=function(h,O){var w=this.hls;if(this.config.renderTextTracksNatively){var x=this.textTracks[O];if(x.mode==="disabled")return;h.forEach(function(T){return Object(k.addCueToTrack)(x,T)})}else{var A=this.tracks[O],S=A.default?"default":"subtitles"+O;w.trigger(N.Events.CUES_PARSED,{type:"subtitles",cues:h,track:S})}},a.onFragDecrypted=function(h,O){var w=O.frag;if(w.type===g.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[w.cc])){this.unparsedVttFrags.push(O);return}this.onFragLoaded(N.Events.FRAG_LOADED,O)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(h,O){var w=this.cea608Parser1,x=this.cea608Parser2;if(!this.enabled||!(w&&x))return;for(var A=0;A<O.samples.length;A++){var S=O.samples[A].bytes;if(S){var T=this.extractCea608Data(S);w.addData(O.samples[A].pts,T[0]),x.addData(O.samples[A].pts,T[1])}}},a.onBufferFlushing=function(h,O){var w=O.startOffset,x=O.endOffset,A=O.endOffsetSubtitles,S=O.type,T=this.media;if(!T||T.currentTime<x)return;if(!S||S==="video"){var E=this.captionsTracks;Object.keys(E).forEach(function(u){return Object(k.removeCuesInRange)(E[u],w,x)})}if(this.config.renderTextTracksNatively&&(w===0&&A!==void 0)){var _=this.textTracks;Object.keys(_).forEach(function(u){return Object(k.removeCuesInRange)(_[u],w,A)})}},a.extractCea608Data=function(h){for(var O=h[0]&31,w=2,x=[[],[]],A=0;A<O;A++){var S=h[w++],T=127&h[w++],E=127&h[w++],_=(4&S)!==0,u=3&S;if(T===0&&E===0)continue;_&&((u===0||u===1)&&(x[u].push(T),x[u].push(E)))}return x},s}();function d(s,a){return s&&s.label===a.name&&!(s.textTrack1||s.textTrack2)}function o(s,a,l,h){return Math.min(a,h)-Math.max(s,l)}function c(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function N(W,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=B}var M=N.prototype;return M.decrypt=function(B,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,B)},N}()},"./src/crypt/aes-decryptor.ts":function(ne,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 B=W.byteLength,k=B&&new DataView(W.buffer).getUint8(B-1);return k?Object(z.sliceUint8)(W,0,B-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 B=W.prototype;return B.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},B.initTable=function(){var R=this.sBox,g=this.invSBox,p=this.subMix,f=p[0],d=p[1],o=p[2],c=p[3],s=this.invSubMix,a=s[0],l=s[1],h=s[2],O=s[3],w=new Uint32Array(256),x=0,A=0,S=0;for(S=0;S<256;S++)S<128?w[S]=S<<1:w[S]=S<<1^283;for(S=0;S<256;S++){var T=A^A<<1^A<<2^A<<3^A<<4;T=T>>>8^T&255^99,R[x]=T,g[T]=x;var E=w[x],_=w[E],u=w[_],y=w[T]*257^T*16843008;f[x]=y<<24|y>>>8,d[x]=y<<16|y>>>16,o[x]=y<<8|y>>>24,c[x]=y,y=u*16843009^_*65537^E*257^x*16843008,a[T]=y<<24|y>>>8,l[T]=y<<16|y>>>16,h[T]=y<<8|y>>>24,O[T]=y,x?(x=E^w[w[w[u^E]]],A^=w[w[A]]):x=A=1}},B.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 o=this.ksRows=(d+6+1)*4,c,s,a=this.keySchedule=new Uint32Array(o),l=this.invKeySchedule=new Uint32Array(o),h=this.sBox,O=this.rcon,w=this.invSubMix,x=w[0],A=w[1],S=w[2],T=w[3],E,_;for(c=0;c<o;c++){if(c<d){E=a[c]=g[c];continue}_=E,c%d===0?(_=_<<8|_>>>24,_=h[_>>>24]<<24|h[_>>>16&255]<<16|h[_>>>8&255]<<8|h[_&255],_^=O[c/d|0]<<24):d>6&&c%d===4&&(_=h[_>>>24]<<24|h[_>>>16&255]<<16|h[_>>>8&255]<<8|h[_&255]),a[c]=E=(a[c-d]^_)>>>0}for(s=0;s<o;s++)c=o-s,s&3?_=a[c]:_=a[c-4],s<4||c<=4?l[s]=_:l[s]=x[h[_>>>24]]^A[h[_>>>16&255]]^S[h[_>>>8&255]]^T[h[_&255]],l[s]=l[s]>>>0},B.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},B.decrypt=function(R,g,p){for(var f=this.keySize+6,d=this.invKeySchedule,o=this.invSBox,c=this.invSubMix,s=c[0],a=c[1],l=c[2],h=c[3],O=this.uint8ArrayToUint32Array_(p),w=O[0],x=O[1],A=O[2],S=O[3],T=new Int32Array(R),E=new Int32Array(T.length),_,u,y,m,b,P,I,U,F,L,v,j,K,J,ee=this.networkToHostOrderSwap;g<T.length;){for(F=ee(T[g]),L=ee(T[g+1]),v=ee(T[g+2]),j=ee(T[g+3]),b=F^d[0],P=j^d[1],I=v^d[2],U=L^d[3],K=4,J=1;J<f;J++)_=s[b>>>24]^a[P>>16&255]^l[I>>8&255]^h[U&255]^d[K],u=s[P>>>24]^a[I>>16&255]^l[U>>8&255]^h[b&255]^d[K+1],y=s[I>>>24]^a[U>>16&255]^l[b>>8&255]^h[P&255]^d[K+2],m=s[U>>>24]^a[b>>16&255]^l[P>>8&255]^h[I&255]^d[K+3],b=_,P=u,I=y,U=m,K=K+4;_=o[b>>>24]<<24^o[P>>16&255]<<16^o[I>>8&255]<<8^o[U&255]^d[K],u=o[P>>>24]<<24^o[I>>16&255]<<16^o[U>>8&255]<<8^o[b&255]^d[K+1],y=o[I>>>24]<<24^o[U>>16&255]<<16^o[b>>8&255]<<8^o[P&255]^d[K+2],m=o[U>>>24]<<24^o[b>>16&255]<<16^o[P>>8&255]<<8^o[I&255]^d[K+3],E[g]=ee(_^w),E[g+1]=ee(m^x),E[g+2]=ee(y^A),E[g+3]=ee(u^S),w=F,x=L,A=v,S=j,g=g+4}return E.buffer},W}()},"./src/crypt/decrypter.ts":function(ne,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"),B=D("./src/utils/mp4-tools.ts"),k=D("./src/utils/typed-array.ts"),R=16,g=function(){function p(d,o,c){var s=c===void 0?{}:c,a=s.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=o,this.removePKCS7Padding=l,l)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(O){}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 o=this.currentResult;if(!o){this.reset();return}var c=new Uint8Array(o);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(c):c},f.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},f.decrypt=function(o,c,s,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(o),c,s);var l=this.flush();l&&a(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(o),c,s).then(a)},f.softwareDecrypt=function(o,c,s){var a=this.currentIV,l=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(o=Object(B.appendUint8Array)(h,o),this.remainderData=null);var O=this.getValidChunk(o);if(!O.length)return null;a&&(s=a);var w=this.softwareDecrypter;w||(w=this.softwareDecrypter=new M.default),w.expandKey(c);var x=l;return this.currentResult=w.decrypt(O.buffer,0,s),this.currentIV=Object(k.sliceUint8)(O,-16).buffer,x||null},f.webCryptoDecrypt=function(o,c,s){var a=this,l=this.subtle;return(this.key!==c||!this.fastAesKey)&&(this.key=c,this.fastAesKey=new N.default(l,c)),this.fastAesKey.expandKey().then(function(h){if(!l)return Promise.reject(new Error("web crypto not initialized"));var O=new z.default(l,s);return O.decrypt(o.buffer,h)}).catch(function(h){return a.onWebCryptoError(h,o,c,s)})},f.onWebCryptoError=function(o,c,s,a){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",o),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(c,s,a)},f.getValidChunk=function(o){var c=o,s=o.length-o.length%R;return s!==o.length&&(c=Object(k.sliceUint8)(o,0,s),this.remainderData=Object(k.sliceUint8)(o,s)),c},f.logOnce=function(o){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+o),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function N(W,B){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=B}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(ne,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 B(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,o){return d.__proto__=o,d},k(g,p)}var R=function(g){B(p,g);function p(d,o){var c;return c=g.call(this)||this,c.observer=void 0,c.config=void 0,c.observer=d,c.config=o,c}var f=p.prototype;return f.resetInitSegment=function(o,c,s){g.prototype.resetInitSegment.call(this,o,c,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:o,duration:s,inputTimeScale:9e4,dropped:0}},p.probe=function(o){if(!o)return!1;for(var c=W.getID3Data(o,0)||[],s=c.length,a=o.length;s<a;s++)if(N.probe(o,s))return M.logger.log("ADTS sync word found !"),!0;return!1},f.canParse=function(o,c){return N.canParse(o,c)},f.appendFrame=function(o,c,s){N.initTrackConfig(o,this.observer,c,s,o.manifestCodec);var a=N.appendFrame(o,c,s,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(ne,V,D){"use strict";D.r(V),D.d(V,"getAudioConfig",function(){return W}),D.d(V,"isHeaderPattern",function(){return B}),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 o}),D.d(V,"getFrameDuration",function(){return c}),D.d(V,"parseFrameHeader",function(){return s}),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,O,w){var x,A,S,T,E=navigator.userAgent.toLowerCase(),_=w,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];x=((h[O+2]&192)>>>6)+1;var y=(h[O+2]&60)>>>2;if(y>u.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[O+2]&1)<<2,S|=(h[O+3]&192)>>>6,z.logger.log("manifest codec:"+w+", ADTS type:"+x+", samplingIndex:"+y),/firefox/i.test(E)?y>=6?(x=5,T=new Array(4),A=y-3):(x=2,T=new Array(2),A=y):E.indexOf("android")!==-1?(x=2,T=new Array(2),A=y):(x=5,T=new Array(4),w&&(w.indexOf("mp4a.40.29")!==-1||w.indexOf("mp4a.40.5")!==-1)||!w&&y>=6?A=y-3:((w&&w.indexOf("mp4a.40.2")!==-1&&(y>=6&&S===1||/vivaldi/i.test(E))||!w&&S===1)&&(x=2,T=new Array(2)),A=y)),T[0]=x<<3,T[0]|=(y&14)>>1,T[1]|=(y&1)<<7,T[1]|=S<<3,x===5&&(T[1]|=(A&14)>>1,T[2]=(A&1)<<7,T[2]|=2<<2,T[3]=0),{config:T,samplerate:u[y],channelCount:S,codec:"mp4a.40."+x,manifestCodec:_}}function B(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&&B(l,h)}function f(l,h){return g(l,h)&&B(l,h)&&R(l,h)<=l.length-h}function d(l,h){if(p(l,h)){var O=k(l,h);if(h+O>=l.length)return!1;var w=R(l,h);if(w<=O)return!1;var x=h+w;return x===l.length||p(l,x)}return!1}function o(l,h,O,w,x){if(!l.samplerate){var A=W(h,O,w,x);if(!A)return;l.config=A.config,l.samplerate=A.samplerate,l.channelCount=A.channelCount,l.codec=A.codec,l.manifestCodec=A.manifestCodec,z.logger.log("parsed codec:"+l.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function c(l){return 1024*9e4/l}function s(l,h,O,w,x){var A=k(l,h),S=R(l,h);if(S-=A,S>0){var T=O+w*x;return{headerLength:A,frameLength:S,stamp:T}}}function a(l,h,O,w,x){var A=c(l.samplerate),S=s(h,O,w,x,A);if(S){var T=S.frameLength,E=S.headerLength,_=S.stamp,u=E+T,y=Math.max(0,O+u-h.length),m;y?(m=new Uint8Array(u-E),m.set(h.subarray(O+E,h.length),0)):m=h.subarray(O+E,O+u);var b={unit:m,pts:_};return y||l.samples.push(b),{sample:b,length:u,missing:y}}}},"./src/demux/base-audio-demuxer.ts":function(ne,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"),B=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,o,c){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(d,o){return!1},p.appendFrame=function(d,o,c){},p.demux=function(d,o){this.cachedData&&(d=Object(W.appendUint8Array)(this.cachedData,d),this.cachedData=null);var c=N.getID3Data(d,0),s=c?c.length:0,a,l,h=this._audioTrack,O=this._id3Track,w=c?N.getTimeStamp(c):void 0,x=d.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(w,o)),c&&c.length>0&&O.samples.push({pts:this.initPTS,dts:this.initPTS,data:c}),l=this.initPTS;s<x;){if(this.canParse(d,s)){var A=this.appendFrame(h,d,s);A?(this.frameIndex++,l=A.sample.pts,s+=A.length,a=s):s=x}else N.canParse(d,s)?(c=N.getID3Data(d,s),O.samples.push({pts:l,dts:l,data:c}),s+=c.length,a=s):s++;if(s===x&&a!==x){var S=Object(B.sliceUint8)(d,a);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,S):this.cachedData=S}}return{audioTrack:h,avcTrack:Object(M.dummyTrack)(),id3Track:O,textTrack:Object(M.dummyTrack)()}},p.demuxSampleAes=function(d,o,c){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(d){var o=this.cachedData;return o&&(this.cachedData=null,this.demux(o,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(ne,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 B=new Uint8Array(W),k=0,R=0;R<M.length;R++){var g=M[R];B.set(g,k),k+=g.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(ne,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(ne,V,D){"use strict";D.r(V);var z=D("./src/utils/logger.ts"),N=function(){function M(B){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=B,this.bytesAvailable=B.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,o,c=this.readUByte.bind(this),s=this.readBits.bind(this),a=this.readUEG.bind(this),l=this.readBoolean.bind(this),h=this.skipBits.bind(this),O=this.skipEG.bind(this),w=this.skipUEG.bind(this),x=this.skipScalingList.bind(this);c();var A=c();if(s(5),h(3),c(),w(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var S=a();if(S===3&&h(1),w(),w(),h(1),l())for(d=S!==3?8:12,o=0;o<d;o++)l()&&(o<6?x(16):x(64))}w();var T=a();if(T===0)a();else if(T===1)for(h(1),O(),O(),f=a(),o=0;o<f;o++)O();w(),h(1);var E=a(),_=a(),u=s(1);u===0&&h(1),h(1),l()&&(k=a(),R=a(),g=a(),p=a());var y=[1,1];if(l()&&l()){var m=c();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=[c()<<8|c(),c()<<8|c()];break}}}return{width:Math.ceil((E+1)*16-k*2-R*2),height:(2-u)*(_+1)*16-(u?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(ne,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 B}),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(x,A){return A+10<=x.length&&(x[A]===73&&x[A+1]===68&&x[A+2]===51&&(x[A+3]<255&&x[A+4]<255&&(x[A+6]<128&&x[A+7]<128&&x[A+8]<128&&x[A+9]<128)))},N=function(x,A){return A+10<=x.length&&(x[A]===51&&x[A+1]===68&&x[A+2]===73&&(x[A+3]<255&&x[A+4]<255&&(x[A+6]<128&&x[A+7]<128&&x[A+8]<128&&x[A+9]<128)))},M=function(x,A){for(var S=A,T=0;z(x,A);){T+=10;var E=W(x,A+6);T+=E,N(x,A+10)&&(T+=10),A+=T}return T>0?x.subarray(S,S+T):void 0},W=function(x,A){var S=0;return S=(x[A]&127)<<21,S|=(x[A+1]&127)<<14,S|=(x[A+2]&127)<<7,S|=x[A+3]&127,S},B=function(x,A){return z(x,A)&&W(x,A+6)+10<=x.length-A},k=function(x){for(var A=p(x),S=0;S<A.length;S++){var T=A[S];if(R(T))return s(T)}return},R=function(x){return x&&x.key==="PRIV"&&x.info==="com.apple.streaming.transportStreamTimestamp"},g=function(x){var A=String.fromCharCode(x[0],x[1],x[2],x[3]),S=W(x,4),T=10;return{type:A,size:S,data:x.subarray(T,T+S)}},p=function(x){for(var A=0,S=[];z(x,A);){var T=W(x,A+6);A+=10;for(var E=A+T;A+8<E;){var _=g(x.subarray(A)),u=f(_);u&&S.push(u),A+=_.size+10}N(x,A)&&(A+=10)}return S},f=function(x){return x.type==="PRIV"?d(x):x.type[0]==="W"?c(x):o(x)},d=function(x){if(x.size<2)return;var A=a(x.data,!0),S=new Uint8Array(x.data.subarray(A.length+1));return{key:x.type,info:A,data:S.buffer}},o=function(x){if(x.size<2)return;if(x.type==="TXXX"){var A=1,S=a(x.data.subarray(A),!0);A+=S.length+1;var T=a(x.data.subarray(A));return{key:x.type,info:S,data:T}}var E=a(x.data.subarray(1));return{key:x.type,data:E}},c=function(x){if(x.type==="WXXX"){if(x.size<2)return;var A=1,S=a(x.data.subarray(A),!0);A+=S.length+1;var T=a(x.data.subarray(A));return{key:x.type,info:S,data:T}}var E=a(x.data);return{key:x.type,data:E}},s=function(x){if(x.data.byteLength===8){var A=new Uint8Array(x.data),S=A[3]&1,T=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return T/=45,S&&(T+=4772185884e-2),Math.round(T)}return},a=function(x,A){A===void 0&&(A=!1);var S=O();if(S){var T=S.decode(x);if(A){var E=T.indexOf("\0");return E!==-1?T.substring(0,E):T}return T.replace(/\0/g,"")}for(var _=x.length,u,y,m,b="",P=0;P<_;){if(u=x[P++],u===0&&A)return b;if(u===0||u===3)continue;switch(u>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(u);break;case 12:case 13:y=x[P++],b+=String.fromCharCode((u&31)<<6|y&63);break;case 14:y=x[P++],m=x[P++],b+=String.fromCharCode((u&15)<<12|(y&63)<<6|(m&63)<<0);break;default:}}return b},l={decodeTextFrame:o},h;function O(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(ne,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 B(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,o){return d.__proto__=o,d},k(g,p)}var R=function(g){B(p,g);function p(){return g.apply(this,arguments)||this}var f=p.prototype;return f.resetInitSegment=function(o,c,s){g.prototype.resetInitSegment.call(this,o,c,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:o,duration:s,inputTimeScale:9e4,dropped:0}},p.probe=function(o){if(!o)return!1;for(var c=N.getID3Data(o,0)||[],s=c.length,a=o.length;s<a;s++)if(W.probe(o,s))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},f.canParse=function(o,c){return W.canParse(o,c)},f.appendFrame=function(o,c,s){return this.initPTS===null?void 0:W.appendFrame(o,c,s,this.initPTS,this.frameIndex)},p}(z.default);R.minProbeByteLength=4,V.default=R},"./src/demux/mp4demuxer.ts":function(ne,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 B=W.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},W.probe=function(R){return Object(z.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},B.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)()}},B.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)()}},B.demuxSampleAes=function(R,g,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},W}();M.minProbeByteLength=1024,V.default=M},"./src/demux/mpegaudio.ts":function(ne,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]],B=[0,1,1,4];function k(o,c,s,a,l){if(s+24>c.length)return;var h=R(c,s);if(h&&s+h.frameLength<=c.length){var O=h.samplesPerFrame*9e4/h.sampleRate,w=a+l*O,x={unit:c.subarray(s,s+h.frameLength),pts:w,dts:w};return o.config=[],o.channelCount=h.channelCount,o.samplerate=h.sampleRate,o.samples.push(x),{sample:x,length:h.frameLength,missing:0}}}function R(o,c){var s=o[c+1]>>3&3,a=o[c+1]>>1&3,l=o[c+2]>>4&15,h=o[c+2]>>2&3;if(s!==1&&l!==0&&l!==15&&h!==3){var O=o[c+2]>>1&1,w=o[c+3]>>6,x=s===3?3-a:a===3?3:4,A=N[x*14+l-1]*1e3,S=s===3?0:s===2?1:2,T=M[S*3+h],E=w===3?1:2,_=W[s][a],u=B[a],y=_*8*u,m=Math.floor(_*A/T+O)*u;if(z===null){var b=navigator.userAgent||"",P=b.match(/Chrome\/(\d+)/i);z=P?parseInt(P[1]):0}var I=!!z&&z<=87;return I&&a===2&&A>=224e3&&w===0&&(o[c+3]=o[c+3]|128),{sampleRate:T,channelCount:E,frameLength:m,samplesPerFrame:y}}}function g(o,c){return o[c]===255&&(o[c+1]&224)===224&&(o[c+1]&6)!==0}function p(o,c){return c+1<o.length&&g(o,c)}function f(o,c){var s=4;return g(o,c)&&s<=o.length-c}function d(o,c){if(c+1<o.length&&g(o,c)){var s=4,a=R(o,c),l=s;a!=null&&a.frameLength&&(l=a.frameLength);var h=c+l;return h===o.length||p(o,h)}return!1}},"./src/demux/sample-aes.ts":function(ne,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 B=W.prototype;return B.decryptBuffer=function(R,g){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,g)},B.decryptAacSample=function(R,g,p,f){var d=R[g].unit,o=d.subarray(16,d.length-d.length%16),c=o.buffer.slice(o.byteOffset,o.byteOffset+o.length),s=this;this.decryptBuffer(c,function(a){var l=new Uint8Array(a);d.set(l,16),f||s.decryptAacSamples(R,g+1,p)})},B.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}},B.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},B.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},B.decryptAvcSample=function(R,g,p,f,d,o){var c=Object(N.discardEPB)(d.data),s=this.getAvcEncryptedData(c),a=this;this.decryptBuffer(s.buffer,function(l){d.data=a.getAvcDecryptedUnit(c,l),o||a.decryptAvcSamples(R,g,p+1,f)})},B.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 o=d[p];if(o.data.length<=48||o.type!==1&&o.type!==5)continue;var c=this.decrypter.isSync();if(this.decryptAvcSample(R,g,p,f,o,c),!c)return}}},W}();V.default=M},"./src/demux/transmuxer-interface.ts":function(ne,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"),B=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 o(s,a,l,h){var O=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=s,this.id=a,this.onTransmuxComplete=l,this.onFlush=h;var w=s.config,x=function(_,u){u=u||{},u.frag=O.frag,u.id=O.id,s.trigger(_,u)};this.observer=new g.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,x),this.observer.on(M.Events.ERROR,x);var A={mp4:f.isTypeSupported("video/mp4"),mpeg:f.isTypeSupported("audio/mpeg"),mp3:f.isTypeSupported('audio/mp4; codecs="mp3"')},S=navigator.vendor;if(w.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var T;try{T=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),T.addEventListener("message",this.onwmsg),T.onerror=function(E){s.trigger(M.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(E.message+" ("+E.filename+":"+E.lineno+")")})},T.postMessage({cmd:"init",typeSupported:A,vendor:S,id:a,config:JSON.stringify(w)})}catch(E){B.logger.warn("Error in worker:",E),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),T&&self.URL.revokeObjectURL(T.objectURL),this.transmuxer=new W.default(this.observer,A,w,S,a),this.worker=null}}else this.transmuxer=new W.default(this.observer,A,w,S,a)}var c=o.prototype;return c.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},c.push=function(a,l,h,O,w,x,A,S,T,E){var _=this;T.transmuxing.start=self.performance.now();var u=this.transmuxer,y=this.worker,m=x?x.start:w.start,b=w.decryptdata,P=this.frag,I=!(P&&w.cc===P.cc),U=!(P&&T.level===P.level),F=P?T.sn-P.sn:-1,L=this.part?T.part-this.part.index:1,v=!U&&(F===1||F===0&&L===1),j=self.performance.now();(U||F||w.stats.parsing.start===0)&&(w.stats.parsing.start=j),x&&(L||!v)&&(x.stats.parsing.start=j);var K=new W.TransmuxState(I,v,S,U,m);if(!v||I){B.logger.log("[transmuxer-interface, "+w.type+"]: Starting new transmux session for sn: "+T.sn+" p: "+T.part+" level: "+T.level+" id: "+T.id+`
discontinuity: `+I+`
trackSwitch: `+U+`
contiguous: `+v+`
accurateTimeOffset: `+S+`
timeOffset: `+m);var J=new W.TransmuxConfig(h,O,l,A,E);this.configureTransmuxer(J)}if(this.frag=w,this.part=x,y)y.postMessage({cmd:"demux",data:a,decryptdata:b,chunkMeta:T,state:K},a instanceof ArrayBuffer?[a]:[]);else if(u){var ee=u.push(a,b,T,K);Object(W.isPromise)(ee)?ee.then(function(ve){_.handleTransmuxComplete(ve)}):this.handleTransmuxComplete(ee)}},c.flush=function(a){var l=this;a.transmuxing.start=self.performance.now();var h=this.transmuxer,O=this.worker;if(O)O.postMessage({cmd:"flush",chunkMeta:a});else if(h){var w=h.flush(a);Object(W.isPromise)(w)?w.then(function(x){l.handleFlushResult(x,a)}):this.handleFlushResult(w,a)}},c.handleFlushResult=function(a,l){var h=this;a.forEach(function(O){h.handleTransmuxComplete(O)}),this.onFlush(l)},c.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}}},c.configureTransmuxer=function(a){var l=this.worker,h=this.transmuxer;l?l.postMessage({cmd:"configure",config:a}):h&&h.configure(a)},c.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},o}()},"./src/demux/transmuxer-worker.ts":function(ne,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"),B=D.n(W);function k(d){var o=new W.EventEmitter,c=function(a,l){d.postMessage({event:a,data:l})};o.on(N.Events.FRAG_DECRYPTED,c),o.on(N.Events.ERROR,c),d.addEventListener("message",function(s){var a=s.data;switch(a.cmd){case"init":{var l=JSON.parse(a.config);d.transmuxer=new z.default(o,a.typeSupported,l,a.vendor,a.id),Object(M.enableLogs)(l.debug),c("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(x){R(d,x)}):R(d,h);break}case"flush":{var O=a.chunkMeta,w=d.transmuxer.flush(O);Object(z.isPromise)(w)?w.then(function(x){p(d,x,O)}):p(d,w,O);break}default:break}})}function R(d,o){if(f(o.remuxResult))return;var c=[],s=o.remuxResult,a=s.audio,l=s.video;a&&g(c,a),l&&g(c,l),d.postMessage({event:"transmuxComplete",data:o},c)}function g(d,o){o.data1&&d.push(o.data1.buffer),o.data2&&d.push(o.data2.buffer)}function p(d,o,c){o.forEach(function(s){R(d,s)}),d.postMessage({event:"flush",data:c})}function f(d){return!d.audio&&!d.video&&!d.text&&!d.id3&&!d.initSegment}},"./src/demux/transmuxer.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"default",function(){return l}),D.d(V,"isPromise",function(){return w}),D.d(V,"TransmuxConfig",function(){return x}),D.d(V,"TransmuxState",function(){return A});var z=D("./src/events.ts"),N=D("./src/errors.ts"),M=D("./src/crypt/decrypter.ts"),W=D("./src/demux/aacdemuxer.ts"),B=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"),o=D("./src/utils/logger.ts"),c;try{c=self.performance.now.bind(self.performance)}catch(S){o.logger.debug("Unable to use Performance API on this environment"),c=self.Date.now}var s=[{demux:k.default,remux:g.default},{demux:B.default,remux:p.default},{demux:W.default,remux:g.default},{demux:R.default,remux:g.default}],a=1024;s.forEach(function(S){var T=S.demux;a=Math.max(a,T.minProbeByteLength)});var l=function(){function S(E,_,u,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=E,this.typeSupported=_,this.config=u,this.vendor=y,this.id=m}var T=S.prototype;return T.configure=function(_){this.transmuxConfig=_,this.decrypter&&this.decrypter.reset()},T.push=function(_,u,y,m){var b=this,P=y.transmuxing;P.executeStart=c();var I=new Uint8Array(_),U=this.cache,F=this.config,L=this.currentTransmuxState,v=this.transmuxConfig;m&&(this.currentTransmuxState=m);var j=h(I,u);if(j&&j.method==="AES-128"){var K=this.getDecrypter();if(F.enableSoftwareAES){var J=K.softwareDecrypt(I,j.key.buffer,j.iv.buffer);if(!J)return P.executeEnd=c(),O(y);I=new Uint8Array(J)}else return this.decryptionPromise=K.webCryptoDecrypt(I,j.key.buffer,j.iv.buffer).then(function(we){var Re=b.push(we,null,y);return b.decryptionPromise=null,Re}),this.decryptionPromise}var ee=m||L,ve=ee.contiguous,de=ee.discontinuity,me=ee.trackSwitch,ce=ee.accurateTimeOffset,pe=ee.timeOffset,ae=v.audioCodec,he=v.videoCodec,$=v.defaultInitPts,ie=v.duration,q=v.initSegmentData;if((de||me)&&this.resetInitSegment(q,ae,he,ie),de&&this.resetInitialTimestamp($),ve||this.resetContiguity(),this.needsProbing(I,de,me)){if(U.dataLength){var Ee=U.flush();I=Object(d.appendUint8Array)(Ee,I)}this.configureTransmuxer(I,v)}var Ae=this.transmux(I,j,pe,ce,y),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,P.executeEnd=c(),Ae},T.flush=function(_){var u=this,y=_.transmuxing;y.executeStart=c();var m=this.decrypter,b=this.cache,P=this.currentTransmuxState,I=this.decryptionPromise;if(I)return I.then(function(){return u.flush(_)});var U=[],F=P.timeOffset;if(m){var L=m.flush();L&&U.push(this.push(L,null,_))}var v=b.dataLength;b.reset();var j=this.demuxer,K=this.remuxer;if(!j||!K)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=c(),[O(_)];var J=j.flush(F);return w(J)?J.then(function(ee){return u.flushRemux(U,ee,_),U}):(this.flushRemux(U,J,_),U)},T.flushRemux=function(_,u,y){var m=u.audioTrack,b=u.avcTrack,P=u.id3Track,I=u.textTrack,U=this.currentTransmuxState,F=U.accurateTimeOffset,L=U.timeOffset;o.logger.log("[transmuxer.ts]: Flushed fragment "+y.sn+(y.part>-1?" p: "+y.part:"")+" of level "+y.level);var v=this.remuxer.remux(m,b,P,I,L,F,!0,this.id);_.push({remuxResult:v,chunkMeta:y}),y.transmuxing.executeEnd=c()},T.resetInitialTimestamp=function(_){var u=this.demuxer,y=this.remuxer;if(!u||!y)return;u.resetTimeStamp(_),y.resetTimeStamp(_)},T.resetContiguity=function(){var _=this.demuxer,u=this.remuxer;if(!_||!u)return;_.resetContiguity(),u.resetNextTimestamp()},T.resetInitSegment=function(_,u,y,m){var b=this.demuxer,P=this.remuxer;if(!b||!P)return;b.resetInitSegment(u,y,m),P.resetInitSegment(_,u,y)},T.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},T.transmux=function(_,u,y,m,b){var P;return u&&u.method==="SAMPLE-AES"?P=this.transmuxSampleAes(_,u,y,m,b):P=this.transmuxUnencrypted(_,y,m,b),P},T.transmuxUnencrypted=function(_,u,y,m){var b=this.demuxer.demux(_,u,!1,!this.config.progressive),P=b.audioTrack,I=b.avcTrack,U=b.id3Track,F=b.textTrack,L=this.remuxer.remux(P,I,U,F,u,y,!1,this.id);return{remuxResult:L,chunkMeta:m}},T.transmuxSampleAes=function(_,u,y,m,b){var P=this;return this.demuxer.demuxSampleAes(_,u,y).then(function(I){var U=P.remuxer.remux(I.audioTrack,I.avcTrack,I.id3Track,I.textTrack,y,m,!1,P.id);return{remuxResult:U,chunkMeta:b}})},T.configureTransmuxer=function(_,u){for(var y=this.config,m=this.observer,b=this.typeSupported,P=this.vendor,I=u.audioCodec,U=u.defaultInitPts,F=u.duration,L=u.initSegmentData,v=u.videoCodec,j,K=0,J=s.length;K<J;K++)if(s[K].demux.probe(_)){j=s[K];break}j||(o.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),j={demux:B.default,remux:p.default});var ee=this.demuxer,ve=this.remuxer,de=j.remux,me=j.demux;(!ve||!(ve instanceof de))&&(this.remuxer=new de(m,y,b,P)),(!ee||!(ee instanceof me))&&(this.demuxer=new me(m,y,b),this.probe=me.probe),this.resetInitSegment(L,I,v,F),this.resetInitialTimestamp(U)},T.needsProbing=function(_,u,y){return!this.demuxer||!this.remuxer||u||y},T.getDecrypter=function(){var _=this.decrypter;return _||(_=this.decrypter=new M.default(this.observer,this.config)),_},S}();function h(S,T){var E=null;return S.byteLength>0&&T!=null&&T.key!=null&&T.iv!==null&&T.method!=null&&(E=T),E}var O=function(T){return{remuxResult:{},chunkMeta:T}};function w(S){return"then"in S&&S.then instanceof Function}var x=function(T,E,_,u,y){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=T,this.videoCodec=E,this.initSegmentData=_,this.duration=u,this.defaultInitPts=y},A=function(T,E,_,u,y){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=T,this.contiguous=E,this.accurateTimeOffset=_,this.trackSwitch=u,this.timeOffset=y}},"./src/demux/tsdemuxer.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"discardEPB",function(){return O});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"),B=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 w(A,S,T){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=A,this.config=S,this.typeSupported=T}w.probe=function(S){var T=w.syncOffset(S);return T<0?!1:(T&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+T+", junk ahead ?"),!0)},w.syncOffset=function(S){for(var T=Math.min(1e3,S.length-3*188),E=0;E<T;){if(S[E]===71&&S[E+188]===71&&S[E+2*188]===71)return E;E++}return-1},w.createTrack=function(S,T){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"?T:void 0}};var x=w.prototype;return x.resetInitSegment=function(S,T,E){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=w.createTrack("video",E),this._audioTrack=w.createTrack("audio",E),this._id3Track=w.createTrack("id3",E),this._txtTrack=w.createTrack("text",E),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=S,this.videoCodec=T,this._duration=E},x.resetTimeStamp=function(){},x.resetContiguity=function(){var S=this._audioTrack,T=this._avcTrack,E=this._id3Track;S&&(S.pesData=null),T&&(T.pesData=null),E&&(E.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},x.demux=function(S,T,E,_){E===void 0&&(E=!1),_===void 0&&(_=!1),E||(this.sampleAes=null);var u,y=this._avcTrack,m=this._audioTrack,b=this._id3Track,P=y.pid,I=y.pesData,U=m.pid,F=b.pid,L=m.pesData,v=b.pesData,j=!1,K=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&&!_)return this.remainderData=S,{audioTrack:m,avcTrack:y,id3Track:b,textTrack:this._txtTrack};var ve=Math.max(0,w.syncOffset(S));ee-=(ee+ve)%188,ee<S.byteLength&&!_&&(this.remainderData=new Uint8Array(S.buffer,ee,S.buffer.byteLength-ee));for(var de=ve;de<ee;de+=188)if(S[de]===71){var me=!!(S[de+1]&64),ce=((S[de+1]&31)<<8)+S[de+2],pe=(S[de+3]&48)>>4,ae=void 0;if(pe>1){if(ae=de+5+S[de+4],ae===de+188)continue}else ae=de+4;switch(ce){case P:me&&(I&&(u=a(I))&&this.parseAVCPES(u,!1),I={data:[],size:0}),I&&(I.data.push(S.subarray(ae,de+188)),I.size+=de+188-ae);break;case U:me&&(L&&(u=a(L))&&(m.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),L={data:[],size:0}),L&&(L.data.push(S.subarray(ae,de+188)),L.size+=de+188-ae);break;case F:me&&(v&&(u=a(v))&&this.parseID3PES(u),v={data:[],size:0}),v&&(v.data.push(S.subarray(ae,de+188)),v.size+=de+188-ae);break;case 0:me&&(ae+=S[ae]+1),J=this._pmtId=c(S,ae);break;case J:{me&&(ae+=S[ae]+1);var he=s(S,ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,E);P=he.avc,P>0&&(y.pid=P),U=he.audio,U>0&&(m.pid=U,m.isAAC=he.isAAC),F=he.id3,F>0&&(b.pid=F),j&&!K&&(g.logger.log("reparse from beginning"),j=!1,de=ve-188),K=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=L,b.pesData=v;var $={audioTrack:m,avcTrack:y,id3Track:b,textTrack:this._txtTrack};return _&&this.extractRemainingSamples($),$},x.flush=function(){var S=this.remainderData;this.remainderData=null;var T;return S?T=this.demux(S,-1,!1,!0):T={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(T),this.sampleAes?this.decrypt(T,this.sampleAes):T},x.extractRemainingSamples=function(S){var T=S.audioTrack,E=S.avcTrack,_=S.id3Track,u=E.pesData,y=T.pesData,m=_.pesData,b;u&&(b=a(u))?(this.parseAVCPES(b,!0),E.pesData=null):E.pesData=u,y&&(b=a(y))?(T.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),T.pesData=null):(y!=null&&y.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),T.pesData=y),m&&(b=a(m))?(this.parseID3PES(b),_.pesData=null):_.pesData=m},x.demuxSampleAes=function(S,T,E){var _=this.demux(S,E,!0,!this.config.progressive),u=this.sampleAes=new B.default(this.observer,this.config,T);return this.decrypt(_,u)},x.decrypt=function(S,T){return new Promise(function(E){var _=S.audioTrack,u=S.avcTrack;_.samples&&_.isAAC?T.decryptAacSamples(_.samples,0,function(){u.samples?T.decryptAvcSamples(u.samples,0,0,function(){E(S)}):E(S)}):u.samples&&T.decryptAvcSamples(u.samples,0,0,function(){E(S)})})},x.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},x.parseAVCPES=function(S,T){var E=this,_=this._avcTrack,u=this.parseAVCNALu(S.data),y=!1,m=this.avcSample,b,P=!1;S.data=null,m&&u.length&&!_.audFound&&(l(m,_),m=this.avcSample=o(!1,S.pts,S.dts,"")),u.forEach(function(I){switch(I.type){case 1:{b=!0,m||(m=E.avcSample=o(!0,S.pts,S.dts,"")),y&&(m.debug+="NDR "),m.frame=!0;var U=I.data;if(P&&U.length>4){var F=new M.default(U).readSliceType();(F===2||F===4||F===7||F===9)&&(m.key=!0)}break}case 5:b=!0,m||(m=E.avcSample=o(!0,S.pts,S.dts,"")),y&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{b=!0,y&&m&&(m.debug+="SEI ");var L=new M.default(O(I.data));L.readUByte();for(var v=0,j=0,K=!1,J=0;!K&&L.bytesAvailable>1;){v=0;do J=L.readUByte(),v+=J;while(J===255);j=0;do J=L.readUByte(),j+=J;while(J===255);if(v===4&&L.bytesAvailable!==0){K=!0;var ee=L.readUByte();if(ee===181){var ve=L.readUShort();if(ve===49){var de=L.readUInt();if(de===1195456820){var me=L.readUByte();if(me===3){for(var ce=L.readUByte(),pe=L.readUByte(),ae=31&ce,he=[ce,pe],$=0;$<ae;$++)he.push(L.readUByte()),he.push(L.readUByte()),he.push(L.readUByte());h(E._txtTrack.samples,{type:3,pts:S.pts,bytes:he})}}}}}else if(v===5&&L.bytesAvailable!==0){if(K=!0,j>16){for(var ie=[],q=0;q<16;q++)ie.push(L.readUByte().toString(16)),(q===3||q===5||q===7||q===9)&&ie.push("-");for(var Ee=j-16,Ae=new Uint8Array(Ee),ye=0;ye<Ee;ye++)Ae[ye]=L.readUByte();h(E._txtTrack.samples,{pts:S.pts,payloadType:v,uuid:ie.join(""),userData:Object(W.utf8ArrayToStr)(Ae),userDataBytes:Ae})}}else if(j<L.bytesAvailable)for(var we=0;we<j;we++)L.readUByte()}break}case 7:if(b=!0,P=!0,y&&m&&(m.debug+="SPS "),!_.sps){var Re=new M.default(I.data),ke=Re.readSPS();_.width=ke.width,_.height=ke.height,_.pixelRatio=ke.pixelRatio,_.sps=[I.data],_.duration=E._duration;for(var Ne=I.data.subarray(1,4),Ie="avc1.",Le=0;Le<3;Le++){var Ye=Ne[Le].toString(16);Ye.length<2&&(Ye="0"+Ye),Ie+=Ye}_.codec=Ie}break;case 8:b=!0,y&&m&&(m.debug+="PPS "),_.pps||(_.pps=[I.data]);break;case 9:b=!1,_.audFound=!0,m&&l(m,_),m=E.avcSample=o(!1,S.pts,S.dts,y?"AUD ":"");break;case 12:b=!1;break;default:b=!1,m&&(m.debug+="unknown NAL "+I.type+" ");break}if(m&&b){var Qe=m.units;Qe.push(I)}}),T&&m&&(l(m,_),this.avcSample=null)},x.getLastNalUnit=function(){var S,T=this.avcSample,E;if(!T||T.units.length===0){var _=this._avcTrack.samples;T=_[_.length-1]}if((S=T)!==null&&S!==void 0&&S.units){var u=T.units;E=u[u.length-1]}return E},x.parseAVCNALu=function(S){var T=S.byteLength,E=this._avcTrack,_=E.naluState||0,u=_,y=[],m=0,b,P,I,U=-1,F=0;for(_===-1&&(U=0,F=S[0]&31,_=0,m=1);m<T;){if(b=S[m++],!_){_=b?0:1;continue}if(_===1){_=b?0:2;continue}if(!b)_=3;else if(b===1){if(U>=0){var L={data:S.subarray(U,m-_-1),type:F};y.push(L)}else{var v=this.getLastNalUnit();if(v&&(u&&m<=4-u&&(v.state&&(v.data=v.data.subarray(0,v.data.byteLength-u))),P=m-_-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<T?(I=S[m]&31,U=m,F=I,_=0):_=-1}else _=0}if(U>=0&&_>=0){var K={data:S.subarray(U,T),type:F,state:_};y.push(K)}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 E.naluState=_,y},x.parseAACPES=function(S){var T=0,E=this._audioTrack,_=this.aacOverFlow,u=S.data;if(_){this.aacOverFlow=null;var y=_.sample.unit.byteLength,m=Math.min(_.missing,y),b=y-m;_.sample.unit.set(u.subarray(0,m),b),E.samples.push(_.sample),T=_.missing}var P,I;for(P=T,I=u.length;P<I-1&&!z.isHeader(u,P);P++);if(P!==T){var U,F;if(P<I-1?(U="AAC PES did not start with ADTS header,offset:"+P,F=!1):(U="no ADTS header found in AAC PES",F=!0),g.logger.warn("parsing error:"+U),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:F,reason:U}),F)return}z.initTrackConfig(E,this.observer,u,P,this.audioCodec);var L;if(S.pts!==void 0)L=S.pts;else if(_){var v=z.getFrameDuration(E.samplerate);L=_.sample.pts+v}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var j=0;P<I;)if(z.isHeader(u,P)){if(P+5<I){var K=z.appendFrame(E,u,P,L,j);if(K)if(K.missing)this.aacOverFlow=K;else{P+=K.length,j++;continue}}break}else P++},x.parseMPEGPES=function(S){var T=S.data,E=T.length,_=0,u=0,y=S.pts;if(y===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<E;)if(N.isHeader(T,u)){var m=N.appendFrame(this._audioTrack,T,u,y,_);if(m)u+=m.length,_++;else break}else u++},x.parseID3PES=function(S){if(S.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(S)},w}();d.minProbeByteLength=188;function o(w,x,A,S){return{key:w,frame:!1,pts:x,dts:A,units:[],debug:S,length:0}}function c(w,x){return(w[x+10]&31)<<8|w[x+11]}function s(w,x,A,S){var T={audio:-1,avc:-1,id3:-1,isAAC:!0},E=(w[x+1]&15)<<8|w[x+2],_=x+3+E-4,u=(w[x+10]&15)<<8|w[x+11];for(x+=12+u;x<_;){var y=(w[x+1]&31)<<8|w[x+2];switch(w[x]){case 207:if(!S){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:T.audio===-1&&(T.audio=y);break;case 21:T.id3===-1&&(T.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:T.avc===-1&&(T.avc=y);break;case 3:case 4:A?T.audio===-1&&(T.audio=y,T.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}x+=((w[x+3]&15)<<8|w[x+4])+5}return T}function a(w){var x=0,A,S,T,E,_,u=w.data;if(!w||w.size===0)return null;for(;u[0].length<19&&u.length>1;){var y=new Uint8Array(u[0].length+u[1].length);y.set(u[0]),y.set(u[1],u[0].length),u[0]=y,u.splice(1,1)}A=u[0];var m=(A[0]<<16)+(A[1]<<8)+A[2];if(m===1){if(S=(A[4]<<8)+A[5],S&&S>w.size-6)return null;var b=A[7];b&192&&(E=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,b&64?(_=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,E-_>60*9e4&&(g.logger.warn(Math.round((E-_)/9e4)+"s delta between PTS and DTS, align them"),E=_)):_=E),T=A[8];var P=T+9;if(w.size<=P)return null;w.size-=P;for(var I=new Uint8Array(w.size),U=0,F=u.length;U<F;U++){A=u[U];var L=A.byteLength;if(P)if(P>L){P-=L;continue}else A=A.subarray(P),L-=P,P=0;I.set(A,x),x+=L}return S&&(S-=T+3),{data:I,pts:E,dts:_,len:S}}return null}function l(w,x){if(w.units.length&&w.frame){if(w.pts===void 0){var A=x.samples,S=A.length;if(S){var T=A[S-1];w.pts=T.pts,w.dts=T.dts}else{x.dropped++;return}}x.samples.push(w)}w.debug.length&&g.logger.log(w.pts+"/"+w.dts+":"+w.debug)}function h(w,x){var A=w.length;if(A>0){if(x.pts>=w[A-1].pts)w.push(x);else for(var S=A-1;S>=0;S--)if(x.pts<w[S].pts){w.splice(S,0,x);break}}else w.push(x)}function O(w){for(var x=w.byteLength,A=[],S=1;S<x-2;)w[S]===0&&w[S+1]===0&&w[S+2]===3?(A.push(S+2),S+=2):S++;if(A.length===0)return w;var T=x-A.length,E=new Uint8Array(T),_=0;for(S=0;S<T;_++,S++)_===A[0]&&(_++,A.shift()),E[S]=w[_];return E}V.default=d},"./src/errors.ts":function(ne,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(ne,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(ne,V,D){"use strict";D.r(V),D.d(V,"default",function(){return w});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"),B=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"),o=D("./src/config.ts"),c=D("./node_modules/eventemitter3/index.js"),s=D.n(c),a=D("./src/events.ts"),l=D("./src/errors.ts");function h(x,A){for(var S=0;S<A.length;S++){var T=A[S];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(x,T.key,T)}}function O(x,A,S){return A&&h(x.prototype,A),S&&h(x,S),x}var w=function(){x.isSupported=function(){return Object(f.isSupported)()};function x(S){S===void 0&&(S={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new c.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var T=this.config=Object(o.mergeConfig)(x.DefaultConfig,S);this.userConfig=S,Object(d.enableLogs)(T.debug),this._autoLevelCapping=-1,T.progressive&&Object(o.enableStreamingMode)(T);var E=T.abrController,_=T.bufferController,u=T.capLevelController,y=T.fpsController,m=this.abrController=new E(this),b=this.bufferController=new _(this),P=this.capLevelController=new u(this),I=new y(this),U=new M.default(this),F=new W.default(this),L=new B.default(this),v=this.levelController=new R.default(this),j=new g.FragmentTracker(this),K=this.streamController=new p.default(this,j);P.setStreamController(K),I.setStreamController(K);var J=[v,K];this.networkControllers=J;var ee=[U,F,m,b,P,I,L,j];this.audioTrackController=this.createController(T.audioTrackController,null,J),this.createController(T.audioStreamController,j,J),this.subtitleTrackController=this.createController(T.subtitleTrackController,null,J),this.createController(T.subtitleStreamController,j,J),this.createController(T.timelineController,null,ee),this.emeController=this.createController(T.emeController,null,ee),this.cmcdController=this.createController(T.cmcdController,null,ee),this.latencyController=this.createController(k.default,null,ee),this.coreComponents=ee}var A=x.prototype;return A.createController=function(T,E,_){if(T){var u=E?new T(this,E):new T(this);return _&&_.push(u),u}return null},A.on=function(T,E,_){_===void 0&&(_=this),this._emitter.on(T,E,_)},A.once=function(T,E,_){_===void 0&&(_=this),this._emitter.once(T,E,_)},A.removeAllListeners=function(T){this._emitter.removeAllListeners(T)},A.off=function(T,E,_,u){_===void 0&&(_=this),this._emitter.off(T,E,_,u)},A.listeners=function(T){return this._emitter.listeners(T)},A.emit=function(T,E,_){return this._emitter.emit(T,E,_)},A.trigger=function(T,E){if(this.config.debug)return this.emit(T,T,E);try{return this.emit(T,T,E)}catch(_){d.logger.error("An internal error happened while handling event "+T+'. Error message: "'+_.message+'". Here is a stacktrace:',_),this.trigger(a.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:T,error:_})}return!1},A.listenerCount=function(T){return this._emitter.listenerCount(T)},A.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(T){return T.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(T){return T.destroy()}),this.coreComponents.length=0},A.attachMedia=function(T){d.logger.log("attachMedia"),this._media=T,this.trigger(a.Events.MEDIA_ATTACHING,{media:T})},A.detachMedia=function(){d.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(T){this.stopLoad();var E=this.media,_=this.url,u=this.url=z.buildAbsoluteURL(self.location.href,T,{alwaysNormalize:!0});d.logger.log("loadSource:"+u),E&&_&&_!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(E)),this.trigger(a.Events.MANIFEST_LOADING,{url:T})},A.startLoad=function(T){T===void 0&&(T=-1),d.logger.log("startLoad("+T+")"),this.networkControllers.forEach(function(E){E.startLoad(T)})},A.stopLoad=function(){d.logger.log("stopLoad"),this.networkControllers.forEach(function(T){T.stopLoad()})},A.swapAudioCodec=function(){d.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){d.logger.log("recoverMediaError");var T=this._media;this.detachMedia(),T&&this.attachMedia(T)},A.removeLevel=function(T,E){E===void 0&&(E=0),this.levelController.removeLevel(T,E)},O(x,[{key:"levels",get:function(){var T=this.levelController.levels;return T||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(T){d.logger.log("set currentLevel:"+T),this.loadLevel=T,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(T){d.logger.log("set nextLevel:"+T),this.levelController.manualLevel=T,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(T){d.logger.log("set loadLevel:"+T),this.levelController.manualLevel=T}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(T){this.levelController.nextLoadLevel=T}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(T){d.logger.log("set firstLevel:"+T),this.levelController.firstLevel=T}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(T){d.logger.log("set startLevel:"+T),T!==-1&&(T=Math.max(T,this.minAutoLevel)),this.levelController.startLevel=T}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(T){var E=!!T;E!==this.config.capLevelToPlayerSize&&(E?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=E)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(T){this._autoLevelCapping!==T&&(d.logger.log("set autoLevelCapping:"+T),this._autoLevelCapping=T)}},{key:"bandwidthEstimate",get:function(){var T=this.abrController.bwEstimator;return T?T.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var T=this.levels,E=this.config.minAutoBitrate;if(!T)return 0;for(var _=T.length,u=0;u<_;u++)if(T[u].maxBitrate>E)return u;return 0}},{key:"maxAutoLevel",get:function(){var T=this.levels,E=this.autoLevelCapping,_;return E===-1&&T&&T.length?_=T.length-1:_=E,_}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(T){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,T)}},{key:"audioTracks",get:function(){var T=this.audioTrackController;return T?T.audioTracks:[]}},{key:"audioTrack",get:function(){var T=this.audioTrackController;return T?T.audioTrack:-1},set:function(T){var E=this.audioTrackController;E&&(E.audioTrack=T)}},{key:"subtitleTracks",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTrack:-1},set:function(T){var E=this.subtitleTrackController;E&&(E.subtitleTrack=T)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var T=this.subtitleTrackController;return T?T.subtitleDisplay:!1},set:function(T){var E=this.subtitleTrackController;E&&(E.subtitleDisplay=T)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(T){this.config.lowLatencyMode=T}},{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 x.defaultConfig?x.defaultConfig:o.hlsDefaultConfig},set:function(T){x.defaultConfig=T}}]),x}();w.defaultConfig=void 0},"./src/is-supported.ts":function(ne,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 B=Object(z.getMediaSource)();if(!B)return!1;var k=N(),R=B&&typeof B.isTypeSupported=="function"&&B.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 B,k=N();return typeof(k==null||((B=k.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"default",function(){return d}),D.d(V,"LoadError",function(){return c});var z=D("./src/polyfills/number.ts"),N=D("./src/errors.ts");function M(s,a){s.prototype=Object.create(a.prototype),s.prototype.constructor=s,g(s,a)}function W(s){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,O)}function O(){return B(h,arguments,p(this).constructor)}return O.prototype=Object.create(h.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),g(O,h)},W(s)}function B(s,a,l){return k()?B=Reflect.construct:B=function(O,w,x){var A=[null];A.push.apply(A,w);var S=Function.bind.apply(O,A),T=new S;return x&&g(T,x.prototype),T},B.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(s){return!1}}function R(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function g(s,a){return g=Object.setPrototypeOf||function(h,O){return h.__proto__=O,h},g(s,a)}function p(s){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},p(s)}var f=Math.pow(2,17),d=function(){function s(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var a=s.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,O){var w=this,x=h.url;if(!x)return Promise.reject(new c({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(x?"part list":"url")));this.abort();var A=this.config,S=A.fLoader,T=A.loader;return new Promise(function(E,_){w.loader&&w.loader.destroy();var u=w.loader=h.loader=S?new S(A):new T(A),y=o(h),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:f};h.stats=u.stats,u.load(y,m,{onSuccess:function(P,I,U,F){w.resetLoader(h,u),E({frag:h,part:null,payload:P.data,networkDetails:F})},onError:function(P,I,U){w.resetLoader(h,u),_(new c({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:P,networkDetails:U}))},onAbort:function(P,I,U){w.resetLoader(h,u),_(new c({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:U}))},onTimeout:function(P,I,U){w.resetLoader(h,u),_(new c({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:U}))},onProgress:function(P,I,U,F){O&&O({frag:h,part:null,payload:U,networkDetails:F})}})})},a.loadPart=function(h,O,w){var x=this;this.abort();var A=this.config,S=A.fLoader,T=A.loader;return new Promise(function(E,_){x.loader&&x.loader.destroy();var u=x.loader=h.loader=S?new S(A):new T(A),y=o(h,O),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:f};O.stats=u.stats,u.load(y,m,{onSuccess:function(P,I,U,F){x.resetLoader(h,u),x.updateStatsFromPart(h,O);var L={frag:h,part:O,payload:P.data,networkDetails:F};w(L),E(L)},onError:function(P,I,U){x.resetLoader(h,u),_(new c({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:O,response:P,networkDetails:U}))},onAbort:function(P,I,U){h.stats.aborted=O.stats.aborted,x.resetLoader(h,u),_(new c({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:O,networkDetails:U}))},onTimeout:function(P,I,U){x.resetLoader(h,u),_(new c({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:O,networkDetails:U}))}})})},a.updateStatsFromPart=function(h,O){var w=h.stats,x=O.stats,A=x.total;if(w.loaded+=x.loaded,A){var S=Math.round(h.duration/O.duration),T=Math.min(Math.round(w.loaded/A),S),E=S-T,_=E*Math.round(w.loaded/T);w.total=w.loaded+_}else w.total=Math.max(w.loaded,w.total);var u=w.loading,y=x.loading;u.start?u.first+=y.first-y.start:(u.start=y.start,u.first=y.first),u.end=y.end},a.resetLoader=function(h,O){h.loader=null,this.loader===O&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),O.destroy()},s}();function o(s,a){a===void 0&&(a=null);var l=a||s,h={frag:s,part:a,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},O=l.byteRangeStartOffset,w=l.byteRangeEndOffset;return Object(z.isFiniteNumber)(O)&&Object(z.isFiniteNumber)(w)&&(h.rangeStart=O,h.rangeEnd=w),h}var c=function(s){M(a,s);function a(l){for(var h,O=arguments.length,w=new Array(O>1?O-1:0),x=1;x<O;x++)w[x-1]=arguments[x];return h=s.call.apply(s,[this].concat(w))||this,h.data=void 0,h.data=l,h}return a}(W(Error))},"./src/loader/fragment.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"ElementaryStreamTypes",function(){return d}),D.d(V,"BaseSegment",function(){return o}),D.d(V,"Fragment",function(){return c}),D.d(V,"Part",function(){return s});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"),B=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(O,w){return O.__proto__=w,O},g(a,l)}function p(a,l){for(var h=0;h<l.length;h++){var O=l[h];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(a,O.key,O)}}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 o=function(){function a(h){var O;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(O={},O[d.AUDIO]=null,O[d.VIDEO]=null,O[d.AUDIOVIDEO]=null,O),this.baseurl=h}var l=a.prototype;return l.setByteRange=function(O,w){var x=O.split("@",2),A=[];x.length===1?A[0]=w?w.byteRangeEndOffset:0:A[0]=parseInt(x[1]),A[1]=parseInt(x[0])+A[0],this._byteRange=A},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(O){this._url=O}}]),a}(),c=function(a){R(l,a);function l(O,w){var x;return x=a.call(this,w)||this,x._decryptdata=null,x.rawProgramDateTime=null,x.programDateTime=null,x.tagList=[],x.duration=0,x.sn=0,x.levelkey=void 0,x.type=void 0,x.loader=null,x.level=-1,x.cc=0,x.startPTS=void 0,x.endPTS=void 0,x.appendedPTS=void 0,x.startDTS=void 0,x.endDTS=void 0,x.start=0,x.deltaPTS=void 0,x.maxStartPTS=void 0,x.minEndPTS=void 0,x.stats=new k.LoadStats,x.urlId=0,x.data=void 0,x.bitrateTest=!1,x.title=null,x.initSegment=null,x.type=O,x}var h=l.prototype;return h.createInitializationVector=function(w){for(var x=new Uint8Array(16),A=12;A<16;A++)x[A]=w>>8*(15-A)&255;return x},h.setDecryptDataFromLevelKey=function(w,x){var A=w;return(w==null?void 0:w.method)==="AES-128"&&w.uri&&!w.iv&&(A=B.LevelKey.fromURI(w.uri),A.method=w.method,A.iv=this.createInitializationVector(x),A.keyFormat="identity"),A},h.setElementaryStreamInfo=function(w,x,A,S,T,E){E===void 0&&(E=!1);var _=this.elementaryStreams,u=_[w];if(!u){_[w]={startPTS:x,endPTS:A,startDTS:S,endDTS:T,partial:E};return}u.startPTS=Math.min(u.startPTS,x),u.endPTS=Math.max(u.endPTS,A),u.startDTS=Math.min(u.startDTS,S),u.endDTS=Math.max(u.endDTS,T)},h.clearElementaryStreamInfo=function(){var w=this.elementaryStreams;w[d.AUDIO]=null,w[d.VIDEO]=null,w[d.AUDIOVIDEO]=null},f(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var w=this.sn;typeof w!="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'),w=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,w)}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 w=Object(z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+w*1e3}},{key:"encrypted",get:function(){var w;return!!((w=this.decryptdata)!==null&&w!==void 0&&w.keyFormat&&this.decryptdata.uri)}}]),l}(o),s=function(a){R(l,a);function l(h,O,w,x,A){var S;S=a.call(this,w)||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=O,S.index=x;var T=h.enumeratedString("BYTERANGE");return T&&S.setByteRange(T,A),A&&(S.fragOffset=A.fragOffset+A.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 O=this.elementaryStreams;return!!(O.audio||O.video||O.audiovideo)}}]),l}(o)},"./src/loader/key-loader.ts":function(ne,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 B(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var k=B.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,o=this.loaders[d];if(!f.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var c=f.decryptdata.uri;if(c!==this.decrypturl||this.decryptkey===null){var s=this.hls.config;if(o&&(M.logger.warn("abort previous key loader for type:"+d),o.abort()),!c){M.logger.warn("key uri is falsy");return}var a=s.loader,l=f.loader=this.loaders[d]=new a(s);this.decrypturl=c,this.decryptkey=null;var h={url:c,frag:f,responseType:"arraybuffer"},O={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:0},w={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(h,O,w)}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})},B}()},"./src/loader/level-details.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"LevelDetails",function(){return B});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,B=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(ne,V,D){"use strict";D.r(V),D.d(V,"LevelKey",function(){return B});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 B=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(ne,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(ne,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"),B=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,o=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),c=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),s=/\.(mp4|m4s|m4v|m4a)$/i;function a(A){var S,T;return s.test((S=(T=N.parseURL(A))===null||T===void 0?void 0:T.path)!=null?S:"")}var l=function(){function A(){}return A.findGroup=function(T,E){for(var _=0;_<T.length;_++){var u=T[_];if(u.id===E)return u}},A.convertAVC1ToAVCOTI=function(T){var E=T.split(".");if(E.length>2){var _=E.shift()+".";return _+=parseInt(E.shift()).toString(16),_+=("000"+parseInt(E.shift()).toString(16)).substr(-4),_}return T},A.resolve=function(T,E){return N.buildAbsoluteURL(E,T,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(T,E){var _=[],u={},y=!1;f.lastIndex=0;for(var m;(m=f.exec(T))!=null;)if(m[1]){var b=new R.AttrList(m[1]),P={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:A.resolve(m[2],E)},I=b.decimalResolution("RESOLUTION");I&&(P.width=I.width,P.height=I.height),h((b.CODECS||"").split(/[ ,]+/).filter(function(F){return F}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=A.convertAVC1ToAVCOTI(P.videoCodec)),_.push(P)}else if(m[3]){var U=new R.AttrList(m[3]);U["DATA-ID"]&&(y=!0,u[U["DATA-ID"]]=U)}return{levels:_,sessionData:y?u:null}},A.parseMasterPlaylistMedia=function(T,E,_,u){u===void 0&&(u=[]);var y,m=[],b=0;for(d.lastIndex=0;(y=d.exec(T))!==null;){var P=new R.AttrList(y[1]);if(P.TYPE===_){var I={attrs:P,bitrate:0,id:b++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:_,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?A.resolve(P.URI,E):""};if(u.length){var U=A.findGroup(u,I.groupId)||u[0];O(I,U,"audioCodec"),O(I,U,"textCodec")}m.push(I)}}return m},A.parseLevelPlaylist=function(T,E,_,u,y){var m=new B.LevelDetails(E),b=m.fragments,P=null,I=0,U=0,F=0,L=0,v=null,j=new W.Fragment(u,E),K,J,ee,ve=-1,de=!1;for(o.lastIndex=0,m.m3u8=T;(K=o.exec(T))!==null;){de&&(de=!1,j=new W.Fragment(u,E),j.start=F,j.sn=I,j.cc=L,j.level=_,P&&(j.initSegment=P,j.rawProgramDateTime=P.rawProgramDateTime));var me=K[1];if(me){j.duration=parseFloat(me);var ce=(" "+K[2]).slice(1);j.title=ce||null,j.tagList.push(ce?["INF",me,ce]:["INF",me])}else if(K[3])Object(z.isFiniteNumber)(j.duration)&&(j.start=F,ee&&(j.levelkey=ee),j.sn=I,j.level=_,j.cc=L,j.urlId=y,b.push(j),j.relurl=(" "+K[3]).slice(1),x(j,v),v=j,F+=j.duration,I++,U=0,de=!0);else if(K[4]){var pe=(" "+K[4]).slice(1);v?j.setByteRange(pe,v):j.setByteRange(pe)}else if(K[5])j.rawProgramDateTime=(" "+K[5]).slice(1),j.tagList.push(["PROGRAM-DATE-TIME",j.rawProgramDateTime]),ve===-1&&(ve=b.length);else{if(K=K[0].match(c),!K){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(J=1;J<K.length&&!(typeof K[J]!="undefined");J++);var ae=(" "+K[J]).slice(1),he=(" "+K[J+1]).slice(1),$=K[J+2]?(" "+K[J+2]).slice(1):"";switch(ae){case"PLAYLIST-TYPE":m.type=he.toUpperCase();break;case"MEDIA-SEQUENCE":I=m.startSN=parseInt(he);break;case"SKIP":{var ie=new R.AttrList(he),q=ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(q)){m.skippedSegments=q;for(var Ee=q;Ee--;)b.unshift(null);I+=q}var Ae=ie.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ae&&(m.recentlyRemovedDateranges=Ae.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(he);break;case"VERSION":m.version=parseInt(he);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(he||$)&&j.tagList.push($?[he,$]:[he]);break;case"DIS":L++;case"GAP":j.tagList.push([ae]);break;case"BITRATE":j.tagList.push([ae,he]);break;case"DISCONTINUITY-SEQ":L=parseInt(he);break;case"KEY":{var ye,we=new R.AttrList(he),Re=we.enumeratedString("METHOD"),ke=we.URI,Ne=we.hexadecimalInteger("IV"),Ie=we.enumeratedString("KEYFORMATVERSIONS"),Le=we.enumeratedString("KEYID"),Ye=(ye=we.enumeratedString("KEYFORMAT"))!=null?ye:"identity",Qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Qe.indexOf(Ye)>-1){g.logger.warn("Keyformat "+Ye+" is not supported from the manifest");continue}else if(Ye!=="identity")continue;Re&&(ee=k.LevelKey.fromURL(E,ke),ke&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Re)>=0&&(ee.method=Re,ee.keyFormat=Ye,Le&&(ee.keyID=Le),Ie&&(ee.keyFormatVersions=Ie),ee.iv=Ne));break}case"START":{var Xe=new R.AttrList(he),We=Xe.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(We)&&(m.startTimeOffset=We);break}case"MAP":{var Je=new R.AttrList(he);j.relurl=Je.URI,Je.BYTERANGE&&j.setByteRange(Je.BYTERANGE),j.level=_,j.sn="initSegment",ee&&(j.levelkey=ee),j.initSegment=null,P=j,de=!0;break}case"SERVER-CONTROL":{var je=new R.AttrList(he);m.canBlockReload=je.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=je.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&je.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=je.optionalFloat("PART-HOLD-BACK",0),m.holdBack=je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var He=new R.AttrList(he);m.partTarget=He.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Se=m.partList;Se||(Se=m.partList=[]);var qe=U>0?Se[Se.length-1]:void 0,Ke=U++,xe=new W.Part(new R.AttrList(he),j,E,Ke,qe);Se.push(xe),j.duration+=xe.duration;break}case"PRELOAD-HINT":{var Pe=new R.AttrList(he);m.preloadHint=Pe;break}case"RENDITION-REPORT":{var _e=new R.AttrList(he);m.renditionReports=m.renditionReports||[],m.renditionReports.push(_e);break}default:g.logger.warn("line parsed but not handled: "+K);break}}}v&&!v.relurl?(b.pop(),F-=v.duration,m.partList&&(m.fragmentHint=v)):m.partList&&(x(j,v),j.cc=L,m.fragmentHint=j);var le=b.length,fe=b[0],Q=b[le-1];if(F+=m.skippedSegments*m.targetduration,F>0&&le&&Q){m.averagetargetduration=F/le;var Z=Q.sn;m.endSN=Z!=="initSegment"?Z:0,fe&&(m.startCC=fe.cc,fe.initSegment||m.fragments.every(function(re){return re.relurl&&a(re.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),j=new W.Fragment(u,E),j.relurl=Q.relurl,j.level=_,j.sn="initSegment",fe.initSegment=j,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(F+=m.fragmentHint.duration),m.totalduration=F,m.endCC=L,ve>0&&w(b,ve),m},A}();function h(A,S){["video","audio","text"].forEach(function(T){var E=A.filter(function(u){return Object(p.isCodecType)(u,T)});if(E.length){var _=E.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});S[T+"Codec"]=_.length>0?_[0]:E[0],A=A.filter(function(u){return E.indexOf(u)===-1})}}),S.unknownCodecs=A}function O(A,S,T){var E=S[T];E&&(A[T]=E)}function w(A,S){for(var T=A[S],E=S;E--;){var _=A[E];if(!_)return;_.programDateTime=T.programDateTime-_.duration*1e3,T=_}}function x(A,S){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):S!=null&&S.programDateTime&&(A.programDateTime=S.endProgramDateTime),Object(z.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ne,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"),B=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(o){var c=o.type;switch(c){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(o,c){var s=o.url;return(s===void 0||s.indexOf("data:")===0)&&(s=c.url),s}var d=function(){function o(s){this.hls=void 0,this.loaders=Object.create(null),this.hls=s,this.registerListeners()}var c=o.prototype;return c.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)},c.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)},c.createInternalLoader=function(a){var l=this.hls.config,h=l.pLoader,O=l.loader,w=h||O,x=new w(l);return a.loader=x,this.loaders[a.type]=x,x},c.getInternalLoader=function(a){return this.loaders[a.type]},c.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},c.destroyInternalLoaders=function(){for(var a in this.loaders){var l=this.loaders[a];l&&l.destroy(),this.resetInternalLoader(a)}},c.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},c.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})},c.onLevelLoading=function(a,l){var h=l.id,O=l.level,w=l.url,x=l.deliveryDirectives;this.load({id:h,groupId:null,level:O,responseType:"text",type:R.PlaylistContextType.LEVEL,url:w,deliveryDirectives:x})},c.onAudioTrackLoading=function(a,l){var h=l.id,O=l.groupId,w=l.url,x=l.deliveryDirectives;this.load({id:h,groupId:O,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:w,deliveryDirectives:x})},c.onSubtitleTrackLoading=function(a,l){var h=l.id,O=l.groupId,w=l.url,x=l.deliveryDirectives;this.load({id:h,groupId:O,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:w,deliveryDirectives:x})},c.load=function(a){var l,h=this.hls.config,O=this.getInternalLoader(a);if(O){var w=O.context;if(w&&w.url===a.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),O.abort()}var x,A,S,T;switch(a.type){case R.PlaylistContextType.MANIFEST:x=h.manifestLoadingMaxRetry,A=h.manifestLoadingTimeOut,S=h.manifestLoadingRetryDelay,T=h.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:x=0,A=h.levelLoadingTimeOut;break;default:x=h.levelLoadingMaxRetry,A=h.levelLoadingTimeOut,S=h.levelLoadingRetryDelay,T=h.levelLoadingMaxRetryTimeout;break}if(O=this.createInternalLoader(a),(l=a.deliveryDirectives)!==null&&l!==void 0&&l.part){var E;if(a.type===R.PlaylistContextType.LEVEL&&a.level!==null?E=this.hls.levels[a.level].details:a.type===R.PlaylistContextType.AUDIO_TRACK&&a.id!==null?E=this.hls.audioTracks[a.id].details:a.type===R.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(E=this.hls.subtitleTracks[a.id].details),E){var _=E.partTarget,u=E.targetduration;_&&u&&(A=Math.min(Math.max(_*3,u*.8)*1e3,A))}}var y={timeout:A,maxRetry:x,retryDelay:S,maxRetryDelay:T,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};O.load(a,y,m)},c.loadsuccess=function(a,l,h,O){if(O===void 0&&(O=null),h.isSidxRequest){this.handleSidxRequest(a,h),this.handlePlaylistLoaded(a,l,h,O);return}this.resetInternalLoader(h.type);var w=a.data;if(w.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,h,"no EXTM3U delimiter",O);return}l.parsing.start=performance.now(),w.indexOf("#EXTINF:")>0||w.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,l,h,O):this.handleMasterPlaylist(a,l,h,O)},c.loaderror=function(a,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!1,a)},c.loadtimeout=function(a,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!0)},c.handleMasterPlaylist=function(a,l,h,O){var w=this.hls,x=a.data,A=f(a,h),S=k.default.parseMasterPlaylist(x,A),T=S.levels,E=S.sessionData;if(!T.length){this.handleManifestParsingError(a,h,"no level found in manifest",O);return}var _=T.map(function(I){return{id:I.attrs.AUDIO,audioCodec:I.audioCodec}}),u=T.map(function(I){return{id:I.attrs.SUBTITLES,textCodec:I.textCodec}}),y=k.default.parseMasterPlaylistMedia(x,A,"AUDIO",_),m=k.default.parseMasterPlaylistMedia(x,A,"SUBTITLES",u),b=k.default.parseMasterPlaylistMedia(x,A,"CLOSED-CAPTIONS");if(y.length){var P=y.some(function(I){return!I.url});!P&&T[0].audioCodec&&!T[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:""}))}w.trigger(N.Events.MANIFEST_LOADED,{levels:T,audioTracks:y,subtitles:m,captions:b,url:A,stats:l,networkDetails:O,sessionData:E})},c.handleTrackOrLevelPlaylist=function(a,l,h,O){var w=this.hls,x=h.id,A=h.level,S=h.type,T=f(a,h),E=Object(z.isFiniteNumber)(x)?x:0,_=Object(z.isFiniteNumber)(A)?A:E,u=p(h),y=k.default.parseLevelPlaylist(a.data,T,_,u,E);if(!y.fragments.length){w.trigger(N.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:T,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:T};w.trigger(N.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:T,stats:l,networkDetails:O,sessionData:null})}if(l.parsing.end=performance.now(),y.needSidxRanges){var b,P=(b=y.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:P,isSidxRequest:!0,type:S,level:A,levelDetails:y,id:x,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=y,this.handlePlaylistLoaded(a,l,h,O)},c.handleSidxRequest=function(a,l){var h=Object(B.parseSegmentIndex)(new Uint8Array(a.data));if(!h)return;var O=h.references,w=l.levelDetails;O.forEach(function(x,A){var S=x.info,T=w.fragments[A];T.byteRange.length===0&&T.setByteRange(String(1+S.end-S.start)+"@"+String(S.start)),T.initSegment&&T.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},c.handleManifestParsingError=function(a,l,h,O){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:O})},c.handleNetworkError=function(a,l,h,O){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 w=M.ErrorDetails.UNKNOWN,x=!1,A=this.getInternalLoader(a);switch(a.type){case R.PlaylistContextType.MANIFEST:w=h?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,x=!0;break;case R.PlaylistContextType.LEVEL:w=h?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,x=!1;break;case R.PlaylistContextType.AUDIO_TRACK:w=h?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,x=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:w=h?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,x=!1;break}A&&this.resetInternalLoader(a.type);var S={type:M.ErrorTypes.NETWORK_ERROR,details:w,fatal:x,url:a.url,loader:A,context:a,networkDetails:l};O&&(S.response=O),this.hls.trigger(N.Events.ERROR,S)},c.handlePlaylistLoaded=function(a,l,h,O){var w=h.type,x=h.level,A=h.id,S=h.groupId,T=h.loader,E=h.levelDetails,_=h.deliveryDirectives;if(!(E!=null&&E.targetduration)){this.handleManifestParsingError(a,h,"invalid target duration",O);return}if(!T)return;E.live&&(T.getCacheAge&&(E.ageHeader=T.getCacheAge()||0),(!T.getCacheAge||isNaN(E.ageHeader))&&(E.ageHeader=0));switch(w){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(N.Events.LEVEL_LOADED,{details:E,level:x||0,id:A||0,stats:l,networkDetails:O,deliveryDirectives:_});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(N.Events.AUDIO_TRACK_LOADED,{details:E,id:A||0,groupId:S||"",stats:l,networkDetails:O,deliveryDirectives:_});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(N.Events.SUBTITLE_TRACK_LOADED,{details:E,id:A||0,groupId:S||"",stats:l,networkDetails:O,deliveryDirectives:_});break}},o}();V.default=d},"./src/polyfills/number.ts":function(ne,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(ne,V,D){"use strict";D.r(V);var z=function(){function N(){}return N.getSilentFrame=function(W,B){switch(W){case"mp4a.40.2":if(B===1)return new Uint8Array([0,200,0,128,35,128]);if(B===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(B===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(B===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(B===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(B===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(B===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(B===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(B===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(ne,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 B;for(B in M.types)M.types.hasOwnProperty(B)&&(M.types[B]=[B.charCodeAt(0),B.charCodeAt(1),B.charCodeAt(2),B.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]),o=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,f,o,f,d),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,g))},M.box=function(B){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 o=new Uint8Array(k);for(o[0]=k>>24&255,o[1]=k>>16&255,o[2]=k>>8&255,o[3]=k&255,o.set(B,4),f=0,k=8;f<d;f++)o.set(g[f],k),k+=g[f].byteLength;return o},M.hdlr=function(B){return M.box(M.types.hdlr,M.HDLR_TYPES[B])},M.mdat=function(B){return M.box(M.types.mdat,B)},M.mdhd=function(B,k){k*=B;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,B>>24&255,B>>16&255,B>>8&255,B&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(B){return M.box(M.types.mdia,M.mdhd(B.timescale,B.duration),M.hdlr(B.type),M.minf(B))},M.mfhd=function(B){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},M.minf=function(B){return B.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(B)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(B))},M.moof=function(B,k,R){return M.box(M.types.moof,M.mfhd(B),M.traf(R,k))},M.moov=function(B){for(var k=B.length,R=[];k--;)R[k]=M.trak(B[k]);return M.box.apply(null,[M.types.moov,M.mvhd(B[0].timescale,B[0].duration)].concat(R).concat(M.mvex(B)))},M.mvex=function(B){for(var k=B.length,R=[];k--;)R[k]=M.trex(B[k]);return M.box.apply(null,[M.types.mvex].concat(R))},M.mvhd=function(B,k){k*=B;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,B>>24&255,B>>16&255,B>>8&255,B&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(B){var k=B.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(B){return M.box(M.types.stbl,M.stsd(B),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(B){var k=[],R=[],g,p,f;for(g=0;g<B.sps.length;g++)p=B.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<B.pps.length;g++)p=B.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|B.sps.length].concat(k).concat([B.pps.length]).concat(R))),o=B.width,c=B.height,s=B.pixelRatio[0],a=B.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,o>>8&255,o&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d,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([s>>24,s>>16&255,s>>8&255,s&255,a>>24,a>>16&255,a>>8&255,a&255])))},M.esds=function(B){var k=B.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(B.config).concat([6,1,2]))},M.mp4a=function(B){var k=B.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,B.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),M.box(M.types.esds,M.esds(B)))},M.mp3=function(B){var k=B.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,B.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},M.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(B)):M.box(M.types.stsd,M.STSD,M.mp4a(B)):M.box(M.types.stsd,M.STSD,M.avc1(B))},M.tkhd=function(B){var k=B.id,R=B.duration*B.timescale,g=B.width,p=B.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(B,k){var R=M.sdtp(B),g=B.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(B,R.length+16+20+8+16+8+8),R)},M.trak=function(B){return B.duration=B.duration||4294967295,M.box(M.types.trak,M.tkhd(B),M.mdia(B))},M.trex=function(B){var k=B.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(B,k){var R=B.samples||[],g=R.length,p=12+16*g,f=new Uint8Array(p),d,o,c,s,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++)o=R[d],c=o.duration,s=o.size,a=o.flags,l=o.cts,f.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,s>>>24&255,s>>>16&255,s>>>8&255,s&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(B){M.types||M.init();var k=M.moov(B),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(ne,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"),B=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(A){for(var S=1;S<arguments.length;S++){var T=arguments[S];for(var E in T)Object.prototype.hasOwnProperty.call(T,E)&&(A[E]=T[E])}return A},p.apply(this,arguments)}var f=10*1e3,d=1024,o=1152,c=null,s=null,a=!1,l=function(){function A(T,E,_,u){if(u===void 0&&(u=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=T,this.config=E,this.typeSupported=_,this.ISGenerated=!1,c===null){var y=navigator.userAgent||"",m=y.match(/Chrome\/(\d+)/i);c=m?parseInt(m[1]):0}if(s===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);s=b?parseInt(b[1]):0}a=!!c&&c<75||!!s&&s<600}var S=A.prototype;return S.destroy=function(){},S.resetTimeStamp=function(E){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=E},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(E){var _=!1,u=E.reduce(function(y,m){var b=m.pts-y;return b<-4294967296?(_=!0,h(y,m.pts)):b>0?y:m.pts},E[0].pts);return _&&k.logger.debug("PTS rollover detected"),u},S.remux=function(E,_,u,y,m,b,P,I){var U,F,L,v,j,K,J=m,ee=m,ve=E.pid>-1,de=_.pid>-1,me=_.samples.length,ce=E.samples.length>0,pe=me>1,ae=(!ve||ce)&&(!de||pe)||this.ISGenerated||P;if(ae){this.ISGenerated||(L=this.generateIS(E,_,m));var he=this.isVideoContiguous,$=-1;if(pe&&($=O(_.samples),!he&&this.config.forceKeyFrameOnDiscontinuity))if(K=!0,$>0){k.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+me+" video samples due to a missing keyframe");var ie=this.getVideoStartPts(_.samples);_.samples=_.samples.slice($),_.dropped+=$,ee+=(_.samples[0].pts-ie)/(_.timescale||9e4)}else $===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+me+" video samples"),K=!1);if(this.ISGenerated){if(ce&&pe){var q=this.getVideoStartPts(_.samples),Ee=h(E.samples[0].pts,q)-q,Ae=Ee/_.inputTimeScale;J+=Math.max(0,Ae),ee+=Math.max(0,-Ae)}if(ce){if(E.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),L=this.generateIS(E,_,m)),F=this.remuxAudio(E,J,this.isAudioContiguous,b,de||pe||I===R.PlaylistLevelType.AUDIO?ee:void 0),pe){var ye=F?F.endPTS-F.startPTS:0;_.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),L=this.generateIS(E,_,m)),U=this.remuxVideo(_,ee,he,ye)}}else pe&&(U=this.remuxVideo(_,ee,he,0));U&&(U.firstKeyFrame=$,U.independent=$!==-1)}}return this.ISGenerated&&(u.samples.length&&(j=this.remuxID3(u,m)),y.samples.length&&(v=this.remuxText(y,m))),{audio:F,video:U,initSegment:L,independent:K,text:v,id3:j}},S.generateIS=function(E,_,u){var y=E.samples,m=_.samples,b=this.typeSupported,P={},I=!Object(z.isFiniteNumber)(this._initPTS),U="audio/mp4",F,L,v;if(I&&(F=L=Infinity),E.config&&y.length&&(E.timescale=E.samplerate,E.isAAC||(b.mpeg?(U="audio/mpeg",E.codec=""):b.mp3&&(E.codec="mp3")),P.audio={id:"audio",container:U,codec:E.codec,initSegment:!E.isAAC&&b.mpeg?new Uint8Array(0):M.default.initSegment([E]),metadata:{channelCount:E.channelCount}},I&&(v=E.inputTimeScale,F=L=y[0].pts-Math.round(v*u))),_.sps&&_.pps&&m.length&&(_.timescale=_.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:_.codec,initSegment:M.default.initSegment([_]),metadata:{width:_.width,height:_.height}},I)){v=_.inputTimeScale;var j=this.getVideoStartPts(m),K=Math.round(v*u);L=Math.min(L,h(m[0].dts,j)-K),F=Math.min(F,j-K)}if(Object.keys(P).length)return this.ISGenerated=!0,I&&(this._initPTS=F,this._initDTS=L),{tracks:P,initPTS:F,timescale:v}},S.remuxVideo=function(E,_,u,y){var m=E.inputTimeScale,b=E.samples,P=[],I=b.length,U=this._initPTS,F=this.nextAvcDts,L=8,v,j,K,J=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,ve=0,de=!1;if(!u||F===null){var me=_*m,ce=b[0].pts-h(b[0].dts,b[0].pts);F=me-ce}for(var pe=0;pe<I;pe++){var ae=b[pe];if(ae.pts=h(ae.pts-U,F),ae.dts=h(ae.dts-U,F),ae.dts>ae.pts){var he=9e4*.2;ve=Math.max(Math.min(ve,ae.pts-ae.dts),-1*he)}ae.dts<b[pe>0?pe-1:pe].dts&&(de=!0)}de&&b.sort(function(Et,ct){var st=Et.dts-ct.dts,Ot=Et.pts-ct.pts;return st||Ot}),j=b[0].dts,K=b[b.length-1].dts;var $=Math.round((K-j)/(I-1));if(ve<0){if(ve<$*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-$,!0)+" ms");for(var ie=ve,q=0;q<I;q++)b[q].dts=ie=Math.max(ie,b[q].pts-$),b[q].pts=Math.max(ie,b[q].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(ve,!0)+" ms to overcome this issue");for(var Ee=0;Ee<I;Ee++)b[Ee].dts=b[Ee].dts+ve}j=b[0].dts}if(u){var Ae=j-F,ye=Ae>$,we=Ae<-1;if(ye||we){ye?k.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Ae,!0)+" ms ("+Ae+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Ae,!0)+" ms ("+Ae+"dts) overlapping between fragments detected"),j=F;var Re=b[0].pts-Ae;b[0].dts=j,b[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)(Ae,!0)+" ms")}}a&&(j=Math.max(0,j));for(var ke=0,Ne=0,Ie=0;Ie<I;Ie++){for(var Le=b[Ie],Ye=Le.units,Qe=Ye.length,Xe=0,We=0;We<Qe;We++)Xe+=Ye[We].data.length;Ne+=Xe,ke+=Qe,Le.length=Xe,Le.dts=Math.max(Le.dts,j),Le.pts=Math.max(Le.pts,Le.dts,0),J=Math.min(Le.pts,J),ee=Math.max(Le.pts,ee)}K=b[I-1].dts;var Je=Ne+4*ke+8,je;try{je=new Uint8Array(Je)}catch(Et){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Je,reason:"fail allocating video mdat "+Je});return}var He=new DataView(je.buffer);He.setUint32(0,Je),je.set(M.default.types.mdat,4);for(var Se=0;Se<I;Se++){for(var qe=b[Se],Ke=qe.units,xe=0,Pe=0,_e=Ke.length;Pe<_e;Pe++){var le=Ke[Pe],fe=le.data,Q=le.data.byteLength;He.setUint32(L,Q),L+=4,je.set(fe,L),L+=Q,xe+=4+Q}if(Se<I-1)v=b[Se+1].dts-qe.dts;else{var Z=this.config,re=qe.dts-b[Se>0?Se-1:Se].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var oe=Math.floor(Z.maxBufferHole*m),ge=(y?J+y*m:this.nextAudioPts)-qe.pts;ge>oe?(v=ge-re,v<0&&(v=re),k.logger.log("[mp4-remuxer]: It is approximately "+ge/90+" ms to the next segment; using duration "+v/90+" ms for the last video frame.")):v=re}else v=re}var Oe=Math.round(qe.pts-qe.dts);P.push(new w(qe.key,v,xe,Oe))}if(P.length&&c&&c<70){var De=P[0].flags;De.dependsOn=2,De.isNonSync=0}console.assert(v!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=F=K+v,this.isVideoContiguous=!0;var $e=M.default.moof(E.sequenceNumber++,j,p({},E,{samples:P})),tt="video",nt={data1:$e,data2:je,startPTS:J/m,endPTS:(ee+v)/m,startDTS:j/m,endDTS:F/m,type:tt,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:E.dropped};return E.samples=[],E.dropped=0,console.assert(je.length,"MDAT length must not be zero"),nt},S.remuxAudio=function(E,_,u,y,m){var b=E.inputTimeScale,P=E.samplerate?E.samplerate:b,I=b/P,U=E.isAAC?d:o,F=U*I,L=this._initPTS,v=!E.isAAC&&this.typeSupported.mpeg,j=[],K=E.samples,J=v?0:8,ee=this.nextAudioPts||-1,ve=_*b;if(this.isAudioContiguous=u=u||K.length&&ee>0&&(y&&Math.abs(ve-ee)<9e3||Math.abs(h(K[0].pts-L,ve)-ee)<20*F),K.forEach(function(fe){fe.pts=h(fe.pts-L,ve)}),!u||ee<0){if(K=K.filter(function(fe){return fe.pts>=0}),!K.length)return;m===0?ee=0:y?ee=Math.max(0,ve):ee=K[0].pts}if(E.isAAC)for(var de=m!==void 0,me=this.config.maxAudioFramesDrift,ce=0,pe=ee;ce<K.length;ce++){var ae=K[ce],he=ae.pts,$=he-pe,ie=Math.abs(1e3*$/b);if($<=-me*F&&de)ce===0&&(k.logger.warn("Audio frame @ "+(he/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/b)+" ms."),this.nextAudioPts=ee=pe=he);else if($>=me*F&&ie<f&&de){var q=Math.round($/F);pe=he-q*F,pe<0&&(q--,pe+=F),ce===0&&(this.nextAudioPts=ee=pe),k.logger.warn("[mp4-remuxer]: Injecting "+q+" audio frame @ "+(pe/b).toFixed(3)+"s due to "+Math.round(1e3*$/b)+" ms gap.");for(var Ee=0;Ee<q;Ee++){var Ae=Math.max(pe,0),ye=N.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);ye||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=ae.unit.subarray()),K.splice(ce,0,{unit:ye,pts:Ae}),pe+=F,ce++}}ae.pts=pe,pe+=F}for(var we=null,Re=null,ke,Ne=0,Ie=K.length;Ie--;)Ne+=K[Ie].unit.byteLength;for(var Le=0,Ye=K.length;Le<Ye;Le++){var Qe=K[Le],Xe=Qe.unit,We=Qe.pts;if(Re!==null){var Je=j[Le-1];Je.duration=Math.round((We-Re)/I)}else if(u&&E.isAAC&&(We=ee),we=We,Ne>0){Ne+=J;try{ke=new Uint8Array(Ne)}catch(fe){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ne,reason:"fail allocating audio mdat "+Ne});return}if(!v){var je=new DataView(ke.buffer);je.setUint32(0,Ne),ke.set(M.default.types.mdat,4)}}else return;ke.set(Xe,J);var He=Xe.byteLength;J+=He,j.push(new w(!0,U,He,0)),Re=We}var Se=j.length;if(!Se)return;var qe=j[j.length-1];this.nextAudioPts=ee=Re+I*qe.duration;var Ke=v?new Uint8Array(0):M.default.moof(E.sequenceNumber++,we/I,p({},E,{samples:j}));E.samples=[];var xe=we/b,Pe=ee/b,_e="audio",le={data1:Ke,data2:ke,startPTS:xe,endPTS:Pe,startDTS:xe,endDTS:Pe,type:_e,hasAudio:!0,hasVideo:!1,nb:Se};return this.isAudioContiguous=!0,console.assert(ke.length,"MDAT length must not be zero"),le},S.remuxEmptyAudio=function(E,_,u,y){var m=E.inputTimeScale,b=E.samplerate?E.samplerate:m,P=m/b,I=this.nextAudioPts,U=(I!==null?I:y.startDTS*m)+this._initDTS,F=y.endDTS*m+this._initDTS,L=P*d,v=Math.ceil((F-U)/L),j=N.default.getSilentFrame(E.manifestCodec||E.codec,E.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 K=[],J=0;J<v;J++){var ee=U+J*L;K.push({unit:j,pts:ee,dts:ee})}return E.samples=K,this.remuxAudio(E,_,u,!1)},S.remuxID3=function(E,_){var u=E.samples.length;if(!u)return;for(var y=E.inputTimeScale,m=this._initPTS,b=this._initDTS,P=0;P<u;P++){var I=E.samples[P];I.pts=h(I.pts-m,_*y)/y,I.dts=h(I.dts-b,_*y)/y}var U=E.samples;return E.samples=[],{samples:U}},S.remuxText=function(E,_){var u=E.samples.length;if(!u)return;for(var y=E.inputTimeScale,m=this._initPTS,b=0;b<u;b++){var P=E.samples[b];P.pts=h(P.pts-m,_*y)/y}E.samples.sort(function(U,F){return U.pts-F.pts});var I=E.samples;return E.samples=[],{samples:I}},A}();function h(A,S){var T;if(S===null)return A;for(S<A?T=-8589934592:T=8589934592;Math.abs(A-S)>4294967296;)A+=T;return A}function O(A){for(var S=0;S<A.length;S++)if(A[S].key)return S;return-1}var w=function(S,T,E,_){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=T,this.size=E,this.cts=_,this.flags=new x(S)},x=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(ne,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"),B=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,o,c){this.audioCodec=o,this.videoCodec=c,this.generateInitSegment(d),this.emitInitSegment=!0},p.generateInitSegment=function(d){var o=this.audioCodec,c=this.videoCodec;if(!d||!d.byteLength){this.initTracks=void 0,this.initData=void 0;return}var s=this.initData=Object(N.parseInitSegment)(d);o||(o=R(s.audio,M.ElementaryStreamTypes.AUDIO)),c||(c=R(s.video,M.ElementaryStreamTypes.VIDEO));var a={};s.audio&&s.video?a.audiovideo={container:"video/mp4",codec:o+","+c,initSegment:d,id:"main"}:s.audio?a.audio={container:"audio/mp4",codec:o,initSegment:d,id:"audio"}:s.video?a.video={container:"video/mp4",codec:c,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,o,c,s,a){var l=this.initPTS,h=this.lastEndDTS,O={audio:void 0,video:void 0,text:s,id3:c,initSegment:void 0};Object(z.isFiniteNumber)(h)||(h=this.lastEndDTS=a||0);var w=o.samples;if(!w||!w.length)return O;var x={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(w),A=this.initData),!A||!A.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),O;this.emitInitSegment&&(x.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(l)||(this.initPTS=x.initPTS=l=k(A,w,h));var S=Object(N.getDuration)(w,A),T=h,E=S+T;Object(N.offsetStartDTS)(A,w,l),S>0?this.lastEndDTS=E:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var _=!!A.audio,u=!!A.video,y="";_&&(y+="audio"),u&&(y+="video");var m={data1:w,startPTS:T,startDTS:T,endPTS:E,endDTS:E,type:y,hasAudio:_,hasVideo:u,nb:1,dropped:0};return O.audio=m.type==="audio"?m:void 0,O.video=m.type!=="audio"?m:void 0,O.text=s,O.id3=c,O.initSegment=x,O},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=B},"./src/task-loop.ts":function(ne,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(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!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(ne,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(B){B.MANIFEST="m",B.AUDIO="a",B.VIDEO="v",B.MUXED="av",B.INIT="i",B.CAPTION="c",B.TIMED_TEXT="tt",B.KEY="k",B.OTHER="o"})(N||(N={}));var M;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(M||(M={}));var W;(function(B){B.VOD="v",B.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(ne,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 B}),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,o=g!==void 0?g-d:0;return p&&o<p?f?M.v2:M.Yes:M.No}var B=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(ne,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(ne,V,D){"use strict";D.r(V),D.d(V,"ChunkMetadata",function(){return z});var z=function(W,B,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=B,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(ne,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 B=W.prototype;return B.decimalInteger=function(R){var g=parseInt(this[R],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},B.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},B.hexadecimalIntegerAsNumber=function(R){var g=parseInt(this[R],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},B.decimalFloatingPoint=function(R){return parseFloat(this[R])},B.optionalFloat=function(R,g){var p=this[R];return p?parseFloat(p):g},B.enumeratedString=function(R){return this[R]},B.bool=function(R){return this[R]==="YES"},B.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(ne,V,D){"use strict";D.r(V);var z={search:function(M,W){for(var B=0,k=M.length-1,R=null,g=null;B<=k;){R=(B+k)/2|0,g=M[R];var p=W(g);if(p>0)B=R+1;else if(p<0)k=R-1;else return g}return null}};V.default=z},"./src/utils/buffer-helper.ts":function(ne,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(o){}return{len:0,start:R,end:R,nextStart:void 0}},W.bufferedInfo=function(k,R,g){R=Math.max(0,R),k.sort(function(x,A){var S=x.start-A.start;return S||A.end-x.end});var p=[];if(g)for(var f=0;f<k.length;f++){var d=p.length;if(d){var o=p[d-1].end;k[f].start-o<g?k[f].end>o&&(p[d-1].end=k[f].end):p.push(k[f])}else p.push(k[f])}else p=k;for(var c=0,s,a=R,l=R,h=0;h<p.length;h++){var O=p[h].start,w=p[h].end;if(R+g>=O&&R<w)a=O,l=w,c=l-R;else if(R+g<O){s=O;break}}return{len:c,start:a||0,end:l||0,nextStart:s}},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(ne,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(E){var _=E;return N.hasOwnProperty(E)&&(_=N[E]),String.fromCharCode(_)},W=15,B=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(T){T[T.ERROR=0]="ERROR",T[T.TEXT=1]="TEXT",T[T.WARNING=2]="WARNING",T[T.INFO=2]="INFO",T[T.DEBUG=3]="DEBUG",T[T.DATA=3]="DATA"})(d||(d={}));var o=function(){function T(){this.time=null,this.verboseLevel=d.ERROR}var E=T.prototype;return E.log=function(u,y){this.verboseLevel>=u&&z.logger.log(this.time+" ["+u+"] "+y)},T}(),c=function(E){for(var _=[],u=0;u<E.length;u++)_.push(E[u].toString(16));return _},s=function(){function T(_,u,y,m,b){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=_||"white",this.underline=u||!1,this.italics=y||!1,this.background=m||"black",this.flash=b||!1}var E=T.prototype;return E.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},E.setStyles=function(u){for(var y=["foreground","underline","italics","background","flash"],m=0;m<y.length;m++){var b=y[m];u.hasOwnProperty(b)&&(this[b]=u[b])}},E.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},E.equals=function(u){return this.foreground===u.foreground&&this.underline===u.underline&&this.italics===u.italics&&this.background===u.background&&this.flash===u.flash},E.copy=function(u){this.foreground=u.foreground,this.underline=u.underline,this.italics=u.italics,this.background=u.background,this.flash=u.flash},E.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},T}(),a=function(){function T(_,u,y,m,b,P){this.uchar=void 0,this.penState=void 0,this.uchar=_||" ",this.penState=new s(u,y,m,b,P)}var E=T.prototype;return E.reset=function(){this.uchar=" ",this.penState.reset()},E.setChar=function(u,y){this.uchar=u,this.penState.copy(y)},E.setPenState=function(u){this.penState.copy(u)},E.equals=function(u){return this.uchar===u.uchar&&this.penState.equals(u.penState)},E.copy=function(u){this.uchar=u.uchar,this.penState.copy(u.penState)},E.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},T}(),l=function(){function T(_){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var u=0;u<B;u++)this.chars.push(new a);this.logger=_,this.pos=0,this.currPenState=new s}var E=T.prototype;return E.equals=function(u){for(var y=!0,m=0;m<B;m++)if(!this.chars[m].equals(u.chars[m])){y=!1;break}return y},E.copy=function(u){for(var y=0;y<B;y++)this.chars[y].copy(u.chars[y])},E.isEmpty=function(){for(var u=!0,y=0;y<B;y++)if(!this.chars[y].isEmpty()){u=!1;break}return u},E.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(d.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(d.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},E.moveCursor=function(u){var y=this.pos+u;if(u>1)for(var m=this.pos+1;m<y+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(y)},E.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},E.insertChar=function(u){u>=144&&this.backSpace();var y=M(u);if(this.pos>=B){this.logger.log(d.ERROR,"Cannot insert "+u.toString(16)+" ("+y+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(y,this.currPenState),this.moveCursor(1)},E.clearFromPos=function(u){var y;for(y=u;y<B;y++)this.chars[y].reset()},E.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},E.clearToEndOfRow=function(){this.clearFromPos(this.pos)},E.getTextString=function(){for(var u=[],y=!0,m=0;m<B;m++){var b=this.chars[m].uchar;b!==" "&&(y=!1),u.push(b)}return y?"":u.join("")},E.setPenStyles=function(u){this.currPenState.setStyles(u);var y=this.chars[this.pos];y.setPenState(this.currPenState)},T}(),h=function(){function T(_){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var u=0;u<W;u++)this.rows.push(new l(_));this.logger=_,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var E=T.prototype;return E.reset=function(){for(var u=0;u<W;u++)this.rows[u].clear();this.currRow=W-1},E.equals=function(u){for(var y=!0,m=0;m<W;m++)if(!this.rows[m].equals(u.rows[m])){y=!1;break}return y},E.copy=function(u){for(var y=0;y<W;y++)this.rows[y].copy(u.rows[y])},E.isEmpty=function(){for(var u=!0,y=0;y<W;y++)if(!this.rows[y].isEmpty()){u=!1;break}return u},E.backSpace=function(){var u=this.rows[this.currRow];u.backSpace()},E.clearToEndOfRow=function(){var u=this.rows[this.currRow];u.clearToEndOfRow()},E.insertChar=function(u){var y=this.rows[this.currRow];y.insertChar(u)},E.setPen=function(u){var y=this.rows[this.currRow];y.setPenStyles(u)},E.moveCursor=function(u){var y=this.rows[this.currRow];y.moveCursor(u)},E.setCursor=function(u){this.logger.log(d.INFO,"setCursor: "+u);var y=this.rows[this.currRow];y.setCursor(u)},E.setPAC=function(u){this.logger.log(d.INFO,"pacData = "+JSON.stringify(u));var y=u.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 b=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var I=P.rows[b].cueStartTime,U=this.logger.time;if(I&&U!==null&&I<U)for(var F=0;F<this.nrRollUpRows;F++)this.rows[y-this.nrRollUpRows+F+1].copy(P.rows[b+F])}}this.currRow=y;var L=this.rows[this.currRow];if(u.indent!==null){var v=u.indent,j=Math.max(v-1,0);L.setCursor(u.indent),u.color=L.chars[j].penState.foreground}var K={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(K)},E.setBkgData=function(u){this.logger.log(d.INFO,"bkgData = "+JSON.stringify(u)),this.backSpace(),this.setPen(u),this.insertChar(32)},E.setRollUpRows=function(u){this.nrRollUpRows=u},E.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(d.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(d.TEXT,this.getDisplayText());var u=this.currRow+1-this.nrRollUpRows,y=this.rows.splice(u,1)[0];y.clear(),this.rows.splice(this.currRow,0,y),this.logger.log(d.INFO,"Rolling up")},E.getDisplayText=function(u){u=u||!1;for(var y=[],m="",b=-1,P=0;P<W;P++){var I=this.rows[P].getTextString();I&&(b=P+1,u?y.push("Row "+b+": '"+I+"'"):y.push(I.trim()))}return y.length>0&&(u?m="["+y.join(" | ")+"]":m=y.join(`
`)),m},E.getTextAndFormat=function(){return this.rows},T}(),O=function(){function T(_,u,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=_,this.outputFilter=u,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 E=T.prototype;return E.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},E.getHandler=function(){return this.outputFilter},E.setHandler=function(u){this.outputFilter=u},E.setPAC=function(u){this.writeScreen.setPAC(u)},E.setBkgData=function(u){this.writeScreen.setBkgData(u)},E.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(d.INFO,"MODE="+u),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=u},E.insertChars=function(u){for(var y=0;y<u.length;y++)this.writeScreen.insertChar(u[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())},E.ccRCL=function(){this.logger.log(d.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},E.ccBS=function(){if(this.logger.log(d.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},E.ccAOF=function(){},E.ccAON=function(){},E.ccDER=function(){this.logger.log(d.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},E.ccRU=function(u){this.logger.log(d.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},E.ccFON=function(){this.logger.log(d.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},E.ccRDC=function(){this.logger.log(d.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},E.ccTR=function(){this.logger.log(d.INFO,"TR"),this.setMode("MODE_TEXT")},E.ccRTD=function(){this.logger.log(d.INFO,"RTD"),this.setMode("MODE_TEXT")},E.ccEDM=function(){this.logger.log(d.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},E.ccCR=function(){this.logger.log(d.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},E.ccENM=function(){this.logger.log(d.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},E.ccEOC=function(){if(this.logger.log(d.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var u=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=u,this.writeScreen=this.nonDisplayedMemory,this.logger.log(d.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},E.ccTO=function(u){this.logger.log(d.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},E.ccMIDROW=function(u){var y={flash:!1};if(y.underline=u%2===1,y.italics=u>=46,y.italics)y.foreground="white";else{var m=Math.floor(u/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];y.foreground=b[m]}this.logger.log(d.INFO,"MIDROW: "+JSON.stringify(y)),this.writeScreen.setPen(y)},E.outputDataUpdate=function(u){u===void 0&&(u=!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),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:y),this.lastOutputScreen.copy(this.displayedMemory))},E.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},T}(),w=function(){function T(_,u,y){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new o;this.channels=[null,new O(_,u,m),new O(_+1,y,m)],this.cmdHistory=S(),this.logger=m}var E=T.prototype;return E.getHandler=function(u){return this.channels[u].getHandler()},E.setHandler=function(u,y){this.channels[u].setHandler(y)},E.addData=function(u,y){var m,b,P,I=!1;this.logger.time=u;for(var U=0;U<y.length;U+=2){if(b=y[U]&127,P=y[U+1]&127,b===0&&P===0)continue;if(this.logger.log(d.DATA,"["+c([y[U],y[U+1]])+"] -> ("+c([b,P])+")"),m=this.parseCmd(b,P),m||(m=this.parseMidrow(b,P)),m||(m=this.parsePAC(b,P)),m||(m=this.parseBackgroundAttributes(b,P)),!m&&(I=this.parseChars(b,P),I)){var F=this.currentChannel;if(F&&F>0){var L=this.channels[F];L.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 "+c([b,P])+" orig: "+c([y[U],y[U+1]]))}},E.parseCmd=function(u,y){var m=this.cmdHistory,b=(u===20||u===28||u===21||u===29)&&y>=32&&y<=47,P=(u===23||u===31)&&y>=33&&y<=35;if(!(b||P))return!1;if(A(u,y,m))return x(null,null,m),this.logger.log(d.DEBUG,"Repeated command ("+c([u,y])+") is dropped"),!0;var I=u===20||u===21||u===23?1:2,U=this.channels[I];return u===20||u===21||u===28||u===29?y===32?U.ccRCL():y===33?U.ccBS():y===34?U.ccAOF():y===35?U.ccAON():y===36?U.ccDER():y===37?U.ccRU(2):y===38?U.ccRU(3):y===39?U.ccRU(4):y===40?U.ccFON():y===41?U.ccRDC():y===42?U.ccTR():y===43?U.ccRTD():y===44?U.ccEDM():y===45?U.ccCR():y===46?U.ccENM():y===47&&U.ccEOC():U.ccTO(y-32),x(u,y,m),this.currentChannel=I,!0},E.parseMidrow=function(u,y){var m=0;if((u===17||u===25)&&y>=32&&y<=47){if(u===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(d.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[m];return b?(b.ccMIDROW(y),this.logger.log(d.DEBUG,"MIDROW ("+c([u,y])+")"),!0):!1}return!1},E.parsePAC=function(u,y){var m,b=this.cmdHistory,P=(u>=17&&u<=23||u>=25&&u<=31)&&y>=64&&y<=127,I=(u===16||u===24)&&y>=64&&y<=95;if(!(P||I))return!1;if(A(u,y,b))return x(null,null,b),!0;var U=u<=23?1:2;y>=64&&y<=95?m=U===1?k[u]:g[u]:m=U===1?R[u]:p[u];var F=this.channels[U];return F?(F.setPAC(this.interpretPAC(m,y)),x(u,y,b),this.currentChannel=U,!0):!1},E.interpretPAC=function(u,y){var m,b={color:null,italics:!1,indent:null,underline:!1,row:u};return y>95?m=y-96:m=y-64,b.underline=(m&1)===1,m<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((m-16)/2)*4,b},E.parseChars=function(u,y){var m,b=null,P=null;if(u>=25?(m=2,P=u-8):(m=1,P=u),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),b=[I]}else u>=32&&u<=127&&(b=y===0?[u]:[u,y]);if(b){var U=c(b);this.logger.log(d.DEBUG,"Char codes = "+U.join(",")),x(u,y,this.cmdHistory)}return b},E.parseBackgroundAttributes=function(u,y){var m=(u===16||u===24)&&y>=32&&y<=47,b=(u===23||u===31)&&y>=45&&y<=47;if(!(m||b))return!1;var P,I={};u===16||u===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 U=u<=23?1:2,F=this.channels[U];return F.setBkgData(I),x(u,y,this.cmdHistory),!0},E.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var y=this.channels[u];y&&y.reset()}this.cmdHistory=S()},E.cueSplitAtTime=function(u){for(var y=0;y<this.channels.length;y++){var m=this.channels[y];m&&m.cueSplitAtTime(u)}},T}();function x(T,E,_){_.a=T,_.b=E}function A(T,E,_){return _.a===T&&_.b===E}function S(){return{a:null,b:null}}V.default=w},"./src/utils/codecs.ts":function(ne,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,B){var k=z[B];return!!k&&k[W.slice(0,4)]===!0}function M(W,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(ne,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/,B={newCue:function(R,g,p,f){for(var d=[],o,c,s,a,l,h=self.VTTCue||self.TextTrackCue,O=0;O<f.rows.length;O++)if(o=f.rows[O],s=!0,a=0,l="",!o.isEmpty()){for(var w=0;w<o.chars.length;w++)W.test(o.chars[w].uchar)&&s?a++:(l+=o.chars[w].uchar,s=!1);o.cueStartTime=g,g===p&&(p+=1e-4),a>=16?a--:a++;var x=Object(z.fixLineBreaks)(l.trim()),A=Object(N.generateCueId)(g,p,x);(!R||!R.cues||!R.cues.getCueById(A))&&(c=new h(g,p,x),c.id=A,c.line=O+1,c.align="left",c.position=10+Math.min(80,Math.floor(a*8/32)*10),d.push(c))}return R&&d.length&&(d.sort(function(S,T){return S.line==="auto"||T.line==="auto"?0:S.line>8&&T.line>8?T.line-S.line:S.line-T.line}),d.forEach(function(S){return Object(M.addCueToTrack)(R,S)})),d}};V.default=B},"./src/utils/discontinuities.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"findFirstFragWithCC",function(){return W}),D.d(V,"shouldAlignOnDiscontinuities",function(){return B}),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 o}),D.d(V,"alignMediaPlaylistByPDT",function(){return c});var z=D("./src/polyfills/number.ts"),N=D("./src/utils/logger.ts"),M=D("./src/controller/level-helper.ts");function W(s,a){for(var l=null,h=0,O=s.length;h<O;h++){var w=s[h];if(w&&w.cc===a){l=w;break}}return l}function B(s,a,l){return!!(a.details&&(l.endCC>l.startCC||s&&s.cc<l.startCC))}function k(s,a){var l=s.fragments,h=a.fragments;if(!h.length||!l.length){N.logger.log("No fragments to align");return}var O=W(l,h[0].cc);if(!O||O&&!O.startPTS){N.logger.log("No frag in previous level to align on");return}return O}function R(s,a){if(s){var l=s.start+a;s.start=s.startPTS=l,s.endPTS=l+s.duration}}function g(s,a){for(var l=a.fragments,h=0,O=l.length;h<O;h++)R(l[h],s);a.fragmentHint&&R(a.fragmentHint,s),a.alignedSliding=!0}function p(s,a,l){if(!a)return;f(s,l,a),!l.alignedSliding&&a.details&&d(l,a.details),!l.alignedSliding&&a.details&&!l.skippedSegments&&Object(M.adjustSliding)(a.details,l)}function f(s,a,l){if(B(s,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(s,a){if(!a.fragments.length||!s.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,h=s.fragments[0].programDateTime,O=(h-l)/1e3+a.fragments[0].start;O&&Object(z.isFiniteNumber)(O)&&(N.logger.log("Adjusting PTS using programDateTime delta "+(h-l)+"ms, sliding:"+O.toFixed(3)+" "+s.url+" "),g(O,s))}function o(s,a){var l=s.programDateTime;if(!l)return;var h=(l-a)/1e3;s.start=s.startPTS=h,s.endPTS=h+s.duration}function c(s,a){if(!a.fragments.length||!s.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,h=a.fragments[0].start,O=l-h*1e3;s.fragments.forEach(function(w){o(w,O)}),s.fragmentHint&&o(s.fragmentHint,O),s.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ne,V,D){"use strict";D.r(V);var z=D("./src/utils/ewma.ts"),N=function(){function M(B,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(B),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(ne,V,D){"use strict";D.r(V);var z=function(){function N(W,B,k){B===void 0&&(B=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_=B,this.totalWeight_=k}var M=N.prototype;return M.sample=function(B,k){var R=Math.pow(this.alpha_,B);this.estimate_=k*(1-R)+R*this.estimate_,this.totalWeight_+=B},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},N}();V.default=z},"./src/utils/fetch-loader.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"fetchSupported",function(){return o});var z=D("./src/polyfills/number.ts"),N=D("./src/loader/load-stats.ts"),M=D("./src/demux/chunk-cache.ts");function W(h,O){h.prototype=Object.create(O.prototype),h.prototype.constructor=h,p(h,O)}function B(h){var O=typeof Map=="function"?new Map:void 0;return B=function(x){if(x===null||!g(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof O!="undefined"){if(O.has(x))return O.get(x);O.set(x,A)}function A(){return k(x,arguments,f(this).constructor)}return A.prototype=Object.create(x.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),p(A,x)},B(h)}function k(h,O,w){return R()?k=Reflect.construct:k=function(A,S,T){var E=[null];E.push.apply(E,S);var _=Function.bind.apply(A,E),u=new _;return T&&p(u,T.prototype),u},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,O){return p=Object.setPrototypeOf||function(x,A){return x.__proto__=A,x},p(h,O)}function f(h){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},f(h)}function d(){return d=Object.assign||function(h){for(var O=1;O<arguments.length;O++){var w=arguments[O];for(var x in w)Object.prototype.hasOwnProperty.call(w,x)&&(h[x]=w[x])}return h},d.apply(this,arguments)}function o(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var c=function(){function h(w){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=w.fetchSetup||a,this.controller=new self.AbortController,this.stats=new N.LoadStats}var O=h.prototype;return O.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},O.abortInternal=function(){var x=this.response;(!x||!x.ok)&&(this.stats.aborted=!0,this.controller.abort())},O.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},O.load=function(x,A,S){var T=this,E=this.stats;if(E.loading.start)throw new Error("Loader can only be used once.");E.loading.start=self.performance.now();var _=s(x,this.controller.signal),u=S.onProgress,y=x.responseType==="arraybuffer",m=y?"byteLength":"length";this.context=x,this.config=A,this.callbacks=S,this.request=this.fetchSetup(x,_),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){T.abortInternal(),S.onTimeout(E,x,T.response)},A.timeout),self.fetch(this.request).then(function(b){if(T.response=T.loader=b,!b.ok){var P=b.status,I=b.statusText;throw new l(I||"fetch, bad network response",P,b)}return E.loading.first=Math.max(self.performance.now(),E.loading.start),E.total=parseInt(b.headers.get("Content-Length")||"0"),u&&Object(z.isFiniteNumber)(A.highWaterMark)?T.loadProgressively(b,E,x,A.highWaterMark,u):y?b.arrayBuffer():b.text()}).then(function(b){var P=T.response;self.clearTimeout(T.requestTimeout),E.loading.end=Math.max(self.performance.now(),E.loading.first),E.loaded=E.total=b[m];var I={url:P.url,data:b};u&&!Object(z.isFiniteNumber)(A.highWaterMark)&&u(E,x,b,P),S.onSuccess(I,E,x,P)}).catch(function(b){if(self.clearTimeout(T.requestTimeout),E.aborted)return;var P=b.code||0;S.onError({code:P,text:b.message},x,b.details)})},O.getCacheAge=function(){var x=null;if(this.response){var A=this.response.headers.get("age");x=A?parseFloat(A):null}return x},O.loadProgressively=function(x,A,S,T,E){T===void 0&&(T=0);var _=new M.default,u=x.body.getReader(),y=function m(){return u.read().then(function(b){if(b.done)return _.dataLength&&E(A,S,_.flush(),x),Promise.resolve(new ArrayBuffer(0));var P=b.value,I=P.length;return A.loaded+=I,I<T||_.dataLength?(_.push(P),_.dataLength>=T&&E(A,S,_.flush(),x)):E(A,S,P,x),m()}).catch(function(){return Promise.reject()})};return y()},h}();function s(h,O){var w={method:"GET",mode:"cors",credentials:"same-origin",signal:O,headers:new self.Headers(d({},h.headers))};return h.rangeEnd&&w.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),w}function a(h,O){return new self.Request(h.url,O)}var l=function(h){W(O,h);function O(w,x,A){var S;return S=h.call(this,w)||this,S.code=void 0,S.details=void 0,S.code=x,S.details=A,S}return O}(B(Error));V.default=c},"./src/utils/imsc1-ttml-parser.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"IMSC1_CODEC",function(){return g}),D.d(V,"parseIMSC1",function(){return o});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"),B=D("./src/utils/timescale-conversion.ts"),k=D("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(T){for(var E=1;E<arguments.length;E++){var _=arguments[E];for(var u in _)Object.prototype.hasOwnProperty.call(_,u)&&(T[u]=_[u])}return T},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 o(T,E,_,u,y){var m=Object(z.findBox)(new Uint8Array(T),["mdat"]);if(m.length===0){y(new Error("Could not parse IMSC1 mdat"));return}var b=m[0],P=Object(W.utf8ArrayToStr)(new Uint8Array(T,b.start,b.end-b.start)),I=Object(B.toTimescaleFromScale)(E,1,_);try{u(c(P,I))}catch(U){y(U)}}function c(T,E){var _=new DOMParser,u=_.parseFromString(T,"text/xml"),y=u.getElementsByTagName("tt")[0];if(!y)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(m).reduce(function(L,v){return L[v]=y.getAttribute("ttp:"+v)||m[v],L},{}),P=y.getAttribute("xml:space")!=="preserve",I=a(s(y,"styling","style")),U=a(s(y,"layout","region")),F=s(y,"body","[begin]");return[].map.call(F,function(L){var v=l(L,P);if(!v||!L.hasAttribute("begin"))return null;var j=x(L.getAttribute("begin"),b),K=x(L.getAttribute("dur"),b),J=x(L.getAttribute("end"),b);if(j===null)throw w(L);if(J===null){if(K===null)throw w(L);J=j+K}var ee=new M.default(j-E,J-E,v);ee.id=Object(k.generateCueId)(ee.startTime,ee.endTime,ee.text);var ve=U[L.getAttribute("region")],de=I[L.getAttribute("style")];ee.position=10,ee.size=80;var me=h(ve,de),ce=me.textAlign;if(ce){var pe=d[ce];pe&&(ee.lineAlign=pe),ee.align=ce}return R(ee,me),ee}).filter(function(L){return L!==null})}function s(T,E,_){var u=T.getElementsByTagName(E)[0];return u?[].slice.call(u.querySelectorAll(_)):[]}function a(T){return T.reduce(function(E,_){var u=_.getAttribute("xml:id");return u&&(E[u]=_),E},{})}function l(T,E){return[].slice.call(T.childNodes).reduce(function(_,u,y){var m;return u.nodeName==="br"&&y?_+`
`:(m=u.childNodes)!==null&&m!==void 0&&m.length?l(u,E):E?_+u.textContent.trim().replace(/\s+/g," "):_+u.textContent},"")}function h(T,E){var _="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(y,m){var b=O(E,_,m)||O(T,_,m);return b&&(y[m]=b),y},{})}function O(T,E,_){return T.hasAttributeNS(E,_)?T.getAttributeNS(E,_):null}function w(T){return new Error("Could not parse ttml timestamp "+T)}function x(T,E){if(!T)return null;var _=Object(N.parseTimeStamp)(T);return _===null&&(p.test(T)?_=A(T,E):f.test(T)&&(_=S(T,E))),_}function A(T,E){var _=p.exec(T),u=(_[4]|0)+(_[5]|0)/E.subFrameRate;return(_[1]|0)*3600+(_[2]|0)*60+(_[3]|0)+u/E.frameRate}function S(T,E){var _=f.exec(T),u=Number(_[1]),y=_[2];switch(y){case"h":return u*3600;case"m":return u*60;case"ms":return u*1e3;case"f":return u/E.frameRate;case"t":return u/E.tickRate}return u}},"./src/utils/logger.ts":function(ne,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 B(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(o){M[o]=g[o]?g[o].bind(g):W(o)})}function k(g){if(self.console&&g===!0||typeof g=="object"){B(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(ne,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(ne,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(ne,V,D){"use strict";D.r(V),D.d(V,"bin2str",function(){return B}),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 o}),D.d(V,"getDuration",function(){return c}),D.d(V,"computeRawDurationFromSamples",function(){return s}),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 B(O){return String.fromCharCode.apply(null,O)}function k(O,w){"data"in O&&(w+=O.start,O=O.data);var x=O[w]<<8|O[w+1];return x<0?65536+x:x}function R(O,w){"data"in O&&(w+=O.start,O=O.data);var x=O[w]<<24|O[w+1]<<16|O[w+2]<<8|O[w+3];return x<0?4294967296+x:x}function g(O,w,x){"data"in O&&(w+=O.start,O=O.data),O[w]=x>>24,O[w+1]=x>>16&255,O[w+2]=x>>8&255,O[w+3]=x&255}function p(O,w){var x=[];if(!w.length)return x;var A,S,T;"data"in O?(A=O.data,S=O.start,T=O.end):(A=O,S=0,T=A.byteLength);for(var E=S;E<T;){var _=R(A,E),u=B(A.subarray(E+4,E+8)),y=_>1?E+_:T;if(u===w[0])if(w.length===1)x.push({data:A,start:E+8,end:y});else{var m=p({data:A,start:E+8,end:y},w.slice(1));m.length&&W.apply(x,m)}E=y}return x}function f(O){var w=p(O,["moov"]),x=w[0],A=x?x.end:null,S=p(O,["sidx"]);if(!S||!S[0])return null;var T=[],E=S[0],_=E.data[0],u=_===0?8:16,y=R(E,u);u+=4;var m=0,b=0;_===0?u+=8:u+=16,u+=2;var P=E.end+b,I=k(E,u);u+=2;for(var U=0;U<I;U++){var F=u,L=R(E,F);F+=4;var v=L&2147483647,j=(L&2147483648)>>>31;if(j===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var K=R(E,F);F+=4,T.push({referenceSize:v,subsegmentDuration:K,info:{duration:K/y,start:P,end:P+v-1}}),P+=v,F+=4,u=F}return{earliestPresentationTime:m,timescale:y,version:_,referencesCount:I,references:T,moovEndOffset:A}}function d(O){for(var w=[],x=p(O,["moov","trak"]),A=0;A<x.length;A++){var S=x[A],T=p(S,["tkhd"])[0];if(T){var E=T.data[T.start],_=E===0?12:20,u=R(T,_),y=p(S,["mdia","mdhd"])[0];if(y){E=y.data[y.start],_=E===0?12:20;var m=R(y,_),b=p(S,["mdia","hdlr"])[0];if(b){var P=B(b.data.subarray(b.start+8,b.start+12)),I={soun:N.ElementaryStreamTypes.AUDIO,vide:N.ElementaryStreamTypes.VIDEO}[P];if(I){var U=p(S,["mdia","minf","stbl","stsd"])[0],F=void 0;U&&(F=B(U.data.subarray(U.start+12,U.start+16))),w[u]={timescale:m,type:I},w[I]={timescale:m,id:u,codec:F}}}}}}var L=p(O,["moov","mvex","trex"]);return L.forEach(function(v){var j=R(v,4),K=w[j];K&&(K.default={duration:R(v,12),flags:R(v,20)})}),w}function o(O,w){return p(w,["moof","traf"]).reduce(function(x,A){var S=p(A,["tfdt"])[0],T=S.data[S.start],E=p(A,["tfhd"]).reduce(function(_,u){var y=R(u,4),m=O[y];if(m){var b=R(S,4);T===1&&(b*=Math.pow(2,32),b+=R(S,8));var P=m.timescale||9e4,I=b/P;if(isFinite(I)&&(_===null||I<_))return I}return _},null);return E!==null&&isFinite(E)&&(x===null||E<x)?E:x},null)||0}function c(O,w){for(var x=0,A=0,S=0,T=p(O,["moof","traf"]),E=0;E<T.length;E++){var _=T[E],u=p(_,["tfhd"])[0],y=R(u,4),m=w[y];if(!m)continue;var b=m.default,P=R(u,0)|(b==null?void 0:b.flags),I=b==null?void 0:b.duration;P&8&&(P&2?I=R(u,12):I=R(u,8));for(var U=m.timescale||9e4,F=p(_,["trun"]),L=0;L<F.length;L++){if(I){var v=R(F[L],4);x=I*v}else x=s(F[L]);m.type===N.ElementaryStreamTypes.VIDEO?A+=x/U:m.type===N.ElementaryStreamTypes.AUDIO&&(S+=x/U)}}if(A===0&&S===0){var j=f(O);if(j!=null&&j.references)return j.references.reduce(function(K,J){return K+J.info.duration||0},0)}return A||S}function s(O){var w=R(O,0),x=8;w&1&&(x+=4),w&4&&(x+=4);for(var A=0,S=R(O,4),T=0;T<S;T++){if(w&256){var E=R(O,x);A+=E,x+=4}w&512&&(x+=4),w&1024&&(x+=4),w&2048&&(x+=4)}return A}function a(O,w,x){p(w,["moof","traf"]).forEach(function(A){p(A,["tfhd"]).forEach(function(S){var T=R(S,4),E=O[T];if(!E)return;var _=E.timescale||9e4;p(A,["tfdt"]).forEach(function(u){var y=u.data[u.start],m=R(u,4);if(y===0)g(u,4,m-x*_);else{m*=Math.pow(2,32),m+=R(u,8),m-=x*_,m=Math.max(m,0);var b=Math.floor(m/(M+1)),P=Math.floor(m%(M+1));g(u,4,b),g(u,8,P)}})})})}function l(O){var w={valid:null,remainder:null},x=p(O,["moof"]);if(x){if(x.length<2)return w.remainder=O,w}else return w;var A=x[x.length-1];return w.valid=Object(z.sliceUint8)(O,0,A.start-8),w.remainder=Object(z.sliceUint8)(O,A.start-8),w}function h(O,w){var x=new Uint8Array(O.length+w.length);return x.set(O),x.set(w,O.length),x}},"./src/utils/output-filter.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"default",function(){return z});var z=function(){function N(W,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=B}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(B,k,R){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=k,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},N}()},"./src/utils/texttrack-utils.ts":function(ne,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 B}),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(o){z.logger.debug("[texttrack-utils]: "+o);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 B(g,p,f){var d=g.mode;if(d==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var o=R(g.cues,p,f),c=0;c<o.length;c++)g.removeCue(o[c]);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,o=f;d<=o;){var c=Math.floor((o+d)/2);if(p<g[c].startTime)o=c-1;else if(p>g[c].startTime&&d<f)d=c+1;else return c}return g[d].startTime-p<p-g[o].startTime?d:o}function R(g,p,f){var d=[],o=k(g,p);if(o>-1)for(var c=o,s=g.length;c<s;c++){var a=g[c];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(ne,V,D){"use strict";D.r(V);var z={toString:function(M){for(var W="",B=M.length,k=0;k<B;k++)W+="["+M.start(k).toFixed(3)+","+M.end(k).toFixed(3)+"]";return W}};V.default=z},"./src/utils/timescale-conversion.ts":function(ne,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 B});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 B(k,R){return R===void 0&&(R=1),N(k,z,1/R)}},"./src/utils/typed-array.ts":function(ne,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(ne,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 B(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 o=1;o<arguments.length;o++){var c=arguments[o];for(var s in c)g[s]=c[s]}return g}function R(g,p,f){var d=this,o={enumerable:!0};d.hasBeenReset=!1;var c="",s=!1,a=g,l=p,h=f,O=null,w="",x=!0,A="auto",S="start",T=50,E="middle",_=50,u="middle";Object.defineProperty(d,"id",k({},o,{get:function(){return c},set:function(m){c=""+m}})),Object.defineProperty(d,"pauseOnExit",k({},o,{get:function(){return s},set:function(m){s=!!m}})),Object.defineProperty(d,"startTime",k({},o,{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({},o,{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({},o,{get:function(){return h},set:function(m){h=""+m,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",k({},o,{get:function(){return O},set:function(m){O=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",k({},o,{get:function(){return w},set:function(m){var b=W(m);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");w=b,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",k({},o,{get:function(){return x},set:function(m){x=!!m,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",k({},o,{get:function(){return A},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"lineAlign",k({},o,{get:function(){return S},set:function(m){var b=B(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");S=b,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",k({},o,{get:function(){return T},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");T=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"positionAlign",k({},o,{get:function(){return E},set:function(m){var b=B(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");E=b,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",k({},o,{get:function(){return _},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");_=m,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",k({},o,{get:function(){return u},set:function(m){var b=B(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");u=b,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(ne,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 o=d.prototype;return o.decode=function(s,a){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},d}();function M(d){function o(s,a,l,h){return(s|0)*3600+(a|0)*60+(l|0)+parseFloat(h||0)}var c=d.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return c?parseFloat(c[2])>59?o(c[2],c[3],0,c[4]):o(c[1],c[2],c[3],c[4]):null}var W=function(){function d(){this.values=Object.create(null)}var o=d.prototype;return o.set=function(s,a){!this.get(s)&&a!==""&&(this.values[s]=a)},o.get=function(s,a,l){return l?this.has(s)?this.values[s]:a[l]:this.has(s)?this.values[s]:a},o.has=function(s){return s in this.values},o.alt=function(s,a,l){for(var h=0;h<l.length;++h)if(a===l[h]){this.set(s,a);break}},o.integer=function(s,a){/^-?\d+$/.test(a)&&this.set(s,parseInt(a,10))},o.percent=function(s,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var l=parseFloat(a);if(l>=0&&l<=100)return this.set(s,l),!0}return!1},d}();function B(d,o,c,s){var a=s?d.split(s):[d];for(var l in a){if(typeof a[l]!="string")continue;var h=a[l].split(c);if(h.length!==2)continue;var O=h[0],w=h[1];o(O,w)}}var k=new z.default(0,0,""),R=k.align==="middle"?"middle":"center";function g(d,o,c){var s=d;function a(){var O=M(d);if(O===null)throw new Error("Malformed timestamp: "+s);return d=d.replace(/^[^\sa-zA-Z-]+/,""),O}function l(O,w){var x=new W;B(O,function(T,E){var _;switch(T){case"region":for(var u=c.length-1;u>=0;u--)if(c[u].id===E){x.set(T,c[u].region);break}break;case"vertical":x.alt(T,E,["rl","lr"]);break;case"line":_=E.split(","),x.integer(T,_[0]),x.percent(T,_[0])&&x.set("snapToLines",!1),x.alt(T,_[0],["auto"]),_.length===2&&x.alt("lineAlign",_[1],["start",R,"end"]);break;case"position":_=E.split(","),x.percent(T,_[0]),_.length===2&&x.alt("positionAlign",_[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":x.percent(T,E);break;case"align":x.alt(T,E,["start",R,"end","left","right"]);break}},/:/,/\s/),w.region=x.get("region",null),w.vertical=x.get("vertical","");var A=x.get("line","auto");A==="auto"&&k.line===-1&&(A=-1),w.line=A,w.lineAlign=x.get("lineAlign","start"),w.snapToLines=x.get("snapToLines",!0),w.size=x.get("size",100),w.align=x.get("align",R);var S=x.get("position","auto");S==="auto"&&k.position===50&&(S=w.align==="start"||w.align==="left"?0:w.align==="end"||w.align==="right"?100:50),w.position=S}function h(){d=d.replace(/^\s+/,"")}if(h(),o.startTime=a(),h(),d.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);d=d.substr(3),h(),o.endTime=a(),h(),l(d,o)}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 o=d.prototype;return o.parse=function(s){var a=this;s&&(a.buffer+=a.decoder.decode(s,{stream:!0}));function l(){var S=a.buffer,T=0;for(S=p(S);T<S.length&&S[T]!=="\r"&&S[T]!==`
`;)++T;var E=S.substr(0,T);return S[T]==="\r"&&++T,S[T]===`
`&&++T,a.buffer=S.substr(T),E}function h(S){B(S,function(T,E){},/:/)}try{var O="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;O=l();var w=O.match(/^()?WEBVTT([ \t].*)?$/);if(!w||!w[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var x=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;x?x=!1:O=l();switch(a.state){case"HEADER":/:/.test(O)?h(O):O||(a.state="ID");continue;case"NOTE":O||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(O)){a.state="NOTE";break}if(!O)continue;if(a.cue=new z.default(0,0,""),a.state="CUE",O.indexOf("-->")===-1){a.cue.id=O;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{g(O,a.cue,a.regionList)}catch(S){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var A=O.indexOf("-->")!==-1;if(!O||A&&(x=!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+=O}continue;case"BADCUE":O||(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},o.flush=function(){var s=this;try{if((s.cue||s.state==="HEADER")&&(s.buffer+=`
`,s.parse()),s.state==="INITIAL"||s.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){s.onparsingerror&&s.onparsingerror(a)}return s.onflush&&s.onflush(),this},d}()},"./src/utils/webvtt-parser.ts":function(ne,V,D){"use strict";D.r(V),D.d(V,"generateCueId",function(){return f}),D.d(V,"parseWebVTT",function(){return o});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"),B=D("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,R=function(s,a,l){return l===void 0&&(l=0),s.substr(l,a.length)===a},g=function(s){var a=parseInt(s.substr(-3)),l=parseInt(s.substr(-6,2)),h=parseInt(s.substr(-9,2)),O=s.length>9?parseInt(s.substr(0,s.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(a)||!Object(z.isFiniteNumber)(l)||!Object(z.isFiniteNumber)(h)||!Object(z.isFiniteNumber)(O))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+s);return a+=1e3*l,a+=60*1e3*h,a+=60*60*1e3*O,a},p=function(s){for(var a=5381,l=s.length;l;)a=a*33^s.charCodeAt(--l);return(a>>>0).toString()};function f(c,s,a){return p(c.toString())+p(s.toString())+p(a)}var d=function(s,a,l){var h=s[a],O=s[h.prevCC];if(!O||!O.new&&h.new){s.ccOffset=s.presentationOffset=h.start,h.new=!1;return}for(;(w=O)!==null&&w!==void 0&&w.new;){var w;s.ccOffset+=h.start-O.start,h.new=!1,h=O,O=s[h.prevCC]}s.presentationOffset=l};function o(c,s,a,l,h,O,w,x){var A=new N.VTTParser,S=Object(M.utf8ArrayToStr)(new Uint8Array(c)).trim().replace(k,`
`).split(`
`),T=[],E=Object(W.toMpegTsClockFromTimescale)(s,a),_="00:00.000",u=0,y=0,m,b=!0,P=!1;A.oncue=function(I){var U=l[h],F=l.ccOffset,L=(u-E)/9e4;if(U!=null&&U.new&&(y!==void 0?F=l.ccOffset=U.start:d(l,h,L)),L&&(F=L-l.presentationOffset),P){var v=I.endTime-I.startTime,j=Object(B.normalizePts)((I.startTime+F-y)*9e4,O*9e4)/9e4;I.startTime=j,I.endTime=j+v}var K=I.text.trim();I.text=decodeURIComponent(encodeURIComponent(K)),I.id||(I.id=f(I.startTime,I.endTime,K)),I.endTime>0&&T.push(I)},A.onparsingerror=function(I){m=I},A.onflush=function(){if(m){x(m);return}w(T)},S.forEach(function(I){if(b)if(R(I,"X-TIMESTAMP-MAP=")){b=!1,P=!0,I.substr(16).split(",").forEach(function(U){R(U,"LOCAL:")?_=U.substr(6):R(U,"MPEGTS:")&&(u=parseInt(U.substr(7)))});try{y=g(_)/1e3}catch(U){P=!1,m=U}return}else I===""&&(b=!1);A.parse(I+`
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(ne,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 B(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=B.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 o=this.xhrSetup;try{if(o)try{o(f,p.url)}catch(a){f.open("GET",p.url,!0),o(f,p.url)}f.readyState||f.open("GET",p.url,!0);var c=this.context.headers;if(c)for(var s in c)f.setRequestHeader(s,c[s])}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,o=this.config;if(f.aborted)return;if(d>=2)if(self.clearTimeout(this.requestTimeout),f.loading.first===0&&(f.loading.first=Math.max(self.performance.now(),f.loading.start)),d===4){p.onreadystatechange=null,p.onprogress=null;var c=p.status;if(c>=200&&c<300){f.loading.end=Math.max(self.performance.now(),f.loading.first);var s,a;if(g.responseType==="arraybuffer"?(s=p.response,a=s.byteLength):(s=p.responseText,a=s.length),f.loaded=f.total=a,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(f,g,s,p),!this.callbacks)return;var h={url:p.responseURL,data:s};this.callbacks.onSuccess(h,f,g,p)}else f.retry>=o.maxRetry||c>=400&&c<499?(z.logger.error(c+" while loading "+g.url),this.callbacks.onError({code:c,text:p.statusText},g,p)):(z.logger.warn(c+" while loading "+g.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,o.maxRetryDelay),f.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.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},B}();V.default=W}}).default})},vHTk:function(at,Ve,te){at.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);