(window.webpackJsonp=window.webpackJsonp||[]).push([[276,5,6,7],{"+NIl":function(vt,rt,oe){(function(ue){ue(oe("VrN/"))})(function(ue){"use strict";ue.defineMode("stex",function(Z,P){"use strict";function Q(h,o){h.cmdState.push(o)}function B(h){return h.cmdState.length>0?h.cmdState[h.cmdState.length-1]:null}function F(h){var o=h.cmdState.pop();o&&o.closeBracket()}function K(h){for(var o=h.cmdState,d=o.length-1;d>=0;d--){var s=o[d];if(s.name=="DEFAULT")continue;return s}return{styleIdentifier:function(){return null}}}function G(h,o,d){return function(){this.name=h,this.bracketNo=0,this.style=o,this.styles=d,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var M={};M.importmodule=G("importmodule","tag",["string","builtin"]),M.documentclass=G("documentclass","tag",["","atom"]),M.usepackage=G("usepackage","tag",["atom"]),M.begin=G("begin","tag",["atom"]),M.end=G("end","tag",["atom"]),M.label=G("label","tag",["atom"]),M.ref=G("ref","tag",["atom"]),M.eqref=G("eqref","tag",["atom"]),M.cite=G("cite","tag",["atom"]),M.bibitem=G("bibitem","tag",["atom"]),M.Bibitem=G("Bibitem","tag",["atom"]),M.RBibitem=G("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(h,o){h.f=o}function g(h,o){var d;if(h.match(/^\\[a-zA-Z@]+/)){var s=h.current().slice(1);return d=M.hasOwnProperty(s)?M[s]:M.DEFAULT,d=new d,Q(o,d),L(o,f),d.style}if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/\\]/))return"tag";if(h.match("\\["))return L(o,function(l,c){return p(l,c,"\\]")}),"keyword";if(h.match("\\("))return L(o,function(l,c){return p(l,c,"\\)")}),"keyword";if(h.match("$$"))return L(o,function(l,c){return p(l,c,"$$")}),"keyword";if(h.match("$"))return L(o,function(l,c){return p(l,c,"$")}),"keyword";var a=h.next();if(a=="%")return h.skipToEnd(),"comment";if(a=="}"||a=="]"){if(d=B(o),d)d.closeBracket(a),L(o,f);else return"error";return"bracket"}else return a=="{"||a=="["?(d=M.DEFAULT,d=new d,Q(o,d),"bracket"):/\d/.test(a)?(h.eatWhile(/[\w.%]/),"atom"):(h.eatWhile(/[\w\-_]/),d=K(o),d.name=="begin"&&(d.argument=h.current()),d.styleIdentifier())}function p(h,o,d){if(h.eatSpace())return null;if(d&&h.match(d))return L(o,g),"keyword";if(h.match(/^\\[a-zA-Z@]+/))return"tag";if(h.match(/^[a-zA-Z]+/))return"variable-2";if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/]/))return"tag";if(h.match(/^[\^_&]/))return"tag";if(h.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(h.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var s=h.next();return s=="{"||s=="}"||s=="["||s=="]"||s=="("||s==")"?"bracket":s=="%"?(h.skipToEnd(),"comment"):"error"}function f(h,o){var d=h.peek(),s;return d=="{"||d=="["?(s=B(o),s.openBracket(d),h.eat(d),L(o,g),"bracket"):/[ \t\r]/.test(d)?(h.eat(d),null):(L(o,g),F(o),g(h,o))}return{startState:function(){var h=P.inMathMode?function(o,d){return p(o,d)}:g;return{cmdState:[],f:h}},copyState:function(h){return{cmdState:h.cmdState.slice(),f:h.f}},token:function(h,o){return o.f(h,o)},blankLine:function(h){h.f=g,h.cmdState.length=0},lineComment:"%"}}),ue.defineMIME("text/x-stex","stex"),ue.defineMIME("text/x-latex","stex")})},"+ua5":function(vt,rt,oe){},"19Vz":function(vt,rt,oe){(function(ue){ue(oe("VrN/"))})(function(ue){ue.defineOption("placeholder","",function(G,M,L){var g=L&&L!=ue.Init;if(M&&!g)G.on("blur",B),G.on("change",F),G.on("swapDoc",F),ue.on(G.getInputField(),"compositionupdate",G.state.placeholderCompose=function(){Q(G)}),F(G);else if(!M&&g){G.off("blur",B),G.off("change",F),G.off("swapDoc",F),ue.off(G.getInputField(),"compositionupdate",G.state.placeholderCompose),Z(G);var p=G.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}M&&!G.hasFocus()&&B(G)});function Z(G){G.state.placeholder&&(G.state.placeholder.parentNode.removeChild(G.state.placeholder),G.state.placeholder=null)}function P(G){Z(G);var M=G.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=G.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var L=G.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),M.appendChild(L),G.display.lineSpace.insertBefore(M,G.display.lineSpace.firstChild)}function Q(G){setTimeout(function(){var M=!1,L=G.getInputField();L.nodeName=="TEXTAREA"?M=!L.value:G.lineCount()==1&&(M=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),M?P(G):Z(G)},20)}function B(G){K(G)&&P(G)}function F(G){var M=G.getWrapperElement(),L=K(G);M.className=M.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?P(G):Z(G)}function K(G){return G.lineCount()===1&&G.getLine(0)===""}})},"1eCo":function(vt,rt,oe){(function(ue){ue(oe("VrN/"))})(function(ue){"use strict";var Z={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},P={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ue.defineMode("xml",function(Q,B){var F=Q.indentUnit,K={},G=B.htmlMode?Z:P;for(var M in G)K[M]=G[M];for(var M in B)K[M]=B[M];var L,g;function p(u,b){function m(D){return b.tokenize=D,D(u,b)}var E=u.next();if(E=="<")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(d(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),b.tokenize=o("meta","?>"),"meta"):(L=u.eat("/")?"closeTag":"openTag",b.tokenize=f,"tag bracket");if(E=="&"){var N;return u.eat("#")?u.eat("x")?N=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):N=u.eatWhile(/[\d]/)&&u.eat(";"):N=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),N?"atom":"error"}else return u.eatWhile(/[^&<]/),null}p.isInText=!0;function f(u,b){var m=u.next();if(m==">"||m=="/"&&u.eat(">"))return b.tokenize=p,L=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return L="equals",null;if(m=="<"){b.tokenize=p,b.state=c,b.tagName=b.tagStart=null;var E=b.tokenize(u,b);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(m)?(b.tokenize=h(m),b.stringStartCol=u.column(),b.tokenize(u,b)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(u){var b=function(m,E){for(;!m.eol();)if(m.next()==u){E.tokenize=f;break}return"string"};return b.isInAttribute=!0,b}function o(u,b){return function(m,E){for(;!m.eol();){if(m.match(b)){E.tokenize=p;break}m.next()}return u}}function d(u){return function(b,m){for(var E;(E=b.next())!=null;){if(E=="<")return m.tokenize=d(u+1),m.tokenize(b,m);if(E==">")if(u==1){m.tokenize=p;break}else return m.tokenize=d(u-1),m.tokenize(b,m)}return"meta"}}function s(u,b,m){this.prev=u.context,this.tagName=b,this.indent=u.indented,this.startOfLine=m,(K.doNotIndent.hasOwnProperty(b)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function a(u){u.context&&(u.context=u.context.prev)}function l(u,b){for(var m;;){if(!u.context)return;if(m=u.context.tagName,!K.contextGrabbers.hasOwnProperty(m)||!K.contextGrabbers[m].hasOwnProperty(b))return;a(u)}}function c(u,b,m){return u=="openTag"?(m.tagStart=b.column(),O):u=="closeTag"?S:c}function O(u,b,m){return u=="word"?(m.tagName=b.current(),g="tag",A):K.allowMissingTagName&&u=="endTag"?(g="tag bracket",A(u,b,m)):(g="error",O)}function S(u,b,m){if(u=="word"){var E=b.current();return m.context&&m.context.tagName!=E&&K.implicitlyClosed.hasOwnProperty(m.context.tagName)&&a(m),m.context&&m.context.tagName==E||K.matchClosing===!1?(g="tag",T):(g="tag error",R)}else return K.allowMissingTagName&&u=="endTag"?(g="tag bracket",T(u,b,m)):(g="error",R)}function T(u,b,m){return u!="endTag"?(g="error",T):(a(m),c)}function R(u,b,m){return g="error",T(u,b,m)}function A(u,b,m){if(u=="word")return g="attribute",w;if(u=="endTag"||u=="selfcloseTag"){var E=m.tagName,N=m.tagStart;return m.tagName=m.tagStart=null,u=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(E)?l(m,E):(l(m,E),m.context=new s(m,E,N==m.indented)),c}return g="error",A}function w(u,b,m){return u=="equals"?x:(K.allowMissing||(g="error"),A(u,b,m))}function x(u,b,m){return u=="string"?_:u=="word"&&K.allowUnquoted?(g="string",A):(g="error",A(u,b,m))}function _(u,b,m){return u=="string"?_:A(u,b,m)}return{startState:function(u){var b={tokenize:p,state:c,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(b.baseIndent=u),b},token:function(u,b){if(!b.tagName&&u.sol()&&(b.indented=u.indentation()),u.eatSpace())return null;L=null;var m=b.tokenize(u,b);return(m||L)&&m!="comment"&&(g=null,b.state=b.state(L||m,u,b),g&&(m=g=="error"?m+" error":g)),m},indent:function(u,b,m){var E=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+F;if(E&&E.noIndent)return ue.Pass;if(u.tokenize!=f&&u.tokenize!=p)return m?m.match(/^(\s*)/)[0].length:0;if(u.tagName)return K.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+F*(K.multilineTagIndentFactor||1);if(K.alignCDATA&&/$/,blockCommentStart:"",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(u){u.state==x&&(u.state=A)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var b=[],m=u.context;m;m=m.prev)m.tagName&&b.push(m.tagName);return b.reverse()}}}),ue.defineMIME("text/xml","xml"),ue.defineMIME("application/xml","xml"),ue.mimeModes.hasOwnProperty("text/html")||ue.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(vt,rt,oe){"use strict";oe.d(rt,"a",function(){return l});var ue=oe("Ty5D"),Z=oe("dI71"),P=oe("q1tI"),Q=oe.n(P),B=oe("YS25"),F=oe("17x9"),K=oe.n(F),G=oe("wx14"),M=oe("zLVn"),L=oe("9R94"),g=function(x){Object(Z.a)(_,x);function _(){for(var b,m=arguments.length,E=new Array(m),N=0;NY&&(Y=y.line_indent_level));var ie={mode:W,parent:y,last_token:y?y.last_token:new f(l.START_BLOCK,""),last_word:y?y.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:Y,alignment:0,line_indent_level:y?y.line_indent_level:Y,start_line_index:this._output.get_line_number(),ternary_depth:0};return ie},H.prototype._reset=function(y){var W=y.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new p(this._options,W),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(u.BlockStatement);var Y=new d(y,this._options);return this._tokens=Y.tokenize(),y},H.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var y,W=this._reset(this._source_text),Y=this._options.eol;this._options.eol==="auto"&&(Y=` `,W&&h.lineBreak.test(W||"")&&(Y=W.match(h.lineBreak)[0]));for(var ie=this._tokens.next();ie;)this.handle_token(ie),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ie,ie=this._tokens.next();return y=this._output.get_code(Y),y},H.prototype.handle_token=function(y,W){y.type===l.START_EXPR?this.handle_start_expr(y):y.type===l.END_EXPR?this.handle_end_expr(y):y.type===l.START_BLOCK?this.handle_start_block(y):y.type===l.END_BLOCK?this.handle_end_block(y):y.type===l.WORD?this.handle_word(y):y.type===l.RESERVED?this.handle_word(y):y.type===l.SEMICOLON?this.handle_semicolon(y):y.type===l.STRING?this.handle_string(y):y.type===l.EQUALS?this.handle_equals(y):y.type===l.OPERATOR?this.handle_operator(y):y.type===l.COMMA?this.handle_comma(y):y.type===l.BLOCK_COMMENT?this.handle_block_comment(y,W):y.type===l.COMMENT?this.handle_comment(y,W):y.type===l.DOT?this.handle_dot(y):y.type===l.EOF?this.handle_eof(y):y.type===l.UNKNOWN?this.handle_unknown(y,W):this.handle_unknown(y,W)},H.prototype.handle_whitespace_and_comments=function(y,W){var Y=y.newlines,ie=this._options.keep_array_indentation&&E(this._flags.mode);if(y.comments_before)for(var se=y.comments_before.next();se;)this.handle_whitespace_and_comments(se,W),this.handle_token(se,W),se=y.comments_before.next();if(ie)for(var xe=0;xe0,W);else if(this._options.max_preserve_newlines&&Y>this._options.max_preserve_newlines&&(Y=this._options.max_preserve_newlines),this._options.preserve_newlines&&Y>1){this.print_newline(!1,W);for(var me=1;me0&&(!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))},H.prototype.set_mode=function(y){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,y),this._flags=this.create_flags(this._previous_flags,y),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},H.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&&b(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},H.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||R(this._flags.last_token,["get","set"]))},H.prototype.start_of_statement=function(y){var W=!1;return W=W||R(this._flags.last_token,["var","let","const"])&&y.type===l.WORD,W=W||T(this._flags.last_token,"do"),W=W||!(this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement)&&R(this._flags.last_token,I)&&!y.newlines,W=W||T(this._flags.last_token,"else")&&!(T(y,"if")&&!y.comments_before),W=W||this._flags.last_token.type===l.END_EXPR&&(this._previous_flags.mode===u.ForInitializer||this._previous_flags.mode===u.Conditional),W=W||this._flags.last_token.type===l.WORD&&this._flags.mode===u.BlockStatement&&!this._flags.in_case&&!(y.text==="--"||y.text==="++")&&this._last_last_text!=="function"&&y.type!==l.WORD&&y.type!==l.RESERVED,W=W||this._flags.mode===u.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||R(this._flags.last_token,["get","set"])),W?(this.set_mode(u.Statement),this.indent(),this.handle_whitespace_and_comments(y,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(y,R(y,["do","for","if","while"])),!0):!1},H.prototype.handle_start_expr=function(y){this.start_of_statement(y)||this.handle_whitespace_and_comments(y);var W=u.Expression;if(y.text==="["){if(this._flags.last_token.type===l.WORD||this._flags.last_token.text===")"){R(this._flags.last_token,s)&&(this._output.space_before_token=!0),this.print_token(y),this.set_mode(W),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}W=u.ArrayLiteral,E(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())),c(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,W=u.ForInitializer):c(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,W=u.Conditional):c(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&y.whitespace_before===""?this._output.space_before_token=!1:(c(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(y);else if(this._flags.last_token.type===l.WORD){this._output.space_before_token=!1;var Y=this._tokens.peek(-3);if(this._options.space_after_named_function&&Y){var ie=this._tokens.peek(-4);R(Y,["async","function"])||Y.text==="*"&&R(ie,["async","function"])?this._output.space_before_token=!0:this._flags.mode===u.ObjectLiteral?(Y.text==="{"||Y.text===","||Y.text==="*"&&(ie.text==="{"||ie.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(y);(this._flags.last_token.type===l.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(c(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&c(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(y,y.newlines),this.print_token(y),this.set_mode(W),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},H.prototype.handle_end_expr=function(y){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(y),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(y,y.text==="]"&&E(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(y),this.restore_mode(),b(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)},H.prototype.handle_start_block=function(y){this.handle_whitespace_and_comments(y);var W=this._tokens.peek(),Y=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):Y&&(c(Y.text,[":",","])&&c(W.type,[l.STRING,l.WORD,l.RESERVED])||c(W.text,["get","set","..."])&&c(Y.type,[l.WORD,l.RESERVED]))?c(this._last_last_text,["class","interface"])&&!c(Y.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):c(this._flags.last_token.type,[l.EQUALS,l.START_EXPR,l.COMMA,l.OPERATOR])||R(this._flags.last_token,["return","throw","import","default"])?this.set_mode(u.ObjectLiteral):this.set_mode(u.BlockStatement),this._flags.last_token&&(R(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var ie=!W.comments_before&&W.text==="}",se=ie&&this._flags.last_word==="function"&&this._flags.last_token.type===l.END_EXPR;if(this._options.brace_preserve_inline){var xe=0,me=null;this._flags.inline_frame=!0;do if(xe+=1,me=this._tokens.peek(xe-1),me.newlines){this._flags.inline_frame=!1;break}while(me.type!==l.EOF&&!(me.type===l.END_BLOCK&&me.opened===y))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&y.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==l.OPERATOR&&(se||this._flags.last_token.type===l.EQUALS||R(this._flags.last_token,A)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(E(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(y),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(y),this.indent(),!ie&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},H.prototype.handle_end_block=function(y){for(this.handle_whitespace_and_comments(y);this._flags.mode===u.Statement;)this.restore_mode();var W=this._flags.last_token.type===l.START_BLOCK;this._flags.inline_frame&&!W?this._output.space_before_token=!0:this._options.brace_style==="expand"?W||this.print_newline():W||(E(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(y)},H.prototype.handle_word=function(y){if(y.type===l.RESERVED){if(c(y.text,["set","get"])&&this._flags.mode!==u.ObjectLiteral)y.type=l.WORD;else if(y.text==="import"&&c(this._tokens.peek().text,["(","."]))y.type=l.WORD;else if(c(y.text,["as","from"])&&!this._flags.import_block)y.type=l.WORD;else if(this._flags.mode===u.ObjectLiteral){var W=this._tokens.peek();W.text===":"&&(y.type=l.WORD)}}if(this.start_of_statement(y)?R(this._flags.last_token,["var","let","const"])&&y.type===l.WORD&&(this._flags.declaration_statement=!0):y.newlines&&!N(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||!R(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(y),this.print_newline()):this.handle_whitespace_and_comments(y),this._flags.do_block&&!this._flags.do_while)if(T(y,"while")){this._output.space_before_token=!0,this.print_token(y),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&T(y,"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&&R(y,["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(y),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(y)),T(y,"function")){(c(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(c(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===l.OPERATOR))&&(!this._output.just_added_blankline()&&!y.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD?R(this._flags.last_token,["get","set","new","export"])||R(this._flags.last_token,I)?this._output.space_before_token=!0:T(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===l.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(N(this._flags.mode)||E(this._flags.mode))||this.print_newline(),this.print_token(y),this._flags.last_word=y.text;return}var Y="NONE";if(this._flags.last_token.type===l.END_BLOCK?this._previous_flags.inline_frame?Y="SPACE":R(y,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&y.newlines?Y="NEWLINE":(Y="SPACE",this._output.space_before_token=!0):Y="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&this._flags.mode===u.BlockStatement?Y="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&N(this._flags.mode)?Y="SPACE":this._flags.last_token.type===l.STRING?Y="NEWLINE":this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD||this._flags.last_token.text==="*"&&(c(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&c(this._last_last_text,["{",","]))?Y="SPACE":this._flags.last_token.type===l.START_BLOCK?this._flags.inline_frame?Y="SPACE":Y="NEWLINE":this._flags.last_token.type===l.END_EXPR&&(this._output.space_before_token=!0,Y="NEWLINE"),R(y,s)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Y="SPACE":Y="NEWLINE"),R(y,["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"&&y.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ie=this._output.current_line;ie.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else Y==="NEWLINE"?R(this._flags.last_token,A)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&R(y,["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||!R(y,["var","let","const"]))&&this._flags.last_token.text!==":"&&(T(y,"if")&&T(y.previous,"else")?this._output.space_before_token=!0:this.print_newline()):R(y,s)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&E(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():Y==="SPACE"&&(this._output.space_before_token=!0);y.previous&&(y.previous.type===l.WORD||y.previous.type===l.RESERVED)&&(this._output.space_before_token=!0),this.print_token(y),this._flags.last_word=y.text,y.type===l.RESERVED&&(y.text==="do"?this._flags.do_block=!0:y.text==="if"?this._flags.if_block=!0:y.text==="import"?this._flags.import_block=!0:this._flags.import_block&&T(y,"from")&&(this._flags.import_block=!1))},H.prototype.handle_semicolon=function(y){this.start_of_statement(y)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(y);for(var W=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&T(W,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(y)},H.prototype.handle_string=function(y){y.text.startsWith("`")&&y.newlines===0&&y.whitespace_before===""&&(y.previous.text===")"||this._flags.last_token.type===l.WORD)||(this.start_of_statement(y)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(y),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(y):y.text.startsWith("`")&&this._flags.last_token.type===l.END_EXPR&&(y.previous.text==="]"||y.previous.text===")")&&y.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(y)},H.prototype.handle_equals=function(y){this.start_of_statement(y)||this.handle_whitespace_and_comments(y),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(y),this._output.space_before_token=!0},H.prototype.handle_comma=function(y){this.handle_whitespace_and_comments(y,!0),this.print_token(y),this._output.space_before_token=!0,this._flags.declaration_statement?(N(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(y)):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(y)},H.prototype.handle_operator=function(y){var W=y.text==="*"&&(R(this._flags.last_token,["function","yield"])||c(this._flags.last_token.type,[l.START_BLOCK,l.COMMA,l.END_BLOCK,l.SEMICOLON])),Y=c(y.text,["-","+"])&&(c(this._flags.last_token.type,[l.START_BLOCK,l.START_EXPR,l.EQUALS,l.OPERATOR])||c(this._flags.last_token.text,s)||this._flags.last_token.text===",");if(!this.start_of_statement(y)){var ie=!W;this.handle_whitespace_and_comments(y,ie)}if(y.text==="*"&&this._flags.last_token.type===l.DOT){this.print_token(y);return}if(y.text==="::"){this.print_token(y);return}if(this._flags.last_token.type===l.OPERATOR&&c(this._options.operator_position,_)&&this.allow_wrap_or_preserved_newline(y),y.text===":"&&this._flags.in_case){this.print_token(y),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 se=!0,xe=!0,me=!1;if(y.text===":"?this._flags.ternary_depth===0?se=!1:(this._flags.ternary_depth-=1,me=!0):y.text==="?"&&(this._flags.ternary_depth+=1),!Y&&!W&&this._options.preserve_newlines&&c(y.text,a)){var Te=y.text===":",Se=Te&&me,we=Te&&!me;switch(this._options.operator_position){case x.before_newline:this._output.space_before_token=!we,this.print_token(y),(!Te||Se)&&this.allow_wrap_or_preserved_newline(y),this._output.space_before_token=!0;return;case x.after_newline:this._output.space_before_token=!0,!Te||Se?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(y):this._output.space_before_token=!1,this.print_token(y),this._output.space_before_token=!0;return;case x.preserve_newline:we||this.allow_wrap_or_preserved_newline(y),se=!(this._output.just_added_newline()||we),this._output.space_before_token=se,this.print_token(y),this._output.space_before_token=!0;return}}if(W){this.allow_wrap_or_preserved_newline(y),se=!1;var fe=this._tokens.peek();xe=fe&&c(fe.type,[l.WORD,l.RESERVED])}else if(y.text==="...")this.allow_wrap_or_preserved_newline(y),se=this._flags.last_token.type===l.START_BLOCK,xe=!1;else if(c(y.text,["--","++","!","~"])||Y){if((this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR)&&this.allow_wrap_or_preserved_newline(y),se=!1,xe=!1,y.newlines&&(y.text==="--"||y.text==="++"||y.text==="~")){var le=R(this._flags.last_token,A)&&y.newlines;le&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(le,!0)}this._flags.last_token.text===";"&&N(this._flags.mode)&&(se=!0),this._flags.last_token.type===l.RESERVED?se=!0:this._flags.last_token.type===l.END_EXPR?se=!(this._flags.last_token.text==="]"&&(y.text==="--"||y.text==="++")):this._flags.last_token.type===l.OPERATOR&&(se=c(y.text,["--","-","++","+"])&&c(this._flags.last_token.text,["--","-","++","+"]),c(y.text,["+","-"])&&c(this._flags.last_token.text,["--","++"])&&(xe=!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||se,this.print_token(y),this._output.space_before_token=xe},H.prototype.handle_block_comment=function(y,W){if(this._output.raw){this._output.add_raw_token(y),y.directives&&y.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(y.directives){this.print_newline(!1,W),this.print_token(y),y.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!h.newline.test(y.text)&&!y.newlines){this._output.space_before_token=!0,this.print_token(y),this._output.space_before_token=!0;return}else this.print_block_commment(y,W)},H.prototype.print_block_commment=function(y,W){var Y=m(y.text),ie,se=!1,xe=!1,me=y.whitespace_before,Te=me.length;if(this.print_newline(!1,W),this.print_token_line_indentation(y),this._output.add_token(Y[0]),this.print_newline(!1,W),Y.length>1){for(Y=Y.slice(1),se=D(Y,"*"),xe=j(Y,me),se&&(this._flags.alignment=1),ie=0;ie=0;h--)if(this.__items[h].match(f))return!0;return!1},L.prototype.set_indent=function(f,h){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},L.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},L.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},L.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},L.prototype.is_empty=function(){return this.__items.length===0},L.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},L.prototype.push=function(f){this.__items.push(f);var h=f.lastIndexOf(` `);h!==-1?this.__character_count=f.length-h:this.__character_count+=f.length},L.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},L.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},L.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},L.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},L.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function g(f,h){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)),h=h||"",f.indent_level>0&&(h=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}g.prototype.get_indent_size=function(f,h){var o=this.__base_string_length;return h=h||0,f<0&&(o=0),o+=f*this.__indent_size,o+=h,o},g.prototype.get_indent_string=function(f,h){var o=this.__base_string;return h=h||0,f<0&&(f=0,o=""),h+=f*this.__indent_size,this.__ensure_cache(h),o+=this.__cache[h],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,h=0,o="";this.__indent_size&&f>=this.__indent_size&&(h=Math.floor(f/this.__indent_size),f-=h*this.__indent_size,o=new Array(h+1).join(this.__indent_string)),f&&(o+=new Array(f+1).join(" ")),this.__cache.push(o)};function p(f,h){this.__indent_cache=new g(f,h),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new L(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,h){return this.__indent_cache.get_indent_string(f,h)},p.prototype.get_indent_size=function(f,h){return this.__indent_cache.get_indent_size(f,h)},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 h=this.current_line.pop();h&&(h[h.length-1]===` `&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),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,h){return f=f||0,h=h||0,this.next_line.set_indent(f,h),this.__lines.length>1?(this.current_line.set_indent(f,h),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var h=0;h1&&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,h){for(var o=this.__lines.length-2;o>=0;){var d=this.__lines[o];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==h){this.__lines.splice(o+1,0,new L(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},M.exports.Output=p},function(M){function L(g,p,f,h){this.type=g,this.text=p,this.comments_before=null,this.newlines=f||0,this.whitespace_before=h||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}M.exports.Token=L},function(M,L){var g="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",f="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",h="\\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+"])",d="(?:\\\\u[0-9a-fA-F]{4}|["+p+f+h+"])*";L.identifier=new RegExp(o+d,"g"),L.identifierStart=new RegExp(o),L.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+f+h+"])+");var s=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;L.newline=/[\n\r\u2028\u2029]/,L.lineBreak=new RegExp(`\r |`+L.newline.source),L.allLineBreaks=new RegExp(L.lineBreak.source,"g")},function(M,L,g){var p=g(6).Options,f=["before-newline","after-newline","preserve-newline"];function h(o){p.call(this,o,"js");var d=this.raw_options.brace_style||null;d==="expand-strict"?this.raw_options.brace_style="expand":d==="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>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),w=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";w=w.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),w="\\?\\.(?!\\d) "+w,w=w.replace(/ /g,"|");var x=new RegExp(w),_="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"]),b=new RegExp("^(?:"+u.join("|")+")$"),m,E=function(D,j){f.call(this,D,j),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var H=new s(this._input),I=new a(this._input).read_options(this._options);this.__patterns={template:I,identifier:I.starting_with(d.identifier).matching(d.identifierMatch),number:H.matching(S),punct:H.matching(x),comment:H.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:H.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:H.matching(//),include:H.starting_with(/#include/).until_after(d.lineBreak),shebang:H.starting_with(/#!/).until_after(d.lineBreak),xml:H.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:I.until(/['\\\n\r\u2028\u2029]/),double_quote:I.until(/["\\\n\r\u2028\u2029]/),template_text:I.until(/[`\\$]/),template_expression:I.until(/[`}\\]/)}};E.prototype=new f,E.prototype._is_comment=function(D){return D.type===c.COMMENT||D.type===c.BLOCK_COMMENT||D.type===c.UNKNOWN},E.prototype._is_opening=function(D){return D.type===c.START_BLOCK||D.type===c.START_EXPR},E.prototype._is_closing=function(D,j){return(D.type===c.END_BLOCK||D.type===c.END_EXPR)&&j&&(D.text==="]"&&j.text==="["||D.text===")"&&j.text==="("||D.text==="}"&&j.text==="{")},E.prototype._reset=function(){m=!1},E.prototype._get_next_token=function(D,j){var H=null;this._readWhitespace();var I=this._input.peek();return I===null?this._create_token(c.EOF,""):(H=H||this._read_non_javascript(I),H=H||this._read_string(I),H=H||this._read_word(D),H=H||this._read_singles(I),H=H||this._read_comment(I),H=H||this._read_regexp(I,D),H=H||this._read_xml(I,D),H=H||this._read_punctuation(),H=H||this._create_token(c.UNKNOWN,this._input.next()),H)},E.prototype._read_word=function(D){var j;if(j=this.__patterns.identifier.read(),j!=="")return j=j.replace(d.allLineBreaks,` `),!(D.type===c.DOT||D.type===c.RESERVED&&(D.text==="set"||D.text==="get"))&&b.test(j)?(j==="in"||j==="of")&&(D.type===c.WORD||D.type===c.STRING)?this._create_token(c.OPERATOR,j):this._create_token(c.RESERVED,j):this._create_token(c.WORD,j);if(j=this.__patterns.number.read(),j!=="")return this._create_token(c.WORD,j)},E.prototype._read_singles=function(D){var j=null;return D==="("||D==="["?j=this._create_token(c.START_EXPR,D):D===")"||D==="]"?j=this._create_token(c.END_EXPR,D):D==="{"?j=this._create_token(c.START_BLOCK,D):D==="}"?j=this._create_token(c.END_BLOCK,D):D===";"?j=this._create_token(c.SEMICOLON,D):D==="."&&R.test(this._input.peek(1))?j=this._create_token(c.DOT,D):D===","&&(j=this._create_token(c.COMMA,D)),j&&this._input.next(),j},E.prototype._read_punctuation=function(){var D=this.__patterns.punct.read();if(D!=="")return D==="="?this._create_token(c.EQUALS,D):D==="?."?this._create_token(c.DOT,D):this._create_token(c.OPERATOR,D)},E.prototype._read_non_javascript=function(D){var j="";if(D==="#"){if(this._is_first_token()&&(j=this.__patterns.shebang.read(),j))return this._create_token(c.UNKNOWN,j.trim()+` `);if(j=this.__patterns.include.read(),j)return this._create_token(c.UNKNOWN,j.trim()+` `);D=this._input.next();var H="#";if(this._input.hasNext()&&this._input.testChar(T)){do D=this._input.next(),H+=D;while(this._input.hasNext()&&D!=="#"&&D!=="=");return D==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(H+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(H+="{}",this._input.next(),this._input.next())),this._create_token(c.WORD,H)}this._input.back()}else if(D==="<"&&this._is_first_token()){if(j=this.__patterns.html_comment_start.read(),j){for(;this._input.hasNext()&&!this._input.testChar(d.newline);)j+=this._input.next();return m=!0,this._create_token(c.COMMENT,j)}}else if(m&&D==="-"&&(j=this.__patterns.html_comment_end.read(),j))return m=!1,this._create_token(c.COMMENT,j);return null},E.prototype._read_comment=function(D){var j=null;if(D==="/"){var H="";if(this._input.peek(1)==="*"){H=this.__patterns.block_comment.read();var I=O.get_directives(H);I&&I.ignore==="start"&&(H+=O.readIgnored(this._input)),H=H.replace(d.allLineBreaks,` `),j=this._create_token(c.BLOCK_COMMENT,H),j.directives=I}else this._input.peek(1)==="/"&&(H=this.__patterns.comment.read(),j=this._create_token(c.COMMENT,H))}return j},E.prototype._read_string=function(D){if(D==="`"||D==="'"||D==='"'){var j=this._input.next();return this.has_char_escapes=!1,D==="`"?j+=this._read_string_recursive("`",!0,"${"):j+=this._read_string_recursive(D),this.has_char_escapes&&this._options.unescape_strings&&(j=N(j)),this._input.peek()===D&&(j+=this._input.next()),j=j.replace(d.allLineBreaks,` `),this._create_token(c.STRING,j)}return null},E.prototype._allow_regexp_or_xml=function(D){return D.type===c.RESERVED&&l(D.text,["return","case","throw","else","do","typeof","yield"])||D.type===c.END_EXPR&&D.text===")"&&D.opened.previous.type===c.RESERVED&&l(D.opened.previous.text,["if","while","for"])||l(D.type,[c.COMMENT,c.START_EXPR,c.START_BLOCK,c.START,c.END_BLOCK,c.OPERATOR,c.EQUALS,c.EOF,c.SEMICOLON,c.COMMA])},E.prototype._read_regexp=function(D,j){if(D==="/"&&this._allow_regexp_or_xml(j)){for(var H=this._input.next(),I=!1,y=!1;this._input.hasNext()&&(I||y||this._input.peek()!==D)&&!this._input.testChar(d.newline);)H+=this._input.peek(),I?I=!1:(I=this._input.peek()==="\\",this._input.peek()==="["?y=!0:this._input.peek()==="]"&&(y=!1)),this._input.next();return this._input.peek()===D&&(H+=this._input.next(),H+=this._input.read(d.identifier)),this._create_token(c.STRING,H)}return null},E.prototype._read_xml=function(D,j){if(this._options.e4x&&D==="<"&&this._allow_regexp_or_xml(j)){var H="",I=this.__patterns.xml.read_match();if(I){for(var y=I[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),W=y.indexOf("{")===0,Y=0;I;){var ie=!!I[1],se=I[2],xe=!!I[I.length-1]||se.slice(0,8)==="![CDATA[";if(!xe&&(se===y||W&&se.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ie?--Y:++Y),H+=I[0],Y<=0)break;I=this.__patterns.xml.read_match()}return I||(H+=this._input.match(/[\s\S]*/g)[0]),H=H.replace(d.allLineBreaks,` `),this._create_token(c.STRING,H)}}return null};function N(D){for(var j="",H=0,I=new p(D),y=null;I.hasNext();)if(y=I.match(/([\s]|[^\\]|\\\\)+/g),y&&(j+=y[0]),I.peek()==="\\"){if(I.next(),I.peek()==="x")y=I.match(/x([0-9A-Fa-f]{2})/g);else if(I.peek()==="u")y=I.match(/u([0-9A-Fa-f]{4})/g);else{j+="\\",I.hasNext()&&(j+=I.next());continue}if(!y)return D;if(H=parseInt(y[1],16),H>126&&H<=255&&y[0].indexOf("x")===0)return D;if(H>=0&&H<32){j+="\\"+y[0];continue}else H===34||H===39||H===92?j+="\\"+String.fromCharCode(H):j+=String.fromCharCode(H)}return j}E.prototype._read_string_recursive=function(D,j,H){var I,y;D==="'"?y=this.__patterns.single_quote:D==='"'?y=this.__patterns.double_quote:D==="`"?y=this.__patterns.template_text:D==="}"&&(y=this.__patterns.template_expression);for(var W=y.read(),Y="";this._input.hasNext();){if(Y=this._input.next(),Y===D||!j&&d.newline.test(Y)){this._input.back();break}else Y==="\\"&&this._input.hasNext()?(I=this._input.peek(),I==="x"||I==="u"?this.has_char_escapes=!0:I==="\r"&&this._input.peek(1)===` `&&this._input.next(),Y+=this._input.next()):H&&(H==="${"&&Y==="$"&&this._input.peek()==="{"&&(Y+=this._input.next()),H===Y&&(D==="`"?Y+=this._read_string_recursive("}",j,"`"):Y+=this._read_string_recursive("`",j,"${"),this._input.hasNext()&&(Y+=this._input.next())));Y+=y.read(),W+=Y}return W},M.exports.Tokenizer=E,M.exports.TOKEN=c,M.exports.positionable_operators=A.slice(),M.exports.line_starters=_.slice()},function(M){var L=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position=0&&p=0&&f=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},M.exports.InputScanner=g},function(M,L,g){var p=g(8).InputScanner,f=g(3).Token,h=g(10).TokenStream,o=g(11).WhitespacePattern,d={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 h,this._reset();for(var a,l=new f(d.START,""),c=null,O=[],S=new h;l.type!==d.EOF;){for(a=this._get_next_token(l,c);this._is_comment(a);)S.add(a),a=this._get_next_token(l,c);S.isEmpty()||(a.comments_before=S,S=new h),a.parent=c,this._is_opening(a)?(O.push(c),c=a):c&&this._is_closing(a,c)&&(a.opened=c,c.closed=a,c=O.pop(),a.parent=c),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 c=this._input.read(/.+/g);return c?this._create_token(d.RAW,c):this._create_token(d.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 c=new f(a,l,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return c},s.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},M.exports.Tokenizer=s,M.exports.TOKEN=d},function(M){function L(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}L.prototype.restart=function(){this.__position=0},L.prototype.isEmpty=function(){return this.__tokens_length===0},L.prototype.hasNext=function(){return this.__position=0&&g/),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}/)}}h.prototype=new p,h.prototype._create=function(){return new h(this._input,this)},h.prototype._update=function(){this.__set_templated_pattern()},h.prototype.disable=function(o){var d=this._create();return d._disabled[o]=!0,d._update(),d},h.prototype.read_options=function(o){var d=this._create();for(var s in f)d._disabled[s]=o.templating.indexOf(s)===-1;return d._update(),d},h.prototype.exclude=function(o){var d=this._create();return d._excluded[o]=!0,d._update(),d},h.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 d=this._read_template();d;)this._match_pattern?d+=this._input.read(this._match_pattern):d+=this._input.readUntil(this.__template_pattern),o+=d,d=this._read_template();return this._until_after&&(o+=this._input.readUntilAfter(this._until_pattern)),o},h.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("|")+")")},h.prototype._read_template=function(){var o="",d=this._input.peek();if(d==="<"){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 d==="{"&&(!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},M.exports.TemplatablePattern=h}],F={};function K(M){var L=F[M];if(L!==void 0)return L.exports;var g=F[M]={exports:{}};return B[M](g,g.exports,K),g.exports}var G=K(0);P=G})();var Q=P;!(ue=[],Z=function(){return{js_beautify:Q}}.apply(rt,ue),Z!==void 0&&(vt.exports=Z))})()},"7Cbv":function(vt,rt,oe){"use strict";var ue=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Z=new Uint8Array(16);function P(){if(!ue)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ue(Z)}var Q=/^(?:[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 B(f){return typeof f=="string"&&Q.test(f)}for(var F=B,K=[],G=0;G<256;++G)K.push((G+256).toString(16).substr(1));function M(f){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=(K[f[h+0]]+K[f[h+1]]+K[f[h+2]]+K[f[h+3]]+"-"+K[f[h+4]]+K[f[h+5]]+"-"+K[f[h+6]]+K[f[h+7]]+"-"+K[f[h+8]]+K[f[h+9]]+"-"+K[f[h+10]]+K[f[h+11]]+K[f[h+12]]+K[f[h+13]]+K[f[h+14]]+K[f[h+15]]).toLowerCase();if(!F(o))throw TypeError("Stringified UUID is invalid");return o}var L=M;function g(f,h,o){f=f||{};var d=f.random||(f.rng||P)();if(d[6]=d[6]&15|64,d[8]=d[8]&63|128,h){o=o||0;for(var s=0;s<16;++s)h[o+s]=d[s];return h}return L(d)}var p=rt.a=g},"7ahc":function(vt,rt,oe){"use strict";oe.d(rt,"a",function(){return O});var ue=oe("k1fw"),Z=oe("0Owb"),P=oe("+L6B"),Q=oe("2/Rp"),B=oe("y8nQ"),F=oe("Vl3Y"),K=oe("tJVT"),G=oe("OaEy"),M=oe("2fM7"),L=oe("q1tI"),g=oe.n(L),p=oe("VrN/"),f=oe.n(p),h=oe("p77/"),o=oe.n(h),d=oe("c5Ni"),s=oe.n(d),a=M.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},c={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"]};rt.b=function(S){var T=S.callback,R=S.onCancel,A=Object(L.useState)("python"),w=Object(K.a)(A,2),x=w[0],_=w[1];function u(m){_(c[m][1])}function b(m){T(m)}return g.a.createElement(F.a,Object(Z.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),g.a.createElement(F.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(M.a,{onChange:u},Object.keys(c).map(function(m){return g.a.createElement(a,{key:m,value:m},c[m][0])}))),g.a.createElement(F.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:x})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(Q.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(Q.a,{type:"ghost",onClick:R},"\u53D6\u6D88")))};function O(S){var T=S.value,R=S.onChange,A=S.mode,w=S.options,x=w===void 0?{}:w,_=Object(L.useRef)(),u=Object(L.useState)(),b=Object(K.a)(u,2),m=b[0],E=b[1];return Object(L.useEffect)(function(){if(m){function N(D){var j=D.getValue();R&&R(j)}return m.on("change",N),function(){m.off("change",N)}}},[m,R]),Object(L.useEffect)(function(){m&&m.setOption("mode",A)},[m,A]),Object(L.useEffect)(function(){m&&((T!==m.getValue()||T==="")&&setTimeout(function(){m.setValue(T||" ")},300))},[m,T]),Object(L.useEffect)(function(){if(_.current&&!m){var N=f.a.fromTextArea(_.current,Object(ue.a)({mode:A,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},x));E(N)}},[_.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:_}))}},"8EBN":function(vt,rt,oe){(function(ue){ue(oe("VrN/"))})(function(ue){"use strict";ue.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 Z=0;Z-1&&Q.substring(K+1,Q.length);if(G)return ue.findModeByExtension(G)},ue.findModeByName=function(Q){Q=Q.toLowerCase();for(var B=0;B=U.length?q.slice(U.length):q}).join(` `)}var s=[],a=["
    "],l=new h.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function O(){s.length=0,a=["
      "]}var S={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function T(X,v,C,U){if(v>=X.length||X[v].level<=C)return v;var q=X[v];U.push("
    • "+q.text+""),v++;var V=[];return v=T(X,v,q.level,V),V.length>0&&(U.push("
        "),V.forEach(function(ye){U.push(ye)}),U.push("
      ")),U.push("
    • "),v=T(X,v,C,U),v}function R(){return T(s,0,0,a),a.push("
    "),a.join("")}var A={heading:function(v){var C=c.exec(v);if(C)return{type:"heading",raw:C[0],depth:C[1].length,text:C[2]}},fences:function(v){var C=this.rules.block.fences.exec(v);if(C){var U=C[0],q=d(U,C[3]||""),V=C[2]?C[2].trim():C[2];if(["latex","katex","math"].indexOf(V)>=0){var ye=_(),Be=q;q=ye,u[ye]={type:"block",expression:Be}}return{type:"code",raw:U,lang:V,text:q}}}},w=/(?:\${2})([^\n`]+?)(?:\${2})/gi,x=0,_=function(){return"__special_katext_id_".concat(x++,"__")},u={};function b(){return u}function m(){x=0,u={}}function E(X){return X=X.replace(w,function(v,C){var U=_();return u[U]={type:"inline",expression:C},U}),X}var N=l.listitem;l.listitem=function(X){return N(E(X))};var D=l.paragraph;l.paragraph=function(X){return D(E(X))};var j=l.tablecell;l.tablecell=function(X,v){return j(E(X),v)},l.code=function(X,v,C){var U=(v||"").match(/\S*/)[0];return U?["latex","katex","math"].indexOf(U)>=0?"

    ".concat(X,"

    "):'
    ').concat(C?X:Object(o.escape)(X,!0),`
    `):'
    '+(C?X:Object(o.escape)(X,!0))+"
    "},l.heading=function(X,v,C){var U=this.options.headerPrefix+C.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return s.push({anchor:U,level:v,text:X}),"'+X+""},h.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),h.a.use({tokenizer:A,renderer:l});var H=h.a,I=oe("SJMd"),y=oe("ulZh"),W=oe.n(y),Y=oe("m3rI"),ie=oe("Oy/b"),se=oe("p5ED"),xe=oe("ErOA");/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var me=function(X,v){return(me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,U){C.__proto__=U}||function(C,U){for(var q in U)Object.prototype.hasOwnProperty.call(U,q)&&(C[q]=U[q])})(X,v)};function Te(X,v){function C(){this.constructor=X}me(X,v),X.prototype=v===null?Object.create(v):(C.prototype=v.prototype,new C)}function Se(X,v,C,U){return new(C||(C=Promise))(function(q,V){function ye(mt){try{Ze(U.next(mt))}catch(ze){V(ze)}}function Be(mt){try{Ze(U.throw(mt))}catch(ze){V(ze)}}function Ze(mt){var ze;mt.done?q(mt.value):(ze=mt.value,ze instanceof C?ze:new C(function(_t){_t(ze)})).then(ye,Be)}Ze((U=U.apply(X,v||[])).next())})}function we(X,v){var C,U,q,V,ye={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return V={next:Be(0),throw:Be(1),return:Be(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function Be(Ze){return function(mt){return function(ze){if(C)throw new TypeError("Generator is already executing.");for(;ye;)try{if(C=1,U&&(q=2&ze[0]?U.return:ze[0]?U.throw||((q=U.return)&&q.call(U),0):U.next)&&!(q=q.call(U,ze[1])).done)return q;switch(U=0,q&&(ze=[2&ze[0],q.value]),ze[0]){case 0:case 1:q=ze;break;case 4:return ye.label++,{value:ze[1],done:!1};case 5:ye.label++,U=ze[1],ze=[0];continue;case 7:ze=ye.ops.pop(),ye.trys.pop();continue;default:if(!(q=ye.trys,(q=q.length>0&&q[q.length-1])||ze[0]!==6&&ze[0]!==2)){ye=0;continue}if(ze[0]===3&&(!q||ze[1]>q[0]&&ze[1]',"select"),this.addActionButton(U,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(U,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(U,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(U,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(U,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(U,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(U,'',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(V){var ye=document.createElement("div");ye.className=""+C.toolbarButtonStyleClass.name,ye.setAttribute("data-type-name",V.typeName),ye.innerHTML=V.icon,ye.addEventListener("click",function(){C.markerToolbarButtonClicked(ye,V)}),C.buttons.push(ye),C.markerButtons.push(ye)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var q=document.createElement("div");q.className=this.toolbarBlockStyleClass.name,q.style.whiteSpace="nowrap",q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(q),this.addActionButton(q,'',"render"),this.addActionButton(q,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},X.prototype.addButtonClickListener=function(v){this.buttonClickListeners.push(v)},X.prototype.removeButtonClickListener=function(v){this.buttonClickListeners.indexOf(v)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(v),1)},X.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},X.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var v=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var C=0;C0&&this.buttonClickListeners.forEach(function(U){return U("marker",C)}),this.markerButtonOverflowBlock.style.display="none"},X.prototype.actionToolbarButtonClicked=function(v,C){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("action",C)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},X.prototype.setActiveButton=function(v){this.resetButtonStyles(),v.className=v.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),v.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},X.prototype.setActiveMarkerButton=function(v){var C=this.markerButtons.find(function(U){return U.getAttribute("data-type-name")===v});C&&this.setActiveButton(C)},X.prototype.setCurrentMarker=function(v){var C=this;this.currentMarker=v,this.buttons.filter(function(U){return/delete|notes/.test(U.getAttribute("data-action"))}).forEach(function(U){C.currentMarker===void 0?(U.style.fillOpacity="0.4",U.style.pointerEvents="none"):(U.style.fillOpacity="1",U.style.pointerEvents="all")})},X}(),Me=function(){function X(v,C,U,q){this.panels=[],this.panelButtons=[],this.markerjsContainer=v,this.displayMode=C,this.uiStyleSettings=U,this.styles=q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return X.prototype.addStyles=function(){var v;this.toolboxStyleClass=this.styles.addClass(new Ce("toolbox",` width: 100%; flex-shrink: 0; display: flex; flex-direction: column; font-family: sans-serif; `+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+` box-sizing: content-box; `+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+` `+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+` `+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+` overflow: hidden; `)),this.toolboxStyleColorsClass=this.styles.addClass(new Ce("toolbox_colors",` color: `+this.uiStyleSettings.toolboxColor+`; `));var C=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ce("toolbox-button-row",` display: flex; cursor: default; box-sizing: content-box; `)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ce("toolbox-button-row_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`; `)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ce("toolbox-panel-row",` display: flex; `+(this.displayMode==="inline"?"position: absolute;":"")+` `+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+` cursor: default; height: `+1.5*this.uiStyleSettings.toolbarHeight+`px; `+(this.displayMode==="inline"?"width: 100%;":"")+` box-sizing: content-box; `)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new Ce("toolbox-panel-row_colors",` background-color: `+((v=this.uiStyleSettings.toolboxBackgroundColor)!==null&&v!==void 0?v:this.uiStyleSettings.toolbarBackgroundHoverColor)+`; `)),this.toolboxButtonStyleClass=this.styles.addClass(new Ce("toolbox_button",` display: inline-block; width: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px; height: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px; padding: `+C+`px; box-sizing: content-box; `)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Ce("toolbox-button_colors",` fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ce("toolbox-active-button_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`; fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.styles.addRule(new Ie("."+this.toolboxButtonStyleColorsClass.name+":hover",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+` `)),this.styles.addRule(new Ie("."+this.toolboxButtonStyleClass.name+" svg",` height: `+this.uiStyleSettings.toolbarHeight/2+`px; `))},X.prototype.show=function(v){var C;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=v,this.uiContainer.className=this.toolboxStyleClass.name+" "+((C=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&C!==void 0?C:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},X.prototype.setPanelButtons=function(v){var C,U,q=this;this.panels=v,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((C=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&C!==void 0?C:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((U=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&U!==void 0?U:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(V){var ye;V.uiStyleSettings=q.uiStyleSettings;var Be=document.createElement("div");Be.className=q.toolboxButtonStyleClass.name+" "+((ye=q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ye!==void 0?ye:q.toolboxButtonStyleColorsClass.name),Be.innerHTML=V.icon,Be.title=V.title,Be.addEventListener("click",function(){q.panelButtonClick(V)}),q.panelButtons.push(Be),q.buttonRow.appendChild(Be)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},X.prototype.panelButtonClick=function(v){var C=this,U=-1;if(v!==this.activePanel){U=this.panels.indexOf(v),this.panelRow.innerHTML="";var q=v.getUi();q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=v}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){C.displayMode==="inline"?C.panelRow.style.display="none":C.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(V,ye){var Be,Ze;V.className=C.toolboxButtonStyleClass.name+" "+(ye===U?""+((Be=C.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Be!==void 0?Be:C.toolboxActiveButtonStyleColorsClass.name):""+((Ze=C.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ze!==void 0?Ze:C.toolboxButtonStyleColorsClass.name))})},X}(),We=function(X,v){this.title=X,this.icon=v},He=function(X){function v(C,U,q,V){var ye=X.call(this,C,V||'')||this;return ye.colors=[],ye.addTransparent=!1,ye.colorBoxes=[],ye.colors=U,ye.currentColor=q,ye.setCurrentColor=ye.setCurrentColor.bind(ye),ye.getColorBox=ye.getColorBox.bind(ye),ye}return Te(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.whiteSpace="nowrap",this.colors.forEach(function(q){var V=C.getColorBox(q);U.appendChild(V),C.colorBoxes.push(V)}),U},v.prototype.getColorBox=function(C){var U=this,q=this.uiStyleSettings.toolbarHeight/4,V=this.uiStyleSettings.toolbarHeight-q,ye=document.createElement("div");ye.style.display="inline-block",ye.style.boxSizing="content-box",ye.style.width=V-2+"px",ye.style.height=V-2+"px",ye.style.padding="1px",ye.style.marginRight="2px",ye.style.marginBottom="2px",ye.style.borderWidth="2px",ye.style.borderStyle="solid",ye.style.borderRadius=(V+2)/2+"px",ye.style.borderColor=C===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ye.addEventListener("click",function(){U.setCurrentColor(C,ye)});var Be=document.createElement("div");return Be.style.display="inline-block",Be.style.width=V-2+"px",Be.style.height=V-2+"px",Be.style.backgroundColor=C,Be.style.borderRadius=V/2+"px",C==="transparent"&&(Be.style.fill=this.uiStyleSettings.toolboxAccentColor,Be.innerHTML=` `),ye.appendChild(Be),ye},v.prototype.setCurrentColor=function(C,U){var q=this;this.currentColor=C,this.colorBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(C)},v}(We),Ue=function(){function X(v,C,U){this._state="new",this._isSelected=!1,this._container=v,this._overlayContainer=C,this.globalSettings=U,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(X.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),X.prototype.ownsTarget=function(v){return!1},Object.defineProperty(X.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),X.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},X.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},X.prototype.pointerDown=function(v,C){},X.prototype.dblClick=function(v,C){},X.prototype.manipulate=function(v){},X.prototype.pointerUp=function(v){this.stateChanged()},X.prototype.dispose=function(){},X.prototype.addMarkerVisualToContainer=function(v){this.container.childNodes.length>0?this.container.insertBefore(v,this.container.childNodes[0]):this.container.appendChild(v)},X.prototype.getState=function(){return{typeName:X.typeName,state:this.state,notes:this.notes}},X.prototype.restoreState=function(v){this._state=v.state,this.notes=v.notes},X.prototype.scale=function(v,C){},X.prototype.colorChanged=function(v){this.onColorChanged&&this.onColorChanged(v),this.stateChanged()},X.prototype.fillColorChanged=function(v){this.onFillColorChanged&&this.onFillColorChanged(v),this.stateChanged()},X.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var v=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),v.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(v)&&this.onStateChanged(this)}},X.typeName="MarkerBase",X}(),Fe=function(){function X(){this.findGripByVisual=this.findGripByVisual.bind(this)}return X.prototype.findGripByVisual=function(v){return this.topLeft.ownsTarget(v)?this.topLeft:this.topCenter.ownsTarget(v)?this.topCenter:this.topRight.ownsTarget(v)?this.topRight:this.centerLeft.ownsTarget(v)?this.centerLeft:this.centerRight.ownsTarget(v)?this.centerRight:this.bottomLeft.ownsTarget(v)?this.bottomLeft:this.bottomCenter.ownsTarget(v)?this.bottomCenter:this.bottomRight.ownsTarget(v)?this.bottomRight:void 0},X}(),nt=function(){function X(){this.GRIP_SIZE=10,this.visual=le.createGroup(),this.visual.appendChild(le.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(le.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(v){return v===this.visual||v===this.visual.childNodes[0]||v===this.visual.childNodes[1]},X}(),at=function(){function X(){}return X.toITransformMatrix=function(v){return{a:v.a,b:v.b,c:v.c,d:v.d,e:v.e,f:v.f}},X.toSVGMatrix=function(v,C){return v.a=C.a,v.b=C.b,v.c=C.c,v.d=C.d,v.e=C.e,v.f=C.f,v},X}(),qe=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.left=0,V.top=0,V.width=0,V.height=0,V.defaultSize={x:50,y:20},V.offsetX=0,V.offsetY=0,V.rotationAngle=0,V.CB_DISTANCE=10,V._suppressMarkerCreateEvent=!1,V.container.transform.baseVal.appendItem(le.createTransform()),V.setupControlBox(),V}return Te(v,X),Object.defineProperty(v.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"visual",{get:function(){return this._visual},set:function(C){this._visual=C;var U=le.createTransform();this._visual.transform.baseVal.appendItem(U)},enumerable:!1,configurable:!0}),v.prototype.ownsTarget=function(C){return!!X.prototype.ownsTarget.call(this,C)||!!(this.controlGrips.findGripByVisual(C)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(C))},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.state==="new"&&(this.left=C.x,this.top=C.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var q=this.unrotatePoint(C);if(this.manipulationStartX=q.x,this.manipulationStartY=q.y,this.offsetX=q.x-this.left,this.offsetY=q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(U),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(U)){this.activeGrip=this.rotatorGrip;var V=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=V.x-this.width/2,this.top=V.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ye=this.container.transform.baseVal.getItem(0);ye.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ye,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},v.prototype.pointerUp=function(C){var U=this.state;X.prototype.pointerUp.call(this,C),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(C),this._state="select",U==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},v.prototype.moveVisual=function(C){this.visual.style.transform="translate("+C.x+"px, "+C.y+"px)"},v.prototype.manipulate=function(C){var U=this.unrotatePoint(C);this.state==="creating"?this.resize(C):this.state==="move"?(this.left=this.manipulationStartLeft+(U.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(U.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(U):this.state==="rotate"&&this.rotate(C)},v.prototype.resize=function(C){var U=this.manipulationStartLeft,q=this.manipulationStartWidth,V=this.manipulationStartTop,ye=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:U=this.manipulationStartLeft+C.x-this.manipulationStartX,q=this.manipulationStartWidth+this.manipulationStartLeft-U;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:q=this.manipulationStartWidth+C.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:V=this.manipulationStartTop+C.y-this.manipulationStartY,ye=this.manipulationStartHeight+this.manipulationStartTop-V;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ye=this.manipulationStartHeight+C.y-this.manipulationStartY}q>=0?(this.left=U,this.width=q):(this.left=U+q,this.width=-q),ye>=0?(this.top=V,this.height=ye):(this.top=V+ye,this.height=-ye),this.setSize()},v.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},v.prototype.rotate=function(C){if(Math.abs(C.x-this.centerX)>.1){var U=Math.sign(C.x-this.centerX);this.rotationAngle=180*Math.atan((C.y-this.centerY)/(C.x-this.centerX))/Math.PI+90*U,this.applyRotation()}},v.prototype.applyRotation=function(){var C=this.container.transform.baseVal.getItem(0);C.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(C,0)},v.prototype.rotatePoint=function(C){if(this.rotationAngle===0)return C;var U=this.container.getCTM(),q=le.createPoint(C.x,C.y);return{x:(q=q.matrixTransform(U)).x,y:q.y}},v.prototype.unrotatePoint=function(C){if(this.rotationAngle===0)return C;var U=this.container.getCTM();U=U.inverse();var q=le.createPoint(C.x,C.y);return{x:(q=q.matrixTransform(U)).x,y:q.y}},v.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},v.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},v.prototype.setupControlBox=function(){this.controlBox=le.createGroup();var C=le.createTransform();C.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(C),this.container.appendChild(this.controlBox),this.controlRect=le.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=le.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Fe,this.addControlGrips(),this.controlBox.style.display="none"},v.prototype.adjustControlBox=function(){var C=this.controlBox.transform.baseVal.getItem(0);C.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(C,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},v.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},v.prototype.createGrip=function(){var C=new nt;return C.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(C.visual),C},v.prototype.positionGrips=function(){var C=this.controlGrips.topLeft.GRIP_SIZE,U=-C/2,q=U,V=(this.width+this.CB_DISTANCE)/2-C/2,ye=(this.height+this.CB_DISTANCE)/2-C/2,Be=this.height+this.CB_DISTANCE-C/2,Ze=this.width+this.CB_DISTANCE-C/2;this.positionGrip(this.controlGrips.topLeft.visual,U,q),this.positionGrip(this.controlGrips.topCenter.visual,V,q),this.positionGrip(this.controlGrips.topRight.visual,Ze,q),this.positionGrip(this.controlGrips.centerLeft.visual,U,ye),this.positionGrip(this.controlGrips.centerRight.visual,Ze,ye),this.positionGrip(this.controlGrips.bottomLeft.visual,U,Be),this.positionGrip(this.controlGrips.bottomCenter.visual,V,Be),this.positionGrip(this.controlGrips.bottomRight.visual,Ze,Be),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,V,q-3*this.CB_DISTANCE)},v.prototype.positionGrip=function(C,U,q){var V=C.transform.baseVal.getItem(0);V.setTranslate(U,q),C.transform.baseVal.replaceItem(V,0)},v.prototype.hideControlBox=function(){this.controlBox.style.display="none"},v.prototype.showControlBox=function(){this.controlBox.style.display=""},v.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:at.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:at.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},X.prototype.getState.call(this))},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C);var U=C;this.left=U.left,this.top=U.top,this.width=U.width,this.height=U.height,this.rotationAngle=U.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(at.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,U.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(at.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,U.containerTransformMatrix))},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U);var q=this.rotatePoint({x:this.left,y:this.top}),V=this.unrotatePoint({x:q.x*C,y:q.y*U});this.left=V.x,this.top=V.y,this.width=this.width*C,this.height=this.height*U,this.adjustControlBox()},v}(Ue),Je=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.createVisual=V.createVisual.bind(V),V}return Te(v,X),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.visual)},v.prototype.createVisual=function(){this.visual=le.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},v.prototype.manipulate=function(C){X.prototype.manipulate.call(this,C)},v.prototype.resize=function(C){X.prototype.resize.call(this,C),this.setSize()},v.prototype.setSize=function(){X.prototype.setSize.call(this),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},v.prototype.pointerUp=function(C){X.prototype.pointerUp.call(this,C),this.setSize()},v.prototype.setStrokeColor=function(C){this.strokeColor=C,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(C),this.stateChanged()},v.prototype.setFillColor=function(C){this.fillColor=C,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},v.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},v.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},v.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this))},v.prototype.restoreState=function(C){var U=C;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),X.prototype.restoreState.call(this,C),this.setSize()},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U),this.setSize()},v.title="Rectangle marker",v}(qe),ot=function(X){function v(C,U,q,V){var ye=X.call(this,C,V||'')||this;return ye.widths=[],ye.widthBoxes=[],ye.widths=U,ye.currentWidth=q,ye.setCurrentWidth=ye.setCurrentWidth.bind(ye),ye}return Te(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.widths.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.flexGrow="2",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=q===C.currentWidth?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentWidth(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.innerText=q.toString(),ye.style.marginRight="5px",V.appendChild(ye);var Be=document.createElement("div");Be.style.minHeight="20px",Be.style.flexGrow="2",Be.style.display="flex",Be.style.alignItems="center";var Ze=document.createElement("hr");Ze.style.minWidth="20px",Ze.style.border="0px",Ze.style.borderTop=q+"px solid "+C.uiStyleSettings.toolboxColor,Ze.style.flexGrow="2",Be.appendChild(Ze),V.appendChild(Be),C.widthBoxes.push(V)}),U},v.prototype.setCurrentWidth=function(C,U){var q=this;this.currentWidth=C,this.widthBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},v}(We),Xe=function(X){function v(C,U,q,V){var ye=X.call(this,C,V||'')||this;return ye.styles=[],ye.styleBoxes=[],ye.styles=U,ye.currentStyle=q,ye.setCurrentStyle=ye.setCurrentStyle.bind(ye),ye}return Te(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.styles.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/C.styles.length-5+"%",V.style.borderColor=q===C.currentStyle?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentStyle(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.overflow="hidden";var Be=` `;ye.innerHTML=Be,V.appendChild(ye),C.styleBoxes.push(V)}),U},v.prototype.setCurrentStyle=function(C,U){var q=this;this.currentStyle=C,this.styleBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},v}(We),Qe=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new He("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new ot("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new Xe("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Te(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=X.prototype.getState.call(this);return C.typeName=v.typeName,C},v.typeName="FrameMarker",v.title="Frame marker",v.icon='',v}(Je),De=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},ut=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.x1=0,V.y1=0,V.x2=0,V.y2=0,V.defaultLength=50,V.manipulationStartX=0,V.manipulationStartY=0,V.manipulationStartX1=0,V.manipulationStartY1=0,V.manipulationStartX2=0,V.manipulationStartY2=0,V.setupControlBox(),V}return Te(v,X),v.prototype.ownsTarget=function(C){return!!X.prototype.ownsTarget.call(this,C)||!(!this.grip1.ownsTarget(C)&&!this.grip2.ownsTarget(C))},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.manipulationStartX=C.x,this.manipulationStartY=C.y,this.state==="new"&&(this.x1=C.x,this.y1=C.y,this.x2=C.x,this.y2=C.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(U)?this.activeGrip=this.grip1:this.grip2.ownsTarget(U)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},v.prototype.pointerUp=function(C){var U=this.state;X.prototype.pointerUp.call(this,C),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(C),this._state="select",U==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},v.prototype.adjustVisual=function(){},v.prototype.manipulate=function(C){this.state==="creating"?this.resize(C):this.state==="move"?(this.x1=this.manipulationStartX1+C.x-this.manipulationStartX,this.y1=this.manipulationStartY1+C.y-this.manipulationStartY,this.x2=this.manipulationStartX2+C.x-this.manipulationStartX,this.y2=this.manipulationStartY2+C.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(C)},v.prototype.resize=function(C){switch(this.activeGrip){case this.grip1:this.x1=C.x,this.y1=C.y;break;case this.grip2:case void 0:this.x2=C.x,this.y2=C.y}this.adjustVisual(),this.adjustControlBox()},v.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},v.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},v.prototype.setupControlBox=function(){this.controlBox=le.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},v.prototype.adjustControlBox=function(){this.positionGrips()},v.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},v.prototype.createGrip=function(){var C=new nt;return C.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(C.visual),C},v.prototype.positionGrips=function(){var C=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-C/2,this.y1-C/2),this.positionGrip(this.grip2.visual,this.x2-C/2,this.y2-C/2)},v.prototype.positionGrip=function(C,U,q){var V=C.transform.baseVal.getItem(0);V.setTranslate(U,q),C.transform.baseVal.replaceItem(V,0)},v.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},X.prototype.getState.call(this))},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C);var U=C;this.x1=U.x1,this.y1=U.y1,this.x2=U.x2,this.y2=U.y2},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U),this.x1=this.x1*C,this.y1=this.y1*U,this.x2=this.x2*C,this.y2=this.y2*U,this.adjustVisual(),this.adjustControlBox()},v}(Ue),et=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new He("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new ot("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new Xe("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Te(v,X),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorLine&&C!==this.visibleLine)},v.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},v.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),le.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},v.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},v.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},v.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C);var U=C;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.createVisual(),this.adjustVisual()},v.typeName="LineMarker",v.title="Line marker",v.icon='',v}(ut),ke=function(X){function v(C,U,q,V){var ye=X.call(this,C,V||'')||this;return ye.fonts=[],ye.fontBoxes=[],ye.fonts=U,ye.currentFont=q,ye.setCurrentFont=ye.setCurrentFont.bind(ye),ye}return Te(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.flexGrow="2",this.fonts.forEach(function(q){var V=document.createElement("div");V.style.display="inline-block",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/C.fonts.length-5+"%",V.style.borderColor=q===C.currentFont?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentFont(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.style.display="flex",ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.fontFamily=q,ye.style.overflow="hidden";var Be=document.createElement("div");Be.style.whiteSpace="nowrap",Be.style.overflow="hidden",Be.style.textOverflow="ellipsis",Be.innerHTML="The quick brown fox jumps over the lazy dog",ye.appendChild(Be),V.appendChild(ye),C.fontBoxes.push(V)}),U},v.prototype.setCurrentFont=function(C,U){var q=this;this.currentFont=C,this.fontBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},v}(We),Ge=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.color="transparent",V.padding=5,V.DEFAULT_TEXT="your text here",V.text=V.DEFAULT_TEXT,V.isMoved=!1,V.color=q.defaultColor,V.fontFamily=q.defaultFontFamily,V.defaultSize={x:100,y:30},V.setColor=V.setColor.bind(V),V.setFont=V.setFont.bind(V),V.renderText=V.renderText.bind(V),V.sizeText=V.sizeText.bind(V),V.textEditDivClicked=V.textEditDivClicked.bind(V),V.showTextEditor=V.showTextEditor.bind(V),V.setSize=V.setSize.bind(V),V.positionTextEditor=V.positionTextEditor.bind(V),V.colorPanel=new He("Color",q.defaultColorSet,q.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.fontFamilyPanel=new ke("Font",q.defaultFontFamilies,q.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V}return Te(v,X),v.prototype.ownsTarget=function(C){if(X.prototype.ownsTarget.call(this,C)||C===this.visual||C===this.textElement||C===this.bgRectangle)return!0;var U=!1;return this.textElement.childNodes.forEach(function(q){q===C&&(U=!0)}),U},v.prototype.createVisual=function(){this.visual=le.createGroup(),this.bgRectangle=le.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=le.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.isMoved=!1,this.pointerDownPoint=C,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},v.prototype.renderText=function(){var C=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(U){C.textElement.appendChild(le.createTSpan(U.trim()===""?" ":U.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},v.prototype.getTextScale=function(){var C=this.textElement.getBBox(),U=1;if(C.width>0&&C.height>0){var q=(1*this.width-this.width*this.padding*2/100)/C.width,V=(1*this.height-this.height*this.padding*2/100)/C.height;U=Math.min(q,V)}return U},v.prototype.getTextPosition=function(C){var U=this.textElement.getBBox(),q=0,V=0;return U.width>0&&U.height>0&&(q=(this.width-U.width*C)/2,V=this.height/2-U.height*C/2),{x:q,y:V}},v.prototype.sizeText=function(){var C=this.textElement.getBBox(),U=this.getTextScale(),q=this.getTextPosition(U);q.y-=C.y*U,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+q.x+"px, "+q.y+"px) scale("+U+", "+U+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(q.x,q.y),this.textElement.transform.baseVal.getItem(1).setScale(U,U))},v.prototype.manipulate=function(C){X.prototype.manipulate.call(this,C),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(C.x-this.pointerDownPoint.x)>5||Math.abs(C.y-this.pointerDownPoint.y)>5)},v.prototype.resize=function(C){X.prototype.resize.call(this,C),this.isMoved=!0,this.setSize(),this.sizeText()},v.prototype.setSize=function(){X.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},v.prototype.pointerUp=function(C){var U=this.state;U==="creating"&&(this._suppressMarkerCreateEvent=!0),X.prototype.pointerUp.call(this,C),this.setSize(),(U==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},v.prototype.showTextEditor=function(){var C=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(U){U.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var U=Number.parseFloat(C.textEditor.style.fontSize);C.textEditor.clientWidth>=Number.parseInt(C.textEditor.style.maxWidth)&&U>.9;)U-=.1,C.textEditor.style.fontSize=Math.max(U,.9)+"em"}),this.textEditor.addEventListener("keyup",function(U){U.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(U){if(U.clipboardData){var q=U.clipboardData.getData("text"),V=window.getSelection();if(!V.rangeCount)return!1;V.deleteFromDocument(),V.getRangeAt(0).insertNode(document.createTextNode(q)),U.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){C.textEditDivClicked(C.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},v.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var C=this.getTextScale(),U=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),q=this.textElement.getBBox(),V={x:q.width*C,y:q.height*C};U.x-=V.x/2,U.y-=V.y/2,this.textEditor.style.top=U.y+"px",this.textEditor.style.left=U.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-U.x+"px",this.textEditor.style.fontSize=Math.max(16*C,12)+"px",this.textElement.style.display="none"}},v.prototype.textEditDivClicked=function(C){this.text=C.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},v.prototype.select=function(){X.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},v.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),X.prototype.deselect.call(this)},v.prototype.dblClick=function(C,U){X.prototype.dblClick.call(this,C,U),this.showTextEditor()},v.prototype.setColor=function(C){this.textElement&&le.setAttributes(this.textElement,[["fill",C]]),this.color=C,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(C)},v.prototype.setFont=function(C){this.textElement&&le.setAttributes(this.textElement,[["font-family",C]]),this.fontFamily=C,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},v.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},v.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){var U=C;this.color=U.color,this.fontFamily=U.fontFamily,this.padding=U.padding,this.text=U.text,this.createVisual(),X.prototype.restoreState.call(this,C),this.setSize()},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U),this.setSize(),this.sizeText(),this.positionTextEditor()},v.typeName="TextMarker",v.title="Text marker",v.icon='',v}(qe),Ee=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.color="transparent",V.lineWidth=3,V.drawing=!1,V.pixelRatio=1,V.color=q.defaultColor,V.lineWidth=q.defaultStrokeWidth,V.pixelRatio=q.freehandPixelRatio,V.setColor=V.setColor.bind(V),V.addCanvas=V.addCanvas.bind(V),V.finishCreation=V.finishCreation.bind(V),V.setLineWidth=V.setLineWidth.bind(V),V.colorPanel=new He("Color",q.defaultColorSet,q.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.lineWidthPanel=new ot("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.lineWidthPanel.onWidthChanged=V.setLineWidth,V}return Te(v,X),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.drawingImage)},v.prototype.createVisual=function(){this.visual=le.createGroup(),this.drawingImage=le.createImage(),this.visual.appendChild(this.drawingImage);var C=le.createTransform();this.visual.transform.baseVal.appendItem(C),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(C,U){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(C.x,C.y),this.drawing=!0):X.prototype.pointerDown.call(this,C,U)},v.prototype.manipulate=function(C){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(C.x,C.y),this.canvasContext.stroke()):X.prototype.manipulate.call(this,C)},v.prototype.resize=function(C){X.prototype.resize.call(this,C),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},v.prototype.pointerUp=function(C){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):X.prototype.pointerUp.call(this,C)},v.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},v.prototype.select=function(){this.state==="creating"&&this.finishCreation(),X.prototype.select.call(this)},v.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),X.prototype.deselect.call(this)},v.prototype.finishCreation=function(){for(var C=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),U=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],q=U[0],V=U[1],ye=U[2],Be=U[3],Ze=!1,mt=0;mt0&&(Ze=!0,mtBe&&(Be=mt),ze>ye&&(ye=ze));if(Ze){this.left=q/this.pixelRatio,this.top=V/this.pixelRatio,this.width=(ye-q)/this.pixelRatio,this.height=(Be-V)/this.pixelRatio;var _t=document.createElement("canvas");_t.width=ye-q,_t.height=Be-V,_t.getContext("2d").putImageData(this.canvasContext.getImageData(q,V,ye-q,Be-V),0,0),this.drawingImgUrl=_t.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},v.prototype.setDrawingImage=function(){le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},v.prototype.setColor=function(C){this.color=C,this.colorChanged(C)},v.prototype.setLineWidth=function(C){this.lineWidth=C},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=Object.assign({drawingImgUrl:this.drawingImgUrl},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){this.createVisual(),X.prototype.restoreState.call(this,C),this.drawingImgUrl=C.drawingImgUrl,this.setDrawingImage()},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U),this.setDrawingImage()},v.typeName="FreehandMarker",v.title="Freehand marker",v.icon='',v}(qe),pe=function(X){function v(C,U,q){var V=X.call(this,C,q||'')||this;return V.typeBoxes=[],V.currentType=U,V.setCurrentType=V.setCurrentType.bind(V),V}return Te(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2";for(var q=function(Be){var Ze="both";switch(Be){case 0:Ze="both";break;case 1:Ze="start";break;case 2:Ze="end";break;case 3:Ze="none"}var mt=document.createElement("div");if(mt.style.display="flex",mt.style.flexGrow="2",mt.style.alignItems="center",mt.style.justifyContent="space-between",mt.style.padding="5px",mt.style.borderWidth="2px",mt.style.borderStyle="solid",mt.style.borderColor=Ze===V.currentType?V.uiStyleSettings.toolboxAccentColor:"transparent",mt.addEventListener("click",function(){C.setCurrentType(Ze,mt)}),U.appendChild(mt),Ze==="both"||Ze==="start"){var ze=document.createElement("div");ze.style.display="flex",ze.style.alignItems="center",ze.style.minHeight="20px",ze.innerHTML=` `,ze.style.marginLeft="5px",mt.appendChild(ze)}var _t=document.createElement("div");_t.style.display="flex",_t.style.alignItems="center",_t.style.minHeight="20px",_t.style.flexGrow="2";var Ht=document.createElement("hr");if(Ht.style.minWidth="20px",Ht.style.border="0px",Ht.style.borderTop="3px solid "+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee"),Ht.style.flexGrow="2",_t.appendChild(Ht),mt.appendChild(_t),Ze==="both"||Ze==="end"){var $t=document.createElement("div");$t.style.display="flex",$t.style.alignItems="center",$t.style.minHeight="20px",$t.innerHTML=` `,$t.style.marginRight="5px",mt.appendChild($t)}V.typeBoxes.push(mt)},V=this,ye=0;ye<4;ye++)q(ye);return U},v.prototype.setCurrentType=function(C,U){var q=this;this.currentType=C,this.typeBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},v}(We),_e=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.arrowType="end",V.arrowBaseHeight=10,V.arrowBaseWidth=10,V.getArrowPoints=V.getArrowPoints.bind(V),V.setArrowType=V.setArrowType.bind(V),V.arrowTypePanel=new pe("Arrow type","end"),V.arrowTypePanel.onArrowTypeChanged=V.setArrowType,V}return Te(v,X),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.arrow1&&C!==this.arrow2)},v.prototype.getArrowPoints=function(C,U){var q=this.arrowBaseWidth+2*this.strokeWidth,V=this.arrowBaseHeight+2*this.strokeWidth;return C-q/2+","+(U+V/2)+" "+C+","+(U-V/2)+" "+(C+q/2)+","+(U+V/2)},v.prototype.createTips=function(){this.arrow1=le.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=le.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow2)},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.state==="creating"&&this.createTips()},v.prototype.adjustVisual=function(){if(X.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",le.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),le.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var C=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.arrow1.transform.baseVal.getItem(0);U.setRotate(C,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(U,0);var q=this.arrow2.transform.baseVal.getItem(0);q.setRotate(C+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(q,0)}},v.prototype.setArrowType=function(C){this.arrowType=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=Object.assign({arrowType:this.arrowType},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C);var U=C;this.arrowType=U.arrowType,this.createTips(),this.adjustVisual()},v.typeName="ArrowMarker",v.title="Arrow marker",v.icon='',v}(et),re=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.fillColor=q.defaultFillColor,V.strokeWidth=0,V.fillPanel=new He("Color",q.defaultColorSet,q.defaultFillColor),V.fillPanel.onColorChanged=V.setFillColor,V}return Te(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=X.prototype.getState.call(this);return C.typeName=v.typeName,C},v.typeName="CoverMarker",v.title="Cover marker",v.icon='',v}(Je),ne=function(X){function v(C,U,q,V){var ye=X.call(this,C,V||'')||this;return ye.opacities=[],ye.opacityBoxes=[],ye.opacities=U,ye.currentOpacity=q,ye.setCurrentOpacity=ye.setCurrentOpacity.bind(ye),ye}return Te(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",U.style.justifyContent="space-between",this.opacities.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="center",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=q===C.currentOpacity?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentOpacity(q,V)}),U.appendChild(V);var ye=document.createElement("div");ye.innerText=100*q+"%",V.appendChild(ye),C.opacityBoxes.push(V)}),U},v.prototype.setCurrentOpacity=function(C,U){var q=this;this.currentOpacity=C,this.opacityBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},v}(We),de=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.setOpacity=V.setOpacity.bind(V),V.fillColor=q.defaultHighlightColor,V.strokeWidth=0,V.opacity=q.defaultHighlightOpacity,V.fillPanel=new He("Color",q.defaultColorSet,V.fillColor),V.fillPanel.onColorChanged=V.setFillColor,V.opacityPanel=new ne("Opacity",q.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return Te(v,X),v.prototype.setOpacity=function(C){this.opacity=C,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=X.prototype.getState.call(this);return C.typeName=v.typeName,C},v.typeName="HighlightMarker",v.title="Highlight marker",v.icon='',v}(re),ve='',be=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.bgColor="transparent",V.tipPosition={x:0,y:0},V.tipBase1Position={x:0,y:0},V.tipBase2Position={x:0,y:0},V.tipMoving=!1,V.color=q.defaultStrokeColor,V.bgColor=q.defaultFillColor,V.fontFamily=q.defaultFontFamily,V.defaultSize={x:100,y:30},V.setBgColor=V.setBgColor.bind(V),V.getTipPoints=V.getTipPoints.bind(V),V.positionTip=V.positionTip.bind(V),V.setTipPoints=V.setTipPoints.bind(V),V.colorPanel=new He("Text color",q.defaultColorSet,V.color,''),V.colorPanel.onColorChanged=V.setColor,V.bgColorPanel=new He("Fill color",q.defaultColorSet,V.bgColor,ve),V.bgColorPanel.onColorChanged=V.setBgColor,V.fontFamilyPanel=new ke("Font",q.defaultFontFamilies,q.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V.tipGrip=new nt,V.tipGrip.visual.transform.baseVal.appendItem(le.createTransform()),V.controlBox.appendChild(V.tipGrip.visual),V}return Te(v,X),v.prototype.ownsTarget=function(C){return X.prototype.ownsTarget.call(this,C)||this.tipGrip.ownsTarget(C)||this.tip===C},v.prototype.createTip=function(){le.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=le.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},v.prototype.pointerDown=function(C,U){this.state==="new"&&X.prototype.pointerDown.call(this,C,U),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(U)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):X.prototype.pointerDown.call(this,C,U)},v.prototype.pointerUp=function(C){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,X.prototype.pointerUp.call(this,C);else{var U=this.state==="creating";X.prototype.pointerUp.call(this,C),this.setTipPoints(U),this.positionTip()}},v.prototype.manipulate=function(C){if(this.tipMoving){var U=this.unrotatePoint(C);this.tipPosition={x:U.x-this.manipulationStartLeft,y:U.y-this.manipulationStartTop},this.positionTip()}else X.prototype.manipulate.call(this,C)},v.prototype.setBgColor=function(C){this.bgRectangle&&this.tip&&(le.setAttributes(this.bgRectangle,[["fill",C]]),le.setAttributes(this.tip,[["fill",C]])),this.bgColor=C,this.fillColorChanged(C)},v.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},v.prototype.setTipPoints=function(C){C===void 0&&(C=!1);var U=Math.min(this.height/2,15),q=this.height/5;C&&(this.tipPosition={x:U+q/2,y:this.height+20});var V=Math.atan(this.height/2/(this.width/2));this.tipPosition.x=this.width/2&&this.tipPosition.y=this.width/2&&this.tipPosition.y>=this.height/2?V.1)){var C=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.tip1.transform.baseVal.getItem(0);U.setRotate(C,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(U,0);var q=this.tip2.transform.baseVal.getItem(0);q.setRotate(C+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(q,0)}},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=X.prototype.getState.call(this);return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C),this.createTips(),this.adjustVisual()},v.typeName="MeasurementMarker",v.title="Measurement marker",v.icon='',v}(et),st=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.strokePanel.colors=q.defaultColorSet,V.fillColor="transparent",V}return Te(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=X.prototype.getState.call(this);return C.typeName=v.typeName,C},v.typeName="EllipseFrameMarker",v.title="Ellipse frame marker",v.icon='',v}(Pe),ct=function(){function X(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),X.prototype.addUndoStep=function(v){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(v)||(this.undoStack.push(v),JSON.stringify(this.lastRedoStep)!==JSON.stringify(v)&&this.redoStack.splice(0,this.redoStack.length))},X.prototype.replaceLastUndoStep=function(v){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=v)},X.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},X.prototype.undo=function(){if(this.undoStack.length>1){var v=this.undoStack.pop();return v!==void 0&&this.redoStack.push(v),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},X.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},X}(),ft=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.curveX=0,V.curveY=0,V.manipulationStartCurveX=0,V.manipulationStartCurveY=0,V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.positionGrips=V.positionGrips.bind(V),V.addControlGrips=V.addControlGrips.bind(V),V.adjustVisual=V.adjustVisual.bind(V),V.setupControlBox=V.setupControlBox.bind(V),V.resize=V.resize.bind(V),V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new He("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new ot("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new Xe("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Te(v,X),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorCurve&&C!==this.visibleCurve&&!this.curveGrip.ownsTarget(C))},v.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},v.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorCurve=le.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=le.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=C.x,this.curveY=C.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(U)&&(this.activeGrip=this.curveGrip,this._state="resize")},v.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),le.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},v.prototype.setupControlBox=function(){X.prototype.setupControlBox.call(this),this.curveControlLine1=le.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=le.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},v.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,X.prototype.addControlGrips.call(this)},v.prototype.positionGrips=function(){X.prototype.positionGrips.call(this);var C=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-C/2,this.curveY-C/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},v.prototype.manipulate=function(C){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+C.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+C.y-this.manipulationStartY),X.prototype.manipulate.call(this,C)},v.prototype.resize=function(C){this.activeGrip===this.curveGrip&&(this.curveX=C.x,this.curveY=C.y),X.prototype.resize.call(this,C),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},v.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},v.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},v.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual()},v.prototype.scale=function(C,U){this.curveX=this.curveX*C,this.curveY=this.curveY*U,X.prototype.scale.call(this,C,U)},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C);var U=C;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.curveX=U.curveX,this.curveY=U.curveY,this.createVisual(),this.adjustVisual()},v.typeName="CurveMarker",v.title="Curve marker",v.icon='',v}(ut),Ct=function(){function X(v,C){C===void 0&&(C=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=v,this.cancelable=C}return Object.defineProperty(X.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),X.prototype.preventDefault=function(){this._defaultPrevented=!0},X}(),xt=function(X){function v(C,U,q){var V=X.call(this,C,!1)||this;return V.dataUrl=U,V.state=q,V}return Te(v,X),v}(Ct),ht=function(X){function v(C,U,q){q===void 0&&(q=!1);var V=X.call(this,C,q)||this;return V.marker=U,V}return Te(v,X),v}(Ct),Ut=function(){function X(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return X.prototype.addEventListener=function(v,C){this[v].push(C)},X.prototype.removeEventListener=function(v,C){var U=this[v].indexOf(C);U>-1&&this[v].splice(U,1)},X}(),Mt=function(){function X(v){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new De,this._isOpen=!1,this.undoRedoManager=new ct,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new Ut,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=X.instanceCounter++,this.styles=new Oe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=v,this.targetRoot=document.body,this.width=v.clientWidth,this.height=v.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(X.prototype,"ALL_MARKER_TYPES",{get:function(){return[Qe,Ee,_e,Ge,st,Pe,de,be,je,re,et,ft]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Qe,Ee,_e,Ge,Pe,de,be]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Qe,Ee,_e,Ge,de]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(v){var C=this;this._availableMarkerTypes.splice(0),v.forEach(function(U){if(typeof U=="string"){var q=C.ALL_MARKER_TYPES.find(function(V){return V.typeName===U});q!==void 0&&C._availableMarkerTypes.push(q)}else C._availableMarkerTypes.push(U)})},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(v){this._zoomLevel=v,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),X.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},X.prototype.show=function(){var v=this;this.styles.styleSheetRoot===void 0&&ae.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ae.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(C){return C(new Ct(v))})},X.prototype.render=function(){return Se(this,void 0,void 0,function(){var v;return we(this,function(C){switch(C.label){case 0:return this.setCurrentMarker(),(v=new he).naturalSize=this.renderAtNaturalSize,v.imageType=this.renderImageType,v.imageQuality=this.renderImageQuality,v.markersOnly=this.renderMarkersOnly,v.width=this.renderWidth,v.height=this.renderHeight,[4,v.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return C.sent(),[4,v.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,C.sent()]}})})},X.prototype.close=function(v){var C=this;if(v===void 0&&(v=!1),this.isOpen){var U=!1;v||this.eventListeners.beforeclose.forEach(function(q){var V=new Ct(C,!0);q(V),V.defaultPrevented&&(U=!0)}),U||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(q){return q(new Ct(C))}),this.detachEvents(),this._isOpen=!1)}},X.prototype.addMarkersToToolbar=function(){for(var v,C=[],U=0;Uthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*v:this.editorCanvas.clientWidth,U=C',v.title="Powered by marker.js",v.style.display="grid",v.style.alignItems="center",v.style.justifyItems="center",v.style.padding="3px",v.style.width="20px",v.style.height="20px",this.logoUI.appendChild(v),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},X.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},X.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var v=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=v+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Le(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y-1&&this.markers.splice(this.markers.indexOf(v),1),v.dispose()},X.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},X.prototype.toolbarButtonClicked=function(v,C){if(v==="marker"&&C!==void 0)this.createNewMarker(C);else if(v==="action")switch(C){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},X.prototype.deleteSelectedMarker=function(){var v=this;if(this._currentMarker!==void 0){var C=!1;if(this.eventListeners.markerbeforedelete.forEach(function(q){var V=new ht(v,v._currentMarker,!0);q(V),V.defaultPrevented&&(C=!0)}),!C){var U=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(q){return q(new ht(v,U))})}}},X.prototype.clear=function(){var v=this,C=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ye){var Be=new ht(v,void 0,!0);ye(Be),Be.defaultPrevented&&(C=!0)}),!C)){this.setCurrentMarker();for(var U=function(ye){var Be=q.markers[ye];q.setCurrentMarker(q.markers[ye]),q._currentMarker.dispose(),q.markerImage.removeChild(q._currentMarker.container),q.markers.splice(q.markers.indexOf(q._currentMarker),1),q.eventListeners.markerdelete.forEach(function(Ze){return Ze(new ht(v,Be))})},q=this,V=this.markers.length-1;V>=0;V--)U(V);this.addUndoStep()}},Object.defineProperty(X.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),X.prototype.showNotesEditor=function(){var v;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(v=this._currentMarker.notes)!==null&&v!==void 0?v:"",this.overlayContainer.appendChild(this.notesArea))},X.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},X.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},X.prototype.addUndoStep=function(){var v=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var C=this.getState(),U=this.undoRedoManager.getLastUndoStep();if(!U||U.width===C.width&&U.height===C.height){var q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(C),q1&&this.panTo({x:v.clientX,y:v.clientY}))},X.prototype.onPointerUp=function(v){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(v.clientX,v.clientY)),this.isDragging=!1,this.addUndoStep()},X.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},X.prototype.onKeyUp=function(v){this._currentMarker===void 0||this.notesArea!==void 0||v.key!=="Delete"&&v.key!=="Backspace"||this.deleteSelectedMarker()},X.prototype.clientToLocalCoordinates=function(v,C){var U=this.markerImage.getBoundingClientRect();return{x:(v-U.left)/this.zoomLevel,y:(C-U.top)/this.zoomLevel}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var v=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=v+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},X.prototype.addLicenseKey=function(v){te.addKey(v)},X.prototype.addEventListener=function(v,C){this.eventListeners.addEventListener(v,C)},X.prototype.removeEventListener=function(v,C){this.eventListeners.removeEventListener(v,C)},X.prototype.renderState=function(v){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(v),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(X.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),X.prototype.focus=function(){var v=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(C){return C(new Ct(v))}))},X.prototype.blur=function(){var v=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(C){return C(new Ct(v))}))},X.instanceCounter=0,X}();/* ********************************** cropro version 1.2.0 @license SEE LICENSE IN LICENSE copyright Alan Mendelevich see README and LICENSE for details ********************************** *//*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var Zt=function(X,v){return(Zt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,U){C.__proto__=U}||function(C,U){for(var q in U)Object.prototype.hasOwnProperty.call(U,q)&&(C[q]=U[q])})(X,v)};function Yt(X,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");function C(){this.constructor=X}Zt(X,v),X.prototype=v===null?Object.create(v):(C.prototype=v.prototype,new C)}function Rt(X,v,C,U){return new(C||(C=Promise))(function(q,V){function ye(mt){try{Ze(U.next(mt))}catch(ze){V(ze)}}function Be(mt){try{Ze(U.throw(mt))}catch(ze){V(ze)}}function Ze(mt){var ze;mt.done?q(mt.value):(ze=mt.value,ze instanceof C?ze:new C(function(_t){_t(ze)})).then(ye,Be)}Ze((U=U.apply(X,v||[])).next())})}function Ti(X,v){var C,U,q,V,ye={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return V={next:Be(0),throw:Be(1),return:Be(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function Be(Ze){return function(mt){return function(ze){if(C)throw new TypeError("Generator is already executing.");for(;ye;)try{if(C=1,U&&(q=2&ze[0]?U.return:ze[0]?U.throw||((q=U.return)&&q.call(U),0):U.next)&&!(q=q.call(U,ze[1])).done)return q;switch(U=0,q&&(ze=[2&ze[0],q.value]),ze[0]){case 0:case 1:q=ze;break;case 4:return ye.label++,{value:ze[1],done:!1};case 5:ye.label++,U=ze[1],ze=[0];continue;case 7:ze=ye.ops.pop(),ye.trys.pop();continue;default:if(!(q=ye.trys,(q=q.length>0&&q[q.length-1])||ze[0]!==6&&ze[0]!==2)){ye=0;continue}if(ze[0]===3&&(!q||ze[1]>q[0]&&ze[1]0&&C>0){var U=new Gi(v,C),q=U.ratio>=1?20:U.getHorizontalLength(20),V=U.ratio<1?20:U.getVerticalLength(20),ye=document.createElementNS("http://www.w3.org/2000/svg","svg");ye.setAttribute("xmlns","http://www.w3.org/2000/svg"),ye.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ye);var Be=$e.createDefs();ye.appendChild(Be);var Ze=$e.createElement("clipPath",[["id","text-bg-clip"]]);Be.appendChild(Ze);var mt=$e.createPath($e.getHollowRectanglePath((24-q)/2,(24-V)/2,q,V,(24-q)/2+2,(24-V)/2+2,q-4,V-4));ye.appendChild(mt);var ze=$e.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);ze.appendChild($e.createTSpan(v+":"+C)),ye.appendChild(ze);var _t=ze.getBBox();$e.setAttributes(ze,[["x",((24-_t.width)/2).toString()],["y",((24-_t.height)/2-_t.y).toString()]]);var Ht=$e.createPath($e.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(_t.width))/2,(24-Math.ceil(_t.height))/2,Math.ceil(_t.width),Math.ceil(_t.height)));return Ze.appendChild(Ht),$e.setAttributes(mt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ye),ye.outerHTML}return''},X}(),vi=function(X){function v(C,U,q){var V=X.call(this,C,U)||this;return V.isDropdownOpen=!1,V.onClick=V.dropdownButtonClicked,V.dropdownButtons=q,V}return Yt(v,X),v.prototype.setupDropdown=function(){var C=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(U){U.className=C.className,U.colorsClassName=C.colorsClassName,C.dropdownBlock.appendChild(U.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},v.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},v.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},v.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},v.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},v.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},v}(Bt),kt=function(){function X(v,C){this.GRIP_SIZE=10,this.color=v,this.fillColor=C,this.visual=$e.createGroup(),this.visual.appendChild($e.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild($e.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(v){return v===this.visual||v===this.visual.childNodes[0]||v===this.visual.childNodes[1]},X.prototype.setCenter=function(v,C){this.visual.childNodes.forEach(function(U){return $e.setAttributes(U,[["cx",v.toString()],["cy",C.toString()]])})},X}(),Bi=function(){function X(v,C,U,q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=v,this.canvasHeight=C,this.margin=U,this.container=q,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(X.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(v){this._aspectRatio=v,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(v){this._isGridVisible=v,this.gridContainer&&$e.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(v){this._zoomFactor=v,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),X.prototype.open=function(){var v=this;this.cropShadeElement=$e.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=$e.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var C=0;Cthis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-C.height/2),$e.setAttributes(this.cropRectElement,[["x",C.x.toString()],["y",C.y.toString()],["width",C.width.toString()],["height",C.height.toString()]]);var U=C.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(V,ye){var Be=C.y+U*(ye+1);$e.setAttributes(V,[["x1",""+C.x],["y1",""+Be],["x2",""+(C.x+C.width)],["y2",""+Be]])});var q=C.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(V,ye){var Be=C.x+q*(ye+1);$e.setAttributes(V,[["x1",""+Be],["y1",""+C.y],["x2",""+Be],["y2",""+(C.y+C.height)]])}),$e.setAttributes(this.cropShadeElement,[["d",$e.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,C.x,C.y,C.width,C.height)]]),this.topLeftGrip.setCenter(C.x,C.y),this.topRightGrip.setCenter(C.x+C.width,C.y),this.bottomLeftGrip.setCenter(C.x,C.y+C.height),this.bottomRightGrip.setCenter(C.x+C.width,C.y+C.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},X.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},X.prototype.clientToLocalCoordinates=function(v,C){var U=this.container.getBoundingClientRect();return{x:v-U.left+this.margin,y:C-U.top+this.margin}},X.prototype.onPointerDown=function(v){this.container.setPointerCapture(v.pointerId),this.previousPoint=this.clientToLocalCoordinates(v.clientX,v.clientY),this.cropRectElement===v.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(v.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(v.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(v.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(v.target)&&(this.activeGrip=this.bottomRightGrip)},X.prototype.onPointerMove=function(v){if(this.isMoving)this.move(this.clientToLocalCoordinates(v.clientX,v.clientY));else if(this.activeGrip){var C=this.clientToLocalCoordinates(v.clientX,v.clientY);this.resize(C)}v.preventDefault()},X.prototype.onPointerUp=function(v){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(v.pointerId)},X.prototype.move=function(v){var C=v.x-this.previousPoint.x,U=v.y-this.previousPoint.y;this.zoomFactor!==1&&(C=-C/this.zoomFactor,U=-U/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+C),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+U),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=v},X.prototype.resize=function(v){var C=Object.assign({},this.cropRect),U=v.x-this.previousPoint.x,q=v.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:C.x+Uthis.canvasWidth*this.zoomFactor&&(U=this.canvasWidth*this.zoomFactor-C.width),C.width+=U}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(C.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(U),C.height=this.aspectRatio.getVerticalLength(C.width)):(C.y+=q,C.height=this.cropRect.y+this.cropRect.height-C.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?C.height=this.aspectRatio.getVerticalLength(C.width):C.height+=q}C.width<10&&(C.x=this.cropRect.x,C.width=10),C.height<10&&(C.y=this.cropRect.y,C.height=10),this.previousPoint=v,C.x>=this.margin&&C.y>=this.margin&&C.x-this.margin+C.width<=this.canvasWidth&&C.y-this.margin+C.height<=this.canvasHeight&&(this.cropRect=C,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},X.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var v=this.cropRect.x+this.cropRect.width/2,C=this.cropRect.y+this.cropRect.height/2,U=this.aspectRatio.getHorizontalLength(this.cropRect.height),q=this.aspectRatio.getVerticalLength(this.cropRect.width);U/this.canvasWidththis.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=v-this.cropRect.width/2,this.cropRect.y=C-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},X.prototype.getRescaledRect=function(v,C,U,q,V,ye){var Be=U/v,Ze=q/C;return{x:(V.x-ye)*Be+ye,y:(V.y-ye)*Ze+ye,width:V.width*Be,height:V.height*Ze}},X.prototype.scaleCanvas=function(v,C){var U=this.getRescaledRect(this.canvasWidth,this.canvasHeight,v,C,this.cropRect,this.margin);this.canvasWidth=v,this.canvasHeight=C,this.onCropChange&&this.onCropChange(U),this.setCropRectangle(U)},X}(),Vi=function(){function X(v){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=v,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(X.prototype,"angle",{get:function(){return this._angle},set:function(v){this._angle=v,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),X.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},X.prototype.onPointerDown=function(v){this.controlContainer.setPointerCapture(v.pointerId),this.isDragging=!0,this.previousPoint={x:v.clientX,y:v.clientY}},X.prototype.onPointerMove=function(v){this.isDragging&&(this.onAngleChange&&this.onAngleChange((v.clientX-this.previousPoint.x)/5),this.previousPoint.x=v.clientX)},X.prototype.onPointerUp=function(v){this.isDragging&&this.onAngleChange&&this.onAngleChange((v.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(v.pointerId)},X.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var v=this.angleLabelText.getBBox();$e.setAttributes(this.angleLabelElement,[["x",((this.width-v.width)/2).toString()],["y",(this.height/2).toString()]])}},X.prototype.positionScaleShape=function(){if(this.scaleShape){var v=this.scaleShape.transform.baseVal.getItem(0);v.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(v,0)}},X.prototype.getVisual=function(){var v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.setAttribute("xmlns","http://www.w3.org/2000/svg"),v.setAttribute("width",this.width+"px"),v.setAttribute("height",this.height+"px"),v.setAttribute("viewBox","0 0 "+this.width+" "+this.height),v.style.flexShrink="0",document.body.appendChild(v);for(var C="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,U=1;U<=this.width/5+10;U++){var q=U%5==0?this.height/3:this.height/6;C+="h4v"+-q+"h1v"+q}C+="v1H0Z",this.scaleShape=$e.createPath(C);var V=$e.createTransform();this.scaleShape.transform.baseVal.appendItem(V),v.appendChild(this.scaleShape),this.angleLabelElement=$e.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=$e.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ye=$e.createTSpan("");return ye.innerHTML="°",this.angleLabelElement.appendChild(ye),v.appendChild(this.angleLabelElement),document.body.removeChild(v),v},X}(),fr=function(){function X(){this.naturalSize=!1,this.imageType="image/png"}return X.prototype.rasterize=function(v,C,U,q,V,ye,Be){var Ze=this;return new Promise(function(mt){var ze=document.createElement("canvas");ze.width=v.width.baseVal.value-2*q,ze.height=v.height.baseVal.value-2*q;var _t=1,Ht=1;Ze.naturalSize===!0?(_t=C.naturalWidth/(v.width.baseVal.value-2*q)/ye,Ht=C.naturalHeight/(v.height.baseVal.value-2*q)/Be,ze.width=C.naturalWidth/ye,ze.height=C.naturalHeight/Be):Ze.width!==void 0&&Ze.height!==void 0&&(_t=Ze.width/U.width,Ht=Ze.height/U.height,ze.width*=_t,ze.height*=Ht);var $t=ze.getContext("2d");$t.translate(ze.width/2,ze.height/2),$t.rotate(V*Math.PI/180),$t.scale(ye,Be),$t.translate(-ze.width/2,-ze.height/2),$t.drawImage(C,0,0,ze.width,ze.height);var Pi=document.createElement("canvas");Pi.width=U.width*_t,Pi.height=U.height*Ht,Pi.getContext("2d").putImageData($t.getImageData((U.x-q)*_t,(U.y-q)*Ht,U.width*_t,U.height*Ht),0,0),mt(Pi.toDataURL(Ze.imageType,Ze.imageQuality))})},X}(),Ve=function(){function X(v){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=X.instanceCounter++,this.styles=new wt(this.instanceNo),this.target=v,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(v){this._zoomToCropEnabled=v,v?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(v){this._isGridVisible=v,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"gridLines",{get:function(){return this._gridLines},set:function(v){this._gridLines=v,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(v){this._rotationAngle=v,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"aspectRatio",{get:function(){var v;return(v=this._aspectRatio)!==null&&v!==void 0?v:this.aspectRatios[0]},set:function(v){this._aspectRatio=v},enumerable:!1,configurable:!0}),X.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},X.prototype.show=function(){this.showUI(),this.open()},X.prototype.close=function(v){v===void 0&&(v=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),v||this.closeEventListeners.forEach(function(C){return C()}),this._isOpen=!1)},X.prototype.addRenderEventListener=function(v){this.renderEventListeners.push(v)},X.prototype.removeRenderEventListener=function(v){this.renderEventListeners.indexOf(v)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(v),1)},X.prototype.addCloseEventListener=function(v){this.closeEventListeners.push(v)},X.prototype.removeCloseEventListener=function(v){this.closeEventListeners.indexOf(v)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(v),1)},X.prototype.setupResizeObserver=function(){var v=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){v.resize(v.target.clientWidth,v.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},X.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var v=1*this.target.clientWidth/this.target.clientHeight,C=this.contentDiv.clientWidth/v>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*v:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,U=C+2*this.CANVAS_MARGINv+this.CANVAS_MARGIN?this.target.offsetTop-(v+this.CANVAS_MARGIN):0;this.coverDiv.style.top=C+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},X.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},X.prototype.addTopToolbar=function(){var v=this;this.topToolbar=new qt,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var C=new er;C.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(C);var U=[];this.aspectRatios.forEach(function(Ht){var $t=new Bt(tr.getIcon(Ht.horizontal,Ht.vertical),Ht.horizontal===0&&Ht.vertical===0?"FREE":Ht.horizontal+":"+Ht.vertical);$t.onClick=function(){return v.ratioButtonClicked(Ht)},U.push($t)}),this.aspectRatioButton=new vi(tr.getIcon(0,0),"Aspect ratio",U),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,C.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var q=new Bt('',"Toggle grid");q.isActive=this.isGridVisible,q.onClick=function(){v.isGridVisible=!v.isGridVisible,q.isActive=v.isGridVisible},C.addButton(q);var V=new Bt('',"Zoom to selection");if(V.isActive=this.zoomToCropEnabled,V.onClick=function(){v.zoomToCropEnabled=!v.zoomToCropEnabled,V.isActive=v.zoomToCropEnabled},C.addButton(V),!Ui.isLicensed){var ye=new pt;this.topToolbar.addElementBlock(ye);var Be=document.createElement("div");Be.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ze=document.createElement("a");Ze.style.color="currentColor",Ze.href="https://markerjs.com/products/cropro",Ze.target="_blank",Ze.innerHTML='',Be.appendChild(Ze),ye.addElement(Be)}var mt=new er;mt.minWidth=3*this.toolbarHeight+"px",mt.contentAlign="end",this.topToolbar.addButtonBlock(mt);var ze=new Bt('',"OK");ze.onClick=this.startRenderAndClose,mt.addButton(ze),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(ze.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var _t=new Bt('',"Close");_t.onClick=this.close,mt.addButton(_t),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(_t.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},X.prototype.addBottomToolbar=function(){var v=this;this.bottomToolbar=new qt,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var C=new er;C.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(C);var U=new Bt('',"Rotate left");U.onClick=this.rotateLeftButtonClicked,C.addButton(U);var q=new Bt('',"Rotate right");q.onClick=this.rotateRightButtonClicked,C.addButton(q);var V=new pt;V.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(V),this.straightener=new Vi("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(mt){v.rotateBy(mt),v.straightener.angle=v.rotationAngle},V.addElement(this.straightener.getUI());var ye=new er;ye.minWidth=2*this.toolbarHeight+"px",ye.contentAlign="end",this.bottomToolbar.addButtonBlock(ye);var Be=new Bt('',"Flip horizontal");Be.onClick=this.flipHorizontallyButtonClicked,ye.addButton(Be);var Ze=new Bt('',"Flip vertical");Ze.onClick=this.flipVerticallyButtonClicked,ye.addButton(Ze)},X.prototype.ratioButtonClicked=function(v){this.aspectRatio=v,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},X.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=tr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},X.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Gi(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},X.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},X.prototype.restoreState=function(v){if(v){var C=this.cropLayer.getRescaledRect(v.width,v.height,this.imageWidth,this.imageHeight,v.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(C),this.cropRectChanged(C),this.flippedHorizontally=v.flippedHorizontally,this.flippedVertically=v.flippedVertically,this.applyFlip(),this.rotationAngle=v.rotationAngle,this.applyRotation()}},X.prototype.clientToLocalCoordinates=function(v,C){var U=this.cropImage.getBoundingClientRect();return{x:v-U.left,y:C-U.top}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var v=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=v+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},X.prototype.rotateLeftButtonClicked=function(){var v=this.rotationAngle-90;this.rotationAngle%90!=0&&(v+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(v)},X.prototype.rotateRightButtonClicked=function(){var v=this.rotationAngle+90;this.rotationAngle%90!=0&&(v-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(v)},X.prototype.rotateTo=function(v){v=(v=v>180?v-360:v)<=-180?v+360:v,this.rotationAngle=v,this.applyRotation()},X.prototype.rotateBy=function(v){this.rotateTo((this.rotationAngle+v)%360)},X.prototype.applyRotation=function(){var v=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var C=this.editingTargetRotationContainer.transform.baseVal.getItem(0);C.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(C,0);var U=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/U.width,this.imageHeight/U.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=v},X.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},X.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},X.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},X.prototype.startRenderAndClose=function(){return Rt(this,void 0,void 0,function(){var v,C;return Ti(this,function(U){switch(U.label){case 0:return[4,this.render()];case 1:return v=U.sent(),C=this.getState(),this.renderEventListeners.forEach(function(q){return q(v,C)}),this.close(!0),[2]}})})},X.prototype.render=function(){return Rt(this,void 0,void 0,function(){var v;return Ti(this,function(C){switch(C.label){case 0:return(v=new fr).naturalSize=this.renderAtNaturalSize,v.imageType=this.renderImageType,v.imageQuality=this.renderImageQuality,v.width=this.renderWidth,v.height=this.renderHeight,this.unzoomFromCrop(),$e.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,v.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return C.sent(),[4,v.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,C.sent()]}})})},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Lt("toolbar",` width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`; flex-shrink: 0; display: flex; flex-direction: row; justify-content: space-between; height: `+this.toolbarHeight+`px; box-sizing: content-box; overflow: hidden; line-height: 0px; `)),this.toolbarStyleColorsClass=this.styles.addClass(new Lt("toolbar_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarBlockStyleClass=this.styles.addClass(new Lt("toolbar-block",` display: flex; align-items: center; box-sizing: content-box; `));var v=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Lt("toolbar_button",` display: inline-block; width: `+(this.toolbarHeight-2*v)+`px; height: `+(this.toolbarHeight-2*v)+`px; padding: `+v+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Lt("toolbar_button_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Lt("toolbar_active_button",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; background-color: `+this.styles.settings.toolbarBackgroundActiveColor+` `)),this.styles.addRule(new Ot("."+this.toolbarButtonStyleClass.name+" svg",` height: `+this.toolbarHeight/2+`px; `)),this.styles.addRule(new Ot("."+this.toolbarButtonStyleColorsClass.name+":hover",` background-color: `+this.styles.settings.toolbarBackgroundHoverColor+` `)),this.toolbarDropdownStyleClass=this.styles.addClass(new Lt("toolbar_dropdown",` position: absolute; max-width: `+4*this.toolbarHeight+`px; z-index: 20; white-space: normal; box-sizing: content-box; box-shadow: 3px 3px rgba(33, 33, 33, 0.1); margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px; line-height: 0px; `)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Lt("toolbar_dropdown_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Lt("toolbar_straightener_block",` display: flex; overflow: hidden; justify-content: center; -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%); `)),this.toolbarStraightenerStyleClass=this.styles.addClass(new Lt("toolbar_straightener",` display: flex; overflow: hidden; justify-content: center; height: `+(this.toolbarHeight-2*v)+`px; padding: `+v+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Lt("toolbar_straightener_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `))},X.instanceCounter=0,X}(),Tt=oe("8hTe"),pr=oe.n(Tt),mr=/]*>/g;function gr(X){var v=document.createElement("div");return v.innerHTML=X,v.childNodes.length===0?"":v.childNodes[0].nodeValue}var vr=rt.a=function(X){var v=X.value,C=v===void 0?"":v,U=X.edit,q=U===void 0?!1:U,V=X.className,ye=X.showTextOnly,Be=X.showLines,Ze=X.replaces,mt=X.zoomImg,ze=X.hasMask,_t=X.style,Ht=_t===void 0?{}:_t,$t=X.stylesPrev,Pi=$t===void 0?{}:$t,yi=String(C),_i=Object(L.useRef)(),Xi=Object(L.useRef)(),Ir=Object(L.useState)(""),li=Object(K.a)(Ir,2),Hi=li[0],or=li[1],lr=Object(L.useState)("office"),Mi=Object(K.a)(lr,2),kr=Mi[0],yr=Mi[1],zr=function(){var jt=new Ve(Xi.current);jt.displayMode="popup",jt.addRenderEventListener(function(){var pi=Object(F.a)(M.a.mark(function Dt(ri){var zt;return M.a.wrap(function(ui){for(;;)switch(ui.prev=ui.next){case 0:return _i.current.style.display="none",ui.next=3,Object(xe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ri}});case 3:zt=ui.sent,zt!=null&&zt.id&&Ze(Xi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 5:case"end":return ui.stop()}},Dt)}));return function(Dt){return pi.apply(this,arguments)}}()),jt.show()},Kr=function(){var jt=new Mt(Xi.current);jt.settings.displayMode="popup",jt.addEventListener("render",function(){var pi=Object(F.a)(M.a.mark(function Dt(ri){var zt;return M.a.wrap(function(ui){for(;;)switch(ui.prev=ui.next){case 0:if(_i.current.style.display="none",!Xi.current){ui.next=6;break}return ui.next=4,Object(xe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ri.dataUrl}});case 4:zt=ui.sent,zt!=null&&zt.id&&Ze(Xi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 6:case"end":return ui.stop()}},Dt)}));return function(Dt){return pi.apply(this,arguments)}}()),jt.show(),window.markerArea=jt},Yi=Object(L.useMemo)(function(){_i.current&&(_i.current.style.zIndex=-1);try{var ti=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,jt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,pi=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;yi=yi.replace(ti,"("+Y.a.API_SERVER+"/api/attachments/").replace(jt,'"'+Y.a.API_SERVER+"/api/attachments/").replace(pi,'"'+Y.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(ir){}var Dt=H(yi),ri=b();if(yi.match(/\[TOC\]/)&&(Dt=Dt.replace("

    [TOC]

    ",R()),O()),Dt=Dt.replace(/(__special_katext_id_\d+__)/g,function(ir,ui){var wi=ri[ui],Vr=wi.type,Er=wi.expression;return Object(ie.renderToString)(gr(Er)||"",{displayMode:Vr==="block",throwOnError:!1,output:"html"})}),Dt=Dt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ye){var zt=document.createElement("div");return zt.innerHTML=Dt,zt.innerText}return setTimeout(function(){return dn()},500),Dt},[yi]),zi=Object(L.useRef)();S.WebkitLineClamp=Be,Be&&(Ht=Object(B.a)(Object(B.a)({},Ht),S));function _r(ti){var jt=ti.target;if(jt.tagName.toUpperCase()==="IMG"){if(mt){var pi=jt.getAttribute("src");or(pi),yr("image")}}else if(jt.tagName.toUpperCase()==="A"){var Dt=jt.getAttribute("href");if(Dt.indexOf("office")>-1)ti.preventDefault(),or(Dt),yr("office");else if(Dt.indexOf("application/pdf")>-1)ti.preventDefault(),or(Dt),yr("pdf");else if(Dt.indexOf("text/html")>-1)ti.preventDefault(),or(Dt),yr("html");else if(Dt.startsWith("#")){ti.preventDefault();var ri=document.getElementById(Dt.replace("#",""));ri&&ri.scrollIntoView(!0)}}}var dn=function(){var jt,pi=(jt=zi.current)===null||jt===void 0?void 0:jt.querySelectorAll("video");pi==null||pi.forEach(function(Dt){if(Dt.oncontextmenu=function(){return!1},Dt.src.indexOf(".m3u8")>-1&&!Dt.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var ri=new W.a;ri.loadSource(Dt.src),ri.attachMedia(Dt)}}})};Object(L.useEffect)(function(){if(zi.current&&Yi&&(Yi.match(mr)&&window.PR.prettyPrint()),zi.current)return zi.current.addEventListener("click",_r),function(){zi.current.removeEventListener("click",_r),m(),O()}},[Yi,zi.current,_r]);var br=function(jt){if(!q)return;jt.target.nodeName==="IMG"?(_i.current.style.zIndex=1,_i.current.style.display="flex",_i.current.style.width=jt.target.clientWidth+"px",_i.current.style.height=jt.target.clientHeight+"px",_i.current.style.top=jt.target.offsetTop+"px",_i.current.style.left=jt.target.offsetLeft+"px",Xi.current.src=jt.target.getAttribute("src")):_i.current.style.display="none"};return g.a.createElement("div",{style:{position:"relative"}},g.a.createElement("div",{ref:zi,style:Object(B.a)({},Ht),className:"".concat(V||""," markdown-body ").concat(pr.a.mdBody),onMouseOver:br,dangerouslySetInnerHTML:{__html:Yi}}),g.a.createElement("div",{ref:_i,className:pr.a.button},g.a.createElement(Z.a,null,g.a.createElement(Q.a,{onClick:function(){return zr()}},"\u88C1\u526A"),g.a.createElement(Q.a,{onClick:function(){return Kr()}},"\u7F16\u8F91"))),g.a.createElement("img",{ref:Xi,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),g.a.createElement(se.a,{close:!0,data:Hi,type:Hi!=null&&Hi.length?kr:"",style:Object(B.a)({},Pi),onClose:function(){return or("")}}))}},"9VGf":function(vt,rt,oe){"use strict";oe.d(rt,"a",function(){return P});var ue=oe("q1tI"),Z=oe.n(ue);function P(Q,B){var F=Object(ue.useRef)();Object(ue.useEffect)(function(){F.current=Q}),Object(ue.useEffect)(function(){function K(){F.current()}if(B!==null){var G=setInterval(K,B);return function(){return clearInterval(G)}}},[B])}},BU3w:function(vt,rt,oe){"use strict";oe.d(rt,"a",function(){return F});var ue=oe("MNnm"),Z="rc-util-key";function P(K){if(K.attachTo)return K.attachTo;var G=document.querySelector("head");return G||document.body}function Q(K){var G,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ue.a)())return null;var L=document.createElement("style");if((G=M.csp)===null||G===void 0?void 0:G.nonce){var g;L.nonce=(g=M.csp)===null||g===void 0?void 0:g.nonce}L.innerHTML=K;var p=P(M),f=p.firstChild;return M.prepend&&p.prepend?p.prepend(L):M.prepend&&f?p.insertBefore(L,f):p.appendChild(L),L}var B=new Map;function F(K,G){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=P(M);if(!B.has(L)){var g=Q("",M),p=g.parentNode;B.set(L,p),p.removeChild(g)}var f=Array.from(B.get(L).children).find(function(a){return a.tagName==="STYLE"&&a[Z]===G});if(f){var h,o;if(((h=M.csp)===null||h===void 0?void 0:h.nonce)&&f.nonce!==((o=M.csp)===null||o===void 0?void 0:o.nonce)){var d;f.nonce=(d=M.csp)===null||d===void 0?void 0:d.nonce}return f.innerHTML!==K&&(f.innerHTML=K),f}var s=Q(K,M);return s[Z]=G,s}},Bd2K:function(vt,rt,oe){(function(ue){ue(oe("VrN/"),oe("osHv"))})(function(ue){ue.defineOption("autoCloseTags",!1,function(M,L,g){if(g!=ue.Init&&g&&M.removeKeyMap("autoCloseTags"),!L)return;var p={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(p["'/'"]=function(f){return F(f)}),(typeof L!="object"||L.whenOpening!==!1)&&(p["'>'"]=function(f){return Q(f)}),M.addKeyMap(p)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],P=["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 Q(M){if(M.getOption("disableInput"))return ue.Pass;for(var L=M.listSelections(),g=[],p=M.getOption("autoCloseTags"),f=0;fh.ch&&(l=l.slice(0,l.length-o.end+h.ch));var T=l.toLowerCase();if(!l||o.type=="string"&&(o.end!=h.ch||!/[\"\']/.test(o.string.charAt(o.string.length-1))||o.string.length==1)||o.type=="tag"&&a.close||o.string.indexOf("/")==h.ch-o.start-1||O&&K(O,T)>-1||G(M,d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(s)||[],l,h,!0))return ue.Pass;var R=typeof p=="object"&&p.emptyTags;if(R&&K(R,l)>-1){g[f]={text:"/>",newPos:ue.Pos(h.line,h.ch+2)};continue}var A=S&&K(S,T)>-1;g[f]={indent:A,text:">"+(A?` `:"")+"",newPos:A?ue.Pos(h.line+1,0):ue.Pos(h.line,h.ch+1)}}for(var w=typeof p=="object"&&p.dontIndentOnAutoClose,f=L.length-1;f>=0;f--){var x=g[f];M.replaceRange(x.text,L[f].head,L[f].anchor,"+insert");var _=M.listSelections().slice(0);_[f]={head:x.newPos,anchor:x.newPos},M.setSelections(_),!w&&x.indent&&(M.indentLine(x.newPos.line,null,!0),M.indentLine(x.newPos.line+1,null,!0))}}function B(M,L){for(var g=M.listSelections(),p=[],f=L?"/":""&&(O+=">"),p[d]=O}if(M.replaceSelections(p),g=M.listSelections(),!o)for(var d=0;d=0&&L[s]==g;s--)++d;p=o.to;for(var s=1;s0){for(var L=0;L1&&arguments[1]!==void 0?arguments[1]:"",L=[],g=0;gEe.length)&&(pe=Ee.length);for(var _e=0,re=new Array(pe);_e=Ee.length?{done:!0}:{done:!1,value:Ee[re++]}}}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 _e=Ee[Symbol.iterator](),_e.next.bind(_e)}function F(Ee,pe){return pe={exports:{}},Ee(pe,pe.exports),pe.exports}var K=F(function(Ee){function pe(){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 _e(re){Ee.exports.defaults=re}Ee.exports={defaults:pe(),getDefaults:pe,changeDefaults:_e}}),G=K.defaults,M=K.getDefaults,L=K.changeDefaults,g=/[&<>"']/,p=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,h=/[<>"']|&(?!#?\w+;)/g,o={"&":"&","<":"<",">":">",'"':""","'":"'"},d=function(pe){return o[pe]};function s(Ee,pe){if(pe){if(g.test(Ee))return Ee.replace(p,d)}else if(f.test(Ee))return Ee.replace(h,d);return Ee}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(Ee){return Ee.replace(a,function(pe,_e){return _e=_e.toLowerCase(),_e==="colon"?":":_e.charAt(0)==="#"?_e.charAt(1)==="x"?String.fromCharCode(parseInt(_e.substring(2),16)):String.fromCharCode(+_e.substring(1)):""})}var c=/(^|[^\[])\^/g;function O(Ee,pe){Ee=Ee.source||Ee,pe=pe||"";var _e={replace:function(ne,de){return de=de.source||de,de=de.replace(c,"$1"),Ee=Ee.replace(ne,de),_e},getRegex:function(){return new RegExp(Ee,pe)}};return _e}var S=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(Ee,pe,_e){if(Ee){var re;try{re=decodeURIComponent(l(_e)).replace(S,"").toLowerCase()}catch(ne){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}pe&&!T.test(_e)&&(_e=u(pe,_e));try{_e=encodeURI(_e).replace(/%25/g,"%")}catch(ne){return null}return _e}var A={},w=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,_=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(Ee,pe){A[" "+Ee]||(w.test(Ee)?A[" "+Ee]=Ee+"/":A[" "+Ee]=N(Ee,"/",!0)),Ee=A[" "+Ee];var _e=Ee.indexOf(":")===-1;return pe.substring(0,2)==="//"?_e?pe:Ee.replace(x,"$1")+pe:pe.charAt(0)==="/"?_e?pe:Ee.replace(_,"$1")+pe:Ee+pe}var b={exec:function(){}};function m(Ee){for(var pe=1,_e,re;pe=0&&be[je]==="\\";)Pe=!Pe;return Pe?"|":" |"}),re=_e.split(/ \|/),ne=0;if(re.length>pe)re.splice(pe);else for(;re.length=re.length?ne.slice(re.length):ne}).join(` `)}var me=function(){function Ee(_e){this.options=_e||I}var pe=Ee.prototype;return pe.space=function(re){var ne=this.rules.block.newline.exec(re);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:` `}},pe.code=function(re,ne){var de=this.rules.block.code.exec(re);if(de){var ve=ne[ne.length-1];if(ve&&ve.type==="paragraph")return{raw:de[0],text:de[0].trimRight()};var be=de[0].replace(/^ {4}/gm,"");return{type:"code",raw:de[0],codeBlockStyle:"indented",text:this.options.pedantic?be:y(be,` `)}}},pe.fences=function(re){var ne=this.rules.block.fences.exec(re);if(ne){var de=ne[0],ve=xe(de,ne[3]||"");return{type:"code",raw:de,lang:ne[2]?ne[2].trim():ne[2],text:ve}}},pe.heading=function(re){var ne=this.rules.block.heading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},pe.nptable=function(re){var ne=this.rules.block.nptable.exec(re);if(ne){var de={type:"table",header:W(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(` `):[],raw:ne[0]};if(de.header.length===de.align.length){var ve=de.align.length,be;for(be=0;be ?/gm,"");return{type:"blockquote",raw:ne[0],text:de}}},pe.list=function(re){var ne=this.rules.block.list.exec(re);if(ne){for(var de=ne[0],ve=ne[2],be=ve.length>1,Pe=ve[ve.length-1]===")",je={type:"list",raw:de,ordered:be,start:be?+ve.slice(0,-1):"",loose:!1,items:[]},st=ne[0].match(this.rules.block.item),ct=!1,ft,Ct,xt,ht,Ut,Mt,Zt,Yt=st.length,Rt=0;Rt1||this.options.smartLists&&xt!==ve)&&(ht=st.slice(Rt+1).join(` `),je.raw=je.raw.substring(0,je.raw.length-ht.length),Rt=Yt-1)),Ut=ct||/\n\n(?!\s*$)/.test(ft),Rt!==Yt-1&&(ct=ft.charAt(ft.length-1)===` `,Ut||(Ut=ct)),Ut&&(je.loose=!0),Mt=/^\[[ xX]\] /.test(ft),Zt=void 0,Mt&&(Zt=ft[1]!==" ",ft=ft.replace(/^\[[ xX]\] +/,"")),je.items.push({type:"list_item",raw:de,task:Mt,checked:Zt,loose:Ut,text:ft});return je}},pe.html=function(re){var ne=this.rules.block.html.exec(re);if(ne)return{type:this.options.sanitize?"paragraph":"html",raw:ne[0],pre:!this.options.sanitizer&&(ne[1]==="pre"||ne[1]==="script"||ne[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):Y(ne[0]):ne[0]}},pe.def=function(re){var ne=this.rules.block.def.exec(re);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var de=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:de,raw:ne[0],href:ne[2],title:ne[3]}}},pe.table=function(re){var ne=this.rules.block.table.exec(re);if(ne){var de={type:"table",header:W(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(` `):[]};if(de.header.length===de.align.length){de.raw=ne[0];var ve=de.align.length,be;for(be=0;be/i.test(ve[0])&&(ne=!1),!de&&/^<(pre|code|kbd|script)(\s|>)/i.test(ve[0])?de=!0:de&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ve[0])&&(de=!1),{type:this.options.sanitize?"text":"html",raw:ve[0],inLink:ne,inRawBlock:de,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):Y(ve[0]):ve[0]}},pe.link=function(re){var ne=this.rules.inline.link.exec(re);if(ne){var de=ie(ne[2],"()");if(de>-1){var ve=ne[0].indexOf("!")===0?5:4,be=ve+ne[1].length+de;ne[2]=ne[2].substring(0,de),ne[0]=ne[0].substring(0,be).trim(),ne[3]=""}var Pe=ne[2],je="";if(this.options.pedantic){var st=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Pe);st?(Pe=st[1],je=st[3]):je=""}else je=ne[3]?ne[3].slice(1,-1):"";Pe=Pe.trim().replace(/^<([\s\S]*)>$/,"$1");var ct=se(ne,{href:Pe&&Pe.replace(this.rules.inline._escapes,"$1"),title:je&&je.replace(this.rules.inline._escapes,"$1")},ne[0]);return ct}},pe.reflink=function(re,ne){var de;if((de=this.rules.inline.reflink.exec(re))||(de=this.rules.inline.nolink.exec(re))){var ve=(de[2]||de[1]).replace(/\s+/g," ");if(ve=ne[ve.toLowerCase()],!ve||!ve.href){var be=de[0].charAt(0);return{type:"text",raw:be,text:be}}var Pe=se(de,ve,de[0]);return Pe}},pe.strong=function(re,ne,de){de===void 0&&(de="");var ve=this.rules.inline.strong.start.exec(re);if(ve&&(!ve[1]||ve[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ne=ne.slice(-1*re.length);var be=ve[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var Pe;(ve=be.exec(ne))!=null;)if(Pe=this.rules.inline.strong.middle.exec(ne.slice(0,ve.index+3)),Pe)return{type:"strong",raw:re.slice(0,Pe[0].length),text:re.slice(2,Pe[0].length-2)}}},pe.em=function(re,ne,de){de===void 0&&(de="");var ve=this.rules.inline.em.start.exec(re);if(ve&&(!ve[1]||ve[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ne=ne.slice(-1*re.length);var be=ve[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var Pe;(ve=be.exec(ne))!=null;)if(Pe=this.rules.inline.em.middle.exec(ne.slice(0,ve.index+2)),Pe)return{type:"em",raw:re.slice(0,Pe[0].length),text:re.slice(1,Pe[0].length-1)}}},pe.codespan=function(re){var ne=this.rules.inline.code.exec(re);if(ne){var de=ne[2].replace(/\n/g," "),ve=/[^ ]/.test(de),be=de.startsWith(" ")&&de.endsWith(" ");return ve&&be&&(de=de.substring(1,de.length-1)),de=Y(de,!0),{type:"codespan",raw:ne[0],text:de}}},pe.br=function(re){var ne=this.rules.inline.br.exec(re);if(ne)return{type:"br",raw:ne[0]}},pe.del=function(re){var ne=this.rules.inline.del.exec(re);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},pe.autolink=function(re,ne){var de=this.rules.inline.autolink.exec(re);if(de){var ve,be;return de[2]==="@"?(ve=Y(this.options.mangle?ne(de[1]):de[1]),be="mailto:"+ve):(ve=Y(de[1]),be=ve),{type:"link",raw:de[0],text:ve,href:be,tokens:[{type:"text",raw:ve,text:ve}]}}},pe.url=function(re,ne){var de;if(de=this.rules.inline.url.exec(re)){var ve,be;if(de[2]==="@")ve=Y(this.options.mangle?ne(de[0]):de[0]),be="mailto:"+ve;else{var Pe;do Pe=de[0],de[0]=this.rules.inline._backpedal.exec(de[0])[0];while(Pe!==de[0]);ve=Y(de[0]),de[1]==="www."?be="http://"+ve:be=ve}return{type:"link",raw:de[0],text:ve,href:be,tokens:[{type:"text",raw:ve,text:ve}]}}},pe.inlineText=function(re,ne,de){var ve=this.rules.inline.text.exec(re);if(ve){var be;return ne?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):Y(ve[0]):ve[0]:be=Y(this.options.smartypants?de(ve[0]):ve[0]),{type:"text",raw:ve[0],text:be}}},Ee}(),Te=H.noopTest,Se=H.edit,we=H.merge,fe={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]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Te,table:Te,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};fe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,fe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,fe.def=Se(fe.def).replace("label",fe._label).replace("title",fe._title).getRegex(),fe.bullet=/(?:[*+-]|\d{1,9}[.)])/,fe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,fe.item=Se(fe.item,"gm").replace(/bull/g,fe.bullet).getRegex(),fe.list=Se(fe.list).replace(/bull/g,fe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+fe.def.source+")").getRegex(),fe._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",fe._comment=//,fe.html=Se(fe.html,"i").replace("comment",fe._comment).replace("tag",fe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fe.paragraph=Se(fe._paragraph).replace("hr",fe.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",")|<(?:script|pre|style|!--)").replace("tag",fe._tag).getRegex(),fe.blockquote=Se(fe.blockquote).replace("paragraph",fe.paragraph).getRegex(),fe.normal=we({},fe),fe.gfm=we({},fe.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*|$)"}),fe.gfm.nptable=Se(fe.gfm.nptable).replace("hr",fe.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",")|<(?:script|pre|style|!--)").replace("tag",fe._tag).getRegex(),fe.gfm.table=Se(fe.gfm.table).replace("hr",fe.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",")|<(?:script|pre|style|!--)").replace("tag",fe._tag).getRegex(),fe.pedantic=we({},fe.normal,{html:Se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fe._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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Te,paragraph:Se(fe.normal._paragraph).replace("hr",fe.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",fe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var le={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Te,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\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:Te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",le.punctuation=Se(le.punctuation).replace(/punctuation/g,le._punctuation).getRegex(),le._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",le._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",le.em.start=Se(le.em.start).replace(/punctuation/g,le._punctuation).getRegex(),le.em.middle=Se(le.em.middle).replace(/punctuation/g,le._punctuation).replace(/overlapSkip/g,le._overlapSkip).getRegex(),le.em.endAst=Se(le.em.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.em.endUnd=Se(le.em.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.start=Se(le.strong.start).replace(/punctuation/g,le._punctuation).getRegex(),le.strong.middle=Se(le.strong.middle).replace(/punctuation/g,le._punctuation).replace(/blockSkip/g,le._blockSkip).getRegex(),le.strong.endAst=Se(le.strong.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.endUnd=Se(le.strong.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.blockSkip=Se(le._blockSkip,"g").getRegex(),le.overlapSkip=Se(le._overlapSkip,"g").getRegex(),le._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,le._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,le._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])?)+(?![-_])/,le.autolink=Se(le.autolink).replace("scheme",le._scheme).replace("email",le._email).getRegex(),le._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,le.tag=Se(le.tag).replace("comment",fe._comment).replace("attribute",le._attribute).getRegex(),le._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,le._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,le._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,le.link=Se(le.link).replace("label",le._label).replace("href",le._href).replace("title",le._title).getRegex(),le.reflink=Se(le.reflink).replace("label",le._label).getRegex(),le.reflinkSearch=Se(le.reflinkSearch,"g").replace("reflink",le.reflink).replace("nolink",le.nolink).getRegex(),le.normal=we({},le),le.pedantic=we({},le.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:Se(/^!?\[(label)\]\((.*?)\)/).replace("label",le._label).getRegex(),reflink:Se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",le._label).getRegex()}),le.gfm=we({},le.normal,{escape:Se(le.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]*?(?:(?=[\\.5&&(re="x"+re.toString(16)),pe+="&#"+re+";";return pe}var Le=function(){function Ee(_e){this.tokens=[],this.tokens.links=Object.create(null),this.options=_e||he,this.options.tokenizer=this.options.tokenizer||new me,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:ae.normal,inline:Oe.normal};this.options.pedantic?(re.block=ae.pedantic,re.inline=Oe.pedantic):this.options.gfm&&(re.block=ae.gfm,this.options.breaks?re.inline=Oe.breaks:re.inline=Oe.gfm),this.tokenizer.rules=re}Ee.lex=function(re,ne){var de=new Ee(ne);return de.lex(re)};var pe=Ee.prototype;return pe.lex=function(re){return re=re.replace(/\r\n|\r/g,` `).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},pe.blockTokens=function(re,ne,de){ne===void 0&&(ne=[]),de===void 0&&(de=!0),re=re.replace(/^ +$/gm,"");for(var ve,be,Pe,je;re;){if(ve=this.tokenizer.space(re)){re=re.substring(ve.raw.length),ve.type&&ne.push(ve);continue}if(ve=this.tokenizer.code(re,ne)){re=re.substring(ve.raw.length),ve.type?ne.push(ve):(je=ne[ne.length-1],je.raw+=` `+ve.raw,je.text+=` `+ve.text);continue}if(ve=this.tokenizer.fences(re)){re=re.substring(ve.raw.length),ne.push(ve);continue}if(ve=this.tokenizer.heading(re)){re=re.substring(ve.raw.length),ne.push(ve);continue}if(ve=this.tokenizer.nptable(re)){re=re.substring(ve.raw.length),ne.push(ve);continue}if(ve=this.tokenizer.hr(re)){re=re.substring(ve.raw.length),ne.push(ve);continue}if(ve=this.tokenizer.blockquote(re)){re=re.substring(ve.raw.length),ve.tokens=this.blockTokens(ve.text,[],de),ne.push(ve);continue}if(ve=this.tokenizer.list(re)){for(re=re.substring(ve.raw.length),Pe=ve.items.length,be=0;be0)for(;(st=this.tokenizer.rules.inline.reflinkSearch.exec(je))!=null;)ct.includes(st[0].slice(st[0].lastIndexOf("[")+1,-1))&&(je=je.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(st=this.tokenizer.rules.inline.blockSkip.exec(je))!=null;)je=je.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Pe=this.tokenizer.escape(re)){re=re.substring(Pe.raw.length),ne.push(Pe);continue}if(Pe=this.tokenizer.tag(re,de,ve)){re=re.substring(Pe.raw.length),de=Pe.inLink,ve=Pe.inRawBlock,ne.push(Pe);continue}if(Pe=this.tokenizer.link(re)){re=re.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,ve)),ne.push(Pe);continue}if(Pe=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,ve)),ne.push(Pe);continue}if(Pe=this.tokenizer.strong(re,je,be)){re=re.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],de,ve),ne.push(Pe);continue}if(Pe=this.tokenizer.em(re,je,be)){re=re.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],de,ve),ne.push(Pe);continue}if(Pe=this.tokenizer.codespan(re)){re=re.substring(Pe.raw.length),ne.push(Pe);continue}if(Pe=this.tokenizer.br(re)){re=re.substring(Pe.raw.length),ne.push(Pe);continue}if(Pe=this.tokenizer.del(re)){re=re.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],de,ve),ne.push(Pe);continue}if(Pe=this.tokenizer.autolink(re,Ce)){re=re.substring(Pe.raw.length),ne.push(Pe);continue}if(!de&&(Pe=this.tokenizer.url(re,Ce))){re=re.substring(Pe.raw.length),ne.push(Pe);continue}if(Pe=this.tokenizer.inlineText(re,ve,Ie)){re=re.substring(Pe.raw.length),be=Pe.raw.slice(-1),ne.push(Pe);continue}if(re){var ft="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(ft);break}else throw new Error(ft)}}return ne},Z(Ee,null,[{key:"rules",get:function(){return{block:ae,inline:Oe}}}]),Ee}(),Me=K.defaults,We=H.cleanUrl,He=H.escape,Ue=function(){function Ee(_e){this.options=_e||Me}var pe=Ee.prototype;return pe.code=function(re,ne,de){var ve=(ne||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight(re,ve);be!=null&&be!==re&&(de=!0,re=be)}return ve?'
    '+(de?re:He(re,!0))+`
    `:"
    "+(de?re:He(re,!0))+`
    `},pe.blockquote=function(re){return`
    `+re+`
    `},pe.html=function(re){return re},pe.heading=function(re,ne,de,ve){return this.options.headerIds?"'+re+" `:""+re+" `},pe.hr=function(){return this.options.xhtml?`
    `:`
    `},pe.list=function(re,ne,de){var ve=ne?"ol":"ul",be=ne&&de!==1?' start="'+de+'"':"";return"<"+ve+be+`> `+re+" `},pe.listitem=function(re){return"
  • "+re+`
  • `},pe.checkbox=function(re){return" "},pe.paragraph=function(re){return"

    "+re+`

    `},pe.table=function(re,ne){return ne&&(ne=""+ne+""),` `+re+` `+ne+`
    `},pe.tablerow=function(re){return` `+re+` `},pe.tablecell=function(re,ne){var de=ne.header?"th":"td",ve=ne.align?"<"+de+' align="'+ne.align+'">':"<"+de+">";return ve+re+" `},pe.strong=function(re){return""+re+""},pe.em=function(re){return""+re+""},pe.codespan=function(re){return""+re+""},pe.br=function(){return this.options.xhtml?"
    ":"
    "},pe.del=function(re){return""+re+""},pe.link=function(re,ne,de){if(re=We(this.options.sanitize,this.options.baseUrl,re),re===null)return de;var ve='",ve},pe.image=function(re,ne,de){if(re=We(this.options.sanitize,this.options.baseUrl,re),re===null)return de;var ve=''+de+'":">",ve},pe.text=function(re){return re},Ee}(),Fe=function(){function Ee(){}var pe=Ee.prototype;return pe.strong=function(re){return re},pe.em=function(re){return re},pe.codespan=function(re){return re},pe.del=function(re){return re},pe.html=function(re){return re},pe.text=function(re){return re},pe.link=function(re,ne,de){return""+de},pe.image=function(re,ne,de){return""+de},pe.br=function(){return""},Ee}(),nt=function(){function Ee(){this.seen={}}var pe=Ee.prototype;return pe.slug=function(re){var ne=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var de=ne;do this.seen[de]++,ne=de+"-"+this.seen[de];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},Ee}(),at=K.defaults,qe=H.unescape,Je=function(){function Ee(_e){this.options=_e||at,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new nt}Ee.parse=function(re,ne){var de=new Ee(ne);return de.parse(re)};var pe=Ee.prototype;return pe.parse=function(re,ne){ne===void 0&&(ne=!0);var de="",ve,be,Pe,je,st,ct,ft,Ct,xt,ht,Ut,Mt,Zt,Yt,Rt,Ti,Ui,$e,wt=re.length;for(ve=0;ve0&&Rt.tokens[0].type==="text"?(Rt.tokens[0].text=$e+" "+Rt.tokens[0].text,Rt.tokens[0].tokens&&Rt.tokens[0].tokens.length>0&&Rt.tokens[0].tokens[0].type==="text"&&(Rt.tokens[0].tokens[0].text=$e+" "+Rt.tokens[0].tokens[0].text)):Rt.tokens.unshift({type:"text",text:$e}):Yt+=$e),Yt+=this.parse(Rt.tokens,Zt),xt+=this.renderer.listitem(Yt,Ui,Ti);de+=this.renderer.list(xt,Ut,Mt);continue}case"html":{de+=this.renderer.html(ht.text);continue}case"paragraph":{de+=this.renderer.paragraph(this.parseInline(ht.tokens));continue}case"text":{for(xt=ht.tokens?this.parseInline(ht.tokens):ht.text;ve+1An error occurred:

    "+Qe(Pe.message+"",!0)+"
    ";throw Pe}}ke.options=ke.setOptions=function(Ee){return ot(ke.defaults,Ee),ut(ke.defaults),ke},ke.getDefaults=De,ke.defaults=et,ke.use=function(Ee){var pe=ot({},Ee);if(Ee.renderer&&function(){var re=ke.defaults.renderer||new Ue,ne=function(be){var Pe=re[be];re[be]=function(){for(var je=arguments.length,st=new Array(je),ct=0;ct`,triples:"",explode:"[]{}"},P=ue.Pos;ue.defineOption("autoCloseBrackets",!1,function(o,d,s){s&&s!=ue.Init&&(o.removeKeyMap(B),o.state.closeBrackets=null),d&&(F(Q(d,"pairs")),o.state.closeBrackets=d,o.addKeyMap(B))});function Q(o,d){return d=="pairs"&&typeof o=="string"?o:typeof o=="object"&&o[d]!=null?o[d]:Z[d]}var B={Backspace:M,Enter:L};function F(o){for(var d=0;d=0;l--){var O=a[l].head;o.replaceRange("",P(O.line,O.ch-1),P(O.line,O.ch+1),"+delete")}}function L(o){var d=G(o),s=d&&Q(d,"explode");if(!s||o.getOption("disableInput"))return ue.Pass;for(var a=o.listSelections(),l=0;l0;return{anchor:new P(o.anchor.line,o.anchor.ch+(d?-1:1)),head:new P(o.head.line,o.head.ch+(d?1:-1))}}function p(o,d){var s=G(o);if(!s||o.getOption("disableInput"))return ue.Pass;var a=Q(s,"pairs"),l=a.indexOf(d);if(l==-1)return ue.Pass;for(var c=Q(s,"closeBefore"),O=Q(s,"triples"),S=a.charAt(l+1)==d,T=o.listSelections(),R=l%2==0,A,w=0;w=0&&o.getRange(_,P(_.line,_.ch+3))==d+d+d?u="skipThree":u="skip";else if(S&&_.ch>1&&O.indexOf(d)>=0&&o.getRange(P(_.line,_.ch-2),_)==d+d){if(_.ch>2&&/\bstring/.test(o.getTokenTypeAt(P(_.line,_.ch-2))))return ue.Pass;u="addFour"}else if(S){var m=_.ch==0?" ":o.getRange(P(_.line,_.ch-1),_);if(!ue.isWordChar(b)&&m!=d&&!ue.isWordChar(m))u="both";else return ue.Pass}else if(R&&(b.length===0||/\s/.test(b)||c.indexOf(b)>-1))u="both";else return ue.Pass;if(!A)A=u;else if(A!=u)return ue.Pass}var E=l%2?a.charAt(l-1):d,N=l%2?d:a.charAt(l+1);o.operation(function(){if(A=="skip")o.execCommand("goCharRight");else if(A=="skipThree")for(var D=0;D<3;D++)o.execCommand("goCharRight");else if(A=="surround"){for(var j=o.getSelections(),D=0;D0&&(ie.percent=ie.loaded/ie.total*100),H.onProgress(ie)});var y=new FormData;H.data&&Object.keys(H.data).forEach(function(Y){var ie=H.data[Y];if(Array.isArray(ie)){ie.forEach(function(se){y.append(Y+"[]",se)});return}y.append(Y,H.data[Y])}),H.file instanceof Blob?y.append(H.filename,H.file,H.file.name):y.append(H.filename,H.file),I.onerror=function(ie){H.onError(ie)},I.onload=function(){return I.status<200||I.status>=300?H.onError(B(H,I),F(I)):H.onSuccess(F(I),I)},I.open(H.method,H.action,!0),H.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var W=H.headers||{};return W["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(W).forEach(function(Y){W[Y]!==null&&I.setRequestHeader(Y,W[Y])}),I.send(y),{abort:function(){I.abort()}}}var G=+new Date,M=0;function L(){return"rc-upload-"+G+"-"+ ++M}function g(H,I){return H.indexOf(I,H.length-I.length)!==-1}var p=function(H,I){if(H&&I){var y=Array.isArray(I)?I:I.split(","),W=H.name||"",Y=H.type||"",ie=Y.replace(/\/.*$/,"");return y.some(function(se){var xe=se.trim();return xe.charAt(0)==="."?g(W.toLowerCase(),xe.toLowerCase()):/\/\*$/.test(xe)?ie===xe.replace(/\/.*$/,""):Y===xe})}return!0};function f(H,I){var y=H.createReader(),W=[];function Y(){y.readEntries(function(ie){var se=Array.prototype.slice.apply(ie);W=W.concat(se);var xe=!se.length;xe?I(W):Y()})}Y()}var h=function(I,y,W){var Y=function ie(se,xe){xe=xe||"",se.isFile?se.file(function(me){W(me)&&(se.fullPath&&!me.webkitRelativePath&&(Object.defineProperties(me,{webkitRelativePath:{writable:!0}}),me.webkitRelativePath=se.fullPath.replace(/^\//,""),Object.defineProperties(me,{webkitRelativePath:{writable:!1}})),y([me]))}):se.isDirectory&&f(se,function(me){me.forEach(function(Te){ie(Te,""+xe+se.name+"/")})})};I.forEach(function(ie){Y(ie.webkitGetAsEntry())})},o=h,d=Object.assign||function(H){for(var I=1;I=0)continue;if(!Object.prototype.hasOwnProperty.call(H,W))continue;y[W]=H[W]}return y}function O(H,I){if(!(H instanceof I))throw new TypeError("Cannot call a class as a function")}function S(H,I){if(!H)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:H}function T(H,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);H.prototype=Object.create(I&&I.prototype,{constructor:{value:H,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(H,I):H.__proto__=I)}var R=function(I){return Object.keys(I).reduce(function(y,W){return(W.substr(0,5)==="data-"||W.substr(0,5)==="aria-"||W==="role")&&(y[W]=I[W]),y},{})},A=function(H){T(I,H);function I(){var y,W,Y,ie;O(this,I);for(var se=arguments.length,xe=Array(se),me=0;me1&&arguments[1]!==void 0?arguments[1]:1,_e=Fe.length,re=0;re<_e;re+=1){var ne=(Ee+re*pe+_e)%_e,de=Fe[ne],ve=de.group,be=de.data;if(!ve&&!be.disabled)return ne}return-1},ot=B.useState(function(){return Je(0)}),Xe=Object(G.a)(ot,2),Qe=Xe[0],De=Xe[1],ut=function(Ee){De(Ee);var pe=Fe[Ee];if(!pe){Me(null,-1);return}Me(pe.data.value,Ee)};B.useEffect(function(){ut(fe!==!1?Je(0):-1)},[Fe.length,Se]),B.useEffect(function(){var Ge=setTimeout(function(){if(!we&&ae&&Te.size===1){var Ee=Array.from(Te)[0],pe=Fe.findIndex(function(_e){var re=_e.data;return re.value===Ee});ut(pe),qe(pe)}});return function(){return clearTimeout(Ge)}},[ae]);var et=function(Ee){Ee!==void 0&&Ce(Ee,{selected:!Te.has(Ee)}),we||Le(!1)};if(B.useImperativeHandle(Y,function(){return{onKeyDown:function(Ee){var pe=Ee.which;switch(pe){case M.a.UP:case M.a.DOWN:{var _e=0;if(pe===M.a.UP?_e=-1:pe===M.a.DOWN&&(_e=1),_e!==0){var re=Je(Qe+_e,_e);qe(re),ut(re)}break}case M.a.ENTER:{var ne=Fe[Qe];ne&&!ne.data.disabled?et(ne.data.value):et(void 0),ae&&Ee.preventDefault();break}case M.a.ESC:Le(!1)}},onKeyUp:function(){},scrollTo:function(Ee){qe(Ee)}}}),Fe.length===0)return B.createElement("div",{role:"listbox",id:"".concat(se,"_list"),className:"".concat(Ue,"-empty"),onMouseDown:at},he);function ke(Ge){var Ee=Fe[Ge];if(!Ee)return null;var pe=Ee.data||{},_e=pe.value,re=pe.label,ne=pe.children,de=Object(L.a)(pe,!0),ve=me?ne:re;return Ee?B.createElement("div",Object.assign({"aria-label":typeof ve=="string"?ve:null},de,{key:Ge,role:"option",id:"".concat(se,"_list_").concat(Ge),"aria-selected":Te.has(_e)}),_e):null}return B.createElement(B.Fragment,null,B.createElement("div",{role:"listbox",id:"".concat(se,"_list"),style:{height:0,width:0,overflow:"hidden"}},ke(Qe-1),ke(Qe),ke(Qe+1)),B.createElement(h.a,{itemKey:"key",ref:nt,data:Fe,height:le,itemHeight:te,fullHeight:!1,onMouseDown:at,onScroll:We,virtual:Ie,onMouseEnter:He},function(Ge,Ee){var pe,_e=Ge.group,re=Ge.groupOption,ne=Ge.data,de=ne.label,ve=ne.key;if(_e)return B.createElement("div",{className:f()(Ue,"".concat(Ue,"-group"))},de!==void 0?de:ve);var be=ne.disabled,Pe=ne.value,je=ne.title,st=ne.children,ct=ne.style,ft=ne.className,Ct=Object(K.a)(ne,["disabled","value","title","children","style","className"]),xt=Te.has(Pe),ht="".concat(Ue,"-option"),Ut=f()(Ue,ht,ft,(pe={},Object(F.a)(pe,"".concat(ht,"-grouped"),re),Object(F.a)(pe,"".concat(ht,"-active"),Qe===Ee&&!be),Object(F.a)(pe,"".concat(ht,"-disabled"),be),Object(F.a)(pe,"".concat(ht,"-selected"),xt),pe)),Mt=me?st:de,Zt=!Oe||typeof Oe=="function"||xt;return B.createElement("div",Object.assign({},Ct,{"aria-selected":xt,className:Ut,title:je,onMouseMove:function(){if(Qe===Ee||be)return;ut(Ee)},onClick:function(){be||et(Pe)},style:ct}),B.createElement("div",{className:"".concat(ht,"-content")},Mt||Pe),B.isValidElement(Oe)||xt,Zt&&B.createElement(o.a,{className:"".concat(Ue,"-option-state"),customizeIcon:Oe,customizeIconProps:{isSelected:xt}},xt?"\u2713":null))}))},s=B.forwardRef(d);s.displayName="OptionList";var a=s,l=function(){return null};l.isSelectOption=!0;var c=l,O=function(){return null};O.isSelectOptGroup=!0;var S=O,T=oe("VTBJ"),R=oe("Zm9Q");function A(y){var W=y.key,Y=y.props,ie=Y.children,se=Y.value,xe=Object(K.a)(Y,["children","value"]);return Object(T.a)({key:W,value:se!==void 0?se:W,children:ie},xe)}function w(y){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(R.a)(y).map(function(Y,ie){if(!B.isValidElement(Y)||!Y.type)return null;var se=Y.type.isSelectOptGroup,xe=Y.key,me=Y.props,Te=me.children,Se=Object(K.a)(me,["children"]);return W||!se?A(Y):Object(T.a)(Object(T.a)({key:"__RC_SELECT_GRP__".concat(xe===null?ie:xe,"__"),label:xe},Se),{},{options:w(Te)})}).filter(function(Y){return Y})}var x=oe("2Qr1"),_=oe("qNPg"),u=oe("U8pU"),b=oe("Kwbf"),m=oe("WKfj");function E(y){var W=y.mode,Y=y.options,ie=y.children,se=y.backfill,xe=y.allowClear,me=y.placeholder,Te=y.getInputElement,Se=y.showSearch,we=y.onSearch,fe=y.defaultOpen,le=y.autoFocus,te=y.labelInValue,he=y.value,ae=y.inputValue,Oe=y.optionLabelProp,Ie=W==="multiple"||W==="tags",Ce=Se!==void 0?Se:Ie||W==="combobox",Le=Y||w(ie);if(Object(b.a)(W!=="tags"||Le.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),W==="tags"||W==="combobox"){var Me=Le.some(function(Ue){return Ue.options?Ue.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(b.a)(!Me,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)(W!=="combobox"||!Oe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)(W==="combobox"||!se,"`backfill` only works with `combobox` mode."),Object(b.a)(W==="combobox"||!Te,"`getInputElement` only work with `combobox` mode."),Object(b.b)(W!=="combobox"||!Te||!xe||!me,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),we&&!Ce&&W!=="combobox"&&W!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!fe||le,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),he!=null){var We=Object(m.d)(he);Object(b.a)(!te||We.every(function(Ue){return Object(u.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!Ie||Array.isArray(he),"`value` should be array when `mode` is `multiple` or `tags`")}if(ie){var He=null;Object(R.a)(ie).some(function(Ue){if(!B.isValidElement(Ue)||!Ue.type)return!1;var Fe=Ue.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var nt=Object(R.a)(Ue.props.children).every(function(at){return!B.isValidElement(at)||!Ue.type||at.type.isSelectOption?!0:(He=at.type,!1)});return!nt}return He=Fe,!0}),He&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(He.displayName||He.name||He,"`.")),Object(b.a)(ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=E,D=Object(_.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:w,flattenOptions:x.d,getLabeledValue:x.e,filterOptions:x.b,isValueDisabled:x.g,findValueOption:x.c,warningProps:N,fillOptionsWithMissingValue:x.a}),j=function(y){Object(P.a)(Y,y);var W=Object(Q.a)(Y);function Y(){var ie;return Object(ue.a)(this,Y),ie=W.apply(this,arguments),ie.selectRef=B.createRef(),ie.focus=function(){ie.selectRef.current.focus()},ie.blur=function(){ie.selectRef.current.blur()},ie}return Object(Z.a)(Y,[{key:"render",value:function(){return B.createElement(D,Object.assign({ref:this.selectRef},this.props))}}]),Y}(B.Component);j.Option=c,j.OptGroup=S;var H=j,I=rt.c=H},M8RZ:function(vt,rt,oe){"use strict";oe.d(rt,"a",function(){return M});var ue=oe("fWQN"),Z=oe("mtLc"),P=oe("yKVA"),Q=oe("879j"),B=oe("q1tI"),F=oe.n(B),K=oe("i8i4"),G=oe.n(K),M=function(L){Object(P.a)(p,L);var g=Object(Q.a)(p);function p(f){var h;Object(ue.a)(this,p),h=g.call(this,f);var o=window.document;return h.node=o.createElement("div"),o.body.appendChild(h.node),h}return Object(Z.a)(p,[{key:"render",value:function(){var h=this.props.children;return Object(K.createPortal)(h,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(F.a.Component)},Ot1p:function(vt,rt,oe){"use strict";var ue=oe("2qtc"),Z=oe("kLXV"),P=oe("rAM+"),Q=oe("miYZ"),B=oe("tsqr"),F=oe("9og8"),K=oe("tJVT"),G=oe("jrin"),M=oe("WmNS"),L=oe.n(M),g=oe("q1tI"),p=oe.n(g),f=oe("VrN/"),h=oe.n(f),o=oe("bdgK"),d=oe("p77/"),s=oe("Bd2K"),a=oe("ELLl"),l=oe("19Vz"),c=oe("lZu9"),O=oe("+NIl"),S=oe("kSUc"),T=oe("9Bee"),R=function(be){var Pe=be.value,je=Pe===void 0?"":Pe,st=be.className,ct=be.showTextOnly,ft=be.showLines,Ct=be.style,xt=Ct===void 0?{}:Ct,ht=Object(g.useMemo)(function(){return""},[je]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:ht}}))},A=oe("0Owb"),w=oe("dejd"),x=oe("C+DQ"),_=oe("1vsH"),u=oe("m3rI"),b=[{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(be){var Pe=be.onActionCallback,je=be.title,st=be.icon,ct=be.actionName,ft=be.className,Ct=ft===void 0?"":ft,xt=be.children;function ht(){Pe(ct)}return p.a.createElement("a",{title:je,className:Ct,onClick:ht},p.a.createElement("i",{className:"md-iconfont ".concat(st)}),xt)}var E=function(be){var Pe=be.watch,je=be.showNullButton,st=be.onActionCallback,ct=be.fullScreen,ft=be.insertTemp,Ct=be.hidetoolBar,xt=be.uuid,ht=be.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(_.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(_.F)("_educoder_session"),"&key=").concat(xt,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var Ut=[].concat(b,[{title:"".concat(Pe?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Pe?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!Ct&&Ut.map(function(Mt,Zt){return p.a.createElement("li",{key:Zt},Mt.actionName?p.a.createElement(m,Object(A.a)({},Mt,{onActionCallback:st})):p.a.createElement("span",{className:"v-line"}))}),je?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:st},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ft&&p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ft),onActionCallback:st},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(ct?"icon-shrink":"icon-enlarge"),title:ct?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:st})))},N=oe("M8RZ"),D=oe("+L6B"),j=oe("2/Rp"),H=oe("y8nQ"),I=oe("Vl3Y"),y=oe("5NDa"),W=oe("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},ie=function(be){var Pe=be.callback,je=be.onCancel;function st(ct){Pe(ct)}return p.a.createElement(I.a,Object(A.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:st}),p.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(W.a,null)),p.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(W.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))},se=oe("7ahc"),xe=oe("HmJG"),me=oe("BjJ7"),Te=I.a.useForm,Se={width:280,marginRight:10},we={labelCol:{span:5},wrapperCol:{span:19}},fe=function(be){var Pe=be.callback,je=be.onCancel,st=Te(),ct=Object(K.a)(st,1),ft=ct[0];function Ct(Ut){Pe(Ut)}function xt(Ut,Mt){if(Ut.status===-1){B.b.error(Ut.message);return}ft.setFieldsValue({src:"/api/attachments/".concat(Ut.id),type:Mt.type})}function ht(Ut){var Mt=Ut.target.files[0];te(Mt,xt)}return p.a.createElement(I.a,Object(A.a)({form:ft},we,{className:"upload-image-panel",onFinish:Ct}),p.a.createElement(I.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(I.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(W.a,{style:Se})),p.a.createElement(le,{onFileChange:ht}))),p.a.createElement(I.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(W.a,{style:{width:264}})),p.a.createElement(I.a.Item,{style:{textAlign:"right"}},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))};function le(be){var Pe=be.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:Pe}))}function te(be,Pe){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var je=new FormData;je.append("editormd-image-file",be),je.append("file_param_name","editormd-image-file"),je.append("byxhr","true");var st=new window.XMLHttpRequest;st.withCredentials=!0,st.addEventListener("load",function(ct){Pe(JSON.parse(ct.target.responseText),be)},!1),st.addEventListener("error",function(ct){console.error(ct)},!1),st.open("POST","".concat(me.a,"/api/attachments.json")),st.send(je)}var he=oe("giR+"),ae=oe("fyUT"),Oe=oe("7Kak"),Ie=oe("9yH6"),Ce=Ie.a.Group,Le={margin:"0 8px"},Me=function(be){var Pe=be.callback,je=be.onCancel;function st(ct){Pe(ct)}return p.a.createElement(I.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:st},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:Le},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:Le},"\u884C\u6570"),p.a.createElement(I.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(ae.a,null)),p.a.createElement("span",{style:Le},"\u5217\u6570"),p.a.createElement(I.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(ae.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:Le},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(I.a.Item,{name:"align"},p.a.createElement(Ce,null,p.a.createElement(Ie.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(Ie.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(Ie.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(Ie.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))},We=oe("ErOA"),He=oe("7Cbv"),Ue="link",Fe="upload-image",nt="code-block",at="add-table",qe="------------",Je={default:qe,left:":".concat(qe),center:":".concat(qe,":"),right:"".concat(qe,":")},ot=oe("9VGf"),Xe,Qe;function De(){}var ut=0,et=1e4,ke="\u2581",Ge=` **\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 Ee(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var pe=navigator.platform.toUpperCase().indexOf("MAC")>=0,_e=pe?"Cmd":"Ctrl",re=["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"],ne=(Xe={},Object(G.a)(Xe,_e+"-B","bold"),Object(G.a)(Xe,_e+"-I","italic"),Xe),de=(Qe={},Object(G.a)(Qe,Ue,"\u6DFB\u52A0\u94FE\u63A5"),Object(G.a)(Qe,nt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(G.a)(Qe,Fe,"\u6DFB\u52A0\u6587\u4EF6"),Object(G.a)(Qe,at,"\u6DFB\u52A0\u8868\u683C"),Qe),ve=rt.a=function(be){var Pe=be.defaultValue,je=Pe===void 0?"":Pe,st=be.onChange,ct=be.width,ft=ct===void 0?"100%":ct,Ct=be.height,xt=Ct===void 0?400:Ct,ht=be.miniToolbar,Ut=ht===void 0?!1:ht,Mt=be.isFocus,Zt=Mt===void 0?!1:Mt,Yt=be.watch,Rt=be.insertTemp,Ti=be.mode,Ui=Ti===void 0?"markdown":Ti,$e=be.id,wt=$e===void 0?"markdown-editor-id":$e,Ot=be.showResizeBar,Lt=Ot===void 0?!1:Ot,qt=be.noStorage,qi=qt===void 0?!1:qt,er=be.showNullButton,Bt=er===void 0?!1:er,pt=be.hidetoolBar,Gi=pt===void 0?!1:pt,tr=be.fullScreen,vi=tr===void 0?!1:tr,kt=be.onBlur,Bi=be.onCMBeforeChange,Vi=be.onFullScreen,fr=be.className,Ve=fr===void 0?"":fr,Tt=be.disablePaste,pr=Tt===void 0?!1:Tt,mr=be.placeholder,gr=mr===void 0?"":mr,vr=be.values,X=vr===void 0?"":vr,v=Object(g.useState)(null),C=Object(K.a)(v,2),U=C[0],q=C[1],V=Object(g.useState)(je),ye=Object(K.a)(V,2),Be=ye[0],Ze=ye[1],mt=Object(g.useState)(Yt),ze=Object(K.a)(mt,2),_t=ze[0],Ht=ze[1],$t=Object(g.useState)(vi),Pi=Object(K.a)($t,2),yi=Pi[0],_i=Pi[1],Xi=Object(g.useState)(""),Ir=Object(K.a)(Xi,2),li=Ir[0],Hi=Ir[1],or=Object(g.useState)(0),lr=Object(K.a)(or,2),Mi=lr[0],kr=lr[1],yr=Object(g.useState)(xt),zr=Object(K.a)(yr,2),Kr=zr[0],Yi=zr[1],zi=Object(g.useState)(!1),_r=Object(K.a)(zi,2),dn=_r[0],br=_r[1],ti=Object(g.useRef)(Object(He.a)()),jt=Object(g.useRef)(!1),pi=Object(g.useRef)(),Dt=Object(g.useRef)(),ri=Object(g.useRef)(),zt=Object(g.useRef)(),ir=Object(g.useRef)(),ui=function(){var gt=Object(F.a)(L.a.mark(function St(){var bt,It;return L.a.wrap(function(Vt){for(;;)switch(Vt.prev=Vt.next){case 0:return Vt.next=2,Object(We.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ti.current}});case 2:It=Vt.sent,It!=null&&(bt=It.attachments)!==null&&bt!==void 0&&bt.length&&(console.log("cm:",U,Dt),It.attachments.map(function(Nt){Nt.content_type.indexOf("image")>-1?U.replaceSelection("![,](/api/attachments/".concat(Nt.id,"?type=").concat(Nt.content_type,")")):Nt.content_type.indexOf("video")>-1?U.replaceSelection('')):Nt.content_type.indexOf("pdf")>-1?U.replaceSelection('
    ').concat(Nt.name,"")):U.replaceSelection("[".concat(Nt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Nt.id,"?type=").concat(Nt.content_type,")"))}));case 4:case"end":return Vt.stop()}},St)}));return function(){return gt.apply(this,arguments)}}();Object(g.useEffect)(function(){Ze(X),U==null||U.setValue(X)},[X]),Object(g.useEffect)(function(){Vi==null||Vi(yi)},[yi]),Object(g.useEffect)(function(){if(Dt.current){var gt=h.a.fromTextArea(Dt.current,{mode:Ui,lineNumbers:!Ut,lineWrapping:!0,value:je,autoCloseTags:!0,autoCloseBrackets:!0});Zt&>.focus();function St(bt,It){if(pr){It.preventDefault();return}var Ft=It.clipboardData;if(Ft){var Vt=Ft.types.toString(),Nt=Ft.items;if(Vt==="Files"||Ft.types.indexOf("Files")>-1){if(It.preventDefault(),Ui=="stex")return;try{var si,Ai=Nt[1];((si=Nt[0])===null||si===void 0?void 0:si.kind)==="file"&&(Ai=Nt[0]);var Pt=Ai.getAsFile(),ur=Pt.name.split(".").pop();te(Pt,function(Wt){if(Wt.id){var Oi,bi,Ki;(Pt==null||((Oi=Pt.type)===null||Oi===void 0)?void 0:Oi.indexOf("image"))>-1?gt.replaceSelection("![,](/api/attachments/".concat(Wt.id,"?type=").concat(Wt.content_type,")")):(Pt==null||((bi=Pt.type)===null||bi===void 0)?void 0:bi.indexOf("video"))>-1?gt.replaceSelection('')):(Pt==null||((Ki=Pt.type)===null||Ki===void 0)?void 0:Ki.indexOf("pdf"))>-1?gt.replaceSelection('').concat(Pt.name,"")):re.includes(ur)?gt.replaceSelection('').concat(Pt.name,"")):gt.replaceSelection("[".concat(Pt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})}catch(Wt){B.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return gt.on("paste",St),gt.on("dragleave",function(bt,It){ri.current.classList.remove("mouse-hover-md")}),gt.on("dragover",function(bt,It){ri.current.classList.add("mouse-hover-md")}),gt.on("drop",function(bt,It){ri.current.classList.add("mouse-hover-md");var Ft;if(Ft=It.dataTransfer.files,Ft.length>0){It.preventDefault(),It.stopPropagation();for(var Vt=function(Ai){var Pt=Ft[Ai],ur=Pt.name.split(".").pop();te(Pt,function(Wt){if(Wt.id){var Oi,bi,Ki;(Pt==null||((Oi=Pt.type)===null||Oi===void 0)?void 0:Oi.indexOf("image"))>-1?gt.replaceSelection("![,](/api/attachments/".concat(Wt.id,"?type=").concat(Wt.content_type,")")):(Pt==null||((bi=Pt.type)===null||bi===void 0)?void 0:bi.indexOf("video"))>-1?gt.replaceSelection('')):(Pt==null||((Ki=Pt.type)===null||Ki===void 0)?void 0:Ki.indexOf("pdf"))>-1?gt.replaceSelection('').concat(Pt.name,"")):re.includes(ur)?gt.replaceSelection('').concat(Pt.name,"")):gt.replaceSelection("[".concat(Pt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})},Nt=0;Nt0||Nt.target.offsetWidth>0)&&(wi(),U.setSize("100%","100%"),U.refresh())}}catch(si){Ft.e(si)}finally{Ft.f()}});return bt.observe(Dt.current.parentElement),bt}if(U){var St=gt();return function(){St.unobserve(Dt.current.parentElement)}}},[U,wi]),Object(g.useEffect)(function(){if(U){for(var gt=[],St=function(){var Nt=It[bt];Ft=Object(K.a)(Nt,2);var si=Ft[0],Ai=Ft[1],Pt=Object(G.a)({},si,function(){Vr(Ai)});gt.push(Pt),U.addKeyMap(Pt)},bt=0,It=Object.entries(ne);bt0){var gt=new Date().getTime(),St=window.sessionStorage.getItem(wt);gt>=Mi+et&&(!St||St!==Be)&&(window.sessionStorage.setItem(wt,Be),br(!0))}},et),Object(g.useEffect)(function(){Ht(Yt)},[U,Yt]),Object(g.useEffect)(function(){U&&(Zt&&U.focus())},[U,Zt]),Object(g.useEffect)(function(){if(_t&&U){var gt=U.getScrollerElement();function St(bt){var It=bt.target;if(ir.current){var Ft=It.scrollTop/It.scrollHeight;ir.current.scrollTop=ir.current.scrollHeight*Ft}}return gt.addEventListener("scroll",St),function(){gt.removeEventListener("scroll",St)}}},[U,_t]),Object(g.useEffect)(function(){if(U&&Bi){function gt(St,bt){Bi(St,bt)}return U.on("beforeChange",gt),function(){U.off("beforeChange",gt)}}},[U,Bi]),Object(g.useEffect)(function(){if(U&&kt){function gt(){kt(U.getValue())}return U.on("blur",gt),function(){U.off("blur",gt)}}},[U,kt]),Object(g.useEffect)(function(){if(U){function gt(St){var bt=St.getValue();Ze(bt),kr(new Date().getTime()),St.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),st&&st(bt)}return U.on("change",gt),function(){U.off("change",gt)}}},[U,st]),Object(g.useEffect)(function(){U&&(je==null?(U.setValue(""),Ze("")):je!==U.getValue()&&(U.setValue(je),Ze(je),U.setCursor(U.lineCount(),0)))},[U,je]);var Vr=Object(g.useCallback)(function(gt){var St=U.getCursor(),bt=U.getSelection(),It=bt.split(` `);switch(gt){case"bold":return U.replaceSelection("**"+bt+"**"),bt===""&&U.setCursor(St.line,St.ch+2),U.focus();case"italic":return U.replaceSelection("*"+bt+"*"),bt===""&&U.setCursor(St.line,St.ch+1),U.focus();case"code":return U.replaceSelection("`"+bt+"`"),bt===""&&U.setCursor(St.line,St.ch+1),U.focus();case"inline-latex":return U.replaceSelection("`$$"+bt+"$$`"),bt===""&&U.setCursor(St.line,St.ch+3),U.focus();case"latex":return U.replaceSelection("```latex\n"+bt+"\n```"),U.setCursor(St.line+1,bt.length+1),U.focus();case"line-break":return U.replaceSelection(`
    `),U.focus();case"list-ul":return bt===""?U.replaceSelection("- "+bt):U.replaceSelection(It.map(function(Ft){return Ft===""?"":"- ".concat(Ft)}).join(` `)),U.focus();case"list-ol":return bt===""?U.replaceSelection("1. "+bt):U.replaceSelection(It.map(function(Ft,Vt){return Ft===""?"":"".concat(Vt+1,". ").concat(Ft)}).join(` `)),U.focus();case"add-null-ch":return bt===""&&U.setCursor(St.line,St.ch+1),U.replaceSelection(ke),U.focus();case"inster-template-1":return bt===""&&U.setCursor(St.line,St.ch),U.replaceSelection(Ge),U.focus();case"eraser":return U.setValue(""),U.focus();case"trigger-watch":return Ht(!_t),U.focus();case"trigger-full-screen":return _i(!yi),U.focus();case Ue:Hi(Ue);return;case nt:Hi(nt);return;case Fe:Hi(Fe);return;case at:Hi(at);return;default:throw new Error}},[U,_t,yi]),Er=Object(g.useCallback)(function(gt){Hi("");switch(li){case Ue:var St=gt.title,bt=gt.link;return U.replaceSelection("[".concat(St,"](").concat(bt,")")),U.focus();case nt:var It=gt.language,Ft=gt.content;return U.replaceSelection(["```"+It,Ft,"```"].join(` `)),U.focus();case Fe:var Vt=gt.src,Nt=gt.alt;return Nt?U.replaceSelection("![ ".concat(Nt," ]( ").concat(Vt,' "').concat(Nt,'" )')):U.replaceSelection("![,](".concat(Vt,")")),U.focus();case at:for(var si=gt.row,Ai=gt.col,Pt=gt.align,ur=` `,Wt=0;Wt300&&(si=300);var Ai=xt+si+"px";Yi(Ai)}}return gt.addEventListener("mousedown",It),document.addEventListener("mousemove",Vt),document.addEventListener("mouseup",Ft),function(){gt.removeEventListener("mousedown",It),document.removeEventListener("mousemove",Vt),document.removeEventListener("mouseup",Ft)}}},[U,zt]),Object(g.useEffect)(function(){Yi(xt)},[xt]);var rr=Ee(ft),fn=Ee(Kr),$i={width:rr,height:fn},pn=Object(g.useMemo)(function(){if(Mi){var gt=new Date(Mi),St=gt.getHours(),bt=gt.getMinutes(),It=gt.getSeconds();return St=St<10?"0"+St:St,bt=bt<10?"0"+bt:bt,It=It<10?"0"+It:It,"".concat(St,":").concat(bt,":").concat(It)}return 0},[Mi]);function Hn(){window.sessionStorage.removeItem(wt),br(!1),kr(0)}function Dr(){br(!1),kr(0),U.setValue(window.sessionStorage.getItem(wt))}function ua(gt,St){var bt=U.getValue();bt=bt.replace(gt,St),Ze(bt),U==null||U.setValue(bt)}return p.a.createElement(g.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:ri},p.a.createElement("div",{className:"markdown-editor-container ".concat(Ve," ").concat(_t?"on-preview":""," ").concat(Ut?"mini":""," ").concat(yi?"full-screen":""),style:$i},p.a.createElement(E,{insertTemp:Rt,watch:_t,fullScreen:yi,showNullButton:Bt,onActionCallback:Vr,hidetoolBar:Gi,uuid:ti.current,setOpenPhones:function(){jt.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Dt,placeholder:gr})),_t?p.a.createElement("div",{ref:ir,className:"preview-container"},Ui==="stex"&&p.a.createElement(R,{value:Be}),Ui!=="stex"&&p.a.createElement(T.a,{edit:!0,value:Be,replaces:ua})):null))),Lt?p.a.createElement("a",{ref:zt,className:"editor-resize"}):null,p.a.createElement(N.a,null,de[li]?p.a.createElement(Z.a,{centered:!0,title:de[li],visible:!0,onCancel:xr,footer:null,className:"markdown-popup-form"},cn):null))}},R7cW:function(vt,rt,oe){"use strict";oe.r(rt);var ue=oe("+L6B"),Z=oe("2/Rp"),P=oe("DZo9"),Q=oe("8z0m"),B=oe("0Owb"),F=oe("5NDa"),K=oe("5rEg"),G=oe("sPJy"),M=oe("bE4q"),L=oe("k1fw"),g=oe("oBTY"),p=oe("9og8"),f=oe("miYZ"),h=oe("tsqr"),o=oe("y8nQ"),d=oe("Vl3Y"),s=oe("tJVT"),a=oe("WmNS"),l=oe.n(a),c=oe("q1tI"),O=oe.n(c),S=oe("Ty5D"),T=oe("9kvl"),R=oe("55Ip"),A=oe("Ot1p"),w=oe("XYT7"),x=oe("m3rI"),_=oe("YiJy"),u=oe.n(_),b=function(E){var N,D=E.shixunHomeworks,j=E.newCourse,H=E.globalSetting,I=E.loading,y=E.dispatch,W=E.match,Y=Object(S.i)(),ie=d.a.useForm(),se=Object(s.a)(ie,1),xe=se[0],me=Object(c.useState)({}),Te=Object(s.a)(me,2),Se=Te[0],we=Te[1],fe=Object(c.useState)(!1),le=Object(s.a)(fe,2),te=le[0],he=le[1],ae=Object(c.useState)([]),Oe=Object(s.a)(ae,2),Ie=Oe[0],Ce=Oe[1],Le=Object(c.useState)([]),Me=Object(s.a)(Le,2),We=Me[0],He=Me[1],Ue=D.commonHomeWorkEditDefaultData,Fe={name:"file",multiple:!0,action:x.a.API_SERVER+"/api/attachments.json",defaultFileList:Ie,onChange:function(ot){var Xe=ot.file.status;Xe!=="uploading",Xe==="done"?h.b.success("".concat(ot.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")):Xe==="error"&&h.b.error("".concat(ot.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))}};Object(c.useEffect)(function(){at()},[Y.topicId]);var nt=function(ot){return ot==null?void 0:ot.map(function(Xe){return{uid:Xe.id,response:{id:Xe.id},name:Xe.title,status:"done",url:Xe.url}})},at=function(){var Je=Object(p.a)(l.a.mark(function ot(){var Xe;return l.a.wrap(function(De){for(;;)switch(De.prev=De.next){case 0:return De.next=2,y({type:"shixunHomeworks/editCommonHomeWorkDefaultBankData",payload:{id:Y.topicId}});case 2:Xe=De.sent,Xe&&(xe.setFieldsValue({name:Xe.name}),xe.setFieldsValue({description:Xe.description}),xe.setFieldsValue({reference_answer:Xe.reference_answer}),Ce(Object(g.a)(nt(Xe.attachments))),He(Object(g.a)(nt(Xe.reference_attachments))),he(!0));case 4:case"end":return De.stop()}},ot)}));return function(){return Je.apply(this,arguments)}}(),qe=function(){var Je=Object(p.a)(l.a.mark(function ot(Xe){var Qe,De,ut,et;return l.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:return Qe=Object(L.a)({},Se),Qe.attachment_ids&&(Qe.attachment_ids=Qe==null||((De=Qe.attachment_ids.fileList)===null||De===void 0)?void 0:De.map(function(Ee){var pe;return(pe=Ee.response)===null||pe===void 0?void 0:pe.id})),Qe.reference_attachment_ids&&(Qe.reference_attachment_ids=Qe==null||((ut=Qe.reference_attachment_ids.fileList)===null||ut===void 0)?void 0:ut.map(function(Ee){var pe;return(pe=Ee.response)===null||pe===void 0?void 0:pe.id})),Ge.next=5,Object(w.n)(Object(L.a)(Object(L.a)({id:Y.topicId},Qe),{},{base_on_project:null,type:1}));case 5:et=Ge.sent,et&&T.d.push("/users/".concat(Y.username,"/topics/").concat(Y.topicId,"/").concat(Y.topictype,"/normal/detail"));case 7:case"end":return Ge.stop()}},ot)}));return function(Xe){return Je.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(M.a,{separator:">"},O.a.createElement(M.a.Item,null,O.a.createElement(R.a,{to:"/users/".concat(Y.username,"/").concat(Y.topictype==="personal"?"topics":"topicbank","/").concat(Y.topictype)},Y.topictype==="personal"?"\u6211\u7684\u8BFE\u5802\u8D44\u6E90":"\u516C\u5171\u9898\u5E93")),O.a.createElement(M.a.Item,null,O.a.createElement(R.a,{to:"/users/".concat(Y.username,"/topics/").concat(Y.topicId,"/").concat(Y.topictype,"/normal/detail")},"\u8BE6\u60C5")),O.a.createElement(M.a.Item,null,"\u7F16\u8F91")))),O.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u7F16\u8F91"),O.a.createElement(d.a,{form:xe,className:u.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){we(Object(L.a)({},xe.getFieldsValue()))},onFinish:qe},O.a.createElement("div",{className:u.a.fieldWrap},O.a.createElement(d.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},O.a.createElement(K.a,{maxLength:60,suffix:"".concat(((N=Se.name)===null||N===void 0?void 0:N.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(d.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(A.a,{id:"topic-normal-description",watch:!0,defaultValue:Ue.description})),O.a.createElement("div",null,O.a.createElement(d.a.Item,{name:"attachment_ids"},te&&O.a.createElement(Q.a,Object(B.a)({defaultFileList:Ie},Fe),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(d.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},O.a.createElement(A.a,{id:"topic-normal-reference_answer",defaultValue:Ue.reference_answer,watch:!0})),O.a.createElement("div",null,O.a.createElement(d.a.Item,{name:"reference_attachment_ids"},te&&O.a.createElement(Q.a,Object(B.a)({},Fe,{defaultFileList:We}),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(d.a.Item,null,O.a.createElement(Z.a,{size:"large",type:"primary",className:"".concat(u.a.button," mr20"),htmlType:"submit"},"\u63D0\u4EA4"),O.a.createElement(Z.a,{size:"large",type:"primary",ghost:!0,className:u.a.button,onClick:function(){return T.d.push("/users/".concat(Y.username,"/topics/").concat(Y.topicId,"/").concat(Y.topictype,"/normal/detail"))}},"\u53D6\u6D88"))))))};rt.default=Object(T.a)(function(m){var E=m.shixunHomeworks,N=m.newCourse,D=m.loading,j=m.globalSetting;return{shixunHomeworks:E,newCourse:N,globalSetting:j,loading:D.effects}})(b)},SJMd:function(vt,rt){/** * @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 oe,ue,Z,P=!1,Q,B;window.PR_SHOULD_USE_CONTINUATION=!0;var F,K;(function(){var G=window,M=["break,continue,do,else,for,if,return,while"],L=[M,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],g=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[g,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],f=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],h=[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",d=[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=[M,"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=[M,"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"],c=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],O=[p,h,f,d,s,a,l,c],S=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,T="str",R="kwd",A="com",w="typ",x="lit",_="pun",u="pln",b="tag",m="dec",E="src",N="atn",D="atv",j="nocode",H="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(Ce){for(var Le=0,Me=!1,We=!1,He=0,Ue=Ce.length;He122||(re<65||_e>90||ut.push([Math.max(65,_e)|32,Math.min(re,90)|32]),re<97||_e>122||ut.push([Math.max(97,_e)&~32,Math.min(re,122)&~32]))}}ut.sort(function(be,Pe){return be[0]-Pe[0]||Pe[1]-be[1]});for(var ne=[],de=[],Ge=0;Geve[0]&&(ve[1]+1>ve[0]&&ke.push("-"),ke.push(qe(ve[1])))}return ke.push("]"),ke.join("")}function ot(Qe){for(var De=Qe.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")),ut=De.length,et=[],ke=0,Ge=0;ke=2&&_e==="["?De[ke]=Je(Ee):_e!=="\\"&&(De[ke]=Ee.replace(/[a-zA-Z]/g,function(de){var ve=de.charCodeAt(0);return"["+String.fromCharCode(ve&~32,ve|32)+"]"}))}return De.join("")}for(var Xe=[],He=0,Ue=Ce.length;He=0;)Me[Xe.charAt(Qe)]=ot;var De=ot[1],ut=""+De;at.hasOwnProperty(ut)||(nt.push(De),at[ut]=null)}nt.push(/[\0-\uffff]/),We=I(nt)})();var He=Le.length,Ue=function(Fe){for(var nt=Fe.sourceCode,at=Fe.basePos,qe=Fe.sourceNode,Je=[at,u],ot=0,Xe=nt.match(We)||[],Qe={},De=0,ut=Xe.length;De=5&&ke.substring(0,5)==="lang-",Ee&&!(Ge&&typeof Ge[1]=="string")&&(Ee=!1,ke=E),Ee||(Qe[et]=ke)}var re=ot;if(ot+=et.length,!Ee)Je.push(at+re,ke);else{var ne=Ge[1],de=et.indexOf(ne),ve=de+ne.length;Ge[2]&&(ve=et.length-Ge[2].length,de=ve-ne.length);var be=ke.substring(5);W(qe,at+re,et.substring(0,de),Ue,Je),W(qe,at+re+de,ne,le(be,ne),Je),W(qe,at+re+ve,et.substring(ve),Ue,Je)}}Fe.decorations=Je};return Ue}function xe(Ce){var Le=[],Me=[];Ce.tripleQuotedStrings?Le.push([T,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ce.multiLineStrings?Le.push([T,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Le.push([T,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ce.verbatimStrings&&Me.push([T,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var We=Ce.hashComments;We&&(Ce.cStyleComments?(We>1?Le.push([A,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Le.push([A,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Me.push([T,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Le.push([A,/^#[^\r\n]*/,null,"#"])),Ce.cStyleComments&&(Me.push([A,/^\/\/[^\r\n]*/,null]),Me.push([A,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var He=Ce.regexLiterals;if(He){var Ue=He>1?"":` \r`,Fe=Ue?".":"[\\S\\s]",nt="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";Me.push(["lang-regex",RegExp("^"+H+"("+nt+")")])}var at=Ce.types;at&&Me.push([w,at]);var qe=(""+Ce.keywords).replace(/^ | $/g,"");qe.length&&Me.push([R,new RegExp("^(?:"+qe.replace(/[\s,]+/g,"|")+")\\b"),null]),Le.push([u,/^\s+/,null,` \r \xA0`]);var Je="^.[^\\s\\w.$@'\"`/\\\\]*";return Ce.regexLiterals&&(Je+="(?!s*/)"),Me.push([x,/^@[a-z_$][a-z_$@0-9]*/i,null],[w,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[x,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[_,new RegExp(Je),null]),se(Le,Me)}var me=xe({keywords:O,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Te(Ce,Le,Me){for(var We=/(?:^|\s)nocode(?:\s|$)/,He=/\r\n?|\n/,Ue=Ce.ownerDocument,Fe=Ue.createElement("li");Ce.firstChild;)Fe.appendChild(Ce.firstChild);var nt=[Fe];function at(De){var ut=De.nodeType;if(ut==1&&!We.test(De.className))if(De.nodeName==="br")qe(De),De.parentNode&&De.parentNode.removeChild(De);else for(var et=De.firstChild;et;et=et.nextSibling)at(et);else if((ut==3||ut==4)&&Me){var ke=De.nodeValue,Ge=ke.match(He);if(Ge){var Ee=ke.substring(0,Ge.index);De.nodeValue=Ee;var pe=ke.substring(Ge.index+Ge[0].length);if(pe){var _e=De.parentNode;_e.insertBefore(Ue.createTextNode(pe),De.nextSibling)}qe(De),Ee||De.parentNode.removeChild(De)}}}function qe(De){for(;!De.nextSibling;)if(De=De.parentNode,!De)return;function ut(Ge,Ee){var pe=Ee?Ge.cloneNode(!1):Ge,_e=Ge.parentNode;if(_e){var re=ut(_e,1),ne=Ge.nextSibling;re.appendChild(pe);for(var de=ne;de;de=ne)ne=de.nextSibling,re.appendChild(de)}return pe}for(var et=ut(De.nextSibling,0),ke;(ke=et.parentNode)&&ke.nodeType===1;)et=ke;nt.push(et)}for(var Je=0;Je=_e&&(at+=2),Ue>=re&&(ot+=2)}}finally{ke&&(ke.style.display=Ge)}}var we={};function fe(Ce,Le){for(var Me=Le.length;--Me>=0;){var We=Le[Me];we.hasOwnProperty(We)?G.console&&console.warn("cannot override language handler %s",We):we[We]=Ce}}function le(Ce,Le){return Ce&&we.hasOwnProperty(Ce)||(Ce=/^\s*]*(?:>|$)/],[A,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[_,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),fe(se([[u,/^[\s]+/,null,` \r `],[D,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!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"]),fe(se([],[[D,/^[\s\S]+/]]),["uq.val"]),fe(xe({keywords:p,hashComments:!0,cStyleComments:!0,types:S}),["c","cc","cpp","cxx","cyc","m"]),fe(xe({keywords:"null,true,false"}),["json"]),fe(xe({keywords:h,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:S}),["cs"]),fe(xe({keywords:f,cStyleComments:!0}),["java"]),fe(xe({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),fe(xe({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),fe(xe({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),fe(xe({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),fe(xe({keywords:d,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),fe(xe({keywords:o,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),fe(se([],[[T,/^[\s\S]+/]]),["regex"]);function te(Ce){var Le=Ce.langExtension;try{var Me=y(Ce.sourceNode,Ce.pre),We=Me.sourceCode;Ce.sourceCode=We,Ce.spans=Me.spans,Ce.basePos=0,le(Le,We)(Ce),Se(Ce)}catch(He){G.console&&console.log(He&&He.stack||He)}}function he(Ce,Le,Me){var We=Me||!1,He=Le||null,Ue=document.createElement("div");Ue.innerHTML="
    "+Ce+"
    ",Ue=Ue.firstChild,We&&Te(Ue,We,!0);var Fe={langExtension:He,numberLines:We,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Fe),Ue.innerHTML}function ae(Ce,Le){var Me=Le||document.body,We=Me.ownerDocument||document;function He(pe){return Me.getElementsByTagName(pe)}for(var Ue=[He("pre"),He("code"),He("xmp")],Fe=[],nt=0;nt=0;h--)if(this.__items[h].match(f))return!0;return!1},L.prototype.set_indent=function(f,h){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},L.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},L.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},L.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},L.prototype.is_empty=function(){return this.__items.length===0},L.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},L.prototype.push=function(f){this.__items.push(f);var h=f.lastIndexOf(` `);h!==-1?this.__character_count=f.length-h:this.__character_count+=f.length},L.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},L.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},L.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},L.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},L.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function g(f,h){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)),h=h||"",f.indent_level>0&&(h=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}g.prototype.get_indent_size=function(f,h){var o=this.__base_string_length;return h=h||0,f<0&&(o=0),o+=f*this.__indent_size,o+=h,o},g.prototype.get_indent_string=function(f,h){var o=this.__base_string;return h=h||0,f<0&&(f=0,o=""),h+=f*this.__indent_size,this.__ensure_cache(h),o+=this.__cache[h],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,h=0,o="";this.__indent_size&&f>=this.__indent_size&&(h=Math.floor(f/this.__indent_size),f-=h*this.__indent_size,o=new Array(h+1).join(this.__indent_string)),f&&(o+=new Array(f+1).join(" ")),this.__cache.push(o)};function p(f,h){this.__indent_cache=new g(f,h),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new L(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,h){return this.__indent_cache.get_indent_string(f,h)},p.prototype.get_indent_size=function(f,h){return this.__indent_cache.get_indent_size(f,h)},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 h=this.current_line.pop();h&&(h[h.length-1]===` `&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),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,h){return f=f||0,h=h||0,this.next_line.set_indent(f,h),this.__lines.length>1?(this.current_line.set_indent(f,h),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var h=0;h1&&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,h){for(var o=this.__lines.length-2;o>=0;){var d=this.__lines[o];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==h){this.__lines.splice(o+1,0,new L(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},M.exports.Output=p},,,,function(M){function L(f,h){this.raw_options=g(f,h),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}L.prototype._get_array=function(f,h){var o=this.raw_options[f],d=h||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(d=o.concat()):typeof o=="string"&&(d=o.split(/[^a-zA-Z0-9_\/\-]+/)),d},L.prototype._get_boolean=function(f,h){var o=this.raw_options[f],d=o===void 0?!!h:!!o;return d},L.prototype._get_characters=function(f,h){var o=this.raw_options[f],d=h||"";return typeof o=="string"&&(d=o.replace(/\\r/,"\r").replace(/\\n/,` `).replace(/\\t/," ")),d},L.prototype._get_number=function(f,h){var o=this.raw_options[f];h=parseInt(h,10),isNaN(h)&&(h=0);var d=parseInt(o,10);return isNaN(d)&&(d=h),d},L.prototype._get_selection=function(f,h,o){var d=this._get_selection_list(f,h,o);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values: `+h+` You passed in: '`+this.raw_options[f]+"'");return d[0]},L.prototype._get_selection_list=function(f,h,o){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[h[0]],!this._is_valid_selection(o,h))throw new Error("Invalid Default Value!");var d=this._get_array(f,o);if(!this._is_valid_selection(d,h))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values: `+h+` You passed in: '`+this.raw_options[f]+"'");return d},L.prototype._is_valid_selection=function(f,h){return f.length&&h.length&&!f.some(function(o){return h.indexOf(o)===-1})};function g(f,h){var o={};f=p(f);var d;for(d in f)d!==h&&(o[d]=f[d]);if(h&&f[h])for(d in f[h])o[d]=f[h][d];return o}function p(f){var h={},o;for(o in f){var d=o.replace(/-/g,"_");h[d]=f[o]}return h}M.exports.Options=L,M.exports.normalizeOpts=p,M.exports.mergeOpts=g},,function(M){var L=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position=0&&p=0&&f=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},M.exports.InputScanner=g},,,,,function(M){function L(g,p){g=typeof g=="string"?g:g.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+p,"g")}L.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(g);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(g);return p},L.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},M.exports.Directives=L},,function(M,L,g){var p=g(16).Beautifier,f=g(17).Options;function h(o,d){var s=new p(o,d);return s.beautify()}M.exports=h,M.exports.defaultOptions=function(){return new f}},function(M,L,g){var p=g(17).Options,f=g(2).Output,h=g(8).InputScanner,o=g(13).Directives,d=new o(/\/\*/,/\*\//),s=/\r\n|[\r\n]/,a=/\r\n|[\r\n]/g,l=/\s/,c=/(?:\s|\n)+/g,O=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,S=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function T(R,A){this._source_text=R||"",this._options=new p(A),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}T.prototype.eatString=function(R){var A="";for(this._ch=this._input.next();this._ch;){if(A+=this._ch,this._ch==="\\")A+=this._input.next();else if(R.indexOf(this._ch)!==-1||this._ch===` `)break;this._ch=this._input.next()}return A},T.prototype.eatWhitespace=function(R){for(var A=l.test(this._input.peek()),w=0;l.test(this._input.peek());)this._ch=this._input.next(),R&&this._ch===` `&&((w===0||w0&&this._indentLevel--},T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var R=this._source_text,A=this._options.eol;A==="auto"&&(A=` `,R&&s.test(R||"")&&(A=R.match(s)[0])),R=R.replace(a,` `);var w=R.match(/^[\t ]*/)[0];this._output=new f(this._options,w),this._input=new h(R),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var x=0,_=!1,u=!1,b=!1,m=!1,E=!1,N=!1,D=this._ch,j=!1,H,I,y;H=this._input.read(c),I=H!=="",y=D,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),D=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var W=this._input.read(O),Y=d.get_directives(W);Y&&Y.ignore==="start"&&(W+=d.readIgnored(this._input)),this.print_string(W),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(S)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(I),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ie=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ie.match(/[ :]$/)&&(ie=this.eatString(": ").replace(/\s$/,""),this.print_string(ie),this._output.space_before_token=!0),ie=ie.replace(/\s$/,""),ie==="extend"?m=!0:ie==="import"&&(E=!0),ie in this.NESTED_AT_RULE?(this._nestedLevel+=1,ie in this.CONDITIONAL_GROUP_RULE&&(b=!0)):!_&&x===0&&ie.indexOf(":")!==-1&&(u=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(I),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")u&&(u=!1,this.outdent()),b?(b=!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)):(y==="("?this._output.space_before_token=!1:y!==","&&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(),y==="{"&&this._output.trim(!0),E=!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 se=0;se"||this._ch==="+"||this._ch==="~")&&!u&&x===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(I),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 Te=y==='"'||y==="'";this.preserveSingleSpace(Te||I),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===` `&&j&&this._output.add_new_line()}var Se=this._output.get_code(A);return Se},M.exports.Beautifier=T},function(M,L,g){var p=g(6).Options;function f(h){p.call(this,h,"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 d=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var s=0;s=15&&(p=!1,M=!0);var T=l&&(L||p&&(S==null||S<12.11)),R=P||K&&G>=9;function A(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var w=function(e,t){var r=e.className,i=A(t).exec(r);if(i){var n=r.slice(i.index+i[0].length);e.className=r.slice(0,i.index)+(n?i[1]+n:"")}};function x(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function _(e,t){return x(e).appendChild(t)}function u(e,t,r,i){var n=document.createElement(e);if(r&&(n.className=r),i&&(n.style.cssText=i),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var k=0;k=t)return z+(t-k);z+=$-k,z+=r-z%r,k=$+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r=t)return i+Math.min(z,t-n);if(n+=k-i,n+=r-n%r,i=k+1,n>=t)return i}}var fe=[""];function le(e){for(;fe.length<=e;)fe.push(te(fe)+" ");return fe[e]}function te(e){return e[e.length-1]}function he(e,t){for(var r=[],i=0;i"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ce.test(e))}function Me(e,t){return t?t.source.indexOf("\\w")>-1&&Le(e)?!0:t.test(e):Le(e)}function We(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var He=/[\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 Ue(e){return e.charCodeAt(0)>=768&&He.test(e)}function Fe(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var n=(t+r)/2,k=i<0?Math.ceil(n):Math.floor(n);if(k==t)return e(k)?t:r;e(k)?r=k:t=k+i}}function at(e,t,r,i){if(!e)return i(t,r,"ltr",0);for(var n=!1,k=0;kt||t==r&&z.to==t)&&(i(Math.max(z.from,t),Math.min(z.to,r),z.level==1?"rtl":"ltr",k),n=!0)}n||i(t,r,"ltr")}var qe=null;function Je(e,t,r){var i;qe=null;for(var n=0;nt)return n;k.to==t&&(k.from!=k.to&&r=="before"?i=n:qe=n),k.from==t&&(k.from!=k.to&&r!="before"?i=n:qe=n)}return i!=null?i:qe}var ot=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,k=/[LRr]/,z=/[Lb1n]/,$=/[1n]/;function J(ee,ce,ge){this.level=ee,this.from=ce,this.to=ge}return function(ee,ce){var ge=ce=="ltr"?"L":"R";if(ee.length==0||ce=="ltr"&&!i.test(ee))return!1;for(var Re=ee.length,Ae=[],Ne=0;Ne-1&&(i[t]=n.slice(0,k).concat(n.slice(k+1)))}}}function ke(e,t){var r=ut(e,t);if(!r.length)return;for(var i=Array.prototype.slice.call(arguments,2),n=0;n0}function _e(e){e.prototype.on=function(t,r){De(this,t,r)},e.prototype.off=function(t,r){et(this,t,r)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function de(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ve(e){re(e),ne(e)}function be(e){return e.target||e.srcElement}function Pe(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 je=function(){if(K&&G<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),st;function ct(e){if(st==null){var t=u("span","\u200B");_(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(st=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&G<8))}var r=st?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var ft;function Ct(e){if(ft!=null)return ft;var t=_(e,document.createTextNode("A\u062EA")),r=m(t,0,1).getBoundingClientRect(),i=m(t,1,2).getBoundingClientRect();return x(e),!r||r.left==r.right?!1:ft=i.right-r.right<3}var xt=` b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],i=e.length;t<=i;){var n=e.indexOf(` `,t);n==-1&&(n=e.length);var k=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),z=k.indexOf("\r");z!=-1?(r.push(k.slice(0,z)),t+=z+1):(r.push(k),t=n+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ht=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},Ut=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Mt=null;function Zt(e){if(Mt!=null)return Mt;var t=_(e,u("span","x")),r=t.getBoundingClientRect(),i=m(t,0,1).getBoundingClientRect();return Mt=Math.abs(r.left-i.left)>1}var Yt={},Rt={};function Ti(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Yt[e]=t}function Ui(e,t){Rt[e]=t}function $e(e){if(typeof e=="string"&&Rt.hasOwnProperty(e))e=Rt[e];else if(e&&typeof e.name=="string"&&Rt.hasOwnProperty(e.name)){var t=Rt[e.name];typeof t=="string"&&(t={name:t}),e=Ie(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return $e("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return $e("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function wt(e,t){t=$e(t);var r=Yt[t.name];if(!r)return wt(e,"text/plain");var i=r(e,t);if(Ot.hasOwnProperty(t.name)){var n=Ot[t.name];for(var k in n){if(!n.hasOwnProperty(k))continue;i.hasOwnProperty(k)&&(i["_"+k]=i[k]),i[k]=n[k]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var z in t.modeProps)i[z]=t.modeProps[z];return i}var Ot={};function Lt(e,t){var r=Ot.hasOwnProperty(e)?Ot[e]:Ot[e]={};y(t,r)}function qt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var i in t){var n=t[i];n instanceof Array&&(n=n.concat([])),r[i]=n}return r}function qi(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 er(e,t,r){return e.startState?e.startState(t,r):!0}var Bt=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};Bt.prototype.eol=function(){return this.pos>=this.string.length},Bt.prototype.sol=function(){return this.pos==this.lineStart},Bt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Bt.prototype.next=function(){if(this.post},Bt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Bt.prototype.skipToEnd=function(){this.pos=this.string.length},Bt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Bt.prototype.backUp=function(e){this.pos-=e},Bt.prototype.column=function(){return this.lastColumnPos0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},Bt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Bt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Bt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Bt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function pt(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 i=0;;++i){var n=r.children[i],k=n.chunkSize();if(t=e.first&&tr?Ve(r,pt(e,r).text.length):C(t,pt(e,t.line).text.length)}function C(e,t){var r=e.ch;return r==null||r>t?Ve(e.line,t):r<0?Ve(e.line,0):e}function U(e,t){for(var r=[],i=0;ithis.maxLookAhead&&(this.maxLookAhead=e),t},V.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}},V.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},V.fromSaved=function(e,t,r){return t instanceof q?new V(e,qt(e.mode,t.state),r,t.lookAhead):new V(e,qt(e.mode,t),r)},V.prototype.save=function(e){var t=e!==!1?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new q(t,this.maxLookAhead):t};function ye(e,t,r,i){var n=[e.state.modeGen],k={};yi(e,t.text,e.doc.mode,r,function(ee,ce){return n.push(ee,ce)},k,i);for(var z=r.state,$=function(ee){r.baseTokens=n;var ce=e.state.overlays[ee],ge=1,Re=0;r.state=!0,yi(e,t.text,ce.mode,r,function(Ae,Ne){for(var Ke=ge;ReAe&&n.splice(ge,1,Ae,n[ge+1],Ye),ge+=2,Re=Math.min(Ae,Ye)}if(!Ne)return;if(ce.opaque)n.splice(Ke,ge-Ke,Ae,"overlay "+Ne),ge=Ke+2;else for(;Kee.options.maxHighlightLength&&qt(e.doc.mode,i.state),k=ye(e,t,i);n&&(i.state=n),t.stateAfter=i.save(!n),t.styles=k.styles,k.classes?t.styleClasses=k.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 Ze(e,t,r){var i=e.doc,n=e.display;if(!i.mode.startState)return new V(i,!0,t);var k=_i(e,t,r),z=k>i.first&&pt(i,k-1).stateAfter,$=z?V.fromSaved(i,z,k):new V(i,er(i.mode),k);return i.iter(k,t,function(J){mt(e,J.text,$);var ee=$.line;J.stateAfter=ee==t-1||ee%5==0||ee>=n.viewFrom&&eet.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ht=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function $t(e,t,r,i){var n=e.doc,k=n.mode,z;t=v(n,t);var $=pt(n,t.line),J=Ze(e,t.line,r),ee=new Bt($.text,e.options.tabSize,J),ce;for(i&&(ce=[]);(i||ee.pose.options.maxHighlightLength?($=!1,z&&mt(e,t,i,ce.pos),ce.pos=t.length,ge=null):ge=Pi(_t(r,ce,i.state,Re),k),Re){var Ae=Re[0].name;Ae&&(ge="m-"+(ge?Ae+" "+ge:Ae))}if(!$||ee!=ge){for(;Jz;--$){if($<=k.first)return k.first;var J=pt(k,$-1),ee=J.stateAfter;if(ee&&(!r||$+(ee instanceof q?ee.lookAhead:0)<=k.modeFrontier))return $;var ce=W(J.text,null,e.options.tabSize);(n==null||i>ce)&&(n=$-1,i=ce)}return n}function Xi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontierr;i--){var n=pt(e,i).stateAfter;if(n&&(!(n instanceof q)||i+n.lookAhead=t:k.to>t);(i||(i=[])).push(new lr(z,k.from,J?null:k.to))}}return i}function Kr(e,t,r){var i;if(e)for(var n=0;n=t:k.to>t);if($||k.from==t&&z.type=="bookmark"&&(!r||k.marker.insertLeft)){var J=k.from==null||(z.inclusiveLeft?k.from<=t:k.from0&&$)for(var dt=0;dt<$.length;++dt)$[dt].to==null&&(it||(it=[])).push(new lr($[dt].marker,null,null));for(var Et=0;Et0)continue;var ce=[J,1],ge=Tt(ee.from,$.from),Re=Tt(ee.to,$.to);(ge<0||!z.inclusiveLeft&&!ge)&&ce.push({from:ee.from,to:$.from}),(Re>0||!z.inclusiveRight&&!Re)&&ce.push({from:$.to,to:ee.to}),n.splice.apply(n,ce),J+=ce.length-3}return n}function dn(e){var t=e.markedSpans;if(!t)return;for(var r=0;rt)&&(!i||pi(i,k.marker)<0)&&(i=k.marker)}return i}function ui(e,t,r,i,n){var k=pt(e,t),z=li&&k.markedSpans;if(z)for(var $=0;$=0&&ge<=0||ce<=0&&ge>=0)continue;if(ce<=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?Tt(ee.to,r)>=0:Tt(ee.to,r)>0)||ce>=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?Tt(ee.from,i)<=0:Tt(ee.from,i)<0))return!0}}function wi(e){for(var t;t=ri(e);)e=t.find(-1,!0).line;return e}function Vr(e){for(var t;t=zt(e);)e=t.find(1,!0).line;return e}function Er(e){for(var t,r;t=zt(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function cn(e,t){var r=pt(e,t),i=wi(r);return r==i?t:kt(i)}function xr(e,t){if(t>e.lastLine())return t;var r=pt(e,t),i;if(!rr(e,r))return t;for(;i=zt(r);)r=i.find(1,!0).line;return kt(r)+1}function rr(e,t){var r=li&&t.markedSpans;if(r)for(var i=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=i)})}var Dr=function(e,t,r){this.text=e,br(this,t),this.height=r?r(this):1};Dr.prototype.lineNo=function(){return kt(this)},_e(Dr);function ua(e,t,r,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),dn(e),br(e,r);var n=i?i(e):1;n!=e.height&&vi(e,n)}function gt(e){e.parent=null,dn(e)}var St={},bt={};function It(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?bt:St;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Ft(e,t){var r=b("span",null,null,M?"padding-right: .1px":null),i={pre:b("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var k=n?t.rest[n-1]:t.line,z=void 0;i.pos=0,i.addToken=Nt,Ct(e.display.measure)&&(z=Xe(k,e.doc.direction))&&(i.addToken=Ai(i.addToken,z)),i.map=[];var $=t!=e.display.externalMeasured&&kt(k);ur(k,i,Be(e,k,$)),k.styleClasses&&(k.styleClasses.bgClass&&(i.bgClass=j(k.styleClasses.bgClass,i.bgClass||"")),k.styleClasses.textClass&&(i.textClass=j(k.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(ct(e.display.measure))),n==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(M){var J=i.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return ke(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=j(i.pre.className,i.textClass||"")),i}function Vt(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 Nt(e,t,r,i,n,k,z){if(!t)return;var $=e.splitSpaces?si(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,ce;if(!J.test(t))e.col+=t.length,ce=document.createTextNode($),e.map.push(e.pos,e.pos+t.length,ce),K&&G<9&&(ee=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var ge=0;;){J.lastIndex=ge;var Re=J.exec(t),Ae=Re?Re.index-ge:t.length-ge;if(Ae){var Ne=document.createTextNode($.slice(ge,ge+Ae));K&&G<9?ce.appendChild(u("span",[Ne])):ce.appendChild(Ne),e.map.push(e.pos,e.pos+Ae,Ne),e.col+=Ae,e.pos+=Ae}if(!Re)break;ge+=Ae+1;var Ke=void 0;if(Re[0]==" "){var Ye=e.cm.options.tabSize,tt=Ye-e.col%Ye;Ke=ce.appendChild(u("span",le(tt),"cm-tab")),Ke.setAttribute("role","presentation"),Ke.setAttribute("cm-text"," "),e.col+=tt}else Re[0]=="\r"||Re[0]==` `?(Ke=ce.appendChild(u("span",Re[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ke.setAttribute("cm-text",Re[0]),e.col+=1):(Ke=e.cm.options.specialCharPlaceholder(Re[0]),Ke.setAttribute("cm-text",Re[0]),K&&G<9?ce.appendChild(u("span",[Ke])):ce.appendChild(Ke),e.col+=1);e.map.push(e.pos,e.pos+1,Ke),e.pos++}}if(e.trailingSpace=$.charCodeAt(t.length-1)==32,r||i||n||ee||k||z){var lt=r||"";i&&(lt+=i),n&&(lt+=n);var it=u("span",[ce],lt,k);if(z)for(var dt in z)z.hasOwnProperty(dt)&&dt!="style"&&dt!="class"&&it.setAttribute(dt,z[dt]);return e.content.appendChild(it)}e.content.appendChild(ce)}function si(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,i="",n=0;nee&&ge.from<=ee);Re++);if(ge.to>=ce)return e(r,i,n,k,z,$,J);e(r,i.slice(0,ge.to-ee),n,k,null,$,J),k=null,i=i.slice(ge.to-ee),ee=ge.to}}}function Pt(e,t,r,i){var n=!i&&r.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!i&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",r.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function ur(e,t,r){var i=e.markedSpans,n=e.text,k=0;if(!i){for(var z=1;zJ||At.collapsed&&yt.to==J&&yt.from==J)){if(yt.to!=null&&yt.to!=J&&Ae>yt.to&&(Ae=yt.to,Ke=""),At.className&&(Ne+=" "+At.className),At.css&&(Re=(Re?Re+";":"")+At.css),At.startStyle&&yt.from==J&&(Ye+=" "+At.startStyle),At.endStyle&&yt.to==Ae&&(dt||(dt=[])).push(At.endStyle,yt.to),At.title&&((lt||(lt={})).title=At.title),At.attributes)for(var Xt in At.attributes)(lt||(lt={}))[Xt]=At.attributes[Xt];At.collapsed&&(!tt||pi(tt.marker,At)<0)&&(tt=yt)}else yt.from>J&&Ae>yt.from&&(Ae=yt.from)}if(dt)for(var ci=0;ci=$)break;for(var Fi=Math.min($,Ae);;){if(ce){var Ii=J+ce.length;if(!tt){var ni=Ii>Fi?ce.slice(0,Fi-J):ce;t.addToken(t,ni,ge?ge+Ne:Ne,Ye,J+ni.length==Ae?Ke:"",Re,lt)}if(Ii>=Fi){ce=ce.slice(Fi-J),J=Fi;break}J=Ii,Ye=""}ce=n.slice(k,k=r[ee++]),ge=It(r[ee++],t.cm.options)}}}function Wt(e,t,r){this.line=t,this.rest=Er(t),this.size=this.rest?kt(te(this.rest))-r+1:1,this.node=this.text=null,this.hidden=rr(e,t)}function Oi(e,t,r){for(var i=[],n,k=t;k2&&k.push((J.bottom+ee.top)/2-r.top)}}k.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 i=0;ir)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Bo(e,t){t=wi(t);var r=kt(t),i=e.display.externalMeasured=new Wt(e.doc,t,r);i.lineN=r;var n=i.built=Ft(e,i);return i.text=n.pre,_(e.display.lineMeasure,n.pre),i}function ts(e,t,r,i){return ar(e,Xr(e,t),r,i)}function fa(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt)&&(k=J-$,n=k-1,t>=J&&(z="right")),n!=null){if(i=e[ee+2],$==J&&r==(i.insertLeft?"left":"right")&&(z=r),r=="left"&&n==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)i=e[(ee-=3)+2],z="left";if(r=="right"&&n==J-$)for(;ee=0&&!((r=e[n]).left!=r.right);n--);return r}function jo(e,t,r,i){var n=rs(t.map,r,i),k=n.node,z=n.start,$=n.end,J=n.collapse,ee;if(k.nodeType==3){for(var ce=0;ce<4;ce++){for(;z&&Ue(t.line.text.charAt(n.coverStart+z));)--z;for(;n.coverStart+$0&&(J=i="right");var ge;e.options.lineWrapping&&(ge=k.getClientRects()).length>1?ee=ge[i=="right"?ge.length-1:0]:ee=k.getBoundingClientRect()}if(K&&G<9&&!z&&(!ee||!ee.left&&!ee.right)){var Re=k.parentNode.getClientRects()[0];Re?ee={left:Re.left,right:Re.left+$r(e.display),top:Re.top,bottom:Re.bottom}:ee=is}for(var Ae=ee.top-t.rect.top,Ne=ee.bottom-t.rect.top,Ke=(Ae+Ne)/2,Ye=t.view.measure.heights,tt=0;tt=i.text.length?(J=i.text.length,ee="before"):J<=0&&(J=0,ee="after"),!$)return z(ee=="before"?J-1:J,ee=="before");function ce(Ne,Ke,Ye){var tt=$[Ke],lt=tt.level==1;return z(Ye?Ne-1:Ne,lt!=Ye)}var ge=Je($,J,ee),Re=qe,Ae=ce(J,ge,ee=="before");return Re!=null&&(Ae.other=ce(J,Re,ee!="before")),Ae}function us(e,t){var r=0;t=v(e.doc,t),e.options.lineWrapping||(r=$r(e.display)*t.ch);var i=pt(e.doc,t.line),n=$i(i)+jn(e.display);return{left:r,right:r,top:n,bottom:n+i.height}}function ga(e,t,r,i,n){var k=Ve(e,t,r);return k.xRel=n,i&&(k.outside=i),k}function va(e,t,r){var i=e.doc;if(r+=e.display.viewOffset,r<0)return ga(i.first,0,null,-1,-1);var n=Bi(i,r),k=i.first+i.size-1;if(n>k)return ga(i.first+i.size-1,pt(i,k).text.length,null,1,1);t<0&&(t=0);for(var z=pt(i,n);;){var $=Go(e,z,n,t,r),J=ir(z,$.ch+($.xRel>0||$.outside>0?1:0));if(!J)return $;var ee=J.find(1);if(ee.line==n)return ee;z=pt(i,n=ee.line)}}function hs(e,t,r,i){i-=pa(t);var n=t.text.length,k=nt(function(z){return ar(e,r,z-1).bottom<=i},n,0);return n=nt(function(z){return ar(e,r,z).top>i},k,n),{begin:k,end:n}}function ds(e,t,r,i){r||(r=Xr(e,t));var n=Wn(e,t,ar(e,r,i),"line").top;return hs(e,t,r,n)}function ya(e,t,r,i){return e.bottom<=r?!1:e.top>r?!0:(i?e.left:e.right)>t}function Go(e,t,r,i,n){n-=$i(t);var k=Xr(e,t),z=pa(t),$=0,J=t.text.length,ee=!0,ce=Xe(t,e.doc.direction);if(ce){var ge=(e.options.lineWrapping?Ko:zo)(e,t,r,k,ce,i,n);ee=ge.level!=1,$=ee?ge.from:ge.to-1,J=ee?ge.to:ge.from-1}var Re=null,Ae=null,Ne=nt(function(Et){var yt=ar(e,k,Et);return yt.top+=z,yt.bottom+=z,ya(yt,i,n,!1)?(yt.top<=n&&yt.left<=i&&(Re=Et,Ae=yt),!0):!1},$,J),Ke,Ye,tt=!1;if(Ae){var lt=i-Ae.left=dt.bottom?1:0}return Ne=Fe(t.text,Ne,1),ga(r,Ne,Ye,tt,i-Ke)}function zo(e,t,r,i,n,k,z){var $=nt(function(ge){var Re=n[ge],Ae=Re.level!=1;return ya(Qi(e,Ve(r,Ae?Re.to:Re.from,Ae?"before":"after"),"line",t,i),k,z,!0)},0,n.length-1),J=n[$];if($>0){var ee=J.level!=1,ce=Qi(e,Ve(r,ee?J.from:J.to,ee?"after":"before"),"line",t,i);ya(ce,k,z,!0)&&ce.top>z&&(J=n[$-1])}return J}function Ko(e,t,r,i,n,k,z){var $=hs(e,t,i,z),J=$.begin,ee=$.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var ce=null,ge=null,Re=0;Re=ee||Ae.to<=J)continue;var Ne=Ae.level!=1,Ke=ar(e,i,Ne?Math.min(ee,Ae.to)-1:Math.max(J,Ae.from)).right,Ye=KeYe)&&(ce=Ae,ge=Ye)}return ce||(ce=n[n.length-1]),ce.fromee&&(ce={from:ce.from,to:ee,level:ce.level}),ce}var Mr;function Yr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Mr==null){Mr=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Mr.appendChild(document.createTextNode("x")),Mr.appendChild(u("br"));Mr.appendChild(document.createTextNode("x"))}_(e.measure,Mr);var r=Mr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),x(e.measure),r||1}function $r(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),r=u("pre",[t],"CodeMirror-line-like");_(e.measure,r);var i=t.getBoundingClientRect(),n=(i.right-i.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function _a(e){for(var t=e.display,r={},i={},n=t.gutters.clientLeft,k=t.gutters.firstChild,z=0;k;k=k.nextSibling,++z){var $=e.display.gutterSpecs[z].className;r[$]=k.offsetLeft+k.clientLeft+n,i[$]=k.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cs(e){var t=Yr(e.display),r=e.options.lineWrapping,i=r&&Math.max(5,e.display.scroller.clientWidth/$r(e.display)-3);return function(n){if(rr(e.doc,n))return 0;var k=0;if(n.widgets)for(var z=0;z0&&(ee=pt(e.doc,J.line).text).length==J.ch){var ce=W(ee,ee.length,e.options.tabSize)-ee.length;J=Ve(J.line,Math.max(0,Math.round((k-qa(e.display).left)/$r(e.display))-ce))}return J}function Fr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,i=0;it)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)li&&cn(e.doc,t)n.viewFrom?wr(e):(n.viewFrom+=i,n.viewTo+=i);else if(t<=n.viewFrom&&r>=n.viewTo)wr(e);else if(t<=n.viewFrom){var k=Gn(e,r,r+i,1);k?(n.view=n.view.slice(k.index),n.viewFrom=k.lineN,n.viewTo+=i):wr(e)}else if(r>=n.viewTo){var z=Gn(e,t,t,-1);z?(n.view=n.view.slice(0,z.index),n.viewTo=z.lineN):wr(e)}else{var $=Gn(e,t,t,-1),J=Gn(e,r,r+i,1);$&&J?(n.view=n.view.slice(0,$.index).concat(Oi(e,$.lineN,J.lineN)).concat(n.view.slice(J.index)),n.viewTo+=i):wr(e)}var ee=n.externalMeasured;ee&&(r=n.lineN&&t=i.viewTo)return;var k=i.view[Fr(e,t)];if(k.node==null)return;var z=k.changes||(k.changes=[]);ie(z,r)==-1&&z.push(r)}function wr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gn(e,t,r,i){var n=Fr(e,t),k,z=e.display.view;if(!li||r==e.doc.first+e.doc.size)return{index:n,lineN:r};for(var $=e.display.viewFrom,J=0;J0){if(n==z.length-1)return null;k=$+z[n].size-t,n++}else k=$-t;t+=k,r+=k}for(;cn(e.doc,r)!=r;){if(n==(i<0?0:z.length-1))return null;r+=i*z[n-(i<0?1:0)].size,n+=i}return{index:n,lineN:r}}function Vo(e,t,r){var i=e.display,n=i.view;n.length==0||t>=i.viewTo||r<=i.viewFrom?(i.view=Oi(e,t,r),i.viewFrom=t):(i.viewFrom>t?i.view=Oi(e,t,i.viewFrom).concat(i.view):i.viewFromr&&(i.view=i.view.slice(0,Fr(e,r)))),i.viewTo=r}function fs(e){for(var t=e.display.view,r=0,i=0;i=e.display.viewTo||$.to().line0?t.blinker=setInterval(function(){e.hasFocus()||Qr(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(),Ta(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Qr(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(ke(e,"focus",e,t),e.state.focused=!0,D(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),M&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Qr(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(ke(e,"blur",e,t),e.state.focused=!1,w(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,r=t.lineDiv.offsetTop,i=0;i.005||ce<-.005)&&(vi(n.line,z),ys(n.line),n.rest))for(var ge=0;gee.display.sizerWidth){var Re=Math.ceil($/$r(e.display));Re>e.display.maxLineLength&&(e.display.maxLineLength=Re,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t=z&&(k=Bi(t,$i(pt(t,J))-e.wrapper.clientHeight),z=J)}return{from:k,to:Math.max(z,k+1)}}function Yo(e,t){if(Ge(e,"scrollCursorIntoView"))return;var r=e.display,i=r.sizer.getBoundingClientRect(),n=null;if(t.top+i.top<0?n=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!o){var k=u("div","\u200B",null,`position: absolute; top: `+(t.top-r.viewOffset-jn(e.display))+`px; height: `+(t.bottom-t.top+nr(e)+r.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(n),e.display.lineSpace.removeChild(k)}}function $o(e,t,r,i){i==null&&(i=0);var n;!e.options.lineWrapping&&t==r&&(t=t.ch?Ve(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Ve(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var z=!1,$=Qi(e,t),J=!r||r==t?$:Qi(e,r);n={left:Math.min($.left,J.left),top:Math.min($.top,J.top)-i,right:Math.max($.left,J.left),bottom:Math.max($.bottom,J.bottom)+i};var ee=wa(e,n),ce=e.doc.scrollTop,ge=e.doc.scrollLeft;if(ee.scrollTop!=null&&(En(e,ee.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(z=!0)),ee.scrollLeft!=null&&(Ur(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(z=!0)),!z)break}return n}function Qo(e,t){var r=wa(e,t);r.scrollTop!=null&&En(e,r.scrollTop),r.scrollLeft!=null&&Ur(e,r.scrollLeft)}function wa(e,t){var r=e.display,i=Yr(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,k=ca(e),z={};t.bottom-t.top>k&&(t.bottom=t.top+k);var $=e.doc.height+da(r),J=t.top$-i;if(t.topn+k){var ce=Math.min(t.top,(ee?$:t.bottom)-k);ce!=n&&(z.scrollTop=ce)}var ge=e.options.fixedGutter?0:r.gutters.offsetWidth,Re=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-ge,Ae=Pr(e)-r.gutters.offsetWidth,Ne=t.right-t.left>Ae;return Ne&&(t.right=t.left+Ae),t.left<10?z.scrollLeft=0:t.leftAe+Re-3&&(z.scrollLeft=t.right+(Ne?0:10)-Ae),z}function Sa(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Zr(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bn(e,t,r){(t!=null||r!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Zo(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=us(e,t.from),i=us(e,t.to);_s(e,r,i,t.margin)}}function _s(e,t,r,i){var n=wa(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-i,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+i});bn(e,n.scrollLeft,n.scrollTop)}function En(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;P||Aa(e,{top:t}),bs(e,t,!0),P&&Aa(e),wn(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 Ur(e,t,r,i){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)&&!i)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function xn(e){var t=e.display,r=t.gutters.offsetWidth,i=Math.round(e.doc.height+da(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:i,scrollHeight:i+nr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Br=function(e,t,r){this.cm=r;var i=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=n.tabIndex=-1,e(i),e(n),De(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),De(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&G<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Br.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var n=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(r?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(i==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?i:0,bottom:t?i:0}},Br.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Br.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Br.prototype.zeroWidthHack=function(){var e=l&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},Br.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function i(){var n=e.getBoundingClientRect(),k=r=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},Br.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Tn=function(){};Tn.prototype.update=function(){return{bottom:0,right:0}},Tn.prototype.setScrollLeft=function(){},Tn.prototype.setScrollTop=function(){},Tn.prototype.clear=function(){};function Jr(e,t){t||(t=xn(e));var r=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var n=0;n<4&&r!=e.display.barWidth||i!=e.display.barHeight;n++)r!=e.display.barWidth&&e.options.lineWrapping&&Kn(e),Es(e,xn(e)),r=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var r=e.display,i=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=i.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=i.bottom)+"px",r.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=i.bottom+"px",r.scrollbarFiller.style.width=i.right+"px"):r.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=i.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var xs={native:Br,null:Tn};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&w(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),De(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"?Ur(e,t):En(e,t)},e),e.display.scrollbars.addClass&&D(e.display.wrapper,e.display.scrollbars.addClass)}var Jo=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:++Jo},Ki(e.curOp)}function jr(e){var t=e.curOp;t&&Io(t,function(r){for(var i=0;i=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function il(e){var t=e.cm,r=t.display;e.updatedDisplay&&Kn(t),e.barMeasure=xn(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+nr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Pr(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=e.display.viewTo)return;var r=+new Date+e.options.workTime,i=Ze(e,t.highlightFrontier),n=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(i.line>=e.display.viewFrom){var z=k.styles,$=k.text.length>e.options.maxHighlightLength?qt(t.mode,i.state):null,J=ye(e,k,i,!0);$&&(i.state=$),k.styles=J.styles;var ee=k.styleClasses,ce=J.classes;ce?k.styleClasses=ce:ee&&(k.styleClasses=null);for(var ge=!z||z.length!=k.styles.length||ee!=ce&&(!ee||!ce||ee.bgClass!=ce.bgClass||ee.textClass!=ce.textClass),Re=0;!ge&&Rer)return wn(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),n.length&&Ni(e,function(){for(var k=0;k=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&fs(e)==0)return!1;Cs(e)&&(wr(e),t.dims=_a(e));var n=i.first+i.size,k=Math.max(t.visible.from-e.options.viewportMargin,i.first),z=Math.min(n,t.visible.to+e.options.viewportMargin);r.viewFromz&&r.viewTo-z<20&&(z=Math.min(n,r.viewTo)),li&&(k=cn(e.doc,k),z=xr(e.doc,z));var $=k!=r.viewFrom||z!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vo(e,k,z),r.viewOffset=$i(pt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var J=fs(e);if(!$&&J==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var ee=ol(e);return J>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),J>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(ee),x(r.cursorDiv),x(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,$&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,wn(e,400)),r.updateLineNumbers=null,!0}function ws(e,t){for(var r=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Pr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+da(e.display)-ca(e),r.top)}),t.visible=Vn(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Vn(e.display,e.doc,r));if(!Ca(e,t))break;Kn(e);var n=xn(e);_n(e),Jr(e,n),Ra(e,n),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 Yn(e,t);if(Ca(e,r)){Kn(e),ws(e,r);var i=xn(e);_n(e),Jr(e,i),Ra(e,i),r.finish()}}function ul(e,t,r){var i=e.display,n=e.options.lineNumbers,k=i.lineDiv,z=k.firstChild;function $(Ne){var Ke=Ne.nextSibling;return M&&l&&e.display.currentWheelTarget==Ne?Ne.style.display="none":Ne.parentNode.removeChild(Ne),Ke}for(var J=i.view,ee=i.viewFrom,ce=0;ce-1&&(Ae=!1),Ya(e,ge,ee,r)),Ae&&(x(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(fr(e.options,ee)))),z=ge.node.nextSibling}ee+=ge.size}for(;z;)z=$(z)}function Oa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(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+nr(e)+"px"}function Ss(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=ba(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,k=i+"px",z=0;zz.clientWidth,J=z.scrollHeight>z.clientHeight;if(!(i&&$||n&&J))return;if(n&&l&&M){e:for(var ee=t.target,ce=k.view;ee!=z;ee=ee.parentNode)for(var ge=0;ge=0&&Tt(e,i.to())<=0)return r}return-1};var Gt=function(e,t){this.anchor=e,this.head=t};Gt.prototype.from=function(){return vr(this.anchor,this.head)},Gt.prototype.to=function(){return gr(this.anchor,this.head)},Gt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Zi(e,t,r){var i=e&&e.options.selectionsMayTouch,n=t[r];t.sort(function(Re,Ae){return Tt(Re.from(),Ae.from())}),r=ie(t,n);for(var k=1;k0:J>=0){var ee=vr($.from(),z.from()),ce=gr($.to(),z.to()),ge=$.empty()?z.from()==z.head:$.from()==$.head;k<=r&&--r,t.splice(--k,2,new Gt(ge?ce:ee,ge?ee:ce))}}return new Wi(t,r)}function Sr(e,t){return new Wi([new Gt(e,t||e)],0)}function Cr(e){return e.text?Ve(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(Tt(e,t.from)<0)return e;if(Tt(e,t.to)<=0)return Cr(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Cr(t).ch-t.to.ch),Ve(r,i)}function Ia(e,t){for(var r=[],i=0;i1&&e.remove($.line+1,Ne-1),e.insert($.line+1,tt)}mi(e,"change",e,t)}function Ar(e,t,r){function i(n,k,z){if(n.linked)for(var $=0;$1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function Ns(e,t,r,i){var n=e.history;n.undone.length=0;var k=+new Date,z,$;if((n.lastOp==i||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(z=pl(n,n.lastOp==i)))$=te(z.changes),Tt(t.from,t.to)==0&&Tt(t.from,$.to)==0?$.to=Cr(t):z.changes.push(Pa(e,t));else{var J=te(n.done);for((!J||!J.ranges)&&Zn(e.sel,n.done),z={changes:[Pa(e,t)],generation:n.generation},n.done.push(z);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(r),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=k,n.lastOp=n.lastSelOp=i,n.lastOrigin=n.lastSelOrigin=t.origin,$||ke(e,"historyAdded")}function ml(e,t,r,i){var n=t.charAt(0);return n=="*"||n=="+"&&r.ranges.length==i.ranges.length&&r.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,i){var n=e.history,k=i&&i.origin;r==n.lastSelOp||k&&n.lastSelOrigin==k&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==k||ml(e,k,te(n.done),t))?n.done[n.done.length-1]=t:Zn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=k,n.lastSelOp=r,i&&i.clearRedo!==!1&&Ms(n.undone)}function Zn(e,t){var r=te(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Fs(e,t,r,i){var n=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,i),function(z){z.markedSpans&&((n||(n=t["spans_"+e.id]={}))[k]=z.markedSpans),++k})}function vl(e){if(!e)return null;for(var t,r=0;r-1&&(te($)[ge]=ee[ge],delete ee[ge]))}}return i}function Ma(e,t,r,i){if(i){var n=e.anchor;if(r){var k=Tt(t,n)<0;k!=Tt(r,n)<0?(n=t,t=r):k!=Tt(t,r)<0&&(t=r)}return new Gt(n,t)}else return new Gt(r||t,t)}function Jn(e,t,r,i,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),Ei(e,new Wi([Ma(e.sel.primary(),t,r,n)],0),i)}function Bs(e,t,r){for(var i=[],n=e.cm&&(e.cm.display.shift||e.extend),k=0;k=t.ch:$.to>t.ch))){if(n&&(ke(J,"beforeCursorEnter"),J.explicitlyCleared))if(k.markedSpans){--z;continue}else break;if(!J.atomic)continue;if(r){var ge=J.find(i<0?1:-1),Re=void 0;if((i<0?ce:ee)&&(ge=Ks(e,ge,-i,ge&&ge.line==t.line?k:null)),ge&&ge.line==t.line&&(Re=Tt(ge,r))&&(i<0?Re<0:Re>0))return en(e,ge,t,i,n)}var Ae=J.find(i<0?-1:1);return(i<0?ee:ce)&&(Ae=Ks(e,Ae,i,Ae.line==t.line?k:null)),Ae?en(e,Ae,t,i,n):null}}return t}function ea(e,t,r,i,n){var k=i||1,z=en(e,t,r,k,n)||!n&&en(e,t,r,k,!0)||en(e,t,r,-k,n)||!n&&en(e,t,r,-k,!0);return z||(e.cantEdit=!0,Ve(e.first,0))}function Ks(e,t,r,i){return r<0&&t.ch==0?t.line>e.first?v(e,Ve(t.line-1)):null:r>0&&t.ch==(i||pt(e,t.line)).text.length?t.line=0;--n)Ys(e,{from:i[n].from,to:i[n].to,text:n?[""]:t.text,origin:t.origin});else Ys(e,t)}function Ys(e,t){if(t.text.length==1&&t.text[0]==""&&Tt(t.from,t.to)==0)return;var r=Ia(e,t);Ns(e,t,r,e.cm?e.cm.curOp.id:NaN),An(e,t,r,Yi(e,t));var i=[];Ar(e,function(n,k){!k&&ie(i,n.history)==-1&&(Js(n.history,t),i.push(n.history)),An(n,t,null,Yi(n,t))})}function ta(e,t,r){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!r)return;for(var n=e.history,k,z=e.sel,$=t=="undo"?n.done:n.undone,J=t=="undo"?n.undone:n.done,ee=0;ee<$.length&&!(k=$[ee],r?k.ranges&&!k.equals(e.sel):!k.ranges);ee++);if(ee==$.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(k=$.pop(),k.ranges){if(Zn(k,J),r&&!k.equals(e.sel)){Ei(e,k,{clearRedo:!1});return}z=k}else if(i){$.push(k);return}else break;var ce=[];Zn(z,J),J.push({changes:ce,generation:n.generation}),n.generation=k.generation||++n.maxGeneration;for(var ge=pe(e,"beforeChange")||e.cm&&pe(e.cm,"beforeChange"),Re=function(Ke){var Ye=k.changes[Ke];if(Ye.origin=t,ge&&!Xs(e,Ye,!1))return $.length=0,{};ce.push(Pa(e,Ye));var tt=Ke?Ia(e,Ye):te($);An(e,Ye,tt,Us(e,Ye)),!Ke&&e.cm&&e.cm.scrollIntoView({from:Ye.from,to:Cr(Ye)});var lt=[];Ar(e,function(it,dt){!dt&&ie(lt,it.history)==-1&&(Js(it.history,Ye),lt.push(it.history)),An(it,Ye,null,Us(it,Ye))})},Ae=k.changes.length-1;Ae>=0;--Ae){var Ne=Re(Ae);if(Ne)return Ne.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new Wi(he(e.sel.ranges,function(n){return new Gt(Ve(n.anchor.line+t,n.anchor.ch),Ve(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Ri(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,i=r.viewFrom;ie.lastLine())return;if(t.from.linek&&(t={from:t.from,to:Ve(k,pt(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Gi(e,t.from,t.to),r||(r=Ia(e,t)),e.cm?bl(e.cm,t,i):Da(e,t,i),qn(e,r,me),e.cantEdit&&ea(e,Ve(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,r){var i=e.doc,n=e.display,k=t.from,z=t.to,$=!1,J=k.line;e.options.lineWrapping||(J=kt(wi(pt(i,k.line))),i.iter(J,z.line+1,function(Ae){if(Ae==n.maxLine)return $=!0,!0})),i.sel.contains(t.from,t.to)>-1&&Ee(e),Da(i,t,r,cs(e)),e.options.lineWrapping||(i.iter(J,k.line+t.text.length,function(Ae){var Ne=pn(Ae);Ne>n.maxLineLength&&(n.maxLine=Ae,n.maxLineLength=Ne,n.maxLineChanged=!0,$=!1)}),$&&(e.curOp.updateMaxLine=!0)),Xi(i,k.line),wn(e,400);var ee=t.text.length-(z.line-k.line)-1;t.full?Ri(e):k.line==z.line&&t.text.length==1&&!ks(e.doc,t)?Tr(e,k.line,"text"):Ri(e,k.line,z.line+1,ee);var ce=pe(e,"changes"),ge=pe(e,"change");if(ge||ce){var Re={from:k,to:z,text:t.text,removed:t.removed,origin:t.origin};ge&&mi(e,"change",e,Re),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Re)}e.display.selForContextMenu=null}function rn(e,t,r,i,n){var k;i||(i=r),Tt(i,r)<0&&(k=[i,r],r=k[0],i=k[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:r,to:i,text:t,origin:n})}function Qs(e,t,r,i){r1||!(this.children[0]instanceof Rn))){var $=[];this.collapse($),this.children=[new Rn($)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var z=n.lines.length%25+25,$=z;$10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var i=0;ie.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&Ri(e,i,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&mi(e,"markerCleared",e,this,i,n),t&&jr(e),this.parent&&this.parent.clear()},Or.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,i,n=0;n0||z==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=b("span",[k.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(ui(e,t.line,t,r,k)||t.line!=r.line&&ui(e,r.line,t,r,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");or()}k.addToHistory&&Ns(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var $=t.line,J=e.cm,ee;if(e.iter($,r.line+1,function(ge){J&&k.collapsed&&!J.options.lineWrapping&&wi(ge)==J.display.maxLine&&(ee=!0),k.collapsed&&$!=t.line&&vi(ge,0),yr(ge,new lr(k,$==t.line?t.ch:null,$==r.line?r.ch:null)),++$}),k.collapsed&&e.iter(t.line,r.line+1,function(ge){rr(e,ge)&&vi(ge,0)}),k.clearOnEnter&&De(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(Hi(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++eo,k.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),k.collapsed)Ri(J,t.line,r.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var ce=t.line;ce<=r.line;ce++)Tr(J,ce,"text");k.atomic&&Gs(J.doc),mi(J,"markerAdded",J,k)}return k}var kn=function(e,t){this.markers=e,this.primary=t;for(var r=0;r=0;J--)tn(this,i[J]);$?js(this,$):this.cm&&Zr(this.cm)}),undo:di(function(){ta(this,"undo")}),redo:di(function(){ta(this,"redo")}),undoSelection:di(function(){ta(this,"undo",!0)}),redoSelection:di(function(){ta(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,i=0;i=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,r){e=v(this,e),t=v(this,t);var i=[],n=e.line;return this.iter(e.line,t.line+1,function(k){var z=k.markedSpans;if(z)for(var $=0;$=J.to||J.from==null&&n!=e.line||J.from!=null&&n==t.line&&J.from>=t.ch)&&(!r||r(J.marker))&&i.push(J.marker.parent||J.marker)}++n}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var i=0;ie)return t=e,!0;e-=k,++r}),v(this,Ve(r,t))},indexFromPos:function(e){e=v(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ce=e.dataTransfer.getData("Text");if(ce){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),qn(t.doc,Sr(r,r)),ge)for(var Re=0;Re=0;$--)rn(e.doc,"",i[$].from,i[$].to,"+delete");Zr(e)})}function Fa(e,t,r){var i=Fe(e.text,t+r,r);return i<0||i>e.text.length?null:i}function Ua(e,t,r){var i=Fa(e,t.ch,r);return i==null?null:new Ve(t.line,i,r<0?"after":"before")}function Ba(e,t,r,i,n){if(e){t.doc.direction=="rtl"&&(n=-n);var k=Xe(r,t.doc.direction);if(k){var z=n<0?te(k):k[0],$=n<0==(z.level==1),J=$?"after":"before",ee;if(z.level>0||t.doc.direction=="rtl"){var ce=Xr(t,r);ee=n<0?r.text.length-1:0;var ge=ar(t,ce,ee).top;ee=nt(function(Re){return ar(t,ce,Re).top==ge},n<0==(z.level==1)?z.from:z.to-1,ee),J=="before"&&(ee=Fa(r,ee,1))}else ee=n<0?z.to:z.from;return new Ve(i,ee,J)}}return new Ve(i,n<0?r.text.length:0,n<0?"before":"after")}function Pl(e,t,r,i){var n=Xe(t,e.doc.direction);if(!n)return Ua(t,r,i);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var k=Je(n,r.ch,r.sticky),z=n[k];if(e.doc.direction=="ltr"&&z.level%2==0&&(i>0?z.to>r.ch:z.from=z.from&&Re>=ce.begin)){var Ae=ge?"before":"after";return new Ve(r.line,Re,Ae)}}var Ne=function(tt,lt,it){for(var dt=function(Xt,ci){return ci?new Ve(r.line,$(Xt,1),"before"):new Ve(r.line,Xt,"after")};tt>=0&&tt0==(Et.level!=1),At=yt?it.begin:$(it.end,-1);if(Et.from<=At&&At0?ce.end:$(ce.begin,-1);return Ye!=null&&!(i>0&&Ye==t.text.length)&&(Ke=Ne(i>0?0:n.length-1,i,ee(Ye)),Ke)?Ke:null}var Mn={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),me)},killLine:function(e){return sn(e,function(t){if(t.empty()){var r=pt(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)n=new Ve(n.line,n.ch+1),e.replaceRange(k.charAt(n.ch-1)+k.charAt(n.ch-2),Ve(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var z=pt(e.doc,n.line-1).text;z&&(n=new Ve(n.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+z.charAt(z.length-1),Ve(n.line-1,z.length-1),n,"+transpose"))}}r.push(new Gt(n,n))}e.setSelections(r)})},newlineAndIndent:function(e){return Ni(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 i=0;ie&&Tt(t,this.pos)==0&&r==this.button};var Fn,Un;function jl(e,t){var r=+new Date;return Un&&Un.compare(r,e,t)?(Fn=Un=null,"triple"):Fn&&Fn.compare(r,e,t)?(Un=new ja(r,e,t),Fn=null,"double"):(Fn=new ja(r,e,t),Un=null,"single")}function vo(e){var t=this,r=t.display;if(Ge(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,hr(r,e)){M||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=Nr(t,e),n=Pe(e),k=i?jl(i,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,n,i,k,e))return;n==1?i?zl(t,i,k,e):be(e)==r.scroller&&re(e):n==2?(i&&Jn(t.doc,i),setTimeout(function(){return r.input.focus()},20)):n==3&&(R?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,r,i,n){var k="Click";return i=="double"?k="Double"+k:i=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,Nn(e,oo(k,n),n,function(z){if(typeof z=="string"&&(z=Mn[z]),!z)return!1;var $=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),$=z(e,r)!=xe}finally{e.state.suppressEdits=!1}return $})}function Gl(e,t,r){var i=e.getOption("configureMouse"),n=i?i(e,t,r):{};if(n.unit==null){var k=c?r.shiftKey&&r.metaKey:r.altKey;n.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||r.shiftKey),n.addNew==null&&(n.addNew=l?r.metaKey:r.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?r.altKey:r.ctrlKey)),n}function zl(e,t,r,i){K?setTimeout(I(gs,e),0):e.curOp.focus=N();var n=Gl(e,r,i),k=e.doc.sel,z;e.options.dragDrop&&je&&!e.isReadOnly()&&r=="single"&&(z=k.contains(t))>-1&&(Tt((z=k.ranges[z]).from(),t)<0||t.xRel>0)&&(Tt(z.to(),t)>0||t.xRel<0)?Kl(e,i,t,n):Vl(e,i,t,n)}function Kl(e,t,r,i){var n=e.display,k=!1,z=hi(e,function(ee){M&&(n.scroller.draggable=!1),e.state.draggingText=!1,et(n.wrapper.ownerDocument,"mouseup",z),et(n.wrapper.ownerDocument,"mousemove",$),et(n.scroller,"dragstart",J),et(n.scroller,"drop",z),k||(re(ee),i.addNew||Jn(e.doc,r,null,null,i.extend),M&&!f||K&&G==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),$=function(ee){k=k||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return k=!0};M&&(n.scroller.draggable=!0),e.state.draggingText=z,z.copy=!i.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),De(n.wrapper.ownerDocument,"mouseup",z),De(n.wrapper.ownerDocument,"mousemove",$),De(n.scroller,"dragstart",J),De(n.scroller,"drop",z),vs(e),setTimeout(function(){return n.input.focus()},20)}function yo(e,t,r){if(r=="char")return new Gt(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Gt(Ve(t.line,0),v(e.doc,Ve(t.line+1,0)));var i=r(e,t);return new Gt(i.from,i.to)}function Vl(e,t,r,i){var n=e.display,k=e.doc;re(t);var z,$,J=k.sel,ee=J.ranges;if(i.addNew&&!i.extend?($=k.sel.contains(r),$>-1?z=ee[$]:z=new Gt(r,r)):(z=k.sel.primary(),$=k.sel.primIndex),i.unit=="rectangle")i.addNew||(z=new Gt(r,r)),r=Nr(e,t,!0,!0),$=-1;else{var ce=yo(e,r,i.unit);i.extend?z=Ma(z,ce.anchor,ce.head,i.extend):z=ce}i.addNew?$==-1?($=ee.length,Ei(k,Zi(e,ee.concat([z]),$),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[$].empty()&&i.unit=="char"&&!i.extend?(Ei(k,Zi(e,ee.slice(0,$).concat(ee.slice($+1)),0),{scroll:!1,origin:"*mouse"}),J=k.sel):Na(k,$,z,Te):($=0,Ei(k,new Wi([z],0),Te),J=k.sel);var ge=r;function Re(it){if(Tt(ge,it)==0)return;if(ge=it,i.unit=="rectangle"){for(var dt=[],Et=e.options.tabSize,yt=W(pt(k,r.line).text,r.ch,Et),At=W(pt(k,it.line).text,it.ch,Et),Xt=Math.min(yt,At),ci=Math.max(yt,At),Jt=Math.min(r.line,it.line),Fi=Math.min(e.lastLine(),Math.max(r.line,it.line));Jt<=Fi;Jt++){var Ii=pt(k,Jt).text,ni=we(Ii,Xt,Et);Xt==ci?dt.push(new Gt(Ve(Jt,ni),Ve(Jt,ni))):Ii.length>ni&&dt.push(new Gt(Ve(Jt,ni),Ve(Jt,we(Ii,ci,Et))))}dt.length||dt.push(new Gt(r,r)),Ei(k,Zi(e,J.ranges.slice(0,$).concat(dt),$),{origin:"*mouse",scroll:!1}),e.scrollIntoView(it)}else{var ki=z,gi=yo(e,it,i.unit),oi=ki.anchor,ai;Tt(gi.anchor,oi)>0?(ai=gi.head,oi=vr(ki.from(),gi.anchor)):(ai=gi.anchor,oi=gr(ki.to(),gi.head));var ei=J.ranges.slice(0);ei[$]=Xl(e,new Gt(v(k,oi),ai)),Ei(k,Zi(e,ei,$),Te)}}var Ae=n.wrapper.getBoundingClientRect(),Ne=0;function Ke(it){var dt=++Ne,Et=Nr(e,it,!0,i.unit=="rectangle");if(!Et)return;if(Tt(Et,ge)!=0){e.curOp.focus=N(),Re(Et);var yt=Vn(n,k);(Et.line>=yt.to||Et.lineAe.bottom?20:0;At&&setTimeout(hi(e,function(){if(Ne!=dt)return;n.scroller.scrollTop+=At,Ke(it)}),50)}}function Ye(it){e.state.selectingText=!1,Ne=Infinity,it&&(re(it),n.input.focus()),et(n.wrapper.ownerDocument,"mousemove",tt),et(n.wrapper.ownerDocument,"mouseup",lt),k.history.lastSelOrigin=null}var tt=hi(e,function(it){it.buttons===0||!Pe(it)?Ye(it):Ke(it)}),lt=hi(e,Ye);e.state.selectingText=lt,De(n.wrapper.ownerDocument,"mousemove",tt),De(n.wrapper.ownerDocument,"mouseup",lt)}function Xl(e,t){var r=t.anchor,i=t.head,n=pt(e.doc,r.line);if(Tt(r,i)==0&&r.sticky==i.sticky)return t;var k=Xe(n);if(!k)return t;var z=Je(k,r.ch,r.sticky),$=k[z];if($.from!=r.ch&&$.to!=r.ch)return t;var J=z+($.from==r.ch==($.level!=1)?0:1);if(J==0||J==k.length)return t;var ee;if(i.line!=r.line)ee=(i.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=Je(k,i.ch,i.sticky),ge=ce-z||(i.ch-r.ch)*($.level==1?-1:1);ce==J-1||ce==J?ee=ge<0:ee=ge>0}var Re=k[J+(ee?-1:0)],Ae=ee==(Re.level==1),Ne=Ae?Re.from:Re.to,Ke=Ae?"after":"before";return r.ch==Ne&&r.sticky==Ke?t:new Gt(new Ve(r.line,Ne,Ke),i)}function _o(e,t,r,i){var n,k;if(t.touches)n=t.touches[0].clientX,k=t.touches[0].clientY;else try{n=t.clientX,k=t.clientY}catch(Re){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&re(t);var z=e.display,$=z.lineDiv.getBoundingClientRect();if(k>$.bottom||!pe(e,r))return de(t);k-=$.top-z.viewOffset;for(var J=0;J=n){var ce=Bi(e.doc,k),ge=e.display.gutterSpecs[J];return ke(e,r,e,ce,ge.className,t),de(t)}}}function Wa(e,t){return _o(e,t,"gutterClick",!0)}function bo(e,t){if(hr(e.display,t)||Yl(e,t))return;if(Ge(e,t,"contextmenu"))return;R||e.display.input.onContextMenu(t)}function Yl(e,t){return pe(e,"gutterContextMenu")?_o(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yn(e)}var on={toString:function(){return"CodeMirror.Init"}},xo={},aa={};function $l(e){var t=e.optionHandlers;function r(i,n,k,z){e.defaults[i]=n,k&&(t[i]=z?function($,J,ee){ee!=on&&k($,J,ee)}:k)}e.defineOption=r,e.Init=on,r("value","",function(i,n){return i.setValue(n)},!0),r("mode",null,function(i,n){i.doc.modeOption=n,ka(i)},!0),r("indentUnit",2,ka,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(i){Cn(i),yn(i),Ri(i)},!0),r("lineSeparator",null,function(i,n){if(i.doc.lineSep=n,!n)return;var k=[],z=i.doc.first;i.doc.iter(function(J){for(var ee=0;;){var ce=J.text.indexOf(n,ee);if(ce==-1)break;ee=ce+n.length,k.push(Ve(z,ce))}z++});for(var $=k.length-1;$>=0;$--)rn(i.doc,n,k[$],Ve(k[$].line,k[$].ch+n.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,n,k){i.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),k!=on&&i.refresh()}),r("specialCharPlaceholder",Vt,function(i){return i.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(i,n){return i.getInputField().spellcheck=n},!0),r("autocorrect",!1,function(i,n){return i.getInputField().autocorrect=n},!0),r("autocapitalize",!1,function(i,n){return i.getInputField().autocapitalize=n},!0),r("rtlMoveVisually",!O),r("wholeLineUpdateBefore",!0),r("theme","default",function(i){Eo(i),Sn(i)},!0),r("keyMap","default",function(i,n,k){var z=ra(n),$=k!=on&&ra(k);$&&$.detach&&$.detach(i,z),z.attach&&z.attach(i,$||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Zl,!0),r("gutters",[],function(i,n){i.display.gutterSpecs=La(n,i.options.lineNumbers),Sn(i)},!0),r("fixedGutter",!0,function(i,n){i.display.gutters.style.left=n?ba(i.display)+"px":"0",i.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(i){return Jr(i)},!0),r("scrollbarStyle","native",function(i){Ts(i),Jr(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),r("lineNumbers",!1,function(i,n){i.display.gutterSpecs=La(i.options.gutters,n),Sn(i)},!0),r("firstLineNumber",1,Sn,!0),r("lineNumberFormatter",function(i){return i},Sn,!0),r("showCursorWhenSelecting",!1,_n,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(i,n){n=="nocursor"&&(Qr(i),i.display.input.blur()),i.display.input.readOnlyChanged(n)}),r("screenReaderLabel",null,function(i,n){n=n===""?null:n,i.display.input.screenReaderLabelChanged(n)}),r("disableInput",!1,function(i,n){n||i.display.input.reset()},!0),r("dragDrop",!0,Ql),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,_n,!0),r("singleCursorHeightPerLine",!0,_n,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Cn,!0),r("addModeClass",!1,Cn,!0),r("pollInterval",100),r("undoDepth",200,function(i,n){return i.doc.history.undoDepth=n}),r("historyEventDelay",1250),r("viewportMargin",10,function(i){return i.refresh()},!0),r("maxHighlightLength",1e4,Cn,!0),r("moveInputWithCursor",!0,function(i,n){n||i.display.input.resetPosition()}),r("tabindex",null,function(i,n){return i.display.input.getField().tabIndex=n||""}),r("autofocus",null),r("direction","ltr",function(i,n){return i.doc.setDirection(n)},!0),r("phrases",null)}function Ql(e,t,r){var i=r&&r!=on;if(!t!=!i){var n=e.display.dragFunctions,k=t?De:et;k(e.display.scroller,"dragstart",n.start),k(e.display.scroller,"dragenter",n.enter),k(e.display.scroller,"dragover",n.over),k(e.display.scroller,"dragleave",n.leave),k(e.display.scroller,"drop",n.drop)}}function Zl(e){e.options.lineWrapping?(D(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(w(e.display.wrapper,"CodeMirror-wrap"),Hn(e)),Ea(e),Ri(e),yn(e),setTimeout(function(){return Jr(e)},100)}function Qt(e,t){var r=this;if(!(this instanceof Qt))return new Qt(e,t);this.options=t=t?y(t):{},y(xo,t,!1);var i=t.value;typeof i=="string"?i=new Li(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var n=new Qt.inputStyles[t.inputStyle](this),k=this.display=new hl(e,i,n,t);k.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ts(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 Y,keySeq:null,specialChars:null},t.autofocus&&!a&&k.input.focus(),K&&G<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Jl(this),Rl(),Hr(this),this.curOp.forceUpdate=!0,Ds(this,i),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ta(r)},20):Qr(this);for(var z in aa)aa.hasOwnProperty(z)&&aa[z](this,t[z],on);Cs(this),t.finishInit&&t.finishInit(this);for(var $=0;$20*20}De(t.scroller,"touchstart",function(J){if(!Ge(e,J)&&!k(J)&&!Wa(e,J)){t.input.ensurePolled(),clearTimeout(r);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-i.end<=300?i:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),De(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),De(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!hr(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var ce=e.coordsChar(t.activeTouch,"page"),ge;!ee.prev||z(ee,ee.prev)?ge=new Gt(ce,ce):!ee.prev.prev||z(ee,ee.prev.prev)?ge=e.findWordAt(ce):ge=new Gt(Ve(ce.line,0),v(e.doc,Ve(ce.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),re(J)}n()}),De(t.scroller,"touchcancel",n),De(t.scroller,"scroll",function(){t.scroller.clientHeight&&(En(e,t.scroller.scrollTop),Ur(e,t.scroller.scrollLeft,!0),ke(e,"scroll",e))}),De(t.scroller,"mousewheel",function(J){return Rs(e,J)}),De(t.scroller,"DOMMouseScroll",function(J){return Rs(e,J)}),De(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){Ge(e,J)||ve(J)},over:function(J){Ge(e,J)||(Ol(e,J),ve(J))},start:function(J){return Al(e,J)},drop:hi(e,Cl),leave:function(J){Ge(e,J)||ro(e)}};var $=t.input.getField();De($,"keyup",function(J){return mo.call(e,J)}),De($,"keydown",hi(e,po)),De($,"keypress",hi(e,go)),De($,"focus",function(J){return Ta(e,J)}),De($,"blur",function(J){return Qr(e,J)})}var Ga=[];Qt.defineInitHook=function(e){return Ga.push(e)};function Bn(e,t,r,i){var n=e.doc,k;r==null&&(r="add"),r=="smart"&&(n.mode.indent?k=Ze(e,t).state:r="prev");var z=e.options.tabSize,$=pt(n,t),J=W($.text,null,z);$.stateAfter&&($.stateAfter=null);var ee=$.text.match(/^\s*/)[0],ce;if(!i&&!/\S/.test($.text))ce=0,r="not";else if(r=="smart"&&(ce=n.mode.indent(k,$.text.slice(ee.length),$.text),ce==xe||ce>150)){if(!i)return;r="prev"}r=="prev"?t>n.first?ce=W(pt(n,t-1).text,null,z):ce=0:r=="add"?ce=J+e.options.indentUnit:r=="subtract"?ce=J-e.options.indentUnit:typeof r=="number"&&(ce=J+r),ce=Math.max(0,ce);var ge="",Re=0;if(e.options.indentWithTabs)for(var Ae=Math.floor(ce/z);Ae;--Ae)Re+=z,ge+=" ";if(Rez,J=xt(t),ee=null;if($&&i.ranges.length>1)if(Ji&&Ji.text.join(` `)==t){if(i.ranges.length%Ji.text.length==0){ee=[];for(var ce=0;ce=0;Re--){var Ae=i.ranges[Re],Ne=Ae.from(),Ke=Ae.to();Ae.empty()&&(r&&r>0?Ne=Ve(Ne.line,Ne.ch-r):e.state.overwrite&&!$?Ke=Ve(Ke.line,Math.min(pt(k,Ke.line).text.length,Ke.ch+te(J).length)):$&&Ji&&Ji.lineWise&&Ji.text.join(` `)==J.join(` `)&&(Ne=Ke=Ve(Ne.line,0)));var Ye={from:Ne,to:Ke,text:ee?ee[Re%ee.length]:J,origin:n||($?"paste":e.state.cutIncoming>z?"cut":"+input")};tn(e.doc,Ye),mi(e,"inputRead",e,Ye)}t&&!$&&wo(e,t),Zr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Ni(t,function(){return za(t,r,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,i=r.ranges.length-1;i>=0;i--){var n=r.ranges[i];if(n.head.ch>100||i&&r.ranges[i-1].head.line==n.head.line)continue;var k=e.getModeAt(n.head),z=!1;if(k.electricChars){for(var $=0;$-1){z=Bn(e,n.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(pt(e.doc,n.head.line).text.slice(0,n.head.ch))&&(z=Bn(e,n.head.line,"smart")));z&&mi(e,"electricInput",e,n.head.line)}}function So(e){for(var t=[],r=[],i=0;ik&&(Bn(this,$.head.line,i,!0),k=$.head.line,z==this.doc.sel.primIndex&&Zr(this));else{var J=$.from(),ee=$.to(),ce=Math.max(k,J.line);k=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ge=ce;ge0&&Na(this.doc,z,new Gt(J,Re[z].to()),me)}}}),getTokenAt:function(i,n){return $t(this,i,n)},getLineTokens:function(i,n){return $t(this,Ve(i),n,!0)},getTokenTypeAt:function(i){i=v(this.doc,i);var n=Be(this,pt(this.doc,i.line)),k=0,z=(n.length-1)/2,$=i.ch,J;if($==0)J=n[2];else for(;;){var ee=k+z>>1;if((ee?n[ee*2-1]:0)>=$)z=ee;else if(n[ee*2+1]<$)k=ee+1;else{J=n[ee*2+2];break}}var ce=J?J.indexOf("overlay "):-1;return ce<0?J:ce==0?null:J.slice(0,ce-1)},getModeAt:function(i){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(i).state).mode:n},getHelper:function(i,n){return this.getHelpers(i,n)[0]},getHelpers:function(i,n){var k=[];if(!r.hasOwnProperty(n))return k;var z=r[n],$=this.getModeAt(i);if(typeof $[n]=="string")z[$[n]]&&k.push(z[$[n]]);else if($[n])for(var J=0;J<$[n].length;J++){var ee=z[$[n][J]];ee&&k.push(ee)}else $.helperType&&z[$.helperType]?k.push(z[$.helperType]):z[$.name]&&k.push(z[$.name]);for(var ce=0;ceJ&&(i=J,z=!0),$=pt(this.doc,i)}else $=i;return Wn(this,$,{top:0,left:0},n||"page",k||z).top+(z?this.doc.height-$i($):0)},defaultTextHeight:function(){return Yr(this.display)},defaultCharWidth:function(){return $r(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,n,k,z,$){var J=this.display;i=Qi(this,v(this.doc,i));var ee=i.bottom,ce=i.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),J.sizer.appendChild(n),z=="over")ee=i.top;else if(z=="above"||z=="near"){var ge=Math.max(J.wrapper.clientHeight,this.doc.height),Re=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(z=="above"||i.bottom+n.offsetHeight>ge)&&i.top>n.offsetHeight?ee=i.top-n.offsetHeight:i.bottom+n.offsetHeight<=ge&&(ee=i.bottom),ce+n.offsetWidth>Re&&(ce=Re-n.offsetWidth)}n.style.top=ee+"px",n.style.left=n.style.right="",$=="right"?(ce=J.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):($=="left"?ce=0:$=="middle"&&(ce=(J.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ce+"px"),k&&Qo(this,{left:ce,top:ee,right:ce+n.offsetWidth,bottom:ee+n.offsetHeight})},triggerOnKeyDown:Si(po),triggerOnKeyPress:Si(go),triggerOnKeyUp:mo,triggerOnMouseDown:Si(vo),execCommand:function(i){if(Mn.hasOwnProperty(i))return Mn[i].call(null,this)},triggerElectric:Si(function(i){wo(this,i)}),findPosH:function(i,n,k,z){var $=1;n<0&&($=-1,n=-n);for(var J=v(this.doc,i),ee=0;ee0&&ce(k.charAt(z-1));)--z;for(;$.5||this.options.lineWrapping)&&Ea(this),ke(this,"refresh",this)}),swapDoc:Si(function(i){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Ds(this,i),yn(this),this.display.input.reset(),bn(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,mi(this,"swapDoc",this,n),n}),phrase:function(i){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,i)?n[i]:i},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}},_e(e),e.registerHelper=function(i,n,k){r.hasOwnProperty(i)||(r[i]=e[i]={_global:[]}),r[i][n]=k},e.registerGlobalHelper=function(i,n,k,z){e.registerHelper(i,n,z),r[i]._global.push({pred:k,val:z})}}function Ka(e,t,r,i,n){var k=t,z=r,$=pt(e,t.line),J=n&&e.direction=="rtl"?-r:r;function ee(){var lt=t.line+J;return lt=e.first+e.size?!1:(t=new Ve(lt,t.ch,t.sticky),$=pt(e,lt))}function ce(lt){var it;if(i=="codepoint"){var dt=$.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(dt)?it=null:it=new Ve(t.line,Math.max(0,Math.min($.text.length,t.ch+r*(dt>=55296&&dt<56320?2:1))),-r)}else n?it=Pl(e.cm,$,t,r):it=Ua($,t,r);if(it==null)if(!lt&&ee())t=Ba(n,e.cm,$,t.line,J);else return!1;else t=it;return!0}if(i=="char"||i=="codepoint")ce();else if(i=="column")ce(!0);else if(i=="word"||i=="group")for(var ge=null,Re=i=="group",Ae=e.cm&&e.cm.getHelper(t,"wordChars"),Ne=!0;!(r<0&&!ce(!Ne));Ne=!1){var Ke=$.text.charAt(t.ch)||` `,Ye=Me(Ke,Ae)?"w":Re&&Ke==` `?"n":!Re||/\s/.test(Ke)?null:"p";if(Re&&!Ne&&!Ye&&(Ye="s"),ge&&ge!=Ye){r<0&&(r=1,ce(),t.sticky="after");break}if(Ye&&(ge=Ye),r>0&&!ce(!Ne))break}var tt=ea(e,t,k,z,!0);return pr(k,tt)&&(tt.hitSide=!0),tt}function Oo(e,t,r,i){var n=e.doc,k=t.left,z;if(i=="page"){var $=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max($-.5*Yr(e.display),3);z=(r>0?t.bottom:t.top)+r*J}else i=="line"&&(z=r>0?t.bottom+3:t.top-3);for(var ee;!(ee=va(e,k,z),!ee.outside);){if(r<0?z<=0:z>=n.height){ee.hitSide=!0;break}z+=r*5}return ee}var Kt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Kt.prototype.init=function(e){var t=this,r=this,i=r.cm,n=r.div=e.lineDiv;Co(n,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function k($){for(var J=$.target;J;J=J.parentNode){if(J==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}De(n,"paste",function($){if(!k($)||Ge(i,$)||To($,i))return;G<=11&&setTimeout(hi(i,function(){return t.updateFromDOM()}),20)}),De(n,"compositionstart",function($){t.composing={data:$.data,done:!1}}),De(n,"compositionupdate",function($){t.composing||(t.composing={data:$.data,done:!1})}),De(n,"compositionend",function($){t.composing&&($.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),De(n,"touchstart",function(){return r.forceCompositionEnd()}),De(n,"input",function(){t.composing||t.readFromDOMSoon()});function z($){if(!k($)||Ge(i,$))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()}),$.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var J=So(i);sa({lineWise:!0,text:J.text}),$.type=="cut"&&i.operation(function(){i.setSelections(J.ranges,0,me),i.replaceSelection("",null,"cut")})}else return;if($.clipboardData){$.clipboardData.clearData();var ee=Ji.text.join(` `);if($.clipboardData.setData("Text",ee),$.clipboardData.getData("Text")==ee){$.preventDefault();return}}var ce=Ao(),ge=ce.firstChild;i.display.lineSpace.insertBefore(ce,i.display.lineSpace.firstChild),ge.value=Ji.text.join(` `);var Re=document.activeElement;H(ge),setTimeout(function(){i.display.lineSpace.removeChild(ce),Re.focus(),Re==n&&r.showPrimarySelection()},50)}De(n,"copy",z),De(n,"cut",z)},Kt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Kt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Kt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Kt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Kt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),n=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||n.line=t.display.viewFrom&&Ro(t,i)||{node:$[0].measure.map[2],offset:0},ee=n.linee.firstLine()&&(i=Ve(i.line-1,pt(e.doc,i.line-1).length)),n.ch==pt(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var k,z,$;i.line==t.viewFrom||(k=Fr(e,i.line))==0?(z=kt(t.view[0].line),$=t.view[0].node):(z=kt(t.view[k].line),$=t.view[k-1].node.nextSibling);var J=Fr(e,n.line),ee,ce;if(J==t.view.length-1?(ee=t.viewTo-1,ce=t.lineDiv.lastChild):(ee=kt(t.view[J+1].line)-1,ce=t.view[J+1].node.previousSibling),!$)return!1;for(var ge=e.doc.splitLines(tu(e,$,ce,z,ee)),Re=Gi(e.doc,Ve(z,0),Ve(ee,pt(e.doc,ee).text.length));ge.length>1&&Re.length>1;)if(te(ge)==te(Re))ge.pop(),Re.pop(),ee--;else if(ge[0]==Re[0])ge.shift(),Re.shift(),z++;else break;for(var Ae=0,Ne=0,Ke=ge[0],Ye=Re[0],tt=Math.min(Ke.length,Ye.length);Aei.ch&<.charCodeAt(lt.length-Ne-1)==it.charCodeAt(it.length-Ne-1);)Ae--,Ne++;ge[ge.length-1]=lt.slice(0,lt.length-Ne).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Ae).replace(/\u200b+$/,"");var Et=Ve(z,Ae),yt=Ve(ee,Re.length?te(Re).length-Ne:0);if(ge.length>1||ge[0]||Tt(Et,yt))return rn(e.doc,ge,Et,yt,"+input"),!0},Kt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Kt.prototype.reset=function(){this.forceCompositionEnd()},Kt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Kt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Kt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ni(this.cm,function(){return Ri(e.cm)})},Kt.prototype.setUneditable=function(e){e.contentEditable="false"},Kt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||hi(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Kt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Kt.prototype.onContextMenu=function(){},Kt.prototype.resetPosition=function(){},Kt.prototype.needsContentAttribute=!0;function Ro(e,t){var r=fa(e,t.line);if(!r||r.hidden)return null;var i=pt(e.doc,t.line),n=es(r,i,t.line),k=Xe(i,e.doc.direction),z="left";if(k){var $=Je(k,t.ch);z=$%2?"right":"left"}var J=rs(n.map,t.ch,z);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ln(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,i,n){var k="",z=!1,$=e.doc.lineSeparator(),J=!1;function ee(Ae){return function(Ne){return Ne.id==Ae}}function ce(){z&&(k+=$,J&&(k+=$),z=J=!1)}function ge(Ae){Ae&&(ce(),k+=Ae)}function Re(Ae){if(Ae.nodeType==1){var Ne=Ae.getAttribute("cm-text");if(Ne){ge(Ne);return}var Ke=Ae.getAttribute("cm-marker"),Ye;if(Ke){var tt=e.findMarks(Ve(i,0),Ve(n+1,0),ee(+Ke));tt.length&&(Ye=tt[0].find(0))&&ge(Gi(e.doc,Ye.from,Ye.to).join($));return}if(Ae.getAttribute("contenteditable")=="false")return;var lt=/^(pre|div|p|li|table|br)$/i.test(Ae.nodeName);if(!/^br$/i.test(Ae.nodeName)&&Ae.textContent.length==0)return;lt&&ce();for(var it=0;it=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),De(n,"paste",function(z){if(Ge(i,z)||To(z,i))return;i.state.pasteIncoming=+new Date,r.fastPoll()});function k(z){if(Ge(i,z))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var $=So(i);sa({lineWise:!0,text:$.text}),z.type=="cut"?i.setSelections($.ranges,null,me):(r.prevInput="",n.value=$.text.join(` `),H(n))}else return;z.type=="cut"&&(i.state.cutIncoming=+new Date)}De(n,"cut",k),De(n,"copy",k),De(e.scroller,"paste",function(z){if(hr(e,z)||Ge(i,z))return;if(!n.dispatchEvent){i.state.pasteIncoming=+new Date,r.focus();return}var $=new Event("paste");$.clipboardData=z.clipboardData,n.dispatchEvent($)}),De(e.lineSpace,"selectstart",function(z){hr(e,z)||re(z)}),De(n,"compositionstart",function(){var z=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:z,range:i.markText(z,i.getCursor("to"),{className:"CodeMirror-composing"})}}),De(n,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},ii.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},ii.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ii.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var n=Qi(e,r.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),z=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+z.top-k.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+z.left-k.left))}return i},ii.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")},ii.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&&H(this.textarea),K&&G>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",K&&G>=9&&(this.hasSelection=null))},ii.prototype.getField=function(){return this.textarea},ii.prototype.supportsTouch=function(){return!1},ii.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},ii.prototype.blur=function(){this.textarea.blur()},ii.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ii.prototype.receivedFocus=function(){this.slowPoll()},ii.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()})},ii.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},ii.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||ht(r)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=r.value;if(n==i&&!t.somethingSelected())return!1;if(K&&G>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=n.charCodeAt(0);if(k==8203&&!i&&(i="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var z=0,$=Math.min(i.length,n.length);z<$&&i.charCodeAt(z)==n.charCodeAt(z);)++z;return Ni(t,function(){za(t,n.slice(z),i.length-z,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(` `)>-1?r.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ii.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ii.prototype.onKeyPress=function(){K&&G>=9&&(this.hasSelection=null),this.fastPoll()},ii.prototype.onContextMenu=function(e){var t=this,r=t.cm,i=r.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=Nr(r,e),z=i.scroller.scrollTop;if(!k||p)return;var $=r.options.resetSelectionOnContextMenu;$&&r.doc.sel.contains(k)==-1&&hi(r,Ei)(r.doc,Sr(k),me);var J=n.style.cssText,ee=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.left-5)+`px; z-index: 1000; background: `+(K?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ge;M&&(ge=window.scrollY),i.input.focus(),M&&window.scrollTo(null,ge),i.input.reset(),r.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Ae,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll);function Re(){if(n.selectionStart!=null){var Ke=r.somethingSelected(),Ye="\u200B"+(Ke?n.value:"");n.value="\u21DA",n.value=Ye,t.prevInput=Ke?"":"\u200B",n.selectionStart=1,n.selectionEnd=Ye.length,i.selForContextMenu=r.doc.sel}}function Ae(){if(t.contextMenuPending!=Ae)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,n.style.cssText=J,K&&G<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=z),n.selectionStart!=null){(!K||K&&G<9)&&Re();var Ke=0,Ye=function(){i.selForContextMenu==r.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?hi(r,Vs)(r):Ke++<10?i.detectingSelectAll=setTimeout(Ye,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(Ye,200)}}if(K&&G>=9&&Re(),R){ve(e);var Ne=function(){et(window,"mouseup",Ne),setTimeout(Ae,20)};De(window,"mouseup",Ne)}else setTimeout(Ae,50)},ii.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},ii.prototype.setUneditable=function(){},ii.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?y(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=N();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function i(){e.value=$.getValue()}var n;if(e.form&&(De(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var k=e.form;n=k.submit;try{var z=k.submit=function(){i(),k.submit=n,k.submit(),k.submit=z}}catch(J){}}t.finishInit=function(J){J.save=i,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,i(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(et(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var $=Qt(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return $}function nu(e){e.off=et,e.on=De,e.wheelEventPixels=dl,e.Doc=Li,e.splitLines=xt,e.countColumn=W,e.findColumn=we,e.isWordChar=Le,e.Pass=xe,e.signal=ke,e.Line=Dr,e.changeEnd=Cr,e.scrollbarModel=xs,e.Pos=Ve,e.cmpPos=Tt,e.modes=Yt,e.mimeModes=Rt,e.resolveMode=$e,e.getMode=wt,e.modeExtensions=Ot,e.extendMode=Lt,e.copyState=qt,e.startState=er,e.innerMode=qi,e.commands=Mn,e.keyMap=dr,e.keyName=lo,e.isModifierKey=so,e.lookupKey=an,e.normalizeKeyMap=Dl,e.StringStream=Bt,e.SharedTextMarker=kn,e.TextMarker=Or,e.LineWidget=In,e.e_preventDefault=re,e.e_stopPropagation=ne,e.e_stop=ve,e.addClass=D,e.contains=E,e.rmClass=w,e.keyNames=Rr}$l(Qt),ql(Qt);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Li.prototype)Li.prototype.hasOwnProperty(la)&&ie(au,la)<0&&(Qt.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Li.prototype[la]));return _e(Li),Qt.inputStyles={textarea:ii,contenteditable:Kt},Qt.defineMode=function(e){!Qt.defaults.mode&&e!="null"&&(Qt.defaults.mode=e),Ti.apply(this,arguments)},Qt.defineMIME=Ui,Qt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Qt.defineMIME("text/plain","null"),Qt.defineExtension=function(e,t){Qt.prototype[e]=t},Qt.defineDocExtension=function(e,t){Li.prototype[e]=t},Qt.fromTextArea=ru,nu(Qt),Qt.version="5.58.2",Qt})},Y1PL:function(vt,rt,oe){"use strict";oe.r(rt),oe.d(rt,"ResizableTextArea",function(){return ie});var ue=oe("wx14"),Z=oe("1OyB"),P=oe("vuIU"),Q=oe("Ji7U"),B=oe("LK+K"),F=oe("q1tI"),K=oe("VTBJ"),G=oe("rePB"),M=oe("Zm9Q"),L=oe("Kwbf"),g=oe("c+Xe"),p=oe("m+aA"),f=oe("bdgK"),h=new Map;function o(me){me.forEach(function(Te){var Se,we=Te.target;(Se=h.get(we))===null||Se===void 0||Se.forEach(function(fe){return fe(we)})})}var d=new f.default(o),s=null,a=null;function l(me,Te){h.has(me)||(h.set(me,new Set),d.observe(me)),h.get(me).add(Te)}function c(me,Te){h.has(me)&&(h.get(me).delete(Te),h.get(me).size||(d.unobserve(me),h.delete(me)))}var O=function(me){Object(Q.a)(Se,me);var Te=Object(B.a)(Se);function Se(){return Object(Z.a)(this,Se),Te.apply(this,arguments)}return Object(P.a)(Se,[{key:"render",value:function(){return this.props.children}}]),Se}(F.Component),S=F.createContext(null);function T(me){var Te=me.children,Se=me.onBatchResize,we=F.useRef(0),fe=F.useRef([]),le=F.useContext(S),te=F.useCallback(function(he,ae,Oe){we.current+=1;var Ie=we.current;fe.current.push({size:he,element:ae,data:Oe}),Promise.resolve().then(function(){Ie===we.current&&(Se==null||Se(fe.current),fe.current=[])}),le==null||le(he,ae,Oe)},[Se,le]);return F.createElement(S.Provider,{value:te},Te)}function R(me){var Te=me.children,Se=me.disabled,we=F.useRef(null),fe=F.useRef(null),le=F.useContext(S),te=F.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),he=F.isValidElement(Te)&&Object(g.c)(Te),ae=he?Te.ref:null,Oe=F.useMemo(function(){return Object(g.a)(ae,we)},[ae,we]),Ie=F.useRef(me);Ie.current=me;var Ce=F.useCallback(function(Le){var Me=Ie.current,We=Me.onResize,He=Me.data,Ue=Le.getBoundingClientRect(),Fe=Ue.width,nt=Ue.height,at=Le.offsetWidth,qe=Le.offsetHeight,Je=Math.floor(Fe),ot=Math.floor(nt);if(te.current.width!==Je||te.current.height!==ot||te.current.offsetWidth!==at||te.current.offsetHeight!==qe){var Xe={width:Je,height:ot,offsetWidth:at,offsetHeight:qe};te.current=Xe;var Qe=at===Math.round(Fe)?Fe:at,De=qe===Math.round(nt)?nt:qe,ut=Object(K.a)(Object(K.a)({},Xe),{},{offsetWidth:Qe,offsetHeight:De});le==null||le(ut,Le,He),We&&Promise.resolve().then(function(){We(ut,Le)})}},[]);return F.useEffect(function(){var Le=Object(p.a)(we.current)||Object(p.a)(fe.current);return Le&&!Se&&l(Le,Ce),function(){return c(Le,Ce)}},[we.current,Se]),F.createElement(O,{ref:fe},he?F.cloneElement(Te,{ref:Oe}):Te)}var A="rc-observer-key";function w(me){var Te=me.children,Se=Object(M.a)(Te);return Se.map(function(we,fe){var le=(we==null?void 0:we.key)||"".concat(A,"-").concat(fe);return F.createElement(R,Object(ue.a)({},me,{key:le}),we)})}w.Collection=T;var x=w,_=oe("bT9E"),u=oe("TSYQ"),b=oe.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 `,E=["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"],N={},D;function j(me){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Se=me.getAttribute("id")||me.getAttribute("data-reactid")||me.getAttribute("name");if(Te&&N[Se])return N[Se];var we=window.getComputedStyle(me),fe=we.getPropertyValue("box-sizing")||we.getPropertyValue("-moz-box-sizing")||we.getPropertyValue("-webkit-box-sizing"),le=parseFloat(we.getPropertyValue("padding-bottom"))+parseFloat(we.getPropertyValue("padding-top")),te=parseFloat(we.getPropertyValue("border-bottom-width"))+parseFloat(we.getPropertyValue("border-top-width")),he=E.map(function(Oe){return"".concat(Oe,":").concat(we.getPropertyValue(Oe))}).join(";"),ae={sizingStyle:he,paddingSize:le,borderSize:te,boxSizing:fe};return Te&&Se&&(N[Se]=ae),ae}function H(me){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,we=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;D||(D=document.createElement("textarea"),D.setAttribute("tab-index","-1"),D.setAttribute("aria-hidden","true"),document.body.appendChild(D)),me.getAttribute("wrap")?D.setAttribute("wrap",me.getAttribute("wrap")):D.removeAttribute("wrap");var fe=j(me,Te),le=fe.paddingSize,te=fe.borderSize,he=fe.boxSizing,ae=fe.sizingStyle;D.setAttribute("style","".concat(ae,";").concat(m)),D.value=me.value||me.placeholder||"";var Oe=Number.MIN_SAFE_INTEGER,Ie=Number.MAX_SAFE_INTEGER,Ce=D.scrollHeight,Le;if(he==="border-box"?Ce+=te:he==="content-box"&&(Ce-=le),Se!==null||we!==null){D.value=" ";var Me=D.scrollHeight-le;Se!==null&&(Oe=Me*Se,he==="border-box"&&(Oe=Oe+le+te),Ce=Math.max(Oe,Ce)),we!==null&&(Ie=Me*we,he==="border-box"&&(Ie=Ie+le+te),Le=Ce>Ie?"":"hidden",Ce=Math.min(Ie,Ce))}return{height:Ce,minHeight:Oe,maxHeight:Ie,overflowY:Le,resize:"none"}}var I=oe("Gytx"),y=oe.n(I),W;(function(me){me[me.NONE=0]="NONE",me[me.RESIZING=1]="RESIZING",me[me.RESIZED=2]="RESIZED"})(W||(W={}));var Y=function(me){Object(Q.a)(Se,me);var Te=Object(B.a)(Se);function Se(we){var fe;return Object(Z.a)(this,Se),fe=Te.call(this,we),fe.nextFrameActionId=void 0,fe.resizeFrameId=void 0,fe.textArea=void 0,fe.saveTextArea=function(le){fe.textArea=le},fe.handleResize=function(le){var te=fe.state.resizeStatus,he=fe.props,ae=he.autoSize,Oe=he.onResize;if(te!==W.NONE)return;typeof Oe=="function"&&Oe(le),ae&&fe.resizeOnNextFrame()},fe.resizeOnNextFrame=function(){cancelAnimationFrame(fe.nextFrameActionId),fe.nextFrameActionId=requestAnimationFrame(fe.resizeTextarea)},fe.resizeTextarea=function(){var le=fe.props.autoSize;if(!le||!fe.textArea)return;var te=le.minRows,he=le.maxRows,ae=H(fe.textArea,!1,te,he);fe.setState({textareaStyles:ae,resizeStatus:W.RESIZING},function(){cancelAnimationFrame(fe.resizeFrameId),fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:W.RESIZED},function(){fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:W.NONE}),fe.fixFirefoxAutoScroll()})})})})},fe.renderTextArea=function(){var le=fe.props,te=le.prefixCls,he=te===void 0?"rc-textarea":te,ae=le.autoSize,Oe=le.onResize,Ie=le.className,Ce=le.disabled,Le=fe.state,Me=Le.textareaStyles,We=Le.resizeStatus,He=Object(_.a)(fe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=b()(he,Ie,Object(G.a)({},"".concat(he,"-disabled"),Ce));"value"in He&&(He.value=He.value||"");var Fe=Object(K.a)(Object(K.a)(Object(K.a)({},fe.props.style),Me),We===W.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return F.createElement(x,{onResize:fe.handleResize,disabled:!(ae||Oe)},F.createElement("textarea",Object(ue.a)({},He,{className:Ue,style:Fe,ref:fe.saveTextArea})))},fe.state={textareaStyles:{},resizeStatus:W.NONE},fe}return Object(P.a)(Se,[{key:"componentDidUpdate",value:function(fe){(fe.value!==this.props.value||!y()(fe.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 fe=this.textArea.selectionStart,le=this.textArea.selectionEnd;this.textArea.setSelectionRange(fe,le)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Se}(F.Component),ie=Y,se=function(me){Object(Q.a)(Se,me);var Te=Object(B.a)(Se);function Se(we){var fe;Object(Z.a)(this,Se),fe=Te.call(this,we),fe.resizableTextArea=void 0,fe.focus=function(){fe.resizableTextArea.textArea.focus()},fe.saveTextArea=function(te){fe.resizableTextArea=te},fe.handleChange=function(te){var he=fe.props.onChange;fe.setValue(te.target.value,function(){fe.resizableTextArea.resizeTextarea()}),he&&he(te)},fe.handleKeyDown=function(te){var he=fe.props,ae=he.onPressEnter,Oe=he.onKeyDown;te.keyCode===13&&ae&&ae(te),Oe&&Oe(te)};var le=typeof we.value=="undefined"||we.value===null?we.defaultValue:we.value;return fe.state={value:le},fe}return Object(P.a)(Se,[{key:"setValue",value:function(fe,le){"value"in this.props||this.setState({value:fe},le)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return F.createElement(ie,Object(ue.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(fe){return"value"in fe?{value:fe.value}:null}}]),Se}(F.Component),xe=rt.default=se},YiJy:function(vt,rt,oe){vt.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(vt,rt,oe){"use strict";oe.d(rt,"a",function(){return H});var ue=oe("k1fw"),Z=oe("miYZ"),P=oe("tsqr"),Q=oe("rAM+"),B=oe("tJVT"),F=oe("PpiC"),K=oe("q1tI"),G=oe.n(K),M=oe("bdgK"),L=oe("oBTY"),g=oe("9og8"),p=oe("WmNS"),f=oe.n(p),h={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"]},d={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 ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].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=oe("5VLF"),l=oe.n(a),c={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(y,W){return W.map(function(Y){return{label:Y,kind:y.languages.CompletionItemKind.Keyword,insertText:Y}})},S=function(y){return Object.keys(c.tables).map(function(W){return{label:W,kind:y.languages.CompletionItemKind.Variable,insertText:W}})},T=function(y,W){var Y=c.tables[y];return Y?Y.map(function(ie){return{label:ie,kind:W.languages.CompletionItemKind.Field,insertText:ie}}):[]};function R(I,y,W,Y,ie){var se=y.getWordUntilPosition(W),xe={startLineNumber:W.lineNumber,endLineNumber:W.lineNumber,startColumn:se.startColumn,endColumn:se.endColumn},me=Y.map(function(Te){return{label:Te,kind:I.languages.CompletionItemKind.Keyword,insertText:Te,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:xe}});return ie.map(function(Te){me.push(Object(ue.a)(Object(ue.a)({},Te),{},{range:xe}))}),me}var A=function(I){c.languages.map(function(ie){return I.languages.registerDocumentFormattingEditProvider(ie,{provideDocumentFormattingEdits:function(xe,me,Te){return Object(g.a)(f.a.mark(function Se(){var we;return f.a.wrap(function(le){for(;;)switch(le.prev=le.next){case 0:return we=l()(xe.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}),le.abrupt("return",[{range:xe.getFullModelRange(),text:we}]);case 2:case"end":return le.stop()}},Se)}))()}}),ie});var y=d.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),W=s.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),Y=o.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}});I.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(L.a)(d.keywords),Object(L.a)(d.quickKey.map(function(ie){return ie.label}))),provideCompletionItems:function(se,xe){var me=se.getValueInRange({startLineNumber:xe.lineNumber,startColumn:1,endLineNumber:xe.lineNumber,endColumn:xe.column}),Te=me.match(/cu/gim);console.log("match:",Te,xe,me,se);var Se=[],we=xe.lineNumber,fe=xe.column,le=se.getValueInRange({startLineNumber:we,startColumn:0,endLineNumber:we,endColumn:fe}),te=le.trim().split(/\s+/),he=te[te.length-1];if(he.endsWith(".")){var ae=he.slice(0,he.length-1);Object.keys(c.tables).includes(ae)&&(Se=Object(L.a)(T(ae,I)))}else he==="."?Se=[]:Se=[].concat(Object(L.a)(S(I)),Object(L.a)(O(I,d.keywords)),Object(L.a)(y));return{suggestions:Se}}}),I.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(L.a)(h.keywords)),provideCompletionItems:function(se,xe){var me=se.getValueInRange({startLineNumber:xe.lineNumber,startColumn:1,endLineNumber:xe.lineNumber,endColumn:xe.column}),Te=me.match(/cu/gim);console.log("match:",Te,xe,me,se);var Se=[],we=xe.lineNumber,fe=xe.column,le=se.getValueInRange({startLineNumber:we,startColumn:0,endLineNumber:we,endColumn:fe}),te=le.trim().split(/\s+/),he=te[te.length-1];if(he.endsWith(".")){var ae=he.slice(0,he.length-1);Object.keys(c.tables).includes(ae)&&(Se=Object(L.a)(T(ae,I)))}else he==="."?Se=[]:Se=[].concat(Object(L.a)(S(I)),Object(L.a)(O(I,h.keywords)));return{suggestions:Se}}}),I.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(L.a)(o.keywords)),provideCompletionItems:function(se,xe){var me=[],Te=xe.lineNumber,Se=xe.column,we=se.getValueInRange({startLineNumber:Te,startColumn:0,endLineNumber:Te,endColumn:Se}),fe=we.trim().split(/\s+/),le=fe[fe.length-1];if(le.endsWith(".")){var te=le.slice(0,le.length-1);Object.keys(c.tables).includes(te)&&(me=Object(L.a)(T(te,I)))}else le==="."?me=[]:me=[].concat(Object(L.a)(S(I)),Object(L.a)(O(I,o.keywords)),Object(L.a)(Y));return{suggestions:me}}}),I.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(L.a)(s.keywords)),provideCompletionItems:function(se,xe){var me=[],Te=xe.lineNumber,Se=xe.column,we=se.getValueInRange({startLineNumber:Te,startColumn:0,endLineNumber:Te,endColumn:Se}),fe=we.trim().split(/\s+/),le=fe[fe.length-1];if(le.endsWith(".")){var te=le.slice(0,le.length-1);Object.keys(c.tables).includes(te)&&(me=Object(L.a)(T(te,I)))}else le==="."?me=[]:me=[].concat(Object(L.a)(S(I)),Object(L.a)(O(I,s.keywords)),Object(L.a)(W));return{suggestions:me}}})},w="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",x=oe("LvDl"),_=oe("+ua5");function u(I){return/^\d+$/.test(I)?"".concat(I,"px"):I}function b(){}var m=!1,E={"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 N(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],y=I;if(Array.isArray(I)){for(var W=0;W0||qt.target.offsetWidth>0)&&ke.current.instance.layout()}}catch(qi){Ot.e(qi)}finally{Ot.f()}}),$e.observe(et.current)),$e}function be(){P.b.warn(decodeURIComponent(w))}var Pe=function(){var wt=ke.current.instance;if(se!=null&&wt&&ne){var Ot=wt.getModel();Ot&&se!==Ot.getValue()&&(m=!0,Ot.setValue(se),wt.layout(),m=!1)}};Object(K.useEffect)(function(){Ge.current&&clearTimeout(Ge.current),Ge.current=setTimeout(function(){Pe()},500)},[se,ne,ke.current]),Object(K.useEffect)(function(){if(Xe&&ke.current&&ke.current.instance){var $e=ke.current.instance;$e.changeViewZones(function(Ot){var Lt=document.createElement("div");Lt.style.padding="10px 20px",Lt.style.width="calc(100% - 20px)",Lt.className="my-error-line-wrp",Lt.innerHTML=De,Ot.addZone({afterLineNumber:Xe||11,heightInLines:3,domNode:Lt})});var wt={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}};$e.addOverlayWidget(wt),$e.revealPositionInCenter({lineNumber:20,column:1})}},[Xe,ke.current,ne]);function je(){var $e=ke.current.instance;if($e){var wt=$e.getSelection(),Ot=ke.current.pastePos||{},Lt=new D.Range(Ot.startLineNumber||wt.endLineNumber,Ot.startColumn||wt.endColumn,Ot.endLineNumber||wt.endLineNumber,Ot.endColumn||wt.endColumn);setTimeout(function(){$e.executeEdits("",[{range:Lt,text:""}])},300)}}function st($e){(window.navigator.platform.match("Mac")?$e.metaKey:$e.ctrlKey)&&$e.keyCode==83&&($e.preventDefault(),Ie())}var ct=function(){if(Le&&ke.current.instance){var wt=ke.current.instance.getContentHeight();Ti(wt0||Fe.target.offsetWidth>0)&&Le.layout()}}catch(nt){He.e(nt)}finally{He.f()}}),Me.observe(we.current)),Me}Object(K.useEffect)(function(){we.current&&oe.e(27).then(oe.t.bind(null,"M/lh",7)).then(function(Le){D=Le;var Me=D.editor.createDiffEditor(we.current,Object(ue.a)(Object(ue.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},Se),{},{wordWrap:!0}));he(Me);var We=ae(Me);return function(){Me.dispose();var He=Me.getModel();He&&He.dispose(),We.unobserve(we.current)}})},[]),Object(K.useEffect)(function(){te&&te.setModel({original:D.editor.createModel(se,me),modified:D.editor.createModel(xe,me)})},[se,xe,me,te]);var Oe=u(W),Ie=u(ie),Ce={width:Oe,height:Ie};return G.a.createElement("div",{className:"my-diff-editor",ref:we,style:Ce})}},ZpRC:function(vt,rt,oe){"use strict";function ue(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function Z(g,p){return(!p||g!=="hidden")&&g!=="visible"&&g!=="clip"}function P(g,p){if(g.clientHeightp||d>g&&s=p&&a>=f?d-g-h:s>p&&af?s-p+o:0}var B=function(g,p){var f=window,h=p.scrollMode,o=p.block,d=p.inline,s=p.boundary,a=p.skipOverflowHiddenElements,l=typeof s=="function"?s:function(Me){return Me!==s};if(!ue(g))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,O=[],S=g;ue(S)&&l(S);){if((S=S.parentElement)===c){O.push(S);break}S!=null&&S===document.body&&P(S)&&!P(document.documentElement)||S!=null&&P(S,a)&&O.push(S)}for(var T=f.visualViewport?f.visualViewport.width:innerWidth,R=f.visualViewport?f.visualViewport.height:innerHeight,A=window.scrollX||pageXOffset,w=window.scrollY||pageYOffset,x=g.getBoundingClientRect(),_=x.height,u=x.width,b=x.top,m=x.right,E=x.bottom,N=x.left,D=o==="start"||o==="nearest"?b:o==="end"?E:b+_/2,j=d==="center"?N+u/2:d==="end"?m:N,H=[],I=0;I=0&&N>=0&&E<=R&&m<=T&&b>=se&&E<=me&&N>=Te&&m<=xe)return H;var Se=getComputedStyle(y),we=parseInt(Se.borderLeftWidth,10),fe=parseInt(Se.borderTopWidth,10),le=parseInt(Se.borderRightWidth,10),te=parseInt(Se.borderBottomWidth,10),he=0,ae=0,Oe="offsetWidth"in y?y.offsetWidth-y.clientWidth-we-le:0,Ie="offsetHeight"in y?y.offsetHeight-y.clientHeight-fe-te:0;if(c===y)he=o==="start"?D:o==="end"?D-R:o==="nearest"?Q(w,w+R,R,fe,te,w+D,w+D+_,_):D-R/2,ae=d==="start"?j:d==="center"?j-T/2:d==="end"?j-T:Q(A,A+T,T,we,le,A+j,A+j+u,u),he=Math.max(0,he+w),ae=Math.max(0,ae+A);else{he=o==="start"?D-se-fe:o==="end"?D-me+te+Ie:o==="nearest"?Q(se,me,Y,fe,te+Ie,D,D+_,_):D-(se+Y/2)+Ie/2,ae=d==="start"?j-Te-we:d==="center"?j-(Te+ie/2)+Oe/2:d==="end"?j-xe+le+Oe:Q(Te,xe,ie,we,le+Oe,j,j+u,u);var Ce=y.scrollLeft,Le=y.scrollTop;D+=Le-(he=Math.max(0,Math.min(Le+he,y.scrollHeight-Y+Ie))),j+=Ce-(ae=Math.max(0,Math.min(Ce+ae,y.scrollWidth-ie+Oe)))}H.push({el:y,top:he,left:ae})}return H};function F(g){return g===Object(g)&&Object.keys(g).length!==0}function K(g,p){p===void 0&&(p="auto");var f="scrollBehavior"in document.body.style;g.forEach(function(h){var o=h.el,d=h.top,s=h.left;o.scroll&&f?o.scroll({top:d,left:s,behavior:p}):(o.scrollTop=d,o.scrollLeft=s)})}function G(g){return g===!1?{block:"end",inline:"nearest"}:F(g)?g:{block:"start",inline:"nearest"}}function M(g,p){var f=!g.ownerDocument.documentElement.contains(g);if(F(p)&&typeof p.behavior=="function")return p.behavior(f?[]:B(g,p));if(f)return;var h=G(p);return K(B(g,h),h.behavior)}var L=rt.a=M},Zss7:function(vt,rt,oe){var ue;(function(Z){var P=/^\s+/,Q=/\s+$/,B=0,F=Z.round,K=Z.min,G=Z.max,M=Z.random;function L(te,he){if(te=te||"",he=he||{},te instanceof L)return te;if(!(this instanceof L))return new L(te,he);var ae=g(te);this._originalInput=te,this._r=ae.r,this._g=ae.g,this._b=ae.b,this._a=ae.a,this._roundA=F(100*this._a)/100,this._format=he.format||ae.format,this._gradientType=he.gradientType,this._r<1&&(this._r=F(this._r)),this._g<1&&(this._g=F(this._g)),this._b<1&&(this._b=F(this._b)),this._ok=ae.ok,this._tc_id=B++}L.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 te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),he,ae,Oe,Ie,Ce,Le;return he=te.r/255,ae=te.g/255,Oe=te.b/255,he<=.03928?Ie=he/12.92:Ie=Z.pow((he+.055)/1.055,2.4),ae<=.03928?Ce=ae/12.92:Ce=Z.pow((ae+.055)/1.055,2.4),Oe<=.03928?Le=Oe/12.92:Le=Z.pow((Oe+.055)/1.055,2.4),.2126*Ie+.7152*Ce+.0722*Le},setAlpha:function(te){return this._a=H(te),this._roundA=F(100*this._a)/100,this},toHsv:function(){var te=o(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=o(this._r,this._g,this._b),he=F(te.h*360),ae=F(te.s*100),Oe=F(te.v*100);return this._a==1?"hsv("+he+", "+ae+"%, "+Oe+"%)":"hsva("+he+", "+ae+"%, "+Oe+"%, "+this._roundA+")"},toHsl:function(){var te=f(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=f(this._r,this._g,this._b),he=F(te.h*360),ae=F(te.s*100),Oe=F(te.l*100);return this._a==1?"hsl("+he+", "+ae+"%, "+Oe+"%)":"hsla("+he+", "+ae+"%, "+Oe+"%, "+this._roundA+")"},toHex:function(te){return s(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return a(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:F(this._r),g:F(this._g),b:F(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+F(this._r)+", "+F(this._g)+", "+F(this._b)+")":"rgba("+F(this._r)+", "+F(this._g)+", "+F(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:F(I(this._r,255)*100)+"%",g:F(I(this._g,255)*100)+"%",b:F(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+F(I(this._r,255)*100)+"%, "+F(I(this._g,255)*100)+"%, "+F(I(this._b,255)*100)+"%)":"rgba("+F(I(this._r,255)*100)+"%, "+F(I(this._g,255)*100)+"%, "+F(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:D[s(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var he="#"+l(this._r,this._g,this._b,this._a),ae=he,Oe=this._gradientType?"GradientType = 1, ":"";if(te){var Ie=L(te);ae="#"+l(Ie._r,Ie._g,Ie._b,Ie._a)}return"progid:DXImageTransform.Microsoft.gradient("+Oe+"startColorstr="+he+",endColorstr="+ae+")"},toString:function(te){var he=!!te;te=te||this._format;var ae=!1,Oe=this._a<1&&this._a>=0,Ie=!he&&Oe&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Ie?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(ae=this.toRgbString()),te==="prgb"&&(ae=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(ae=this.toHexString()),te==="hex3"&&(ae=this.toHexString(!0)),te==="hex4"&&(ae=this.toHex8String(!0)),te==="hex8"&&(ae=this.toHex8String()),te==="name"&&(ae=this.toName()),te==="hsl"&&(ae=this.toHslString()),te==="hsv"&&(ae=this.toHsvString()),ae||this.toHexString())},clone:function(){return L(this.toString())},_applyModification:function(te,he){var ae=te.apply(null,[this].concat([].slice.call(he)));return this._r=ae._r,this._g=ae._g,this._b=ae._b,this.setAlpha(ae._a),this},lighten:function(){return this._applyModification(T,arguments)},brighten:function(){return this._applyModification(R,arguments)},darken:function(){return this._applyModification(A,arguments)},desaturate:function(){return this._applyModification(c,arguments)},saturate:function(){return this._applyModification(O,arguments)},greyscale:function(){return this._applyModification(S,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(te,he){return te.apply(null,[this].concat([].slice.call(he)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(b,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(u,arguments)}},L.fromRatio=function(te,he){if(typeof te=="object"){var ae={};for(var Oe in te)te.hasOwnProperty(Oe)&&(Oe==="a"?ae[Oe]=te[Oe]:ae[Oe]=xe(te[Oe]));te=ae}return L(te,he)};function g(te){var he={r:0,g:0,b:0},ae=1,Oe=null,Ie=null,Ce=null,Le=!1,Me=!1;return typeof te=="string"&&(te=fe(te)),typeof te=="object"&&(we(te.r)&&we(te.g)&&we(te.b)?(he=p(te.r,te.g,te.b),Le=!0,Me=String(te.r).substr(-1)==="%"?"prgb":"rgb"):we(te.h)&&we(te.s)&&we(te.v)?(Oe=xe(te.s),Ie=xe(te.v),he=d(te.h,Oe,Ie),Le=!0,Me="hsv"):we(te.h)&&we(te.s)&&we(te.l)&&(Oe=xe(te.s),Ce=xe(te.l),he=h(te.h,Oe,Ce),Le=!0,Me="hsl"),te.hasOwnProperty("a")&&(ae=te.a)),ae=H(ae),{ok:Le,format:te.format||Me,r:K(255,G(he.r,0)),g:K(255,G(he.g,0)),b:K(255,G(he.b,0)),a:ae}}function p(te,he,ae){return{r:I(te,255)*255,g:I(he,255)*255,b:I(ae,255)*255}}function f(te,he,ae){te=I(te,255),he=I(he,255),ae=I(ae,255);var Oe=G(te,he,ae),Ie=K(te,he,ae),Ce,Le,Me=(Oe+Ie)/2;if(Oe==Ie)Ce=Le=0;else{var We=Oe-Ie;Le=Me>.5?We/(2-Oe-Ie):We/(Oe+Ie);switch(Oe){case te:Ce=(he-ae)/We+(he1&&(Fe-=1),Fe<1/6?He+(Ue-He)*6*Fe:Fe<1/2?Ue:Fe<2/3?He+(Ue-He)*(2/3-Fe)*6:He}if(he===0)Oe=Ie=Ce=ae;else{var Me=ae<.5?ae*(1+he):ae+he-ae*he,We=2*ae-Me;Oe=Le(We,Me,te+1/3),Ie=Le(We,Me,te),Ce=Le(We,Me,te-1/3)}return{r:Oe*255,g:Ie*255,b:Ce*255}}function o(te,he,ae){te=I(te,255),he=I(he,255),ae=I(ae,255);var Oe=G(te,he,ae),Ie=K(te,he,ae),Ce,Le,Me=Oe,We=Oe-Ie;if(Le=Oe===0?0:We/Oe,Oe==Ie)Ce=0;else{switch(Oe){case te:Ce=(he-ae)/We+(he>1)+720)%360;--he;)Oe.h=(Oe.h+Ie)%360,Ce.push(L(Oe));return Ce}function E(te,he){he=he||6;for(var ae=L(te).toHsv(),Oe=ae.h,Ie=ae.s,Ce=ae.v,Le=[],Me=1/he;he--;)Le.push(L({h:Oe,s:Ie,v:Ce})),Ce=(Ce+Me)%1;return Le}L.mix=function(te,he,ae){ae=ae===0?0:ae||50;var Oe=L(te).toRgb(),Ie=L(he).toRgb(),Ce=ae/100,Le={r:(Ie.r-Oe.r)*Ce+Oe.r,g:(Ie.g-Oe.g)*Ce+Oe.g,b:(Ie.b-Oe.b)*Ce+Oe.b,a:(Ie.a-Oe.a)*Ce+Oe.a};return L(Le)},L.readability=function(te,he){var ae=L(te),Oe=L(he);return(Z.max(ae.getLuminance(),Oe.getLuminance())+.05)/(Z.min(ae.getLuminance(),Oe.getLuminance())+.05)},L.isReadable=function(te,he,ae){var Oe=L.readability(te,he),Ie,Ce;Ce=!1,Ie=le(ae);switch(Ie.level+Ie.size){case"AAsmall":case"AAAlarge":Ce=Oe>=4.5;break;case"AAlarge":Ce=Oe>=3;break;case"AAAsmall":Ce=Oe>=7;break}return Ce},L.mostReadable=function(te,he,ae){var Oe=null,Ie=0,Ce,Le,Me,We;ae=ae||{},Le=ae.includeFallbackColors,Me=ae.level,We=ae.size;for(var He=0;HeIe&&(Ie=Ce,Oe=L(he[He]));return L.isReadable(te,Oe,{level:Me,size:We})||!Le?Oe:(ae.includeFallbackColors=!1,L.mostReadable(te,["#fff","#000"],ae))};var N=L.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"},D=L.hexNames=j(N);function j(te){var he={};for(var ae in te)te.hasOwnProperty(ae)&&(he[te[ae]]=ae);return he}function H(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function I(te,he){Y(te)&&(te="100%");var ae=ie(te);return te=K(he,G(0,parseFloat(te))),ae&&(te=parseInt(te*he,10)/100),Z.abs(te-he)<1e-6?1:te%he/parseFloat(he)}function y(te){return K(1,G(0,te))}function W(te){return parseInt(te,16)}function Y(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function ie(te){return typeof te=="string"&&te.indexOf("%")!=-1}function se(te){return te.length==1?"0"+te:""+te}function xe(te){return te<=1&&(te=te*100+"%"),te}function me(te){return Z.round(parseFloat(te)*255).toString(16)}function Te(te){return W(te)/255}var Se=function(){var te="[-\\+]?\\d+%?",he="[-\\+]?\\d*\\.\\d+%?",ae="(?:"+he+")|(?:"+te+")",Oe="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?",Ie="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?";return{CSS_UNIT:new RegExp(ae),rgb:new RegExp("rgb"+Oe),rgba:new RegExp("rgba"+Ie),hsl:new RegExp("hsl"+Oe),hsla:new RegExp("hsla"+Ie),hsv:new RegExp("hsv"+Oe),hsva:new RegExp("hsva"+Ie),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 we(te){return!!Se.CSS_UNIT.exec(te)}function fe(te){te=te.replace(P,"").replace(Q,"").toLowerCase();var he=!1;if(N[te])te=N[te],he=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ae;return(ae=Se.rgb.exec(te))?{r:ae[1],g:ae[2],b:ae[3]}:(ae=Se.rgba.exec(te))?{r:ae[1],g:ae[2],b:ae[3],a:ae[4]}:(ae=Se.hsl.exec(te))?{h:ae[1],s:ae[2],l:ae[3]}:(ae=Se.hsla.exec(te))?{h:ae[1],s:ae[2],l:ae[3],a:ae[4]}:(ae=Se.hsv.exec(te))?{h:ae[1],s:ae[2],v:ae[3]}:(ae=Se.hsva.exec(te))?{h:ae[1],s:ae[2],v:ae[3],a:ae[4]}:(ae=Se.hex8.exec(te))?{r:W(ae[1]),g:W(ae[2]),b:W(ae[3]),a:Te(ae[4]),format:he?"name":"hex8"}:(ae=Se.hex6.exec(te))?{r:W(ae[1]),g:W(ae[2]),b:W(ae[3]),format:he?"name":"hex"}:(ae=Se.hex4.exec(te))?{r:W(ae[1]+""+ae[1]),g:W(ae[2]+""+ae[2]),b:W(ae[3]+""+ae[3]),a:Te(ae[4]+""+ae[4]),format:he?"name":"hex8"}:(ae=Se.hex3.exec(te))?{r:W(ae[1]+""+ae[1]),g:W(ae[2]+""+ae[2]),b:W(ae[3]+""+ae[3]),format:he?"name":"hex"}:!1}function le(te){var he,ae;return te=te||{level:"AA",size:"small"},he=(te.level||"AA").toUpperCase(),ae=(te.size||"small").toLowerCase(),he!=="AA"&&he!=="AAA"&&(he="AA"),ae!=="small"&&ae!=="large"&&(ae="small"),{level:he,size:ae}}vt.exports?vt.exports=L:!(ue=function(){return L}.call(rt,oe,rt,vt),ue!==void 0&&(vt.exports=ue))})(Math)},bT9E:function(vt,rt,oe){"use strict";oe.d(rt,"a",function(){return Z});var ue=oe("VTBJ");function Z(P,Q){var B=Object(ue.a)({},P);return Array.isArray(Q)&&Q.forEach(function(F){delete B[F]}),B}},c5Ni:function(vt,rt,oe){},dejd:function(vt,rt,oe){},dmUQ:function(vt,rt,oe){"use strict";var ue=oe("Ff2n"),Z=oe("rePB"),P=oe("1OyB"),Q=oe("vuIU"),B=oe("Ji7U"),F=oe("md7G"),K=oe("foSv"),G=oe("q1tI"),M=oe.n(G),L=oe("TSYQ"),g=oe.n(L),p=oe("4IlW");function f(_,u){var b=Object.keys(_);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(_);u&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(_,E).enumerable})),b.push.apply(b,m)}return b}function h(_){for(var u=1;u1?ie-1:0),xe=1;xe1?I-1:0),W=1;W=0)return parseInt(H.slice(H.indexOf("e-")+2),10);var I=0;return H.indexOf(".")>=0&&(I=H.length-H.indexOf(".")-1),I},E.getInputDisplayValue=function(j){var H=j||E.state,I=H.focused,y=H.inputValue,W=H.value,Y;I?Y=y:Y=E.toPrecisionAsStep(W),Y==null&&(Y="");var ie=E.formatWrapper(Y);return T(E.props.decimalSeparator)&&(ie=ie.toString().replace(".",E.props.decimalSeparator)),ie},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(j){}},E.restoreByAfter=function(j){if(j===void 0)return!1;var H=E.input.value,I=H.lastIndexOf(j);if(I===-1)return!1;var y=E.cursorBefore.length;return E.lastKeyCode===p.a.DELETE&&E.cursorBefore.charAt(y-1)===j[0]?(E.fixCaret(y,y),!0):I+j.length===H.length?(E.fixCaret(I,I),!0):!1},E.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(H,I){var y=j.substring(I);return E.restoreByAfter(y)})},E.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(j,H,I){E.pressingUpOrDown=!0,E.step("down",j,H,I)},E.up=function(j,H,I){E.pressingUpOrDown=!0,E.step("up",j,H,I)},E.saveInput=function(j){E.input=j};var N=m.value;N===void 0&&(N=m.defaultValue),E.state={focused:m.autoFocus};var D=E.getValidValue(E.toNumber(N));return E.state=h(h({},E.state),{},{inputValue:E.toPrecisionAsStep(D),value:D}),E}return Object(Q.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var N=this.props,D=N.value,j=N.onChange,H=N.max,I=N.min,y=this.state.focused;if(E){if(!R(E.value,D)||!R(E.max,H)||!R(E.min,I)){var W=y?D:this.getValidValue(D),Y;this.pressingUpOrDown?Y=W:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(W),this.setState({value:W,inputValue:Y})}var ie="value"in this.props?D:this.state.value;"max"in this.props&&E.max!==H&&typeof ie=="number"&&ie>H&&j&&j(H),"min"in this.props&&E.min!==I&&typeof ie=="number"&&ie1&&arguments[1]!==void 0?arguments[1]:this.props.min,D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(E);return isNaN(j)?E:(jD&&(j=D),j)}},{key:"setValue",value:function(E,N){var D=this.props.precision,j=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),H=this.state.value,I=H===void 0?null:H,y=this.state.inputValue,W=y===void 0?null:y,Y=typeof j=="number"?j.toFixed(D):"".concat(j),ie=j!==I||Y!=="".concat(W);return"value"in this.props?(W=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:W},N)):this.setState({value:j,inputValue:this.toPrecisionAsStep(E)},N),ie&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.props,j=D.precision,H=D.step;if(T(j))return j;var I=this.getPrecision(N),y=this.getPrecision(H),W=this.getPrecision(E);return E?Math.max(W,I+y):I+y}},{key:"getPrecisionFactor",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.getMaxPrecision(E,N);return Math.pow(10,D)}},{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(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var N=Math.abs(this.getMaxPrecision(E));return isNaN(N)?E.toString():Number(E).toFixed(N)}},{key:"toNumber",value:function(E){var N=this.props.precision,D=this.state.focused,j=E&&E.length>16&&D;return this.isNotCompleteNumber(E)||j?E:T(N)?Math.round(E*Math.pow(10,N))/Math.pow(10,N):Number(E)}},{key:"upStep",value:function(E,N){var D=this.props.step,j=this.getPrecisionFactor(E,N),H=Math.abs(this.getMaxPrecision(E,N)),I=((j*E+j*D*N)/j).toFixed(H);return this.toNumber(I)}},{key:"downStep",value:function(E,N){var D=this.props.step,j=this.getPrecisionFactor(E,N),H=Math.abs(this.getMaxPrecision(E,N)),I=((j*E-j*D*N)/j).toFixed(H);return this.toNumber(I)}},{key:"step",value:function(E,N){var D=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,H=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var I=this.props;if(I.disabled)return;var y=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(y))return;var W=this["".concat(E,"Step")](y,j),Y=W>I.max||WI.max?W=I.max:W=se),Ge=(ot||ot===0)&&(isNaN(ot)||Number(ot)<=xe),Ee=ke||j||H,pe=Ge||j||H,_e=g()("".concat(D,"-handler"),"".concat(D,"-handler-up"),Object(Z.a)({},"".concat(D,"-handler-up-disabled"),Ee)),re=g()("".concat(D,"-handler"),"".concat(D,"-handler-down"),Object(Z.a)({},"".concat(D,"-handler-down-disabled"),pe)),ne=I?{onTouchStart:Ee?s:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?s:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},de=I?{onTouchStart:pe?s:this.down,onTouchEnd:this.stop}:{onMouseDown:pe?s:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return M.a.createElement("div",{className:Qe,style:me,title:Te,onMouseEnter:Se,onMouseLeave:we,onMouseOver:fe,onMouseOut:le,onFocus:function(){return null},onBlur:function(){return null}},M.a.createElement("div",{className:"".concat(D,"-handler-wrap")},M.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":Ee,className:_e}),W||M.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-up-inner"),onClick:a})),M.a.createElement("span",Object.assign({unselectable:"on"},de,{role:"button","aria-label":"Decrease Value","aria-disabled":pe,className:re}),Y||M.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-down-inner"),onClick:a}))),M.a.createElement("div",{className:"".concat(D,"-input-wrap")},M.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":xe,"aria-valuemax":se,"aria-valuenow":ot,required:te,type:Oe,placeholder:Ie,onPaste:nt,onClick:he,onMouseUp:this.onMouseUp,className:"".concat(D,"-input"),tabIndex:ae,autoComplete:y,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ut?this.onKeyDown:s,onKeyUp:ut?this.onKeyUp:s,autoFocus:Ue,maxLength:He,readOnly:H,disabled:j,max:se,min:xe,step:We,name:Fe,title:Te,id:Ce,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(et),pattern:Me,inputMode:Le,onInput:at},De))))}}]),b}(M.a.Component);A.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:S,min:-S,step:1,style:{},onChange:s,onKeyDown:s,onPressEnter:s,onFocus:s,onBlur:s,parser:l,required:!1,autoComplete:"off"};var w=A,x=rt.a=w},h78n:function(vt,rt,oe){"use strict";oe.d(rt,"a",function(){return E});var ue=oe("q1tI"),Z=oe.n(ue),P=oe("TSYQ"),Q=oe.n(P),B={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},F=function(j){var H=j.map(function(){return Object(ue.useRef)()}),I=Object(ue.useRef)();return Object(ue.useEffect)(function(){var y=Date.now(),W=!1;Object.keys(H).forEach(function(Y){var ie=H[Y].current;if(!ie)return;W=!0;var se=ie.style;se.transitionDuration=".3s, .3s, .3s, .06s",I.current&&y-I.current<100&&(se.transitionDuration="0s, 0s")}),W&&(I.current=Date.now())}),[H]};function K(){return K=Object.assign||function(D){for(var j=1;jD.length)&&(j=D.length);for(var H=0,I=new Array(j);H=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,I))continue;H[I]=D[I]}}return H}function o(D,j){if(D==null)return{};var H={},I=Object.keys(D),y,W;for(W=0;W=0)continue;H[y]=D[y]}return H}var d=function(j){var H=j.className,I=j.percent,y=j.prefixCls,W=j.strokeColor,Y=j.strokeLinecap,ie=j.strokeWidth,se=j.style,xe=j.trailColor,me=j.trailWidth,Te=j.transition,Se=h(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Se.gapPosition;var we=Array.isArray(I)?I:[I],fe=Array.isArray(W)?W:[W],le=F(we),te=G(le,1),he=te[0],ae=ie/2,Oe=100-ie/2,Ie="M ".concat(Y==="round"?ae:0,",").concat(ae,` L `).concat(Y==="round"?Oe:100,",").concat(ae),Ce="0 0 100 ".concat(ie),Le=0;return Z.a.createElement("svg",K({className:Q()("".concat(y,"-line"),H),viewBox:Ce,preserveAspectRatio:"none",style:se},Se),Z.a.createElement("path",{className:"".concat(y,"-line-trail"),d:Ie,strokeLinecap:Y,stroke:xe,strokeWidth:me||ie,fillOpacity:"0"}),we.map(function(Me,We){var He={strokeDasharray:"".concat(Me,"px, 100px"),strokeDashoffset:"-".concat(Le,"px"),transition:Te||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ue=fe[We]||fe[fe.length-1];return Le+=Me,Z.a.createElement("path",{key:We,className:"".concat(y,"-line-path"),d:Ie,strokeLinecap:Y,stroke:Ue,strokeWidth:ie,fillOpacity:"0",ref:he[We],style:He})}))};d.defaultProps=B;var s=d;function a(){return a=Object.assign||function(D){for(var j=1;jD.length)&&(j=D.length);for(var H=0,I=new Array(j);H=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,I))continue;H[I]=D[I]}}return H}function w(D,j){if(D==null)return{};var H={},I=Object.keys(D),y,W;for(W=0;W=0)continue;H[y]=D[y]}return H}var x=0;function _(D){return+D.replace("%","")}function u(D){return Array.isArray(D)?D:[D]}function b(D,j,H,I){var y=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,W=arguments.length>5?arguments[5]:void 0,Y=50-I/2,ie=0,se=-Y,xe=0,me=-2*Y;switch(W){case"left":ie=-Y,se=0,xe=2*Y,me=0;break;case"right":ie=Y,se=0,xe=-2*Y,me=0;break;case"bottom":se=Y,me=2*Y;break;default:}var Te="M 50,50 m ".concat(ie,",").concat(se,` a `).concat(Y,",").concat(Y," 0 1 1 ").concat(xe,",").concat(-me,` a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-xe,",").concat(me),Se=Math.PI*2*Y,we={stroke:H,strokeDasharray:"".concat(j/100*(Se-y),"px ").concat(Se,"px"),strokeDashoffset:"-".concat(y/2+D/100*(Se-y),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Te,pathStyle:we}}var m=function(j){var H=j.prefixCls,I=j.strokeWidth,y=j.trailWidth,W=j.gapDegree,Y=j.gapPosition,ie=j.trailColor,se=j.strokeLinecap,xe=j.style,me=j.className,Te=j.strokeColor,Se=j.percent,we=A(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),fe=Object(ue.useMemo)(function(){return x+=1,x},[]),le=b(0,100,ie,I,W,Y),te=le.pathString,he=le.pathStyle,ae=u(Se),Oe=u(Te),Ie=Oe.find(function(He){return Object.prototype.toString.call(He)==="[object Object]"}),Ce=F(ae),Le=l(Ce,1),Me=Le[0],We=function(){var Ue=0;return ae.map(function(Fe,nt){var at=Oe[nt]||Oe[Oe.length-1],qe=Object.prototype.toString.call(at)==="[object Object]"?"url(#".concat(H,"-gradient-").concat(fe,")"):"",Je=b(Ue,Fe,at,I,W,Y);return Ue+=Fe,Z.a.createElement("path",{key:nt,className:"".concat(H,"-circle-path"),d:Je.pathString,stroke:qe,strokeLinecap:se,strokeWidth:I,opacity:Fe===0?0:1,fillOpacity:"0",style:Je.pathStyle,ref:Me[nt]})})};return Z.a.createElement("svg",a({className:Q()("".concat(H,"-circle"),me),viewBox:"0 0 100 100",style:xe},we),Ie&&Z.a.createElement("defs",null,Z.a.createElement("linearGradient",{id:"".concat(H,"-gradient-").concat(fe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ie).sort(function(He,Ue){return _(He)-_(Ue)}).map(function(He,Ue){return Z.a.createElement("stop",{key:Ue,offset:He,stopColor:Ie[He]})}))),Z.a.createElement("path",{className:"".concat(H,"-circle-trail"),d:te,stroke:ie,strokeLinecap:se,strokeWidth:y||I,fillOpacity:"0",style:he}),We().reverse())};m.defaultProps=B;var E=m,N={Line:s,Circle:E}},kSUc:function(vt,rt,oe){},lZu9:function(vt,rt,oe){(function(ue){ue(oe("VrN/"),oe("1eCo"),oe("8EBN"))})(function(ue){"use strict";ue.defineMode("markdown",function(Z,P){var Q=ue.getMode(Z,"text/html"),B=Q.name=="null";function F(I){if(ue.findModeByName){var y=ue.findModeByName(I);y&&(I=y.mime||y.mimes[0])}var W=ue.getMode(Z,I);return W.name=="null"?null:W}P.highlightFormatting===void 0&&(P.highlightFormatting=!1),P.maxBlockquoteDepth===void 0&&(P.maxBlockquoteDepth=0),P.taskLists===void 0&&(P.taskLists=!1),P.strikethrough===void 0&&(P.strikethrough=!1),P.emoji===void 0&&(P.emoji=!1),P.fencedCodeBlockHighlighting===void 0&&(P.fencedCodeBlockHighlighting=!0),P.fencedCodeBlockDefaultMode===void 0&&(P.fencedCodeBlockDefaultMode="text/plain"),P.xml===void 0&&(P.xml=!0),P.tokenTypeOverrides===void 0&&(P.tokenTypeOverrides={});var K={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 G in K)K.hasOwnProperty(G)&&P.tokenTypeOverrides[G]&&(K[G]=P.tokenTypeOverrides[G]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,p=P.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,h=/^[^#!\[\]*_\\<>` "'(~:]+/,o=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,d=/^\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(I,y,W){return y.f=y.inline=W,W(I,y)}function c(I,y,W){return y.f=y.block=W,W(I,y)}function O(I){return!I||!/\S/.test(I.string)}function S(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==R){var y=B;if(!y){var W=ue.innerMode(Q,I.htmlState);y=W.mode.name=="xml"&&W.state.tagStart===null&&!W.state.context&&W.state.tokenize.isInText}y&&(I.f=_,I.block=T,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function T(I,y){var W=I.column()===y.indentation,Y=O(y.prevLine.stream),ie=y.indentedCode,se=y.prevLine.hr,xe=y.list!==!1,me=(y.listStack[y.listStack.length-1]||0)+3;y.indentedCode=!1;var Te=y.indentation;if(y.indentationDiff===null&&(y.indentationDiff=y.indentation,xe)){for(y.list=null;Te=4&&(ie||y.prevLine.fencedCodeEnd||y.prevLine.header||Y))return I.skipToEnd(),y.indentedCode=!0,K.code;if(I.eatSpace())return null;if(W&&y.indentation<=me&&(fe=I.match(p))&&fe[1].length<=6)return y.quote=0,y.header=fe[1].length,y.thisLine.header=!0,P.highlightFormatting&&(y.formatting="header"),y.f=y.inline,w(y);if(y.indentation<=me&&I.eat(">"))return y.quote=W?1:y.quote+1,P.highlightFormatting&&(y.formatting="quote"),I.eatSpace(),w(y);if(!we&&!y.setext&&W&&y.indentation<=me&&(fe=I.match(L))){var le=fe[1]?"ol":"ul";return y.indentation=Te+I.current().length,y.list=!0,y.quote=0,y.listStack.push(y.indentation),y.em=!1,y.strong=!1,y.code=!1,y.strikethrough=!1,P.taskLists&&I.match(g,!1)&&(y.taskList=!0),y.f=y.inline,P.highlightFormatting&&(y.formatting=["list","list-"+le]),w(y)}else{if(W&&y.indentation<=me&&(fe=I.match(o,!0)))return y.quote=0,y.fencedEndRE=new RegExp(fe[1]+"+ *$"),y.localMode=P.fencedCodeBlockHighlighting&&F(fe[2]||P.fencedCodeBlockDefaultMode),y.localMode&&(y.localState=ue.startState(y.localMode)),y.f=y.block=A,P.highlightFormatting&&(y.formatting="code-block"),y.code=-1,w(y);if(y.setext||(!Se||!xe)&&!y.quote&&y.list===!1&&!y.code&&!we&&!d.test(I.string)&&(fe=I.lookAhead(1))&&(fe=fe.match(f)))return y.setext?(y.header=y.setext,y.setext=0,I.skipToEnd(),P.highlightFormatting&&(y.formatting="header")):(y.header=fe[0].charAt(0)=="="?1:2,y.setext=y.header),y.thisLine.header=!0,y.f=y.inline,w(y);if(we)return I.skipToEnd(),y.hr=!0,y.thisLine.hr=!0,K.hr;if(I.peek()==="[")return l(I,y,N)}return l(I,y,y.inline)}function R(I,y){var W=Q.token(I,y.htmlState);if(!B){var Y=ue.innerMode(Q,y.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||y.md_inside&&I.current().indexOf(">")>-1)&&(y.f=_,y.block=T,y.htmlState=null)}return W}function A(I,y){var W=y.listStack[y.listStack.length-1]||0,Y=y.indentation=I.quote?y.push(K.formatting+"-"+I.formatting[W]+"-"+I.quote):y.push("error"))}if(I.taskOpen)return y.push("meta"),y.length?y.join(" "):null;if(I.taskClosed)return y.push("property"),y.length?y.join(" "):null;if(I.linkHref?y.push(K.linkHref,"url"):(I.strong&&y.push(K.strong),I.em&&y.push(K.em),I.strikethrough&&y.push(K.strikethrough),I.emoji&&y.push(K.emoji),I.linkText&&y.push(K.linkText),I.code&&y.push(K.code),I.image&&y.push(K.image),I.imageAltText&&y.push(K.imageAltText,"link"),I.imageMarker&&y.push(K.imageMarker)),I.header&&y.push(K.header,K.header+"-"+I.header),I.quote&&(y.push(K.quote),!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=I.quote?y.push(K.quote+"-"+I.quote):y.push(K.quote+"-"+P.maxBlockquoteDepth)),I.list!==!1){var Y=(I.listStack.length-1)%3;Y?Y===1?y.push(K.list2):y.push(K.list3):y.push(K.list1)}return I.trailingSpaceNewLine?y.push("trailing-space-new-line"):I.trailingSpace&&y.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),y.length?y.join(" "):null}function x(I,y){return I.match(h,!0)?w(y):void 0}function _(I,y){var W=y.text(I,y);if(typeof W!="undefined")return W;if(y.list)return y.list=null,w(y);if(y.taskList){var Y=I.match(g,!0)[1]===" ";return Y?y.taskOpen=!0:y.taskClosed=!0,P.highlightFormatting&&(y.formatting="task"),y.taskList=!1,w(y)}if(y.taskOpen=!1,y.taskClosed=!1,y.header&&I.match(/^#+$/,!0))return P.highlightFormatting&&(y.formatting="header"),w(y);var ie=I.next();if(y.linkTitle){y.linkTitle=!1;var se=ie;ie==="("&&(se=")"),se=(se+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var xe="^\\s*(?:[^"+se+"\\\\]+|\\\\\\\\|\\\\.)"+se;if(I.match(new RegExp(xe),!0))return K.linkHref}if(ie==="`"){var me=y.formatting;P.highlightFormatting&&(y.formatting="code"),I.eatWhile("`");var Te=I.current().length;if(y.code==0&&(!y.quote||Te==1))return y.code=Te,w(y);if(Te==y.code){var Se=w(y);return y.code=0,Se}else return y.formatting=me,w(y)}else if(y.code)return w(y);if(ie==="\\"&&(I.next(),P.highlightFormatting)){var we=w(y),fe=K.formatting+"-escape";return we?we+" "+fe:fe}if(ie==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return y.imageMarker=!0,y.image=!0,P.highlightFormatting&&(y.formatting="image"),w(y);if(ie==="["&&y.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return y.imageMarker=!1,y.imageAltText=!0,P.highlightFormatting&&(y.formatting="image"),w(y);if(ie==="]"&&y.imageAltText){P.highlightFormatting&&(y.formatting="image");var we=w(y);return y.imageAltText=!1,y.image=!1,y.inline=y.f=b,we}if(ie==="["&&!y.image)return y.linkText&&I.match(/^.*?\]/)||(y.linkText=!0,P.highlightFormatting&&(y.formatting="link")),w(y);if(ie==="]"&&y.linkText){P.highlightFormatting&&(y.formatting="link");var we=w(y);return y.linkText=!1,y.inline=y.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?b:_,we}if(ie==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=u,P.highlightFormatting&&(y.formatting="link");var we=w(y);return we?we+=" ":we="",we+K.linkInline}if(ie==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=u,P.highlightFormatting&&(y.formatting="link");var we=w(y);return we?we+=" ":we="",we+K.linkEmail}if(P.xml&&ie==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var le=I.string.indexOf(">",I.pos);if(le!=-1){var te=I.string.substring(I.start,le);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(y.md_inside=!0)}return I.backUp(1),y.htmlState=ue.startState(Q),c(I,y,R)}if(P.xml&&ie==="<"&&I.match(/^\/\w*?>/))return y.md_inside=!1,"tag";if(ie==="*"||ie==="_"){for(var he=1,ae=I.pos==1?" ":I.string.charAt(I.pos-2);he<3&&I.eat(ie);)he++;var Oe=I.peek()||" ",Ie=!/\s/.test(Oe)&&(!s.test(Oe)||/\s/.test(ae)||s.test(ae)),Ce=!/\s/.test(ae)&&(!s.test(ae)||/\s/.test(Oe)||s.test(Oe)),Le=null,Me=null;if(he%2&&(!y.em&&Ie&&(ie==="*"||!Ce||s.test(ae))?Le=!0:y.em==ie&&Ce&&(ie==="*"||!Ie||s.test(Oe))&&(Le=!1)),he>1&&(!y.strong&&Ie&&(ie==="*"||!Ce||s.test(ae))?Me=!0:y.strong==ie&&Ce&&(ie==="*"||!Ie||s.test(Oe))&&(Me=!1)),Me!=null||Le!=null){P.highlightFormatting&&(y.formatting=Le==null?"strong":Me==null?"em":"strong em"),Le===!0&&(y.em=ie),Me===!0&&(y.strong=ie);var Se=w(y);return Le===!1&&(y.em=!1),Me===!1&&(y.strong=!1),Se}}else if(ie===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return w(y);I.backUp(1)}if(P.strikethrough){if(ie==="~"&&I.eatWhile(ie)){if(y.strikethrough){P.highlightFormatting&&(y.formatting="strikethrough");var Se=w(y);return y.strikethrough=!1,Se}else if(I.match(/^[^\s]/,!1))return y.strikethrough=!0,P.highlightFormatting&&(y.formatting="strikethrough"),w(y)}else if(ie===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return w(y);I.backUp(2)}}if(P.emoji&&ie===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){y.emoji=!0,P.highlightFormatting&&(y.formatting="emoji");var We=w(y);return y.emoji=!1,We}return ie===" "&&(I.match(/^ +$/,!1)?y.trailingSpace++:y.trailingSpace&&(y.trailingSpaceNewLine=!0)),w(y)}function u(I,y){var W=I.next();if(W===">"){y.f=y.inline=_,P.highlightFormatting&&(y.formatting="link");var Y=w(y);return Y?Y+=" ":Y="",Y+K.linkInline}return I.match(/^[^>]+/,!0),K.linkInline}function b(I,y){if(I.eatSpace())return null;var W=I.next();return W==="("||W==="["?(y.f=y.inline=E(W==="("?")":"]"),P.highlightFormatting&&(y.formatting="link-string"),y.linkHref=!0,w(y)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(I){return function(y,W){var Y=y.next();if(Y===I){W.f=W.inline=_,P.highlightFormatting&&(W.formatting="link-string");var ie=w(W);return W.linkHref=!1,ie}return y.match(m[I]),W.linkHref=!0,w(W)}}function N(I,y){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(y.f=D,I.next(),P.highlightFormatting&&(y.formatting="link"),y.linkText=!0,w(y)):l(I,y,_)}function D(I,y){if(I.match(/^\]:/,!0)){y.f=y.inline=j,P.highlightFormatting&&(y.formatting="link");var W=w(y);return y.linkText=!1,W}return I.match(/^([^\]\\]|\\.)+/,!0),K.linkText}function j(I,y){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?y.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),y.f=y.inline=_,K.linkHref+" url")}var H={startState:function(){return{f:T,prevLine:{stream:null},thisLine:{stream:null},block:T,htmlState:null,indentation:0,inline:_,text:x,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(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&ue.copyState(Q,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?ue.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,y){if(y.formatting=!1,I!=y.thisLine.stream){if(y.header=0,y.hr=!1,I.match(/^\s*$/,!0))return S(y),null;if(y.prevLine=y.thisLine,y.thisLine={stream:I},y.taskList=!1,y.trailingSpace=0,y.trailingSpaceNewLine=!1,!y.localState&&(y.f=y.block,y.f!=R)){var W=I.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(y.indentation=W,y.indentationDiff=null,W>0)return null}}return y.f(I,y)},innerMode:function(I){return I.block==R?{state:I.htmlState,mode:Q}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:H}},indent:function(I,y,W){return I.block==R&&Q.indent?Q.indent(I.htmlState,y,W):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,y,W):ue.Pass},blankLine:S,getType:w,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return H},"xml"),ue.defineMIME("text/markdown","markdown"),ue.defineMIME("text/x-markdown","markdown")})},osHv:function(vt,rt,oe){(function(ue){ue(oe("VrN/"))})(function(ue){"use strict";var Z=ue.Pos;function P(s,a){return s.line-a.line||s.ch-a.ch}var Q="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",B=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",F=new RegExp("<(/?)(["+Q+"]["+B+"]*)","g");function K(s,a,l,c){this.line=a,this.ch=l,this.cm=s,this.text=s.getLine(a),this.min=c?Math.max(c.from,s.firstLine()):s.firstLine(),this.max=c?Math.min(c.to-1,s.lastLine()):s.lastLine()}function G(s,a){var l=s.cm.getTokenTypeAt(Z(s.line,a));return l&&/\btag\b/.test(l)}function M(s){return s.line>=s.max?void 0:(s.ch=0,s.text=s.cm.getLine(++s.line),!0)}function L(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(M(s))continue;return}if(!G(s,a+1)){s.ch=a+1;continue}var l=s.text.lastIndexOf("/",a),c=l>-1&&!/\S/.test(s.text.slice(l+1,a));return s.ch=a+1,c?"selfClose":"regular"}}function p(s){for(;;){var a=s.ch?s.text.lastIndexOf("<",s.ch-1):-1;if(a==-1){if(L(s))continue;return}if(!G(s,a+1)){s.ch=a;continue}F.lastIndex=a,s.ch=a;var l=F.exec(s.text);if(l&&l.index==a)return l}}function f(s){for(;;){F.lastIndex=s.ch;var a=F.exec(s.text);if(!a){if(M(s))continue;return}if(!G(s,a.index+1)){s.ch=a.index+1;continue}return s.ch=a.index+a[0].length,a}}function h(s){for(;;){var a=s.ch?s.text.lastIndexOf(">",s.ch-1):-1;if(a==-1){if(L(s))continue;return}if(!G(s,a+1)){s.ch=a;continue}var l=s.text.lastIndexOf("/",a),c=l>-1&&!/\S/.test(s.text.slice(l+1,a));return s.ch=a+1,c?"selfClose":"regular"}}function o(s,a){for(var l=[];;){var c=f(s),O,S=s.line,T=s.ch-(c?c[0].length:0);if(!c||!(O=g(s)))return;if(O=="selfClose")continue;if(c[1]){for(var R=l.length-1;R>=0;--R)if(l[R]==c[2]){l.length=R;break}if(R<0&&(!a||a==c[2]))return{tag:c[2],from:Z(S,T),to:Z(s.line,s.ch)}}else l.push(c[2])}}function d(s,a){for(var l=[];;){var c=h(s);if(!c)return;if(c=="selfClose"){p(s);continue}var O=s.line,S=s.ch,T=p(s);if(!T)return;if(T[1])l.push(T[2]);else{for(var R=l.length-1;R>=0;--R)if(l[R]==T[2]){l.length=R;break}if(R<0&&(!a||a==T[2]))return{tag:T[2],from:Z(s.line,s.ch),to:Z(O,S)}}}}ue.registerHelper("fold","xml",function(s,a){for(var l=new K(s,a.line,0);;){var c=f(l);if(!c||l.line!=a.line)return;var O=g(l);if(!O)return;if(!c[1]&&O!="selfClose"){var S=Z(l.line,l.ch),T=o(l,c[2]);return T&&P(T.from,S)>0?{from:S,to:T.from}:null}}}),ue.findMatchingTag=function(s,a,l){var c=new K(s,a.line,a.ch,l);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var O=g(c),S=O&&Z(c.line,c.ch),T=O&&p(c);if(!O||!T||P(c,a)>0)return;var R={from:Z(c.line,c.ch),to:S,tag:T[2]};return O=="selfClose"?{open:R,close:null,at:"open"}:T[1]?{open:d(c,T[2]),close:R,at:"close"}:(c=new K(s,S.line,S.ch,l),{open:R,close:o(c,T[2]),at:"open"})},ue.findEnclosingTag=function(s,a,l,c){for(var O=new K(s,a.line,a.ch,l);;){var S=d(O,c);if(!S)break;var T=new K(s,a.line,a.ch,l),R=o(T,S.tag);if(R)return{open:S,close:R}}},ue.scanForClosingTag=function(s,a,l,c){var O=new K(s,a.line,a.ch,c?{from:0,to:c}:null);return o(O,l)}})},p5ED:function(vt,rt,oe){"use strict";var ue=oe("+L6B"),Z=oe("2/Rp"),P=oe("5Dmo"),Q=oe("3S7+"),B=oe("k1fw"),F=oe("tJVT"),K=oe("q1tI"),G=oe.n(K),M=oe("vHTk"),L=oe.n(M),g=oe("yEEn"),p=oe("ZW9T"),f=oe("1vsH");rt.a=function(h){var o=h.name,d=h.data,s=h.theme,a=h.type,l=h.filename,c=h.monacoEditor,O=h.className,S=h.style,T=h.close,R=h.onClose,A=h.hasMask,w=Object(K.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),x=Object(F.a)(w,2),_=x[0],u=x[1],b=Object(K.useState)(""),m=Object(F.a)(b,2),E=m[0],N=m[1],D,j=1024*1024,H=10*j,I=Object(K.useRef)();a==="office"&&(D=Object(f.T)(d).filesize,D>H&&(a="other")),l&&(c.filename=l),Object(K.useEffect)(function(){var Y,ie,se=(Y=document.cookie)===null||Y===void 0||((ie=Y.replace(/\s/g,""))===null||ie===void 0)?void 0:ie.split(";");se==null||se.map(function(xe){var me=xe.split("=");me[0]==="_educoder_session"&&N(me[1])})},[]);var y=function(){if(d.startsWith("http")||d.startsWith("/")){W();return}Object(f.z)(l||"educoder",d,l)},W=function(){Object(f.x)(l||o,d)};return console.log("data:",d,"fileanme:",l," name:",o),G.a.createElement("div",{style:Object(B.a)({},S||{}),className:"".concat(A&&L.a.bgBlack," ").concat(a?L.a.wrp:"hide")},T&&G.a.createElement("div",{className:L.a.close,ref:I},G.a.createElement(Q.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return I.current}},G.a.createElement("span",{onClick:W},G.a.createElement("i",{className:"icon-quxiaozhiding"}))),G.a.createElement(Q.a,{title:"\u5173\u95ED",getPopupContainer:function(){return I.current}},G.a.createElement("span",{className:"",onClick:R},G.a.createElement("i",{className:"icon-guanbi1"})))),G.a.createElement("div",{className:"".concat(L.a[O]," ").concat(O," ").concat(L.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&G.a.createElement(p.b,c)),a==="audio"&&G.a.createElement("audio",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?d:"data:audio/mp3;base64,").concat(d),autoPlay:!0}),a==="video"&&G.a.createElement(G.a.Fragment,null,d!=null&&d.startsWith("/")?G.a.createElement("video",{controls:!0,src:"".concat(d),autoPlay:!0}):G.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(d),autoPlay:!0})),a==="html"&&G.a.createElement("iframe",{src:d+"&disposition=inline"}),a==="pdf"&&G.a.createElement("embed",{className:L.a.embed,src:d}),a==="image"&&G.a.createElement(G.a.Fragment,null,G.a.createElement("img",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(d)})),a==="other"&&G.a.createElement("div",null,G.a.createElement(Z.a,{type:"primary",size:"large",onClick:y},G.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&G.a.createElement(Z.a,{type:"primary",size:"large",onClick:y},G.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(vt,rt,oe){},psGv:function(vt,rt,oe){var ue,Z;(function(){var P;(function(){"use strict";var K=[,,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 d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(o))return!0;return!1},p.prototype.set_indent=function(o,d){this.is_empty()&&(this.__indent_count=o||0,this.__alignment_count=d||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 d=o.lastIndexOf(` `);d!==-1?this.__character_count=o.length-d: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,d){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)),d=d||"",o.indent_level>0&&(d=new Array(o.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}f.prototype.get_indent_size=function(o,d){var s=this.__base_string_length;return d=d||0,o<0&&(s=0),s+=o*this.__indent_size,s+=d,s},f.prototype.get_indent_string=function(o,d){var s=this.__base_string;return d=d||0,o<0&&(o=0,s=""),d+=o*this.__indent_size,this.__ensure_cache(d),s+=this.__cache[d],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,d=0,s="";this.__indent_size&&o>=this.__indent_size&&(d=Math.floor(o/this.__indent_size),o-=d*this.__indent_size,s=new Array(d+1).join(this.__indent_string)),o&&(s+=new Array(o+1).join(" ")),this.__cache.push(s)};function h(o,d){this.__indent_cache=new f(o,d),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()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(o,d){return this.__indent_cache.get_indent_string(o,d)},h.prototype.get_indent_size=function(o,d){return this.__indent_cache.get_indent_size(o,d)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(o){return this.is_empty()||!o&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(o){this.trim(!0);var d=this.current_line.pop();d&&(d[d.length-1]===` `&&(d=d.replace(/\n+$/g,"")),this.current_line.push(d)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(` `);return o!==` `&&(s=s.replace(/[\n]/g,o)),s},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.prototype.set_indent=function(o,d){return o=o||0,d=d||0,this.next_line.set_indent(o,d),this.__lines.length>1?(this.current_line.set_indent(o,d),!0):(this.current_line.set_indent(),!1)},h.prototype.add_raw_token=function(o){for(var d=0;d1&&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},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(o,d){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)!==d){this.__lines.splice(s+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},g.exports.Output=h},function(g){function p(f,h,o,d){this.type=f,this.text=h,this.comments_before=null,this.newlines=o||0,this.whitespace_before=d||"",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,d){this.raw_options=f(o,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"])}p.prototype._get_array=function(o,d){var s=this.raw_options[o],a=d||[];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,d){var s=this.raw_options[o],a=s===void 0?!!d:!!s;return a},p.prototype._get_characters=function(o,d){var s=this.raw_options[o],a=d||"";return typeof s=="string"&&(a=s.replace(/\\r/,"\r").replace(/\\n/,` `).replace(/\\t/," ")),a},p.prototype._get_number=function(o,d){var s=this.raw_options[o];d=parseInt(d,10),isNaN(d)&&(d=0);var a=parseInt(s,10);return isNaN(a)&&(a=d),a},p.prototype._get_selection=function(o,d,s){var a=this._get_selection_list(o,d,s);if(a.length!==1)throw new Error("Invalid Option Value: The option '"+o+`' can only be one of the following values: `+d+` You passed in: '`+this.raw_options[o]+"'");return a[0]},p.prototype._get_selection_list=function(o,d,s){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[d[0]],!this._is_valid_selection(s,d))throw new Error("Invalid Default Value!");var a=this._get_array(o,s);if(!this._is_valid_selection(a,d))throw new Error("Invalid Option Value: The option '"+o+`' can contain only the following values: `+d+` You passed in: '`+this.raw_options[o]+"'");return a},p.prototype._is_valid_selection=function(o,d){return o.length&&d.length&&!o.some(function(s){return d.indexOf(s)===-1})};function f(o,d){var s={};o=h(o);var a;for(a in o)a!==d&&(s[a]=o[a]);if(d&&o[d])for(a in o[d])s[a]=o[d][a];return s}function h(o){var d={},s;for(s in o){var a=s.replace(/-/g,"_");d[a]=o[s]}return d}g.exports.Options=p,g.exports.normalizeOpts=h,g.exports.mergeOpts=f},,function(g){var p=RegExp.prototype.hasOwnProperty("sticky");function f(h){this.__input=h||"",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=0&&h=0&&o=h.length&&this.__input.substring(o-h.length,o).toLowerCase()===h},g.exports.InputScanner=f},function(g,p,f){var h=f(8).InputScanner,o=f(3).Token,d=f(10).TokenStream,s=f(11).WhitespacePattern,a={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(c,O){this._input=new h(c),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 d,this._reset();for(var c,O=new o(a.START,""),S=null,T=[],R=new d;O.type!==a.EOF;){for(c=this._get_next_token(O,S);this._is_comment(c);)R.add(c),c=this._get_next_token(O,S);R.isEmpty()||(c.comments_before=R,R=new d),c.parent=S,this._is_opening(c)?(T.push(S),S=c):S&&this._is_closing(c,S)&&(c.opened=S,S.closed=c,S=T.pop(),c.parent=S),c.previous=O,O.next=c,this.__tokens.add(c),O=c}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(c,O){this._readWhitespace();var S=this._input.read(/.+/g);return S?this._create_token(a.RAW,S):this._create_token(a.EOF,"")},l.prototype._is_comment=function(c){return!1},l.prototype._is_opening=function(c){return!1},l.prototype._is_closing=function(c,O){return!1},l.prototype._create_token=function(c,O){var S=new o(c,O,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return S},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=0&&f/),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}/)}}d.prototype=new h,d.prototype._create=function(){return new d(this._input,this)},d.prototype._update=function(){this.__set_templated_pattern()},d.prototype.disable=function(s){var a=this._create();return a._disabled[s]=!0,a._update(),a},d.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},d.prototype.exclude=function(s){var a=this._create();return a._excluded[s]=!0,a._update(),a},d.prototype.read=function(){var s="";this._match_pattern?s=this._input.read(this._starting_pattern):s=this._input.read(this._starting_pattern,this.__template_pattern);for(var 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},d.prototype.__set_templated_pattern=function(){var s=[];this._disabled.php||s.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||s.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||s.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(s.push(this.__patterns.django._starting_pattern.source),s.push(this.__patterns.django_value._starting_pattern.source),s.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||s.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&s.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+s.join("|")+")")},d.prototype._read_template=function(){var s="",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=d},,,,function(g,p,f){var h=f(19).Beautifier,o=f(20).Options;function d(s,a,l,c){var O=new h(s,a,l,c);return O.beautify()}g.exports=d,g.exports.defaultOptions=function(){return new o}},function(g,p,f){var h=f(20).Options,o=f(2).Output,d=f(21).Tokenizer,s=f(21).TOKEN,a=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,c=function(b,m){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=b.max_preserve_newlines,this.preserve_newlines=b.preserve_newlines,this._output=new o(b,m)};c.prototype.current_line_has_match=function(b){return this._output.current_line.has_match(b)},c.prototype.set_space_before_token=function(b,m){this._output.space_before_token=b,this._output.non_breaking_space=m},c.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},c.prototype.add_raw_token=function(b){this._output.add_raw_token(b)},c.prototype.print_preserved_newlines=function(b){var m=0;b.type!==s.TEXT&&b.previous.type!==s.TEXT&&(m=b.newlines?1:0),this.preserve_newlines&&(m=b.newlines0);return m!==0},c.prototype.traverse_whitespace=function(b){return b.whitespace_before||b.newlines?(this.print_preserved_newlines(b)||(this._output.space_before_token=!0),!0):!1},c.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},c.prototype.print_newline=function(b){this._output.add_new_line(b)},c.prototype.print_token=function(b){b.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(b.text))},c.prototype.indent=function(){this.indent_level++},c.prototype.get_full_indent=function(b){return b=this.indent_level+(b||0),b<1?"":this._output.get_indent_string(b)};var O=function(b){for(var m=null,E=b.next;E.type!==s.EOF&&b.closed!==E;){if(E.type===s.ATTRIBUTE&&E.text==="type"){E.next&&E.next.type===s.EQUALS&&E.next.next&&E.next.next.type===s.VALUE&&(m=E.next.next.text);break}E=E.next}return m},S=function(b,m){var E=null,N=null;return m.closed?(b==="script"?E="text/javascript":b==="style"&&(E="text/css"),E=O(m)||E,E.search("text/css")>-1?N="css":E.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?N="javascript":E.search(/(text|application|dojo)\/(x-)?(html)/)>-1?N="html":E.search(/test\/null/)>-1&&(N="null"),N):null};function T(b,m){return m.indexOf(b)!==-1}function R(b,m,E){this.parent=b||null,this.tag=m?m.tag_name:"",this.indent_level=E||0,this.parser_token=m||null}function A(b){this._printer=b,this._current_frame=null}A.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},A.prototype.record_tag=function(b){var m=new R(this._current_frame,b,this._printer.indent_level);this._current_frame=m},A.prototype._try_pop_frame=function(b){var m=null;return b&&(m=b.parser_token,this._printer.indent_level=b.indent_level,this._current_frame=b.parent),m},A.prototype._get_frame=function(b,m){for(var E=this._current_frame;E&&!(b.indexOf(E.tag)!==-1);){if(m&&m.indexOf(E.tag)!==-1){E=null;break}E=E.parent}return E},A.prototype.try_pop=function(b,m){var E=this._get_frame([b],m);return this._try_pop_frame(E)},A.prototype.indent_to_tag=function(b){var m=this._get_frame(b);m&&(this._printer.indent_level=m.indent_level)};function w(b,m,E,N){this._source_text=b||"",m=m||{},this._js_beautify=E,this._css_beautify=N,this._tag_stack=null;var D=new h(m,"html");this._options=D,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"}w.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var b=this._source_text,m=this._options.eol;this._options.eol==="auto"&&(m=` `,b&&a.test(b)&&(m=b.match(a)[0])),b=b.replace(l,` `);var E=b.match(/^[\t ]*/)[0],N={text:"",type:""},D=new x,j=new c(this._options,E),H=new d(b,this._options).tokenize();this._tag_stack=new A(j);for(var I=null,y=H.next();y.type!==s.EOF;)y.type===s.TAG_OPEN||y.type===s.COMMENT?(I=this._handle_tag_open(j,y,D,N),D=I):y.type===s.ATTRIBUTE||y.type===s.EQUALS||y.type===s.VALUE||y.type===s.TEXT&&!D.tag_complete?I=this._handle_inside_tag(j,y,D,H):y.type===s.TAG_CLOSE?I=this._handle_tag_close(j,y,D):y.type===s.TEXT?I=this._handle_text(j,y,D):j.add_raw_token(y),N=I,y=H.next();var W=j._output.get_code(m);return W},w.prototype._handle_tag_close=function(b,m,E){var N={text:m.text,type:m.type};return b.alignment_size=0,E.tag_complete=!0,b.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),E.is_unformatted?b.add_raw_token(m):(E.tag_start_char==="<"&&(b.set_space_before_token(m.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&E.has_wrapped_attrs&&b.print_newline(!1)),b.print_token(m)),E.indent_content&&!(E.is_unformatted||E.is_content_unformatted)&&(b.indent(),E.indent_content=!1),!E.is_inline_element&&!(E.is_unformatted||E.is_content_unformatted)&&b.set_wrap_point(),N},w.prototype._handle_inside_tag=function(b,m,E,N){var D=E.has_wrapped_attrs,j={text:m.text,type:m.type};if(b.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),E.is_unformatted)b.add_raw_token(m);else if(E.tag_start_char==="{"&&m.type===s.TEXT)b.print_preserved_newlines(m)?(m.newlines=0,b.add_raw_token(m)):b.print_token(m);else{if(m.type===s.ATTRIBUTE?(b.set_space_before_token(!0),E.attr_count+=1):(m.type===s.EQUALS||m.type===s.VALUE&&m.previous.type===s.EQUALS)&&b.set_space_before_token(!1),m.type===s.ATTRIBUTE&&E.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(b.traverse_whitespace(m),D=D||m.newlines!==0),this._is_wrap_attributes_force)){var H=E.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&E.attr_count===1){var I=!0,y=0,W;do{if(W=N.peek(y),W.type===s.ATTRIBUTE){I=!1;break}y+=1}while(y<4&&W.type!==s.EOF&&W.type!==s.TAG_CLOSE);H=!I}H&&(b.print_newline(!1),D=!0)}b.print_token(m),D=D||b.previous_token_wrapped(),E.has_wrapped_attrs=D}return j},w.prototype._handle_text=function(b,m,E){var N={text:m.text,type:"TK_CONTENT"};return E.custom_beautifier_name?this._print_custom_beatifier_text(b,m,E):E.is_unformatted||E.is_content_unformatted?b.add_raw_token(m):(b.traverse_whitespace(m),b.print_token(m)),N},w.prototype._print_custom_beatifier_text=function(b,m,E){var N=this;if(m.text!==""){var D=m.text,j,H=1,I="",y="";E.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?j=this._js_beautify:E.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?j=this._css_beautify:E.custom_beautifier_name==="html"&&(j=function(me,Te){var Se=new w(me,Te,N._js_beautify,N._css_beautify);return Se.beautify()}),this._options.indent_scripts==="keep"?H=0:this._options.indent_scripts==="separate"&&(H=-b.indent_level);var W=b.get_full_indent(H);if(D=D.replace(/\n[ \t]*$/,""),E.custom_beautifier_name!=="html"&&D[0]==="<"&&D.match(/^(|]]>)$/.exec(D);if(!Y){b.add_raw_token(m);return}I=W+Y[1]+` `,D=Y[4],Y[5]&&(y=W+Y[5]),D=D.replace(/\n[ \t]*$/,""),(Y[2]||Y[3].indexOf(` `)!==-1)&&(Y=Y[3].match(/[ \t]+$/),Y&&(m.whitespace_before=Y[0]))}if(D)if(j){var ie=function(){this.eol=` `};ie.prototype=this._options.raw_options;var se=new ie;D=j(W+D,se)}else{var xe=m.whitespace_before;xe&&(D=D.replace(new RegExp(` (`+xe+")?","g"),` `)),D=W+D.replace(/\n/g,` `+W)}I&&(D?D=I+D+` `+y:D=I+y),b.print_newline(!1),D&&(m.text=D,m.whitespace_before="",m.newlines=0,b.add_raw_token(m),b.print_newline(!0))}},w.prototype._handle_tag_open=function(b,m,E,N){var D=this._get_tag_open_token(m);return(E.is_unformatted||E.is_content_unformatted)&&!E.is_empty_element&&m.type===s.TAG_OPEN&&m.text.indexOf("]*)/),this.tag_check=E?E[1]:""):(E=m.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=E?E[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 N=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(N=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(N)))}};w.prototype._get_tag_open_token=function(b){var m=new x(this._tag_stack.get_parser_token(),b);return m.alignment_size=this._options.wrap_attributes_indent_size,m.is_end_tag=m.is_end_tag||T(m.tag_check,this._options.void_elements),m.is_empty_element=m.tag_complete||m.is_start_tag&&m.is_end_tag,m.is_unformatted=!m.tag_complete&&T(m.tag_check,this._options.unformatted),m.is_content_unformatted=!m.is_empty_element&&T(m.tag_check,this._options.content_unformatted),m.is_inline_element=T(m.tag_name,this._options.inline)||m.tag_name.includes("-")||m.tag_start_char==="{",m},w.prototype._set_tag_position=function(b,m,E,N,D){if(E.is_empty_element||(E.is_end_tag?E.start_tag_token=this._tag_stack.try_pop(E.tag_name):(this._do_optional_end_element(E)&&(E.is_inline_element||b.print_newline(!1)),this._tag_stack.record_tag(E),(E.tag_name==="script"||E.tag_name==="style")&&!(E.is_unformatted||E.is_content_unformatted)&&(E.custom_beautifier_name=S(E.tag_check,m)))),T(E.tag_check,this._options.extra_liners)&&(b.print_newline(!1),b._output.just_added_blankline()||b.print_newline(!0)),E.is_empty_element){if(E.tag_start_char==="{"&&E.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),E.indent_content=!0;var j=b.current_line_has_match(/{{#if/);j||b.print_newline(!1)}E.tag_name==="!--"&&D.type===s.TAG_CLOSE&&N.is_end_tag&&E.text.indexOf(` `)===-1||(E.is_inline_element||E.is_unformatted||b.print_newline(!1),this._calcluate_parent_multiline(b,E))}else if(E.is_end_tag){var H=!1;H=E.start_tag_token&&E.start_tag_token.multiline_content,H=H||!E.is_inline_element&&!(N.is_inline_element||N.is_unformatted)&&!(D.type===s.TAG_CLOSE&&E.start_tag_token===N)&&D.type!=="TK_CONTENT",(E.is_content_unformatted||E.is_unformatted)&&(H=!1),H&&b.print_newline(!1)}else E.indent_content=!E.custom_beautifier_name,E.tag_start_char==="<"&&(E.tag_name==="html"?E.indent_content=this._options.indent_inner_html:E.tag_name==="head"?E.indent_content=this._options.indent_head_inner_html:E.tag_name==="body"&&(E.indent_content=this._options.indent_body_inner_html)),!(E.is_inline_element||E.is_unformatted)&&(D.type!=="TK_CONTENT"||E.is_content_unformatted)&&b.print_newline(!1),this._calcluate_parent_multiline(b,E)},w.prototype._calcluate_parent_multiline=function(b,m){m.parent&&b._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"];w.prototype._do_optional_end_element=function(b){var m=null;if(b.is_empty_element||!b.is_start_tag||!b.parent)return;if(b.tag_name==="body")m=m||this._tag_stack.try_pop("head");else if(b.tag_name==="li")m=m||this._tag_stack.try_pop("li",["ol","ul"]);else if(b.tag_name==="dd"||b.tag_name==="dt")m=m||this._tag_stack.try_pop("dt",["dl"]),m=m||this._tag_stack.try_pop("dd",["dl"]);else if(b.parent.tag_name==="p"&&_.indexOf(b.tag_name)!==-1){var E=b.parent.parent;(!E||u.indexOf(E.tag_name)===-1)&&(m=m||this._tag_stack.try_pop("p"))}else b.tag_name==="rp"||b.tag_name==="rt"?(m=m||this._tag_stack.try_pop("rt",["ruby","rtc"]),m=m||this._tag_stack.try_pop("rp",["ruby","rtc"])):b.tag_name==="optgroup"?m=m||this._tag_stack.try_pop("optgroup",["select"]):b.tag_name==="option"?m=m||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):b.tag_name==="colgroup"?m=m||this._tag_stack.try_pop("caption",["table"]):b.tag_name==="thead"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"])):b.tag_name==="tbody"||b.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"])):b.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"])):(b.tag_name==="th"||b.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 b.parent=this._tag_stack.get_parser_token(),m},g.exports.Beautifier=w},function(g,p,f){var h=f(6).Options;function o(d){h.call(this,d,"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 h,g.exports.Options=o},function(g,p,f){var h=f(9).Tokenizer,o=f(9).TOKEN,d=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},c=new d(/<\!--/,/-->/),O=function(S,T){h.call(this,S,T),this._current_tag_name="";var R=new s(this._input).read_options(this._options),A=new a(this._input);if(this.__patterns={word:R.until(/[\n\r\t <]/),single_quote:R.until_after(/'/),double_quote:R.until_after(/"/),attribute:R.until(/[\n\r\t =>]|\/>/),element_name:R.until(/[\n\r\t >\/]/),handlebars_comment:A.starting_with(/{{!--/).until_after(/--}}/),handlebars:A.starting_with(/{{/).until_after(/}}/),handlebars_open:A.until(/[\n\r\t }]/),handlebars_raw_close:A.until(/}}/),comment:A.starting_with(//),cdata:A.starting_with(//),conditional_comment:A.starting_with(//),processing:A.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 w=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=A.matching(w).until_after(w)}};O.prototype=new h,O.prototype._is_comment=function(S){return!1},O.prototype._is_opening=function(S){return S.type===l.TAG_OPEN},O.prototype._is_closing=function(S,T){return S.type===l.TAG_CLOSE&&T&&((S.text===">"||S.text==="/>")&&T.text[0]==="<"||S.text==="}}"&&T.text[0]==="{"&&T.text[1]==="{")},O.prototype._reset=function(){this._current_tag_name=""},O.prototype._get_next_token=function(S,T){var R=null;this._readWhitespace();var A=this._input.peek();return A===null?this._create_token(l.EOF,""):(R=R||this._read_open_handlebars(A,T),R=R||this._read_attribute(A,S,T),R=R||this._read_close(A,T),R=R||this._read_raw_content(A,S,T),R=R||this._read_content_word(A),R=R||this._read_comment_or_cdata(A),R=R||this._read_processing(A),R=R||this._read_open(A,T),R=R||this._create_token(l.UNKNOWN,this._input.next()),R)},O.prototype._read_comment_or_cdata=function(S){var T=null,R=null,A=null;if(S==="<"){var w=this._input.peek(1);w==="!"&&(R=this.__patterns.comment.read(),R?(A=c.get_directives(R),A&&A.ignore==="start"&&(R+=c.readIgnored(this._input))):R=this.__patterns.cdata.read()),R&&(T=this._create_token(l.COMMENT,R),T.directives=A)}return T},O.prototype._read_processing=function(S){var T=null,R=null,A=null;if(S==="<"){var w=this._input.peek(1);(w==="!"||w==="?")&&(R=this.__patterns.conditional_comment.read(),R=R||this.__patterns.processing.read()),R&&(T=this._create_token(l.COMMENT,R),T.directives=A)}return T},O.prototype._read_open=function(S,T){var R=null,A=null;return T||S==="<"&&(R=this._input.next(),this._input.peek()==="/"&&(R+=this._input.next()),R+=this.__patterns.element_name.read(),A=this._create_token(l.TAG_OPEN,R)),A},O.prototype._read_open_handlebars=function(S,T){var R=null,A=null;return T||this._options.indent_handlebars&&S==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(R=this.__patterns.handlebars_comment.read(),R=R||this.__patterns.handlebars.read(),A=this._create_token(l.COMMENT,R)):(R=this.__patterns.handlebars_open.read(),A=this._create_token(l.TAG_OPEN,R))),A},O.prototype._read_close=function(S,T){var R=null,A=null;return T&&(T.text[0]==="<"&&(S===">"||S==="/"&&this._input.peek(1)===">")?(R=this._input.next(),S==="/"&&(R+=this._input.next()),A=this._create_token(l.TAG_CLOSE,R)):T.text[0]==="{"&&S==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),A=this._create_token(l.TAG_CLOSE,"}}"))),A},O.prototype._read_attribute=function(S,T,R){var A=null,w="";if(R&&R.text[0]==="<")if(S==="=")A=this._create_token(l.EQUALS,this._input.next());else if(S==='"'||S==="'"){var x=this._input.next();S==='"'?x+=this.__patterns.double_quote.read():x+=this.__patterns.single_quote.read(),A=this._create_token(l.VALUE,x)}else w=this.__patterns.attribute.read(),w&&(T.type===l.EQUALS?A=this._create_token(l.VALUE,w):A=this._create_token(l.ATTRIBUTE,w));return A},O.prototype._is_content_unformatted=function(S){return this._options.void_elements.indexOf(S)===-1&&(this._options.content_unformatted.indexOf(S)!==-1||this._options.unformatted.indexOf(S)!==-1)},O.prototype._read_raw_content=function(S,T,R){var A="";if(R&&R.text[0]==="{")A=this.__patterns.handlebars_raw_close.read();else if(T.type===l.TAG_CLOSE&&T.opened.text[0]==="<"&&T.text[0]!=="/"){var w=T.opened.text.substr(1).toLowerCase();if(w==="script"||w==="style"){var x=this._read_comment_or_cdata(S);if(x)return x.type=l.TEXT,x;A=this._input.readUntil(new RegExp("","ig"))}else this._is_content_unformatted(w)&&(A=this._input.readUntil(new RegExp("","ig")))}return A?this._create_token(l.TEXT,A):null},O.prototype._read_content_word=function(S){var T="";if(this._options.unformatted_content_delimiter&&(S===this._options.unformatted_content_delimiter[0]&&(T=this.__patterns.unformatted_content_delimiter.read())),T||(T=this.__patterns.word.read()),T)return this._create_token(l.TEXT,T)},g.exports.Tokenizer=O,g.exports.TOKEN=l}],G={};function M(g){var p=G[g];if(p!==void 0)return p.exports;var f=G[g]={exports:{}};return K[g](f,f.exports,M),f.exports}var L=M(18);P=L})();var Q=P;if(!0)!(ue=[oe,oe("6UM0"),oe("TXwP")],Z=function(K){var G=oe("6UM0"),M=oe("TXwP");return{html_beautify:function(L,g){return Q(L,g,G.js_beautify,M.css_beautify)}}}.apply(rt,ue),Z!==void 0&&(vt.exports=Z));else var B,F})()},"rAM+":function(vt,rt,oe){"use strict";oe.d(rt,"a",function(){return Z});var ue=oe("Qw5x");function Z(P,Q){var B;if(typeof Symbol=="undefined"||P[Symbol.iterator]==null){if(Array.isArray(P)||(B=Object(ue.a)(P))||Q&&P&&typeof P.length=="number"){B&&(P=B);var F=0,K=function(){};return{s:K,n:function(){return F>=P.length?{done:!0}:{done:!1,value:P[F++]}},e:function(p){throw p},f:K}}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 G=!0,M=!1,L;return{s:function(){B=P[Symbol.iterator]()},n:function(){var p=B.next();return G=p.done,p},e:function(p){M=!0,L=p},f:function(){try{!G&&B.return!=null&&B.return()}finally{if(M)throw L}}}}},rUJ1:function(vt,rt){const oe=/[&<>"']/,ue=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,P=/[<>"']|&(?!#?\w+;)/g,Q={"&":"&","<":"<",">":">",'"':""","'":"'"},B=A=>Q[A];function F(A,w){if(w){if(oe.test(A))return A.replace(ue,B)}else if(Z.test(A))return A.replace(P,B);return A}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function G(A){return A.replace(K,(w,x)=>(x=x.toLowerCase(),x==="colon"?":":x.charAt(0)==="#"?x.charAt(1)==="x"?String.fromCharCode(parseInt(x.substring(2),16)):String.fromCharCode(+x.substring(1)):""))}const M=/(^|[^\[])\^/g;function L(A,w){A=A.source||A,w=w||"";const x={replace:(_,u)=>(u=u.source||u,u=u.replace(M,"$1"),A=A.replace(_,u),x),getRegex:()=>new RegExp(A,w)};return x}const g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(A,w,x){if(A){let _;try{_=decodeURIComponent(G(x)).replace(g,"").toLowerCase()}catch(u){return null}if(_.indexOf("javascript:")===0||_.indexOf("vbscript:")===0||_.indexOf("data:")===0)return null}w&&!p.test(x)&&(x=a(w,x));try{x=encodeURI(x).replace(/%25/g,"%")}catch(_){return null}return x}const h={},o=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(A,w){h[" "+A]||(o.test(A)?h[" "+A]=A+"/":h[" "+A]=S(A,"/",!0)),A=h[" "+A];const x=A.indexOf(":")===-1;return w.substring(0,2)==="//"?x?w:A.replace(d,"$1")+w:w.charAt(0)==="/"?x?w:A.replace(s,"$1")+w:A+w}const l={exec:function(){}};function c(A){let w=1,x,_;for(;w{let N=!1,D=m;for(;--D>=0&&E[D]==="\\";)N=!N;return N?"|":" |"}),_=x.split(/ \|/);let u=0;if(_.length>w)_.splice(w);else for(;_.length0},!1)}function g(p,f){for(var h={main:[f]},o={main:[]},d={main:{}};L(h);)for(var s=Object.keys(h),a=0;a=2*R/w||E<=D)return;var j=Number.POSITIVE_INFINITY,H;for(H=s.level-1;H>_;H--){var I=x[H].maxBitrate;if(j=R*I/(8*.8*m),j=E)return;var y=this.bwEstimator.getEstimate();L.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 "+H+` Current BW estimate: `+(Object(Q.isFiniteNumber)(y)?(y/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+E.toFixed(3)+` s Estimated load time for the next fragment: `+j.toFixed(3)+` s Time to underbuffer: `+D.toFixed(3)+" s"),l.nextLoadLevel=H,this.bwEstimator.sample(A,T.loaded),this.clearTimer(),s.loader&&(this.fragCurrent=this.partCurrent=null,s.loader.abort()),l.trigger(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:a,stats:T})},o.onFragLoaded=function(s,a){var l=a.frag,c=a.part;if(l.type===M.PlaylistLevelType.MAIN&&Object(Q.isFiniteNumber)(l.sn)){var O=c?c.stats:l.stats,S=c?c.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var T=this.hls.levels[l.level],R=(T.loaded?T.loaded.bytes:0)+O.loaded,A=(T.loaded?T.loaded.duration:0)+S;T.loaded={bytes:R,duration:A},T.realBitrate=Math.round(8*R/A)}if(l.bitrateTest){var w={stats:O,frag:l,part:c,id:l.type};this.onFragBuffered(F.Events.FRAG_BUFFERED,w),l.bitrateTest=!1}}},o.onFragBuffered=function(s,a){var l=a.frag,c=a.part,O=c?c.stats:l.stats;if(O.aborted)return;if(l.type!==M.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var S=O.parsing.end-O.loading.start;this.bwEstimator.sample(S,O.loaded),O.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=S/1e3:this.bitrateTestDelay=0},o.onError=function(s,a){switch(a.details){case G.ErrorDetails.FRAG_LOAD_ERROR:case G.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,c=l.maxAutoLevel,O=l.config,S=l.minAutoLevel,T=l.media,R=a?a.duration:s?s.duration:0,A=T?T.currentTime:0,w=T&&T.playbackRate!==0?Math.abs(T.playbackRate):1,x=this.bwEstimator?this.bwEstimator.getEstimate():O.abrEwmaDefaultEstimate,_=(K.BufferHelper.bufferInfo(T,A,O.maxBufferHole).end-A)/w,u=this.findBestLevel(x,S,c,_,O.abrBandWidthFactor,O.abrBandWidthUpFactor);if(u>=0)return u;L.logger.trace((_?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=R?Math.min(R,O.maxStarvationDelay):O.maxStarvationDelay,m=O.abrBandWidthFactor,E=O.abrBandWidthUpFactor;if(!_){var N=this.bitrateTestDelay;if(N){var D=R?Math.min(R,O.maxLoadingDelay):O.maxLoadingDelay;b=D-N,L.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),m=E=1}}return u=this.findBestLevel(x,S,c,_+b,m,E),Math.max(u,0)},o.findBestLevel=function(s,a,l,c,O,S){for(var T,R=this.fragCurrent,A=this.partCurrent,w=this.lastLoadedFragLevel,x=this.hls.levels,_=x[w],u=!!(_!=null&&(T=_.details)!==null&&T!==void 0&&T.live),b=_==null?void 0:_.codecSet,m=A?A.duration:R?R.duration:0,E=l;E>=a;E--){var N=x[E];if(!N||b&&N.codecSet!==b)continue;var D=N.details,j=(A?D==null?void 0:D.partTarget:D==null?void 0:D.averagetargetduration)||m,H=void 0;E<=w?H=O*s:H=S*s;var I=x[E].maxBitrate,y=I*j/H;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(H)+"/"+I+"/"+j+"/"+c+"/"+y),H>I&&(!y||u&&!this.bitrateTestDelay||y0&&_===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=B.State.IDLE):(this.loadedmetadata=!1,this.state=B.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=_,this.tick()},w.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_TRACK:{var _,u=this.levels,b=this.trackId,m=u==null||((_=u[b])===null||_===void 0)?void 0:_.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=B.State.WAITING_INIT_PTS}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var E,N=performance.now(),D=this.retryDate;(!D||N>=D||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=B.State.IDLE);break}case B.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var H=j.frag,I=j.part,y=j.cache,W=j.complete;if(this.initPTS[H.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.FRAG_LOADING;var Y=y.flush(),ie={frag:H,part:I,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(ie),W&&R.prototype._handleFragmentLoadComplete.call(this,ie)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+H.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var se=this.getLoadPosition(),xe=K.BufferHelper.bufferInfo(this.mediaBuffer,se,this.config.maxBufferHole),me=Object(o.fragmentWithinToleranceTest)(xe.end,this.config.maxFragLookUpTolerance,H);me<0&&(a.logger.log("Waiting fragment cc ("+H.cc+") @ "+H.start+" cancelled because another fragment at "+xe.end+" is needed"),this.clearWaitingFragment())}}else this.state=B.State.IDLE}}this.onTickEnd()},w.clearWaitingFragment=function(){var _=this.waitingData;_&&(this.fragmentTracker.removeFragment(_.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.IDLE)},w.onTickEnd=function(){var _=this.media;if(!_||!_.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:_,b=u.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=_.currentTime},w.doTickIdle=function(){var _,u,b=this.hls,m=this.levels,E=this.media,N=this.trackId,D=b.config;if(!m||!m[N])return;if(!E&&(this.startFragRequested||!D.startFragPrefetch))return;var j=m[N],H=j.details;if(!H||H.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(H)){this.state=B.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(I===null)return;var y=I.len,W=this.getMaxBufferLength(),Y=this.audioSwitch;if(y>=W&&!Y)return;if(!Y&&this._streamEnded(I,H)){b.trigger(F.Events.BUFFER_EOS,{type:"audio"}),this.state=B.State.ENDED;return}var ie=H.fragments,se=ie[0].start,xe=I.end;if(Y){var me=this.getLoadPosition();xe=me,H.PTSKnown&&mese||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=se+.05))}var Te=this.getNextFragment(xe,H);if(!Te){this.bufferFlushed=!0;return}((_=Te.decryptdata)===null||_===void 0?void 0:_.keyFormat)==="identity"&&!((u=Te.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(Te,H):this.loadFragment(Te,H,xe)},w.getMaxBufferLength=function(){var _=R.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return u===null?_:Math.max(_,u.len)},w.onMediaDetaching=function(){this.videoBuffer=null,R.prototype.onMediaDetaching.call(this)},w.onAudioTracksUpdated=function(_,u){var b=u.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(m){return new M.Level(m)})},w.onAudioTrackSwitching=function(_,u){var b=!!u.url;this.trackId=u.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(S):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=B.State.IDLE):this.state=B.State.STOPPED,this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},w.onLevelLoaded=function(_,u){this.mainDetails=u.details},w.onAudioTrackLoaded=function(_,u){var b,m=this.levels,E=u.details,N=u.id;if(!m){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var D=m[N],j=0;if(E.live||(b=D.details)!==null&&b!==void 0&&b.live){var H=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!H)return;!D.details&&E.hasProgramDateTime&&H.hasProgramDateTime?(Object(d.alignMediaPlaylistByPDT)(E,H),j=E.fragments[0].start):j=this.alignPlaylists(E,D.details)}D.details=E,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(D.details,j),this.state===B.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=B.State.IDLE),this.tick()},w._handleFragmentLoadProgress=function(_){var u,b=_.frag,m=_.part,E=_.payload,N=this.config,D=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+b.sn+" of level "+b.level+" will not be buffered");return}var H=j[D];console.assert(H,"Audio track is defined on fragment load progress");var I=H.details;console.assert(I,"Audio track details are defined on fragment load progress");var y=N.defaultAudioCodec||H.audioCodec||"mp4a.40.2",W=this.transmuxer;W||(W=this.transmuxer=new f.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[b.cc],ie=(u=b.initSegment)===null||u===void 0?void 0:u.data;if(Y!==void 0){var se=!1,xe=m?m.index:-1,me=xe!==-1,Te=new h.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,E.byteLength,xe,me);W.push(E,ie,y,"",b,m,I.totalduration,se,Te,Y)}else{a.logger.log("Unknown video PTS for cc "+b.cc+", waiting for video PTS before demuxing audio frag "+b.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+D);var Se=this.waitingData=this.waitingData||{frag:b,part:m,cache:new p.default,complete:!1},we=Se.cache;we.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=B.State.WAITING_INIT_PTS}},w._handleFragmentLoadComplete=function(_){if(this.waitingData){this.waitingData.complete=!0;return}R.prototype._handleFragmentLoadComplete.call(this,_)},w.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},w.onBufferCreated=function(_,u){var b=u.tracks.audio;b&&(this.mediaBuffer=b.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},w.onFragBuffered=function(_,u){var b=u.frag,m=u.part;if(b.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(m?" p: "+m.index:"")+" of level "+b.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}b.sn!=="initSegment"&&(this.fragPrevious=b,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,m)},w.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(L.PlaylistLevelType.AUDIO,u);break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==B.State.ERROR&&this.state!==B.State.STOPPED&&(this.state=u.fatal?B.State.ERROR:B.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===B.State.PARSING||this.state===B.State.PARSED)){var b=!0,m=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);m&&m.len>.5&&(b=!this.reduceMaxBufferLength(m.len)),b&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},w.onBufferFlushed=function(_,u){var b=u.type;b===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},w._handleTransmuxComplete=function(_){var u,b="audio",m=this.hls,E=_.remuxResult,N=_.chunkMeta,D=this.getCurrentContext(N);if(!D){this.warn("The loading context changed while buffering fragment "+N.sn+" of level "+N.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(N.level);return}var j=D.frag,H=D.part,I=E.audio,y=E.text,W=E.id3,Y=E.initSegment;if(this.fragContextChanged(j))return;if(this.state=B.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,j,N),m.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:b,tracks:Y.tracks})),I){var ie=I.startPTS,se=I.endPTS,xe=I.startDTS,me=I.endDTS;H&&(H.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:ie,endPTS:se,startDTS:xe,endDTS:me}),j.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,ie,se,xe,me),this.bufferFragmentData(I,j,H,N)}if(W!=null&&(u=W.samples)!==null&&u!==void 0&&u.length){var Te=l({frag:j,id:b},W);m.trigger(F.Events.FRAG_PARSING_METADATA,Te)}if(y){var Se=l({frag:j,id:b},y);m.trigger(F.Events.FRAG_PARSING_USERDATA,Se)}},w._bufferInitSegment=function(_,u,b){if(this.state!==B.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(F.Events.BUFFER_CODECS,_);var E=m.initSegment;if(E!=null&&E.byteLength){var N={type:"audio",frag:u,part:null,chunkMeta:b,parent:u.type,data:E};this.hls.trigger(F.Events.BUFFER_APPENDING,N)}this.tick()},w.loadFragment=function(_,u,b){var m=this.fragmentTracker.getState(_);this.fragCurrent=_,(this.audioSwitch||m===G.FragmentState.NOT_LOADED||m===G.FragmentState.PARTIAL)&&(_.sn==="initSegment"?this._loadInitSegment(_):u.live&&!Object(Q.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=B.State.WAITING_INIT_PTS):(this.startFragRequested=!0,R.prototype.loadFragment.call(this,_,u,b)))},w.completeAudioSwitch=function(){var _=this.hls,u=this.media,b=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,_.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:b})},A}(B.default);Z.default=T},"./src/controller/audio-track-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts"),B=P("./src/errors.ts"),F=P("./src/controller/base-playlist-controller.ts"),K=P("./src/types/loader.ts");function G(f,h){for(var o=0;o=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=a[this.trackId];this.log("Now switching to audio-track index "+s);var c=a[s],O=c.id,S=c.groupId,T=S===void 0?"":S,R=c.name,A=c.type,w=c.url;if(this.trackId=s,this.trackName=R,this.selectDefaultTrack=!1,this.hls.trigger(Q.Events.AUDIO_TRACK_SWITCHING,{id:O,groupId:T,name:R,type:A,url:w}),c.details&&!c.details.live)return;var x=this.switchParams(c.url,l==null?void 0:l.details);this.loadPlaylist(x)},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(Q.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},o.findTrackId=function(s){for(var a=this.tracksInGroup,l=0;lh.partTarget&&(c+=1)}if(Object(Q.isFiniteNumber)(l))return new B.HlsUrlParameters(l,Object(Q.isFiniteNumber)(c)?c:void 0,B.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,h,o){var d=this,s=h.details,a=h.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(F.mergeDetails)(o,s),!this.canLoad||!s.live)return;var c,O=void 0,S=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var T=this.hls.config.lowLatencyMode,R=s.lastPartSn,A=s.endSN,w=s.lastPartIndex,x=w!==-1,_=R===A,u=T?0:w;x?(O=_?A+1:R,S=_?u:w+1):O=A+1;var b=s.age,m=b+s.ageHeader,E=Math.min(m-s.partTarget,s.targetduration*1.5);if(E>0){if(o&&E>o.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+o.tuneInGoal+" to: "+E+" with playlist age: "+s.age),E=0;else{var N=Math.floor(E/s.targetduration);if(O+=N,S!==void 0){var D=Math.round(E%s.targetduration/s.partTarget);S+=D}this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+E+" skip sn "+N+" to part "+S)}s.tuneInGoal=E}if(c=this.getDeliveryDirectives(s,h.deliveryDirectives,O,S),T||!_){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(s,h.deliveryDirectives,O,S);var j=Object(F.computeReloadInterval)(s,a);O!==void 0&&s.canBlockReload&&(j-=s.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return d.loadPlaylist(c)},j)}else this.clearTimer()},g.getDeliveryDirectives=function(f,h,o,d){var s=Object(B.getSkipValue)(f,o);return h!=null&&h.skip&&f.deltaUpdateFailed&&(o=h.msn,d=h.part,s=B.HlsSkip.No),new B.HlsUrlParameters(o,d,s)},g.retryLoadingOrFail=function(f){var h=this,o=this.hls.config,d=this.retryCount-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 h.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 d},L}()},"./src/controller/base-stream-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"State",function(){return A}),P.d(Z,"default",function(){return w});var Q=P("./src/polyfills/number.ts"),B=P("./src/task-loop.ts"),F=P("./src/controller/fragment-tracker.ts"),K=P("./src/utils/buffer-helper.ts"),G=P("./src/utils/logger.ts"),M=P("./src/events.ts"),L=P("./src/errors.ts"),g=P("./src/types/transmuxer.ts"),p=P("./src/utils/mp4-tools.ts"),f=P("./src/utils/discontinuities.ts"),h=P("./src/controller/fragment-finders.ts"),o=P("./src/controller/level-helper.ts"),d=P("./src/loader/fragment-loader.ts"),s=P("./src/crypt/decrypter.ts"),a=P("./src/utils/time-ranges.ts"),l=P("./src/types/loader.ts");function c(x,_){for(var u=0;u<_.length;u++){var b=_[u];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(x,b.key,b)}}function O(x,_,u){return _&&c(x.prototype,_),u&&c(x,u),x}function S(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function T(x,_){x.prototype=Object.create(_.prototype),x.prototype.constructor=x,R(x,_)}function R(x,_){return R=Object.setPrototypeOf||function(b,m){return b.__proto__=m,b},R(x,_)}var A={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"},w=function(x){T(_,x);function _(b,m,E){var N;return N=x.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=A.STOPPED,N.media=void 0,N.mediaBuffer=void 0,N.config=void 0,N.bitrateTest=!1,N.lastCurrentTime=0,N.nextLoadPosition=0,N.startPosition=0,N.loadedmetadata=!1,N.fragLoadError=0,N.retryDate=0,N.levels=null,N.fragmentLoader=void 0,N.levelLastLoaded=null,N.startFragRequested=!1,N.decrypter=void 0,N.initPTS=[],N.onvseeking=null,N.onvended=null,N.logPrefix="",N.log=void 0,N.warn=void 0,N.logPrefix=E,N.log=G.logger.log.bind(G.logger,E+":"),N.warn=G.logger.warn.bind(G.logger,E+":"),N.hls=b,N.fragmentLoader=new d.default(b.config),N.fragmentTracker=m,N.config=b.config,N.decrypter=new s.default(b,b.config),b.on(M.Events.KEY_LOADED,N.onKeyLoaded,S(N)),N}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=A.STOPPED},u._streamEnded=function(m,E){var N=this.fragCurrent,D=this.fragmentTracker;if(!E.live&&N&&N.sn===E.endSN&&!m.nextStart){var j=D.getState(N);return j===F.FragmentState.PARTIAL||j===F.FragmentState.OK}return!1},u.onMediaAttached=function(m,E){var N=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var D=this.config;this.levels&&D.autoStartLoad&&this.state===A.STOPPED&&this.startLoad(D.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,E=this.fragCurrent,N=this.media,D=this.mediaBuffer,j=this.state,H=N?N.currentTime:0,I=K.BufferHelper.bufferInfo(D||N,H,m.maxBufferHole);if(this.log("media seeking to "+(Object(Q.isFiniteNumber)(H)?H.toFixed(3):H)+", state: "+j),j===A.ENDED)this.resetLoadingState();else if(E&&!I.len){var y=m.maxFragLookUpTolerance,W=E.start-y,Y=E.start+E.duration+y,ie=H>Y;(H0&&H&&H.key&&H.iv&&H.method==="AES-128"){var I=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(j),H.key.buffer,H.iv.buffer).then(function(y){var W=self.performance.now();return D.trigger(M.Events.FRAG_DECRYPTED,{frag:m,payload:y,stats:{tstart:I,tdecrypt:W}}),N.payload=y,N})}return N}).then(function(N){var D=E.fragCurrent,j=E.hls,H=E.levels;if(!H)throw new Error("init load aborted, missing levels");var I=H[m.level].details;console.assert(I,"Level details are defined when init segment is loaded");var y=m.stats;E.state=A.IDLE,E.fragLoadError=0,m.data=new Uint8Array(N.payload),y.parsing.start=y.buffering.start=self.performance.now(),y.parsing.end=y.buffering.end=self.performance.now(),N.frag===D&&j.trigger(M.Events.FRAG_BUFFERED,{stats:y,frag:D,part:null,id:m.type}),E.tick()}).catch(function(N){E.warn(N),E.resetFragmentLoading(m)})},u.fragContextChanged=function(m){var E=this.fragCurrent;return!m||!E||m.level!==E.level||m.sn!==E.sn||m.urlId!==E.urlId},u.fragBufferedComplete=function(m,E){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+a.default.toString(K.BufferHelper.getBuffered(N))),this.state=A.IDLE,this.tick()},u._handleFragmentLoadComplete=function(m){var E=this.transmuxer;if(!E)return;var N=m.frag,D=m.part,j=m.partsLoaded,H=!j||j.length===0||j.some(function(y){return!y}),I=new g.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,D?D.index:-1,!H);E.flush(I)},u._handleFragmentLoadProgress=function(m){},u._doFragLoad=function(m,E,N,D){var j=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(m.start,N||0),this.config.lowLatencyMode&&E){var H=E.partList;if(H&&D){N>m.end&&E.fragmentHint&&(m=E.fragmentHint);var I=this.getNextPart(H,m,N);if(I>-1){var y=H[I];return this.log("Loading part sn: "+m.sn+" p: "+y.index+" cc: "+m.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+I+"-"+(H.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=y.start+y.duration,this.state=A.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,part:H[I],targetBufferTime:N}),this.doFragPartsLoad(m,H,I,D).catch(function(W){return j.handleFragLoadError(W)})}else if(!m.url||this.loadedEndOfParts(H,N))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(N.toFixed(3))),Object(Q.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=A.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,targetBufferTime:N}),this.fragmentLoader.load(m,D).catch(function(W){return j.handleFragLoadError(W)})},u.doFragPartsLoad=function(m,E,N,D){var j=this;return new Promise(function(H,I){var y=[],W=function Y(ie){var se=E[ie];j.fragmentLoader.loadPart(m,se,D).then(function(xe){y[se.index]=xe;var me=xe.part;j.hls.trigger(M.Events.FRAG_LOADED,xe);var Te=E[ie+1];if(Te&&Te.fragment===m)Y(ie+1);else return H({frag:m,part:me,partsLoaded:y})}).catch(I)};W(N)})},u.handleFragLoadError=function(m){var E=m.data;return E&&E.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(M.Events.ERROR,E),null},u._handleTransmuxerFlush=function(m){var E=this.getCurrentContext(m);if(!E||this.state!==A.PARSING){this.fragCurrent||(this.state=A.IDLE);return}var N=E.frag,D=E.part,j=E.level,H=self.performance.now();N.stats.parsing.end=H,D&&(D.stats.parsing.end=H),this.updateLevelTiming(N,D,j,m.partial)},u.getCurrentContext=function(m){var E=this.levels,N=m.level,D=m.sn,j=m.part;if(!E||!E[N])return this.warn("Levels object was unset while buffering fragment "+D+" of level "+N+". The current chunk will not be buffered."),null;var H=E[N],I=j>-1?Object(o.getPartWith)(H,D,j):null,y=I?I.fragment:Object(o.getFragmentWithSN)(H,D,this.fragCurrent);return y?{frag:y,part:I,level:H}:null},u.bufferFragmentData=function(m,E,N,D){if(!m||this.state!==A.PARSING)return;var j=m.data1,H=m.data2,I=j;if(j&&H&&(I=Object(p.appendUint8Array)(j,H)),!I||!I.length)return;var y={type:m.type,frag:E,part:N,chunkMeta:D,parent:E.type,data:I};this.hls.trigger(M.Events.BUFFER_APPENDING,y),m.dropped&&m.independent&&!N&&this.flushBufferGap(E)},u.flushBufferGap=function(m){var E=this.media;if(!E)return;if(!K.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,m.start);return}var N=E.currentTime,D=K.BufferHelper.bufferInfo(E,N,0),j=m.duration,H=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),I=Math.max(Math.min(m.start-H,D.end-H),N+H);m.start-I>H&&this.flushMainBuffer(I,m.start)},u.getFwdBufferInfo=function(m,E){var N=this.config,D=this.getLoadPosition();if(!Object(Q.isFiniteNumber)(D))return null;var j=K.BufferHelper.bufferInfo(m,D,N.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var H=this.fragmentTracker.getBufferedFrag(D,E);if(H&&j.nextStart=N?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(m,E){var N,D,j=E.fragments,H=j.length;if(!H)return null;var I=this.config,y=j[0].start,W;if(E.live){var Y=I.initialLiveManifestSize;if(H-1&&NN.start&&N.loaded},u.getInitialLiveFragment=function(m,E){var N=this.fragPrevious,D=null;if(N){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),D=Object(h.findFragmentByPDT)(E,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!D){var j=N.sn+1;if(j>=m.startSN&&j<=m.endSN){var H=E[j-m.startSN];N.cc===H.cc&&(D=H,this.log("Live playlist, switching playlist, load frag with next SN: "+D.sn))}D||(D=Object(h.findFragWithCC)(E,N.cc),D&&this.log("Live playlist, switching playlist, load frag with same CC: "+D.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(D=this.getFragmentAtPosition(I,this.bitrateTest?m.fragmentEnd:m.edge,m))}return D},u.getFragmentAtPosition=function(m,E,N){var D=this.config,j=this.fragPrevious,H=N.fragments,I=N.endSN,y=N.fragmentHint,W=D.maxFragLookUpTolerance,Y=!!(D.lowLatencyMode&&N.partList&&y);Y&&y&&!this.bitrateTest&&(H=H.concat(y),I=y.sn);var ie;if(mE-W?0:W;ie=Object(h.findFragmentByPTS)(j,H,m,se)}else ie=H[H.length-1];if(ie){var xe=ie.sn-N.startSN,me=j&&ie.level===j.level,Te=H[xe+1],Se=this.fragmentTracker.getState(ie);if(Se===F.FragmentState.BACKTRACKED){ie=null;for(var we=xe;H[we]&&this.fragmentTracker.getState(H[we])===F.FragmentState.BACKTRACKED;)j?ie=H[we--]:ie=H[--we];ie||(ie=Te)}else j&&ie.sn===j.sn&&!Y&&(me&&(ie.sn=H-E.maxFragLookUpTolerance&&j<=I;if(D!==null&&N.duration>D&&(j"+m.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+I),ie}return y},u.waitForCdnTuneIn=function(m){var E=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*E)},u.setStartPosition=function(m,E){var N=this.startPosition;if(N"+m))}}]),_}(B.default)},"./src/controller/buffer-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h});var Q=P("./src/polyfills/number.ts"),B=P("./src/events.ts"),F=P("./src/utils/logger.ts"),K=P("./src/errors.ts"),G=P("./src/utils/buffer-helper.ts"),M=P("./src/utils/mediasource-helper.ts"),L=P("./src/loader/fragment.ts"),g=P("./src/controller/buffer-operation-queue.ts"),p=Object(M.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,h=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,c=a.media,O=a.mediaSource;F.logger.log("[buffer-controller]: Media source opened"),c&&(a.updateMediaElementDuration(),l.trigger(B.Events.MEDIA_ATTACHED,{media:c})),O&&O.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){F.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){F.logger.log("[buffer-controller]: Media source ended")},this.hls=s,this._initSourceBuffer(),this.registerListeners()}var d=o.prototype;return d.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},d.destroy=function(){this.unregisterListeners(),this.details=null},d.registerListeners=function(){var a=this.hls;a.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(B.Events.BUFFER_RESET,this.onBufferReset,this),a.on(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(B.Events.BUFFER_EOS,this.onBufferEos,this),a.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(B.Events.FRAG_PARSED,this.onFragParsed,this),a.on(B.Events.FRAG_CHANGED,this.onFragChanged,this)},d.unregisterListeners=function(){var a=this.hls;a.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(B.Events.BUFFER_RESET,this.onBufferReset,this),a.off(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(B.Events.BUFFER_EOS,this.onBufferEos,this),a.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(B.Events.FRAG_PARSED,this.onFragParsed,this),a.off(B.Events.FRAG_CHANGED,this.onFragChanged,this)},d._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},d.onManifestParsed=function(a,l){var c=2;(l.audio&&!l.video||!l.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,F.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},d.onMediaAttaching=function(a,l){var c=this.media=l.media;if(c&&p){var O=this.mediaSource=new p;O.addEventListener("sourceopen",this._onMediaSourceOpen),O.addEventListener("sourceended",this._onMediaSourceEnded),O.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(O),this._objectUrl=c.src}},d.onMediaDetaching=function(){var a=this.media,l=this.mediaSource,c=this._objectUrl;if(l){if(F.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(O){F.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&&(c&&self.URL.revokeObjectURL(c),a.src===c?(a.removeAttribute("src"),a.load()):F.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(B.Events.MEDIA_DETACHED,void 0)},d.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(l){var c=a.sourceBuffer[l];try{c&&(a.removeBufferListeners(l),a.mediaSource&&a.mediaSource.removeSourceBuffer(c),a.sourceBuffer[l]=void 0)}catch(O){F.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",O)}}),this._initSourceBuffer()},d.onBufferCodecs=function(a,l){var c=this,O=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(S){if(O){var T=c.tracks[S];if(T&&typeof T.buffer.changeType=="function"){var R=l[S],A=R.codec,w=R.levelCodec,x=R.container,_=(T.levelCodec||T.codec).replace(f,"$1"),u=(w||A).replace(f,"$1");if(_!==u){var b=x+";codecs="+(w||A);c.appendChangeType(S,b)}}}else c.pendingTracks[S]=l[S]}),O)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},d.appendChangeType=function(a,l){var c=this,O=this.operationQueue,S={execute:function(){var R=c.sourceBuffer[a];R&&(F.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+l),R.changeType(l)),O.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(R){F.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",R)}};O.append(S,a)},d.onBufferAppending=function(a,l){var c=this,O=this.hls,S=this.operationQueue,T=this.tracks,R=l.data,A=l.type,w=l.frag,x=l.part,_=l.chunkMeta,u=_.buffering[A],b=self.performance.now();u.start=b;var m=w.stats.buffering,E=x?x.stats.buffering:null;m.start===0&&(m.start=b),E&&E.start===0&&(E.start=b);var N=T.audio,D=A==="audio"&&_.id===1&&(N==null?void 0:N.container)==="audio/mpeg",j={execute:function(){if(u.executeStart=self.performance.now(),D){var I=c.sourceBuffer[A];if(I){var y=w.start-I.timestampOffset;Math.abs(y)>=.1&&(F.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+w.start+" (delta: "+y+") sn: "+w.sn+")"),I.timestampOffset=w.start)}}c.appendExecutor(R,A)},onStart:function(){},onComplete:function(){var I=self.performance.now();u.executeEnd=u.end=I,m.first===0&&(m.first=I),E&&E.first===0&&(E.first=I);var y=c.sourceBuffer,W={};for(var Y in y)W[Y]=G.BufferHelper.getBuffered(y[Y]);c.appendError=0,c.hls.trigger(B.Events.BUFFER_APPENDED,{type:A,frag:w,part:x,chunkMeta:_,parent:w.type,timeRanges:W})},onError:function(I){F.logger.error("[buffer-controller]: Error encountered while trying to append to the "+A+" SourceBuffer",I);var y={type:K.ErrorTypes.MEDIA_ERROR,parent:w.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?y.details=K.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,y.details=K.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>O.config.appendErrorMaxRetry&&(F.logger.error("[buffer-controller]: Failed "+O.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),y.fatal=!0)),O.trigger(B.Events.ERROR,y)}};S.append(j,A)},d.onBufferFlushing=function(a,l){var c=this,O=this.operationQueue,S=function(R){return{execute:c.removeExecutor.bind(c,R,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(B.Events.BUFFER_FLUSHED,{type:R})},onError:function(w){F.logger.warn("[buffer-controller]: Failed to remove from "+R+" SourceBuffer",w)}}};l.type?O.append(S(l.type),l.type):this.getSourceBufferTypes().forEach(function(T){O.append(S(T),T)})},d.onFragParsed=function(a,l){var c=this,O=l.frag,S=l.part,T=[],R=S?S.elementaryStreams:O.elementaryStreams;R[L.ElementaryStreamTypes.AUDIOVIDEO]?T.push("audiovideo"):(R[L.ElementaryStreamTypes.AUDIO]&&T.push("audio"),R[L.ElementaryStreamTypes.VIDEO]&&T.push("video"));var A=function(){var x=self.performance.now();O.stats.buffering.end=x,S&&(S.stats.buffering.end=x);var _=S?S.stats:O.stats;c.hls.trigger(B.Events.FRAG_BUFFERED,{frag:O,part:S,stats:_,id:O.type})};T.length===0&&F.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+O.type+" level: "+O.level+" sn: "+O.sn),this.blockBuffers(A,T)},d.onFragChanged=function(a,l){this.flushBackBuffer()},d.onBufferEos=function(a,l){var c=this,O=this.getSourceBufferTypes().reduce(function(S,T){var R=c.sourceBuffer[T];return(!l.type||l.type===T)&&(R&&!R.ended&&(R.ended=!0,F.logger.log("[buffer-controller]: "+T+" sourceBuffer now EOS"))),S&&!!(!R||R.ended)},!0);O&&this.blockBuffers(function(){var S=c.mediaSource;if(!S||S.readyState!=="open")return;S.endOfStream()})},d.onLevelUpdated=function(a,l){var c=l.details;if(!c.fragments.length)return;this.details=c,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},d.flushBackBuffer=function(){var a=this.hls,l=this.details,c=this.media,O=this.sourceBuffer;if(!c||l===null)return;var S=this.getSourceBufferTypes();if(!S.length)return;var T=l.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(Q.isFiniteNumber)(T)||T<0)return;var R=c.currentTime,A=l.levelTargetDuration,w=Math.max(T,A),x=Math.floor(R/A)*A-w;S.forEach(function(_){var u=O[_];if(u){var b=G.BufferHelper.getBuffered(u);b.length>0&&x>b.start(0)&&(a.trigger(B.Events.BACK_BUFFER_REACHED,{bufferEnd:x}),l.live&&a.trigger(B.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:x}),a.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:x,type:_}))}})},d.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,l=this.hls,c=this.media,O=this.mediaSource,S=a.fragments[0].start+a.totalduration,T=c.duration,R=Object(Q.isFiniteNumber)(O.duration)?O.duration:0;a.live&&l.config.liveDurationInfinity?(F.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),O.duration=Infinity,this.updateSeekableRange(a)):(S>R&&S>T||!Object(Q.isFiniteNumber)(T))&&(F.logger.log("[buffer-controller]: Updating Media Source duration to "+S.toFixed(3)),O.duration=S)},d.updateSeekableRange=function(a){var l=this.mediaSource,c=a.fragments,O=c.length;if(O&&a.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var S=Math.max(0,c[0].start),T=Math.max(S,S+a.totalduration);l.setLiveSeekableRange(S,T)}},d.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,l=this.operationQueue,c=this.pendingTracks,O=Object.keys(c).length;if(O&&!a||O===2){this.createSourceBuffers(c),this.pendingTracks={};var S=this.getSourceBufferTypes();if(S.length===0){this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}S.forEach(function(T){l.executeNext(T)})}},d.createSourceBuffers=function(a){var l=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var O=0;for(var S in a)if(!l[S]){var T=a[S];if(!T)throw Error("source buffer exists for track "+S+", however track does not");var R=T.levelCodec||T.codec,A=T.container+";codecs="+R;F.logger.log("[buffer-controller]: creating sourceBuffer("+A+")");try{var w=l[S]=c.addSourceBuffer(A),x=S;this.addBufferListener(x,"updatestart",this._onSBUpdateStart),this.addBufferListener(x,"updateend",this._onSBUpdateEnd),this.addBufferListener(x,"error",this._onSBUpdateError),this.tracks[S]={buffer:w,codec:R,container:T.container,levelCodec:T.levelCodec,id:T.id},O++}catch(_){F.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+_.message),this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:_,mimeType:A})}}O&&this.hls.trigger(B.Events.BUFFER_CREATED,{tracks:this.tracks})},d._onSBUpdateStart=function(a){var l=this.operationQueue,c=l.current(a);c.onStart()},d._onSBUpdateEnd=function(a){var l=this.operationQueue,c=l.current(a);c.onComplete(),l.shiftAndExecuteNext(a)},d._onSBUpdateError=function(a,l){F.logger.error("[buffer-controller]: "+a+" SourceBuffer error",l),this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(a);c&&c.onError(l)},d.removeExecutor=function(a,l,c){var O=this.media,S=this.mediaSource,T=this.operationQueue,R=this.sourceBuffer,A=R[a];if(!O||!S||!A){F.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),T.shiftAndExecuteNext(a);return}var w=Object(Q.isFiniteNumber)(O.duration)?O.duration:Infinity,x=Object(Q.isFiniteNumber)(S.duration)?S.duration:Infinity,_=Math.max(0,l),u=Math.min(c,w,x);u>_?(F.logger.log("[buffer-controller]: Removing ["+_+","+u+"] from the "+a+" SourceBuffer"),console.assert(!A.updating,a+" sourceBuffer must not be updating"),A.remove(_,u)):T.shiftAndExecuteNext(a)},d.appendExecutor=function(a,l){var c=this.operationQueue,O=this.sourceBuffer,S=O[l];if(!S){F.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(l);return}S.ended=!1,console.assert(!S.updating,l+" sourceBuffer must not be updating"),S.appendBuffer(a)},d.blockBuffers=function(a,l){var c=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){F.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var O=this.operationQueue,S=l.map(function(T){return O.appendBlocker(T)});Promise.all(S).then(function(){a(),l.forEach(function(T){var R=c.sourceBuffer[T];(!R||!R.updating)&&O.shiftAndExecuteNext(T)})})},d.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},d.addBufferListener=function(a,l,c){var O=this.sourceBuffer[a];if(!O)return;var S=c.bind(this,a);this.listeners[a].push({event:l,listener:S}),O.addEventListener(l,S)},d.removeBufferListeners=function(a){var l=this.sourceBuffer[a];if(!l)return;this.listeners[a].forEach(function(c){l.removeEventListener(c.event,c.listener)})},o}()},"./src/controller/buffer-operation-queue.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return B});var Q=P("./src/utils/logger.ts"),B=function(){function F(G){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=G}var K=F.prototype;return K.append=function(M,L){var g=this.queues[L];g.push(M),g.length===1&&this.buffers[L]&&this.executeNext(L)},K.insertAbort=function(M,L){var g=this.queues[L];g.unshift(M),this.executeNext(L)},K.appendBlocker=function(M){var L,g=new Promise(function(f){L=f}),p={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,M),g},K.executeNext=function(M){var L=this.buffers,g=this.queues,p=L[M],f=g[M];if(f.length){var h=f[0];try{h.execute()}catch(o){Q.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),h.onError(o),(!p||!p.updating)&&(f.shift(),this.executeNext(M))}}},K.shiftAndExecuteNext=function(M){this.queues[M].shift(),this.executeNext(M)},K.current=function(M){return this.queues[M][0]},F}()},"./src/controller/cap-level-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts");function B(G,M){for(var L=0;L0&&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}}},M.getMaxLevel=function(g){var p=this,f=this.hls.levels;if(!f.length)return-1;var h=f.filter(function(o,d){return G.isLevelAllowed(d,p.restrictedLevels)&&d<=g});return this.clientRect=null,G.getMaxLevelByMediaSize(h,this.mediaWidth,this.mediaHeight)},M.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()},M.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},M.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},G.isLevelAllowed=function(g,p){return p===void 0&&(p=[]),p.indexOf(g)===-1},G.getMaxLevelByMediaSize=function(g,p,f){if(!g||!g.length)return-1;for(var h=function(l,c){return c?l.width!==c.width||l.height!==c.height:!0},o=g.length-1,d=0;d=p||s.height>=f)&&h(s,g[d+1])){o=d;break}}return o},F(G,[{key:"mediaWidth",get:function(){return this.getDimensions().width*G.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*G.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(p){}return g}}]),G}();Z.default=K},"./src/controller/cmcd-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h});var Q=P("./src/events.ts"),B=P("./src/types/cmcd.ts"),F=P("./src/utils/buffer-helper.ts"),K=P("./src/utils/logger.ts");function G(o,d){for(var s=0;s=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,d){if(!o)return;if(typeof o=="string")return p(o,d);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,d)}function p(o,d){(d==null||d>o.length)&&(d=o.length);for(var s=0,a=new Array(d);sl&&(l=T.bitrate)}return l>0?l:NaN},d.getBufferLength=function(a){var l=this.hls.media,c=a===B.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!l)return NaN;var O=F.BufferHelper.bufferInfo(c,l.currentTime,this.config.maxBufferHole);return O.len*1e3},d.createPlaylistLoader=function(){var a=this.config.pLoader,l=this.applyPlaylistData,c=a||this.config.loader;return function(){function O(T){this.loader=void 0,this.loader=new c(T)}var S=O.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(R,A,w){l(R),this.loader.load(R,A,w)},M(O,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),O}()},d.createFragmentLoader=function(){var a=this.config.fLoader,l=this.applyFragmentData,c=a||this.config.loader;return function(){function O(T){this.loader=void 0,this.loader=new c(T)}var S=O.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(R,A,w){l(R),this.loader.load(R,A,w)},M(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=[],c=function(D){return!Number.isNaN(D)&&D!=null&&D!==""&&D!==!1},O=function(D){return Math.round(D)},S=function(D){return O(D/100)*100},T=function(D){return encodeURIComponent(D)},R={br:O,d:O,bl:S,dl:S,mtp:S,nor:T,rtp:S,tb:O},A=Object.keys(a||{}).sort(),w=L(A),x;!(x=w()).done;){var _=x.value,u=a[_];if(!c(u))continue;if(_==="v"&&u===1)continue;if(_=="pr"&&u===1)continue;var b=R[_];b&&(u=b(u));var m=typeof u,E=void 0;_==="ot"||_==="sf"||_==="st"?E=_+"="+u:m==="boolean"?E=_:m==="number"?E=_+"="+u:E=_+"="+JSON.stringify(u),l.push(E)}return l.join(",")},o.toHeaders=function(a){for(var l=Object.keys(a),c={},O=["Object","Request","Session","Status"],S=[{},{},{},{}],T={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},R=0,A=l;RL){this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var T=L-this._requestLicenseFailureCount+1;F.logger.warn("Retrying license request, "+T+" attempts left"),this._requestLicense(l,c)}break}},o._generateLicenseRequestChallenge=function(s,a){switch(s.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+s.mediaKeySystemDomain)},o._requestLicense=function(s,a){F.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){F.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(l.mediaKeySystemDomain),O=this._createLicenseXhr(c,s,a);F.logger.log("Sending license request to URL: "+c);var S=this._generateLicenseRequestChallenge(l,s);O.send(S)}catch(T){F.logger.error("Failure requesting DRM license: "+T),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.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}),c=a.levels.map(function(O){return O.videoCodec}).filter(function(O){return!!O});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,l,c)},M(h,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),h}();Z.default=f},"./src/controller/fps-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts"),B=P("./src/utils/logger.ts"),F=function(){function K(M){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=M,this.registerListeners()}var G=K.prototype;return G.setStreamController=function(L){this.streamController=L},G.registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},G.unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching)},G.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},G.onMediaAttaching=function(L,g){var p=this.hls.config;if(p.capLevelOnFPSDrop){var f=g.media instanceof self.HTMLVideoElement?g.media:null;this.media=f,f&&typeof f.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),p.fpsDroppedMonitoringPeriod)}},G.checkFPS=function(L,g,p){var f=performance.now();if(g){if(this.lastTime){var h=f-this.lastTime,o=p-this.lastDroppedFrames,d=g-this.lastDecodedFrames,s=1e3*o/h,a=this.hls;if(a.trigger(Q.Events.FPS_DROP,{currentDropped:o,currentDecoded:d,totalDroppedFrames:p}),s>0&&o>a.config.fpsDroppedMonitoringThreshold*d){var l=a.currentLevel;B.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(Q.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}},G.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var g=L.getVideoPlaybackQuality();this.checkFPS(L,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},K}();Z.default=F},"./src/controller/fragment-finders.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"findFragmentByPDT",function(){return F}),P.d(Z,"findFragmentByPTS",function(){return K}),P.d(Z,"fragmentWithinToleranceTest",function(){return G}),P.d(Z,"pdtWithinToleranceTest",function(){return M}),P.d(Z,"findFragWithCC",function(){return L});var Q=P("./src/polyfills/number.ts"),B=P("./src/utils/binary-search.ts");function F(g,p,f){if(p===null||!Array.isArray(g)||!g.length||!Object(Q.isFiniteNumber)(p))return null;var h=g[0].programDateTime;if(p<(h||0))return null;var o=g[g.length-1].endProgramDateTime;if(p>=(o||0))return null;f=f||0;for(var d=0;dg&&f.start?-1:0}function M(g,p,f){var h=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0))*1e3,o=f.endProgramDateTime||0;return o-h>g}function L(g,p){return B.default.search(g,function(f){return f.ccp?-1:0})}},"./src/controller/fragment-tracker.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"FragmentState",function(){return F}),P.d(Z,"FragmentTracker",function(){return K});var Q=P("./src/events.ts"),B=P("./src/types/loader.ts"),F;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(F||(F={}));var K=function(){function L(p){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=p,this._registerListeners()}var g=L.prototype;return g._registerListeners=function(){var f=this.hls;f.on(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.on(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var f=this.hls;f.off(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.off(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(f,h){if(h===B.PlaylistLevelType.MAIN){var o=this.activeFragment,d=this.activeParts;if(!o)return null;if(d)for(var s=d.length;s--;){var a=d[s],l=a?a.end:o.appendedPTS;if(a.start<=f&&l!==void 0&&f<=l)return s>9&&(this.activeParts=d.slice(s-9)),a}else if(o.start<=f&&o.appendedPTS!==void 0&&f<=o.appendedPTS)return o}return this.getBufferedFrag(f,h)},g.getBufferedFrag=function(f,h){for(var o=this.fragments,d=Object.keys(o),s=d.length;s--;){var a=o[d[s]];if((a==null?void 0:a.body.type)===h&&a.buffered){var l=a.body;if(l.start<=f&&f<=l.end)return l}}return null},g.detectEvictedFragments=function(f,h,o){var d=this;Object.keys(this.fragments).forEach(function(s){var a=d.fragments[s];if(!a)return;if(!a.buffered){a.body.type===o&&d.removeFragment(a.body);return}var l=a.range[f];if(!l)return;l.time.some(function(c){var O=!d.isTimeBuffered(c.startPTS,c.endPTS,h);return O&&d.removeFragment(a.body),O})})},g.detectPartialFragments=function(f){var h=this,o=this.timeRanges,d=f.frag,s=f.part;if(!o||d.sn==="initSegment")return;var a=M(d),l=this.fragments[a];if(!l)return;Object.keys(o).forEach(function(c){var O=d.elementaryStreams[c];if(!O)return;var S=o[c],T=s!==null||O.partial===!0;l.range[c]=h.getBufferedTimes(d,s,T,S)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},g.fragBuffered=function(f){var h=M(f),o=this.fragments[h];o&&(o.backtrack=o.loaded=null,o.buffered=!0)},g.getBufferedTimes=function(f,h,o,d){for(var s={time:[],partial:o},a=h?h.start:f.start,l=h?h.end:f.end,c=f.minEndPTS||l,O=f.maxStartPTS||a,S=0;S=T&&c<=R){s.time.push({startPTS:Math.max(a,d.start(S)),endPTS:Math.min(l,d.end(S))});break}else if(aT)s.partial=!0,s.time.push({startPTS:Math.max(a,d.start(S)),endPTS:Math.min(l,d.end(S))});else if(l<=T)break}return s},g.getPartialFragment=function(f){var h=null,o,d,s,a=0,l=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(O){var S=c[O];if(!S)return;G(S)&&(d=S.body.start-l,s=S.body.end+l,f>=d&&f<=s&&(o=Math.min(f-d,s-f),a<=o&&(h=S.body,a=o)))}),h},g.getState=function(f){var h=M(f),o=this.fragments[h];return o?o.buffered?G(o)?F.PARTIAL:F.OK:o.backtrack?F.BACKTRACKED:F.APPENDING:F.NOT_LOADED},g.backtrack=function(f,h){var o=M(f),d=this.fragments[o];if(!d||d.backtrack)return null;var s=d.backtrack=h||d.loaded;return d.loaded=null,s},g.getBacktrackData=function(f){var h=M(f),o=this.fragments[h];if(o){var d,s=o.backtrack;if(s!=null&&(d=s.payload)!==null&&d!==void 0&&d.byteLength)return s;this.removeFragment(f)}return null},g.isTimeBuffered=function(f,h,o){for(var d,s,a=0;a=d&&h<=s)return!0;if(h<=d)return!1}return!1},g.onFragLoaded=function(f,h){var o=h.frag,d=h.part;if(o.sn==="initSegment"||o.bitrateTest||d)return;var s=M(o);this.fragments[s]={body:o,loaded:h,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(f,h){var o=this,d=h.frag,s=h.part,a=h.timeRanges;if(d.type===B.PlaylistLevelType.MAIN)if(this.activeFragment=d,s){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(s)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(c){var O=a[c];if(o.detectEvictedFragments(c,O),!s)for(var S=0;Sf&&d.removeFragment(l)}})},g.removeFragment=function(f){var h=M(f);f.stats.loaded=0,f.clearElementaryStreamInfo(),delete this.fragments[h]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function G(L){var g,p;return L.buffered&&(((g=L.range.video)===null||g===void 0?void 0:g.partial)||((p=L.range.audio)===null||p===void 0?void 0:p.partial))}function M(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return G}),P.d(Z,"MAX_START_GAP_JUMP",function(){return M}),P.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),P.d(Z,"SKIP_BUFFER_RANGE_START",function(){return g}),P.d(Z,"default",function(){return p});var Q=P("./src/utils/buffer-helper.ts"),B=P("./src/errors.ts"),F=P("./src/events.ts"),K=P("./src/utils/logger.ts"),G=250,M=2,L=.1,g=.05,p=function(){function f(o,d,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=d,this.fragmentTracker=s,this.hls=a}var h=f.prototype;return h.destroy=function(){this.hls=this.fragmentTracker=this.media=null},h.poll=function(d){var s=this.config,a=this.media,l=this.stalled,c=a.currentTime,O=a.seeking,S=this.seeking&&!O,T=!this.seeking&&O;if(this.seeking=O,c!==d){if(this.moved=!0,l!==null){if(this.stallReported){var R=self.performance.now()-l;K.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(R)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((T||S)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!Q.BufferHelper.getBuffered(a).length)return;var A=Q.BufferHelper.bufferInfo(a,c,0),w=A.len>0,x=A.nextStart||0;if(!w&&!x)return;if(O){var _=A.len>M,u=!x||x-c>M&&!this.fragmentTracker.getPartialFragment(c);if(_||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,m=Math.max(x,A.start||0)-c,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=E==null||((b=E.details)===null||b===void 0)?void 0:b.live,D=N?E.details.targetduration*2:M;if(m>0&&m<=D){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(l===null){this.stalled=j;return}var H=j-l;!O&&H>=G&&this._reportStall(A.len);var I=Q.BufferHelper.bufferInfo(a,c,s.maxBufferHole);this._tryFixBufferStall(I,H)},h._tryFixBufferStall=function(d,s){var a=this.config,l=this.fragmentTracker,c=this.media,O=c.currentTime,S=l.getPartialFragment(O);if(S){var T=this._trySkipBufferHole(S);if(T)return}d.len>a.maxBufferHole&&s>a.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},h._reportStall=function(d){var s=this.hls,a=this.media,l=this.stallReported;l||(this.stallReported=!0,K.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+d+")"),s.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:d}))},h._trySkipBufferHole=function(d){for(var s=this.config,a=this.hls,l=this.media,c=l.currentTime,O=0,S=Q.BufferHelper.getBuffered(l),T=0;T=O&&c.05&&this.forwardBufferLength>1){var T=Math.min(2,Math.max(1,a)),R=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;f.playbackRate=Math.min(T,Math.max(1,R))}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},G(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var f=this.config,h=this.levelDetails;return f.liveMaxLatencyDuration!==void 0?f.liveMaxLatencyDuration:h?f.liveMaxLatencyDurationCount*h.targetduration:0}},{key:"targetLatency",get:function(){var f=this.levelDetails;if(f===null)return null;var h=f.holdBack,o=f.partHoldBack,d=f.targetduration,s=this.config,a=s.liveSyncDuration,l=s.liveSyncDurationCount,c=s.lowLatencyMode,O=this.hls.userConfig,S=c&&o||h;(O.liveSyncDuration||O.liveSyncDurationCount||S===0)&&(S=a!==void 0?a:l*d);var T=d,R=1;return S+Math.min(this.stallCount*R,T)}},{key:"liveSyncPosition",get:function(){var f=this.estimateLiveEdge(),h=this.targetLatency,o=this.levelDetails;if(f===null||h===null||o===null)return null;var d=o.edge,s=f-h-this.edgeStalled,a=d-o.totalduration,l=d-(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 h=(this.config.lowLatencyMode&&f.partTarget||f.targetduration)*3;return Math.max(f.age-h,0)}},{key:"forwardBufferLength",get:function(){var f=this.media,h=this.levelDetails;if(!f||!h)return 0;var o=f.buffered.length;return o?f.buffered.end(o-1):h.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return s});var Q=P("./src/types/level.ts"),B=P("./src/events.ts"),F=P("./src/errors.ts"),K=P("./src/utils/codecs.ts"),G=P("./src/controller/level-helper.ts"),M=P("./src/controller/base-playlist-controller.ts"),L=P("./src/types/loader.ts");function g(){return g=Object.assign||function(a){for(var l=1;l0){x=R[0].bitrate,R.sort(function(H,I){return H.bitrate-I.bitrate}),this._levels=R;for(var N=0;Nthis.hls.config.fragLoadingMaxRetry&&(_=T.frag.level)):_=T.frag.level}break;case F.ErrorDetails.LEVEL_LOAD_ERROR:case F.ErrorDetails.LEVEL_LOAD_TIMEOUT:R&&(R.deliveryDirectives&&(x=!1),_=R.level),w=!0;break;case F.ErrorDetails.REMUX_ALLOC_ERROR:_=T.level,w=!0;break}_!==void 0&&this.recoverLevel(T,_,w,x)},c.recoverLevel=function(S,T,R,A){var w=S.details,x=this._levels[T];if(x.loadError++,R){var _=this.retryLoadingOrFail(S);if(_)S.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(A){var u=x.url.length;if(u>1&&x.loadError1){var A=(T.urlId+1)%R;this.warn("Switching to redundant URL-id "+A),this._levels.forEach(function(w){w.urlId=A}),this.level=S}},c.onFragLoaded=function(S,T){var R=T.frag;if(R!==void 0&&R.type===L.PlaylistLevelType.MAIN){var A=this._levels[R.level];A!==void 0&&(A.fragmentError=0,A.loadError=0)}},c.onLevelLoaded=function(S,T){var R,A=T.level,w=T.details,x=this._levels[A];if(!x){var _;this.warn("Invalid level index "+A),(_=T.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(w.deltaUpdateFailed=!0);return}A===this.currentLevelIndex?(x.fragmentError===0&&(x.loadError=0,this.retryCount=0),this.playlistLoaded(A,T,x.details)):(R=T.deliveryDirectives)!==null&&R!==void 0&&R.skip&&(w.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(S,T){var R=this.hls.levels[this.currentLevelIndex];if(!R)return;if(R.audioGroupIds){for(var A=-1,w=this.hls.audioTracks[T.id].groupId,x=0;x0){var A=R.urlId,w=R.url[A];if(S)try{w=S.addDirectives(w)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Attempt loading level index "+T+(S?" at sn "+S.msn+" part "+S.part:"")+" with URL-id "+A+" "+w),this.clearTimer(),this.hls.trigger(B.Events.LEVEL_LOADING,{url:w,level:T,id:A,deliveryDirectives:S||null})}},c.removeLevel=function(S,T){var R=function(x,_){return _!==T},A=this._levels.filter(function(w,x){return x!==S?!0:w.url.length>1&&T!==void 0?(w.url=w.url.filter(R),w.audioGroupIds&&(w.audioGroupIds=w.audioGroupIds.filter(R)),w.textGroupIds&&(w.textGroupIds=w.textGroupIds.filter(R)),w.urlId=0,!0):!1}).map(function(w,x){var _=w.details;return _!=null&&_.fragments&&_.fragments.forEach(function(u){u.level=x}),w});this._levels=A,this.hls.trigger(B.Events.LEVELS_UPDATED,{levels:A})},f(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(S){var T,R=this._levels;if(R.length===0)return;if(this.currentLevelIndex===S&&(T=R[S])!==null&&T!==void 0&&T.details)return;if(S<0||S>=R.length){var A=S<0;if(this.hls.trigger(B.Events.ERROR,{type:F.ErrorTypes.OTHER_ERROR,details:F.ErrorDetails.LEVEL_SWITCH_ERROR,level:S,fatal:A,reason:"invalid level idx"}),A)return;S=Math.min(S,R.length-1)}this.clearTimer();var w=this.currentLevelIndex,x=R[w],_=R[S];this.log("switching to level "+S+" from "+w),this.currentLevelIndex=S;var u=g({},_,{level:S,maxBitrate:_.maxBitrate,uri:_.uri,urlId:_.urlId});delete u._urlId,this.hls.trigger(B.Events.LEVEL_SWITCHING,u);var b=_.details;if(!b||b.live){var m=this.switchParams(_.uri,x==null?void 0:x.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(S){this.manualLevelIndex=S,this._startLevel===void 0&&(this._startLevel=S),S!==-1&&(this.level=S)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(S){this._firstLevel=S}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var S=this.hls.config.startLevel;return S!==void 0?S:this._firstLevel}else return this._startLevel},set:function(S){this._startLevel=S}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(S){this.level=S,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=S)}}]),l}(M.default)},"./src/controller/level-helper.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"addGroupId",function(){return F}),P.d(Z,"assignTrackIdsByGroup",function(){return K}),P.d(Z,"updatePTS",function(){return G}),P.d(Z,"updateFragPTSDTS",function(){return L}),P.d(Z,"mergeDetails",function(){return g}),P.d(Z,"mapPartIntersection",function(){return p}),P.d(Z,"mapFragmentIntersection",function(){return f}),P.d(Z,"adjustSliding",function(){return h}),P.d(Z,"addSliding",function(){return o}),P.d(Z,"computeReloadInterval",function(){return d}),P.d(Z,"getFragmentWithSN",function(){return s}),P.d(Z,"getPartWith",function(){return a});var Q=P("./src/polyfills/number.ts"),B=P("./src/utils/logger.ts");function F(l,c,O){switch(c){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(O);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(O);break}}function K(l){var c={};l.forEach(function(O){var S=O.groupId||"";O.id=c[S]=c[S]||0,c[S]++})}function G(l,c,O){var S=l[c],T=l[O];M(S,T)}function M(l,c){var O=c.startPTS;if(Object(Q.isFiniteNumber)(O)){var S=0,T;c.sn>l.sn?(S=O-l.start,T=l):(S=l.start-O,T=c),T.duration!==S&&(T.duration=S)}else if(c.sn>l.sn){var R=l.cc===c.cc;R&&l.minEndPTS?c.start=l.start+(l.minEndPTS-l.start):c.start=l.start+l.duration}else c.start=Math.max(l.start-c.duration,0)}function L(l,c,O,S,T,R){var A=S-O;A<=0&&(B.logger.warn("Fragment should have a positive duration",c),S=O+c.duration,R=T+c.duration);var w=O,x=S,_=c.startPTS,u=c.endPTS;if(Object(Q.isFiniteNumber)(_)){var b=Math.abs(_-O);Object(Q.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(b,c.deltaPTS):c.deltaPTS=b,w=Math.max(O,_),O=Math.min(O,_),T=Math.min(T,c.startDTS),x=Math.min(S,u),S=Math.max(S,u),R=Math.max(R,c.endDTS)}c.duration=S-O;var m=O-c.start;c.appendedPTS=S,c.start=c.startPTS=O,c.maxStartPTS=w,c.startDTS=T,c.endPTS=S,c.minEndPTS=x,c.endDTS=R;var E=c.sn;if(!l||El.endSN)return 0;var N,D=E-l.startSN,j=l.fragments;for(j[D]=c,N=D;N>0;N--)M(j[N],j[N-1]);for(N=D;N=0;T--){var R=S[T].initSegment;if(R){O=R;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var A=0,w;if(f(l,c,function(N,D){N.relurl&&(A=N.cc-D.cc),Object(Q.isFiniteNumber)(N.startPTS)&&Object(Q.isFiniteNumber)(N.endPTS)&&(D.start=D.startPTS=N.startPTS,D.startDTS=N.startDTS,D.appendedPTS=N.appendedPTS,D.maxStartPTS=N.maxStartPTS,D.endPTS=N.endPTS,D.endDTS=N.endDTS,D.minEndPTS=N.minEndPTS,D.duration=N.endPTS-N.startPTS,D.duration&&(w=D),c.PTSKnown=c.alignedSliding=!0),D.elementaryStreams=N.elementaryStreams,D.loader=N.loader,D.stats=N.stats,D.urlId=N.urlId,N.initSegment&&(D.initSegment=N.initSegment,O=N.initSegment)}),O){var x=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;x.forEach(function(N){var D;(!N.initSegment||N.initSegment.relurl===((D=O)===null||D===void 0?void 0:D.relurl))&&(N.initSegment=O)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(N){return!N}),c.deltaUpdateFailed)){B.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var _=c.skippedSegments;_--;)c.fragments.shift();c.startSN=c.fragments[0].sn,c.startCC=c.fragments[0].cc}var u=c.fragments;if(A){B.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b=S.length)return;o(c,S[O].start)}function o(l,c){if(c){for(var O=l.fragments,S=l.skippedSegments;S0&&T0&&x===-1&&(this.log("Override startPosition with lastCurrentTime @"+_.toFixed(3)),x=_),this.state=B.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=x,this.tick()}else this._forceStartLoad=!0,this.state=B.State.STOPPED},A.stopLoad=function(){this._forceStartLoad=!1,T.prototype.stopLoad.call(this)},A.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_LEVEL:{var x,_=this.levels,u=this.level,b=_==null||((x=_[u])===null||x===void 0)?void 0:x.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=B.State.IDLE;break}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var m,E=self.performance.now(),N=this.retryDate;(!N||E>=N||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=B.State.IDLE)}break;default:break}this.onTickEnd()},A.onTickEnd=function(){T.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},A.doTickIdle=function(){var x,_,u=this.hls,b=this.levelLastLoaded,m=this.levels,E=this.media,N=u.config,D=u.nextLoadLevel;if(b===null||!E&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[D])return;var j=m[D];this.level=u.nextLoadLevel=D;var H=j.details;if(!H||this.state===B.State.WAITING_LEVEL||H.live&&this.levelLastLoaded!==D){this.state=B.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,L.PlaylistLevelType.MAIN);if(I===null)return;var y=I.len,W=this.getMaxBufferLength(j.maxBitrate);if(y>=W)return;if(this._streamEnded(I,H)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,Y),this.state=B.State.ENDED;return}var ie=I.end,se=this.getNextFragment(ie,H);if(this.couldBacktrack&&!this.fragPrevious&&se&&se.sn!=="initSegment"){var xe=se.sn-H.startSN;xe>1&&(se=H.fragments[xe-1],this.fragmentTracker.removeFragment(se))}if(se&&this.fragmentTracker.getState(se)===M.FragmentState.OK&&this.nextLoadPosition>ie){var me=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,me,L.PlaylistLevelType.MAIN),se=this.getNextFragment(this.nextLoadPosition,H)}if(!se)return;se.initSegment&&!se.initSegment.data&&!this.bitrateTest&&(se=se.initSegment),((x=se.decryptdata)===null||x===void 0?void 0:x.keyFormat)==="identity"&&!((_=se.decryptdata)!==null&&_!==void 0&&_.key)?this.loadKey(se,H):this.loadFragment(se,H,ie)},A.loadFragment=function(x,_,u){var b,m=this.fragmentTracker.getState(x);if(this.fragCurrent=x,m===M.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(x);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else m=M.FragmentState.NOT_LOADED}m===M.FragmentState.NOT_LOADED||m===M.FragmentState.PARTIAL?x.sn==="initSegment"?this._loadInitSegment(x):this.bitrateTest?(x.bitrateTest=!0,this.log("Fragment "+x.sn+" of level "+x.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(x)):(this.startFragRequested=!0,T.prototype.loadFragment.call(this,x,_,u)):m===M.FragmentState.APPENDING?this.reduceMaxBufferLength(x.duration)&&this.fragmentTracker.removeFragment(x):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},A.getAppendedFrag=function(x){var _=this.fragmentTracker.getAppendedFrag(x,L.PlaylistLevelType.MAIN);return _&&"fragment"in _?_.fragment:_},A.getBufferedFrag=function(x){return this.fragmentTracker.getBufferedFrag(x,L.PlaylistLevelType.MAIN)},A.followingBufferedFrag=function(x){return x?this.getBufferedFrag(x.end+.5):null},A.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},A.nextLevelSwitch=function(){var x=this.levels,_=this.media;if(_!=null&&_.readyState){var u,b=this.getAppendedFrag(_.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!_.paused&&x){var m=this.hls.nextLoadLevel,E=x[m],N=this.fragLastKbps;N&&this.fragCurrent?u=this.fragCurrent.duration*E.maxBitrate/(1e3*N)+1:u=0}else u=0;var D=this.getBufferedFrag(_.currentTime+u);if(D){var j=this.followingBufferedFrag(D);if(j){this.abortCurrentFrag();var H=j.maxStartPTS?j.maxStartPTS:j.start,I=j.duration,y=Math.max(D.end,H+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(y,Number.POSITIVE_INFINITY)}}}},A.abortCurrentFrag=function(){var x=this.fragCurrent;this.fragCurrent=null,x!=null&&x.loader&&x.loader.abort(),this.state===B.State.KEY_LOADING&&(this.state=B.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},A.flushMainBuffer=function(x,_){T.prototype.flushMainBuffer.call(this,x,_,this.altAudio?"video":null)},A.onMediaAttached=function(x,_){T.prototype.onMediaAttached.call(this,x,_);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 h.default(this.config,u,this.fragmentTracker,this.hls)},A.onMediaDetaching=function(){var x=this.media;x&&(x.removeEventListener("playing",this.onvplaying),x.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),T.prototype.onMediaDetaching.call(this)},A.onMediaPlaying=function(){this.tick()},A.onMediaSeeked=function(){var x=this.media,_=x?x.currentTime:null;Object(Q.isFiniteNumber)(_)&&this.log("Media seeked to "+_.toFixed(3)),this.tick()},A.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(K.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},A.onManifestParsed=function(x,_){var u=!1,b=!1,m;_.levels.forEach(function(E){m=E.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(u=!0),m.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=u&&b&&!Object(F.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},A.onLevelLoading=function(x,_){var u=this.levels;if(!u||this.state!==B.State.IDLE)return;var b=u[_.level];(!b.details||b.details.live&&this.levelLastLoaded!==_.level||this.waitForCdnTuneIn(b.details))&&(this.state=B.State.WAITING_LEVEL)},A.onLevelLoaded=function(x,_){var u,b=this.levels,m=_.level,E=_.details,N=E.totalduration;if(!b){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+N);var D=this.fragCurrent;D&&(this.state===B.State.FRAG_LOADING||this.state===B.State.FRAG_LOADING_WAITING_RETRY)&&(D.level!==_.level&&D.loader&&(this.state=B.State.IDLE,D.loader.abort()));var j=b[m],H=0;if(E.live||(u=j.details)!==null&&u!==void 0&&u.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;H=this.alignPlaylists(E,j.details)}if(j.details=E,this.levelLastLoaded=m,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:E,level:m}),this.state===B.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=B.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,H),this.tick()},A._handleFragmentLoadProgress=function(x){var _,u=x.frag,b=x.part,m=x.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var N=E[u.level],D=N.details;if(!D){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var j=N.videoCodec,H=D.PTSKnown||!D.live,I=(_=u.initSegment)===null||_===void 0?void 0:_.data,y=this._getAudioCodec(N),W=this.transmuxer=this.transmuxer||new p.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=b?b.index:-1,ie=Y!==-1,se=new f.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,m.byteLength,Y,ie),xe=this.initPTS[u.cc];W.push(m,I,y,j,u,b,D.totalduration,H,se,xe)},A.onAudioTrackSwitching=function(x,_){var u=this.altAudio,b=!!_.url,m=_.id;if(!b){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var N=this.hls;u&&N.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:m})}},A.onAudioTrackSwitched=function(x,_){var u=_.id,b=!!this.hls.audioTracks[u].url;if(b){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=b,this.tick()},A.onBufferCreated=function(x,_){var u=_.tracks,b,m,E=!1;for(var N in u){var D=u[N];if(D.id==="main"){if(m=N,b=D,N==="video"){var j=u[N];j&&(this.videoBuffer=j.buffer)}}else E=!0}E&&b?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},A.onFragBuffered=function(x,_){var u=_.frag,b=_.part;if(u&&u.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(b?" p: "+b.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===B.State.PARSED&&(this.state=B.State.IDLE);return}var m=b?b.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,b)},A.onError=function(x,_){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(L.PlaylistLevelType.MAIN,_);break;case o.ErrorDetails.LEVEL_LOAD_ERROR:case o.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==B.State.ERROR&&(_.fatal?(this.warn(""+_.details),this.state=B.State.ERROR):!_.levelRetry&&this.state===B.State.WAITING_LEVEL&&(this.state=B.State.IDLE));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(_.parent==="main"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var u=!0,b=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);b&&b.len>.5&&(u=!this.reduceMaxBufferLength(b.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},A.checkBuffer=function(){var x=this.media,_=this.gapController;if(!x||!_||!x.readyState)return;var u=G.BufferHelper.getBuffered(x);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):_.poll(this.lastCurrentTime),this.lastCurrentTime=x.currentTime},A.onFragLoadEmergencyAborted=function(){this.state=B.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},A.onBufferFlushed=function(x,_){var u=_.type;if(u!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(u===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,u,L.PlaylistLevelType.MAIN)}},A.onLevelsUpdated=function(x,_){this.levels=_.levels},A.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},A.seekToStartPos=function(){var x=this.media,_=x.currentTime,u=this.startPosition;if(u>=0&&_0&&(E1&&x.seeking===!1){var u=x.currentTime;if(G.BufferHelper.isBuffered(x,u)?_=this.getAppendedFrag(u):G.BufferHelper.isBuffered(x,u+.1)&&(_=this.getAppendedFrag(u+.1)),_){var b=this.fragPlaying,m=_.level;(!b||_.sn!==b.sn||b.level!==m||_.urlId!==b.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:_}),(!b||b.level!==m)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=_)}}},a(R,[{key:"nextLevel",get:function(){var x=this.nextBufferedFrag;return x?x.level:-1}},{key:"currentLevel",get:function(){var x=this.media;if(x){var _=this.getAppendedFrag(x.currentTime);if(_)return _.level}return-1}},{key:"nextBufferedFrag",get:function(){var x=this.media;if(x){var _=this.getAppendedFrag(x.currentTime);return this.followingBufferedFrag(_)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),R}(B.default)},"./src/controller/subtitle-stream-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"SubtitleStreamController",function(){return l});var Q=P("./src/events.ts"),B=P("./src/utils/logger.ts"),F=P("./src/utils/buffer-helper.ts"),K=P("./src/controller/fragment-finders.ts"),G=P("./src/utils/discontinuities.ts"),M=P("./src/controller/level-helper.ts"),L=P("./src/controller/fragment-tracker.ts"),g=P("./src/controller/base-stream-controller.ts"),p=P("./src/types/loader.ts"),f=P("./src/types/level.ts");function h(c,O){for(var S=0;S=_[m].start&&b<=_[m].end){u=_[m];break}var E=w.start+w.duration;u?u.end=E:(u={start:b,end:E},_.push(u)),this.fragmentTracker.fragBuffered(w)},S.onBufferFlushing=function(R,A){var w=A.startOffset,x=A.endOffset;if(w===0&&x!==Number.POSITIVE_INFINITY){var _=this.currentTrackId,u=this.levels;if(!u.length||!u[_]||!u[_].details)return;var b=u[_].details,m=b.targetduration,E=x-m;if(E<=0)return;A.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(N){for(var D=0;D=b.length||_!==u||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,x.live||(w=m.details)!==null&&w!==void 0&&w.live){var E=this.mainDetails;if(x.deltaUpdateFailed||!E)return;var N=E.fragments[0];if(!m.details)x.hasProgramDateTime&&E.hasProgramDateTime?Object(G.alignMediaPlaylistByPDT)(x,E):N&&Object(M.addSliding)(x,N.start);else{var D=this.alignPlaylists(x,m.details);D===0&&N&&Object(M.addSliding)(x,N.start)}}if(m.details=x,this.levelLastLoaded=_,this.tick(),x.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var j=Object(K.findFragmentByPTS)(null,x.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},S._handleFragmentLoadComplete=function(R){var A=R.frag,w=R.payload,x=A.decryptdata,_=this.hls;if(this.fragContextChanged(A))return;if(w&&w.byteLength>0&&x&&x.key&&x.iv&&x.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(w),x.key.buffer,x.iv.buffer).then(function(b){var m=performance.now();_.trigger(Q.Events.FRAG_DECRYPTED,{frag:A,payload:b,stats:{tstart:u,tdecrypt:m}})})}},S.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var R,A=this.currentTrackId,w=this.levels;if(!w.length||!w[A]||!w[A].details)return;var x=w[A].details,_=x.targetduration,u=this.config,b=this.media,m=F.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-_,u.maxBufferHole),E=m.end,N=m.len,D=this.getMaxBufferLength()+_;if(N>D)return;console.assert(x,"Subtitle track details are defined on idle subtitle stream controller tick");var j=x.fragments,H=j.length,I=x.edge,y,W=this.fragPrevious;if(E-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)},d.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},d.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(B.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},d.onManifestParsed=function(a,l){this.tracks=l.subtitleTracks},d.onSubtitleTrackLoaded=function(a,l){var c=l.id,O=l.details,S=this.trackId,T=this.tracksInGroup[S];if(!T){this.warn("Invalid subtitle track id "+c);return}var R=T.details;T.details=l.details,this.log("subtitle track "+c+" loaded ["+O.startSN+"-"+O.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,l,R))},d.onLevelLoading=function(a,l){this.switchLevel(l.level)},d.onLevelSwitching=function(a,l){this.switchLevel(l.level)},d.switchLevel=function(a){var l=this.hls.levels[a];if(!(l!=null&&l.textGroupIds))return;var c=l.textGroupIds[l.urlId];if(this.groupId!==c){var O=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,S=this.tracks.filter(function(A){return!c||A.groupId===c});this.tracksInGroup=S;var T=this.findTrackId(O==null?void 0:O.name)||this.findTrackId();this.groupId=c;var R={subtitleTracks:S};this.log("Updating subtitle tracks, "+S.length+' track(s) found in "'+c+'" group-id'),this.hls.trigger(Q.Events.SUBTITLE_TRACKS_UPDATED,R),T!==-1&&this.setSubtitleTrack(T,O)}},d.findTrackId=function(a){for(var l=this.tracksInGroup,c=0;c=O.length)return;this.clearTimer();var S=O[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,S){var T=S.id,R=S.groupId,A=R===void 0?"":R,w=S.name,x=S.type,_=S.url;this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:T,groupId:A,name:w,type:x,url:_});var u=this.switchParams(S.url,l==null?void 0:l.details);this.loadPlaylist(u)}else this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:a})},d.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),c=0;c=0&&(x[0]=Math.min(x[0],O),x[1]=Math.max(x[1],S),A=!0,_/(S-O)>.5))return}if(A||R.push([O,S]),this.config.renderTextTracksNatively){var u=this.captionsTracks[c];this.Cues.newCue(u,O,S,T)}else{var b=this.Cues.newCue(null,O,S,T);this.hls.trigger(B.Events.CUES_PARSED,{type:"captions",cues:b,track:c})}},a.onInitPtsFound=function(c,O){var S=this,T=O.frag,R=O.id,A=O.initPTS,w=O.timescale,x=this.unparsedVttFrags;R==="main"&&(this.initPTS[T.cc]=A,this.timescale[T.cc]=w),x.length&&(this.unparsedVttFrags=[],x.forEach(function(_){S.onFragLoaded(B.Events.FRAG_LOADED,_)}))},a.getExistingTrack=function(c){var O=this.media;if(O)for(var S=0;S>>8^w&255^99,L[T]=w,g[w]=T;var x=S[T],_=S[x],u=S[_],b=S[w]*257^w*16843008;f[T]=b<<24|b>>>8,h[T]=b<<16|b>>>16,o[T]=b<<8|b>>>24,d[T]=b,b=u*16843009^_*65537^x*257^T*16843008,a[w]=b<<24|b>>>8,l[w]=b<<16|b>>>16,c[w]=b<<8|b>>>24,O[w]=b,T?(T=x^S[S[S[u^x]]],R^=S[S[R]]):T=R=1}},G.expandKey=function(L){for(var g=this.uint8ArrayToUint32Array_(L),p=!0,f=0;f>>6)+1;var b=(c[O+2]&60)>>>2;if(b>u.length-1){l.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return A=(c[O+2]&1)<<2,A|=(c[O+3]&192)>>>6,Q.logger.log("manifest codec:"+S+", ADTS type:"+T+", samplingIndex:"+b),/firefox/i.test(x)?b>=6?(T=5,w=new Array(4),R=b-3):(T=2,w=new Array(2),R=b):x.indexOf("android")!==-1?(T=2,w=new Array(2),R=b):(T=5,w=new Array(4),S&&(S.indexOf("mp4a.40.29")!==-1||S.indexOf("mp4a.40.5")!==-1)||!S&&b>=6?R=b-3:((S&&S.indexOf("mp4a.40.2")!==-1&&(b>=6&&A===1||/vivaldi/i.test(x))||!S&&A===1)&&(T=2,w=new Array(2)),R=b)),w[0]=T<<3,w[0]|=(b&14)>>1,w[1]|=(b&1)<<7,w[1]|=A<<3,T===5&&(w[1]|=(R&14)>>1,w[2]=(R&1)<<7,w[2]|=2<<2,w[3]=0),{config:w,samplerate:u[b],channelCount:A,codec:"mp4a.40."+T,manifestCodec:_}}function G(l,c){return l[c]===255&&(l[c+1]&246)===240}function M(l,c){return l[c+1]&1?7:9}function L(l,c){return(l[c+3]&3)<<11|l[c+4]<<3|(l[c+5]&224)>>>5}function g(l,c){return c+5=l.length)return!1;var S=L(l,c);if(S<=O)return!1;var T=c+S;return T===l.length||p(l,T)}return!1}function o(l,c,O,S,T){if(!l.samplerate){var R=K(c,O,S,T);if(!R)return;l.config=R.config,l.samplerate=R.samplerate,l.channelCount=R.channelCount,l.codec=R.codec,l.manifestCodec=R.manifestCodec,Q.logger.log("parsed codec:"+l.codec+", rate:"+R.samplerate+", channels:"+R.channelCount)}}function d(l){return 1024*9e4/l}function s(l,c,O,S,T){var R=M(l,c),A=L(l,c);if(A-=R,A>0){var w=O+S*T;return{headerLength:R,frameLength:A,stamp:w}}}function a(l,c,O,S,T){var R=d(l.samplerate),A=s(c,O,S,T,R);if(A){var w=A.frameLength,x=A.headerLength,_=A.stamp,u=x+w,b=Math.max(0,O+u-c.length),m;b?(m=new Uint8Array(u-x),m.set(c.subarray(O+x,c.length),0)):m=c.subarray(O+x,O+u);var E={unit:m,pts:_};return b||l.samples.push(E),{sample:E,length:u,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"initPTSFn",function(){return L});var Q=P("./src/polyfills/number.ts"),B=P("./src/demux/id3.ts"),F=P("./src/demux/dummy-demuxed-track.ts"),K=P("./src/utils/mp4-tools.ts"),G=P("./src/utils/typed-array.ts"),M=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(h,o,d){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(h,o){return!1},p.appendFrame=function(h,o,d){},p.demux=function(h,o){this.cachedData&&(h=Object(K.appendUint8Array)(this.cachedData,h),this.cachedData=null);var d=B.getID3Data(h,0),s=d?d.length:0,a,l,c=this._audioTrack,O=this._id3Track,S=d?B.getTimeStamp(d):void 0,T=h.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(S,o)),d&&d.length>0&&O.samples.push({pts:this.initPTS,dts:this.initPTS,data:d}),l=this.initPTS;sM?(this.word<<=M,this.bitsAvailable-=M):(M-=this.bitsAvailable,L=M>>3,M-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=M,this.bitsAvailable-=M)},K.readBits=function(M){var L=Math.min(this.bitsAvailable,M),g=this.word>>>32-L;return M>32&&Q.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=M-L,L>0&&this.bitsAvailable?g<>>M)!==0)return this.word<<=M,this.bitsAvailable-=M,M;return this.loadWord(),M+this.skipLZ()},K.skipUEG=function(){this.skipBits(1+this.skipLZ())},K.skipEG=function(){this.skipBits(1+this.skipLZ())},K.readUEG=function(){var M=this.skipLZ();return this.readBits(M+1)-1},K.readEG=function(){var M=this.readUEG();return 1&M?1+M>>>1:-1*(M>>>1)},K.readBoolean=function(){return this.readBits(1)===1},K.readUByte=function(){return this.readBits(8)},K.readUShort=function(){return this.readBits(16)},K.readUInt=function(){return this.readBits(32)},K.skipScalingList=function(M){for(var L=8,g=8,p,f=0;f0?T.subarray(A,A+w):void 0},K=function(T,R){var A=0;return A=(T[R]&127)<<21,A|=(T[R+1]&127)<<14,A|=(T[R+2]&127)<<7,A|=T[R+3]&127,A},G=function(T,R){return Q(T,R)&&K(T,R+6)+10<=T.length-R},M=function(T){for(var R=p(T),A=0;A>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(u);break;case 12:case 13:b=T[N++],E+=String.fromCharCode((u&31)<<6|b&63);break;case 14:b=T[N++],m=T[N++],E+=String.fromCharCode((u&15)<<12|(b&63)<<6|(m&63)<<0);break;default:}}return E},l={decodeTextFrame:o},c;function O(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/demux/base-audio-demuxer.ts"),B=P("./src/demux/id3.ts"),F=P("./src/utils/logger.ts"),K=P("./src/demux/mpegaudio.ts");function G(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,M(g,p)}function M(g,p){return M=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},M(g,p)}var L=function(g){G(p,g);function p(){return g.apply(this,arguments)||this}var f=p.prototype;return f.resetInitSegment=function(o,d,s){g.prototype.resetInitSegment.call(this,o,d,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 d=B.getID3Data(o,0)||[],s=d.length,a=o.length;s0},G.demux=function(L){var g=L,p=Object(B.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(Q.appendUint8Array)(this.remainderData,L));var f=Object(Q.segmentValidRange)(g);this.remainderData=f.remainder,p.samples=f.valid||new Uint8Array}else p.samples=g;return{audioTrack:Object(B.dummyTrack)(),avcTrack:p,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},G.flush=function(){var L=Object(B.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(B.dummyTrack)(),avcTrack:L,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},G.demuxSampleAes=function(L,g,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},G.destroy=function(){},K}();F.minProbeByteLength=1024,Z.default=F},"./src/demux/mpegaudio.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"appendFrame",function(){return M}),P.d(Z,"parseHeader",function(){return L}),P.d(Z,"isHeaderPattern",function(){return g}),P.d(Z,"isHeader",function(){return p}),P.d(Z,"canParse",function(){return f}),P.d(Z,"probe",function(){return h});var Q=null,B=[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],F=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],G=[0,1,1,4];function M(o,d,s,a,l){if(s+24>d.length)return;var c=L(d,s);if(c&&s+c.frameLength<=d.length){var O=c.samplesPerFrame*9e4/c.sampleRate,S=a+l*O,T={unit:d.subarray(s,s+c.frameLength),pts:S,dts:S};return o.config=[],o.channelCount=c.channelCount,o.samplerate=c.sampleRate,o.samples.push(T),{sample:T,length:c.frameLength,missing:0}}}function L(o,d){var s=o[d+1]>>3&3,a=o[d+1]>>1&3,l=o[d+2]>>4&15,c=o[d+2]>>2&3;if(s!==1&&l!==0&&l!==15&&c!==3){var O=o[d+2]>>1&1,S=o[d+3]>>6,T=s===3?3-a:a===3?3:4,R=B[T*14+l-1]*1e3,A=s===3?0:s===2?1:2,w=F[A*3+c],x=S===3?1:2,_=K[s][a],u=G[a],b=_*8*u,m=Math.floor(_*R/w+O)*u;if(Q===null){var E=navigator.userAgent||"",N=E.match(/Chrome\/(\d+)/i);Q=N?parseInt(N[1]):0}var D=!!Q&&Q<=87;return D&&a===2&&R>=224e3&&S===0&&(o[d+3]=o[d+3]|128),{sampleRate:w,channelCount:x,frameLength:m,samplesPerFrame:b}}}function g(o,d){return o[d]===255&&(o[d+1]&224)===224&&(o[d+1]&6)!==0}function p(o,d){return d+1=L.length){p();return}if(L[g].unit.length<32)continue;var f=this.decrypter.isSync();if(this.decryptAacSample(L,g,p,f),!f)return}},G.getAvcEncryptedData=function(L){for(var g=Math.floor((L.length-48)/160)*16+16,p=new Int8Array(g),f=0,h=32;h<=L.length-16;h+=160,f+=16)p.set(L.subarray(h,h+16),f);return p},G.getAvcDecryptedUnit=function(L,g){for(var p=new Uint8Array(g),f=0,h=32;h<=L.length-16;h+=160,f+=16)L.set(p.subarray(f,f+16),h);return L},G.decryptAvcSample=function(L,g,p,f,h,o){var d=Object(B.discardEPB)(h.data),s=this.getAvcEncryptedData(d),a=this;this.decryptBuffer(s.buffer,function(l){h.data=a.getAvcDecryptedUnit(d,l),o||a.decryptAvcSamples(L,g,p+1,f)})},G.decryptAvcSamples=function(L,g,p,f){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,p=0){if(g>=L.length){f();return}for(var h=L[g].units;!(p>=h.length);p++){var o=h[p];if(o.data.length<=48||o.type!==1&&o.type!==5)continue;var d=this.decrypter.isSync();if(this.decryptAvcSample(L,g,p,f,o,d),!d)return}}},K}();Z.default=F},"./src/demux/transmuxer-interface.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h});var Q=P("./node_modules/webworkify-webpack/index.js"),B=P.n(Q),F=P("./src/events.ts"),K=P("./src/demux/transmuxer.ts"),G=P("./src/utils/logger.ts"),M=P("./src/errors.ts"),L=P("./src/utils/mediasource-helper.ts"),g=P("./node_modules/eventemitter3/index.js"),p=P.n(g),f=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},h=function(){function o(s,a,l,c){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=c;var S=s.config,T=function(_,u){u=u||{},u.frag=O.frag,u.id=O.id,s.trigger(_,u)};this.observer=new g.EventEmitter,this.observer.on(F.Events.FRAG_DECRYPTED,T),this.observer.on(F.Events.ERROR,T);var R={mp4:f.isTypeSupported("video/mp4"),mpeg:f.isTypeSupported("audio/mpeg"),mp3:f.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(S.enableWorker&&typeof Worker!="undefined"){G.logger.log("demuxing in webworker");var w;try{w=this.worker=Q("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),w.addEventListener("message",this.onwmsg),w.onerror=function(x){s.trigger(F.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(x.message+" ("+x.filename+":"+x.lineno+")")})},w.postMessage({cmd:"init",typeSupported:R,vendor:A,id:a,config:JSON.stringify(S)})}catch(x){G.logger.warn("Error in worker:",x),G.logger.error("Error while initializing DemuxerWorker, fallback to inline"),w&&self.URL.revokeObjectURL(w.objectURL),this.transmuxer=new K.default(this.observer,R,S,A,a),this.worker=null}}else this.transmuxer=new K.default(this.observer,R,S,A,a)}var d=o.prototype;return d.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 c=this.observer;c&&c.removeAllListeners(),this.observer=null},d.push=function(a,l,c,O,S,T,R,A,w,x){var _=this;w.transmuxing.start=self.performance.now();var u=this.transmuxer,b=this.worker,m=T?T.start:S.start,E=S.decryptdata,N=this.frag,D=!(N&&S.cc===N.cc),j=!(N&&w.level===N.level),H=N?w.sn-N.sn:-1,I=this.part?w.part-this.part.index:1,y=!j&&(H===1||H===0&&I===1),W=self.performance.now();(j||H||S.stats.parsing.start===0)&&(S.stats.parsing.start=W),T&&(I||!y)&&(T.stats.parsing.start=W);var Y=new K.TransmuxState(D,y,A,j,m);if(!y||D){G.logger.log("[transmuxer-interface, "+S.type+"]: Starting new transmux session for sn: "+w.sn+" p: "+w.part+" level: "+w.level+" id: "+w.id+` discontinuity: `+D+` trackSwitch: `+j+` contiguous: `+y+` accurateTimeOffset: `+A+` timeOffset: `+m);var ie=new K.TransmuxConfig(c,O,l,R,x);this.configureTransmuxer(ie)}if(this.frag=S,this.part=T,b)b.postMessage({cmd:"demux",data:a,decryptdata:E,chunkMeta:w,state:Y},a instanceof ArrayBuffer?[a]:[]);else if(u){var se=u.push(a,E,w,Y);Object(K.isPromise)(se)?se.then(function(xe){_.handleTransmuxComplete(xe)}):this.handleTransmuxComplete(se)}},d.flush=function(a){var l=this;a.transmuxing.start=self.performance.now();var c=this.transmuxer,O=this.worker;if(O)O.postMessage({cmd:"flush",chunkMeta:a});else if(c){var S=c.flush(a);Object(K.isPromise)(S)?S.then(function(T){l.handleFlushResult(T,a)}):this.handleFlushResult(S,a)}},d.handleFlushResult=function(a,l){var c=this;a.forEach(function(O){c.handleTransmuxComplete(O)}),this.onFlush(l)},d.onWorkerMessage=function(a){var l=a.data,c=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,c.trigger(l.event,l.data);break}}},d.configureTransmuxer=function(a){var l=this.worker,c=this.transmuxer;l?l.postMessage({cmd:"configure",config:a}):c&&c.configure(a)},d.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},o}()},"./src/demux/transmuxer-worker.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return M});var Q=P("./src/demux/transmuxer.ts"),B=P("./src/events.ts"),F=P("./src/utils/logger.ts"),K=P("./node_modules/eventemitter3/index.js"),G=P.n(K);function M(h){var o=new K.EventEmitter,d=function(a,l){h.postMessage({event:a,data:l})};o.on(B.Events.FRAG_DECRYPTED,d),o.on(B.Events.ERROR,d),h.addEventListener("message",function(s){var a=s.data;switch(a.cmd){case"init":{var l=JSON.parse(a.config);h.transmuxer=new Q.default(o,a.typeSupported,l,a.vendor,a.id),Object(F.enableLogs)(l.debug),d("init",null);break}case"configure":{h.transmuxer.configure(a.config);break}case"demux":{var c=h.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(Q.isPromise)(c)?c.then(function(T){L(h,T)}):L(h,c);break}case"flush":{var O=a.chunkMeta,S=h.transmuxer.flush(O);Object(Q.isPromise)(S)?S.then(function(T){p(h,T,O)}):p(h,S,O);break}default:break}})}function L(h,o){if(f(o.remuxResult))return;var d=[],s=o.remuxResult,a=s.audio,l=s.video;a&&g(d,a),l&&g(d,l),h.postMessage({event:"transmuxComplete",data:o},d)}function g(h,o){o.data1&&h.push(o.data1.buffer),o.data2&&h.push(o.data2.buffer)}function p(h,o,d){o.forEach(function(s){L(h,s)}),h.postMessage({event:"flush",data:d})}function f(h){return!h.audio&&!h.video&&!h.text&&!h.id3&&!h.initSegment}},"./src/demux/transmuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return l}),P.d(Z,"isPromise",function(){return S}),P.d(Z,"TransmuxConfig",function(){return T}),P.d(Z,"TransmuxState",function(){return R});var Q=P("./src/events.ts"),B=P("./src/errors.ts"),F=P("./src/crypt/decrypter.ts"),K=P("./src/demux/aacdemuxer.ts"),G=P("./src/demux/mp4demuxer.ts"),M=P("./src/demux/tsdemuxer.ts"),L=P("./src/demux/mp3demuxer.ts"),g=P("./src/remux/mp4-remuxer.ts"),p=P("./src/remux/passthrough-remuxer.ts"),f=P("./src/demux/chunk-cache.ts"),h=P("./src/utils/mp4-tools.ts"),o=P("./src/utils/logger.ts"),d;try{d=self.performance.now.bind(self.performance)}catch(A){o.logger.debug("Unable to use Performance API on this environment"),d=self.Date.now}var s=[{demux:M.default,remux:g.default},{demux:G.default,remux:p.default},{demux:K.default,remux:g.default},{demux:L.default,remux:g.default}],a=1024;s.forEach(function(A){var w=A.demux;a=Math.max(a,w.minProbeByteLength)});var l=function(){function A(x,_,u,b,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=x,this.typeSupported=_,this.config=u,this.vendor=b,this.id=m}var w=A.prototype;return w.configure=function(_){this.transmuxConfig=_,this.decrypter&&this.decrypter.reset()},w.push=function(_,u,b,m){var E=this,N=b.transmuxing;N.executeStart=d();var D=new Uint8Array(_),j=this.cache,H=this.config,I=this.currentTransmuxState,y=this.transmuxConfig;m&&(this.currentTransmuxState=m);var W=c(D,u);if(W&&W.method==="AES-128"){var Y=this.getDecrypter();if(H.enableSoftwareAES){var ie=Y.softwareDecrypt(D,W.key.buffer,W.iv.buffer);if(!ie)return N.executeEnd=d(),O(b);D=new Uint8Array(ie)}else return this.decryptionPromise=Y.webCryptoDecrypt(D,W.key.buffer,W.iv.buffer).then(function(Le){var Me=E.push(Le,null,b);return E.decryptionPromise=null,Me}),this.decryptionPromise}var se=m||I,xe=se.contiguous,me=se.discontinuity,Te=se.trackSwitch,Se=se.accurateTimeOffset,we=se.timeOffset,fe=y.audioCodec,le=y.videoCodec,te=y.defaultInitPts,he=y.duration,ae=y.initSegmentData;if((me||Te)&&this.resetInitSegment(ae,fe,le,he),me&&this.resetInitialTimestamp(te),xe||this.resetContiguity(),this.needsProbing(D,me,Te)){if(j.dataLength){var Oe=j.flush();D=Object(h.appendUint8Array)(Oe,D)}this.configureTransmuxer(D,y)}var Ie=this.transmux(D,W,we,Se,b),Ce=this.currentTransmuxState;return Ce.contiguous=!0,Ce.discontinuity=!1,Ce.trackSwitch=!1,N.executeEnd=d(),Ie},w.flush=function(_){var u=this,b=_.transmuxing;b.executeStart=d();var m=this.decrypter,E=this.cache,N=this.currentTransmuxState,D=this.decryptionPromise;if(D)return D.then(function(){return u.flush(_)});var j=[],H=N.timeOffset;if(m){var I=m.flush();I&&j.push(this.push(I,null,_))}var y=E.dataLength;E.reset();var W=this.demuxer,Y=this.remuxer;if(!W||!Y)return y>=a&&this.observer.emit(Q.Events.ERROR,Q.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=d(),[O(_)];var ie=W.flush(H);return S(ie)?ie.then(function(se){return u.flushRemux(j,se,_),j}):(this.flushRemux(j,ie,_),j)},w.flushRemux=function(_,u,b){var m=u.audioTrack,E=u.avcTrack,N=u.id3Track,D=u.textTrack,j=this.currentTransmuxState,H=j.accurateTimeOffset,I=j.timeOffset;o.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var y=this.remuxer.remux(m,E,N,D,I,H,!0,this.id);_.push({remuxResult:y,chunkMeta:b}),b.transmuxing.executeEnd=d()},w.resetInitialTimestamp=function(_){var u=this.demuxer,b=this.remuxer;if(!u||!b)return;u.resetTimeStamp(_),b.resetTimeStamp(_)},w.resetContiguity=function(){var _=this.demuxer,u=this.remuxer;if(!_||!u)return;_.resetContiguity(),u.resetNextTimestamp()},w.resetInitSegment=function(_,u,b,m){var E=this.demuxer,N=this.remuxer;if(!E||!N)return;E.resetInitSegment(u,b,m),N.resetInitSegment(_,u,b)},w.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},w.transmux=function(_,u,b,m,E){var N;return u&&u.method==="SAMPLE-AES"?N=this.transmuxSampleAes(_,u,b,m,E):N=this.transmuxUnencrypted(_,b,m,E),N},w.transmuxUnencrypted=function(_,u,b,m){var E=this.demuxer.demux(_,u,!1,!this.config.progressive),N=E.audioTrack,D=E.avcTrack,j=E.id3Track,H=E.textTrack,I=this.remuxer.remux(N,D,j,H,u,b,!1,this.id);return{remuxResult:I,chunkMeta:m}},w.transmuxSampleAes=function(_,u,b,m,E){var N=this;return this.demuxer.demuxSampleAes(_,u,b).then(function(D){var j=N.remuxer.remux(D.audioTrack,D.avcTrack,D.id3Track,D.textTrack,b,m,!1,N.id);return{remuxResult:j,chunkMeta:E}})},w.configureTransmuxer=function(_,u){for(var b=this.config,m=this.observer,E=this.typeSupported,N=this.vendor,D=u.audioCodec,j=u.defaultInitPts,H=u.duration,I=u.initSegmentData,y=u.videoCodec,W,Y=0,ie=s.length;Y0&&w!=null&&w.key!=null&&w.iv!==null&&w.method!=null&&(x=w),x}var O=function(w){return{remuxResult:{},chunkMeta:w}};function S(A){return"then"in A&&A.then instanceof Function}var T=function(w,x,_,u,b){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=w,this.videoCodec=x,this.initSegmentData=_,this.duration=u,this.defaultInitPts=b},R=function(w,x,_,u,b){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=w,this.contiguous=x,this.accurateTimeOffset=_,this.trackSwitch=u,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"discardEPB",function(){return O});var Q=P("./src/demux/adts.ts"),B=P("./src/demux/mpegaudio.ts"),F=P("./src/demux/exp-golomb.ts"),K=P("./src/demux/id3.ts"),G=P("./src/demux/sample-aes.ts"),M=P("./src/events.ts"),L=P("./src/utils/mp4-tools.ts"),g=P("./src/utils/logger.ts"),p=P("./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},h=function(){function S(R,A,w){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=R,this.config=A,this.typeSupported=w}S.probe=function(A){var w=S.syncOffset(A);return w<0?!1:(w&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+w+", junk ahead ?"),!0)},S.syncOffset=function(A){for(var w=Math.min(1e3,A.length-3*188),x=0;x>4,fe=void 0;if(we>1){if(fe=me+5+A[me+4],fe===me+188)continue}else fe=me+4;switch(Se){case N:Te&&(D&&(u=a(D))&&this.parseAVCPES(u,!1),D={data:[],size:0}),D&&(D.data.push(A.subarray(fe,me+188)),D.size+=me+188-fe);break;case j:Te&&(I&&(u=a(I))&&(m.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),I={data:[],size:0}),I&&(I.data.push(A.subarray(fe,me+188)),I.size+=me+188-fe);break;case H:Te&&(y&&(u=a(y))&&this.parseID3PES(u),y={data:[],size:0}),y&&(y.data.push(A.subarray(fe,me+188)),y.size+=me+188-fe);break;case 0:Te&&(fe+=A[fe]+1),ie=this._pmtId=d(A,fe);break;case ie:{Te&&(fe+=A[fe]+1);var le=s(A,fe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,x);N=le.avc,N>0&&(b.pid=N),j=le.audio,j>0&&(m.pid=j,m.isAAC=le.isAAC),H=le.id3,H>0&&(E.pid=H),W&&!Y&&(g.logger.log("reparse from beginning"),W=!1,me=xe-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:W=!0;break}}else this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=D,m.pesData=I,E.pesData=y;var te={audioTrack:m,avcTrack:b,id3Track:E,textTrack:this._txtTrack};return _&&this.extractRemainingSamples(te),te},T.flush=function(){var A=this.remainderData;this.remainderData=null;var w;return A?w=this.demux(A,-1,!1,!0):w={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(w),this.sampleAes?this.decrypt(w,this.sampleAes):w},T.extractRemainingSamples=function(A){var w=A.audioTrack,x=A.avcTrack,_=A.id3Track,u=x.pesData,b=w.pesData,m=_.pesData,E;u&&(E=a(u))?(this.parseAVCPES(E,!0),x.pesData=null):x.pesData=u,b&&(E=a(b))?(w.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),w.pesData=null):(b!=null&&b.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),w.pesData=b),m&&(E=a(m))?(this.parseID3PES(E),_.pesData=null):_.pesData=m},T.demuxSampleAes=function(A,w,x){var _=this.demux(A,x,!0,!this.config.progressive),u=this.sampleAes=new G.default(this.observer,this.config,w);return this.decrypt(_,u)},T.decrypt=function(A,w){return new Promise(function(x){var _=A.audioTrack,u=A.avcTrack;_.samples&&_.isAAC?w.decryptAacSamples(_.samples,0,function(){u.samples?w.decryptAvcSamples(u.samples,0,0,function(){x(A)}):x(A)}):u.samples&&w.decryptAvcSamples(u.samples,0,0,function(){x(A)})})},T.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},T.parseAVCPES=function(A,w){var x=this,_=this._avcTrack,u=this.parseAVCNALu(A.data),b=!1,m=this.avcSample,E,N=!1;A.data=null,m&&u.length&&!_.audFound&&(l(m,_),m=this.avcSample=o(!1,A.pts,A.dts,"")),u.forEach(function(D){switch(D.type){case 1:{E=!0,m||(m=x.avcSample=o(!0,A.pts,A.dts,"")),b&&(m.debug+="NDR "),m.frame=!0;var j=D.data;if(N&&j.length>4){var H=new F.default(j).readSliceType();(H===2||H===4||H===7||H===9)&&(m.key=!0)}break}case 5:E=!0,m||(m=x.avcSample=o(!0,A.pts,A.dts,"")),b&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{E=!0,b&&m&&(m.debug+="SEI ");var I=new F.default(O(D.data));I.readUByte();for(var y=0,W=0,Y=!1,ie=0;!Y&&I.bytesAvailable>1;){y=0;do ie=I.readUByte(),y+=ie;while(ie===255);W=0;do ie=I.readUByte(),W+=ie;while(ie===255);if(y===4&&I.bytesAvailable!==0){Y=!0;var se=I.readUByte();if(se===181){var xe=I.readUShort();if(xe===49){var me=I.readUInt();if(me===1195456820){var Te=I.readUByte();if(Te===3){for(var Se=I.readUByte(),we=I.readUByte(),fe=31&Se,le=[Se,we],te=0;te16){for(var he=[],ae=0;ae<16;ae++)he.push(I.readUByte().toString(16)),(ae===3||ae===5||ae===7||ae===9)&&he.push("-");for(var Oe=W-16,Ie=new Uint8Array(Oe),Ce=0;Ce=0){var I={data:A.subarray(j,m-_-1),type:H};b.push(I)}else{var y=this.getLastNalUnit();if(y&&(u&&m<=4-u&&(y.state&&(y.data=y.data.subarray(0,y.data.byteLength-u))),N=m-_-1,N>0)){var W=new Uint8Array(y.data.byteLength+N);W.set(y.data,0),W.set(A.subarray(0,N),y.data.byteLength),y.data=W,y.state=0}}m=0&&_>=0){var Y={data:A.subarray(j,w),type:H,state:_};b.push(Y)}if(b.length===0){var ie=this.getLastNalUnit();if(ie){var se=new Uint8Array(ie.data.byteLength+A.byteLength);se.set(ie.data,0),se.set(A,ie.data.byteLength),ie.data=se}}return x.naluState=_,b},T.parseAACPES=function(A){var w=0,x=this._audioTrack,_=this.aacOverFlow,u=A.data;if(_){this.aacOverFlow=null;var b=_.sample.unit.byteLength,m=Math.min(_.missing,b),E=b-m;_.sample.unit.set(u.subarray(0,m),E),x.samples.push(_.sample),w=_.missing}var N,D;for(N=w,D=u.length;N1;){var b=new Uint8Array(u[0].length+u[1].length);b.set(u[0]),b.set(u[1],u[0].length),u[0]=b,u.splice(1,1)}R=u[0];var m=(R[0]<<16)+(R[1]<<8)+R[2];if(m===1){if(A=(R[4]<<8)+R[5],A&&A>S.size-6)return null;var E=R[7];E&192&&(x=(R[9]&14)*536870912+(R[10]&255)*4194304+(R[11]&254)*16384+(R[12]&255)*128+(R[13]&254)/2,E&64?(_=(R[14]&14)*536870912+(R[15]&255)*4194304+(R[16]&254)*16384+(R[17]&255)*128+(R[18]&254)/2,x-_>60*9e4&&(g.logger.warn(Math.round((x-_)/9e4)+"s delta between PTS and DTS, align them"),x=_)):_=x),w=R[8];var N=w+9;if(S.size<=N)return null;S.size-=N;for(var D=new Uint8Array(S.size),j=0,H=u.length;jI){N-=I;continue}else R=R.subarray(N),I-=N,N=0;D.set(R,T),T+=I}return A&&(A-=w+3),{data:D,pts:x,dts:_,len:A}}return null}function l(S,T){if(S.units.length&&S.frame){if(S.pts===void 0){var R=T.samples,A=R.length;if(A){var w=R[A-1];S.pts=w.pts,S.dts=w.dts}else{T.dropped++;return}}T.samples.push(S)}S.debug.length&&g.logger.log(S.pts+"/"+S.dts+":"+S.debug)}function c(S,T){var R=S.length;if(R>0){if(T.pts>=S[R-1].pts)S.push(T);else for(var A=R-1;A>=0;A--)if(T.ptsx)return u;return 0}},{key:"maxAutoLevel",get:function(){var w=this.levels,x=this.autoLevelCapping,_;return x===-1&&w&&w.length?_=w.length-1:_=x,_}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(w){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,w)}},{key:"audioTracks",get:function(){var w=this.audioTrackController;return w?w.audioTracks:[]}},{key:"audioTrack",get:function(){var w=this.audioTrackController;return w?w.audioTrack:-1},set:function(w){var x=this.audioTrackController;x&&(x.audioTrack=w)}},{key:"subtitleTracks",get:function(){var w=this.subtitleTrackController;return w?w.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var w=this.subtitleTrackController;return w?w.subtitleTrack:-1},set:function(w){var x=this.subtitleTrackController;x&&(x.subtitleTrack=w)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var w=this.subtitleTrackController;return w?w.subtitleDisplay:!1},set:function(w){var x=this.subtitleTrackController;x&&(x.subtitleDisplay=w)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(w){this.config.lowLatencyMode=w}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return T.defaultConfig?T.defaultConfig:o.hlsDefaultConfig},set:function(w){T.defaultConfig=w}}]),T}();S.defaultConfig=void 0},"./src/is-supported.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"isSupported",function(){return F}),P.d(Z,"changeTypeSupported",function(){return K});var Q=P("./src/utils/mediasource-helper.ts");function B(){return self.SourceBuffer||self.WebKitSourceBuffer}function F(){var G=Object(Q.getMediaSource)();if(!G)return!1;var M=B(),L=G&&typeof G.isTypeSupported=="function"&&G.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!M||M.prototype&&typeof M.prototype.appendBuffer=="function"&&typeof M.prototype.remove=="function";return!!L&&!!g}function K(){var G,M=B();return typeof(M==null||((G=M.prototype)===null||G===void 0)?void 0:G.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h}),P.d(Z,"LoadError",function(){return d});var Q=P("./src/polyfills/number.ts"),B=P("./src/errors.ts");function F(s,a){s.prototype=Object.create(a.prototype),s.prototype.constructor=s,g(s,a)}function K(s){var a=typeof Map=="function"?new Map:void 0;return K=function(c){if(c===null||!L(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(c))return a.get(c);a.set(c,O)}function O(){return G(c,arguments,p(this).constructor)}return O.prototype=Object.create(c.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),g(O,c)},K(s)}function G(s,a,l){return M()?G=Reflect.construct:G=function(O,S,T){var R=[null];R.push.apply(R,S);var A=Function.bind.apply(O,R),w=new A;return T&&g(w,T.prototype),w},G.apply(null,arguments)}function M(){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 L(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function g(s,a){return g=Object.setPrototypeOf||function(c,O){return c.__proto__=O,c},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),h=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(c,O){var S=this,T=c.url;if(!T)return Promise.reject(new d({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(T?"part list":"url")));this.abort();var R=this.config,A=R.fLoader,w=R.loader;return new Promise(function(x,_){S.loader&&S.loader.destroy();var u=S.loader=c.loader=A?new A(R):new w(R),b=o(c),m={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:f};c.stats=u.stats,u.load(b,m,{onSuccess:function(N,D,j,H){S.resetLoader(c,u),x({frag:c,part:null,payload:N.data,networkDetails:H})},onError:function(N,D,j){S.resetLoader(c,u),_(new d({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:N,networkDetails:j}))},onAbort:function(N,D,j){S.resetLoader(c,u),_(new d({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:j}))},onTimeout:function(N,D,j){S.resetLoader(c,u),_(new d({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:j}))},onProgress:function(N,D,j,H){O&&O({frag:c,part:null,payload:j,networkDetails:H})}})})},a.loadPart=function(c,O,S){var T=this;this.abort();var R=this.config,A=R.fLoader,w=R.loader;return new Promise(function(x,_){T.loader&&T.loader.destroy();var u=T.loader=c.loader=A?new A(R):new w(R),b=o(c,O),m={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:f};O.stats=u.stats,u.load(b,m,{onSuccess:function(N,D,j,H){T.resetLoader(c,u),T.updateStatsFromPart(c,O);var I={frag:c,part:O,payload:N.data,networkDetails:H};S(I),x(I)},onError:function(N,D,j){T.resetLoader(c,u),_(new d({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:O,response:N,networkDetails:j}))},onAbort:function(N,D,j){c.stats.aborted=O.stats.aborted,T.resetLoader(c,u),_(new d({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:O,networkDetails:j}))},onTimeout:function(N,D,j){T.resetLoader(c,u),_(new d({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:O,networkDetails:j}))}})})},a.updateStatsFromPart=function(c,O){var S=c.stats,T=O.stats,R=T.total;if(S.loaded+=T.loaded,R){var A=Math.round(c.duration/O.duration),w=Math.min(Math.round(S.loaded/R),A),x=A-w,_=x*Math.round(S.loaded/w);S.total=S.loaded+_}else S.total=Math.max(S.loaded,S.total);var u=S.loading,b=T.loading;u.start?u.first+=b.first-b.start:(u.start=b.start,u.first=b.first),u.end=b.end},a.resetLoader=function(c,O){c.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,c={frag:s,part:a,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},O=l.byteRangeStartOffset,S=l.byteRangeEndOffset;return Object(Q.isFiniteNumber)(O)&&Object(Q.isFiniteNumber)(S)&&(c.rangeStart=O,c.rangeEnd=S),c}var d=function(s){F(a,s);function a(l){for(var c,O=arguments.length,S=new Array(O>1?O-1:0),T=1;T>8*(15-R)&255;return T},c.setDecryptDataFromLevelKey=function(S,T){var R=S;return(S==null?void 0:S.method)==="AES-128"&&S.uri&&!S.iv&&(R=G.LevelKey.fromURI(S.uri),R.method=S.method,R.iv=this.createInitializationVector(T),R.keyFormat="identity"),R},c.setElementaryStreamInfo=function(S,T,R,A,w,x){x===void 0&&(x=!1);var _=this.elementaryStreams,u=_[S];if(!u){_[S]={startPTS:T,endPTS:R,startDTS:A,endDTS:w,partial:x};return}u.startPTS=Math.min(u.startPTS,T),u.endPTS=Math.max(u.endPTS,R),u.startDTS=Math.min(u.startDTS,A),u.endDTS=Math.max(u.endDTS,w)},c.clearElementaryStreamInfo=function(){var S=this.elementaryStreams;S[h.AUDIO]=null,S[h.VIDEO]=null,S[h.AUDIOVIDEO]=null},f(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var S=this.sn;typeof S!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&K.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),S=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,S)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Q.isFiniteNumber)(this.programDateTime))return null;var S=Object(Q.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+S*1e3}},{key:"encrypted",get:function(){var S;return!!((S=this.decryptdata)!==null&&S!==void 0&&S.keyFormat&&this.decryptdata.uri)}}]),l}(o),s=function(a){L(l,a);function l(c,O,S,T,R){var A;A=a.call(this,S)||this,A.fragOffset=0,A.duration=0,A.gap=!1,A.independent=!1,A.relurl=void 0,A.fragment=void 0,A.index=void 0,A.stats=new M.LoadStats,A.duration=c.decimalFloatingPoint("DURATION"),A.gap=c.bool("GAP"),A.independent=c.bool("INDEPENDENT"),A.relurl=c.enumeratedString("URI"),A.fragment=O,A.index=T;var w=c.enumeratedString("BYTERANGE");return w&&A.setByteRange(w,R),R&&(A.fragOffset=R.fragOffset+R.duration),A}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(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return K});var Q=P("./src/events.ts"),B=P("./src/errors.ts"),F=P("./src/utils/logger.ts"),K=function(){function G(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var M=G.prototype;return M._registerListeners=function(){this.hls.on(Q.Events.KEY_LOADING,this.onKeyLoading,this)},M._unregisterListeners=function(){this.hls.off(Q.Events.KEY_LOADING,this.onKeyLoading)},M.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var p=this.loaders[g];p&&p.destroy()}this.loaders={}},M.onKeyLoading=function(g,p){var f=p.frag,h=f.type,o=this.loaders[h];if(!f.decryptdata){F.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var d=f.decryptdata.uri;if(d!==this.decrypturl||this.decryptkey===null){var s=this.hls.config;if(o&&(F.logger.warn("abort previous key loader for type:"+h),o.abort()),!d){F.logger.warn("key uri is falsy");return}var a=s.loader,l=f.loader=this.loaders[h]=new a(s);this.decrypturl=d,this.decryptkey=null;var c={url:d,frag:f,responseType:"arraybuffer"},O={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(c,O,S)}else this.decryptkey&&(f.decryptdata.key=this.decryptkey,this.hls.trigger(Q.Events.KEY_LOADED,{frag:f}))},M.loadsuccess=function(g,p,f){var h=f.frag;if(!h.decryptdata){F.logger.error("after key load, decryptdata unset");return}this.decryptkey=h.decryptdata.key=new Uint8Array(g.data),h.loader=null,delete this.loaders[h.type],this.hls.trigger(Q.Events.KEY_LOADED,{frag:h})},M.loaderror=function(g,p){var f=p.frag,h=f.loader;h&&h.abort(),delete this.loaders[f.type],this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:f,response:g})},M.loadtimeout=function(g,p){var f=p.frag,h=f.loader;h&&h.abort(),delete this.loaders[f.type],this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:f})},G}()},"./src/loader/level-details.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"LevelDetails",function(){return G});var Q=P("./src/polyfills/number.ts");function B(M,L){for(var g=0;gp.endSN||f>0||f===0&&h>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},F(M,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Q.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||K}},{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}}]),M}()},"./src/loader/level-key.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"LevelKey",function(){return G});var Q=P("./node_modules/url-toolkit/src/url-toolkit.js"),B=P.n(Q);function F(M,L){for(var g=0;g2){var _=x.shift()+".";return _+=parseInt(x.shift()).toString(16),_+=("000"+parseInt(x.shift()).toString(16)).substr(-4),_}return w},R.resolve=function(w,x){return B.buildAbsoluteURL(x,w,{alwaysNormalize:!0})},R.parseMasterPlaylist=function(w,x){var _=[],u={},b=!1;f.lastIndex=0;for(var m;(m=f.exec(w))!=null;)if(m[1]){var E=new L.AttrList(m[1]),N={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:R.resolve(m[2],x)},D=E.decimalResolution("RESOLUTION");D&&(N.width=D.width,N.height=D.height),c((E.CODECS||"").split(/[ ,]+/).filter(function(H){return H}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=R.convertAVC1ToAVCOTI(N.videoCodec)),_.push(N)}else if(m[3]){var j=new L.AttrList(m[3]);j["DATA-ID"]&&(b=!0,u[j["DATA-ID"]]=j)}return{levels:_,sessionData:b?u:null}},R.parseMasterPlaylistMedia=function(w,x,_,u){u===void 0&&(u=[]);var b,m=[],E=0;for(h.lastIndex=0;(b=h.exec(w))!==null;){var N=new L.AttrList(b[1]);if(N.TYPE===_){var D={attrs:N,bitrate:0,id:E++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:_,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?R.resolve(N.URI,x):""};if(u.length){var j=R.findGroup(u,D.groupId)||u[0];O(D,j,"audioCodec"),O(D,j,"textCodec")}m.push(D)}}return m},R.parseLevelPlaylist=function(w,x,_,u,b){var m=new G.LevelDetails(x),E=m.fragments,N=null,D=0,j=0,H=0,I=0,y=null,W=new K.Fragment(u,x),Y,ie,se,xe=-1,me=!1;for(o.lastIndex=0,m.m3u8=w;(Y=o.exec(w))!==null;){me&&(me=!1,W=new K.Fragment(u,x),W.start=H,W.sn=D,W.cc=I,W.level=_,N&&(W.initSegment=N,W.rawProgramDateTime=N.rawProgramDateTime));var Te=Y[1];if(Te){W.duration=parseFloat(Te);var Se=(" "+Y[2]).slice(1);W.title=Se||null,W.tagList.push(Se?["INF",Te,Se]:["INF",Te])}else if(Y[3])Object(Q.isFiniteNumber)(W.duration)&&(W.start=H,se&&(W.levelkey=se),W.sn=D,W.level=_,W.cc=I,W.urlId=b,E.push(W),W.relurl=(" "+Y[3]).slice(1),T(W,y),y=W,H+=W.duration,D++,j=0,me=!0);else if(Y[4]){var we=(" "+Y[4]).slice(1);y?W.setByteRange(we,y):W.setByteRange(we)}else if(Y[5])W.rawProgramDateTime=(" "+Y[5]).slice(1),W.tagList.push(["PROGRAM-DATE-TIME",W.rawProgramDateTime]),xe===-1&&(xe=E.length);else{if(Y=Y[0].match(d),!Y){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(ie=1;ie-1){g.logger.warn("Keyformat "+nt+" is not supported from the manifest");continue}else if(nt!=="identity")continue;Me&&(se=M.LevelKey.fromURL(x,We),We&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Me)>=0&&(se.method=Me,se.keyFormat=nt,Fe&&(se.keyID=Fe),Ue&&(se.keyFormatVersions=Ue),se.iv=He));break}case"START":{var qe=new L.AttrList(le),Je=qe.decimalFloatingPoint("TIME-OFFSET");Object(Q.isFiniteNumber)(Je)&&(m.startTimeOffset=Je);break}case"MAP":{var ot=new L.AttrList(le);W.relurl=ot.URI,ot.BYTERANGE&&W.setByteRange(ot.BYTERANGE),W.level=_,W.sn="initSegment",se&&(W.levelkey=se),W.initSegment=null,N=W,me=!0;break}case"SERVER-CONTROL":{var Xe=new L.AttrList(le);m.canBlockReload=Xe.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Xe.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Xe.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Xe.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Xe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Qe=new L.AttrList(le);m.partTarget=Qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var De=m.partList;De||(De=m.partList=[]);var ut=j>0?De[De.length-1]:void 0,et=j++,ke=new K.Part(new L.AttrList(le),W,x,et,ut);De.push(ke),W.duration+=ke.duration;break}case"PRELOAD-HINT":{var Ge=new L.AttrList(le);m.preloadHint=Ge;break}case"RENDITION-REPORT":{var Ee=new L.AttrList(le);m.renditionReports=m.renditionReports||[],m.renditionReports.push(Ee);break}default:g.logger.warn("line parsed but not handled: "+Y);break}}}y&&!y.relurl?(E.pop(),H-=y.duration,m.partList&&(m.fragmentHint=y)):m.partList&&(T(W,y),W.cc=I,m.fragmentHint=W);var pe=E.length,_e=E[0],re=E[pe-1];if(H+=m.skippedSegments*m.targetduration,H>0&&pe&&re){m.averagetargetduration=H/pe;var ne=re.sn;m.endSN=ne!=="initSegment"?ne:0,_e&&(m.startCC=_e.cc,_e.initSegment||m.fragments.every(function(de){return de.relurl&&a(de.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),W=new K.Fragment(u,x),W.relurl=re.relurl,W.level=_,W.sn="initSegment",_e.initSegment=W,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(H+=m.fragmentHint.duration),m.totalduration=H,m.endCC=I,xe>0&&S(E,xe),m},R}();function c(R,A){["video","audio","text"].forEach(function(w){var x=R.filter(function(u){return Object(p.isCodecType)(u,w)});if(x.length){var _=x.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});A[w+"Codec"]=_.length>0?_[0]:x[0],R=R.filter(function(u){return x.indexOf(u)===-1})}}),A.unknownCodecs=R}function O(R,A,w){var x=A[w];x&&(R[w]=x)}function S(R,A){for(var w=R[A],x=A;x--;){var _=R[x];if(!_)return;_.programDateTime=w.programDateTime-_.duration*1e3,w=_}}function T(R,A){R.rawProgramDateTime?R.programDateTime=Date.parse(R.rawProgramDateTime):A!=null&&A.programDateTime&&(R.programDateTime=A.endProgramDateTime),Object(Q.isFiniteNumber)(R.programDateTime)||(R.programDateTime=null,R.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/polyfills/number.ts"),B=P("./src/events.ts"),F=P("./src/errors.ts"),K=P("./src/utils/logger.ts"),G=P("./src/utils/mp4-tools.ts"),M=P("./src/loader/m3u8-parser.ts"),L=P("./src/types/loader.ts"),g=P("./src/utils/attr-list.ts");function p(o){var d=o.type;switch(d){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function f(o,d){var s=o.url;return(s===void 0||s.indexOf("data:")===0)&&(s=d.url),s}var h=function(){function o(s){this.hls=void 0,this.loaders=Object.create(null),this.hls=s,this.registerListeners()}var d=o.prototype;return d.registerListeners=function(){var a=this.hls;a.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.unregisterListeners=function(){var a=this.hls;a.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.createInternalLoader=function(a){var l=this.hls.config,c=l.pLoader,O=l.loader,S=c||O,T=new S(l);return a.loader=T,this.loaders[a.type]=T,T},d.getInternalLoader=function(a){return this.loaders[a.type]},d.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},d.destroyInternalLoaders=function(){for(var a in this.loaders){var l=this.loaders[a];l&&l.destroy(),this.resetInternalLoader(a)}},d.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},d.onManifestLoading=function(a,l){var c=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},d.onLevelLoading=function(a,l){var c=l.id,O=l.level,S=l.url,T=l.deliveryDirectives;this.load({id:c,groupId:null,level:O,responseType:"text",type:L.PlaylistContextType.LEVEL,url:S,deliveryDirectives:T})},d.onAudioTrackLoading=function(a,l){var c=l.id,O=l.groupId,S=l.url,T=l.deliveryDirectives;this.load({id:c,groupId:O,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:S,deliveryDirectives:T})},d.onSubtitleTrackLoading=function(a,l){var c=l.id,O=l.groupId,S=l.url,T=l.deliveryDirectives;this.load({id:c,groupId:O,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:S,deliveryDirectives:T})},d.load=function(a){var l,c=this.hls.config,O=this.getInternalLoader(a);if(O){var S=O.context;if(S&&S.url===a.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),O.abort()}var T,R,A,w;switch(a.type){case L.PlaylistContextType.MANIFEST:T=c.manifestLoadingMaxRetry,R=c.manifestLoadingTimeOut,A=c.manifestLoadingRetryDelay,w=c.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:T=0,R=c.levelLoadingTimeOut;break;default:T=c.levelLoadingMaxRetry,R=c.levelLoadingTimeOut,A=c.levelLoadingRetryDelay,w=c.levelLoadingMaxRetryTimeout;break}if(O=this.createInternalLoader(a),(l=a.deliveryDirectives)!==null&&l!==void 0&&l.part){var x;if(a.type===L.PlaylistContextType.LEVEL&&a.level!==null?x=this.hls.levels[a.level].details:a.type===L.PlaylistContextType.AUDIO_TRACK&&a.id!==null?x=this.hls.audioTracks[a.id].details:a.type===L.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(x=this.hls.subtitleTracks[a.id].details),x){var _=x.partTarget,u=x.targetduration;_&&u&&(R=Math.min(Math.max(_*3,u*.8)*1e3,R))}}var b={timeout:R,maxRetry:T,retryDelay:A,maxRetryDelay:w,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};O.load(a,b,m)},d.loadsuccess=function(a,l,c,O){if(O===void 0&&(O=null),c.isSidxRequest){this.handleSidxRequest(a,c),this.handlePlaylistLoaded(a,l,c,O);return}this.resetInternalLoader(c.type);var S=a.data;if(S.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,c,"no EXTM3U delimiter",O);return}l.parsing.start=performance.now(),S.indexOf("#EXTINF:")>0||S.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,l,c,O):this.handleMasterPlaylist(a,l,c,O)},d.loaderror=function(a,l,c){c===void 0&&(c=null),this.handleNetworkError(l,c,!1,a)},d.loadtimeout=function(a,l,c){c===void 0&&(c=null),this.handleNetworkError(l,c,!0)},d.handleMasterPlaylist=function(a,l,c,O){var S=this.hls,T=a.data,R=f(a,c),A=M.default.parseMasterPlaylist(T,R),w=A.levels,x=A.sessionData;if(!w.length){this.handleManifestParsingError(a,c,"no level found in manifest",O);return}var _=w.map(function(D){return{id:D.attrs.AUDIO,audioCodec:D.audioCodec}}),u=w.map(function(D){return{id:D.attrs.SUBTITLES,textCodec:D.textCodec}}),b=M.default.parseMasterPlaylistMedia(T,R,"AUDIO",_),m=M.default.parseMasterPlaylistMedia(T,R,"SUBTITLES",u),E=M.default.parseMasterPlaylistMedia(T,R,"CLOSED-CAPTIONS");if(b.length){var N=b.some(function(D){return!D.url});!N&&w[0].audioCodec&&!w[0].attrs.AUDIO&&(K.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),b.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}S.trigger(B.Events.MANIFEST_LOADED,{levels:w,audioTracks:b,subtitles:m,captions:E,url:R,stats:l,networkDetails:O,sessionData:x})},d.handleTrackOrLevelPlaylist=function(a,l,c,O){var S=this.hls,T=c.id,R=c.level,A=c.type,w=f(a,c),x=Object(Q.isFiniteNumber)(T)?T:0,_=Object(Q.isFiniteNumber)(R)?R:x,u=p(c),b=M.default.parseLevelPlaylist(a.data,w,_,u,x);if(!b.fragments.length){S.trigger(B.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:w,reason:"no fragments found in level",level:typeof c.level=="number"?c.level:void 0});return}if(A===L.PlaylistContextType.MANIFEST){var m={attrs:new g.AttrList({}),bitrate:0,details:b,name:"",url:w};S.trigger(B.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:w,stats:l,networkDetails:O,sessionData:null})}if(l.parsing.end=performance.now(),b.needSidxRanges){var E,N=(E=b.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:N,isSidxRequest:!0,type:A,level:R,levelDetails:b,id:T,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=b,this.handlePlaylistLoaded(a,l,c,O)},d.handleSidxRequest=function(a,l){var c=Object(G.parseSegmentIndex)(new Uint8Array(a.data));if(!c)return;var O=c.references,S=l.levelDetails;O.forEach(function(T,R){var A=T.info,w=S.fragments[R];w.byteRange.length===0&&w.setByteRange(String(1+A.end-A.start)+"@"+String(A.start)),w.initSegment&&w.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},d.handleManifestParsingError=function(a,l,c,O){this.hls.trigger(B.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===L.PlaylistContextType.MANIFEST,url:a.url,reason:c,response:a,context:l,networkDetails:O})},d.handleNetworkError=function(a,l,c,O){c===void 0&&(c=!1),K.logger.warn("[playlist-loader]: A network "+(c?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var S=F.ErrorDetails.UNKNOWN,T=!1,R=this.getInternalLoader(a);switch(a.type){case L.PlaylistContextType.MANIFEST:S=c?F.ErrorDetails.MANIFEST_LOAD_TIMEOUT:F.ErrorDetails.MANIFEST_LOAD_ERROR,T=!0;break;case L.PlaylistContextType.LEVEL:S=c?F.ErrorDetails.LEVEL_LOAD_TIMEOUT:F.ErrorDetails.LEVEL_LOAD_ERROR,T=!1;break;case L.PlaylistContextType.AUDIO_TRACK:S=c?F.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:S=c?F.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:F.ErrorDetails.SUBTITLE_LOAD_ERROR,T=!1;break}R&&this.resetInternalLoader(a.type);var A={type:F.ErrorTypes.NETWORK_ERROR,details:S,fatal:T,url:a.url,loader:R,context:a,networkDetails:l};O&&(A.response=O),this.hls.trigger(B.Events.ERROR,A)},d.handlePlaylistLoaded=function(a,l,c,O){var S=c.type,T=c.level,R=c.id,A=c.groupId,w=c.loader,x=c.levelDetails,_=c.deliveryDirectives;if(!(x!=null&&x.targetduration)){this.handleManifestParsingError(a,c,"invalid target duration",O);return}if(!w)return;x.live&&(w.getCacheAge&&(x.ageHeader=w.getCacheAge()||0),(!w.getCacheAge||isNaN(x.ageHeader))&&(x.ageHeader=0));switch(S){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(B.Events.LEVEL_LOADED,{details:x,level:T||0,id:R||0,stats:l,networkDetails:O,deliveryDirectives:_});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(B.Events.AUDIO_TRACK_LOADED,{details:x,id:R||0,groupId:A||"",stats:l,networkDetails:O,deliveryDirectives:_});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(B.Events.SUBTITLE_TRACK_LOADED,{details:x,id:R||0,groupId:A||"",stats:l,networkDetails:O,deliveryDirectives:_});break}},o}();Z.default=h},"./src/polyfills/number.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"isFiniteNumber",function(){return Q}),P.d(Z,"MAX_SAFE_INTEGER",function(){return B});var Q=Number.isFinite||function(F){return typeof F=="number"&&isFinite(F)},B=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=function(){function B(){}return B.getSilentFrame=function(K,G){switch(K){case"mp4a.40.2":if(G===1)return new Uint8Array([0,200,0,128,35,128]);if(G===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(G===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(G===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(G===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(G===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(G===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(G===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(G===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},B}();Z.default=Q},"./src/remux/mp4-generator.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=Math.pow(2,32)-1,B=function(){function F(){}return F.init=function(){F.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 G;for(G in F.types)F.types.hasOwnProperty(G)&&(F.types[G]=[G.charCodeAt(0),G.charCodeAt(1),G.charCodeAt(2),G.charCodeAt(3)]);var M=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),L=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);F.HDLR_TYPES={video:M,audio:L};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),p=new Uint8Array([0,0,0,0,0,0,0,0]);F.STTS=F.STSC=F.STCO=p,F.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),F.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),F.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var f=new Uint8Array([105,115,111,109]),h=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);F.FTYP=F.box(F.types.ftyp,f,o,f,h),F.DINF=F.box(F.types.dinf,F.box(F.types.dref,g))},F.box=function(G){for(var M=8,L=arguments.length,g=new Array(L>1?L-1:0),p=1;p>24&255,o[1]=M>>16&255,o[2]=M>>8&255,o[3]=M&255,o.set(G,4),f=0,M=8;f>24&255,G>>16&255,G>>8&255,G&255,L>>24,L>>16&255,L>>8&255,L&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},F.mdia=function(G){return F.box(F.types.mdia,F.mdhd(G.timescale,G.duration),F.hdlr(G.type),F.minf(G))},F.mfhd=function(G){return F.box(F.types.mfhd,new Uint8Array([0,0,0,0,G>>24,G>>16&255,G>>8&255,G&255]))},F.minf=function(G){return G.type==="audio"?F.box(F.types.minf,F.box(F.types.smhd,F.SMHD),F.DINF,F.stbl(G)):F.box(F.types.minf,F.box(F.types.vmhd,F.VMHD),F.DINF,F.stbl(G))},F.moof=function(G,M,L){return F.box(F.types.moof,F.mfhd(G),F.traf(L,M))},F.moov=function(G){for(var M=G.length,L=[];M--;)L[M]=F.trak(G[M]);return F.box.apply(null,[F.types.moov,F.mvhd(G[0].timescale,G[0].duration)].concat(L).concat(F.mvex(G)))},F.mvex=function(G){for(var M=G.length,L=[];M--;)L[M]=F.trex(G[M]);return F.box.apply(null,[F.types.mvex].concat(L))},F.mvhd=function(G,M){M*=G;var L=Math.floor(M/(Q+1)),g=Math.floor(M%(Q+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,G>>24&255,G>>16&255,G>>8&255,G&255,L>>24,L>>16&255,L>>8&255,L&255,g>>24,g>>16&255,g>>8&255,g&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return F.box(F.types.mvhd,p)},F.sdtp=function(G){var M=G.samples||[],L=new Uint8Array(4+M.length),g,p;for(g=0;g>>8&255),M.push(f&255),M=M.concat(Array.prototype.slice.call(p));for(g=0;g>>8&255),L.push(f&255),L=L.concat(Array.prototype.slice.call(p));var h=F.box(F.types.avcC,new Uint8Array([1,M[3],M[4],M[5],252|3,224|G.sps.length].concat(M).concat([G.pps.length]).concat(L))),o=G.width,d=G.height,s=G.pixelRatio[0],a=G.pixelRatio[1];return F.box(F.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,d>>8&255,d&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]),h,F.box(F.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),F.box(F.types.pasp,new Uint8Array([s>>24,s>>16&255,s>>8&255,s&255,a>>24,a>>16&255,a>>8&255,a&255])))},F.esds=function(G){var M=G.config.length;return new Uint8Array([0,0,0,0,3,23+M,0,1,0,4,15+M,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([M]).concat(G.config).concat([6,1,2]))},F.mp4a=function(G){var M=G.samplerate;return F.box(F.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,G.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]),F.box(F.types.esds,F.esds(G)))},F.mp3=function(G){var M=G.samplerate;return F.box(F.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,G.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]))},F.stsd=function(G){return G.type==="audio"?!G.isAAC&&G.codec==="mp3"?F.box(F.types.stsd,F.STSD,F.mp3(G)):F.box(F.types.stsd,F.STSD,F.mp4a(G)):F.box(F.types.stsd,F.STSD,F.avc1(G))},F.tkhd=function(G){var M=G.id,L=G.duration*G.timescale,g=G.width,p=G.height,f=Math.floor(L/(Q+1)),h=Math.floor(L%(Q+1));return F.box(F.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,h>>24,h>>16&255,h>>8&255,h&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]))},F.traf=function(G,M){var L=F.sdtp(G),g=G.id,p=Math.floor(M/(Q+1)),f=Math.floor(M%(Q+1));return F.box(F.types.traf,F.box(F.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),F.box(F.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])),F.trun(G,L.length+16+20+8+16+8+8),L)},F.trak=function(G){return G.duration=G.duration||4294967295,F.box(F.types.trak,F.tkhd(G),F.mdia(G))},F.trex=function(G){var M=G.id;return F.box(F.types.trex,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},F.trun=function(G,M){var L=G.samples||[],g=L.length,p=12+16*g,f=new Uint8Array(p),h,o,d,s,a,l;for(M+=8+p,f.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255],0),h=0;h>>24&255,d>>>16&255,d>>>8&255,d&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*h);return F.box(F.types.trun,f)},F.initSegment=function(G){F.types||F.init();var M=F.moov(G),L=new Uint8Array(F.FTYP.byteLength+M.byteLength);return L.set(F.FTYP),L.set(M,F.FTYP.byteLength),L},F}();B.types=void 0,B.HDLR_TYPES=void 0,B.STTS=void 0,B.STSC=void 0,B.STCO=void 0,B.STSZ=void 0,B.VMHD=void 0,B.SMHD=void 0,B.STSD=void 0,B.FTYP=void 0,B.DINF=void 0,Z.default=B},"./src/remux/mp4-remuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return l}),P.d(Z,"normalizePts",function(){return c});var Q=P("./src/polyfills/number.ts"),B=P("./src/remux/aac-helper.ts"),F=P("./src/remux/mp4-generator.ts"),K=P("./src/events.ts"),G=P("./src/errors.ts"),M=P("./src/utils/logger.ts"),L=P("./src/types/loader.ts"),g=P("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(R){for(var A=1;A0?b:m.pts},x[0].pts);return _&&M.logger.debug("PTS rollover detected"),u},A.remux=function(x,_,u,b,m,E,N,D){var j,H,I,y,W,Y,ie=m,se=m,xe=x.pid>-1,me=_.pid>-1,Te=_.samples.length,Se=x.samples.length>0,we=Te>1,fe=(!xe||Se)&&(!me||we)||this.ISGenerated||N;if(fe){this.ISGenerated||(I=this.generateIS(x,_,m));var le=this.isVideoContiguous,te=-1;if(we&&(te=O(_.samples),!le&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,te>0){M.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Te+" video samples due to a missing keyframe");var he=this.getVideoStartPts(_.samples);_.samples=_.samples.slice(te),_.dropped+=te,se+=(_.samples[0].pts-he)/(_.timescale||9e4)}else te===-1&&(M.logger.warn("[mp4-remuxer]: No keyframe found out of "+Te+" video samples"),Y=!1);if(this.ISGenerated){if(Se&&we){var ae=this.getVideoStartPts(_.samples),Oe=c(x.samples[0].pts,ae)-ae,Ie=Oe/_.inputTimeScale;ie+=Math.max(0,Ie),se+=Math.max(0,-Ie)}if(Se){if(x.samplerate||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(x,_,m)),H=this.remuxAudio(x,ie,this.isAudioContiguous,E,me||we||D===L.PlaylistLevelType.AUDIO?se:void 0),we){var Ce=H?H.endPTS-H.startPTS:0;_.inputTimeScale||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(x,_,m)),j=this.remuxVideo(_,se,le,Ce)}}else we&&(j=this.remuxVideo(_,se,le,0));j&&(j.firstKeyFrame=te,j.independent=te!==-1)}}return this.ISGenerated&&(u.samples.length&&(W=this.remuxID3(u,m)),b.samples.length&&(y=this.remuxText(b,m))),{audio:H,video:j,initSegment:I,independent:Y,text:y,id3:W}},A.generateIS=function(x,_,u){var b=x.samples,m=_.samples,E=this.typeSupported,N={},D=!Object(Q.isFiniteNumber)(this._initPTS),j="audio/mp4",H,I,y;if(D&&(H=I=Infinity),x.config&&b.length&&(x.timescale=x.samplerate,x.isAAC||(E.mpeg?(j="audio/mpeg",x.codec=""):E.mp3&&(x.codec="mp3")),N.audio={id:"audio",container:j,codec:x.codec,initSegment:!x.isAAC&&E.mpeg?new Uint8Array(0):F.default.initSegment([x]),metadata:{channelCount:x.channelCount}},D&&(y=x.inputTimeScale,H=I=b[0].pts-Math.round(y*u))),_.sps&&_.pps&&m.length&&(_.timescale=_.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:_.codec,initSegment:F.default.initSegment([_]),metadata:{width:_.width,height:_.height}},D)){y=_.inputTimeScale;var W=this.getVideoStartPts(m),Y=Math.round(y*u);I=Math.min(I,c(m[0].dts,W)-Y),H=Math.min(H,W-Y)}if(Object.keys(N).length)return this.ISGenerated=!0,D&&(this._initPTS=H,this._initDTS=I),{tracks:N,initPTS:H,timescale:y}},A.remuxVideo=function(x,_,u,b){var m=x.inputTimeScale,E=x.samples,N=[],D=E.length,j=this._initPTS,H=this.nextAvcDts,I=8,y,W,Y,ie=Number.POSITIVE_INFINITY,se=Number.NEGATIVE_INFINITY,xe=0,me=!1;if(!u||H===null){var Te=_*m,Se=E[0].pts-c(E[0].dts,E[0].pts);H=Te-Se}for(var we=0;wefe.pts){var le=9e4*.2;xe=Math.max(Math.min(xe,fe.pts-fe.dts),-1*le)}fe.dts0?we-1:we].dts&&(me=!0)}me&&E.sort(function(Ct,xt){var ht=Ct.dts-xt.dts,Ut=Ct.pts-xt.pts;return ht||Ut}),W=E[0].dts,Y=E[E.length-1].dts;var te=Math.round((Y-W)/(D-1));if(xe<0){if(xete,Le=Ie<-1;if(Ce||Le){Ce?M.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Ie,!0)+" ms ("+Ie+"dts) hole between fragments detected, filling it"):M.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Ie,!0)+" ms ("+Ie+"dts) overlapping between fragments detected"),W=H;var Me=E[0].pts-Ie;E[0].dts=W,E[0].pts=Me,M.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(Me,!0)+"/"+Object(g.toMsFromMpegTsClock)(W,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(Ie,!0)+" ms")}}a&&(W=Math.max(0,W));for(var We=0,He=0,Ue=0;Ue0?De-1:De].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var ve=Math.floor(ne.maxBufferHole*m),be=(b?ie+b*m:this.nextAudioPts)-ut.pts;be>ve?(y=be-de,y<0&&(y=de),M.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+y/90+" ms for the last video frame.")):y=de}else y=de}var Pe=Math.round(ut.pts-ut.dts);N.push(new S(ut.key,y,ke,Pe))}if(N.length&&d&&d<70){var je=N[0].flags;je.dependsOn=2,je.isNonSync=0}console.assert(y!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=H=Y+y,this.isVideoContiguous=!0;var st=F.default.moof(x.sequenceNumber++,W,p({},x,{samples:N})),ct="video",ft={data1:st,data2:Xe,startPTS:ie/m,endPTS:(se+y)/m,startDTS:W/m,endDTS:H/m,type:ct,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:x.dropped};return x.samples=[],x.dropped=0,console.assert(Xe.length,"MDAT length must not be zero"),ft},A.remuxAudio=function(x,_,u,b,m){var E=x.inputTimeScale,N=x.samplerate?x.samplerate:E,D=E/N,j=x.isAAC?h:o,H=j*D,I=this._initPTS,y=!x.isAAC&&this.typeSupported.mpeg,W=[],Y=x.samples,ie=y?0:8,se=this.nextAudioPts||-1,xe=_*E;if(this.isAudioContiguous=u=u||Y.length&&se>0&&(b&&Math.abs(xe-se)<9e3||Math.abs(c(Y[0].pts-I,xe)-se)<20*H),Y.forEach(function(_e){_e.pts=c(_e.pts-I,xe)}),!u||se<0){if(Y=Y.filter(function(_e){return _e.pts>=0}),!Y.length)return;m===0?se=0:b?se=Math.max(0,xe):se=Y[0].pts}if(x.isAAC)for(var me=m!==void 0,Te=this.config.maxAudioFramesDrift,Se=0,we=se;Se=Te*H&&he0){He+=ie;try{We=new Uint8Array(He)}catch(_e){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:G.ErrorTypes.MUX_ERROR,details:G.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:He,reason:"fail allocating audio mdat "+He});return}if(!y){var Xe=new DataView(We.buffer);Xe.setUint32(0,He),We.set(F.default.types.mdat,4)}}else return;We.set(qe,ie);var Qe=qe.byteLength;ie+=Qe,W.push(new S(!0,j,Qe,0)),Me=Je}var De=W.length;if(!De)return;var ut=W[W.length-1];this.nextAudioPts=se=Me+D*ut.duration;var et=y?new Uint8Array(0):F.default.moof(x.sequenceNumber++,Le/D,p({},x,{samples:W}));x.samples=[];var ke=Le/E,Ge=se/E,Ee="audio",pe={data1:et,data2:We,startPTS:ke,endPTS:Ge,startDTS:ke,endDTS:Ge,type:Ee,hasAudio:!0,hasVideo:!1,nb:De};return this.isAudioContiguous=!0,console.assert(We.length,"MDAT length must not be zero"),pe},A.remuxEmptyAudio=function(x,_,u,b){var m=x.inputTimeScale,E=x.samplerate?x.samplerate:m,N=m/E,D=this.nextAudioPts,j=(D!==null?D:b.startDTS*m)+this._initDTS,H=b.endDTS*m+this._initDTS,I=N*h,y=Math.ceil((H-j)/I),W=B.default.getSilentFrame(x.manifestCodec||x.codec,x.channelCount);if(M.logger.warn("[mp4-remuxer]: remux empty Audio"),!W){M.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],ie=0;ie4294967296;)R+=w;return R}function O(R){for(var A=0;A0?this.lastEndDTS=x:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var _=!!R.audio,u=!!R.video,b="";_&&(b+="audio"),u&&(b+="video");var m={data1:S,startPTS:w,startDTS:w,endPTS:x,endDTS:x,type:b,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=d,O.initSegment=T,O},g}(),M=function(p,f,h){return Object(B.getStartDTS)(p,f)-h};function L(g,p){var f=g==null?void 0:g.codec;return f&&f.length>4?f:f==="hvc1"?"hvc1.1.c.L120.90":f==="av01"?"av01.0.04M.08":f==="avc1"||p===F.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=G},"./src/task-loop.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return Q});var Q=function(){function B(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var F=B.prototype;return F.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},F.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},F.onHandlerDestroyed=function(){},F.hasInterval=function(){return!!this._tickInterval},F.hasNextTick=function(){return!!this._tickTimer},F.setInterval=function(G){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,G),!0)},F.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},F.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},F.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},F.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},F.doTick=function(){},B}()},"./src/types/cmcd.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"CMCDVersion",function(){return Q}),P.d(Z,"CMCDObjectType",function(){return B}),P.d(Z,"CMCDStreamingFormat",function(){return F}),P.d(Z,"CMCDStreamType",function(){return K});var Q=1,B;(function(G){G.MANIFEST="m",G.AUDIO="a",G.VIDEO="v",G.MUXED="av",G.INIT="i",G.CAPTION="c",G.TIMED_TEXT="tt",G.KEY="k",G.OTHER="o"})(B||(B={}));var F;(function(G){G.DASH="d",G.HLS="h",G.SMOOTH="s",G.OTHER="o"})(F||(F={}));var K;(function(G){G.VOD="v",G.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"HlsSkip",function(){return F}),P.d(Z,"getSkipValue",function(){return K}),P.d(Z,"HlsUrlParameters",function(){return G}),P.d(Z,"Level",function(){return M});function Q(L,g){for(var p=0;pNumber.MAX_SAFE_INTEGER?Infinity:g},G.hexadecimalInteger=function(L){if(this[L]){var g=(this[L]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var p=new Uint8Array(g.length/2),f=0;fNumber.MAX_SAFE_INTEGER?Infinity:g},G.decimalFloatingPoint=function(L){return parseFloat(this[L])},G.optionalFloat=function(L,g){var p=this[L];return p?parseFloat(p):g},G.enumeratedString=function(L){return this[L]},G.bool=function(L){return this[L]==="YES"},G.decimalResolution=function(L){var g=Q.exec(this[L]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},K.parseAttrList=function(L){var g,p={},f='"';for(B.lastIndex=0;(g=B.exec(L))!==null;){var h=g[2];h.indexOf(f)===0&&h.lastIndexOf(f)===h.length-1&&(h=h.slice(1,-1)),p[g[1]]=h}return p},K}()},"./src/utils/binary-search.ts":function(ue,Z,P){"use strict";P.r(Z);var Q={search:function(F,K){for(var G=0,M=F.length-1,L=null,g=null;G<=M;){L=(G+M)/2|0,g=F[L];var p=K(g);if(p>0)G=L+1;else if(p<0)M=L-1;else return g}return null}};Z.default=Q},"./src/utils/buffer-helper.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"BufferHelper",function(){return F});var Q=P("./src/utils/logger.ts"),B={length:0,start:function(){return 0},end:function(){return 0}},F=function(){function K(){}return K.isBuffered=function(M,L){try{if(M){for(var g=K.getBuffered(M),p=0;p=g.start(p)&&L<=g.end(p))return!0}}catch(f){}return!1},K.bufferInfo=function(M,L,g){try{if(M){var p=K.getBuffered(M),f=[],h;for(h=0;ho&&(p[h-1].end=M[f].end):p.push(M[f])}else p.push(M[f])}else p=M;for(var d=0,s,a=L,l=L,c=0;c=O&&L=u&&Q.logger.log(this.time+" ["+u+"] "+b)},w}(),d=function(x){for(var _=[],u=0;uG&&(this.logger.log(h.DEBUG,"Too large cursor position "+this.pos),this.pos=G)},x.moveCursor=function(u){var b=this.pos+u;if(u>1)for(var m=this.pos+1;m=144&&this.backSpace();var b=F(u);if(this.pos>=G){this.logger.log(h.ERROR,"Cannot insert "+u.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},x.clearFromPos=function(u){var b;for(b=u;b0&&(u?m="["+b.join(" | ")+"]":m=b.join(` `)),m},x.getTextAndFormat=function(){return this.rows},w}(),O=function(){function w(_,u,b){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 c(b),this.nonDisplayedMemory=new c(b),this.lastOutputScreen=new c(b),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}var x=w.prototype;return x.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},x.getHandler=function(){return this.outputFilter},x.setHandler=function(u){this.outputFilter=u},x.setPAC=function(u){this.writeScreen.setPAC(u)},x.setBkgData=function(u){this.writeScreen.setBkgData(u)},x.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(h.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},x.insertChars=function(u){for(var b=0;b=46,b.italics)b.foreground="white";else{var m=Math.floor(u/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=E[m]}this.logger.log(h.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},x.outputDataUpdate=function(u){u===void 0&&(u=!1);var b=this.logger.time;if(b===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=b:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,b,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},x.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},w}(),S=function(){function w(_,u,b){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,b,m)],this.cmdHistory=A(),this.logger=m}var x=w.prototype;return x.getHandler=function(u){return this.channels[u].getHandler()},x.setHandler=function(u,b){this.channels[u].setHandler(b)},x.addData=function(u,b){var m,E,N,D=!1;this.logger.time=u;for(var j=0;j ("+d([E,N])+")"),m=this.parseCmd(E,N),m||(m=this.parseMidrow(E,N)),m||(m=this.parsePAC(E,N)),m||(m=this.parseBackgroundAttributes(E,N)),!m&&(D=this.parseChars(E,N),D)){var H=this.currentChannel;if(H&&H>0){var I=this.channels[H];I.insertChars(D)}else this.logger.log(h.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!D&&this.logger.log(h.WARNING,"Couldn't parse cleaned data "+d([E,N])+" orig: "+d([b[j],b[j+1]]))}},x.parseCmd=function(u,b){var m=this.cmdHistory,E=(u===20||u===28||u===21||u===29)&&b>=32&&b<=47,N=(u===23||u===31)&&b>=33&&b<=35;if(!(E||N))return!1;if(R(u,b,m))return T(null,null,m),this.logger.log(h.DEBUG,"Repeated command ("+d([u,b])+") is dropped"),!0;var D=u===20||u===21||u===23?1:2,j=this.channels[D];return u===20||u===21||u===28||u===29?b===32?j.ccRCL():b===33?j.ccBS():b===34?j.ccAOF():b===35?j.ccAON():b===36?j.ccDER():b===37?j.ccRU(2):b===38?j.ccRU(3):b===39?j.ccRU(4):b===40?j.ccFON():b===41?j.ccRDC():b===42?j.ccTR():b===43?j.ccRTD():b===44?j.ccEDM():b===45?j.ccCR():b===46?j.ccENM():b===47&&j.ccEOC():j.ccTO(b-32),T(u,b,m),this.currentChannel=D,!0},x.parseMidrow=function(u,b){var m=0;if((u===17||u===25)&&b>=32&&b<=47){if(u===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(h.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[m];return E?(E.ccMIDROW(b),this.logger.log(h.DEBUG,"MIDROW ("+d([u,b])+")"),!0):!1}return!1},x.parsePAC=function(u,b){var m,E=this.cmdHistory,N=(u>=17&&u<=23||u>=25&&u<=31)&&b>=64&&b<=127,D=(u===16||u===24)&&b>=64&&b<=95;if(!(N||D))return!1;if(R(u,b,E))return T(null,null,E),!0;var j=u<=23?1:2;b>=64&&b<=95?m=j===1?M[u]:g[u]:m=j===1?L[u]:p[u];var H=this.channels[j];return H?(H.setPAC(this.interpretPAC(m,b)),T(u,b,E),this.currentChannel=j,!0):!1},x.interpretPAC=function(u,b){var m,E={color:null,italics:!1,indent:null,underline:!1,row:u};return b>95?m=b-96:m=b-64,E.underline=(m&1)===1,m<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((m-16)/2)*4,E},x.parseChars=function(u,b){var m,E=null,N=null;if(u>=25?(m=2,N=u-8):(m=1,N=u),N>=17&&N<=19){var D;N===17?D=b+80:N===18?D=b+112:D=b+144,this.logger.log(h.INFO,"Special char '"+F(D)+"' in channel "+m),E=[D]}else u>=32&&u<=127&&(E=b===0?[u]:[u,b]);if(E){var j=d(E);this.logger.log(h.DEBUG,"Char codes = "+j.join(",")),T(u,b,this.cmdHistory)}return E},x.parseBackgroundAttributes=function(u,b){var m=(u===16||u===24)&&b>=32&&b<=47,E=(u===23||u===31)&&b>=45&&b<=47;if(!(m||E))return!1;var N,D={};u===16||u===24?(N=Math.floor((b-32)/2),D.background=f[N],b%2===1&&(D.background=D.background+"_semi")):b===45?D.background="transparent":(D.foreground="black",b===47&&(D.underline=!0));var j=u<=23?1:2,H=this.channels[j];return H.setBkgData(D),T(u,b,this.cmdHistory),!0},x.reset=function(){for(var u=0;u=16?a--:a++;var T=Object(Q.fixLineBreaks)(l.trim()),R=Object(B.generateCueId)(g,p,T);(!L||!L.cues||!L.cues.getCueById(R))&&(d=new c(g,p,T),d.id=R,d.line=O+1,d.align="left",d.position=10+Math.min(80,Math.floor(a*8/32)*10),h.push(d))}return L&&h.length&&(h.sort(function(A,w){return A.line==="auto"||w.line==="auto"?0:A.line>8&&w.line>8?w.line-A.line:A.line-w.line}),h.forEach(function(A){return Object(F.addCueToTrack)(L,A)})),h}};Z.default=G},"./src/utils/discontinuities.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"findFirstFragWithCC",function(){return K}),P.d(Z,"shouldAlignOnDiscontinuities",function(){return G}),P.d(Z,"findDiscontinuousReferenceFrag",function(){return M}),P.d(Z,"adjustSlidingStart",function(){return g}),P.d(Z,"alignStream",function(){return p}),P.d(Z,"alignPDT",function(){return h}),P.d(Z,"alignFragmentByPDTDelta",function(){return o}),P.d(Z,"alignMediaPlaylistByPDT",function(){return d});var Q=P("./src/polyfills/number.ts"),B=P("./src/utils/logger.ts"),F=P("./src/controller/level-helper.ts");function K(s,a){for(var l=null,c=0,O=s.length;cl.startCC||s&&s.cc=this.minWeight_},K.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},K.destroy=function(){},F}();Z.default=B},"./src/utils/ewma.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=function(){function B(K,G,M){G===void 0&&(G=0),M===void 0&&(M=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=K,this.alpha_=K?Math.exp(Math.log(.5)/K):0,this.estimate_=G,this.totalWeight_=M}var F=B.prototype;return F.sample=function(G,M){var L=Math.pow(this.alpha_,G);this.estimate_=M*(1-L)+L*this.estimate_,this.totalWeight_+=G},F.getTotalWeight=function(){return this.totalWeight_},F.getEstimate=function(){if(this.alpha_){var G=1-Math.pow(this.alpha_,this.totalWeight_);if(G)return this.estimate_/G}return this.estimate_},B}();Z.default=Q},"./src/utils/fetch-loader.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"fetchSupported",function(){return o});var Q=P("./src/polyfills/number.ts"),B=P("./src/loader/load-stats.ts"),F=P("./src/demux/chunk-cache.ts");function K(c,O){c.prototype=Object.create(O.prototype),c.prototype.constructor=c,p(c,O)}function G(c){var O=typeof Map=="function"?new Map:void 0;return G=function(T){if(T===null||!g(T))return T;if(typeof T!="function")throw new TypeError("Super expression must either be null or a function");if(typeof O!="undefined"){if(O.has(T))return O.get(T);O.set(T,R)}function R(){return M(T,arguments,f(this).constructor)}return R.prototype=Object.create(T.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),p(R,T)},G(c)}function M(c,O,S){return L()?M=Reflect.construct:M=function(R,A,w){var x=[null];x.push.apply(x,A);var _=Function.bind.apply(R,x),u=new _;return w&&p(u,w.prototype),u},M.apply(null,arguments)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(c){return!1}}function g(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function p(c,O){return p=Object.setPrototypeOf||function(T,R){return T.__proto__=R,T},p(c,O)}function f(c){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(S){return S.__proto__||Object.getPrototypeOf(S)},f(c)}function h(){return h=Object.assign||function(c){for(var O=1;O=w&&x(R,A,_.flush(),T)):x(R,A,N,T),m()}).catch(function(){return Promise.reject()})};return b()},c}();function s(c,O){var S={method:"GET",mode:"cors",credentials:"same-origin",signal:O,headers:new self.Headers(h({},c.headers))};return c.rangeEnd&&S.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),S}function a(c,O){return new self.Request(c.url,O)}var l=function(c){K(O,c);function O(S,T,R){var A;return A=c.call(this,S)||this,A.code=void 0,A.details=void 0,A.code=T,A.details=R,A}return O}(G(Error));Z.default=d},"./src/utils/imsc1-ttml-parser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"IMSC1_CODEC",function(){return g}),P.d(Z,"parseIMSC1",function(){return o});var Q=P("./src/utils/mp4-tools.ts"),B=P("./src/utils/vttparser.ts"),F=P("./src/utils/vttcue.ts"),K=P("./src/demux/id3.ts"),G=P("./src/utils/timescale-conversion.ts"),M=P("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(w){for(var x=1;x"):Q}function G(g){for(var p=arguments.length,f=new Array(p>1?p-1:0),h=1;h>24,O[S+1]=T>>16&255,O[S+2]=T>>8&255,O[S+3]=T&255}function p(O,S){var T=[];if(!S.length)return T;var R,A,w;"data"in O?(R=O.data,A=O.start,w=O.end):(R=O,A=0,w=R.byteLength);for(var x=A;x1?x+_:w;if(u===S[0])if(S.length===1)T.push({data:R,start:x+8,end:b});else{var m=p({data:R,start:x+8,end:b},S.slice(1));m.length&&K.apply(T,m)}x=b}return T}function f(O){var S=p(O,["moov"]),T=S[0],R=T?T.end:null,A=p(O,["sidx"]);if(!A||!A[0])return null;var w=[],x=A[0],_=x.data[0],u=_===0?8:16,b=L(x,u);u+=4;var m=0,E=0;_===0?u+=8:u+=16,u+=2;var N=x.end+E,D=M(x,u);u+=2;for(var j=0;j>>31;if(W===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=L(x,H);H+=4,w.push({referenceSize:y,subsegmentDuration:Y,info:{duration:Y/b,start:N,end:N+y-1}}),N+=y,H+=4,u=H}return{earliestPresentationTime:m,timescale:b,version:_,referencesCount:D,references:w,moovEndOffset:R}}function h(O){for(var S=[],T=p(O,["moov","trak"]),R=0;RG)&&(this.startTime=G),this.endTime=M,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},F.reset=function(){this.cueRanges=[]},B}()},"./src/utils/texttrack-utils.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"sendAddTrackEvent",function(){return B}),P.d(Z,"addCueToTrack",function(){return F}),P.d(Z,"clearCurrentCues",function(){return K}),P.d(Z,"removeCuesInRange",function(){return G}),P.d(Z,"getCuesInRange",function(){return L});var Q=P("./src/utils/logger.ts");function B(g,p){var f;try{f=new Event("addtrack")}catch(h){f=document.createEvent("Event"),f.initEvent("addtrack",!1,!1)}f.track=g,p.dispatchEvent(f)}function F(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){Q.logger.debug("[texttrack-utils]: "+o);var h=new self.TextTrackCue(p.startTime,p.endTime,p.text);h.id=p.id,g.addCue(h)}f==="disabled"&&(g.mode=f)}function K(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 G(g,p,f){var h=g.mode;if(h==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var o=L(g.cues,p,f),d=0;dg[f].endTime)return-1;for(var h=0,o=f;h<=o;){var d=Math.floor((o+h)/2);if(pg[d].startTime&&h-1)for(var d=o,s=g.length;d=p&&a.endTime<=f)h.push(a);else if(a.startTime>f)return h}return h}},"./src/utils/time-ranges.ts":function(ue,Z,P){"use strict";P.r(Z);var Q={toString:function(F){for(var K="",G=F.length,M=0;M1?p-1:0),h=1;h100)throw new Error("Position must be between 0 and 100.");w=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",M({},o,{get:function(){return x},set:function(m){var E=G(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");x=E,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",M({},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(h,"align",M({},o,{get:function(){return u},set:function(m){var E=G(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");u=E,this.hasBeenReset=!0}})),h.displayState=void 0}return L.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"parseTimeStamp",function(){return F}),P.d(Z,"fixLineBreaks",function(){return p}),P.d(Z,"VTTParser",function(){return f});var Q=P("./src/utils/vttcue.ts"),B=function(){function h(){}var o=h.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))},h}();function F(h){function o(s,a,l,c){return(s|0)*3600+(a|0)*60+(l|0)+parseFloat(c||0)}var d=h.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return d?parseFloat(d[2])>59?o(d[2],d[3],0,d[4]):o(d[1],d[2],d[3],d[4]):null}var K=function(){function h(){this.values=Object.create(null)}var o=h.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 c=0;c=0&&l<=100)return this.set(s,l),!0}return!1},h}();function G(h,o,d,s){var a=s?h.split(s):[h];for(var l in a){if(typeof a[l]!="string")continue;var c=a[l].split(d);if(c.length!==2)continue;var O=c[0],S=c[1];o(O,S)}}var M=new Q.default(0,0,""),L=M.align==="middle"?"middle":"center";function g(h,o,d){var s=h;function a(){var O=F(h);if(O===null)throw new Error("Malformed timestamp: "+s);return h=h.replace(/^[^\sa-zA-Z-]+/,""),O}function l(O,S){var T=new K;G(O,function(w,x){var _;switch(w){case"region":for(var u=d.length-1;u>=0;u--)if(d[u].id===x){T.set(w,d[u].region);break}break;case"vertical":T.alt(w,x,["rl","lr"]);break;case"line":_=x.split(","),T.integer(w,_[0]),T.percent(w,_[0])&&T.set("snapToLines",!1),T.alt(w,_[0],["auto"]),_.length===2&&T.alt("lineAlign",_[1],["start",L,"end"]);break;case"position":_=x.split(","),T.percent(w,_[0]),_.length===2&&T.alt("positionAlign",_[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":T.percent(w,x);break;case"align":T.alt(w,x,["start",L,"end","left","right"]);break}},/:/,/\s/),S.region=T.get("region",null),S.vertical=T.get("vertical","");var R=T.get("line","auto");R==="auto"&&M.line===-1&&(R=-1),S.line=R,S.lineAlign=T.get("lineAlign","start"),S.snapToLines=T.get("snapToLines",!0),S.size=T.get("size",100),S.align=T.get("align",L);var A=T.get("position","auto");A==="auto"&&M.position===50&&(A=S.align==="start"||S.align==="left"?0:S.align==="end"||S.align==="right"?100:50),S.position=A}function c(){h=h.replace(/^\s+/,"")}if(c(),o.startTime=a(),c(),h.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);h=h.substr(3),c(),o.endTime=a(),c(),l(h,o)}function p(h){return h.replace(//gi,` `)}var f=function(){function h(){this.state="INITIAL",this.buffer="",this.decoder=new B,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var o=h.prototype;return o.parse=function(s){var a=this;s&&(a.buffer+=a.decoder.decode(s,{stream:!0}));function l(){var A=a.buffer,w=0;for(A=p(A);w")===-1){a.cue.id=O;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{g(O,a.cue,a.regionList)}catch(A){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var R=O.indexOf("-->")!==-1;if(!O||R&&(T=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=` `),a.cue.text+=O}continue;case"BADCUE":O||(a.state="ID")}}}catch(A){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},h}()},"./src/utils/webvtt-parser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"generateCueId",function(){return f}),P.d(Z,"parseWebVTT",function(){return o});var Q=P("./src/polyfills/number.ts"),B=P("./src/utils/vttparser.ts"),F=P("./src/demux/id3.ts"),K=P("./src/utils/timescale-conversion.ts"),G=P("./src/remux/mp4-remuxer.ts"),M=/\r\n|\n\r|\n|\r/g,L=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)),c=parseInt(s.substr(-9,2)),O=s.length>9?parseInt(s.substr(0,s.indexOf(":"))):0;if(!Object(Q.isFiniteNumber)(a)||!Object(Q.isFiniteNumber)(l)||!Object(Q.isFiniteNumber)(c)||!Object(Q.isFiniteNumber)(O))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+s);return a+=1e3*l,a+=60*1e3*c,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(d,s,a){return p(d.toString())+p(s.toString())+p(a)}var h=function(s,a,l){var c=s[a],O=s[c.prevCC];if(!O||!O.new&&c.new){s.ccOffset=s.presentationOffset=c.start,c.new=!1;return}for(;(S=O)!==null&&S!==void 0&&S.new;){var S;s.ccOffset+=c.start-O.start,c.new=!1,c=O,O=s[c.prevCC]}s.presentationOffset=l};function o(d,s,a,l,c,O,S,T){var R=new B.VTTParser,A=Object(F.utf8ArrayToStr)(new Uint8Array(d)).trim().replace(M,` `).split(` `),w=[],x=Object(K.toMpegTsClockFromTimescale)(s,a),_="00:00.000",u=0,b=0,m,E=!0,N=!1;R.oncue=function(D){var j=l[c],H=l.ccOffset,I=(u-x)/9e4;if(j!=null&&j.new&&(b!==void 0?H=l.ccOffset=j.start:h(l,c,I)),I&&(H=I-l.presentationOffset),N){var y=D.endTime-D.startTime,W=Object(G.normalizePts)((D.startTime+H-b)*9e4,O*9e4)/9e4;D.startTime=W,D.endTime=W+y}var Y=D.text.trim();D.text=decodeURIComponent(encodeURIComponent(Y)),D.id||(D.id=f(D.startTime,D.endTime,Y)),D.endTime>0&&w.push(D)},R.onparsingerror=function(D){m=D},R.onflush=function(){if(m){T(m);return}S(w)},A.forEach(function(D){if(E)if(L(D,"X-TIMESTAMP-MAP=")){E=!1,N=!0,D.substr(16).split(",").forEach(function(j){L(j,"LOCAL:")?_=j.substr(6):L(j,"MPEGTS:")&&(u=parseInt(j.substr(7)))});try{b=g(_)/1e3}catch(j){N=!1,m=j}return}else D===""&&(E=!1);R.parse(D+` `)}),R.flush()}},"./src/utils/xhr-loader.ts":function(ue,Z,P){"use strict";P.r(Z);var Q=P("./src/utils/logger.ts"),B=P("./src/loader/load-stats.ts"),F=/^age:\s*[\d.]+\s*$/m,K=function(){function G(L){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=L?L.xhrSetup:null,this.stats=new B.LoadStats,this.retryDelay=0}var M=G.prototype;return M.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},M.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()))},M.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},M.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()},M.loadInternal=function(){var g=this.config,p=this.context;if(!g)return;var f=this.loader=new self.XMLHttpRequest,h=this.stats;h.loading.first=0,h.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 d=this.context.headers;if(d)for(var s in d)f.setRequestHeader(s,d[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()},M.readystatechange=function(){var g=this.context,p=this.loader,f=this.stats;if(!g||!p)return;var h=p.readyState,o=this.config;if(f.aborted)return;if(h>=2)if(self.clearTimeout(this.requestTimeout),f.loading.first===0&&(f.loading.first=Math.max(self.performance.now(),f.loading.start)),h===4){p.onreadystatechange=null,p.onprogress=null;var d=p.status;if(d>=200&&d<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 c={url:p.responseURL,data:s};this.callbacks.onSuccess(c,f,g,p)}else f.retry>=o.maxRetry||d>=400&&d<499?(Q.logger.error(d+" while loading "+g.url),this.callbacks.onError({code:d,text:p.statusText},g,p)):(Q.logger.warn(d+" 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)},M.loadtimeout=function(){Q.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},M.loadprogress=function(g){var p=this.stats;p.loaded=g.loaded,g.lengthComputable&&(p.total=g.total)},M.getCacheAge=function(){var g=null;if(this.loader&&F.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");g=p?parseFloat(p):null}return g},G}();Z.default=K}}).default})},vHTk:function(vt,rt,oe){vt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);