You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
394 lines
834 KiB
394 lines
834 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[217,5,7],{"+ua5":function(et,We,J){},"55Ip":function(et,We,J){"use strict";J.d(We,"a",function(){return t});var de=J("Ty5D"),H=J("dI71"),C=J("q1tI"),j=J.n(C),L=J("YS25"),A=J("17x9"),B=J.n(A),M=J("wx14"),w=J("zLVn"),S=J("9R94"),m=function(l){Object(H.a)(h,l);function h(){for(var b,p=arguments.length,x=new Array(p),R=0;R<p;R++)x[R]=arguments[R];return b=l.call.apply(l,[this].concat(x))||this,b.history=Object(L.a)(b.props),b}var d=h.prototype;return d.render=function(){return j.a.createElement(de.c,{history:this.history,children:this.props.children})},h}(j.a.Component),g=function(l){Object(H.a)(h,l);function h(){for(var b,p=arguments.length,x=new Array(p),R=0;R<p;R++)x[R]=arguments[R];return b=l.call.apply(l,[this].concat(x))||this,b.history=Object(L.b)(b.props),b}var d=h.prototype;return d.render=function(){return j.a.createElement(de.c,{history:this.history,children:this.props.children})},h}(j.a.Component),s=function(h,d){return typeof h=="function"?h(d):h},a=function(h,d){return typeof h=="string"?Object(L.c)(h,null,null,d):h},i=function(h){return h},o=j.a.forwardRef;typeof o=="undefined"&&(o=i);function n(l){return!!(l.metaKey||l.altKey||l.ctrlKey||l.shiftKey)}var e=o(function(l,h){var d=l.innerRef,b=l.navigate,p=l.onClick,x=Object(w.a)(l,["innerRef","navigate","onClick"]),R=x.target,O=Object(M.a)({},x,{onClick:function(U){try{p&&p(U)}catch(W){throw U.preventDefault(),W}!U.defaultPrevented&&U.button===0&&(!R||R==="_self")&&!n(U)&&(U.preventDefault(),b())}});return i!==o?O.ref=h||d:O.ref=d,j.a.createElement("a",O)}),t=o(function(l,h){var d=l.component,b=d===void 0?e:d,p=l.replace,x=l.to,R=l.innerRef,O=Object(w.a)(l,["component","replace","to","innerRef"]);return j.a.createElement(de.e.Consumer,null,function(N){N||Object(S.a)(!1);var U=N.history,W=a(s(x,N.location),N.location),P=W?U.createHref(W):"",K=Object(M.a)({},O,{href:P,navigate:function(){var re=s(x,N.location),ee=p?U.replace:U.push;ee(re)}});return i!==o?K.ref=h||R:K.innerRef=R,j.a.createElement(b,K)})});if(!1)var r,T;var v=function(h){return h},f=j.a.forwardRef;typeof f=="undefined"&&(f=v);function E(){for(var l=arguments.length,h=new Array(l),d=0;d<l;d++)h[d]=arguments[d];return h.filter(function(b){return b}).join(" ")}var y=f(function(l,h){var d=l["aria-current"],b=d===void 0?"page":d,p=l.activeClassName,x=p===void 0?"active":p,R=l.activeStyle,O=l.className,N=l.exact,U=l.isActive,W=l.location,P=l.sensitive,K=l.strict,V=l.style,re=l.to,ee=l.innerRef,le=Object(w.a)(l,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return j.a.createElement(de.e.Consumer,null,function(oe){oe||Object(S.a)(!1);var $=W||oe.location,Z=a(s(re,$),$),ne=Z.pathname,X=ne&&ne.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),z=X?Object(de.f)($.pathname,{path:X,exact:N,sensitive:P,strict:K}):null,fe=!!(U?U(z,$):z),Se=fe?E(O,x):O,Oe=fe?Object(M.a)({},V,{},R):V,Ae=Object(M.a)({"aria-current":fe&&b||null,className:Se,style:Oe,to:Z},le);return v!==f?Ae.ref=h||ee:Ae.innerRef=ee,j.a.createElement(t,Ae)})});if(!1)var u},"5VLF":function(et,We,J){"use strict";var de,H;function C(j,L,A){var B=function(M,w){return j.js_beautify(M,w)};return B.js=j.js_beautify,B.css=L.css_beautify,B.html=A.html_beautify,B.js_beautify=j.js_beautify,B.css_beautify=L.css_beautify,B.html_beautify=A.html_beautify,B}!(de=[J("6UM0"),J("TXwP"),J("psGv")],H=function(j,L,A){return C(j,L,A)}.apply(We,de),H!==void 0&&(et.exports=H))},"6UM0":function(et,We,J){var de,H;(function(){var C;(function(){"use strict";var L=[function(w,S,m){var g=m(1).Beautifier,s=m(5).Options;function a(i,o){var n=new g(i,o);return n.beautify()}w.exports=a,w.exports.defaultOptions=function(){return new s}},function(w,S,m){var g=m(2).Output,s=m(3).Token,a=m(4),i=m(5).Options,o=m(7).Tokenizer,n=m(7).line_starters,e=m(7).positionable_operators,t=m(7).TOKEN;function r(P,K){return K.indexOf(P)!==-1}function T(P){return P.replace(/^\s+/g,"")}function v(P){for(var K={},V=0;V<P.length;V++)K[P[V].replace(/-/g,"_")]=P[V];return K}function f(P,K){return P&&P.type===t.RESERVED&&P.text===K}function E(P,K){return P&&P.type===t.RESERVED&&r(P.text,K)}var y=["case","return","do","if","throw","else","await","break","continue","async"],u=["before-newline","after-newline","preserve-newline"],l=v(u),h=[l.before_newline,l.preserve_newline],d={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function b(P,K){if(K.multiline_frame||K.mode===d.ForInitializer||K.mode===d.Conditional)return;P.remove_indent(K.start_line_index)}function p(P){P=P.replace(a.allLineBreaks,`
|
|
`);for(var K=[],V=P.indexOf(`
|
|
`);V!==-1;)K.push(P.substring(0,V)),P=P.substring(V+1),V=P.indexOf(`
|
|
`);return P.length&&K.push(P),K}function x(P){return P===d.ArrayLiteral}function R(P){return r(P,[d.Expression,d.ForInitializer,d.Conditional])}function O(P,K){for(var V=0;V<P.length;V++){var re=P[V].trim();if(re.charAt(0)!==K)return!1}return!0}function N(P,K){for(var V=0,re=P.length,ee;V<re;V++)if(ee=P[V],ee&&ee.indexOf(K)!==0)return!1;return!0}function U(P,K){K=K||{},this._source_text=P||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new i(K)}U.prototype.create_flags=function(P,K){var V=0;P&&(V=P.indentation_level,!this._output.just_added_newline()&&P.line_indent_level>V&&(V=P.line_indent_level));var re={mode:K,parent:P,last_token:P?P.last_token:new s(t.START_BLOCK,""),last_word:P?P.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:V,alignment:0,line_indent_level:P?P.line_indent_level:V,start_line_index:this._output.get_line_number(),ternary_depth:0};return re},U.prototype._reset=function(P){var K=P.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new g(this._options,K),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(d.BlockStatement);var V=new o(P,this._options);return this._tokens=V.tokenize(),P},U.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var P,K=this._reset(this._source_text),V=this._options.eol;this._options.eol==="auto"&&(V=`
|
|
`,K&&a.lineBreak.test(K||"")&&(V=K.match(a.lineBreak)[0]));for(var re=this._tokens.next();re;)this.handle_token(re),this._last_last_text=this._flags.last_token.text,this._flags.last_token=re,re=this._tokens.next();return P=this._output.get_code(V),P},U.prototype.handle_token=function(P,K){P.type===t.START_EXPR?this.handle_start_expr(P):P.type===t.END_EXPR?this.handle_end_expr(P):P.type===t.START_BLOCK?this.handle_start_block(P):P.type===t.END_BLOCK?this.handle_end_block(P):P.type===t.WORD?this.handle_word(P):P.type===t.RESERVED?this.handle_word(P):P.type===t.SEMICOLON?this.handle_semicolon(P):P.type===t.STRING?this.handle_string(P):P.type===t.EQUALS?this.handle_equals(P):P.type===t.OPERATOR?this.handle_operator(P):P.type===t.COMMA?this.handle_comma(P):P.type===t.BLOCK_COMMENT?this.handle_block_comment(P,K):P.type===t.COMMENT?this.handle_comment(P,K):P.type===t.DOT?this.handle_dot(P):P.type===t.EOF?this.handle_eof(P):P.type===t.UNKNOWN?this.handle_unknown(P,K):this.handle_unknown(P,K)},U.prototype.handle_whitespace_and_comments=function(P,K){var V=P.newlines,re=this._options.keep_array_indentation&&x(this._flags.mode);if(P.comments_before)for(var ee=P.comments_before.next();ee;)this.handle_whitespace_and_comments(ee,K),this.handle_token(ee,K),ee=P.comments_before.next();if(re)for(var le=0;le<V;le+=1)this.print_newline(le>0,K);else if(this._options.max_preserve_newlines&&V>this._options.max_preserve_newlines&&(V=this._options.max_preserve_newlines),this._options.preserve_newlines&&V>1){this.print_newline(!1,K);for(var oe=1;oe<V;oe+=1)this.print_newline(!0,K)}};var W=["async","break","continue","return","throw","yield"];U.prototype.allow_wrap_or_preserved_newline=function(P,K){if(K=K===void 0?!1:K,this._output.just_added_newline())return;var V=this._options.preserve_newlines&&P.newlines||K,re=r(this._flags.last_token.text,e)||r(P.text,e);if(re){var ee=r(this._flags.last_token.text,e)&&r(this._options.operator_position,h)||r(P.text,e);V=V&&ee}if(V)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(E(this._flags.last_token,W))return;this._output.set_wrap_point()}},U.prototype.print_newline=function(P,K){if(!K&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==t.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var V=this._tokens.peek();this._flags.mode===d.Statement&&!(this._flags.if_block&&f(V,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(P)&&(this._flags.multiline_frame=!0)},U.prototype.print_token_line_indentation=function(P){this._output.just_added_newline()&&(this._options.keep_array_indentation&&P.newlines&&(P.text==="["||x(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(P.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},U.prototype.print_token=function(P){if(this._output.raw){this._output.add_raw_token(P);return}if(this._options.comma_first&&P.previous&&P.previous.type===t.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var K=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(K),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(P),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(P),this._output.non_breaking_space=!0,this._output.add_token(P.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},U.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},U.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},U.prototype.set_mode=function(P){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,P),this._flags=this.create_flags(this._previous_flags,P),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},U.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===d.Statement&&b(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},U.prototype.start_of_object_property=function(){return this._flags.parent.mode===d.ObjectLiteral&&this._flags.mode===d.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||E(this._flags.last_token,["get","set"]))},U.prototype.start_of_statement=function(P){var K=!1;return K=K||E(this._flags.last_token,["var","let","const"])&&P.type===t.WORD,K=K||f(this._flags.last_token,"do"),K=K||!(this._flags.parent.mode===d.ObjectLiteral&&this._flags.mode===d.Statement)&&E(this._flags.last_token,W)&&!P.newlines,K=K||f(this._flags.last_token,"else")&&!(f(P,"if")&&!P.comments_before),K=K||this._flags.last_token.type===t.END_EXPR&&(this._previous_flags.mode===d.ForInitializer||this._previous_flags.mode===d.Conditional),K=K||this._flags.last_token.type===t.WORD&&this._flags.mode===d.BlockStatement&&!this._flags.in_case&&!(P.text==="--"||P.text==="++")&&this._last_last_text!=="function"&&P.type!==t.WORD&&P.type!==t.RESERVED,K=K||this._flags.mode===d.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||E(this._flags.last_token,["get","set"])),K?(this.set_mode(d.Statement),this.indent(),this.handle_whitespace_and_comments(P,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(P,E(P,["do","for","if","while"])),!0):!1},U.prototype.handle_start_expr=function(P){this.start_of_statement(P)||this.handle_whitespace_and_comments(P);var K=d.Expression;if(P.text==="["){if(this._flags.last_token.type===t.WORD||this._flags.last_token.text===")"){E(this._flags.last_token,n)&&(this._output.space_before_token=!0),this.print_token(P),this.set_mode(K),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}K=d.ArrayLiteral,x(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())),r(this._flags.last_token.type,[t.START_EXPR,t.END_EXPR,t.WORD,t.OPERATOR,t.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===t.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,K=d.ForInitializer):r(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,K=d.Conditional):r(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&P.whitespace_before===""?this._output.space_before_token=!1:(r(this._flags.last_token.text,n)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===t.EQUALS||this._flags.last_token.type===t.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(P);else if(this._flags.last_token.type===t.WORD){this._output.space_before_token=!1;var V=this._tokens.peek(-3);if(this._options.space_after_named_function&&V){var re=this._tokens.peek(-4);E(V,["async","function"])||V.text==="*"&&E(re,["async","function"])?this._output.space_before_token=!0:this._flags.mode===d.ObjectLiteral?(V.text==="{"||V.text===","||V.text==="*"&&(re.text==="{"||re.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(P);(this._flags.last_token.type===t.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(r(this._last_last_text,["function","yield"])||this._flags.mode===d.ObjectLiteral&&r(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===t.START_BLOCK?this.print_newline():(this._flags.last_token.type===t.END_EXPR||this._flags.last_token.type===t.START_EXPR||this._flags.last_token.type===t.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===t.COMMA)&&this.allow_wrap_or_preserved_newline(P,P.newlines),this.print_token(P),this.set_mode(K),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},U.prototype.handle_end_expr=function(P){for(;this._flags.mode===d.Statement;)this.restore_mode();this.handle_whitespace_and_comments(P),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(P,P.text==="]"&&x(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===t.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(P),this.restore_mode(),b(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===d.Conditional&&(this._previous_flags.mode=d.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},U.prototype.handle_start_block=function(P){this.handle_whitespace_and_comments(P);var K=this._tokens.peek(),V=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===t.END_EXPR?(this.set_mode(d.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(d.BlockStatement):V&&(r(V.text,[":",","])&&r(K.type,[t.STRING,t.WORD,t.RESERVED])||r(K.text,["get","set","..."])&&r(V.type,[t.WORD,t.RESERVED]))?r(this._last_last_text,["class","interface"])&&!r(V.text,[":",","])?this.set_mode(d.BlockStatement):this.set_mode(d.ObjectLiteral):this._flags.last_token.type===t.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(d.BlockStatement):r(this._flags.last_token.type,[t.EQUALS,t.START_EXPR,t.COMMA,t.OPERATOR])||E(this._flags.last_token,["return","throw","import","default"])?this.set_mode(d.ObjectLiteral):this.set_mode(d.BlockStatement),this._flags.last_token&&(E(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var re=!K.comments_before&&K.text==="}",ee=re&&this._flags.last_word==="function"&&this._flags.last_token.type===t.END_EXPR;if(this._options.brace_preserve_inline){var le=0,oe=null;this._flags.inline_frame=!0;do if(le+=1,oe=this._tokens.peek(le-1),oe.newlines){this._flags.inline_frame=!1;break}while(oe.type!==t.EOF&&!(oe.type===t.END_BLOCK&&oe.opened===P))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&P.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==t.OPERATOR&&(ee||this._flags.last_token.type===t.EQUALS||E(this._flags.last_token,y)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(x(this._previous_flags.mode)&&(this._flags.last_token.type===t.START_EXPR||this._flags.last_token.type===t.COMMA)&&((this._flags.last_token.type===t.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===t.COMMA||this._flags.last_token.type===t.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(P),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==t.OPERATOR&&this._flags.last_token.type!==t.START_EXPR&&(this._flags.last_token.type===t.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(P),this.indent(),!re&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},U.prototype.handle_end_block=function(P){for(this.handle_whitespace_and_comments(P);this._flags.mode===d.Statement;)this.restore_mode();var K=this._flags.last_token.type===t.START_BLOCK;this._flags.inline_frame&&!K?this._output.space_before_token=!0:this._options.brace_style==="expand"?K||this.print_newline():K||(x(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(P)},U.prototype.handle_word=function(P){if(P.type===t.RESERVED){if(r(P.text,["set","get"])&&this._flags.mode!==d.ObjectLiteral)P.type=t.WORD;else if(P.text==="import"&&r(this._tokens.peek().text,["(","."]))P.type=t.WORD;else if(r(P.text,["as","from"])&&!this._flags.import_block)P.type=t.WORD;else if(this._flags.mode===d.ObjectLiteral){var K=this._tokens.peek();K.text===":"&&(P.type=t.WORD)}}if(this.start_of_statement(P)?E(this._flags.last_token,["var","let","const"])&&P.type===t.WORD&&(this._flags.declaration_statement=!0):P.newlines&&!R(this._flags.mode)&&(this._flags.last_token.type!==t.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==t.EQUALS&&(this._options.preserve_newlines||!E(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(P),this.print_newline()):this.handle_whitespace_and_comments(P),this._flags.do_block&&!this._flags.do_while)if(f(P,"while")){this._output.space_before_token=!0,this.print_token(P),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&&f(P,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===d.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&E(P,["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(P),this._flags.in_case=!0;return}if((this._flags.last_token.type===t.COMMA||this._flags.last_token.type===t.START_EXPR||this._flags.last_token.type===t.EQUALS||this._flags.last_token.type===t.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(P)),f(P,"function")){(r(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(r(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===t.OPERATOR))&&(!this._output.just_added_blankline()&&!P.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===t.RESERVED||this._flags.last_token.type===t.WORD?E(this._flags.last_token,["get","set","new","export"])||E(this._flags.last_token,W)?this._output.space_before_token=!0:f(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===t.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(R(this._flags.mode)||x(this._flags.mode))||this.print_newline(),this.print_token(P),this._flags.last_word=P.text;return}var V="NONE";if(this._flags.last_token.type===t.END_BLOCK?this._previous_flags.inline_frame?V="SPACE":E(P,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&P.newlines?V="NEWLINE":(V="SPACE",this._output.space_before_token=!0):V="NEWLINE":this._flags.last_token.type===t.SEMICOLON&&this._flags.mode===d.BlockStatement?V="NEWLINE":this._flags.last_token.type===t.SEMICOLON&&R(this._flags.mode)?V="SPACE":this._flags.last_token.type===t.STRING?V="NEWLINE":this._flags.last_token.type===t.RESERVED||this._flags.last_token.type===t.WORD||this._flags.last_token.text==="*"&&(r(this._last_last_text,["function","yield"])||this._flags.mode===d.ObjectLiteral&&r(this._last_last_text,["{",","]))?V="SPACE":this._flags.last_token.type===t.START_BLOCK?this._flags.inline_frame?V="SPACE":V="NEWLINE":this._flags.last_token.type===t.END_EXPR&&(this._output.space_before_token=!0,V="NEWLINE"),E(P,n)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?V="SPACE":V="NEWLINE"),E(P,["else","catch","finally"]))if((!(this._flags.last_token.type===t.END_BLOCK&&this._previous_flags.mode===d.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&P.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var re=this._output.current_line;re.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else V==="NEWLINE"?E(this._flags.last_token,y)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&E(P,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==t.END_EXPR?(this._flags.last_token.type!==t.START_EXPR||!E(P,["var","let","const"]))&&this._flags.last_token.text!==":"&&(f(P,"if")&&f(P.previous,"else")?this._output.space_before_token=!0:this.print_newline()):E(P,n)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&x(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():V==="SPACE"&&(this._output.space_before_token=!0);P.previous&&(P.previous.type===t.WORD||P.previous.type===t.RESERVED)&&(this._output.space_before_token=!0),this.print_token(P),this._flags.last_word=P.text,P.type===t.RESERVED&&(P.text==="do"?this._flags.do_block=!0:P.text==="if"?this._flags.if_block=!0:P.text==="import"?this._flags.import_block=!0:this._flags.import_block&&f(P,"from")&&(this._flags.import_block=!1))},U.prototype.handle_semicolon=function(P){this.start_of_statement(P)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(P);for(var K=this._tokens.peek();this._flags.mode===d.Statement&&!(this._flags.if_block&&f(K,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(P)},U.prototype.handle_string=function(P){P.text.startsWith("`")&&P.newlines===0&&P.whitespace_before===""&&(P.previous.text===")"||this._flags.last_token.type===t.WORD)||(this.start_of_statement(P)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(P),this._flags.last_token.type===t.RESERVED||this._flags.last_token.type===t.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===t.COMMA||this._flags.last_token.type===t.START_EXPR||this._flags.last_token.type===t.EQUALS||this._flags.last_token.type===t.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(P):P.text.startsWith("`")&&this._flags.last_token.type===t.END_EXPR&&(P.previous.text==="]"||P.previous.text===")")&&P.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(P)},U.prototype.handle_equals=function(P){this.start_of_statement(P)||this.handle_whitespace_and_comments(P),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(P),this._output.space_before_token=!0},U.prototype.handle_comma=function(P){this.handle_whitespace_and_comments(P,!0),this.print_token(P),this._output.space_before_token=!0,this._flags.declaration_statement?(R(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(P)):this._flags.mode===d.ObjectLiteral||this._flags.mode===d.Statement&&this._flags.parent.mode===d.ObjectLiteral?(this._flags.mode===d.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(P)},U.prototype.handle_operator=function(P){var K=P.text==="*"&&(E(this._flags.last_token,["function","yield"])||r(this._flags.last_token.type,[t.START_BLOCK,t.COMMA,t.END_BLOCK,t.SEMICOLON])),V=r(P.text,["-","+"])&&(r(this._flags.last_token.type,[t.START_BLOCK,t.START_EXPR,t.EQUALS,t.OPERATOR])||r(this._flags.last_token.text,n)||this._flags.last_token.text===",");if(!this.start_of_statement(P)){var re=!K;this.handle_whitespace_and_comments(P,re)}if(P.text==="*"&&this._flags.last_token.type===t.DOT){this.print_token(P);return}if(P.text==="::"){this.print_token(P);return}if(this._flags.last_token.type===t.OPERATOR&&r(this._options.operator_position,h)&&this.allow_wrap_or_preserved_newline(P),P.text===":"&&this._flags.in_case){this.print_token(P),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==t.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var ee=!0,le=!0,oe=!1;if(P.text===":"?this._flags.ternary_depth===0?ee=!1:(this._flags.ternary_depth-=1,oe=!0):P.text==="?"&&(this._flags.ternary_depth+=1),!V&&!K&&this._options.preserve_newlines&&r(P.text,e)){var $=P.text===":",Z=$&&oe,ne=$&&!oe;switch(this._options.operator_position){case l.before_newline:this._output.space_before_token=!ne,this.print_token(P),(!$||Z)&&this.allow_wrap_or_preserved_newline(P),this._output.space_before_token=!0;return;case l.after_newline:this._output.space_before_token=!0,!$||Z?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(P):this._output.space_before_token=!1,this.print_token(P),this._output.space_before_token=!0;return;case l.preserve_newline:ne||this.allow_wrap_or_preserved_newline(P),ee=!(this._output.just_added_newline()||ne),this._output.space_before_token=ee,this.print_token(P),this._output.space_before_token=!0;return}}if(K){this.allow_wrap_or_preserved_newline(P),ee=!1;var X=this._tokens.peek();le=X&&r(X.type,[t.WORD,t.RESERVED])}else if(P.text==="...")this.allow_wrap_or_preserved_newline(P),ee=this._flags.last_token.type===t.START_BLOCK,le=!1;else if(r(P.text,["--","++","!","~"])||V){if((this._flags.last_token.type===t.COMMA||this._flags.last_token.type===t.START_EXPR)&&this.allow_wrap_or_preserved_newline(P),ee=!1,le=!1,P.newlines&&(P.text==="--"||P.text==="++"||P.text==="~")){var z=E(this._flags.last_token,y)&&P.newlines;z&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(z,!0)}this._flags.last_token.text===";"&&R(this._flags.mode)&&(ee=!0),this._flags.last_token.type===t.RESERVED?ee=!0:this._flags.last_token.type===t.END_EXPR?ee=!(this._flags.last_token.text==="]"&&(P.text==="--"||P.text==="++")):this._flags.last_token.type===t.OPERATOR&&(ee=r(P.text,["--","-","++","+"])&&r(this._flags.last_token.text,["--","-","++","+"]),r(P.text,["+","-"])&&r(this._flags.last_token.text,["--","++"])&&(le=!0)),(this._flags.mode===d.BlockStatement&&!this._flags.inline_frame||this._flags.mode===d.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||ee,this.print_token(P),this._output.space_before_token=le},U.prototype.handle_block_comment=function(P,K){if(this._output.raw){this._output.add_raw_token(P),P.directives&&P.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(P.directives){this.print_newline(!1,K),this.print_token(P),P.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!a.newline.test(P.text)&&!P.newlines){this._output.space_before_token=!0,this.print_token(P),this._output.space_before_token=!0;return}else this.print_block_commment(P,K)},U.prototype.print_block_commment=function(P,K){var V=p(P.text),re,ee=!1,le=!1,oe=P.whitespace_before,$=oe.length;if(this.print_newline(!1,K),this.print_token_line_indentation(P),this._output.add_token(V[0]),this.print_newline(!1,K),V.length>1){for(V=V.slice(1),ee=O(V,"*"),le=N(V,oe),ee&&(this._flags.alignment=1),re=0;re<V.length;re++)ee?(this.print_token_line_indentation(P),this._output.add_token(T(V[re]))):le&&V[re]?(this.print_token_line_indentation(P),this._output.add_token(V[re].substring($))):(this._output.current_line.set_indent(-1),this._output.add_token(V[re])),this.print_newline(!1,K);this._flags.alignment=0}},U.prototype.handle_comment=function(P,K){P.newlines?this.print_newline(!1,K):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(P),this.print_newline(!1,K)},U.prototype.handle_dot=function(P){this.start_of_statement(P)||this.handle_whitespace_and_comments(P,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),E(this._flags.last_token,y)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(P,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(P)},U.prototype.handle_unknown=function(P,K){this.print_token(P),P.text[P.text.length-1]===`
|
|
`&&this.print_newline(!1,K)},U.prototype.handle_eof=function(P){for(;this._flags.mode===d.Statement;)this.restore_mode();this.handle_whitespace_and_comments(P)},w.exports.Beautifier=U},function(w){function S(s){this.__parent=s,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}S.prototype.clone_empty=function(){var s=new S(this.__parent);return s.set_indent(this.__indent_count,this.__alignment_count),s},S.prototype.item=function(s){return s<0?this.__items[this.__items.length+s]:this.__items[s]},S.prototype.has_match=function(s){for(var a=this.__items.length-1;a>=0;a--)if(this.__items[a].match(s))return!0;return!1},S.prototype.set_indent=function(s,a){this.is_empty()&&(this.__indent_count=s||0,this.__alignment_count=a||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},S.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)},S.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},S.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var s=this.__parent.current_line;return s.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),s.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),s.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,s.__items[0]===" "&&(s.__items.splice(0,1),s.__character_count-=1),!0}return!1},S.prototype.is_empty=function(){return this.__items.length===0},S.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},S.prototype.push=function(s){this.__items.push(s);var a=s.lastIndexOf(`
|
|
`);a!==-1?this.__character_count=s.length-a:this.__character_count+=s.length},S.prototype.pop=function(){var s=null;return this.is_empty()||(s=this.__items.pop(),this.__character_count-=s.length),s},S.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},S.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},S.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},S.prototype.toString=function(){var s="";return this.is_empty()?this.__parent.indent_empty_lines&&(s=this.__parent.get_indent_string(this.__indent_count)):(s=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),s+=this.__items.join("")),s};function m(s,a){this.__cache=[""],this.__indent_size=s.indent_size,this.__indent_string=s.indent_char,s.indent_with_tabs||(this.__indent_string=new Array(s.indent_size+1).join(s.indent_char)),a=a||"",s.indent_level>0&&(a=new Array(s.indent_level+1).join(this.__indent_string)),this.__base_string=a,this.__base_string_length=a.length}m.prototype.get_indent_size=function(s,a){var i=this.__base_string_length;return a=a||0,s<0&&(i=0),i+=s*this.__indent_size,i+=a,i},m.prototype.get_indent_string=function(s,a){var i=this.__base_string;return a=a||0,s<0&&(s=0,i=""),a+=s*this.__indent_size,this.__ensure_cache(a),i+=this.__cache[a],i},m.prototype.__ensure_cache=function(s){for(;s>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var s=this.__cache.length,a=0,i="";this.__indent_size&&s>=this.__indent_size&&(a=Math.floor(s/this.__indent_size),s-=a*this.__indent_size,i=new Array(a+1).join(this.__indent_string)),s&&(i+=new Array(s+1).join(" ")),this.__cache.push(i)};function g(s,a){this.__indent_cache=new m(s,a),this.raw=!1,this._end_with_newline=s.end_with_newline,this.indent_size=s.indent_size,this.wrap_line_length=s.wrap_line_length,this.indent_empty_lines=s.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new S(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}g.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},g.prototype.get_line_number=function(){return this.__lines.length},g.prototype.get_indent_string=function(s,a){return this.__indent_cache.get_indent_string(s,a)},g.prototype.get_indent_size=function(s,a){return this.__indent_cache.get_indent_size(s,a)},g.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},g.prototype.add_new_line=function(s){return this.is_empty()||!s&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},g.prototype.get_code=function(s){this.trim(!0);var a=this.current_line.pop();a&&(a[a.length-1]===`
|
|
`&&(a=a.replace(/\n+$/g,"")),this.current_line.push(a)),this._end_with_newline&&this.__add_outputline();var i=this.__lines.join(`
|
|
`);return s!==`
|
|
`&&(i=i.replace(/[\n]/g,s)),i},g.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},g.prototype.set_indent=function(s,a){return s=s||0,a=a||0,this.next_line.set_indent(s,a),this.__lines.length>1?(this.current_line.set_indent(s,a),!0):(this.current_line.set_indent(),!1)},g.prototype.add_raw_token=function(s){for(var a=0;a<s.newlines;a++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(s.whitespace_before),this.current_line.push(s.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},g.prototype.add_token=function(s){this.__add_space_before_token(),this.current_line.push(s),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},g.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},g.prototype.remove_indent=function(s){for(var a=this.__lines.length;s<a;)this.__lines[s]._remove_indent(),s++;this.current_line._remove_wrap_indent()},g.prototype.trim=function(s){for(s=s===void 0?!1:s,this.current_line.trim();s&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},g.prototype.just_added_newline=function(){return this.current_line.is_empty()},g.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},g.prototype.ensure_empty_line_above=function(s,a){for(var i=this.__lines.length-2;i>=0;){var o=this.__lines[i];if(o.is_empty())break;if(o.item(0).indexOf(s)!==0&&o.item(-1)!==a){this.__lines.splice(i+1,0,new S(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},w.exports.Output=g},function(w){function S(m,g,s,a){this.type=m,this.text=g,this.comments_before=null,this.newlines=s||0,this.whitespace_before=a||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}w.exports.Token=S},function(w,S){var m="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",g="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",s="\\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",a="\\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",i="(?:\\\\u[0-9a-fA-F]{4}|["+m+s+"])",o="(?:\\\\u[0-9a-fA-F]{4}|["+g+s+a+"])*";S.identifier=new RegExp(i+o,"g"),S.identifierStart=new RegExp(i),S.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+g+s+a+"])+");var n=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;S.newline=/[\n\r\u2028\u2029]/,S.lineBreak=new RegExp(`\r
|
|
|`+S.newline.source),S.allLineBreaks=new RegExp(S.lineBreak.source,"g")},function(w,S,m){var g=m(6).Options,s=["before-newline","after-newline","preserve-newline"];function a(i){g.call(this,i,"js");var o=this.raw_options.brace_style||null;o==="expand-strict"?this.raw_options.brace_style="expand":o==="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 n=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var e=0;e<n.length;e++)n[e]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=n[e];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",s),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}a.prototype=new g,w.exports.Options=a},function(w){function S(s,a){this.raw_options=m(s,a),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"])}S.prototype._get_array=function(s,a){var i=this.raw_options[s],o=a||[];return typeof i=="object"?i!==null&&typeof i.concat=="function"&&(o=i.concat()):typeof i=="string"&&(o=i.split(/[^a-zA-Z0-9_\/\-]+/)),o},S.prototype._get_boolean=function(s,a){var i=this.raw_options[s],o=i===void 0?!!a:!!i;return o},S.prototype._get_characters=function(s,a){var i=this.raw_options[s],o=a||"";return typeof i=="string"&&(o=i.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),o},S.prototype._get_number=function(s,a){var i=this.raw_options[s];a=parseInt(a,10),isNaN(a)&&(a=0);var o=parseInt(i,10);return isNaN(o)&&(o=a),o},S.prototype._get_selection=function(s,a,i){var o=this._get_selection_list(s,a,i);if(o.length!==1)throw new Error("Invalid Option Value: The option '"+s+`' can only be one of the following values:
|
|
`+a+`
|
|
You passed in: '`+this.raw_options[s]+"'");return o[0]},S.prototype._get_selection_list=function(s,a,i){if(!a||a.length===0)throw new Error("Selection list cannot be empty.");if(i=i||[a[0]],!this._is_valid_selection(i,a))throw new Error("Invalid Default Value!");var o=this._get_array(s,i);if(!this._is_valid_selection(o,a))throw new Error("Invalid Option Value: The option '"+s+`' can contain only the following values:
|
|
`+a+`
|
|
You passed in: '`+this.raw_options[s]+"'");return o},S.prototype._is_valid_selection=function(s,a){return s.length&&a.length&&!s.some(function(i){return a.indexOf(i)===-1})};function m(s,a){var i={};s=g(s);var o;for(o in s)o!==a&&(i[o]=s[o]);if(a&&s[a])for(o in s[a])i[o]=s[a][o];return i}function g(s){var a={},i;for(i in s){var o=i.replace(/-/g,"_");a[o]=s[i]}return a}w.exports.Options=S,w.exports.normalizeOpts=g,w.exports.mergeOpts=m},function(w,S,m){var g=m(8).InputScanner,s=m(9).Tokenizer,a=m(9).TOKEN,i=m(13).Directives,o=m(4),n=m(12).Pattern,e=m(14).TemplatablePattern;function t(O,N){return N.indexOf(O)!==-1}var r={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:a.START,RAW:a.RAW,EOF:a.EOF},T=new i(/\/\*/,/\*\//),v=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,f=/[0-9]/,E=/[^\d\.]/,y=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),u=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";u=u.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),u="\\?\\.(?!\\d) "+u,u=u.replace(/ /g,"|");var l=new RegExp(u),h="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),d=h.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),b=new RegExp("^(?:"+d.join("|")+")$"),p,x=function(O,N){s.call(this,O,N),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var U=new n(this._input),W=new e(this._input).read_options(this._options);this.__patterns={template:W,identifier:W.starting_with(o.identifier).matching(o.identifierMatch),number:U.matching(v),punct:U.matching(l),comment:U.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:U.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:U.matching(/<!--/),html_comment_end:U.matching(/-->/),include:U.starting_with(/#include/).until_after(o.lineBreak),shebang:U.starting_with(/#!/).until_after(o.lineBreak),xml:U.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:W.until(/['\\\n\r\u2028\u2029]/),double_quote:W.until(/["\\\n\r\u2028\u2029]/),template_text:W.until(/[`\\$]/),template_expression:W.until(/[`}\\]/)}};x.prototype=new s,x.prototype._is_comment=function(O){return O.type===r.COMMENT||O.type===r.BLOCK_COMMENT||O.type===r.UNKNOWN},x.prototype._is_opening=function(O){return O.type===r.START_BLOCK||O.type===r.START_EXPR},x.prototype._is_closing=function(O,N){return(O.type===r.END_BLOCK||O.type===r.END_EXPR)&&N&&(O.text==="]"&&N.text==="["||O.text===")"&&N.text==="("||O.text==="}"&&N.text==="{")},x.prototype._reset=function(){p=!1},x.prototype._get_next_token=function(O,N){var U=null;this._readWhitespace();var W=this._input.peek();return W===null?this._create_token(r.EOF,""):(U=U||this._read_non_javascript(W),U=U||this._read_string(W),U=U||this._read_word(O),U=U||this._read_singles(W),U=U||this._read_comment(W),U=U||this._read_regexp(W,O),U=U||this._read_xml(W,O),U=U||this._read_punctuation(),U=U||this._create_token(r.UNKNOWN,this._input.next()),U)},x.prototype._read_word=function(O){var N;if(N=this.__patterns.identifier.read(),N!=="")return N=N.replace(o.allLineBreaks,`
|
|
`),!(O.type===r.DOT||O.type===r.RESERVED&&(O.text==="set"||O.text==="get"))&&b.test(N)?(N==="in"||N==="of")&&(O.type===r.WORD||O.type===r.STRING)?this._create_token(r.OPERATOR,N):this._create_token(r.RESERVED,N):this._create_token(r.WORD,N);if(N=this.__patterns.number.read(),N!=="")return this._create_token(r.WORD,N)},x.prototype._read_singles=function(O){var N=null;return O==="("||O==="["?N=this._create_token(r.START_EXPR,O):O===")"||O==="]"?N=this._create_token(r.END_EXPR,O):O==="{"?N=this._create_token(r.START_BLOCK,O):O==="}"?N=this._create_token(r.END_BLOCK,O):O===";"?N=this._create_token(r.SEMICOLON,O):O==="."&&E.test(this._input.peek(1))?N=this._create_token(r.DOT,O):O===","&&(N=this._create_token(r.COMMA,O)),N&&this._input.next(),N},x.prototype._read_punctuation=function(){var O=this.__patterns.punct.read();if(O!=="")return O==="="?this._create_token(r.EQUALS,O):O==="?."?this._create_token(r.DOT,O):this._create_token(r.OPERATOR,O)},x.prototype._read_non_javascript=function(O){var N="";if(O==="#"){if(this._is_first_token()&&(N=this.__patterns.shebang.read(),N))return this._create_token(r.UNKNOWN,N.trim()+`
|
|
`);if(N=this.__patterns.include.read(),N)return this._create_token(r.UNKNOWN,N.trim()+`
|
|
`);O=this._input.next();var U="#";if(this._input.hasNext()&&this._input.testChar(f)){do O=this._input.next(),U+=O;while(this._input.hasNext()&&O!=="#"&&O!=="=");return O==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(U+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(U+="{}",this._input.next(),this._input.next())),this._create_token(r.WORD,U)}this._input.back()}else if(O==="<"&&this._is_first_token()){if(N=this.__patterns.html_comment_start.read(),N){for(;this._input.hasNext()&&!this._input.testChar(o.newline);)N+=this._input.next();return p=!0,this._create_token(r.COMMENT,N)}}else if(p&&O==="-"&&(N=this.__patterns.html_comment_end.read(),N))return p=!1,this._create_token(r.COMMENT,N);return null},x.prototype._read_comment=function(O){var N=null;if(O==="/"){var U="";if(this._input.peek(1)==="*"){U=this.__patterns.block_comment.read();var W=T.get_directives(U);W&&W.ignore==="start"&&(U+=T.readIgnored(this._input)),U=U.replace(o.allLineBreaks,`
|
|
`),N=this._create_token(r.BLOCK_COMMENT,U),N.directives=W}else this._input.peek(1)==="/"&&(U=this.__patterns.comment.read(),N=this._create_token(r.COMMENT,U))}return N},x.prototype._read_string=function(O){if(O==="`"||O==="'"||O==='"'){var N=this._input.next();return this.has_char_escapes=!1,O==="`"?N+=this._read_string_recursive("`",!0,"${"):N+=this._read_string_recursive(O),this.has_char_escapes&&this._options.unescape_strings&&(N=R(N)),this._input.peek()===O&&(N+=this._input.next()),N=N.replace(o.allLineBreaks,`
|
|
`),this._create_token(r.STRING,N)}return null},x.prototype._allow_regexp_or_xml=function(O){return O.type===r.RESERVED&&t(O.text,["return","case","throw","else","do","typeof","yield"])||O.type===r.END_EXPR&&O.text===")"&&O.opened.previous.type===r.RESERVED&&t(O.opened.previous.text,["if","while","for"])||t(O.type,[r.COMMENT,r.START_EXPR,r.START_BLOCK,r.START,r.END_BLOCK,r.OPERATOR,r.EQUALS,r.EOF,r.SEMICOLON,r.COMMA])},x.prototype._read_regexp=function(O,N){if(O==="/"&&this._allow_regexp_or_xml(N)){for(var U=this._input.next(),W=!1,P=!1;this._input.hasNext()&&(W||P||this._input.peek()!==O)&&!this._input.testChar(o.newline);)U+=this._input.peek(),W?W=!1:(W=this._input.peek()==="\\",this._input.peek()==="["?P=!0:this._input.peek()==="]"&&(P=!1)),this._input.next();return this._input.peek()===O&&(U+=this._input.next(),U+=this._input.read(o.identifier)),this._create_token(r.STRING,U)}return null},x.prototype._read_xml=function(O,N){if(this._options.e4x&&O==="<"&&this._allow_regexp_or_xml(N)){var U="",W=this.__patterns.xml.read_match();if(W){for(var P=W[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),K=P.indexOf("{")===0,V=0;W;){var re=!!W[1],ee=W[2],le=!!W[W.length-1]||ee.slice(0,8)==="![CDATA[";if(!le&&(ee===P||K&&ee.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(re?--V:++V),U+=W[0],V<=0)break;W=this.__patterns.xml.read_match()}return W||(U+=this._input.match(/[\s\S]*/g)[0]),U=U.replace(o.allLineBreaks,`
|
|
`),this._create_token(r.STRING,U)}}return null};function R(O){for(var N="",U=0,W=new g(O),P=null;W.hasNext();)if(P=W.match(/([\s]|[^\\]|\\\\)+/g),P&&(N+=P[0]),W.peek()==="\\"){if(W.next(),W.peek()==="x")P=W.match(/x([0-9A-Fa-f]{2})/g);else if(W.peek()==="u")P=W.match(/u([0-9A-Fa-f]{4})/g);else{N+="\\",W.hasNext()&&(N+=W.next());continue}if(!P)return O;if(U=parseInt(P[1],16),U>126&&U<=255&&P[0].indexOf("x")===0)return O;if(U>=0&&U<32){N+="\\"+P[0];continue}else U===34||U===39||U===92?N+="\\"+String.fromCharCode(U):N+=String.fromCharCode(U)}return N}x.prototype._read_string_recursive=function(O,N,U){var W,P;O==="'"?P=this.__patterns.single_quote:O==='"'?P=this.__patterns.double_quote:O==="`"?P=this.__patterns.template_text:O==="}"&&(P=this.__patterns.template_expression);for(var K=P.read(),V="";this._input.hasNext();){if(V=this._input.next(),V===O||!N&&o.newline.test(V)){this._input.back();break}else V==="\\"&&this._input.hasNext()?(W=this._input.peek(),W==="x"||W==="u"?this.has_char_escapes=!0:W==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),V+=this._input.next()):U&&(U==="${"&&V==="$"&&this._input.peek()==="{"&&(V+=this._input.next()),U===V&&(O==="`"?V+=this._read_string_recursive("}",N,"`"):V+=this._read_string_recursive("`",N,"${"),this._input.hasNext()&&(V+=this._input.next())));V+=P.read(),K+=V}return K},w.exports.Tokenizer=x,w.exports.TOKEN=r,w.exports.positionable_operators=y.slice(),w.exports.line_starters=h.slice()},function(w){var S=RegExp.prototype.hasOwnProperty("sticky");function m(g){this.__input=g||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__input.charAt(this.__position),this.__position+=1),g},m.prototype.peek=function(g){var s=null;return g=g||0,g+=this.__position,g>=0&&g<this.__input_length&&(s=this.__input.charAt(g)),s},m.prototype.__match=function(g,s){g.lastIndex=s;var a=g.exec(this.__input);return a&&!(S&&g.sticky)&&(a.index!==s&&(a=null)),a},m.prototype.test=function(g,s){return s=s||0,s+=this.__position,s>=0&&s<this.__input_length?!!this.__match(g,s):!1},m.prototype.testChar=function(g,s){var a=this.peek(s);return g.lastIndex=0,a!==null&&g.test(a)},m.prototype.match=function(g){var s=this.__match(g,this.__position);return s?this.__position+=s[0].length:s=null,s},m.prototype.read=function(g,s,a){var i="",o;return g&&(o=this.match(g),o&&(i+=o[0])),s&&(o||!g)&&(i+=this.readUntil(s,a)),i},m.prototype.readUntil=function(g,s){var a="",i=this.__position;g.lastIndex=this.__position;var o=g.exec(this.__input);return o?(i=o.index,s&&(i+=o[0].length)):i=this.__input_length,a=this.__input.substring(this.__position,i),this.__position=i,a},m.prototype.readUntilAfter=function(g){return this.readUntil(g,!0)},m.prototype.get_regexp=function(g,s){var a=null,i="g";return s&&S&&(i="y"),typeof g=="string"&&g!==""?a=new RegExp(g,i):g&&(a=new RegExp(g.source,i)),a},m.prototype.get_literal_regexp=function(g){return RegExp(g.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(g){var s=this.__position,a=this.readUntilAfter(g);return this.__position=s,a},m.prototype.lookBack=function(g){var s=this.__position-1;return s>=g.length&&this.__input.substring(s-g.length,s).toLowerCase()===g},w.exports.InputScanner=m},function(w,S,m){var g=m(8).InputScanner,s=m(3).Token,a=m(10).TokenStream,i=m(11).WhitespacePattern,o={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},n=function(e,t){this._input=new g(e),this._options=t||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new i(this._input)};n.prototype.tokenize=function(){this._input.restart(),this.__tokens=new a,this._reset();for(var e,t=new s(o.START,""),r=null,T=[],v=new a;t.type!==o.EOF;){for(e=this._get_next_token(t,r);this._is_comment(e);)v.add(e),e=this._get_next_token(t,r);v.isEmpty()||(e.comments_before=v,v=new a),e.parent=r,this._is_opening(e)?(T.push(r),r=e):r&&this._is_closing(e,r)&&(e.opened=r,r.closed=e,r=T.pop(),e.parent=r),e.previous=t,t.next=e,this.__tokens.add(e),t=e}return this.__tokens},n.prototype._is_first_token=function(){return this.__tokens.isEmpty()},n.prototype._reset=function(){},n.prototype._get_next_token=function(e,t){this._readWhitespace();var r=this._input.read(/.+/g);return r?this._create_token(o.RAW,r):this._create_token(o.EOF,"")},n.prototype._is_comment=function(e){return!1},n.prototype._is_opening=function(e){return!1},n.prototype._is_closing=function(e,t){return!1},n.prototype._create_token=function(e,t){var r=new s(e,t,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return r},n.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},w.exports.Tokenizer=n,w.exports.TOKEN=o},function(w){function S(m){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=m}S.prototype.restart=function(){this.__position=0},S.prototype.isEmpty=function(){return this.__tokens_length===0},S.prototype.hasNext=function(){return this.__position<this.__tokens_length},S.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__tokens[this.__position],this.__position+=1),m},S.prototype.peek=function(m){var g=null;return m=m||0,m+=this.__position,m>=0&&m<this.__tokens_length&&(g=this.__tokens[m]),g},S.prototype.add=function(m){this.__parent_token&&(m.parent=this.__parent_token),this.__tokens.push(m),this.__tokens_length+=1},w.exports.TokenStream=S},function(w,S,m){var g=m(12).Pattern;function s(a,i){g.call(this,a,i),i?this._line_regexp=this._input.get_regexp(i._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}s.prototype=new g,s.prototype.__set_whitespace_patterns=function(a,i){a+="\\t ",i+="\\n\\r",this._match_pattern=this._input.get_regexp("["+a+i+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+i+"]")},s.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var a=this._input.read(this._match_pattern);if(a===" ")this.whitespace_before_token=" ";else if(a){var i=this.__split(this._newline_regexp,a);this.newline_count=i.length-1,this.whitespace_before_token=i[this.newline_count]}return a},s.prototype.matching=function(a,i){var o=this._create();return o.__set_whitespace_patterns(a,i),o._update(),o},s.prototype._create=function(){return new s(this._input,this)},s.prototype.__split=function(a,i){a.lastIndex=0;for(var o=0,n=[],e=a.exec(i);e;)n.push(i.substring(o,e.index)),o=e.index+e[0].length,e=a.exec(i);return o<i.length?n.push(i.substring(o,i.length)):n.push(""),n},w.exports.WhitespacePattern=s},function(w){function S(m,g){this._input=m,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,g&&(this._starting_pattern=this._input.get_regexp(g._starting_pattern,!0),this._match_pattern=this._input.get_regexp(g._match_pattern,!0),this._until_pattern=this._input.get_regexp(g._until_pattern),this._until_after=g._until_after)}S.prototype.read=function(){var m=this._input.read(this._starting_pattern);return(!this._starting_pattern||m)&&(m+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),m},S.prototype.read_match=function(){return this._input.match(this._match_pattern)},S.prototype.until_after=function(m){var g=this._create();return g._until_after=!0,g._until_pattern=this._input.get_regexp(m),g._update(),g},S.prototype.until=function(m){var g=this._create();return g._until_after=!1,g._until_pattern=this._input.get_regexp(m),g._update(),g},S.prototype.starting_with=function(m){var g=this._create();return g._starting_pattern=this._input.get_regexp(m,!0),g._update(),g},S.prototype.matching=function(m){var g=this._create();return g._match_pattern=this._input.get_regexp(m,!0),g._update(),g},S.prototype._create=function(){return new S(this._input,this)},S.prototype._update=function(){},w.exports.Pattern=S},function(w){function S(m,g){m=typeof m=="string"?m:m.source,g=typeof g=="string"?g:g.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+g,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+g,"g")}S.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var g={};this.__directive_pattern.lastIndex=0;for(var s=this.__directive_pattern.exec(m);s;)g[s[1]]=s[2],s=this.__directive_pattern.exec(m);return g},S.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},w.exports.Directives=S},function(w,S,m){var g=m(12).Pattern,s={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function a(i,o){g.call(this,i,o),this.__template_pattern=null,this._disabled=Object.assign({},s),this._excluded=Object.assign({},s),o&&(this.__template_pattern=this._input.get_regexp(o.__template_pattern),this._excluded=Object.assign(this._excluded,o._excluded),this._disabled=Object.assign(this._disabled,o._disabled));var n=new g(i);this.__patterns={handlebars_comment:n.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:n.starting_with(/{{{/).until_after(/}}}/),handlebars:n.starting_with(/{{/).until_after(/}}/),php:n.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:n.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:n.starting_with(/{%/).until_after(/%}/),django_value:n.starting_with(/{{/).until_after(/}}/),django_comment:n.starting_with(/{#/).until_after(/#}/),smarty:n.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:n.starting_with(/{\*/).until_after(/\*}/),smarty_literal:n.starting_with(/{literal}/).until_after(/{\/literal}/)}}a.prototype=new g,a.prototype._create=function(){return new a(this._input,this)},a.prototype._update=function(){this.__set_templated_pattern()},a.prototype.disable=function(i){var o=this._create();return o._disabled[i]=!0,o._update(),o},a.prototype.read_options=function(i){var o=this._create();for(var n in s)o._disabled[n]=i.templating.indexOf(n)===-1;return o._update(),o},a.prototype.exclude=function(i){var o=this._create();return o._excluded[i]=!0,o._update(),o},a.prototype.read=function(){var i="";this._match_pattern?i=this._input.read(this._starting_pattern):i=this._input.read(this._starting_pattern,this.__template_pattern);for(var o=this._read_template();o;)this._match_pattern?o+=this._input.read(this._match_pattern):o+=this._input.readUntil(this.__template_pattern),i+=o,o=this._read_template();return this._until_after&&(i+=this._input.readUntilAfter(this._until_pattern)),i},a.prototype.__set_templated_pattern=function(){var i=[];this._disabled.php||i.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||i.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||i.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(i.push(this.__patterns.django._starting_pattern.source),i.push(this.__patterns.django_value._starting_pattern.source),i.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||i.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&i.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+i.join("|")+")")},a.prototype._read_template=function(){var i="",o=this._input.peek();if(o==="<"){var n=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&n==="?"&&(i=i||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&n==="%"&&(i=i||this.__patterns.erb.read())}else o==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(i=i||this.__patterns.handlebars_comment.read(),i=i||this.__patterns.handlebars_unescaped.read(),i=i||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(i=i||this.__patterns.django_value.read()),this._excluded.django||(i=i||this.__patterns.django_comment.read(),i=i||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(i=i||this.__patterns.smarty_comment.read(),i=i||this.__patterns.smarty_literal.read(),i=i||this.__patterns.smarty.read()));return i},w.exports.TemplatablePattern=a}],A={};function B(w){var S=A[w];if(S!==void 0)return S.exports;var m=A[w]={exports:{}};return L[w](m,m.exports,B),m.exports}var M=B(0);C=M})();var j=C;!(de=[],H=function(){return{js_beautify:j}}.apply(We,de),H!==void 0&&(et.exports=H))})()},"815F":function(et,We,J){"use strict";J.d(We,"e",function(){return B}),J.d(We,"c",function(){return w}),J.d(We,"d",function(){return S}),J.d(We,"a",function(){return g}),J.d(We,"f",function(){return s}),J.d(We,"b",function(){return a});var de=J("KQm4"),H=J("VTBJ"),C=J("Ff2n"),j=J("Zm9Q"),L=J("Kwbf"),A=J("OZM5");function B(i,o){return i!=null?i:o}function M(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],o=new Map;function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(e||[]).forEach(function(r){var T=r.key,v=r.children;Object(L.a)(T!=null,"Tree node must have a certain key: [".concat(t).concat(T,"]"));var f=String(T);Object(L.a)(!o.has(f)||T===null||T===void 0,"Same 'key' exist in the Tree: ".concat(f)),o.set(f,!0),n(v,"".concat(t).concat(f," > "))})}n(i)}function w(i){function o(n){var e=Object(j.a)(n);return e.map(function(t){if(!Object(A.i)(t))return Object(L.a)(!t,"Tree/TreeNode can only accept TreeNode as children."),null;var r=t.key,T=t.props,v=T.children,f=Object(C.a)(T,["children"]),E=Object(H.a)({key:r},f),y=o(v);return y.length&&(E.children=y),E}).filter(function(t){return t})}return o(i)}function S(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=new Set(o===!0?[]:o),e=[];function t(r){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return r.map(function(v,f){var E=Object(A.h)(T?T.pos:"0",f),y=B(v.key,E),u=Object(H.a)(Object(H.a)({},v),{},{parent:T,pos:E,children:null,data:v,isStart:[].concat(Object(de.a)(T?T.isStart:[]),[f===0]),isEnd:[].concat(Object(de.a)(T?T.isEnd:[]),[f===r.length-1])});return e.push(u),o===!0||n.has(y)?u.children=t(v.children||[],u):u.children=[],u})}return t(i),e}function m(i,o,n){var e;n?typeof n=="string"?e=function(T){return T[n]}:typeof n=="function"&&(e=function(T){return n(T)}):e=function(T,v){return B(T.key,v)};function t(r,T,v){var f=r?r.children:i,E=r?Object(A.h)(v.pos,T):"0";if(r){var y=e(r,E),u={node:r,index:T,pos:E,key:y,parentPos:v.node?v.pos:null,level:v.level+1};o(u)}f&&f.forEach(function(l,h){t(l,h,{node:r,pos:E,level:v?v.level+1:-1})})}t(null)}function g(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=o.initWrapper,e=o.processEntity,t=o.onProcessFinished,r=arguments.length>2?arguments[2]:void 0,T={},v={},f={posEntities:T,keyEntities:v};return n&&(f=n(f)||f),m(i,function(E){var y=E.node,u=E.index,l=E.pos,h=E.key,d=E.parentPos,b=E.level,p={node:y,index:u,key:h,pos:l,level:b},x=B(h,l);T[l]=p,v[x]=p,p.parent=T[d],p.parent&&(p.parent.children=p.parent.children||[],p.parent.children.push(p)),e&&e(p,f)},r),t&&t(f),f}function s(i,o){var n=o.expandedKeys,e=o.selectedKeys,t=o.loadedKeys,r=o.loadingKeys,T=o.checkedKeys,v=o.halfCheckedKeys,f=o.dragOverNodeKey,E=o.dropPosition,y=o.keyEntities,u=y[i],l={eventKey:i,expanded:n.indexOf(i)!==-1,selected:e.indexOf(i)!==-1,loaded:t.indexOf(i)!==-1,loading:r.indexOf(i)!==-1,checked:T.indexOf(i)!==-1,halfChecked:v.indexOf(i)!==-1,pos:String(u?u.pos:""),dragOver:f===i&&E===0,dragOverGapTop:f===i&&E===-1,dragOverGapBottom:f===i&&E===1};return l}function a(i){var o=i.data,n=i.expanded,e=i.selected,t=i.checked,r=i.loaded,T=i.loading,v=i.halfChecked,f=i.dragOver,E=i.dragOverGapTop,y=i.dragOverGapBottom,u=i.pos,l=i.active,h=Object(H.a)(Object(H.a)({},o),{},{expanded:n,selected:e,checked:t,loaded:r,loading:T,halfChecked:v,dragOver:f,dragOverGapTop:E,dragOverGapBottom:y,pos:u,active:l});return"props"in h||Object.defineProperty(h,"props",{get:function(){return Object(L.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),i}}),h}},"8Jsi":function(et,We,J){"use strict";J.d(We,"d",function(){return d}),J.d(We,"a",function(){return Oe}),J.d(We,"b",function(){return Pe}),J.d(We,"c",function(){return Ae});var de=J("1OyB"),H=J("vuIU"),C=J("Ji7U"),j=J("LK+K"),L=J("KQm4"),A=J("U8pU"),B=J("ODXe"),M=J("VTBJ"),w=J("q1tI"),S=J("qNPg"),m=J("2Qr1"),g=J("815F"),s=J("NvD2"),a=J("wPlo"),i=J("6cGi"),o=J("Kwbf"),n=J("4IlW"),e=J("YrtM"),t=J("fAei"),r=w.createContext(null);function T(ue,pe){if(!ue)return!0;var ye=ue.data,Te=ye.disabled,we=ye.disableCheckbox;switch(pe){case"select":return Te;case"checkbox":return Te||we}return!1}function v(ue,pe){var ye=w.useCallback(function(we){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",ve=arguments.length>2?arguments[2]:void 0,Ne=ue.get(we);return!ve&&T(Ne,xe)?null:Ne},[ue]),Te=w.useCallback(function(we){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",ve=arguments.length>2?arguments[2]:void 0,Ne=pe.get(we);return!ve&&T(Ne,xe)?null:Ne},[pe]);return[ye,Te]}function f(ue){return w.useMemo(function(){var pe=new Map,ye=new Map;return ue.forEach(function(Te){pe.set(Te.key,Te),ye.set(Te.data.value,Te)}),[pe,ye]},[ue])}var E={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},y=function(pe,ye){var Te=pe.prefixCls,we=pe.height,xe=pe.itemHeight,ve=pe.virtual,Ne=pe.options,Ue=pe.flattenOptions,he=pe.multiple,Le=pe.searchValue,se=pe.onSelect,te=pe.onToggleOpen,ae=pe.open,G=pe.notFoundContent,Y=pe.onMouseEnter,Q=w.useContext(r),q=Q.checkable,ce=Q.checkedKeys,_e=Q.halfCheckedKeys,ke=Q.treeExpandedKeys,Ke=Q.treeDefaultExpandAll,Xe=Q.treeDefaultExpandedKeys,ze=Q.onTreeExpand,qe=Q.treeIcon,it=Q.showTreeIcon,Ye=Q.switcherIcon,mt=Q.treeLine,at=Q.treeNodeFilterProp,yt=Q.loadData,dt=Q.treeLoadedKeys,tt=Q.treeMotion,_t=Q.onTreeLoad,Et=w.useRef(),Be=Object(e.a)(function(){return Ne},[ae,Ne],function(He,Ce){return Ce[0]&&He[1]!==Ce[1]}),$e=f(Ue),Qe=Object(B.a)($e,2),Je=Qe[0],ft=Qe[1],Tt=v(Je,ft),Rt=Object(B.a)(Tt,2),ot=Rt[0],rt=Rt[1],Ze=w.useMemo(function(){return ce.map(function(He){var Ce=rt(He);return Ce?Ce.key:null})},[ce]),ut=w.useMemo(function(){return q?{checked:Ze,halfChecked:_e}:null},[Ze,_e,q]);w.useEffect(function(){if(ae&&!he&&Ze.length){var He;(He=Et.current)===null||He===void 0||He.scrollTo({key:Ze[0]})}},[ae]);var ct=String(Le).toLowerCase(),st=function(Ce){return ct?String(Ce[at]).toLowerCase().includes(ct):!1},lt=w.useState(Xe),gt=Object(B.a)(lt,2),It=gt[0],Ft=gt[1],Mt=w.useState(null),Wt=Object(B.a)(Mt,2),jt=Wt[0],Vt=Wt[1],Kt=w.useMemo(function(){return ke?Object(L.a)(ke):Le?jt:It},[It,jt,ct,ke]);w.useEffect(function(){Le&&Vt(Ue.map(function(He){return He.key}))},[Le]);var k=function(Ce){Ft(Ce),Vt(Ce),ze&&ze(Ce)},c=function(Ce){Ce.preventDefault()},_=function(Ce,Ve){var Ge=Ve.node.key,nt=ot(Ge,q?"checkbox":"select");nt!==null&&se(nt.data.value,{selected:!ce.includes(nt.data.value)}),he||te(!1)},I=w.useState(null),F=Object(B.a)(I,2),D=F[0],ie=F[1],Re=ot(D);if(w.useImperativeHandle(ye,function(){return{onKeyDown:function(Ce){var Ve,Ge=Ce.which;switch(Ge){case n.a.UP:case n.a.DOWN:case n.a.LEFT:case n.a.RIGHT:(Ve=Et.current)===null||Ve===void 0||Ve.onKeyDown(Ce);break;case n.a.ENTER:{Re!==null&&_(null,{node:{key:D},selected:!ce.includes(Re.data.value)});break}case n.a.ESC:te(!1)}},onKeyUp:function(){}}}),Be.length===0)return w.createElement("div",{role:"listbox",className:"".concat(Te,"-empty"),onMouseDown:c},G);var je={};return dt&&(je.loadedKeys=dt),Kt&&(je.expandedKeys=Kt),w.createElement("div",{onMouseDown:c,onMouseEnter:Y},Re&&ae&&w.createElement("span",{style:E,"aria-live":"assertive"},Re.data.value),w.createElement(t.b,Object.assign({ref:Et,focusable:!1,prefixCls:"".concat(Te,"-tree"),treeData:Be,height:we,itemHeight:xe,virtual:ve,multiple:he,icon:qe,showIcon:it,switcherIcon:Ye,showLine:mt,loadData:Le?null:yt,motion:tt,checkable:q,checkStrictly:!0,checkedKeys:ut,selectedKeys:q?[]:Ze,defaultExpandAll:Ke},je,{onActiveChange:ie,onSelect:_,onCheck:_,onExpand:k,onLoad:_t,filterTreeNode:st})))},u=w.forwardRef(y);u.displayName="OptionList";var l=u,h=function(){return null},d=h,b=J("Ff2n"),p=J("Zm9Q");function x(ue){return Object(p.a)(ue).map(function(pe){if(!w.isValidElement(pe)||!pe.type)return null;var ye=pe.key,Te=pe.props,we=Te.children,xe=Te.value,ve=Object(b.a)(Te,["children","value"]),Ne=Object(M.a)({key:ye,value:xe},ve),Ue=x(we);return Ue.length&&(Ne.children=Ue),Ne}).filter(function(pe){return pe})}function R(ue){if(!ue)return ue;var pe=Object(M.a)({},ue);return"props"in pe||Object.defineProperty(pe,"props",{get:function(){return Object(o.a)(!1,"New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."),pe}}),pe}function O(ue,pe,ye,Te,we){var xe=null,ve=null;function Ne(){function Ue(he){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return he.map(function(te,ae){var G="".concat(Le,"-").concat(ae),Y=ye.includes(te.value),Q=Ue(te.children||[],G,Y),q=w.createElement(d,Object.assign({},te),Q.map(function(_e){return _e.node}));if(pe===te.value&&(xe=q),Y){var ce={pos:G,node:q,children:Q};return se||ve.push(ce),ce}return null}).filter(function(te){return te})}ve||(ve=[],Ue(Te),ve.sort(function(he,Le){var se=he.node.props.value,te=Le.node.props.value,ae=ye.indexOf(se),G=ye.indexOf(te);return ae-G}))}Object.defineProperty(ue,"triggerNode",{get:function(){return Object(o.a)(!1,"`triggerNode` is deprecated. Please consider decoupling data with node."),Ne(),xe}}),Object.defineProperty(ue,"allCheckedNodes",{get:function(){return Object(o.a)(!1,"`allCheckedNodes` is deprecated. Please consider decoupling data with node."),Ne(),we?ve:ve.map(function(he){var Le=he.node;return Le})}})}function N(ue){return Array.isArray(ue)?ue:ue!==void 0?[ue]:[]}function U(ue,pe){var ye=new Map;return pe.forEach(function(Te){var we=Te.data;ye.set(we.value,we)}),ue.map(function(Te){return R(ye.get(Te))})}function W(ue,pe){var ye=U([ue],pe)[0];return ye?ye.disabled:!1}function P(ue){return ue.disabled||ue.disableCheckbox||ue.checkable===!1}function K(ue){for(var pe=ue.parent,ye=0,Te=pe;Te;)Te=Te.parent,ye+=1;return ye}function V(ue){function pe(Te){return(Te||[]).map(function(we){var xe=we.value,ve=we.key,Ne=we.children,Ue=Object(M.a)(Object(M.a)({},we),{},{key:"key"in we?ve:xe});return Ne&&(Ue.children=pe(Ne)),Ue})}var ye=Object(g.d)(pe(ue),!0);return ye.map(function(Te){return{key:Te.data.key,data:Te.data,level:K(Te)}})}function re(ue){return function(pe,ye){var Te=ye[ue];return String(Te).toLowerCase().includes(String(pe).toLowerCase())}}function ee(ue,pe,ye){var Te=ye.optionFilterProp,we=ye.filterOption;if(we===!1)return pe;var xe;typeof we=="function"?xe=we:xe=re(Te);function ve(Ne){var Ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ne.map(function(he){var Le=he.children,se=Ue||xe(ue,R(he)),te=ve(Le||[],se);return se||te.length?Object(M.a)(Object(M.a)({},he),{},{children:te}):null}).filter(function(he){return he})}return ve(pe)}function le(ue,pe,ye,Te){var we=new Map;return N(pe).forEach(function(xe){xe&&Object(A.a)(xe)==="object"&&"value"in xe&&we.set(xe.value,xe)}),ue.map(function(xe){var ve={value:xe},Ne=ye(xe,"select",!0),Ue=Ne?Te(Ne.data):xe;if(we.has(xe)){var he=we.get(xe);ve.label="label"in he?he.label:Ue,"halfChecked"in he&&(ve.halfChecked=he.halfChecked)}else ve.label=Ue;return ve})}function oe(ue,pe){var ye=new Set(ue);return ye.add(pe),Array.from(ye)}function $(ue,pe){var ye=new Set(ue);return ye.delete(pe),Array.from(ye)}function Z(ue){var pe=ue.searchPlaceholder,ye=ue.treeCheckStrictly,Te=ue.treeCheckable,we=ue.labelInValue,xe=ue.value,ve=ue.multiple;Object(o.a)(!pe,"`searchPlaceholder` has been removed."),ye&&we===!1&&Object(o.a)(!1,"`treeCheckStrictly` will force set `labelInValue` to `true`."),(we||ye)&&Object(o.a)(N(xe).every(function(Ne){return Ne&&Object(A.a)(Ne)==="object"&&"value"in Ne}),"Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."),ye||ve||Te?Object(o.a)(!xe||Array.isArray(xe),"`value` should be an array when `TreeSelect` is checkable or multiple."):Object(o.a)(!Array.isArray(xe),"`value` should not be array when `TreeSelect` is single mode.")}var ne=Z,X=10;function z(ue,pe){var ye=pe.id,Te=pe.pId,we=pe.rootPId,xe={},ve=[],Ne=ue.map(function(Ue){var he=Object(M.a)({},Ue),Le=he[ye];return xe[Le]=he,he.key=he.key||Le,he});return Ne.forEach(function(Ue){var he=Ue[Te],Le=xe[he];Le&&(Le.children=Le.children||[],Le.children.push(Ue)),(he===we||!Le&&we===null)&&ve.push(Ue)}),ve}function fe(ue,pe){var ye=0,Te=new Set;function we(xe){return(xe||[]).map(function(ve){var Ne=ve.key,Ue=ve.value,he=ve.children,Le=Object(b.a)(ve,["key","value","children"]),se="value"in ve?Ue:Ne,te=Object(M.a)(Object(M.a)({},Le),{},{key:Ne!=null?Ne:se,value:se,title:pe(ve)});return"children"in ve&&(te.children=we(he)),te})}return we(ue)}function Se(ue,pe,ye){var Te=ye.getLabelProp,we=ye.simpleMode,xe=w.useRef({});return ue?(xe.current.formatTreeData=xe.current.treeData===ue?xe.current.formatTreeData:fe(we?z(ue,Object(M.a)({id:"id",pId:"pId",rootPId:null},we!==!0?we:{})):ue,Te),xe.current.treeData=ue):xe.current.formatTreeData=xe.current.children===pe?xe.current.formatTreeData:fe(x(pe),Te),xe.current.formatTreeData}var Oe="SHOW_ALL",Ae="SHOW_PARENT",Pe="SHOW_CHILD";function me(ue,pe,ye){var Te=new Set(ue);return pe===Pe?ue.filter(function(we){var xe=ye[we];return!(xe&&xe.children&&xe.children.every(function(ve){var Ne=ve.node;return P(Ne)||Te.has(Ne.key)}))}):pe===Ae?ue.filter(function(we){var xe=ye[we],ve=xe?xe.parent:null;return!(ve&&!P(ve.node)&&Te.has(ve.node.key))}):ue}function ge(ue,pe){var ye=pe.value,Te=pe.getEntityByValue,we=pe.getEntityByKey,xe=pe.treeConduction,ve=pe.showCheckedStrategy,Ne=pe.conductKeyEntities,Ue=pe.getLabelProp;return w.useMemo(function(){var he=ue;if(xe){var Le=me(ue.map(function(se){var te=Te(se);return te?te.key:se}),ve,Ne);he=Le.map(function(se){var te=we(se);return te?te.data.value:se})}return le(he,ye,Te,Ue)},[ue,ye,xe,ve,Te])}var be=["expandedKeys","treeData","treeCheckable","showCheckedStrategy","searchPlaceholder","treeLine","treeIcon","showTreeIcon","switcherIcon","treeNodeFilterProp","filterTreeNode","dropdownPopupAlign","treeDefaultExpandAll","treeCheckStrictly","treeExpandedKeys","treeLoadedKeys","treeMotion","onTreeExpand","onTreeLoad","loadData","treeDataSimpleMode","treeNodeLabelProp","treeDefaultExpandedKeys"],Ee=Object(S.a)({prefixCls:"rc-tree-select",components:{optionList:l},convertChildrenToData:function(){return null},flattenOptions:V,getLabeledValue:m.e,filterOptions:ee,isValueDisabled:W,findValueOption:U,omitDOMProps:function(pe){var ye=Object(M.a)({},pe);return be.forEach(function(Te){delete ye[Te]}),ye}});Ee.displayName="Select";var Ie=w.forwardRef(function(ue,pe){var ye=ue.multiple,Te=ue.treeCheckable,we=ue.treeCheckStrictly,xe=ue.showCheckedStrategy,ve=xe===void 0?"SHOW_CHILD":xe,Ne=ue.labelInValue,Ue=ue.loadData,he=ue.treeLoadedKeys,Le=ue.treeNodeFilterProp,se=Le===void 0?"value":Le,te=ue.treeNodeLabelProp,ae=ue.treeDataSimpleMode,G=ue.treeData,Y=ue.treeExpandedKeys,Q=ue.treeDefaultExpandedKeys,q=ue.treeDefaultExpandAll,ce=ue.children,_e=ue.treeIcon,ke=ue.showTreeIcon,Ke=ue.switcherIcon,Xe=ue.treeLine,ze=ue.treeMotion,qe=ue.filterTreeNode,it=ue.dropdownPopupAlign,Ye=ue.onChange,mt=ue.onTreeExpand,at=ue.onTreeLoad,yt=ue.onDropdownVisibleChange,dt=ue.onSelect,tt=ue.onDeselect,_t=Te||we,Et=ye||_t,Be=Te&&!we,$e=we||Ne,Qe=w.useRef(null);w.useImperativeHandle(pe,function(){return{focus:Qe.current.focus,blur:Qe.current.blur}});var Je=function(Ge){return G&&Ge.label||Ge.title},ft=function(Ge){return te?Ge[te]:Je(Ge)},Tt=Se(G,ce,{getLabelProp:Je,simpleMode:ae}),Rt=Object(w.useMemo)(function(){return V(Tt)},[Tt]),ot=f(Rt),rt=Object(B.a)(ot,2),Ze=rt[0],ut=rt[1],ct=v(Ze,ut),st=Object(B.a)(ct,2),lt=st[0],gt=st[1],It=Object(w.useMemo)(function(){return Be?Object(g.a)(Tt):{keyEntities:null}},[Tt,Te,we]),Ft=It.keyEntities,Mt=Object(i.a)(ue.defaultValue,{value:ue.value}),Wt=Object(B.a)(Mt,2),jt=Wt[0],Vt=Wt[1],Kt=function(Ge){var nt=[],St=[];return Ge.forEach(function(xt){gt(xt)?St.push(xt):nt.push(xt)}),{missingRawValues:nt,existRawValues:St}},k=Object(w.useMemo)(function(){var Ve=[],Ge=[];if(N(jt).forEach(function(vt){if(vt&&Object(A.a)(vt)==="object"&&"value"in vt)if(vt.halfChecked&&we){var Ot=gt(vt.value);Ve.push(Ot?Ot.key:vt.value)}else Ge.push(vt.value);else Ge.push(vt)}),Be){var nt=Kt(Ge),St=nt.missingRawValues,xt=nt.existRawValues,bt=xt.map(function(vt){return gt(vt).key}),Ct=Object(s.a)(bt,!0,Ft),Ht=Ct.checkedKeys,Nt=Ct.halfCheckedKeys;return[[].concat(Object(L.a)(St),Object(L.a)(Ht.map(function(vt){return lt(vt).data.value}))),Nt]}return[Ge,Ve]},[jt,Et,$e,Te,we]),c=Object(B.a)(k,2),_=c[0],I=c[1],F=ge(_,{treeConduction:Be,value:jt,showCheckedStrategy:ve,conductKeyEntities:Ft,getEntityByValue:gt,getEntityByKey:lt,getLabelProp:ft}),D=function(Ge,nt,St){if(Vt(Et?Ge:Ge[0]),Ye){var xt=Ge;if(Be&&ve!=="SHOW_ALL"){var bt=Ge.map(function(At){var Pt=gt(At);return Pt?Pt.key:At}),Ct=me(bt,ve,Ft);xt=Ct.map(function(At){var Pt=lt(At);return Pt?Pt.data.value:At})}var Ht=nt||{triggerValue:void 0,selected:void 0},Nt=Ht.triggerValue,vt=Ht.selected,Ot=$e?le(xt,jt,gt,ft):xt;if(we){var Gt=I.map(function(At){var Pt=lt(At);return Pt?Pt.data.value:At}).filter(function(At){return!xt.includes(At)});Ot=[].concat(Object(L.a)(Ot),Object(L.a)(le(Gt,jt,gt,ft)))}var Lt={preValue:F,triggerValue:Nt},Yt=!0;(we||St==="selection"&&!vt)&&(Yt=!1),O(Lt,Nt,Ge,Tt,Yt),_t?Lt.checked=vt:Lt.selected=vt,Ye(Et?Ot:Ot[0],$e?null:xt.map(function(At){var Pt=gt(At);return Pt?ft(Pt.data):null}),Lt)}},ie=function(Ge,nt,St){var xt=Ge;if(!Et)D([Ge],{selected:!0,triggerValue:Ge},St);else{var bt=oe(_,Ge);if(Be){var Ct=Kt(bt),Ht=Ct.missingRawValues,Nt=Ct.existRawValues,vt=Nt.map(function(Lt){return gt(Lt).key}),Ot=Object(s.a)(vt,!0,Ft),Gt=Ot.checkedKeys;bt=[].concat(Object(L.a)(Ht),Object(L.a)(Gt.map(function(Lt){return lt(Lt).data.value})))}D(bt,{selected:!0,triggerValue:Ge},St)}dt&&dt(xt,nt)},Re=function(Ge,nt,St){var xt=Ge,bt=$(_,Ge);if(Be){var Ct=Kt(bt),Ht=Ct.missingRawValues,Nt=Ct.existRawValues,vt=Nt.map(function(Lt){return gt(Lt).key}),Ot=Object(s.a)(vt,{checked:!1,halfCheckedKeys:I},Ft),Gt=Ot.checkedKeys;bt=[].concat(Object(L.a)(Ht),Object(L.a)(Gt.map(function(Lt){return lt(Lt).data.value})))}D(bt,{selected:!1,triggerValue:Ge},St),tt&&tt(xt,nt)},je=function(){D([],null,"clear")},He=w.useCallback(function(Ve){if(yt){var Ge={};Object.defineProperty(Ge,"documentClickClose",{get:function(){return Object(o.a)(!1,"Second param of `onDropdownVisibleChange` has been removed."),!1}}),yt(Ve,Ge)}},[yt]),Ce={optionLabelProp:null,optionFilterProp:se,dropdownAlign:it,internalProps:{mark:a.a,onClear:je,skipTriggerChange:!0,skipTriggerSelect:!0,onRawSelect:ie,onRawDeselect:Re}};return"filterTreeNode"in ue&&(Ce.filterOption=qe),w.createElement(r.Provider,{value:{checkable:_t,loadData:Ue,treeLoadedKeys:he,onTreeLoad:at,checkedKeys:_,halfCheckedKeys:I,treeDefaultExpandAll:q,treeExpandedKeys:Y,treeDefaultExpandedKeys:Q,onTreeExpand:mt,treeIcon:_e,treeMotion:ze,showTreeIcon:ke,switcherIcon:Ke,treeLine:Xe,treeNodeFilterProp:se}},w.createElement(Ee,Object.assign({ref:Qe,mode:Et?"multiple":null},ue,Ce,{value:F,labelInValue:!0,options:Tt,onChange:null,onSelect:null,onDeselect:null,onDropdownVisibleChange:He})))}),Me=function(ue){Object(C.a)(ye,ue);var pe=Object(j.a)(ye);function ye(){var Te;return Object(de.a)(this,ye),Te=pe.apply(this,arguments),Te.selectRef=w.createRef(),Te.focus=function(){Te.selectRef.current.focus()},Te.blur=function(){Te.selectRef.current.blur()},Te}return Object(H.a)(ye,[{key:"render",value:function(){return w.createElement(Ie,Object.assign({ref:this.selectRef},this.props))}}]),ye}(w.Component);Me.TreeNode=d,Me.SHOW_ALL=Oe,Me.SHOW_PARENT=Ae,Me.SHOW_CHILD=Pe;var De=Me,Fe=We.e=De},"8hTe":function(et,We,J){et.exports={button:"button___1wy9m"}},"9Bee":function(et,We,J){"use strict";var de=J("DYRE"),H=J("zeV3"),C=J("+L6B"),j=J("2/Rp"),L=J("k1fw"),A=J("9og8"),B=J("tJVT"),M=J("WmNS"),w=J.n(M),S=J("q1tI"),m=J.n(S),g=J("vg9a"),s=J("DlQD"),a=J.n(s),i=J("rUJ1");function o(k,c){var _=k.match(/^(\s+)(?:```)/);if(_===null)return c;var I=_[1];return c.split(`
|
|
`).map(function(F){var D=F.match(/^\s+/);if(D===null)return F;var ie=Object(B.a)(D,1),Re=ie[0];return Re.length>=I.length?F.slice(I.length):F}).join(`
|
|
`)}var n=[],e=["<ul>"],t=new a.a.Renderer,r=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function T(){n.length=0,e=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function f(k,c,_,I){if(c>=k.length||k[c].level<=_)return c;var F=k[c];I.push("<li><a href='#"+F.anchor+"'>"+F.text+"</a>"),c++;var D=[];return c=f(k,c,F.level,D),D.length>0&&(I.push("<ul>"),D.forEach(function(ie){I.push(ie)}),I.push("</ul>")),I.push("</li>"),c=f(k,c,_,I),c}function E(){return f(n,0,0,e),e.push("</ul>"),e.join("")}var y={heading:function(c){var _=r.exec(c);if(_)return{type:"heading",raw:_[0],depth:_[1].length,text:_[2]}},fences:function(c){var _=this.rules.block.fences.exec(c);if(_){var I=_[0],F=o(I,_[3]||""),D=_[2]?_[2].trim():_[2];if(["latex","katex","math"].indexOf(D)>=0){var ie=h(),Re=F;F=ie,d[ie]={type:"block",expression:Re}}return{type:"code",raw:I,lang:D,text:F}}}},u=/(?:\${2})([^\n`]+?)(?:\${2})/gi,l=0,h=function(){return"__special_katext_id_".concat(l++,"__")},d={};function b(){return d}function p(){l=0,d={}}function x(k){return k=k.replace(u,function(c,_){var I=h();return d[I]={type:"inline",expression:_},I}),k}var R=t.listitem;t.listitem=function(k){return R(x(k))};var O=t.paragraph;t.paragraph=function(k){return O(x(k))};var N=t.tablecell;t.tablecell=function(k,c){return N(x(k),c)},t.code=function(k,c,_){var I=(c||"").match(/\S*/)[0];return I?["latex","katex","math"].indexOf(I)>=0?"<p class='editormd-tex'>".concat(k,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(c,'">').concat(_?k:Object(i.escape)(k,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(_?k:Object(i.escape)(k,!0))+"</code></pre>"},t.heading=function(k,c,_){var I=this.options.headerPrefix+_.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return n.push({anchor:I,level:c,text:k}),"<h"+c+' id="'+I+'">'+k+"</h"+c+">"},a.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),a.a.use({tokenizer:y,renderer:t});var U=a.a,W=J("SJMd"),P=J("ulZh"),K=J.n(P),V=J("m3rI"),re=J("Oy/b"),ee=J("p5ED"),le=J("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 oe=function(k,c){return(oe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,I){_.__proto__=I}||function(_,I){for(var F in I)Object.prototype.hasOwnProperty.call(I,F)&&(_[F]=I[F])})(k,c)};function $(k,c){function _(){this.constructor=k}oe(k,c),k.prototype=c===null?Object.create(c):(_.prototype=c.prototype,new _)}function Z(k,c,_,I){return new(_||(_=Promise))(function(F,D){function ie(He){try{je(I.next(He))}catch(Ce){D(Ce)}}function Re(He){try{je(I.throw(He))}catch(Ce){D(Ce)}}function je(He){var Ce;He.done?F(He.value):(Ce=He.value,Ce instanceof _?Ce:new _(function(Ve){Ve(Ce)})).then(ie,Re)}je((I=I.apply(k,c||[])).next())})}function ne(k,c){var _,I,F,D,ie={label:0,sent:function(){if(1&F[0])throw F[1];return F[1]},trys:[],ops:[]};return D={next:Re(0),throw:Re(1),return:Re(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function Re(je){return function(He){return function(Ce){if(_)throw new TypeError("Generator is already executing.");for(;ie;)try{if(_=1,I&&(F=2&Ce[0]?I.return:Ce[0]?I.throw||((F=I.return)&&F.call(I),0):I.next)&&!(F=F.call(I,Ce[1])).done)return F;switch(I=0,F&&(Ce=[2&Ce[0],F.value]),Ce[0]){case 0:case 1:F=Ce;break;case 4:return ie.label++,{value:Ce[1],done:!1};case 5:ie.label++,I=Ce[1],Ce=[0];continue;case 7:Ce=ie.ops.pop(),ie.trys.pop();continue;default:if(!(F=ie.trys,(F=F.length>0&&F[F.length-1])||Ce[0]!==6&&Ce[0]!==2)){ie=0;continue}if(Ce[0]===3&&(!F||Ce[1]>F[0]&&Ce[1]<F[3])){ie.label=Ce[1];break}if(Ce[0]===6&&ie.label<F[1]){ie.label=F[1],F=Ce;break}if(F&&ie.label<F[2]){ie.label=F[2],ie.ops.push(Ce);break}F[2]&&ie.ops.pop(),ie.trys.pop();continue}Ce=c.call(k,ie)}catch(Ve){Ce=[6,Ve],I=0}finally{_=F=0}if(5&Ce[0])throw Ce[1];return{value:Ce[0]?Ce[1]:void 0,done:!0}}([je,He])}}}function X(){for(var k=0,c=0,_=arguments.length;c<_;c++)k+=arguments[c].length;var I=Array(k),F=0;for(c=0;c<_;c++)for(var D=arguments[c],ie=0,Re=D.length;ie<Re;ie++,F++)I[F]=D[ie];return I}var z=function(){function k(){}return k.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},k.setAttributes=function(c,_){for(var I=0,F=_;I<F.length;I++){var D=F[I],ie=D[0],Re=D[1];c.setAttribute(ie,Re)}},k.createRect=function(c,_,I){var F=document.createElementNS("http://www.w3.org/2000/svg","rect");return F.setAttribute("width",c.toString()),F.setAttribute("height",_.toString()),I&&k.setAttributes(F,I),F},k.createLine=function(c,_,I,F,D){var ie=document.createElementNS("http://www.w3.org/2000/svg","line");return ie.setAttribute("x1",c.toString()),ie.setAttribute("y1",_.toString()),ie.setAttribute("x2",I.toString()),ie.setAttribute("y2",F.toString()),D&&k.setAttributes(ie,D),ie},k.createPolygon=function(c,_){var I=document.createElementNS("http://www.w3.org/2000/svg","polygon");return I.setAttribute("points",c),_&&k.setAttributes(I,_),I},k.createCircle=function(c,_){var I=document.createElementNS("http://www.w3.org/2000/svg","circle");return I.setAttribute("cx",(c/2).toString()),I.setAttribute("cy",(c/2).toString()),I.setAttribute("r",c.toString()),_&&k.setAttributes(I,_),I},k.createEllipse=function(c,_,I){var F=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return F.setAttribute("cx",(c/2).toString()),F.setAttribute("cy",(_/2).toString()),F.setAttribute("rx",(c/2).toString()),F.setAttribute("ry",(_/2).toString()),I&&k.setAttributes(F,I),F},k.createGroup=function(c){var _=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&k.setAttributes(_,c),_},k.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},k.createMarker=function(c,_,I,F,D,ie,Re){var je=document.createElementNS("http://www.w3.org/2000/svg","marker");return k.setAttributes(je,[["id",c],["orient",_],["markerWidth",I.toString()],["markerHeight",F.toString()],["refX",D.toString()],["refY",ie.toString()]]),je.appendChild(Re),je},k.createText=function(c){var _=document.createElementNS("http://www.w3.org/2000/svg","text");return _.setAttribute("x","0"),_.setAttribute("y","0"),c&&k.setAttributes(_,c),_},k.createTSpan=function(c,_){var I=document.createElementNS("http://www.w3.org/2000/svg","tspan");return I.textContent=c,_&&k.setAttributes(I,_),I},k.createImage=function(c){var _=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&k.setAttributes(_,c),_},k.createPoint=function(c,_){var I=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return I.x=c,I.y=_,I},k.createPath=function(c,_){var I=document.createElementNS("http://www.w3.org/2000/svg","path");return I.setAttribute("d",c),_&&k.setAttributes(I,_),I},k}(),fe=function(){function k(){}return k.addKey=function(c){k.key=c},Object.defineProperty(k,"isLicensed",{get:function(){return!!k.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(k.key)},enumerable:!1,configurable:!0}),k}(),Se=function(){function k(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return k.prototype.rasterize=function(c,_,I){var F=this;return new Promise(function(D){var ie=I!==void 0?I:document.createElement("canvas");c===null&&(F.markersOnly=!0,F.naturalSize=!1);var Re=document.createElementNS("http://www.w3.org/2000/svg","svg");Re.setAttribute("xmlns","http://www.w3.org/2000/svg"),Re.setAttribute("width",_.width.baseVal.valueAsString),Re.setAttribute("height",_.height.baseVal.valueAsString),Re.setAttribute("viewBox","0 0 "+_.viewBox.baseVal.width.toString()+" "+_.viewBox.baseVal.height.toString()),Re.innerHTML=_.innerHTML,F.naturalSize===!0?(Re.width.baseVal.value=c.naturalWidth,Re.height.baseVal.value=c.naturalHeight):F.width!==void 0&&F.height!==void 0&&(Re.width.baseVal.value=F.width,Re.height.baseVal.value=F.height),ie.width=Re.width.baseVal.value,ie.height=Re.height.baseVal.value;var je=Re.outerHTML,He=ie.getContext("2d");F.markersOnly!==!0&&He.drawImage(c,0,0,ie.width,ie.height);var Ce=window.URL,Ve=new Image(ie.width,ie.height);Ve.setAttribute("crossOrigin","anonymous");var Ge=new Blob([je],{type:"image/svg+xml"}),nt=Ce.createObjectURL(Ge);Ve.onload=function(){He.drawImage(Ve,0,0),Ce.revokeObjectURL(nt);var St=ie.toDataURL(F.imageType,F.imageQuality);D(St)},Ve.src=nt})},k}(),Oe=function(){},Ae=function(){function k(c){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(k.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),k.prototype.addClass=function(c){return this.styleSheet===void 0&&this.addStyleSheet(),c.name=""+this.classNamePrefix+c.localName,this.classes.push(c),this.styleSheet.sheet.insertRule("."+c.name+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length),c},k.prototype.addRule=function(c){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(c),this.styleSheet.sheet.insertRule(c.selector+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length)},k.prototype.addStyleSheet=function(){var c;this.styleSheet=document.createElement("style"),((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).appendChild(this.styleSheet),this.addRule(new Pe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Pe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Pe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new me("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new me("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},k.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},k}(),Pe=function(k,c){this.selector=k,this.style=c},me=function(k,c){this.localName=k,this.style=c},ge=function(){function k(c,_,I,F,D){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=c,this.displayMode=_,this.markerItems=I,this.uiStyleSettings=F,this.styles=D,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return k.prototype.show=function(c){var _=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var I=document.createElement("div");I.className=this.toolbarBlockStyleClass.name,I.style.whiteSpace="nowrap",this.uiContainer.appendChild(I),this.addActionButton(I,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(I,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(I,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(I,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(I,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(I,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(I,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(I,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"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(D){var ie=document.createElement("div");ie.className=""+_.toolbarButtonStyleClass.name,ie.setAttribute("data-type-name",D.typeName),ie.innerHTML=D.icon,ie.addEventListener("click",function(){_.markerToolbarButtonClicked(ie,D)}),_.buttons.push(ie),_.markerButtons.push(ie)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var F=document.createElement("div");F.className=this.toolbarBlockStyleClass.name,F.style.whiteSpace="nowrap",F.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(F),this.addActionButton(F,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(F,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},k.prototype.addButtonClickListener=function(c){this.buttonClickListeners.push(c)},k.prototype.removeButtonClickListener=function(c){this.buttonClickListeners.indexOf(c)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(c),1)},k.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},k.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var c=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var _=0;_<this.markerButtons.length;_++)_<c||_===c&&this.markerButtons.length-1===c?this.markerButtonBlock.appendChild(this.markerButtons[_]):(_===c&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[_]))}},k.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},k.prototype.resetButtonStyles=function(){var c=this;this.buttons.forEach(function(_){_.className=_.className.replace(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name,"").trim(),_.className=_.className.replace(c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:c.toolbarActiveButtonStyleColorsClass.name,"").trim(),_.className+=" "+(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name)})},k.prototype.addActionButton=function(c,_,I){var F=this,D=document.createElement("div");switch(D.className=""+this.toolbarButtonStyleClass.name,D.innerHTML=_,D.setAttribute("data-action",I),D.addEventListener("click",function(){F.actionToolbarButtonClicked(D,I)}),I){case"select":D.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":D.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":D.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":D.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":D.style.fill=this.uiStyleSettings.closeButtonColor}c.appendChild(D),this.buttons.push(D)},k.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new me("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new me("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new me("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new me("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new me("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new me("toolbar_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.toolbarButtonStyleColorsClass=this.styles.addClass(new me("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new me("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Pe("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Pe("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},k.prototype.markerToolbarButtonClicked=function(c,_){this.setActiveButton(c),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(I){return I("marker",_)}),this.markerButtonOverflowBlock.style.display="none"},k.prototype.actionToolbarButtonClicked=function(c,_){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(I){return I("action",_)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},k.prototype.setActiveButton=function(c){this.resetButtonStyles(),c.className=c.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),c.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},k.prototype.setActiveMarkerButton=function(c){var _=this.markerButtons.find(function(I){return I.getAttribute("data-type-name")===c});_&&this.setActiveButton(_)},k.prototype.setCurrentMarker=function(c){var _=this;this.currentMarker=c,this.buttons.filter(function(I){return/delete|notes/.test(I.getAttribute("data-action"))}).forEach(function(I){_.currentMarker===void 0?(I.style.fillOpacity="0.4",I.style.pointerEvents="none"):(I.style.fillOpacity="1",I.style.pointerEvents="all")})},k}(),be=function(){function k(c,_,I,F){this.panels=[],this.panelButtons=[],this.markerjsContainer=c,this.displayMode=_,this.uiStyleSettings=I,this.styles=F,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return k.prototype.addStyles=function(){var c;this.toolboxStyleClass=this.styles.addClass(new me("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 me("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var _=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new me("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new me("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new me("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 me("toolbox-panel-row_colors",`
|
|
background-color: `+((c=this.uiStyleSettings.toolboxBackgroundColor)!==null&&c!==void 0?c:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new me("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*_)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*_)+`px;
|
|
padding: `+_+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new me("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new me("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new Pe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Pe("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},k.prototype.show=function(c){var _;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolboxStyleClass.name+" "+((_=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&_!==void 0?_:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},k.prototype.setPanelButtons=function(c){var _,I,F=this;this.panels=c,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((_=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&_!==void 0?_:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((I=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&I!==void 0?I:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(D){var ie;D.uiStyleSettings=F.uiStyleSettings;var Re=document.createElement("div");Re.className=F.toolboxButtonStyleClass.name+" "+((ie=F.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ie!==void 0?ie:F.toolboxButtonStyleColorsClass.name),Re.innerHTML=D.icon,Re.title=D.title,Re.addEventListener("click",function(){F.panelButtonClick(D)}),F.panelButtons.push(Re),F.buttonRow.appendChild(Re)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},k.prototype.panelButtonClick=function(c){var _=this,I=-1;if(c!==this.activePanel){I=this.panels.indexOf(c),this.panelRow.innerHTML="";var F=c.getUi();F.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(F),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=c}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){_.displayMode==="inline"?_.panelRow.style.display="none":_.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(D,ie){var Re,je;D.className=_.toolboxButtonStyleClass.name+" "+(ie===I?""+((Re=_.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Re!==void 0?Re:_.toolboxActiveButtonStyleColorsClass.name):""+((je=_.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&je!==void 0?je:_.toolboxButtonStyleColorsClass.name))})},k}(),Ee=function(k,c){this.title=k,this.icon=c},Ie=function(k){function c(_,I,F,D){var ie=k.call(this,_,D||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ie.colors=[],ie.addTransparent=!1,ie.colorBoxes=[],ie.colors=I,ie.currentColor=F,ie.setCurrentColor=ie.setCurrentColor.bind(ie),ie.getColorBox=ie.getColorBox.bind(ie),ie}return $(c,k),c.prototype.getUi=function(){var _=this,I=document.createElement("div");return I.style.overflow="hidden",I.style.whiteSpace="nowrap",this.colors.forEach(function(F){var D=_.getColorBox(F);I.appendChild(D),_.colorBoxes.push(D)}),I},c.prototype.getColorBox=function(_){var I=this,F=this.uiStyleSettings.toolbarHeight/4,D=this.uiStyleSettings.toolbarHeight-F,ie=document.createElement("div");ie.style.display="inline-block",ie.style.boxSizing="content-box",ie.style.width=D-2+"px",ie.style.height=D-2+"px",ie.style.padding="1px",ie.style.marginRight="2px",ie.style.marginBottom="2px",ie.style.borderWidth="2px",ie.style.borderStyle="solid",ie.style.borderRadius=(D+2)/2+"px",ie.style.borderColor=_===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ie.addEventListener("click",function(){I.setCurrentColor(_,ie)});var Re=document.createElement("div");return Re.style.display="inline-block",Re.style.width=D-2+"px",Re.style.height=D-2+"px",Re.style.backgroundColor=_,Re.style.borderRadius=D/2+"px",_==="transparent"&&(Re.style.fill=this.uiStyleSettings.toolboxAccentColor,Re.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),ie.appendChild(Re),ie},c.prototype.setCurrentColor=function(_,I){var F=this;this.currentColor=_,this.colorBoxes.forEach(function(D){D.style.borderColor=D===I?F.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(_)},c}(Ee),Me=function(){function k(c,_,I){this._state="new",this._isSelected=!1,this._container=c,this._overlayContainer=_,this.globalSettings=I,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(k.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),k.prototype.ownsTarget=function(c){return!1},Object.defineProperty(k.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),k.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},k.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},k.prototype.pointerDown=function(c,_){},k.prototype.dblClick=function(c,_){},k.prototype.manipulate=function(c){},k.prototype.pointerUp=function(c){this.stateChanged()},k.prototype.dispose=function(){},k.prototype.addMarkerVisualToContainer=function(c){this.container.childNodes.length>0?this.container.insertBefore(c,this.container.childNodes[0]):this.container.appendChild(c)},k.prototype.getState=function(){return{typeName:k.typeName,state:this.state,notes:this.notes}},k.prototype.restoreState=function(c){this._state=c.state,this.notes=c.notes},k.prototype.scale=function(c,_){},k.prototype.colorChanged=function(c){this.onColorChanged&&this.onColorChanged(c),this.stateChanged()},k.prototype.fillColorChanged=function(c){this.onFillColorChanged&&this.onFillColorChanged(c),this.stateChanged()},k.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var c=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),c.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(c)&&this.onStateChanged(this)}},k.typeName="MarkerBase",k}(),De=function(){function k(){this.findGripByVisual=this.findGripByVisual.bind(this)}return k.prototype.findGripByVisual=function(c){return this.topLeft.ownsTarget(c)?this.topLeft:this.topCenter.ownsTarget(c)?this.topCenter:this.topRight.ownsTarget(c)?this.topRight:this.centerLeft.ownsTarget(c)?this.centerLeft:this.centerRight.ownsTarget(c)?this.centerRight:this.bottomLeft.ownsTarget(c)?this.bottomLeft:this.bottomCenter.ownsTarget(c)?this.bottomCenter:this.bottomRight.ownsTarget(c)?this.bottomRight:void 0},k}(),Fe=function(){function k(){this.GRIP_SIZE=10,this.visual=z.createGroup(),this.visual.appendChild(z.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(z.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return k.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},k}(),ue=function(){function k(){}return k.toITransformMatrix=function(c){return{a:c.a,b:c.b,c:c.c,d:c.d,e:c.e,f:c.f}},k.toSVGMatrix=function(c,_){return c.a=_.a,c.b=_.b,c.c=_.c,c.d=_.d,c.e=_.e,c.f=_.f,c},k}(),pe=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.left=0,D.top=0,D.width=0,D.height=0,D.defaultSize={x:50,y:20},D.offsetX=0,D.offsetY=0,D.rotationAngle=0,D.CB_DISTANCE=10,D._suppressMarkerCreateEvent=!1,D.container.transform.baseVal.appendItem(z.createTransform()),D.setupControlBox(),D}return $(c,k),Object.defineProperty(c.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"visual",{get:function(){return this._visual},set:function(_){this._visual=_;var I=z.createTransform();this._visual.transform.baseVal.appendItem(I)},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(_){return!!k.prototype.ownsTarget.call(this,_)||!!(this.controlGrips.findGripByVisual(_)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(_))},c.prototype.pointerDown=function(_,I){k.prototype.pointerDown.call(this,_,I),this.state==="new"&&(this.left=_.x,this.top=_.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var F=this.unrotatePoint(_);if(this.manipulationStartX=F.x,this.manipulationStartY=F.y,this.offsetX=F.x-this.left,this.offsetY=F.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(I),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(I)){this.activeGrip=this.rotatorGrip;var D=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=D.x-this.width/2,this.top=D.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ie=this.container.transform.baseVal.getItem(0);ie.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ie,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},c.prototype.pointerUp=function(_){var I=this.state;k.prototype.pointerUp.call(this,_),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(_),this._state="select",I==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},c.prototype.moveVisual=function(_){this.visual.style.transform="translate("+_.x+"px, "+_.y+"px)"},c.prototype.manipulate=function(_){var I=this.unrotatePoint(_);this.state==="creating"?this.resize(_):this.state==="move"?(this.left=this.manipulationStartLeft+(I.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(I.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(I):this.state==="rotate"&&this.rotate(_)},c.prototype.resize=function(_){var I=this.manipulationStartLeft,F=this.manipulationStartWidth,D=this.manipulationStartTop,ie=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:I=this.manipulationStartLeft+_.x-this.manipulationStartX,F=this.manipulationStartWidth+this.manipulationStartLeft-I;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:F=this.manipulationStartWidth+_.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:D=this.manipulationStartTop+_.y-this.manipulationStartY,ie=this.manipulationStartHeight+this.manipulationStartTop-D;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ie=this.manipulationStartHeight+_.y-this.manipulationStartY}F>=0?(this.left=I,this.width=F):(this.left=I+F,this.width=-F),ie>=0?(this.top=D,this.height=ie):(this.top=D+ie,this.height=-ie),this.setSize()},c.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},c.prototype.rotate=function(_){if(Math.abs(_.x-this.centerX)>.1){var I=Math.sign(_.x-this.centerX);this.rotationAngle=180*Math.atan((_.y-this.centerY)/(_.x-this.centerX))/Math.PI+90*I,this.applyRotation()}},c.prototype.applyRotation=function(){var _=this.container.transform.baseVal.getItem(0);_.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(_,0)},c.prototype.rotatePoint=function(_){if(this.rotationAngle===0)return _;var I=this.container.getCTM(),F=z.createPoint(_.x,_.y);return{x:(F=F.matrixTransform(I)).x,y:F.y}},c.prototype.unrotatePoint=function(_){if(this.rotationAngle===0)return _;var I=this.container.getCTM();I=I.inverse();var F=z.createPoint(_.x,_.y);return{x:(F=F.matrixTransform(I)).x,y:F.y}},c.prototype.select=function(){k.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){k.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=z.createGroup();var _=z.createTransform();_.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(_),this.container.appendChild(this.controlBox),this.controlRect=z.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=z.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 De,this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){var _=this.controlBox.transform.baseVal.getItem(0);_.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(_,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()},c.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()},c.prototype.createGrip=function(){var _=new Fe;return _.visual.transform.baseVal.appendItem(z.createTransform()),this.controlBox.appendChild(_.visual),_},c.prototype.positionGrips=function(){var _=this.controlGrips.topLeft.GRIP_SIZE,I=-_/2,F=I,D=(this.width+this.CB_DISTANCE)/2-_/2,ie=(this.height+this.CB_DISTANCE)/2-_/2,Re=this.height+this.CB_DISTANCE-_/2,je=this.width+this.CB_DISTANCE-_/2;this.positionGrip(this.controlGrips.topLeft.visual,I,F),this.positionGrip(this.controlGrips.topCenter.visual,D,F),this.positionGrip(this.controlGrips.topRight.visual,je,F),this.positionGrip(this.controlGrips.centerLeft.visual,I,ie),this.positionGrip(this.controlGrips.centerRight.visual,je,ie),this.positionGrip(this.controlGrips.bottomLeft.visual,I,Re),this.positionGrip(this.controlGrips.bottomCenter.visual,D,Re),this.positionGrip(this.controlGrips.bottomRight.visual,je,Re),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,D,F-3*this.CB_DISTANCE)},c.prototype.positionGrip=function(_,I,F){var D=_.transform.baseVal.getItem(0);D.setTranslate(I,F),_.transform.baseVal.replaceItem(D,0)},c.prototype.hideControlBox=function(){this.controlBox.style.display="none"},c.prototype.showControlBox=function(){this.controlBox.style.display=""},c.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:ue.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ue.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},k.prototype.getState.call(this))},c.prototype.restoreState=function(_){k.prototype.restoreState.call(this,_);var I=_;this.left=I.left,this.top=I.top,this.width=I.width,this.height=I.height,this.rotationAngle=I.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(ue.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,I.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ue.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,I.containerTransformMatrix))},c.prototype.scale=function(_,I){k.prototype.scale.call(this,_,I);var F=this.rotatePoint({x:this.left,y:this.top}),D=this.unrotatePoint({x:F.x*_,y:F.y*I});this.left=D.x,this.top=D.y,this.width=this.width*_,this.height=this.height*I,this.adjustControlBox()},c}(Me),ye=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.fillColor="transparent",D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.opacity=1,D.setStrokeColor=D.setStrokeColor.bind(D),D.setFillColor=D.setFillColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.createVisual=D.createVisual.bind(D),D}return $(c,k),c.prototype.ownsTarget=function(_){return!(!k.prototype.ownsTarget.call(this,_)&&_!==this.visual)},c.prototype.createVisual=function(){this.visual=z.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)},c.prototype.pointerDown=function(_,I){k.prototype.pointerDown.call(this,_,I),this.state==="new"&&(this.createVisual(),this.moveVisual(_),this._state="creating")},c.prototype.manipulate=function(_){k.prototype.manipulate.call(this,_)},c.prototype.resize=function(_){k.prototype.resize.call(this,_),this.setSize()},c.prototype.setSize=function(){k.prototype.setSize.call(this),z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(_){k.prototype.pointerUp.call(this,_),this.setSize()},c.prototype.setStrokeColor=function(_){this.strokeColor=_,this.visual&&z.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(_),this.stateChanged()},c.prototype.setFillColor=function(_){this.fillColor=_,this.visual&&z.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},c.prototype.setStrokeWidth=function(_){this.strokeWidth=_,this.visual&&z.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(_){this.strokeDasharray=_,this.visual&&z.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},k.prototype.getState.call(this))},c.prototype.restoreState=function(_){var I=_;this.fillColor=I.fillColor,this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.opacity=I.opacity,this.createVisual(),k.prototype.restoreState.call(this,_),this.setSize()},c.prototype.scale=function(_,I){k.prototype.scale.call(this,_,I),this.setSize()},c.title="Rectangle marker",c}(pe),Te=function(k){function c(_,I,F,D){var ie=k.call(this,_,D||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ie.widths=[],ie.widthBoxes=[],ie.widths=I,ie.currentWidth=F,ie.setCurrentWidth=ie.setCurrentWidth.bind(ie),ie}return $(c,k),c.prototype.getUi=function(){var _=this,I=document.createElement("div");return I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2",this.widths.forEach(function(F){var D=document.createElement("div");D.style.display="flex",D.style.flexGrow="2",D.style.alignItems="center",D.style.justifyContent="space-between",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.borderColor=F===_.currentWidth?_.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){_.setCurrentWidth(F,D)}),I.appendChild(D);var ie=document.createElement("div");ie.innerText=F.toString(),ie.style.marginRight="5px",D.appendChild(ie);var Re=document.createElement("div");Re.style.minHeight="20px",Re.style.flexGrow="2",Re.style.display="flex",Re.style.alignItems="center";var je=document.createElement("hr");je.style.minWidth="20px",je.style.border="0px",je.style.borderTop=F+"px solid "+_.uiStyleSettings.toolboxColor,je.style.flexGrow="2",Re.appendChild(je),D.appendChild(Re),_.widthBoxes.push(D)}),I},c.prototype.setCurrentWidth=function(_,I){var F=this;this.currentWidth=_,this.widthBoxes.forEach(function(D){D.style.borderColor=D===I?F.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},c}(Ee),we=function(k){function c(_,I,F,D){var ie=k.call(this,_,D||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ie.styles=[],ie.styleBoxes=[],ie.styles=I,ie.currentStyle=F,ie.setCurrentStyle=ie.setCurrentStyle.bind(ie),ie}return $(c,k),c.prototype.getUi=function(){var _=this,I=document.createElement("div");return I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2",this.styles.forEach(function(F){var D=document.createElement("div");D.style.display="flex",D.style.alignItems="center",D.style.justifyContent="space-between",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.overflow="hidden",D.style.maxWidth=100/_.styles.length-5+"%",D.style.borderColor=F===_.currentStyle?_.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){_.setCurrentStyle(F,D)}),I.appendChild(D);var ie=document.createElement("div");ie.style.minHeight="20px",ie.style.flexGrow="2",ie.style.overflow="hidden";var Re=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+_.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(F!==""?'stroke-dasharray="'+F+'"':"")+` />
|
|
</svg>`;ie.innerHTML=Re,D.appendChild(ie),_.styleBoxes.push(D)}),I},c.prototype.setCurrentStyle=function(_,I){var F=this;this.currentStyle=_,this.styleBoxes.forEach(function(D){D.style.borderColor=D===I?F.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},c}(Ee),xe=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.strokeColor=F.defaultColor,D.strokeWidth=F.defaultStrokeWidth,D.strokeDasharray=F.defaultStrokeDasharray,D.strokePanel=new Ie("Line color",F.defaultColorSet,F.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.strokeWidthPanel=new Te("Line width",F.defaultStrokeWidths,F.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new we("Line style",F.defaultStrokeDasharrays,F.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D}return $(c,k),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var _=k.prototype.getState.call(this);return _.typeName=c.typeName,_},c.typeName="FrameMarker",c.title="Frame marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',c}(ye),ve=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},Ne=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.x1=0,D.y1=0,D.x2=0,D.y2=0,D.defaultLength=50,D.manipulationStartX=0,D.manipulationStartY=0,D.manipulationStartX1=0,D.manipulationStartY1=0,D.manipulationStartX2=0,D.manipulationStartY2=0,D.setupControlBox(),D}return $(c,k),c.prototype.ownsTarget=function(_){return!!k.prototype.ownsTarget.call(this,_)||!(!this.grip1.ownsTarget(_)&&!this.grip2.ownsTarget(_))},c.prototype.pointerDown=function(_,I){k.prototype.pointerDown.call(this,_,I),this.manipulationStartX=_.x,this.manipulationStartY=_.y,this.state==="new"&&(this.x1=_.x,this.y1=_.y,this.x2=_.x,this.y2=_.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(I)?this.activeGrip=this.grip1:this.grip2.ownsTarget(I)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},c.prototype.pointerUp=function(_){var I=this.state;k.prototype.pointerUp.call(this,_),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(_),this._state="select",I==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},c.prototype.adjustVisual=function(){},c.prototype.manipulate=function(_){this.state==="creating"?this.resize(_):this.state==="move"?(this.x1=this.manipulationStartX1+_.x-this.manipulationStartX,this.y1=this.manipulationStartY1+_.y-this.manipulationStartY,this.x2=this.manipulationStartX2+_.x-this.manipulationStartX,this.y2=this.manipulationStartY2+_.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(_)},c.prototype.resize=function(_){switch(this.activeGrip){case this.grip1:this.x1=_.x,this.y1=_.y;break;case this.grip2:case void 0:this.x2=_.x,this.y2=_.y}this.adjustVisual(),this.adjustControlBox()},c.prototype.select=function(){k.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){k.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=z.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){this.positionGrips()},c.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},c.prototype.createGrip=function(){var _=new Fe;return _.visual.transform.baseVal.appendItem(z.createTransform()),this.controlBox.appendChild(_.visual),_},c.prototype.positionGrips=function(){var _=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-_/2,this.y1-_/2),this.positionGrip(this.grip2.visual,this.x2-_/2,this.y2-_/2)},c.prototype.positionGrip=function(_,I,F){var D=_.transform.baseVal.getItem(0);D.setTranslate(I,F),_.transform.baseVal.replaceItem(D,0)},c.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},k.prototype.getState.call(this))},c.prototype.restoreState=function(_){k.prototype.restoreState.call(this,_);var I=_;this.x1=I.x1,this.y1=I.y1,this.x2=I.x2,this.y2=I.y2},c.prototype.scale=function(_,I){k.prototype.scale.call(this,_,I),this.x1=this.x1*_,this.y1=this.y1*I,this.x2=this.x2*_,this.y2=this.y2*I,this.adjustVisual(),this.adjustControlBox()},c}(Me),Ue=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.setStrokeColor=D.setStrokeColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.strokeColor=F.defaultColor,D.strokeWidth=F.defaultStrokeWidth,D.strokeDasharray=F.defaultStrokeDasharray,D.strokePanel=new Ie("Line color",F.defaultColorSet,F.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.strokeWidthPanel=new Te("Line width",F.defaultStrokeWidths,F.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new we("Line style",F.defaultStrokeDasharrays,F.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D}return $(c,k),c.prototype.ownsTarget=function(_){return!(!k.prototype.ownsTarget.call(this,_)&&_!==this.visual&&_!==this.selectorLine&&_!==this.visibleLine)},c.prototype.createVisual=function(){this.visual=z.createGroup(),this.selectorLine=z.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=z.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)},c.prototype.pointerDown=function(_,I){k.prototype.pointerDown.call(this,_,I),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},c.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()),z.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),z.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),z.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setStrokeColor=function(_){this.strokeColor=_,this.adjustVisual(),this.colorChanged(_)},c.prototype.setStrokeWidth=function(_){this.strokeWidth=_,this.adjustVisual()},c.prototype.setStrokeDasharray=function(_){this.strokeDasharray=_,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var _=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},k.prototype.getState.call(this));return _.typeName=c.typeName,_},c.prototype.restoreState=function(_){k.prototype.restoreState.call(this,_);var I=_;this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.createVisual(),this.adjustVisual()},c.typeName="LineMarker",c.title="Line marker",c.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',c}(Ne),he=function(k){function c(_,I,F,D){var ie=k.call(this,_,D||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ie.fonts=[],ie.fontBoxes=[],ie.fonts=I,ie.currentFont=F,ie.setCurrentFont=ie.setCurrentFont.bind(ie),ie}return $(c,k),c.prototype.getUi=function(){var _=this,I=document.createElement("div");return I.style.overflow="hidden",I.style.flexGrow="2",this.fonts.forEach(function(F){var D=document.createElement("div");D.style.display="inline-block",D.style.alignItems="center",D.style.justifyContent="space-between",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.overflow="hidden",D.style.maxWidth=100/_.fonts.length-5+"%",D.style.borderColor=F===_.currentFont?_.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){_.setCurrentFont(F,D)}),I.appendChild(D);var ie=document.createElement("div");ie.style.display="flex",ie.style.minHeight="20px",ie.style.flexGrow="2",ie.style.fontFamily=F,ie.style.overflow="hidden";var Re=document.createElement("div");Re.style.whiteSpace="nowrap",Re.style.overflow="hidden",Re.style.textOverflow="ellipsis",Re.innerHTML="The quick brown fox jumps over the lazy dog",ie.appendChild(Re),D.appendChild(ie),_.fontBoxes.push(D)}),I},c.prototype.setCurrentFont=function(_,I){var F=this;this.currentFont=_,this.fontBoxes.forEach(function(D){D.style.borderColor=D===I?F.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},c}(Ee),Le=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.color="transparent",D.padding=5,D.DEFAULT_TEXT="your text here",D.text=D.DEFAULT_TEXT,D.isMoved=!1,D.color=F.defaultColor,D.fontFamily=F.defaultFontFamily,D.defaultSize={x:100,y:30},D.setColor=D.setColor.bind(D),D.setFont=D.setFont.bind(D),D.renderText=D.renderText.bind(D),D.sizeText=D.sizeText.bind(D),D.textEditDivClicked=D.textEditDivClicked.bind(D),D.showTextEditor=D.showTextEditor.bind(D),D.setSize=D.setSize.bind(D),D.positionTextEditor=D.positionTextEditor.bind(D),D.colorPanel=new Ie("Color",F.defaultColorSet,F.defaultColor),D.colorPanel.onColorChanged=D.setColor,D.fontFamilyPanel=new he("Font",F.defaultFontFamilies,F.defaultFontFamily),D.fontFamilyPanel.onFontChanged=D.setFont,D}return $(c,k),c.prototype.ownsTarget=function(_){if(k.prototype.ownsTarget.call(this,_)||_===this.visual||_===this.textElement||_===this.bgRectangle)return!0;var I=!1;return this.textElement.childNodes.forEach(function(F){F===_&&(I=!0)}),I},c.prototype.createVisual=function(){this.visual=z.createGroup(),this.bgRectangle=z.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=z.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(z.createTransform()),this.textElement.transform.baseVal.appendItem(z.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},c.prototype.pointerDown=function(_,I){k.prototype.pointerDown.call(this,_,I),this.isMoved=!1,this.pointerDownPoint=_,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(_),this._state="creating")},c.prototype.renderText=function(){var _=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(I){_.textElement.appendChild(z.createTSpan(I.trim()===""?" ":I.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},c.prototype.getTextScale=function(){var _=this.textElement.getBBox(),I=1;if(_.width>0&&_.height>0){var F=(1*this.width-this.width*this.padding*2/100)/_.width,D=(1*this.height-this.height*this.padding*2/100)/_.height;I=Math.min(F,D)}return I},c.prototype.getTextPosition=function(_){var I=this.textElement.getBBox(),F=0,D=0;return I.width>0&&I.height>0&&(F=(this.width-I.width*_)/2,D=this.height/2-I.height*_/2),{x:F,y:D}},c.prototype.sizeText=function(){var _=this.textElement.getBBox(),I=this.getTextScale(),F=this.getTextPosition(I);F.y-=_.y*I,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+F.x+"px, "+F.y+"px) scale("+I+", "+I+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(F.x,F.y),this.textElement.transform.baseVal.getItem(1).setScale(I,I))},c.prototype.manipulate=function(_){k.prototype.manipulate.call(this,_),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(_.x-this.pointerDownPoint.x)>5||Math.abs(_.y-this.pointerDownPoint.y)>5)},c.prototype.resize=function(_){k.prototype.resize.call(this,_),this.isMoved=!0,this.setSize(),this.sizeText()},c.prototype.setSize=function(){k.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),z.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},c.prototype.pointerUp=function(_){var I=this.state;I==="creating"&&(this._suppressMarkerCreateEvent=!0),k.prototype.pointerUp.call(this,_),this.setSize(),(I==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},c.prototype.showTextEditor=function(){var _=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(I){I.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var I=Number.parseFloat(_.textEditor.style.fontSize);_.textEditor.clientWidth>=Number.parseInt(_.textEditor.style.maxWidth)&&I>.9;)I-=.1,_.textEditor.style.fontSize=Math.max(I,.9)+"em"}),this.textEditor.addEventListener("keyup",function(I){I.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(I){if(I.clipboardData){var F=I.clipboardData.getData("text"),D=window.getSelection();if(!D.rangeCount)return!1;D.deleteFromDocument(),D.getRangeAt(0).insertNode(document.createTextNode(F)),I.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){_.textEditDivClicked(_.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},c.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var _=this.getTextScale(),I=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),F=this.textElement.getBBox(),D={x:F.width*_,y:F.height*_};I.x-=D.x/2,I.y-=D.y/2,this.textEditor.style.top=I.y+"px",this.textEditor.style.left=I.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-I.x+"px",this.textEditor.style.fontSize=Math.max(16*_,12)+"px",this.textElement.style.display="none"}},c.prototype.textEditDivClicked=function(_){this.text=_.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},c.prototype.select=function(){k.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},c.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),k.prototype.deselect.call(this)},c.prototype.dblClick=function(_,I){k.prototype.dblClick.call(this,_,I),this.showTextEditor()},c.prototype.setColor=function(_){this.textElement&&z.setAttributes(this.textElement,[["fill",_]]),this.color=_,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(_)},c.prototype.setFont=function(_){this.textElement&&z.setAttributes(this.textElement,[["font-family",_]]),this.fontFamily=_,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},c.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},c.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var _=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},k.prototype.getState.call(this));return _.typeName=c.typeName,_},c.prototype.restoreState=function(_){var I=_;this.color=I.color,this.fontFamily=I.fontFamily,this.padding=I.padding,this.text=I.text,this.createVisual(),k.prototype.restoreState.call(this,_),this.setSize()},c.prototype.scale=function(_,I){k.prototype.scale.call(this,_,I),this.setSize(),this.sizeText(),this.positionTextEditor()},c.typeName="TextMarker",c.title="Text marker",c.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',c}(pe),se=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.color="transparent",D.lineWidth=3,D.drawing=!1,D.pixelRatio=1,D.color=F.defaultColor,D.lineWidth=F.defaultStrokeWidth,D.pixelRatio=F.freehandPixelRatio,D.setColor=D.setColor.bind(D),D.addCanvas=D.addCanvas.bind(D),D.finishCreation=D.finishCreation.bind(D),D.setLineWidth=D.setLineWidth.bind(D),D.colorPanel=new Ie("Color",F.defaultColorSet,F.defaultColor),D.colorPanel.onColorChanged=D.setColor,D.lineWidthPanel=new Te("Line width",F.defaultStrokeWidths,F.defaultStrokeWidth),D.lineWidthPanel.onWidthChanged=D.setLineWidth,D}return $(c,k),c.prototype.ownsTarget=function(_){return!(!k.prototype.ownsTarget.call(this,_)&&_!==this.visual&&_!==this.drawingImage)},c.prototype.createVisual=function(){this.visual=z.createGroup(),this.drawingImage=z.createImage(),this.visual.appendChild(this.drawingImage);var _=z.createTransform();this.visual.transform.baseVal.appendItem(_),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(_,I){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(_.x,_.y),this.drawing=!0):k.prototype.pointerDown.call(this,_,I)},c.prototype.manipulate=function(_){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(_.x,_.y),this.canvasContext.stroke()):k.prototype.manipulate.call(this,_)},c.prototype.resize=function(_){k.prototype.resize.call(this,_),z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),z.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(_){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):k.prototype.pointerUp.call(this,_)},c.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)},c.prototype.select=function(){this.state==="creating"&&this.finishCreation(),k.prototype.select.call(this)},c.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),k.prototype.deselect.call(this)},c.prototype.finishCreation=function(){for(var _=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),I=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],F=I[0],D=I[1],ie=I[2],Re=I[3],je=!1,He=0;He<this.canvasElement.height;He++)for(var Ce=0;Ce<this.canvasElement.width;Ce++)_.data[He*this.canvasElement.width*4+4*Ce+3]>0&&(je=!0,He<D&&(D=He),Ce<F&&(F=Ce),He>Re&&(Re=He),Ce>ie&&(ie=Ce));if(je){this.left=F/this.pixelRatio,this.top=D/this.pixelRatio,this.width=(ie-F)/this.pixelRatio,this.height=(Re-D)/this.pixelRatio;var Ve=document.createElement("canvas");Ve.width=ie-F,Ve.height=Re-D,Ve.getContext("2d").putImageData(this.canvasContext.getImageData(F,D,ie-F,Re-D),0,0),this.drawingImgUrl=Ve.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},c.prototype.setDrawingImage=function(){z.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),z.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},c.prototype.setColor=function(_){this.color=_,this.colorChanged(_)},c.prototype.setLineWidth=function(_){this.lineWidth=_},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var _=Object.assign({drawingImgUrl:this.drawingImgUrl},k.prototype.getState.call(this));return _.typeName=c.typeName,_},c.prototype.restoreState=function(_){this.createVisual(),k.prototype.restoreState.call(this,_),this.drawingImgUrl=_.drawingImgUrl,this.setDrawingImage()},c.prototype.scale=function(_,I){k.prototype.scale.call(this,_,I),this.setDrawingImage()},c.typeName="FreehandMarker",c.title="Freehand marker",c.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',c}(pe),te=function(k){function c(_,I,F){var D=k.call(this,_,F||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return D.typeBoxes=[],D.currentType=I,D.setCurrentType=D.setCurrentType.bind(D),D}return $(c,k),c.prototype.getUi=function(){var _=this,I=document.createElement("div");I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2";for(var F=function(Re){var je="both";switch(Re){case 0:je="both";break;case 1:je="start";break;case 2:je="end";break;case 3:je="none"}var He=document.createElement("div");if(He.style.display="flex",He.style.flexGrow="2",He.style.alignItems="center",He.style.justifyContent="space-between",He.style.padding="5px",He.style.borderWidth="2px",He.style.borderStyle="solid",He.style.borderColor=je===D.currentType?D.uiStyleSettings.toolboxAccentColor:"transparent",He.addEventListener("click",function(){_.setCurrentType(je,He)}),I.appendChild(He),je==="both"||je==="start"){var Ce=document.createElement("div");Ce.style.display="flex",Ce.style.alignItems="center",Ce.style.minHeight="20px",Ce.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(D.uiStyleSettings!==void 0?D.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ce.style.marginLeft="5px",He.appendChild(Ce)}var Ve=document.createElement("div");Ve.style.display="flex",Ve.style.alignItems="center",Ve.style.minHeight="20px",Ve.style.flexGrow="2";var Ge=document.createElement("hr");if(Ge.style.minWidth="20px",Ge.style.border="0px",Ge.style.borderTop="3px solid "+(D.uiStyleSettings!==void 0?D.uiStyleSettings.toolboxColor:"#eeeeee"),Ge.style.flexGrow="2",Ve.appendChild(Ge),He.appendChild(Ve),je==="both"||je==="end"){var nt=document.createElement("div");nt.style.display="flex",nt.style.alignItems="center",nt.style.minHeight="20px",nt.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(D.uiStyleSettings!==void 0?D.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,nt.style.marginRight="5px",He.appendChild(nt)}D.typeBoxes.push(He)},D=this,ie=0;ie<4;ie++)F(ie);return I},c.prototype.setCurrentType=function(_,I){var F=this;this.currentType=_,this.typeBoxes.forEach(function(D){D.style.borderColor=D===I?F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},c}(Ee),ae=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.arrowType="end",D.arrowBaseHeight=10,D.arrowBaseWidth=10,D.getArrowPoints=D.getArrowPoints.bind(D),D.setArrowType=D.setArrowType.bind(D),D.arrowTypePanel=new te("Arrow type","end"),D.arrowTypePanel.onArrowTypeChanged=D.setArrowType,D}return $(c,k),c.prototype.ownsTarget=function(_){return!(!k.prototype.ownsTarget.call(this,_)&&_!==this.arrow1&&_!==this.arrow2)},c.prototype.getArrowPoints=function(_,I){var F=this.arrowBaseWidth+2*this.strokeWidth,D=this.arrowBaseHeight+2*this.strokeWidth;return _-F/2+","+(I+D/2)+" "+_+","+(I-D/2)+" "+(_+F/2)+","+(I+D/2)},c.prototype.createTips=function(){this.arrow1=z.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(z.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=z.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(z.createTransform()),this.visual.appendChild(this.arrow2)},c.prototype.pointerDown=function(_,I){k.prototype.pointerDown.call(this,_,I),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(k.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",z.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),z.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var _=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),I=this.arrow1.transform.baseVal.getItem(0);I.setRotate(_,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(I,0);var F=this.arrow2.transform.baseVal.getItem(0);F.setRotate(_+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(F,0)}},c.prototype.setArrowType=function(_){this.arrowType=_,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var _=Object.assign({arrowType:this.arrowType},k.prototype.getState.call(this));return _.typeName=c.typeName,_},c.prototype.restoreState=function(_){k.prototype.restoreState.call(this,_);var I=_;this.arrowType=I.arrowType,this.createTips(),this.adjustVisual()},c.typeName="ArrowMarker",c.title="Arrow marker",c.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',c}(Ue),G=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.fillColor=F.defaultFillColor,D.strokeWidth=0,D.fillPanel=new Ie("Color",F.defaultColorSet,F.defaultFillColor),D.fillPanel.onColorChanged=D.setFillColor,D}return $(c,k),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var _=k.prototype.getState.call(this);return _.typeName=c.typeName,_},c.typeName="CoverMarker",c.title="Cover marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',c}(ye),Y=function(k){function c(_,I,F,D){var ie=k.call(this,_,D||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ie.opacities=[],ie.opacityBoxes=[],ie.opacities=I,ie.currentOpacity=F,ie.setCurrentOpacity=ie.setCurrentOpacity.bind(ie),ie}return $(c,k),c.prototype.getUi=function(){var _=this,I=document.createElement("div");return I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2",I.style.justifyContent="space-between",this.opacities.forEach(function(F){var D=document.createElement("div");D.style.display="flex",D.style.alignItems="center",D.style.justifyContent="center",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.borderColor=F===_.currentOpacity?_.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){_.setCurrentOpacity(F,D)}),I.appendChild(D);var ie=document.createElement("div");ie.innerText=100*F+"%",D.appendChild(ie),_.opacityBoxes.push(D)}),I},c.prototype.setCurrentOpacity=function(_,I){var F=this;this.currentOpacity=_,this.opacityBoxes.forEach(function(D){D.style.borderColor=D===I?F.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},c}(Ee),Q=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.setOpacity=D.setOpacity.bind(D),D.fillColor=F.defaultHighlightColor,D.strokeWidth=0,D.opacity=F.defaultHighlightOpacity,D.fillPanel=new Ie("Color",F.defaultColorSet,D.fillColor),D.fillPanel.onColorChanged=D.setFillColor,D.opacityPanel=new Y("Opacity",F.defaultOpacitySteps,D.opacity),D.opacityPanel.onOpacityChanged=D.setOpacity,D}return $(c,k),c.prototype.setOpacity=function(_){this.opacity=_,this.visual&&z.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var _=k.prototype.getState.call(this);return _.typeName=c.typeName,_},c.typeName="HighlightMarker",c.title="Highlight marker",c.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',c}(G),q='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',ce=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.bgColor="transparent",D.tipPosition={x:0,y:0},D.tipBase1Position={x:0,y:0},D.tipBase2Position={x:0,y:0},D.tipMoving=!1,D.color=F.defaultStrokeColor,D.bgColor=F.defaultFillColor,D.fontFamily=F.defaultFontFamily,D.defaultSize={x:100,y:30},D.setBgColor=D.setBgColor.bind(D),D.getTipPoints=D.getTipPoints.bind(D),D.positionTip=D.positionTip.bind(D),D.setTipPoints=D.setTipPoints.bind(D),D.colorPanel=new Ie("Text color",F.defaultColorSet,D.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),D.colorPanel.onColorChanged=D.setColor,D.bgColorPanel=new Ie("Fill color",F.defaultColorSet,D.bgColor,q),D.bgColorPanel.onColorChanged=D.setBgColor,D.fontFamilyPanel=new he("Font",F.defaultFontFamilies,F.defaultFontFamily),D.fontFamilyPanel.onFontChanged=D.setFont,D.tipGrip=new Fe,D.tipGrip.visual.transform.baseVal.appendItem(z.createTransform()),D.controlBox.appendChild(D.tipGrip.visual),D}return $(c,k),c.prototype.ownsTarget=function(_){return k.prototype.ownsTarget.call(this,_)||this.tipGrip.ownsTarget(_)||this.tip===_},c.prototype.createTip=function(){z.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=z.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},c.prototype.pointerDown=function(_,I){this.state==="new"&&k.prototype.pointerDown.call(this,_,I),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(I)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):k.prototype.pointerDown.call(this,_,I)},c.prototype.pointerUp=function(_){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,k.prototype.pointerUp.call(this,_);else{var I=this.state==="creating";k.prototype.pointerUp.call(this,_),this.setTipPoints(I),this.positionTip()}},c.prototype.manipulate=function(_){if(this.tipMoving){var I=this.unrotatePoint(_);this.tipPosition={x:I.x-this.manipulationStartLeft,y:I.y-this.manipulationStartTop},this.positionTip()}else k.prototype.manipulate.call(this,_)},c.prototype.setBgColor=function(_){this.bgRectangle&&this.tip&&(z.setAttributes(this.bgRectangle,[["fill",_]]),z.setAttributes(this.tip,[["fill",_]])),this.bgColor=_,this.fillColorChanged(_)},c.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},c.prototype.setTipPoints=function(_){_===void 0&&(_=!1);var I=Math.min(this.height/2,15),F=this.height/5;_&&(this.tipPosition={x:I+F/2,y:this.height+20});var D=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?D<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(F=this.width/5,I=Math.min(this.width/2,15),this.tipBase1Position={x:I,y:0},this.tipBase2Position={x:I+F,y:0}):(this.tipBase1Position={x:0,y:I},this.tipBase2Position={x:0,y:I+F}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?D<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(F=this.width/5,I=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-I-F,y:0},this.tipBase2Position={x:this.width-I,y:0}):(this.tipBase1Position={x:this.width,y:I},this.tipBase2Position={x:this.width,y:I+F}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?D<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(F=this.width/5,I=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-I-F,y:this.height},this.tipBase2Position={x:this.width-I,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-I-F},this.tipBase2Position={x:this.width,y:this.height-I}):D<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(F=this.width/5,I=Math.min(this.width/2,15),this.tipBase1Position={x:I,y:this.height},this.tipBase2Position={x:I+F,y:this.height}):(this.tipBase1Position={x:0,y:this.height-I},this.tipBase2Position={x:0,y:this.height-I-F})},c.prototype.resize=function(_){k.prototype.resize.call(this,_),this.positionTip()},c.prototype.positionTip=function(){z.setAttributes(this.tip,[["points",this.getTipPoints()]]);var _=this.tipGrip.visual.transform.baseVal.getItem(0);_.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(_,0)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),c.prototype.select=function(){this.positionTip(),k.prototype.select.call(this)},c.prototype.getState=function(){var _=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},k.prototype.getState.call(this));return _.typeName=c.typeName,_},c.prototype.restoreState=function(_){var I=_;this.bgColor=I.bgColor,this.tipPosition=I.tipPosition,k.prototype.restoreState.call(this,_),this.createTip(),this.setTipPoints()},c.prototype.scale=function(_,I){k.prototype.scale.call(this,_,I),this.tipPosition={x:this.tipPosition.x*_,y:this.tipPosition.y*I},this.positionTip()},c.typeName="CalloutMarker",c.title="Callout marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',c}(Le),_e=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.fillColor="transparent",D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.opacity=1,D.strokeColor=F.defaultColor,D.strokeWidth=F.defaultStrokeWidth,D.strokeDasharray=F.defaultStrokeDasharray,D.fillColor=F.defaultFillColor,D.setStrokeColor=D.setStrokeColor.bind(D),D.setFillColor=D.setFillColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.setOpacity=D.setOpacity.bind(D),D.createVisual=D.createVisual.bind(D),D.strokePanel=new Ie("Line color",X(F.defaultColorSet,["transparent"]),F.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.fillPanel=new Ie("Fill color",X(F.defaultColorSet,["transparent"]),D.fillColor,q),D.fillPanel.onColorChanged=D.setFillColor,D.strokeWidthPanel=new Te("Line width",F.defaultStrokeWidths,F.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new we("Line style",F.defaultStrokeDasharrays,F.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D.opacityPanel=new Y("Opacity",F.defaultOpacitySteps,D.opacity),D.opacityPanel.onOpacityChanged=D.setOpacity,D}return $(c,k),c.prototype.ownsTarget=function(_){return!(!k.prototype.ownsTarget.call(this,_)&&_!==this.visual)},c.prototype.createVisual=function(){this.visual=z.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(_,I){k.prototype.pointerDown.call(this,_,I),this.state==="new"&&(this.createVisual(),this.moveVisual(_),this._state="creating")},c.prototype.manipulate=function(_){k.prototype.manipulate.call(this,_)},c.prototype.resize=function(_){k.prototype.resize.call(this,_),this.setSize()},c.prototype.setSize=function(){k.prototype.setSize.call(this),z.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},c.prototype.pointerUp=function(_){k.prototype.pointerUp.call(this,_),this.setSize()},c.prototype.setStrokeColor=function(_){this.strokeColor=_,this.visual&&z.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(_),this.stateChanged()},c.prototype.setFillColor=function(_){this.fillColor=_,this.visual&&z.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(_),this.stateChanged()},c.prototype.setStrokeWidth=function(_){this.strokeWidth=_,this.visual&&z.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(_){this.strokeDasharray=_,this.visual&&z.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.setOpacity=function(_){this.opacity=_,this.visual&&z.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var _=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},k.prototype.getState.call(this));return _.typeName=c.typeName,_},c.prototype.restoreState=function(_){var I=_;this.fillColor=I.fillColor,this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.opacity=I.opacity,this.createVisual(),k.prototype.restoreState.call(this,_),this.setSize()},c.prototype.scale=function(_,I){k.prototype.scale.call(this,_,I),this.setSize()},c.typeName="EllipseMarker",c.title="Ellipse marker",c.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',c}(pe),ke=function(k){function c(_,I,F){return k.call(this,_,I,F)||this}return $(c,k),Object.defineProperty(c.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(_){return!(!k.prototype.ownsTarget.call(this,_)&&_!==this.tip1&&_!==this.tip2)},c.prototype.createTips=function(){this.tip1=z.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(z.createTransform()),this.visual.appendChild(this.tip1),this.tip2=z.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(z.createTransform()),this.visual.appendChild(this.tip2)},c.prototype.pointerDown=function(_,I){k.prototype.pointerDown.call(this,_,I),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(k.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(z.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),z.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var _=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),I=this.tip1.transform.baseVal.getItem(0);I.setRotate(_,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(I,0);var F=this.tip2.transform.baseVal.getItem(0);F.setRotate(_+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(F,0)}},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var _=k.prototype.getState.call(this);return _.typeName=c.typeName,_},c.prototype.restoreState=function(_){k.prototype.restoreState.call(this,_),this.createTips(),this.adjustVisual()},c.typeName="MeasurementMarker",c.title="Measurement marker",c.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',c}(Ue),Ke=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.strokePanel.colors=F.defaultColorSet,D.fillColor="transparent",D}return $(c,k),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var _=k.prototype.getState.call(this);return _.typeName=c.typeName,_},c.typeName="EllipseFrameMarker",c.title="Ellipse frame marker",c.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',c}(_e),Xe=function(){function k(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(k.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),k.prototype.addUndoStep=function(c){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(c)||(this.undoStack.push(c),JSON.stringify(this.lastRedoStep)!==JSON.stringify(c)&&this.redoStack.splice(0,this.redoStack.length))},k.prototype.replaceLastUndoStep=function(c){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=c)},k.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},k.prototype.undo=function(){if(this.undoStack.length>1){var c=this.undoStack.pop();return c!==void 0&&this.redoStack.push(c),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},k.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},k}(),ze=function(k){function c(_,I,F){var D=k.call(this,_,I,F)||this;return D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.curveX=0,D.curveY=0,D.manipulationStartCurveX=0,D.manipulationStartCurveY=0,D.setStrokeColor=D.setStrokeColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.positionGrips=D.positionGrips.bind(D),D.addControlGrips=D.addControlGrips.bind(D),D.adjustVisual=D.adjustVisual.bind(D),D.setupControlBox=D.setupControlBox.bind(D),D.resize=D.resize.bind(D),D.strokeColor=F.defaultColor,D.strokeWidth=F.defaultStrokeWidth,D.strokeDasharray=F.defaultStrokeDasharray,D.strokePanel=new Ie("Line color",F.defaultColorSet,F.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.strokeWidthPanel=new Te("Line width",F.defaultStrokeWidths,F.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new we("Line style",F.defaultStrokeDasharrays,F.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D}return $(c,k),c.prototype.ownsTarget=function(_){return!(!k.prototype.ownsTarget.call(this,_)&&_!==this.visual&&_!==this.selectorCurve&&_!==this.visibleCurve&&!this.curveGrip.ownsTarget(_))},c.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},c.prototype.createVisual=function(){this.visual=z.createGroup(),this.selectorCurve=z.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=z.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)},c.prototype.pointerDown=function(_,I){k.prototype.pointerDown.call(this,_,I),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=_.x,this.curveY=_.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(I)&&(this.activeGrip=this.curveGrip,this._state="resize")},c.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),z.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),z.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),z.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setupControlBox=function(){k.prototype.setupControlBox.call(this),this.curveControlLine1=z.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=z.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)},c.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,k.prototype.addControlGrips.call(this)},c.prototype.positionGrips=function(){k.prototype.positionGrips.call(this);var _=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-_/2,this.curveY-_/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()))},c.prototype.manipulate=function(_){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+_.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+_.y-this.manipulationStartY),k.prototype.manipulate.call(this,_)},c.prototype.resize=function(_){this.activeGrip===this.curveGrip&&(this.curveX=_.x,this.curveY=_.y),k.prototype.resize.call(this,_),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},c.prototype.setStrokeColor=function(_){this.strokeColor=_,this.adjustVisual(),this.colorChanged(_)},c.prototype.setStrokeWidth=function(_){this.strokeWidth=_,this.adjustVisual()},c.prototype.setStrokeDasharray=function(_){this.strokeDasharray=_,this.adjustVisual()},c.prototype.scale=function(_,I){this.curveX=this.curveX*_,this.curveY=this.curveY*I,k.prototype.scale.call(this,_,I)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var _=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},k.prototype.getState.call(this));return _.typeName=c.typeName,_},c.prototype.restoreState=function(_){k.prototype.restoreState.call(this,_);var I=_;this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.curveX=I.curveX,this.curveY=I.curveY,this.createVisual(),this.adjustVisual()},c.typeName="CurveMarker",c.title="Curve marker",c.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',c}(Ne),qe=function(){function k(c,_){_===void 0&&(_=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=c,this.cancelable=_}return Object.defineProperty(k.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),k.prototype.preventDefault=function(){this._defaultPrevented=!0},k}(),it=function(k){function c(_,I,F){var D=k.call(this,_,!1)||this;return D.dataUrl=I,D.state=F,D}return $(c,k),c}(qe),Ye=function(k){function c(_,I,F){F===void 0&&(F=!1);var D=k.call(this,_,F)||this;return D.marker=I,D}return $(c,k),c}(qe),mt=function(){function k(){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 k.prototype.addEventListener=function(c,_){this[c].push(_)},k.prototype.removeEventListener=function(c,_){var I=this[c].indexOf(_);I>-1&&this[c].splice(I,1)},k}(),at=function(){function k(c){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ve,this._isOpen=!1,this.undoRedoManager=new Xe,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 mt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=k.instanceCounter++,this.styles=new Ae(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=c,this.targetRoot=document.body,this.width=c.clientWidth,this.height=c.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(k.prototype,"ALL_MARKER_TYPES",{get:function(){return[xe,se,ae,Le,Ke,_e,Q,ce,ke,G,Ue,ze]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[xe,se,ae,Le,_e,Q,ce]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"BASIC_MARKER_TYPES",{get:function(){return[xe,se,ae,Le,Q]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(c){var _=this;this._availableMarkerTypes.splice(0),c.forEach(function(I){if(typeof I=="string"){var F=_.ALL_MARKER_TYPES.find(function(D){return D.typeName===I});F!==void 0&&_._availableMarkerTypes.push(F)}else _._availableMarkerTypes.push(I)})},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(c){this._zoomLevel=c,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(k.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),k.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),fe.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},k.prototype.show=function(){var c=this;this.styles.styleSheetRoot===void 0&&Oe.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Oe.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(_){return _(new qe(c))})},k.prototype.render=function(){return Z(this,void 0,void 0,function(){var c;return ne(this,function(_){switch(_.label){case 0:return this.setCurrentMarker(),(c=new Se).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.markersOnly=this.renderMarkersOnly,c.width=this.renderWidth,c.height=this.renderHeight,[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return _.sent(),[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,_.sent()]}})})},k.prototype.close=function(c){var _=this;if(c===void 0&&(c=!1),this.isOpen){var I=!1;c||this.eventListeners.beforeclose.forEach(function(F){var D=new qe(_,!0);F(D),D.defaultPrevented&&(I=!0)}),I||(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(F){return F(new qe(_))}),this.detachEvents(),this._isOpen=!1)}},k.prototype.addMarkersToToolbar=function(){for(var c,_=[],I=0;I<arguments.length;I++)_[I]=arguments[I];(c=this._availableMarkerTypes).push.apply(c,_)},k.prototype.addRenderEventListener=function(c){this.addEventListener("render",function(_){c(_.dataUrl,_.state)})},k.prototype.removeRenderEventListener=function(c){},k.prototype.addCloseEventListener=function(c){this.addEventListener("close",function(){c()})},k.prototype.removeCloseEventListener=function(c){},k.prototype.setupResizeObserver=function(){var c=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){c.resize(c.target.clientWidth,c.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return c.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},k.prototype.onPopupTargetResize=function(){var c=1*this.target.clientWidth/this.target.clientHeight,_=this.editorCanvas.clientWidth/c>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*c:this.editorCanvas.clientWidth,I=_<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/c;this.resize(_,I)},k.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},k.prototype.resize=function(c,_){this._isResizing=!0;var I=c/this.imageWidth,F=_/this.imageHeight;this.imageWidth=Math.round(c),this.imageHeight=Math.round(_),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(I,F),this._isResizing=!1},k.prototype.scaleMarkers=function(c,_){var I,F=this;this._currentMarker&&this._currentMarker instanceof Le?this._currentMarker.scale(c,_):(I=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(D){D!==F._currentMarker&&D.scale(c,_)}),I!==void 0&&this.setCurrentMarker(I)},k.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},k.prototype.setTopLeft=function(){var c=this.editingTarget.getBoundingClientRect(),_=this.editorCanvas.getBoundingClientRect();this.left=c.left-_.left,this.top=c.top-_.top},k.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},k.prototype.addDefs=function(){for(var c,_=[],I=0;I<arguments.length;I++)_[I]=arguments[I];this.defs=z.createDefs(),this.addDefsToImage(),(c=this.defs).append.apply(c,_)},k.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},k.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},k.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},k.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},k.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},k.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},k.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},k.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var c=document.createElement("a");c.href="https://markerjs.com/",c.target="_blank",c.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',c.title="Powered by marker.js",c.style.display="grid",c.style.alignItems="center",c.style.justifyItems="center",c.style.padding="3px",c.style.width="20px",c.style.height="20px",this.logoUI.appendChild(c),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},k.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")},k.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"},k.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},k.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 c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"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 ge(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<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new be(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},k.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},k.prototype.removeMarker=function(c){this.markerImage.removeChild(c.container),this.markers.indexOf(c)>-1&&this.markers.splice(this.markers.indexOf(c),1),c.dispose()},k.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())},k.prototype.toolbarButtonClicked=function(c,_){if(c==="marker"&&_!==void 0)this.createNewMarker(_);else if(c==="action")switch(_){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()}},k.prototype.deleteSelectedMarker=function(){var c=this;if(this._currentMarker!==void 0){var _=!1;if(this.eventListeners.markerbeforedelete.forEach(function(F){var D=new Ye(c,c._currentMarker,!0);F(D),D.defaultPrevented&&(_=!0)}),!_){var I=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(F){return F(new Ye(c,I))})}}},k.prototype.clear=function(){var c=this,_=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ie){var Re=new Ye(c,void 0,!0);ie(Re),Re.defaultPrevented&&(_=!0)}),!_)){this.setCurrentMarker();for(var I=function(ie){var Re=F.markers[ie];F.setCurrentMarker(F.markers[ie]),F._currentMarker.dispose(),F.markerImage.removeChild(F._currentMarker.container),F.markers.splice(F.markers.indexOf(F._currentMarker),1),F.eventListeners.markerdelete.forEach(function(je){return je(new Ye(c,Re))})},F=this,D=this.markers.length-1;D>=0;D--)I(D);this.addUndoStep()}},Object.defineProperty(k.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),k.prototype.showNotesEditor=function(){var c;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=(c=this._currentMarker.notes)!==null&&c!==void 0?c:"",this.overlayContainer.appendChild(this.notesArea))},k.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)},k.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},k.prototype.addUndoStep=function(){var c=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var _=this.getState(),I=this.undoRedoManager.getLastUndoStep();if(!I||I.width===_.width&&I.height===_.height){var F=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(_),F<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(D){return D(new qe(c))})}else this.undoRedoManager.replaceLastUndoStep(_),this.eventListeners.statechange.forEach(function(D){return D(new qe(c))})}},k.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},k.prototype.undoStep=function(){var c=this,_=this.undoRedoManager.undo();_!==void 0&&(this.restoreState(_),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(I){return I(new qe(c))}))},k.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},k.prototype.redoStep=function(){var c=this,_=this.undoRedoManager.redo();_!==void 0&&(this.restoreState(_),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(I){return I(new qe(c))}))},k.prototype.stepZoom=function(){var c=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=c<this.zoomSteps.length-1?this.zoomSteps[c+1]:this.zoomSteps[0]},k.prototype.panTo=function(c){this.contentDiv.scrollBy({left:this.prevPanPoint.x-c.x,top:this.prevPanPoint.y-c.y}),this.prevPanPoint=c},k.prototype.startRenderAndClose=function(){return Z(this,void 0,void 0,function(){var c,_,I=this;return ne(this,function(F){switch(F.label){case 0:return[4,this.render()];case 1:return c=F.sent(),_=this.getState(),this.eventListeners.render.forEach(function(D){return D(new it(I,c,_))}),this.close(!0),[2]}})})},k.prototype.getState=function(c){c===!0&&this.setCurrentMarker();var _={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(I){return _.markers.push(I.getState())}),_},k.prototype.restoreState=function(c){var _=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);c.markers.forEach(function(I){var F=_._availableMarkerTypes.find(function(ie){return ie.typeName===I.typeName});if(F!==void 0){var D=_.addNewMarker(F);D.restoreState(I),_.markers.push(D)}}),c.width&&c.height&&(c.width!==this.imageWidth||c.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/c.width,this.imageHeight/c.height),this.eventListeners.restorestate.forEach(function(I){return I(new qe(_))})},k.prototype.addNewMarker=function(c){var _=z.createGroup();return this.markerImage.appendChild(_),new c(_,this.overlayContainer,this.settings)},k.prototype.createNewMarker=function(c){var _,I=this;(_=typeof c=="string"?this._availableMarkerTypes.find(function(F){return F.typeName===c}):c)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(_),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(_.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(F){return F(new Ye(I,I._currentMarker))}))},k.prototype.markerCreated=function(c){var _=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(c),this.setCurrentMarker(c),c instanceof se&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(se):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(I){return I(new Ye(_,_._currentMarker))})},k.prototype.colorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=c,this.settings.defaultStrokeColor=c)},k.prototype.fillColorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=c)},k.prototype.markerStateChanged=function(c){var _=this;this.eventListeners.markerchange.forEach(function(I){return I(new Ye(_,c))})},k.prototype.setCurrentMarker=function(c){var _=this;this._currentMarker!==c&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(I){return I(new Ye(_,_._currentMarker))})),this._currentMarker=c,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(I){return I(new Ye(_,_._currentMarker))}))},k.prototype.onPointerDown=function(c){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||c.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var _=this.markers.find(function(I){return I.ownsTarget(c.target)});_!==void 0?(this.setCurrentMarker(_),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(c.clientX,c.clientY),c.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:c.clientX,y:c.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(c.clientX,c.clientY))},k.prototype.onDblClick=function(c){if(this._isFocused||this.focus(),this.mode==="select"){var _=this.markers.find(function(I){return I.ownsTarget(c.target)});_!==void 0&&_!==this._currentMarker&&this.setCurrentMarker(_),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(c.clientX,c.clientY),c.target):this.setCurrentMarker()}},k.prototype.onPointerMove=function(c){this.touchPoints!==1&&c.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||c.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(c.clientX,c.clientY)):this.zoomLevel>1&&this.panTo({x:c.clientX,y:c.clientY}))},k.prototype.onPointerUp=function(c){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(c.clientX,c.clientY)),this.isDragging=!1,this.addUndoStep()},k.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},k.prototype.onKeyUp=function(c){this._currentMarker===void 0||this.notesArea!==void 0||c.key!=="Delete"&&c.key!=="Backspace"||this.deleteSelectedMarker()},k.prototype.clientToLocalCoordinates=function(c,_){var I=this.markerImage.getBoundingClientRect();return{x:(c-I.left)/this.zoomLevel,y:(_-I.top)/this.zoomLevel}},k.prototype.onWindowResize=function(){this.positionUI()},k.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"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()},k.prototype.addLicenseKey=function(c){fe.addKey(c)},k.prototype.addEventListener=function(c,_){this.eventListeners.addEventListener(c,_)},k.prototype.removeEventListener=function(c,_){this.eventListeners.removeEventListener(c,_)},k.prototype.renderState=function(c){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(c),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(k.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),k.prototype.focus=function(){var c=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(_){return _(new qe(c))}))},k.prototype.blur=function(){var c=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(_){return _(new qe(c))}))},k.instanceCounter=0,k}();/* **********************************
|
|
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 yt=function(k,c){return(yt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,I){_.__proto__=I}||function(_,I){for(var F in I)Object.prototype.hasOwnProperty.call(I,F)&&(_[F]=I[F])})(k,c)};function dt(k,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");function _(){this.constructor=k}yt(k,c),k.prototype=c===null?Object.create(c):(_.prototype=c.prototype,new _)}function tt(k,c,_,I){return new(_||(_=Promise))(function(F,D){function ie(He){try{je(I.next(He))}catch(Ce){D(Ce)}}function Re(He){try{je(I.throw(He))}catch(Ce){D(Ce)}}function je(He){var Ce;He.done?F(He.value):(Ce=He.value,Ce instanceof _?Ce:new _(function(Ve){Ve(Ce)})).then(ie,Re)}je((I=I.apply(k,c||[])).next())})}function _t(k,c){var _,I,F,D,ie={label:0,sent:function(){if(1&F[0])throw F[1];return F[1]},trys:[],ops:[]};return D={next:Re(0),throw:Re(1),return:Re(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function Re(je){return function(He){return function(Ce){if(_)throw new TypeError("Generator is already executing.");for(;ie;)try{if(_=1,I&&(F=2&Ce[0]?I.return:Ce[0]?I.throw||((F=I.return)&&F.call(I),0):I.next)&&!(F=F.call(I,Ce[1])).done)return F;switch(I=0,F&&(Ce=[2&Ce[0],F.value]),Ce[0]){case 0:case 1:F=Ce;break;case 4:return ie.label++,{value:Ce[1],done:!1};case 5:ie.label++,I=Ce[1],Ce=[0];continue;case 7:Ce=ie.ops.pop(),ie.trys.pop();continue;default:if(!(F=ie.trys,(F=F.length>0&&F[F.length-1])||Ce[0]!==6&&Ce[0]!==2)){ie=0;continue}if(Ce[0]===3&&(!F||Ce[1]>F[0]&&Ce[1]<F[3])){ie.label=Ce[1];break}if(Ce[0]===6&&ie.label<F[1]){ie.label=F[1],F=Ce;break}if(F&&ie.label<F[2]){ie.label=F[2],ie.ops.push(Ce);break}F[2]&&ie.ops.pop(),ie.trys.pop();continue}Ce=c.call(k,ie)}catch(Ve){Ce=[6,Ve],I=0}finally{_=F=0}if(5&Ce[0])throw Ce[1];return{value:Ce[0]?Ce[1]:void 0,done:!0}}([je,He])}}}var Et=function(){function k(){}return k.addKey=function(c){k.key=c},Object.defineProperty(k,"isLicensed",{get:function(){return!!k.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(k.key)},enumerable:!1,configurable:!0}),k}(),Be=function(){function k(){}return k.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},k.setAttributes=function(c,_){for(var I=0,F=_;I<F.length;I++){var D=F[I],ie=D[0],Re=D[1];c.setAttribute(ie,Re)}},k.createRect=function(c,_,I){var F=document.createElementNS("http://www.w3.org/2000/svg","rect");return F.setAttribute("width",c.toString()),F.setAttribute("height",_.toString()),I&&k.setAttributes(F,I),F},k.createLine=function(c,_,I,F,D){var ie=document.createElementNS("http://www.w3.org/2000/svg","line");return ie.setAttribute("x1",c.toString()),ie.setAttribute("y1",_.toString()),ie.setAttribute("x2",I.toString()),ie.setAttribute("y2",F.toString()),D&&k.setAttributes(ie,D),ie},k.createPolygon=function(c,_){var I=document.createElementNS("http://www.w3.org/2000/svg","polygon");return I.setAttribute("points",c),_&&k.setAttributes(I,_),I},k.createCircle=function(c,_){var I=document.createElementNS("http://www.w3.org/2000/svg","circle");return I.setAttribute("cx",(c/2).toString()),I.setAttribute("cy",(c/2).toString()),I.setAttribute("r",c.toString()),_&&k.setAttributes(I,_),I},k.createEllipse=function(c,_,I){var F=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return F.setAttribute("cx",(c/2).toString()),F.setAttribute("cy",(_/2).toString()),F.setAttribute("rx",(c/2).toString()),F.setAttribute("ry",(_/2).toString()),I&&k.setAttributes(F,I),F},k.createGroup=function(c){var _=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&k.setAttributes(_,c),_},k.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},k.createMarker=function(c,_,I,F,D,ie,Re){var je=document.createElementNS("http://www.w3.org/2000/svg","marker");return k.setAttributes(je,[["id",c],["orient",_],["markerWidth",I.toString()],["markerHeight",F.toString()],["refX",D.toString()],["refY",ie.toString()]]),je.appendChild(Re),je},k.createText=function(c){var _=document.createElementNS("http://www.w3.org/2000/svg","text");return _.setAttribute("x","0"),_.setAttribute("y","0"),c&&k.setAttributes(_,c),_},k.createTSpan=function(c,_){var I=document.createElementNS("http://www.w3.org/2000/svg","tspan");return I.textContent=c,_&&k.setAttributes(I,_),I},k.createImage=function(c){var _=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&k.setAttributes(_,c),_},k.createPoint=function(c,_){var I=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return I.x=c,I.y=_,I},k.createPath=function(c,_){var I=document.createElementNS("http://www.w3.org/2000/svg","path");return I.setAttribute("d",c),_&&k.setAttributes(I,_),I},k.createElement=function(c,_){var I=document.createElementNS("http://www.w3.org/2000/svg",c);return _&&k.setAttributes(I,_),I},k.getHollowRectanglePath=function(c,_,I,F,D,ie,Re,je){return"M"+c+","+_+"V"+(_+F)+"H"+(c+I)+"V"+_+"H"+D+"V"+ie+"H"+(D+Re)+"V"+(ie+je)+"H"+D+"V"+_+"Z"},k}(),$e=function(){function k(c){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(k.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),k.prototype.addClass=function(c){return this.styleSheet===void 0&&this.addStyleSheet(),c.name=""+this.classNamePrefix+c.localName,this.classes.push(c),this.styleSheet.sheet.insertRule("."+c.name+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length),c},k.prototype.addRule=function(c){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(c),this.styleSheet.sheet.insertRule(c.selector+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length)},k.prototype.addStyleSheet=function(){var c;this.styleSheet=document.createElement("style"),((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).appendChild(this.styleSheet),this.addRule(new Qe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Qe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Qe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Je("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Je("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},k.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},k}(),Qe=function(k,c){this.selector=k,this.style=c},Je=function(k,c){this.localName=k,this.style=c},ft=function(){function k(){this.blocks=[],this.display=""}return k.prototype.addButtonBlock=function(c){c.className=this.blockClassName,c.buttonClassName=this.buttonClassName,c.buttonColorsClassName=this.buttonColorsClassName,c.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(c)},k.prototype.addElementBlock=function(c){c.className===void 0&&(c.className=this.blockClassName),this.blocks.push(c)},k.prototype.getUI=function(){var c=document.createElement("div");return c.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,c.style.display=this.display,this.blocks.forEach(function(_){return c.appendChild(_.getUI())}),c},k}(),Tt=function(){function k(){}return k.prototype.getUI=function(){var c=document.createElement("div");if(c.className=this.className,this.minWidth!==void 0&&(c.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":c.style.justifyContent="flex-start";break;case"center":c.style.justifyContent="center";break;case"end":c.style.justifyContent="flex-end"}return c.style.whiteSpace="nowrap",c},k}(),Rt=function(k){function c(){var _=k!==null&&k.apply(this,arguments)||this;return _.buttons=[],_}return dt(c,k),c.prototype.addButton=function(_){_.className=this.buttonClassName,_.colorsClassName=this.buttonColorsClassName,_.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(_)},c.prototype.getUI=function(){var _=k.prototype.getUI.call(this);return this.buttons.forEach(function(I){return _.appendChild(I.getUI())}),_},c}(Tt),ot=function(){function k(c,_){this._isActive=!1,this._isHidden=!1,this._icon=c,this.title=_,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(k.prototype,"icon",{get:function(){return this._icon},set:function(c){this._icon=c,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isActive",{get:function(){return this._isActive},set:function(c){this._isActive=c,this.adjustClassName()},enumerable:!1,configurable:!0}),k.prototype.getUI=function(){var c=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return c.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},k.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},k.prototype.hide=function(){this._isHidden=!0},k}(),rt=function(k){function c(){var _=k!==null&&k.apply(this,arguments)||this;return _.elements=[],_}return dt(c,k),c.prototype.addElement=function(_){this.elements.push(_)},c.prototype.getUI=function(){var _=k.prototype.getUI.call(this);return this.elements.forEach(function(I){return _.appendChild(I)}),_},c}(Tt),Ze=function(){function k(c,_){this.horizontal=c,this.vertical=_}return Object.defineProperty(k.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),k.prototype.getVerticalLength=function(c){return c/this.ratio},k.prototype.getHorizontalLength=function(c){return c*this.ratio},k}(),ut=function(){function k(){}return k.getIcon=function(c,_){if(c>0&&_>0){var I=new Ze(c,_),F=I.ratio>=1?20:I.getHorizontalLength(20),D=I.ratio<1?20:I.getVerticalLength(20),ie=document.createElementNS("http://www.w3.org/2000/svg","svg");ie.setAttribute("xmlns","http://www.w3.org/2000/svg"),ie.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ie);var Re=Be.createDefs();ie.appendChild(Re);var je=Be.createElement("clipPath",[["id","text-bg-clip"]]);Re.appendChild(je);var He=Be.createPath(Be.getHollowRectanglePath((24-F)/2,(24-D)/2,F,D,(24-F)/2+2,(24-D)/2+2,F-4,D-4));ie.appendChild(He);var Ce=Be.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ce.appendChild(Be.createTSpan(c+":"+_)),ie.appendChild(Ce);var Ve=Ce.getBBox();Be.setAttributes(Ce,[["x",((24-Ve.width)/2).toString()],["y",((24-Ve.height)/2-Ve.y).toString()]]);var Ge=Be.createPath(Be.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ve.width))/2,(24-Math.ceil(Ve.height))/2,Math.ceil(Ve.width),Math.ceil(Ve.height)));return je.appendChild(Ge),Be.setAttributes(He,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ie),ie.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},k}(),ct=function(k){function c(_,I,F){var D=k.call(this,_,I)||this;return D.isDropdownOpen=!1,D.onClick=D.dropdownButtonClicked,D.dropdownButtons=F,D}return dt(c,k),c.prototype.setupDropdown=function(){var _=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(I){I.className=_.className,I.colorsClassName=_.colorsClassName,_.dropdownBlock.appendChild(I.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},c.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},c.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},c.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},c.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},c.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},c}(ot),st=function(){function k(c,_){this.GRIP_SIZE=10,this.color=c,this.fillColor=_,this.visual=Be.createGroup(),this.visual.appendChild(Be.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Be.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return k.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},k.prototype.setCenter=function(c,_){this.visual.childNodes.forEach(function(I){return Be.setAttributes(I,[["cx",c.toString()],["cy",_.toString()]])})},k}(),lt=function(){function k(c,_,I,F){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=c,this.canvasHeight=_,this.margin=I,this.container=F,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(k.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(c){this._aspectRatio=c,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.gridContainer&&Be.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(c){this._zoomFactor=c,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),k.prototype.open=function(){var c=this;this.cropShadeElement=Be.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Be.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var _=0;_<this.numberOfGridLines;_++)this.horizontalGridLines.push(Be.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Be.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(I){return c.gridContainer.appendChild(I)}),this.verticalGridLines.forEach(function(I){return c.gridContainer.appendChild(I)}),this.cropRectElement=Be.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new st(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new st(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new st(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new st(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},k.prototype.setCropRectangle=function(c){this.cropRect=c;var _=Object.assign({},this.cropRect);this.zoomFactor!==1&&(_.width=this.cropRect.width*this.zoomFactor,_.height=this.cropRect.height*this.zoomFactor,_.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-_.width/2,_.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-_.height/2),Be.setAttributes(this.cropRectElement,[["x",_.x.toString()],["y",_.y.toString()],["width",_.width.toString()],["height",_.height.toString()]]);var I=_.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(D,ie){var Re=_.y+I*(ie+1);Be.setAttributes(D,[["x1",""+_.x],["y1",""+Re],["x2",""+(_.x+_.width)],["y2",""+Re]])});var F=_.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(D,ie){var Re=_.x+F*(ie+1);Be.setAttributes(D,[["x1",""+Re],["y1",""+_.y],["x2",""+Re],["y2",""+(_.y+_.height)]])}),Be.setAttributes(this.cropShadeElement,[["d",Be.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,_.x,_.y,_.width,_.height)]]),this.topLeftGrip.setCenter(_.x,_.y),this.topRightGrip.setCenter(_.x+_.width,_.y),this.bottomLeftGrip.setCenter(_.x,_.y+_.height),this.bottomRightGrip.setCenter(_.x+_.width,_.y+_.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},k.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)},k.prototype.clientToLocalCoordinates=function(c,_){var I=this.container.getBoundingClientRect();return{x:c-I.left+this.margin,y:_-I.top+this.margin}},k.prototype.onPointerDown=function(c){this.container.setPointerCapture(c.pointerId),this.previousPoint=this.clientToLocalCoordinates(c.clientX,c.clientY),this.cropRectElement===c.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(c.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(c.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(c.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(c.target)&&(this.activeGrip=this.bottomRightGrip)},k.prototype.onPointerMove=function(c){if(this.isMoving)this.move(this.clientToLocalCoordinates(c.clientX,c.clientY));else if(this.activeGrip){var _=this.clientToLocalCoordinates(c.clientX,c.clientY);this.resize(_)}c.preventDefault()},k.prototype.onPointerUp=function(c){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(c.pointerId)},k.prototype.move=function(c){var _=c.x-this.previousPoint.x,I=c.y-this.previousPoint.y;this.zoomFactor!==1&&(_=-_/this.zoomFactor,I=-I/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+_),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+I),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=c},k.prototype.resize=function(c){var _=Object.assign({},this.cropRect),I=c.x-this.previousPoint.x,F=c.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:_.x+I<this.margin&&(I=this.margin-_.x),_.x+=I,_.width=this.cropRect.x+this.cropRect.width-_.x;break;case this.bottomRightGrip:case this.topRightGrip:_.width+I>this.canvasWidth*this.zoomFactor&&(I=this.canvasWidth*this.zoomFactor-_.width),_.width+=I}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(_.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(I),_.height=this.aspectRatio.getVerticalLength(_.width)):(_.y+=F,_.height=this.cropRect.y+this.cropRect.height-_.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?_.height=this.aspectRatio.getVerticalLength(_.width):_.height+=F}_.width<10&&(_.x=this.cropRect.x,_.width=10),_.height<10&&(_.y=this.cropRect.y,_.height=10),this.previousPoint=c,_.x>=this.margin&&_.y>=this.margin&&_.x-this.margin+_.width<=this.canvasWidth&&_.y-this.margin+_.height<=this.canvasHeight&&(this.cropRect=_,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},k.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var c=this.cropRect.x+this.cropRect.width/2,_=this.cropRect.y+this.cropRect.height/2,I=this.aspectRatio.getHorizontalLength(this.cropRect.height),F=this.aspectRatio.getVerticalLength(this.cropRect.width);I/this.canvasWidth<F/this.canvasHeight?this.cropRect.width=I:this.cropRect.height=F,this.cropRect.width>this.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=c-this.cropRect.width/2,this.cropRect.y=_-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)}},k.prototype.getRescaledRect=function(c,_,I,F,D,ie){var Re=I/c,je=F/_;return{x:(D.x-ie)*Re+ie,y:(D.y-ie)*je+ie,width:D.width*Re,height:D.height*je}},k.prototype.scaleCanvas=function(c,_){var I=this.getRescaledRect(this.canvasWidth,this.canvasHeight,c,_,this.cropRect,this.margin);this.canvasWidth=c,this.canvasHeight=_,this.onCropChange&&this.onCropChange(I),this.setCropRectangle(I)},k}(),gt=function(){function k(c){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=c,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(k.prototype,"angle",{get:function(){return this._angle},set:function(c){this._angle=c,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),k.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},k.prototype.onPointerDown=function(c){this.controlContainer.setPointerCapture(c.pointerId),this.isDragging=!0,this.previousPoint={x:c.clientX,y:c.clientY}},k.prototype.onPointerMove=function(c){this.isDragging&&(this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.previousPoint.x=c.clientX)},k.prototype.onPointerUp=function(c){this.isDragging&&this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(c.pointerId)},k.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var c=this.angleLabelText.getBBox();Be.setAttributes(this.angleLabelElement,[["x",((this.width-c.width)/2).toString()],["y",(this.height/2).toString()]])}},k.prototype.positionScaleShape=function(){if(this.scaleShape){var c=this.scaleShape.transform.baseVal.getItem(0);c.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(c,0)}},k.prototype.getVisual=function(){var c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.setAttribute("width",this.width+"px"),c.setAttribute("height",this.height+"px"),c.setAttribute("viewBox","0 0 "+this.width+" "+this.height),c.style.flexShrink="0",document.body.appendChild(c);for(var _="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,I=1;I<=this.width/5+10;I++){var F=I%5==0?this.height/3:this.height/6;_+="h4v"+-F+"h1v"+F}_+="v1H0Z",this.scaleShape=Be.createPath(_);var D=Be.createTransform();this.scaleShape.transform.baseVal.appendItem(D),c.appendChild(this.scaleShape),this.angleLabelElement=Be.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Be.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ie=Be.createTSpan("");return ie.innerHTML="°",this.angleLabelElement.appendChild(ie),c.appendChild(this.angleLabelElement),document.body.removeChild(c),c},k}(),It=function(){function k(){this.naturalSize=!1,this.imageType="image/png"}return k.prototype.rasterize=function(c,_,I,F,D,ie,Re){var je=this;return new Promise(function(He){var Ce=document.createElement("canvas");Ce.width=c.width.baseVal.value-2*F,Ce.height=c.height.baseVal.value-2*F;var Ve=1,Ge=1;je.naturalSize===!0?(Ve=_.naturalWidth/(c.width.baseVal.value-2*F)/ie,Ge=_.naturalHeight/(c.height.baseVal.value-2*F)/Re,Ce.width=_.naturalWidth/ie,Ce.height=_.naturalHeight/Re):je.width!==void 0&&je.height!==void 0&&(Ve=je.width/I.width,Ge=je.height/I.height,Ce.width*=Ve,Ce.height*=Ge);var nt=Ce.getContext("2d");nt.translate(Ce.width/2,Ce.height/2),nt.rotate(D*Math.PI/180),nt.scale(ie,Re),nt.translate(-Ce.width/2,-Ce.height/2),nt.drawImage(_,0,0,Ce.width,Ce.height);var St=document.createElement("canvas");St.width=I.width*Ve,St.height=I.height*Ge,St.getContext("2d").putImageData(nt.getImageData((I.x-F)*Ve,(I.y-F)*Ge,I.width*Ve,I.height*Ge),0,0),He(St.toDataURL(je.imageType,je.imageQuality))})},k}(),Ft=function(){function k(c){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=k.instanceCounter++,this.styles=new $e(this.instanceNo),this.target=c,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(k.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(c){this._zoomToCropEnabled=c,c?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"gridLines",{get:function(){return this._gridLines},set:function(c){this._gridLines=c,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(c){this._rotationAngle=c,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"aspectRatio",{get:function(){var c;return(c=this._aspectRatio)!==null&&c!==void 0?c:this.aspectRatios[0]},set:function(c){this._aspectRatio=c},enumerable:!1,configurable:!0}),k.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},k.prototype.show=function(){this.showUI(),this.open()},k.prototype.close=function(c){c===void 0&&(c=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),c||this.closeEventListeners.forEach(function(_){return _()}),this._isOpen=!1)},k.prototype.addRenderEventListener=function(c){this.renderEventListeners.push(c)},k.prototype.removeRenderEventListener=function(c){this.renderEventListeners.indexOf(c)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(c),1)},k.prototype.addCloseEventListener=function(c){this.closeEventListeners.push(c)},k.prototype.removeCloseEventListener=function(c){this.closeEventListeners.indexOf(c)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(c),1)},k.prototype.setupResizeObserver=function(){var c=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){c.resize(c.target.clientWidth,c.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))},k.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var c=1*this.target.clientWidth/this.target.clientHeight,_=this.contentDiv.clientWidth/c>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*c:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,I=_+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/c;this.resize(_,I)}},k.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},k.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",Be.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},k.prototype.resize=function(c,_){this.imageWidth=Math.round(c),this.imageHeight=Math.round(_),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},k.prototype.setEditingTarget=function(){var c=document.createElement("canvas");c.width=this.target.naturalWidth,c.height=this.target.naturalHeight,c.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var _=c.toDataURL();Be.setAttributes(this.editingTarget,[["href",_]]),this.setEditingTargetSize()},k.prototype.setTopLeft=function(){var c=this.target.getBoundingClientRect(),_=this.editorCanvas.getBoundingClientRect();this.left=c.left-_.left-this.CANVAS_MARGIN,this.top=c.top-_.top-this.CANVAS_MARGIN},k.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=Be.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Be.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Be.createGroup(),this.editingTargetRotationScaleContainer=Be.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var c=Be.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(c);var _=Be.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(_),this.editingTargetContainer=Be.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},k.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},k.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Be.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new lt(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},k.prototype.zoomToCrop=function(){if(this.cropRect){var c=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,_=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=c+"px "+_+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-c+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-_+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},k.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},k.prototype.cropRectChanged=function(c){this.cropRect=c,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},k.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},k.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"},k.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},k.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var c=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,_=this.target.offsetTop>c+this.CANVAS_MARGIN?this.target.offsetTop-(c+this.CANVAS_MARGIN):0;this.coverDiv.style.top=_+"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},k.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},k.prototype.addTopToolbar=function(){var c=this;this.topToolbar=new ft,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 _=new Rt;_.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(_);var I=[];this.aspectRatios.forEach(function(Ge){var nt=new ot(ut.getIcon(Ge.horizontal,Ge.vertical),Ge.horizontal===0&&Ge.vertical===0?"FREE":Ge.horizontal+":"+Ge.vertical);nt.onClick=function(){return c.ratioButtonClicked(Ge)},I.push(nt)}),this.aspectRatioButton=new ct(ut.getIcon(0,0),"Aspect ratio",I),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,_.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var F=new ot('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");F.isActive=this.isGridVisible,F.onClick=function(){c.isGridVisible=!c.isGridVisible,F.isActive=c.isGridVisible},_.addButton(F);var D=new ot('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(D.isActive=this.zoomToCropEnabled,D.onClick=function(){c.zoomToCropEnabled=!c.zoomToCropEnabled,D.isActive=c.zoomToCropEnabled},_.addButton(D),!Et.isLicensed){var ie=new rt;this.topToolbar.addElementBlock(ie);var Re=document.createElement("div");Re.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var je=document.createElement("a");je.style.color="currentColor",je.href="https://markerjs.com/products/cropro",je.target="_blank",je.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',Re.appendChild(je),ie.addElement(Re)}var He=new Rt;He.minWidth=3*this.toolbarHeight+"px",He.contentAlign="end",this.topToolbar.addButtonBlock(He);var Ce=new ot('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ce.onClick=this.startRenderAndClose,He.addButton(Ce),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ce.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ve=new ot('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Ve.onClick=this.close,He.addButton(Ve),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ve.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},k.prototype.addBottomToolbar=function(){var c=this;this.bottomToolbar=new ft,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 _=new Rt;_.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(_);var I=new ot('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");I.onClick=this.rotateLeftButtonClicked,_.addButton(I);var F=new ot('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");F.onClick=this.rotateRightButtonClicked,_.addButton(F);var D=new rt;D.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(D),this.straightener=new gt("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(He){c.rotateBy(He),c.straightener.angle=c.rotationAngle},D.addElement(this.straightener.getUI());var ie=new Rt;ie.minWidth=2*this.toolbarHeight+"px",ie.contentAlign="end",this.bottomToolbar.addButtonBlock(ie);var Re=new ot('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");Re.onClick=this.flipHorizontallyButtonClicked,ie.addButton(Re);var je=new ot('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");je.onClick=this.flipVerticallyButtonClicked,ie.addButton(je)},k.prototype.ratioButtonClicked=function(c){this.aspectRatio=c,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},k.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=ut.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},k.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ze(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},k.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},k.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},k.prototype.restoreState=function(c){if(c){var _=this.cropLayer.getRescaledRect(c.width,c.height,this.imageWidth,this.imageHeight,c.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(_),this.cropRectChanged(_),this.flippedHorizontally=c.flippedHorizontally,this.flippedVertically=c.flippedVertically,this.applyFlip(),this.rotationAngle=c.rotationAngle,this.applyRotation()}},k.prototype.clientToLocalCoordinates=function(c,_){var I=this.cropImage.getBoundingClientRect();return{x:c-I.left,y:_-I.top}},k.prototype.onWindowResize=function(){this.positionUI()},k.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var c=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=c+"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()},k.prototype.rotateLeftButtonClicked=function(){var c=this.rotationAngle-90;this.rotationAngle%90!=0&&(c+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(c)},k.prototype.rotateRightButtonClicked=function(){var c=this.rotationAngle+90;this.rotationAngle%90!=0&&(c-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(c)},k.prototype.rotateTo=function(c){c=(c=c>180?c-360:c)<=-180?c+360:c,this.rotationAngle=c,this.applyRotation()},k.prototype.rotateBy=function(c){this.rotateTo((this.rotationAngle+c)%360)},k.prototype.applyRotation=function(){var c=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var _=this.editingTargetRotationContainer.transform.baseVal.getItem(0);_.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(_,0);var I=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/I.width,this.imageHeight/I.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=c},k.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},k.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},k.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},k.prototype.startRenderAndClose=function(){return tt(this,void 0,void 0,function(){var c,_;return _t(this,function(I){switch(I.label){case 0:return[4,this.render()];case 1:return c=I.sent(),_=this.getState(),this.renderEventListeners.forEach(function(F){return F(c,_)}),this.close(!0),[2]}})})},k.prototype.render=function(){return tt(this,void 0,void 0,function(){var c;return _t(this,function(_){switch(_.label){case 0:return(c=new It).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.width=this.renderWidth,c.height=this.renderHeight,this.unzoomFromCrop(),Be.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,c.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 _.sent(),[4,c.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,_.sent()]}})})},k.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Je("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 Je("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Je("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var c=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Je("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*c)+`px;
|
|
height: `+(this.toolbarHeight-2*c)+`px;
|
|
padding: `+c+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Je("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Je("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new Qe("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Qe("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Je("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 Je("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Je("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 Je("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*c)+`px;
|
|
padding: `+c+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Je("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},k.instanceCounter=0,k}(),Mt=J("8hTe"),Wt=J.n(Mt),jt=/<pre[^>]*>/g;function Vt(k){var c=document.createElement("div");return c.innerHTML=k,c.childNodes.length===0?"":c.childNodes[0].nodeValue}var Kt=We.a=function(k){var c=k.value,_=c===void 0?"":c,I=k.edit,F=I===void 0?!1:I,D=k.className,ie=k.showTextOnly,Re=k.showLines,je=k.replaces,He=k.zoomImg,Ce=k.hasMask,Ve=k.style,Ge=Ve===void 0?{}:Ve,nt=k.stylesPrev,St=nt===void 0?{}:nt,xt=String(_),bt=Object(S.useRef)(),Ct=Object(S.useRef)(),Ht=Object(S.useState)(""),Nt=Object(B.a)(Ht,2),vt=Nt[0],Ot=Nt[1],Gt=Object(S.useState)("office"),Lt=Object(B.a)(Gt,2),Yt=Lt[0],At=Lt[1],Pt=function(){var pt=new Ft(Ct.current);pt.displayMode="popup",pt.addRenderEventListener(function(){var Ut=Object(A.a)(w.a.mark(function ht(Bt){var wt;return w.a.wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:return bt.current.style.display="none",kt.next=3,Object(le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Bt}});case 3:wt=kt.sent,wt!=null&&wt.id&&je(Ct.current.getAttribute("src").replace(V.a.API_SERVER,""),"/api/attachments/".concat(wt==null?void 0:wt.id,"?type=").concat(wt.content_type));case 5:case"end":return kt.stop()}},ht)}));return function(ht){return Ut.apply(this,arguments)}}()),pt.show()},Jt=function(){var pt=new at(Ct.current);pt.settings.displayMode="popup",pt.addEventListener("render",function(){var Ut=Object(A.a)(w.a.mark(function ht(Bt){var wt;return w.a.wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:if(bt.current.style.display="none",!Ct.current){kt.next=6;break}return kt.next=4,Object(le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Bt.dataUrl}});case 4:wt=kt.sent,wt!=null&&wt.id&&je(Ct.current.getAttribute("src").replace(V.a.API_SERVER,""),"/api/attachments/".concat(wt==null?void 0:wt.id,"?type=").concat(wt.content_type));case 6:case"end":return kt.stop()}},ht)}));return function(ht){return Ut.apply(this,arguments)}}()),pt.show(),window.markerArea=pt},Xt=Object(S.useMemo)(function(){bt.current&&(bt.current.style.zIndex=-1);try{var Dt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,pt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Ut=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;xt=xt.replace(Dt,"("+V.a.API_SERVER+"/api/attachments/").replace(pt,'"'+V.a.API_SERVER+"/api/attachments/").replace(Ut,'"'+V.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(Qt){}var ht=U(xt),Bt=b();if(xt.match(/\[TOC\]/)&&(ht=ht.replace("<p>[TOC]</p>",E()),T()),ht=ht.replace(/(__special_katext_id_\d+__)/g,function(Qt,kt){var Zt=Bt[kt],ti=Zt.type,ii=Zt.expression;return Object(re.renderToString)(Vt(ii)||"",{displayMode:ti==="block",throwOnError:!1,output:"html"})}),ht=ht.replace(/▁/g,"\u2581\u2581\u2581"),p(),ie){var wt=document.createElement("div");return wt.innerHTML=ht,wt.innerText}return setTimeout(function(){return qt()},500),ht},[xt]),zt=Object(S.useRef)();v.WebkitLineClamp=Re,Re&&(Ge=Object(L.a)(Object(L.a)({},Ge),v));function $t(Dt){var pt=Dt.target;if(pt.tagName.toUpperCase()==="IMG"){if(He){var Ut=pt.getAttribute("src");Ot(Ut),At("image")}}else if(pt.tagName.toUpperCase()==="A"){var ht=pt.getAttribute("href");if(ht.indexOf("office")>-1)Dt.preventDefault(),Ot(ht),At("office");else if(ht.indexOf("application/pdf")>-1)Dt.preventDefault(),Ot(ht),At("pdf");else if(ht.indexOf("text/html")>-1)Dt.preventDefault(),Ot(ht),At("html");else if(ht.startsWith("#")){Dt.preventDefault();var Bt=document.getElementById(ht.replace("#",""));Bt&&Bt.scrollIntoView(!0)}}}var qt=function(){var pt,Ut=(pt=zt.current)===null||pt===void 0?void 0:pt.querySelectorAll("video");Ut==null||Ut.forEach(function(ht){if(ht.oncontextmenu=function(){return!1},ht.src.indexOf(".m3u8")>-1&&!ht.canPlayType("application/vnd.apple.mpegurl")){if(K.a.isSupported()){var Bt=new K.a;Bt.loadSource(ht.src),Bt.attachMedia(ht)}}})};Object(S.useEffect)(function(){if(zt.current&&Xt&&(Xt.match(jt)&&window.PR.prettyPrint()),zt.current)return zt.current.addEventListener("click",$t),function(){zt.current.removeEventListener("click",$t),p(),T()}},[Xt,zt.current,$t]);var ei=function(pt){if(!F)return;pt.target.nodeName==="IMG"?(bt.current.style.zIndex=1,bt.current.style.display="flex",bt.current.style.width=pt.target.clientWidth+"px",bt.current.style.height=pt.target.clientHeight+"px",bt.current.style.top=pt.target.offsetTop+"px",bt.current.style.left=pt.target.offsetLeft+"px",Ct.current.src=pt.target.getAttribute("src")):bt.current.style.display="none"};return m.a.createElement("div",{style:{position:"relative"}},m.a.createElement("div",{ref:zt,style:Object(L.a)({},Ge),className:"".concat(D||""," markdown-body ").concat(Wt.a.mdBody),onMouseOver:ei,dangerouslySetInnerHTML:{__html:Xt}}),m.a.createElement("div",{ref:bt,className:Wt.a.button},m.a.createElement(H.a,null,m.a.createElement(j.a,{onClick:function(){return Pt()}},"\u88C1\u526A"),m.a.createElement(j.a,{onClick:function(){return Jt()}},"\u7F16\u8F91"))),m.a.createElement("img",{ref:Ct,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),m.a.createElement(ee.a,{close:!0,data:vt,type:vt!=null&&vt.length?Yt:"",style:Object(L.a)({},St),onClose:function(){return Ot("")}}))}},BU3w:function(et,We,J){"use strict";J.d(We,"a",function(){return A});var de=J("MNnm"),H="rc-util-key";function C(B){if(B.attachTo)return B.attachTo;var M=document.querySelector("head");return M||document.body}function j(B){var M,w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(de.a)())return null;var S=document.createElement("style");if((M=w.csp)===null||M===void 0?void 0:M.nonce){var m;S.nonce=(m=w.csp)===null||m===void 0?void 0:m.nonce}S.innerHTML=B;var g=C(w),s=g.firstChild;return w.prepend&&g.prepend?g.prepend(S):w.prepend&&s?g.insertBefore(S,s):g.appendChild(S),S}var L=new Map;function A(B,M){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=C(w);if(!L.has(S)){var m=j("",w),g=m.parentNode;L.set(S,g),g.removeChild(m)}var s=Array.from(L.get(S).children).find(function(e){return e.tagName==="STYLE"&&e[H]===M});if(s){var a,i;if(((a=w.csp)===null||a===void 0?void 0:a.nonce)&&s.nonce!==((i=w.csp)===null||i===void 0?void 0:i.nonce)){var o;s.nonce=(o=w.csp)===null||o===void 0?void 0:o.nonce}return s.innerHTML!==B&&(s.innerHTML=B),s}var n=j(B,w);return n[H]=M,n}},DlQD:function(et,We,J){(function(de,H){et.exports=H()})(this,function(){"use strict";function de(se,te){for(var ae=0;ae<te.length;ae++){var G=te[ae];G.enumerable=G.enumerable||!1,G.configurable=!0,"value"in G&&(G.writable=!0),Object.defineProperty(se,G.key,G)}}function H(se,te,ae){return te&&de(se.prototype,te),ae&&de(se,ae),se}function C(se,te){if(!se)return;if(typeof se=="string")return j(se,te);var ae=Object.prototype.toString.call(se).slice(8,-1);if(ae==="Object"&&se.constructor&&(ae=se.constructor.name),ae==="Map"||ae==="Set")return Array.from(se);if(ae==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ae))return j(se,te)}function j(se,te){(te==null||te>se.length)&&(te=se.length);for(var ae=0,G=new Array(te);ae<te;ae++)G[ae]=se[ae];return G}function L(se,te){var ae;if(typeof Symbol=="undefined"||se[Symbol.iterator]==null){if(Array.isArray(se)||(ae=C(se))||te&&se&&typeof se.length=="number"){ae&&(se=ae);var G=0;return function(){return G>=se.length?{done:!0}:{done:!1,value:se[G++]}}}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 ae=se[Symbol.iterator](),ae.next.bind(ae)}function A(se,te){return te={exports:{}},se(te,te.exports),te.exports}var B=A(function(se){function te(){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 ae(G){se.exports.defaults=G}se.exports={defaults:te(),getDefaults:te,changeDefaults:ae}}),M=B.defaults,w=B.getDefaults,S=B.changeDefaults,m=/[&<>"']/,g=/[&<>"']/g,s=/[<>"']|&(?!#?\w+;)/,a=/[<>"']|&(?!#?\w+;)/g,i={"&":"&","<":"<",">":">",'"':""","'":"'"},o=function(te){return i[te]};function n(se,te){if(te){if(m.test(se))return se.replace(g,o)}else if(s.test(se))return se.replace(a,o);return se}var e=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function t(se){return se.replace(e,function(te,ae){return ae=ae.toLowerCase(),ae==="colon"?":":ae.charAt(0)==="#"?ae.charAt(1)==="x"?String.fromCharCode(parseInt(ae.substring(2),16)):String.fromCharCode(+ae.substring(1)):""})}var r=/(^|[^\[])\^/g;function T(se,te){se=se.source||se,te=te||"";var ae={replace:function(Y,Q){return Q=Q.source||Q,Q=Q.replace(r,"$1"),se=se.replace(Y,Q),ae},getRegex:function(){return new RegExp(se,te)}};return ae}var v=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function E(se,te,ae){if(se){var G;try{G=decodeURIComponent(t(ae)).replace(v,"").toLowerCase()}catch(Y){return null}if(G.indexOf("javascript:")===0||G.indexOf("vbscript:")===0||G.indexOf("data:")===0)return null}te&&!f.test(ae)&&(ae=d(te,ae));try{ae=encodeURI(ae).replace(/%25/g,"%")}catch(Y){return null}return ae}var y={},u=/^[^:]+:\/*[^/]*$/,l=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function d(se,te){y[" "+se]||(u.test(se)?y[" "+se]=se+"/":y[" "+se]=R(se,"/",!0)),se=y[" "+se];var ae=se.indexOf(":")===-1;return te.substring(0,2)==="//"?ae?te:se.replace(l,"$1")+te:te.charAt(0)==="/"?ae?te:se.replace(h,"$1")+te:se+te}var b={exec:function(){}};function p(se){for(var te=1,ae,G;te<arguments.length;te++){ae=arguments[te];for(G in ae)Object.prototype.hasOwnProperty.call(ae,G)&&(se[G]=ae[G])}return se}function x(se,te){var ae=se.replace(/\|/g,function(Q,q,ce){for(var _e=!1,ke=q;--ke>=0&&ce[ke]==="\\";)_e=!_e;return _e?"|":" |"}),G=ae.split(/ \|/),Y=0;if(G.length>te)G.splice(te);else for(;G.length<te;)G.push("");for(;Y<G.length;Y++)G[Y]=G[Y].trim().replace(/\\\|/g,"|");return G}function R(se,te,ae){var G=se.length;if(G===0)return"";for(var Y=0;Y<G;){var Q=se.charAt(G-Y-1);if(Q===te&&!ae)Y++;else if(Q!==te&&ae)Y++;else break}return se.substr(0,G-Y)}function O(se,te){if(se.indexOf(te[1])===-1)return-1;for(var ae=se.length,G=0,Y=0;Y<ae;Y++)if(se[Y]==="\\")Y++;else if(se[Y]===te[0])G++;else if(se[Y]===te[1]&&(G--,G<0))return Y;return-1}function N(se){se&&se.sanitize&&!se.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var U={escape:n,unescape:t,edit:T,cleanUrl:E,resolveUrl:d,noopTest:b,merge:p,splitCells:x,rtrim:R,findClosingBracket:O,checkSanitizeDeprecation:N},W=B.defaults,P=U.rtrim,K=U.splitCells,V=U.escape,re=U.findClosingBracket;function ee(se,te,ae){var G=te.href,Y=te.title?V(te.title):null,Q=se[1].replace(/\\([\[\]])/g,"$1");return se[0].charAt(0)!=="!"?{type:"link",raw:ae,href:G,title:Y,text:Q}:{type:"image",raw:ae,href:G,title:Y,text:V(Q)}}function le(se,te){var ae=se.match(/^(\s+)(?:```)/);if(ae===null)return te;var G=ae[1];return te.split(`
|
|
`).map(function(Y){var Q=Y.match(/^\s+/);if(Q===null)return Y;var q=Q[0];return q.length>=G.length?Y.slice(G.length):Y}).join(`
|
|
`)}var oe=function(){function se(ae){this.options=ae||W}var te=se.prototype;return te.space=function(G){var Y=this.rules.block.newline.exec(G);if(Y)return Y[0].length>1?{type:"space",raw:Y[0]}:{raw:`
|
|
`}},te.code=function(G,Y){var Q=this.rules.block.code.exec(G);if(Q){var q=Y[Y.length-1];if(q&&q.type==="paragraph")return{raw:Q[0],text:Q[0].trimRight()};var ce=Q[0].replace(/^ {4}/gm,"");return{type:"code",raw:Q[0],codeBlockStyle:"indented",text:this.options.pedantic?ce:P(ce,`
|
|
`)}}},te.fences=function(G){var Y=this.rules.block.fences.exec(G);if(Y){var Q=Y[0],q=le(Q,Y[3]||"");return{type:"code",raw:Q,lang:Y[2]?Y[2].trim():Y[2],text:q}}},te.heading=function(G){var Y=this.rules.block.heading.exec(G);if(Y)return{type:"heading",raw:Y[0],depth:Y[1].length,text:Y[2]}},te.nptable=function(G){var Y=this.rules.block.nptable.exec(G);if(Y){var Q={type:"table",header:K(Y[1].replace(/^ *| *\| *$/g,"")),align:Y[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Y[3]?Y[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Y[0]};if(Q.header.length===Q.align.length){var q=Q.align.length,ce;for(ce=0;ce<q;ce++)/^ *-+: *$/.test(Q.align[ce])?Q.align[ce]="right":/^ *:-+: *$/.test(Q.align[ce])?Q.align[ce]="center":/^ *:-+ *$/.test(Q.align[ce])?Q.align[ce]="left":Q.align[ce]=null;for(q=Q.cells.length,ce=0;ce<q;ce++)Q.cells[ce]=K(Q.cells[ce],Q.header.length);return Q}}},te.hr=function(G){var Y=this.rules.block.hr.exec(G);if(Y)return{type:"hr",raw:Y[0]}},te.blockquote=function(G){var Y=this.rules.block.blockquote.exec(G);if(Y){var Q=Y[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Y[0],text:Q}}},te.list=function(G){var Y=this.rules.block.list.exec(G);if(Y){for(var Q=Y[0],q=Y[2],ce=q.length>1,_e=q[q.length-1]===")",ke={type:"list",raw:Q,ordered:ce,start:ce?+q.slice(0,-1):"",loose:!1,items:[]},Ke=Y[0].match(this.rules.block.item),Xe=!1,ze,qe,it,Ye,mt,at,yt,dt=Ke.length,tt=0;tt<dt;tt++)ze=Ke[tt],Q=ze,qe=ze.length,ze=ze.replace(/^ *([*+-]|\d+[.)]) */,""),~ze.indexOf(`
|
|
`)&&(qe-=ze.length,ze=this.options.pedantic?ze.replace(/^ {1,4}/gm,""):ze.replace(new RegExp("^ {1,"+qe+"}","gm"),"")),tt!==dt-1&&(it=this.rules.block.bullet.exec(Ke[tt+1])[0],(ce?it.length===1||!_e&&it[it.length-1]===")":it.length>1||this.options.smartLists&&it!==q)&&(Ye=Ke.slice(tt+1).join(`
|
|
`),ke.raw=ke.raw.substring(0,ke.raw.length-Ye.length),tt=dt-1)),mt=Xe||/\n\n(?!\s*$)/.test(ze),tt!==dt-1&&(Xe=ze.charAt(ze.length-1)===`
|
|
`,mt||(mt=Xe)),mt&&(ke.loose=!0),at=/^\[[ xX]\] /.test(ze),yt=void 0,at&&(yt=ze[1]!==" ",ze=ze.replace(/^\[[ xX]\] +/,"")),ke.items.push({type:"list_item",raw:Q,task:at,checked:yt,loose:mt,text:ze});return ke}},te.html=function(G){var Y=this.rules.block.html.exec(G);if(Y)return{type:this.options.sanitize?"paragraph":"html",raw:Y[0],pre:!this.options.sanitizer&&(Y[1]==="pre"||Y[1]==="script"||Y[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Y[0]):V(Y[0]):Y[0]}},te.def=function(G){var Y=this.rules.block.def.exec(G);if(Y){Y[3]&&(Y[3]=Y[3].substring(1,Y[3].length-1));var Q=Y[1].toLowerCase().replace(/\s+/g," ");return{tag:Q,raw:Y[0],href:Y[2],title:Y[3]}}},te.table=function(G){var Y=this.rules.block.table.exec(G);if(Y){var Q={type:"table",header:K(Y[1].replace(/^ *| *\| *$/g,"")),align:Y[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Y[3]?Y[3].replace(/\n$/,"").split(`
|
|
`):[]};if(Q.header.length===Q.align.length){Q.raw=Y[0];var q=Q.align.length,ce;for(ce=0;ce<q;ce++)/^ *-+: *$/.test(Q.align[ce])?Q.align[ce]="right":/^ *:-+: *$/.test(Q.align[ce])?Q.align[ce]="center":/^ *:-+ *$/.test(Q.align[ce])?Q.align[ce]="left":Q.align[ce]=null;for(q=Q.cells.length,ce=0;ce<q;ce++)Q.cells[ce]=K(Q.cells[ce].replace(/^ *\| *| *\| *$/g,""),Q.header.length);return Q}}},te.lheading=function(G){var Y=this.rules.block.lheading.exec(G);if(Y)return{type:"heading",raw:Y[0],depth:Y[2].charAt(0)==="="?1:2,text:Y[1]}},te.paragraph=function(G){var Y=this.rules.block.paragraph.exec(G);if(Y)return{type:"paragraph",raw:Y[0],text:Y[1].charAt(Y[1].length-1)===`
|
|
`?Y[1].slice(0,-1):Y[1]}},te.text=function(G,Y){var Q=this.rules.block.text.exec(G);if(Q){var q=Y[Y.length-1];return q&&q.type==="text"?{raw:Q[0],text:Q[0]}:{type:"text",raw:Q[0],text:Q[0]}}},te.escape=function(G){var Y=this.rules.inline.escape.exec(G);if(Y)return{type:"escape",raw:Y[0],text:V(Y[1])}},te.tag=function(G,Y,Q){var q=this.rules.inline.tag.exec(G);if(q)return!Y&&/^<a /i.test(q[0])?Y=!0:Y&&/^<\/a>/i.test(q[0])&&(Y=!1),!Q&&/^<(pre|code|kbd|script)(\s|>)/i.test(q[0])?Q=!0:Q&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(q[0])&&(Q=!1),{type:this.options.sanitize?"text":"html",raw:q[0],inLink:Y,inRawBlock:Q,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):V(q[0]):q[0]}},te.link=function(G){var Y=this.rules.inline.link.exec(G);if(Y){var Q=re(Y[2],"()");if(Q>-1){var q=Y[0].indexOf("!")===0?5:4,ce=q+Y[1].length+Q;Y[2]=Y[2].substring(0,Q),Y[0]=Y[0].substring(0,ce).trim(),Y[3]=""}var _e=Y[2],ke="";if(this.options.pedantic){var Ke=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(_e);Ke?(_e=Ke[1],ke=Ke[3]):ke=""}else ke=Y[3]?Y[3].slice(1,-1):"";_e=_e.trim().replace(/^<([\s\S]*)>$/,"$1");var Xe=ee(Y,{href:_e&&_e.replace(this.rules.inline._escapes,"$1"),title:ke&&ke.replace(this.rules.inline._escapes,"$1")},Y[0]);return Xe}},te.reflink=function(G,Y){var Q;if((Q=this.rules.inline.reflink.exec(G))||(Q=this.rules.inline.nolink.exec(G))){var q=(Q[2]||Q[1]).replace(/\s+/g," ");if(q=Y[q.toLowerCase()],!q||!q.href){var ce=Q[0].charAt(0);return{type:"text",raw:ce,text:ce}}var _e=ee(Q,q,Q[0]);return _e}},te.strong=function(G,Y,Q){Q===void 0&&(Q="");var q=this.rules.inline.strong.start.exec(G);if(q&&(!q[1]||q[1]&&(Q===""||this.rules.inline.punctuation.exec(Q)))){Y=Y.slice(-1*G.length);var ce=q[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ce.lastIndex=0;for(var _e;(q=ce.exec(Y))!=null;)if(_e=this.rules.inline.strong.middle.exec(Y.slice(0,q.index+3)),_e)return{type:"strong",raw:G.slice(0,_e[0].length),text:G.slice(2,_e[0].length-2)}}},te.em=function(G,Y,Q){Q===void 0&&(Q="");var q=this.rules.inline.em.start.exec(G);if(q&&(!q[1]||q[1]&&(Q===""||this.rules.inline.punctuation.exec(Q)))){Y=Y.slice(-1*G.length);var ce=q[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ce.lastIndex=0;for(var _e;(q=ce.exec(Y))!=null;)if(_e=this.rules.inline.em.middle.exec(Y.slice(0,q.index+2)),_e)return{type:"em",raw:G.slice(0,_e[0].length),text:G.slice(1,_e[0].length-1)}}},te.codespan=function(G){var Y=this.rules.inline.code.exec(G);if(Y){var Q=Y[2].replace(/\n/g," "),q=/[^ ]/.test(Q),ce=Q.startsWith(" ")&&Q.endsWith(" ");return q&&ce&&(Q=Q.substring(1,Q.length-1)),Q=V(Q,!0),{type:"codespan",raw:Y[0],text:Q}}},te.br=function(G){var Y=this.rules.inline.br.exec(G);if(Y)return{type:"br",raw:Y[0]}},te.del=function(G){var Y=this.rules.inline.del.exec(G);if(Y)return{type:"del",raw:Y[0],text:Y[1]}},te.autolink=function(G,Y){var Q=this.rules.inline.autolink.exec(G);if(Q){var q,ce;return Q[2]==="@"?(q=V(this.options.mangle?Y(Q[1]):Q[1]),ce="mailto:"+q):(q=V(Q[1]),ce=q),{type:"link",raw:Q[0],text:q,href:ce,tokens:[{type:"text",raw:q,text:q}]}}},te.url=function(G,Y){var Q;if(Q=this.rules.inline.url.exec(G)){var q,ce;if(Q[2]==="@")q=V(this.options.mangle?Y(Q[0]):Q[0]),ce="mailto:"+q;else{var _e;do _e=Q[0],Q[0]=this.rules.inline._backpedal.exec(Q[0])[0];while(_e!==Q[0]);q=V(Q[0]),Q[1]==="www."?ce="http://"+q:ce=q}return{type:"link",raw:Q[0],text:q,href:ce,tokens:[{type:"text",raw:q,text:q}]}}},te.inlineText=function(G,Y,Q){var q=this.rules.inline.text.exec(G);if(q){var ce;return Y?ce=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):V(q[0]):q[0]:ce=V(this.options.smartypants?Q(q[0]):q[0]),{type:"text",raw:q[0],text:ce}}},se}(),$=U.noopTest,Z=U.edit,ne=U.merge,X={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:$,table:$,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};X._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,X._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,X.def=Z(X.def).replace("label",X._label).replace("title",X._title).getRegex(),X.bullet=/(?:[*+-]|\d{1,9}[.)])/,X.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,X.item=Z(X.item,"gm").replace(/bull/g,X.bullet).getRegex(),X.list=Z(X.list).replace(/bull/g,X.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+X.def.source+")").getRegex(),X._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",X._comment=/<!--(?!-?>)[\s\S]*?-->/,X.html=Z(X.html,"i").replace("comment",X._comment).replace("tag",X._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),X.paragraph=Z(X._paragraph).replace("hr",X.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",X._tag).getRegex(),X.blockquote=Z(X.blockquote).replace("paragraph",X.paragraph).getRegex(),X.normal=ne({},X),X.gfm=ne({},X.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*|$)"}),X.gfm.nptable=Z(X.gfm.nptable).replace("hr",X.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",X._tag).getRegex(),X.gfm.table=Z(X.gfm.table).replace("hr",X.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",X._tag).getRegex(),X.pedantic=ne({},X.normal,{html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",X._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:$,paragraph:Z(X.normal._paragraph).replace("hr",X.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",X.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:$,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:$,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};z._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",z.punctuation=Z(z.punctuation).replace(/punctuation/g,z._punctuation).getRegex(),z._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",z._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",z.em.start=Z(z.em.start).replace(/punctuation/g,z._punctuation).getRegex(),z.em.middle=Z(z.em.middle).replace(/punctuation/g,z._punctuation).replace(/overlapSkip/g,z._overlapSkip).getRegex(),z.em.endAst=Z(z.em.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.em.endUnd=Z(z.em.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.start=Z(z.strong.start).replace(/punctuation/g,z._punctuation).getRegex(),z.strong.middle=Z(z.strong.middle).replace(/punctuation/g,z._punctuation).replace(/blockSkip/g,z._blockSkip).getRegex(),z.strong.endAst=Z(z.strong.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.endUnd=Z(z.strong.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.blockSkip=Z(z._blockSkip,"g").getRegex(),z.overlapSkip=Z(z._overlapSkip,"g").getRegex(),z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,z._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])?)+(?![-_])/,z.autolink=Z(z.autolink).replace("scheme",z._scheme).replace("email",z._email).getRegex(),z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,z.tag=Z(z.tag).replace("comment",X._comment).replace("attribute",z._attribute).getRegex(),z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,z._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,z.link=Z(z.link).replace("label",z._label).replace("href",z._href).replace("title",z._title).getRegex(),z.reflink=Z(z.reflink).replace("label",z._label).getRegex(),z.reflinkSearch=Z(z.reflinkSearch,"g").replace("reflink",z.reflink).replace("nolink",z.nolink).getRegex(),z.normal=ne({},z),z.pedantic=ne({},z.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:Z(/^!?\[(label)\]\((.*?)\)/).replace("label",z._label).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",z._label).getRegex()}),z.gfm=ne({},z.normal,{escape:Z(z.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),z.gfm.url=Z(z.gfm.url,"i").replace("email",z.gfm._extended_email).getRegex(),z.breaks=ne({},z.gfm,{br:Z(z.br).replace("{2,}","*").getRegex(),text:Z(z.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var fe={block:X,inline:z},Se=B.defaults,Oe=fe.block,Ae=fe.inline;function Pe(se){return se.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function me(se){var te="",ae,G,Y=se.length;for(ae=0;ae<Y;ae++)G=se.charCodeAt(ae),Math.random()>.5&&(G="x"+G.toString(16)),te+="&#"+G+";";return te}var ge=function(){function se(ae){this.tokens=[],this.tokens.links=Object.create(null),this.options=ae||Se,this.options.tokenizer=this.options.tokenizer||new oe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var G={block:Oe.normal,inline:Ae.normal};this.options.pedantic?(G.block=Oe.pedantic,G.inline=Ae.pedantic):this.options.gfm&&(G.block=Oe.gfm,this.options.breaks?G.inline=Ae.breaks:G.inline=Ae.gfm),this.tokenizer.rules=G}se.lex=function(G,Y){var Q=new se(Y);return Q.lex(G)};var te=se.prototype;return te.lex=function(G){return G=G.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(G,this.tokens,!0),this.inline(this.tokens),this.tokens},te.blockTokens=function(G,Y,Q){Y===void 0&&(Y=[]),Q===void 0&&(Q=!0),G=G.replace(/^ +$/gm,"");for(var q,ce,_e,ke;G;){if(q=this.tokenizer.space(G)){G=G.substring(q.raw.length),q.type&&Y.push(q);continue}if(q=this.tokenizer.code(G,Y)){G=G.substring(q.raw.length),q.type?Y.push(q):(ke=Y[Y.length-1],ke.raw+=`
|
|
`+q.raw,ke.text+=`
|
|
`+q.text);continue}if(q=this.tokenizer.fences(G)){G=G.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.heading(G)){G=G.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.nptable(G)){G=G.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.hr(G)){G=G.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.blockquote(G)){G=G.substring(q.raw.length),q.tokens=this.blockTokens(q.text,[],Q),Y.push(q);continue}if(q=this.tokenizer.list(G)){for(G=G.substring(q.raw.length),_e=q.items.length,ce=0;ce<_e;ce++)q.items[ce].tokens=this.blockTokens(q.items[ce].text,[],!1);Y.push(q);continue}if(q=this.tokenizer.html(G)){G=G.substring(q.raw.length),Y.push(q);continue}if(Q&&(q=this.tokenizer.def(G))){G=G.substring(q.raw.length),this.tokens.links[q.tag]||(this.tokens.links[q.tag]={href:q.href,title:q.title});continue}if(q=this.tokenizer.table(G)){G=G.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.lheading(G)){G=G.substring(q.raw.length),Y.push(q);continue}if(Q&&(q=this.tokenizer.paragraph(G))){G=G.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.text(G,Y)){G=G.substring(q.raw.length),q.type?Y.push(q):(ke=Y[Y.length-1],ke.raw+=`
|
|
`+q.raw,ke.text+=`
|
|
`+q.text);continue}if(G){var Ke="Infinite loop on byte: "+G.charCodeAt(0);if(this.options.silent){console.error(Ke);break}else throw new Error(Ke)}}return Y},te.inline=function(G){var Y,Q,q,ce,_e,ke,Ke=G.length;for(Y=0;Y<Ke;Y++){ke=G[Y];switch(ke.type){case"paragraph":case"text":case"heading":{ke.tokens=[],this.inlineTokens(ke.text,ke.tokens);break}case"table":{for(ke.tokens={header:[],cells:[]},ce=ke.header.length,Q=0;Q<ce;Q++)ke.tokens.header[Q]=[],this.inlineTokens(ke.header[Q],ke.tokens.header[Q]);for(ce=ke.cells.length,Q=0;Q<ce;Q++)for(_e=ke.cells[Q],ke.tokens.cells[Q]=[],q=0;q<_e.length;q++)ke.tokens.cells[Q][q]=[],this.inlineTokens(_e[q],ke.tokens.cells[Q][q]);break}case"blockquote":{this.inline(ke.tokens);break}case"list":{for(ce=ke.items.length,Q=0;Q<ce;Q++)this.inline(ke.items[Q].tokens);break}}}return G},te.inlineTokens=function(G,Y,Q,q,ce){Y===void 0&&(Y=[]),Q===void 0&&(Q=!1),q===void 0&&(q=!1),ce===void 0&&(ce="");var _e,ke=G,Ke;if(this.tokens.links){var Xe=Object.keys(this.tokens.links);if(Xe.length>0)for(;(Ke=this.tokenizer.rules.inline.reflinkSearch.exec(ke))!=null;)Xe.includes(Ke[0].slice(Ke[0].lastIndexOf("[")+1,-1))&&(ke=ke.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ke=this.tokenizer.rules.inline.blockSkip.exec(ke))!=null;)ke=ke.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;G;){if(_e=this.tokenizer.escape(G)){G=G.substring(_e.raw.length),Y.push(_e);continue}if(_e=this.tokenizer.tag(G,Q,q)){G=G.substring(_e.raw.length),Q=_e.inLink,q=_e.inRawBlock,Y.push(_e);continue}if(_e=this.tokenizer.link(G)){G=G.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,q)),Y.push(_e);continue}if(_e=this.tokenizer.reflink(G,this.tokens.links)){G=G.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,q)),Y.push(_e);continue}if(_e=this.tokenizer.strong(G,ke,ce)){G=G.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],Q,q),Y.push(_e);continue}if(_e=this.tokenizer.em(G,ke,ce)){G=G.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],Q,q),Y.push(_e);continue}if(_e=this.tokenizer.codespan(G)){G=G.substring(_e.raw.length),Y.push(_e);continue}if(_e=this.tokenizer.br(G)){G=G.substring(_e.raw.length),Y.push(_e);continue}if(_e=this.tokenizer.del(G)){G=G.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],Q,q),Y.push(_e);continue}if(_e=this.tokenizer.autolink(G,me)){G=G.substring(_e.raw.length),Y.push(_e);continue}if(!Q&&(_e=this.tokenizer.url(G,me))){G=G.substring(_e.raw.length),Y.push(_e);continue}if(_e=this.tokenizer.inlineText(G,q,Pe)){G=G.substring(_e.raw.length),ce=_e.raw.slice(-1),Y.push(_e);continue}if(G){var ze="Infinite loop on byte: "+G.charCodeAt(0);if(this.options.silent){console.error(ze);break}else throw new Error(ze)}}return Y},H(se,null,[{key:"rules",get:function(){return{block:Oe,inline:Ae}}}]),se}(),be=B.defaults,Ee=U.cleanUrl,Ie=U.escape,Me=function(){function se(ae){this.options=ae||be}var te=se.prototype;return te.code=function(G,Y,Q){var q=(Y||"").match(/\S*/)[0];if(this.options.highlight){var ce=this.options.highlight(G,q);ce!=null&&ce!==G&&(Q=!0,G=ce)}return q?'<pre><code class="'+this.options.langPrefix+Ie(q,!0)+'">'+(Q?G:Ie(G,!0))+`</code></pre>
|
|
`:"<pre><code>"+(Q?G:Ie(G,!0))+`</code></pre>
|
|
`},te.blockquote=function(G){return`<blockquote>
|
|
`+G+`</blockquote>
|
|
`},te.html=function(G){return G},te.heading=function(G,Y,Q,q){return this.options.headerIds?"<h"+Y+' id="'+this.options.headerPrefix+q.slug(Q)+'">'+G+"</h"+Y+`>
|
|
`:"<h"+Y+">"+G+"</h"+Y+`>
|
|
`},te.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},te.list=function(G,Y,Q){var q=Y?"ol":"ul",ce=Y&&Q!==1?' start="'+Q+'"':"";return"<"+q+ce+`>
|
|
`+G+"</"+q+`>
|
|
`},te.listitem=function(G){return"<li>"+G+`</li>
|
|
`},te.checkbox=function(G){return"<input "+(G?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},te.paragraph=function(G){return"<p>"+G+`</p>
|
|
`},te.table=function(G,Y){return Y&&(Y="<tbody>"+Y+"</tbody>"),`<table>
|
|
<thead>
|
|
`+G+`</thead>
|
|
`+Y+`</table>
|
|
`},te.tablerow=function(G){return`<tr>
|
|
`+G+`</tr>
|
|
`},te.tablecell=function(G,Y){var Q=Y.header?"th":"td",q=Y.align?"<"+Q+' align="'+Y.align+'">':"<"+Q+">";return q+G+"</"+Q+`>
|
|
`},te.strong=function(G){return"<strong>"+G+"</strong>"},te.em=function(G){return"<em>"+G+"</em>"},te.codespan=function(G){return"<code>"+G+"</code>"},te.br=function(){return this.options.xhtml?"<br/>":"<br>"},te.del=function(G){return"<del>"+G+"</del>"},te.link=function(G,Y,Q){if(G=Ee(this.options.sanitize,this.options.baseUrl,G),G===null)return Q;var q='<a href="'+Ie(G)+'"';return Y&&(q+=' title="'+Y+'"'),q+=">"+Q+"</a>",q},te.image=function(G,Y,Q){if(G=Ee(this.options.sanitize,this.options.baseUrl,G),G===null)return Q;var q='<img src="'+G+'" alt="'+Q+'"';return Y&&(q+=' title="'+Y+'"'),q+=this.options.xhtml?"/>":">",q},te.text=function(G){return G},se}(),De=function(){function se(){}var te=se.prototype;return te.strong=function(G){return G},te.em=function(G){return G},te.codespan=function(G){return G},te.del=function(G){return G},te.html=function(G){return G},te.text=function(G){return G},te.link=function(G,Y,Q){return""+Q},te.image=function(G,Y,Q){return""+Q},te.br=function(){return""},se}(),Fe=function(){function se(){this.seen={}}var te=se.prototype;return te.slug=function(G){var Y=G.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Y)){var Q=Y;do this.seen[Q]++,Y=Q+"-"+this.seen[Q];while(this.seen.hasOwnProperty(Y))}return this.seen[Y]=0,Y},se}(),ue=B.defaults,pe=U.unescape,ye=function(){function se(ae){this.options=ae||ue,this.options.renderer=this.options.renderer||new Me,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new De,this.slugger=new Fe}se.parse=function(G,Y){var Q=new se(Y);return Q.parse(G)};var te=se.prototype;return te.parse=function(G,Y){Y===void 0&&(Y=!0);var Q="",q,ce,_e,ke,Ke,Xe,ze,qe,it,Ye,mt,at,yt,dt,tt,_t,Et,Be,$e=G.length;for(q=0;q<$e;q++){Ye=G[q];switch(Ye.type){case"space":continue;case"hr":{Q+=this.renderer.hr();continue}case"heading":{Q+=this.renderer.heading(this.parseInline(Ye.tokens),Ye.depth,pe(this.parseInline(Ye.tokens,this.textRenderer)),this.slugger);continue}case"code":{Q+=this.renderer.code(Ye.text,Ye.lang,Ye.escaped);continue}case"table":{for(qe="",ze="",ke=Ye.header.length,ce=0;ce<ke;ce++)ze+=this.renderer.tablecell(this.parseInline(Ye.tokens.header[ce]),{header:!0,align:Ye.align[ce]});for(qe+=this.renderer.tablerow(ze),it="",ke=Ye.cells.length,ce=0;ce<ke;ce++){for(Xe=Ye.tokens.cells[ce],ze="",Ke=Xe.length,_e=0;_e<Ke;_e++)ze+=this.renderer.tablecell(this.parseInline(Xe[_e]),{header:!1,align:Ye.align[_e]});it+=this.renderer.tablerow(ze)}Q+=this.renderer.table(qe,it);continue}case"blockquote":{it=this.parse(Ye.tokens),Q+=this.renderer.blockquote(it);continue}case"list":{for(mt=Ye.ordered,at=Ye.start,yt=Ye.loose,ke=Ye.items.length,it="",ce=0;ce<ke;ce++)tt=Ye.items[ce],_t=tt.checked,Et=tt.task,dt="",tt.task&&(Be=this.renderer.checkbox(_t),yt?tt.tokens.length>0&&tt.tokens[0].type==="text"?(tt.tokens[0].text=Be+" "+tt.tokens[0].text,tt.tokens[0].tokens&&tt.tokens[0].tokens.length>0&&tt.tokens[0].tokens[0].type==="text"&&(tt.tokens[0].tokens[0].text=Be+" "+tt.tokens[0].tokens[0].text)):tt.tokens.unshift({type:"text",text:Be}):dt+=Be),dt+=this.parse(tt.tokens,yt),it+=this.renderer.listitem(dt,Et,_t);Q+=this.renderer.list(it,mt,at);continue}case"html":{Q+=this.renderer.html(Ye.text);continue}case"paragraph":{Q+=this.renderer.paragraph(this.parseInline(Ye.tokens));continue}case"text":{for(it=Ye.tokens?this.parseInline(Ye.tokens):Ye.text;q+1<$e&&G[q+1].type==="text";)Ye=G[++q],it+=`
|
|
`+(Ye.tokens?this.parseInline(Ye.tokens):Ye.text);Q+=Y?this.renderer.paragraph(it):it;continue}default:{var Qe='Token with "'+Ye.type+'" type was not found.';if(this.options.silent){console.error(Qe);return}else throw new Error(Qe)}}}return Q},te.parseInline=function(G,Y){Y=Y||this.renderer;var Q="",q,ce,_e=G.length;for(q=0;q<_e;q++){ce=G[q];switch(ce.type){case"escape":{Q+=Y.text(ce.text);break}case"html":{Q+=Y.html(ce.text);break}case"link":{Q+=Y.link(ce.href,ce.title,this.parseInline(ce.tokens,Y));break}case"image":{Q+=Y.image(ce.href,ce.title,ce.text);break}case"strong":{Q+=Y.strong(this.parseInline(ce.tokens,Y));break}case"em":{Q+=Y.em(this.parseInline(ce.tokens,Y));break}case"codespan":{Q+=Y.codespan(ce.text);break}case"br":{Q+=Y.br();break}case"del":{Q+=Y.del(this.parseInline(ce.tokens,Y));break}case"text":{Q+=Y.text(ce.text);break}default:{var ke='Token with "'+ce.type+'" type was not found.';if(this.options.silent){console.error(ke);return}else throw new Error(ke)}}}return Q},se}(),Te=U.merge,we=U.checkSanitizeDeprecation,xe=U.escape,ve=B.getDefaults,Ne=B.changeDefaults,Ue=B.defaults;function he(se,te,ae){if(typeof se=="undefined"||se===null)throw new Error("marked(): input parameter is undefined or null");if(typeof se!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(se)+", string expected");if(typeof te=="function"&&(ae=te,te=null),te=Te({},he.defaults,te||{}),we(te),ae){var G=te.highlight,Y;try{Y=ge.lex(se,te)}catch(_e){return ae(_e)}var Q=function(ke){var Ke;if(!ke)try{Ke=ye.parse(Y,te)}catch(Xe){ke=Xe}return te.highlight=G,ke?ae(ke):ae(null,Ke)};if(!G||G.length<3)return Q();if(delete te.highlight,!Y.length)return Q();var q=0;he.walkTokens(Y,function(_e){_e.type==="code"&&(q++,setTimeout(function(){G(_e.text,_e.lang,function(ke,Ke){if(ke)return Q(ke);Ke!=null&&Ke!==_e.text&&(_e.text=Ke,_e.escaped=!0),q--,q===0&&Q()})},0))}),q===0&&Q();return}try{var ce=ge.lex(se,te);return te.walkTokens&&he.walkTokens(ce,te.walkTokens),ye.parse(ce,te)}catch(_e){if(_e.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,te.silent)return"<p>An error occurred:</p><pre>"+xe(_e.message+"",!0)+"</pre>";throw _e}}he.options=he.setOptions=function(se){return Te(he.defaults,se),Ne(he.defaults),he},he.getDefaults=ve,he.defaults=Ue,he.use=function(se){var te=Te({},se);if(se.renderer&&function(){var G=he.defaults.renderer||new Me,Y=function(ce){var _e=G[ce];G[ce]=function(){for(var ke=arguments.length,Ke=new Array(ke),Xe=0;Xe<ke;Xe++)Ke[Xe]=arguments[Xe];var ze=se.renderer[ce].apply(G,Ke);return ze===!1&&(ze=_e.apply(G,Ke)),ze}};for(var Q in se.renderer)Y(Q);te.renderer=G}(),se.tokenizer&&function(){var G=he.defaults.tokenizer||new oe,Y=function(ce){var _e=G[ce];G[ce]=function(){for(var ke=arguments.length,Ke=new Array(ke),Xe=0;Xe<ke;Xe++)Ke[Xe]=arguments[Xe];var ze=se.tokenizer[ce].apply(G,Ke);return ze===!1&&(ze=_e.apply(G,Ke)),ze}};for(var Q in se.tokenizer)Y(Q);te.tokenizer=G}(),se.walkTokens){var ae=he.defaults.walkTokens;te.walkTokens=function(G){se.walkTokens(G),ae&&ae(G)}}he.setOptions(te)},he.walkTokens=function(se,te){for(var ae=L(se),G;!(G=ae()).done;){var Y=G.value;te(Y);switch(Y.type){case"table":{for(var Q=L(Y.tokens.header),q;!(q=Q()).done;){var ce=q.value;he.walkTokens(ce,te)}for(var _e=L(Y.tokens.cells),ke;!(ke=_e()).done;)for(var Ke=ke.value,Xe=L(Ke),ze;!(ze=Xe()).done;){var qe=ze.value;he.walkTokens(qe,te)}break}case"list":{he.walkTokens(Y.items,te);break}default:Y.tokens&&he.walkTokens(Y.tokens,te)}}},he.Parser=ye,he.parser=ye.parse,he.Renderer=Me,he.TextRenderer=De,he.Lexer=ge,he.lexer=ge.lex,he.Tokenizer=oe,he.Slugger=Fe,he.parse=he;var Le=he;return Le})},Etsf:function(et,We,J){"use strict";J.r(We);var de=J("5Dmo"),H=J("3S7+"),C=J("14J3"),j=J("BMrR"),L=J("jCWc"),A=J("kPKH"),B=J("sPJy"),M=J("bE4q"),w=J("k1fw"),S=J("9og8"),m=J("y8nQ"),g=J("Vl3Y"),s=J("tJVT"),a=J("PpiC"),i=J("WmNS"),o=J.n(i),n=J("q1tI"),e=J.n(n),t=J("55Ip"),r=J("9kvl"),T=J("9Bee"),v=J("xKgJ"),f=J("U/Y8"),E=J.n(f),y=J("Q9mQ"),u=J("diRs"),l=J("miYZ"),h=J("tsqr"),d=J("2qtc"),b=J("kLXV"),p=J("oBTY"),x=J("ozfa"),R=J("MJZm"),O=J("5NDa"),N=J("5rEg"),U=J("jrin"),W=J("nRaC"),P=J("5RzL"),K=J("ErOA"),V=J("Ty5D"),re=P.a.TreeNode,ee=function(be){var Ee=be.restful,Ie=be.loading,Me=be.dispatch,De=Object(V.i)(),Fe=Object(V.h)(),ue=Object(n.useState)(!1),pe=Object(s.a)(ue,2),ye=pe[0],Te=pe[1],we=Object(n.useState)(),xe=Object(s.a)(we,2),ve=xe[0],Ne=xe[1],Ue=Ee.actionTabs,he=g.a.useForm(),Le=Object(s.a)(he,1),se=Le[0];return Object(n.useEffect)(function(){Ee.actionTabs.key=="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"&&se.resetFields()},[Ee.actionTabs.key]),Ee.actionTabs.key!=="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"?null:e.a.createElement(b.a,{centered:!0,title:"\u65B0\u5EFA\u76EE\u5F55",visible:Ee.actionTabs.key==="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",bodyStyle:{minHeight:150},confirmLoading:ye,onOk:Object(S.a)(o.a.mark(function te(){var ae,G,Y;return o.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:return q.next=2,se.validateFields();case 2:return ae=se.getFieldValue(),Te(!0),G="/api/restfuls.json",q.next=7,Object(K.a)(G,{method:"post",body:Object(w.a)({file_type:1},ae)});case 7:Y=q.sent,Y.status===0&&(h.b.success("\u6DFB\u52A0\u6210\u529F"),Me({type:"restful/setActionTabs",payload:{}}),Me({type:"restful/getRestful"})),Te(!1);case 10:case"end":return q.stop()}},te)})),onCancel:function(){Me({type:"restful/setActionTabs",payload:{}})}},e.a.createElement("div",{className:"pl30 pr30"},e.a.createElement(g.a,{form:se,initialValues:Object(U.a)({},"name","")},e.a.createElement(g.a.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0"}]},e.a.createElement(j.a,{className:"mt30"},e.a.createElement(A.a,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),e.a.createElement(A.a,{flex:"1"},e.a.createElement(N.a,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26 ",maxLength:60})))))))},le=Object(r.a)(function(ge){var be=ge.restful,Ee=ge.loading;return{restful:be,loading:Ee}})(ee),oe=P.a.TreeNode,$=function(be){var Ee=be.restful,Ie=be.loading,Me=be.dispatch,De=Object(V.i)(),Fe=Object(V.h)(),ue=Object(n.useState)(!1),pe=Object(s.a)(ue,2),ye=pe[0],Te=pe[1],we=Object(n.useState)(),xe=Object(s.a)(we,2),ve=xe[0],Ne=xe[1],Ue=Ee.actionTabs,he=g.a.useForm(),Le=Object(s.a)(he,1),se=Le[0];return Object(n.useEffect)(function(){Ee.actionTabs.key=="\u91CD\u547D\u540D"&&(se.resetFields(),se.setFieldsValue({name:Ee.actionTabs.data.title}))},[Ee.actionTabs.key]),Ee.actionTabs.key!=="\u91CD\u547D\u540D"?null:e.a.createElement(b.a,{centered:!0,title:"\u91CD\u547D\u540D",visible:Ee.actionTabs.key==="\u91CD\u547D\u540D",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",bodyStyle:{minHeight:150},confirmLoading:ye,onOk:Object(S.a)(o.a.mark(function te(){var ae,G,Y;return o.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:return q.next=2,se.validateFields();case 2:return ae=se.getFieldValue(),Te(!0),G="/api/restfuls/".concat(Ee.actionTabs.data.id,".json"),q.next=7,Object(K.a)(G,{method:"put",body:Object(w.a)({file_type:1},ae)});case 7:Y=q.sent,Y.status===0&&(h.b.success("\u4FEE\u6539\u6210\u529F"),Me({type:"restful/setActionTabs",payload:{}}),Me({type:"restful/getRestful"})),Te(!1);case 10:case"end":return q.stop()}},te)})),onCancel:function(){Me({type:"restful/setActionTabs",payload:{}})}},e.a.createElement("div",{className:"pl30 pr30"},e.a.createElement(g.a,{form:se,initialValues:Object(U.a)({},"name","")},e.a.createElement(j.a,{className:"mt30"},e.a.createElement(A.a,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),e.a.createElement(A.a,{flex:"1"},e.a.createElement(g.a.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u65B0\u540D\u79F0"}]},e.a.createElement(N.a,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26 ",maxLength:60})))))))},Z=Object(r.a)(function(ge){var be=ge.restful,Ee=ge.loading;return{restful:be,loading:Ee}})($),ne=J("s7vb"),X=J("P48q"),z=J.n(X),fe=N.a.Search,Se=R.a.DirectoryTree,Oe=function(be){var Ee=be.user,Ie=be.globalSetting,Me=be.loading,De=be.dispatch,Fe=be.restful,ue=Object(a.a)(be,["user","globalSetting","loading","dispatch","restful"]),pe=Object(n.useState)({content:"",message:"",status:0,contacts:[],address:"",data:[]}),ye=Object(s.a)(pe,2),Te=ye[0],we=ye[1],xe=Object(n.useState)(!0),ve=Object(s.a)(xe,2),Ne=ve[0],Ue=ve[1],he=g.a.useForm(),Le=Object(s.a)(he,1),se=Le[0],te=Object(n.useState)(""),ae=Object(s.a)(te,2),G=ae[0],Y=ae[1],Q=Object(n.useState)([{id:1,name:"\u65B0\u5EFA\u6587\u4EF6"},{id:2,name:"\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"},{id:3,name:"\u91CD\u547D\u540D"},{id:4,name:"\u7F16\u8F91"},{id:5,name:"\u5220\u9664"}]),q=Object(s.a)(Q,1),ce=q[0],_e=Object(n.useState)([]),ke=Object(s.a)(_e,2),Ke=ke[0],Xe=ke[1],ze=Object(n.useState)([]),qe=Object(s.a)(ze,2),it=qe[0],Ye=qe[1],mt=Object(n.useState)(!1),at=Object(s.a)(mt,2),yt=at[0],dt=at[1],tt=Object(n.useState)([]),_t=Object(s.a)(tt,2),Et=_t[0],Be=_t[1];Object(n.useEffect)(function(){var ot;if((ot=Fe.restful)!==null&&ot!==void 0&&ot.data){var rt,Ze,ut;Be(Object(p.a)((rt=Fe.restful)===null||rt===void 0?void 0:rt.data));var ct=0,st;if((Ze=Fe.restful)===null||Ze===void 0||((ut=Ze.data)===null||ut===void 0)||ut.map(function(lt){var gt;lt.id==ue.match.params.id&&(ct=lt.id),lt.file_type==0&&!st&&(st=lt.id),lt==null||((gt=lt.children)===null||gt===void 0)||gt.map(function(It){st||(st=It.id),It.id==ue.match.params.id&&(ct=lt.id)}),!lt.children&&!st&&(st=lt.id)}),!ue.match.params.id&&st){ue.history.push("/ch/rest/".concat(st));return}ct&&setTimeout(function(){Xe([ct]),Ye([Number(ue.match.params.id||st)])},200)}},[Fe.restful]);var $e=function(rt,Ze){Ze.node.file_type===0?ue.history.push("/ch/rest/".concat(rt[0])):Ye(Object(p.a)(rt)),console.log("Trigger Select",rt,Ze)},Qe=function(rt){Xe(rt),console.log("Trigger Expand",rt)},Je=function(rt){return e.a.createElement("div",null,ce.map(function(Ze,ut){return e.a.createElement("p",{key:Ze.id,className:"current",onClick:function(){switch(Ze.id){case 1:ue.history.push("/ch/rest/edit/".concat(rt.id,"/0"));break;case 2:case 3:De({type:"restful/setActionTabs",payload:{key:Ze.name,data:rt}});break;case 4:document.location.href="/ch/rest/edit/".concat(rt.pid||0,"/").concat(rt.id);break;case 5:b.a.confirm({title:"\u63D0\u793A",content:"\u662F\u5426\u786E\u5B9A\u5220\u9664\uFF1F",onOk:function(){var st=Object(S.a)(o.a.mark(function gt(){var It;return o.a.wrap(function(Mt){for(;;)switch(Mt.prev=Mt.next){case 0:return Mt.next=2,Object(ne.a)({id:rt.id});case 2:It=Mt.sent,(It==null?void 0:It.status)==0&&(h.b.success("\u5220\u9664\u6210\u529F"),De({type:"restful/getRestful"}));case 4:case"end":return Mt.stop()}},gt)}));function lt(){return st.apply(this,arguments)}return lt}()});break}}},Ze.name)}).filter(function(Ze){return!!Ze}).filter(function(Ze){return rt.pid||rt.file_type==0?Ze.key>3:Ze.key!=4}))},ft=function ot(rt){return rt.map(function(Ze){var ut=Ze.title.indexOf(G),ct=Ze.title.substr(0,ut),st=Ze.title.substr(ut+G.length),lt=e.a.createElement("span",null,ct,e.a.createElement("span",{className:"c-blue"},G),st,Object(v.o)()&&e.a.createElement(u.a,{placement:"right",title:G,content:function(){return Je(Ze)},trigger:"hover"},e.a.createElement("span",{className:"iconfont icon-sandian ".concat(z.a.actions)})));if(G!==""){var gt;if(ut===-1&&!((gt=Ze.children)!==null&>!==void 0&>.length))return null}return Ze.children&&Ze.file_type===1?Object(w.a)(Object(w.a)({},Ze),{},{title:lt,key:Ze.key,children:ot(Ze.children)}):Object(w.a)(Object(w.a)({},Ze),{},{title:lt,key:Ze.key,isLeaf:!0})}).filter(function(Ze){return!!Ze})},Tt=function ot(rt,Ze){for(var ut,ct=0;ct<Ze.length;ct++){var st=Ze[ct];st.children&&(st.children.some(function(lt){return lt.key===rt})?ut=st.key:ot(rt,st.children)&&(ut=ot(rt,st.children)))}return ut},Rt=function(rt){var Ze=rt.target.value,ut=Et.map(function(ct){if(ct!=null&&ct.children){var st;return ct!=null&&(st=ct.children.filter(function(lt){return lt.title.indexOf(Ze)>-1}))!==null&&st!==void 0&&st.length?ct.id:null}return null});Y(Ze),dt(!0),console.log("expandedKeys:",ut),Xe(ut)};return console.log("loop(treeData):",ft(Et)),e.a.createElement("div",{className:z.a.tree},e.a.createElement(fe,{style:{marginBottom:8},placeholder:"\u8F93\u5165\u5173\u952E\u5B57\u68C0\u7D22",onChange:Rt}),e.a.createElement(Se,{multiple:!0,defaultExpandAll:!0,onSelect:$e,onExpand:Qe,expandedKeys:Ke,selectedKeys:it,autoExpandParent:yt,treeData:ft(Et)}),e.a.createElement(le,null),e.a.createElement(Z,null))},Ae=Object(r.a)(function(ge){var be=ge.user,Ee=ge.loading,Ie=ge.globalSetting,Me=ge.restful;return{user:be,globalSetting:Ie,restful:Me,loading:Ee.models.index}})(Oe),Pe=function(be){var Ee,Ie,Me=be.user,De=be.globalSetting,Fe=be.loading,ue=be.dispatch,pe=be.restful,ye=Object(a.a)(be,["user","globalSetting","loading","dispatch","restful"]),Te=Object(n.useState)({content:"",message:"",status:0,contacts:[],address:"",data:[]}),we=Object(s.a)(Te,2),xe=we[0],ve=we[1],Ne=Object(n.useState)(!0),Ue=Object(s.a)(Ne,2),he=Ue[0],Le=Ue[1],se=g.a.useForm(),te=Object(s.a)(se,1),ae=te[0],G=ye.match.params,Y=function(){var ce=Object(S.a)(o.a.mark(function _e(){return o.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:ue({type:"restful/getRestful"}),G.id&&ue({type:"restful/getRestfulDetail",payload:Object(w.a)({},G)});case 2:case"end":return Ke.stop()}},_e)}));return function(){return ce.apply(this,arguments)}}();Object(n.useEffect)(function(){Le(!0),Y()},[G.id]);var Q=function(){ue({type:"restful/setActionTabs",payload:{key:"\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"}})},q=function(){var _e;if((_e=pe.restful)!==null&&_e!==void 0&&_e.data){var ke,Ke,Xe=0;return(ke=pe.restful)===null||ke===void 0||((Ke=ke.data)===null||Ke===void 0)||Ke.map(function(ze){var qe;ze==null||((qe=ze.children)===null||qe===void 0)||qe.map(function(it){it.id==ye.match.params.id&&(Xe=ze.id)}),!ze.children&&!Xe&&(Xe=ze.id)}),Xe}return 0};return e.a.createElement("section",null,e.a.createElement("aside",{className:"edu-container mt20"},e.a.createElement(M.a,null,e.a.createElement(M.a.Item,null,e.a.createElement(t.a,{to:"/"},"\u9996\u9875")),e.a.createElement(M.a.Item,null,e.a.createElement(t.a,{to:"/ch/rest"},"API\u6587\u6863"))),e.a.createElement("div",{className:"mt20"},e.a.createElement(j.a,{gutter:[20,20]},e.a.createElement(A.a,{flex:"300px"},e.a.createElement(Ae,ye)),e.a.createElement(A.a,{flex:"1"},e.a.createElement("div",{className:E.a.info},e.a.createElement("h1",{style:{fontSize:28,paddingBottom:15,borderBottom:"1px solid #eaeaea",textAlign:"center"}},(Ee=pe.restfulDetail)===null||Ee===void 0?void 0:Ee.name),e.a.createElement(T.a,{value:(Ie=pe.restfulDetail)===null||Ie===void 0?void 0:Ie.description}))))),Object(v.o)()&&e.a.createElement("div",{className:E.a.bar},e.a.createElement(j.a,null,!!q()&&e.a.createElement(A.a,null,e.a.createElement(H.a,{title:"\u7F16\u8F91\u6587\u4EF6"},e.a.createElement(t.a,{to:"/ch/rest/edit/".concat(q(),"/").concat(ye.match.params.id),className:"icon-zhongmingming current"}))),e.a.createElement(A.a,null,e.a.createElement(H.a,{title:"\u6DFB\u52A0\u6587\u4EF6"},e.a.createElement(t.a,{to:"/ch/rest/edit/".concat(q(),"/0"),className:"icon-tianjiatimu current"}))),e.a.createElement(A.a,null,e.a.createElement(H.a,{title:"\u65B0\u5EFA\u6587\u4EF6\u5939"},e.a.createElement("span",{className:"icon-wenjianjia1 current",onClick:Q})))))))},me=We.default=Object(r.a)(function(ge){var be=ge.user,Ee=ge.loading,Ie=ge.globalSetting,Me=ge.restful;return{user:be,globalSetting:Ie,restful:Me,loading:Ee.models.index}})(Pe)},NvD2:function(et,We,J){"use strict";J.d(We,"a",function(){return A});var de=J("Kwbf");function H(B,M){var w=new Set;return B.forEach(function(S){M.has(S)||w.add(S)}),w}function C(B){var M=B||{},w=M.disabled,S=M.disableCheckbox,m=M.checkable;return!!(w||S)||m===!1}function j(B,M,w,S){for(var m=new Set(B),g=new Set,s=0;s<=w;s+=1){var a=M.get(s)||new Set;a.forEach(function(e){var t=e.key,r=e.node,T=e.children,v=T===void 0?[]:T;m.has(t)&&!S(r)&&v.filter(function(f){return!S(f.node)}).forEach(function(f){m.add(f.key)})})}for(var i=new Set,o=w;o>=0;o-=1){var n=M.get(o)||new Set;n.forEach(function(e){var t=e.parent,r=e.node;if(S(r)||!e.parent||i.has(e.parent.key))return;if(S(e.parent.node)){i.add(t.key);return}var T=!0,v=!1;(t.children||[]).filter(function(f){return!S(f.node)}).forEach(function(f){var E=f.key,y=m.has(E);T&&!y&&(T=!1),!v&&(y||g.has(E))&&(v=!0)}),T&&m.add(t.key),v&&g.add(t.key),i.add(t.key)})}return{checkedKeys:Array.from(m),halfCheckedKeys:Array.from(H(g,m))}}function L(B,M,w,S,m){for(var g=new Set(B),s=new Set(M),a=0;a<=S;a+=1){var i=w.get(a)||new Set;i.forEach(function(t){var r=t.key,T=t.node,v=t.children,f=v===void 0?[]:v;!g.has(r)&&!s.has(r)&&!m(T)&&f.filter(function(E){return!m(E.node)}).forEach(function(E){g.delete(E.key)})})}s=new Set;for(var o=new Set,n=S;n>=0;n-=1){var e=w.get(n)||new Set;e.forEach(function(t){var r=t.parent,T=t.node;if(m(T)||!t.parent||o.has(t.parent.key))return;if(m(t.parent.node)){o.add(r.key);return}var v=!0,f=!1;(r.children||[]).filter(function(E){return!m(E.node)}).forEach(function(E){var y=E.key,u=g.has(y);v&&!u&&(v=!1),!f&&(u||s.has(y))&&(f=!0)}),v||g.delete(r.key),f&&s.add(r.key),o.add(r.key)})}return{checkedKeys:Array.from(g),halfCheckedKeys:Array.from(H(s,g))}}function A(B,M,w,S){var m=[],g;S?g=S:g=C;var s=new Set(B.filter(function(n){var e=!!w[n];return e||m.push(n),e})),a=new Map,i=0;Object.keys(w).forEach(function(n){var e=w[n],t=e.level,r=a.get(t);r||(r=new Set,a.set(t,r)),r.add(e),i=Math.max(i,t)}),Object(de.a)(!m.length,"Tree missing follow keys: ".concat(m.slice(0,100).map(function(n){return"'".concat(n,"'")}).join(", ")));var o;return M===!0?o=j(s,a,i,g):o=L(s,M.halfCheckedKeys,a,i,g),o}},OZM5:function(et,We,J){"use strict";J.d(We,"b",function(){return S}),J.d(We,"a",function(){return m}),J.d(We,"k",function(){return g}),J.d(We,"h",function(){return s}),J.d(We,"i",function(){return a}),J.d(We,"g",function(){return i}),J.d(We,"c",function(){return o}),J.d(We,"d",function(){return n}),J.d(We,"j",function(){return r}),J.d(We,"e",function(){return T}),J.d(We,"f",function(){return v});var de=J("KQm4"),H=J("U8pU"),C=J("Ff2n"),j=J("q1tI"),L=J.n(j),A=J("Kwbf"),B=J("WaYH"),M=.25,w=2;function S(f,E){var y=f.slice(),u=y.indexOf(E);return u>=0&&y.splice(u,1),y}function m(f,E){var y=f.slice();return y.indexOf(E)===-1&&y.push(E),y}function g(f){return f.split("-")}function s(f,E){return"".concat(f,"-").concat(E)}function a(f){return f&&f.type&&f.type.isTreeNode}function i(f,E){var y=[f],u=E[f];function l(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];h.forEach(function(d){var b=d.key,p=d.children;y.push(b),l(p)})}return l(u.children),y}function o(f,E){var y=f.clientY,u=E.selectHandle.getBoundingClientRect(),l=u.top,h=u.bottom,d=u.height,b=Math.max(d*M,w);return y<=l+b?-1:y>=h-b?1:0}function n(f,E){if(!f)return;var y=E.multiple;return y?f.slice():f.length?[f[0]]:f}var e=function(E){return E};function t(f,E){if(!f)return[];var y=E||{},u=y.processProps,l=u===void 0?e:u,h=Array.isArray(f)?f:[f];return h.map(function(d){var b=d.children,p=Object(C.a)(d,["children"]),x=t(b,E);return L.a.createElement(B.a,Object.assign({},l(p)),x)})}function r(f){if(!f)return null;var E;if(Array.isArray(f))E={checkedKeys:f,halfCheckedKeys:void 0};else if(Object(H.a)(f)==="object")E={checkedKeys:f.checked||void 0,halfCheckedKeys:f.halfChecked||void 0};else return Object(A.a)(!1,"`checkedKeys` is not an array or an object"),null;return E}function T(f,E){var y=new Set;function u(l){if(y.has(l))return;var h=E[l];if(!h)return;y.add(l);var d=h.parent,b=h.node;if(b.disabled)return;d&&u(d.key)}return(f||[]).forEach(function(l){u(l)}),Object(de.a)(y)}function v(f){var E={};return Object.keys(f).forEach(function(y){(y.startsWith("data-")||y.startsWith("aria-"))&&(E[y]=f[y])}),E}},P48q:function(et,We,J){et.exports={flex_box_center:"flex_box_center___BHtvi",flex_space_between:"flex_space_between___1noDr",flex_box_vertical_center:"flex_box_vertical_center___2UDAc",flex_box_center_end:"flex_box_center_end___2j8--",flex_box_column:"flex_box_column___3X60k",tree:"tree___2kCYs",actions:"actions___10Q_6"}},SJMd:function(et,We){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var J,de,H,C=!1,j,L;window.PR_SHOULD_USE_CONTINUATION=!0;var A,B;(function(){var M=window,w=["break,continue,do,else,for,if,return,while"],S=[w,"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"],m=[S,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],g=[m,"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"],s=[m,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],a=[m,"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"],i="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",o=[m,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],n="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",e=[w,"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"],t=[w,"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"],r=[w,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[g,a,s,o,n,e,t,r],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",E="kwd",y="com",u="typ",l="lit",h="pun",d="pln",b="tag",p="dec",x="src",R="atn",O="atv",N="nocode",U="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function W(me){for(var ge=0,be=!1,Ee=!1,Ie=0,Me=me.length;Ie<Me;++Ie){var De=me[Ie];if(De.ignoreCase)Ee=!0;else if(/[a-z]/i.test(De.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){be=!0,Ee=!1;break}}var Fe={b:8,t:9,n:10,v:11,f:12,r:13};function ue(xe){var ve=xe.charCodeAt(0);if(ve!==92)return ve;var Ne=xe.charAt(1);return ve=Fe[Ne],ve||("0"<=Ne&&Ne<="7"?parseInt(xe.substring(1),8):Ne==="u"||Ne==="x"?parseInt(xe.substring(2),16):xe.charCodeAt(1))}function pe(xe){if(xe<32)return(xe<16?"\\x0":"\\x")+xe.toString(16);var ve=String.fromCharCode(xe);return ve==="\\"||ve==="-"||ve==="]"||ve==="^"?"\\"+ve:ve}function ye(xe){var ve=xe.substring(1,xe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Ne=[],Ue=ve[0]==="^",he=["["];Ue&&he.push("^");for(var Le=Ue?1:0,se=ve.length;Le<se;++Le){var te=ve[Le];if(/\\[bdsw]/i.test(te))he.push(te);else{var ae=ue(te),G;Le+2<se&&ve[Le+1]==="-"?(G=ue(ve[Le+2]),Le+=2):G=ae,Ne.push([ae,G]),G<65||ae>122||(G<65||ae>90||Ne.push([Math.max(65,ae)|32,Math.min(G,90)|32]),G<97||ae>122||Ne.push([Math.max(97,ae)&~32,Math.min(G,122)&~32]))}}Ne.sort(function(ce,_e){return ce[0]-_e[0]||_e[1]-ce[1]});for(var Y=[],Q=[],Le=0;Le<Ne.length;++Le){var q=Ne[Le];q[0]<=Q[1]+1?Q[1]=Math.max(Q[1],q[1]):Y.push(Q=q)}for(var Le=0;Le<Y.length;++Le){var q=Y[Le];he.push(pe(q[0])),q[1]>q[0]&&(q[1]+1>q[0]&&he.push("-"),he.push(pe(q[1])))}return he.push("]"),he.join("")}function Te(xe){for(var ve=xe.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")),Ne=ve.length,Ue=[],he=0,Le=0;he<Ne;++he){var se=ve[he];if(se==="(")++Le;else if(se.charAt(0)==="\\"){var te=+se.substring(1);te&&(te<=Le?Ue[te]=-1:ve[he]=pe(te))}}for(var he=1;he<Ue.length;++he)Ue[he]===-1&&(Ue[he]=++ge);for(var he=0,Le=0;he<Ne;++he){var se=ve[he];if(se==="(")++Le,Ue[Le]||(ve[he]="(?:");else if(se.charAt(0)==="\\"){var te=+se.substring(1);te&&te<=Le&&(ve[he]="\\"+Ue[te])}}for(var he=0;he<Ne;++he)ve[he]==="^"&&ve[he+1]!=="^"&&(ve[he]="");if(xe.ignoreCase&&be)for(var he=0;he<Ne;++he){var se=ve[he],ae=se.charAt(0);se.length>=2&&ae==="["?ve[he]=ye(se):ae!=="\\"&&(ve[he]=se.replace(/[a-zA-Z]/g,function(Q){var q=Q.charCodeAt(0);return"["+String.fromCharCode(q&~32,q|32)+"]"}))}return ve.join("")}for(var we=[],Ie=0,Me=me.length;Ie<Me;++Ie){var De=me[Ie];if(De.global||De.multiline)throw new Error(""+De);we.push("(?:"+Te(De)+")")}return new RegExp(we.join("|"),Ee?"gi":"g")}function P(me,ge){var be=/(?:^|\s)nocode(?:\s|$)/,Ee=[],Ie=0,Me=[],De=0;function Fe(ue){var pe=ue.nodeType;if(pe==1){if(be.test(ue.className))return;for(var ye=ue.firstChild;ye;ye=ye.nextSibling)Fe(ye);var Te=ue.nodeName.toLowerCase();(Te==="br"||Te==="li")&&(Ee[De]=`
|
|
`,Me[De<<1]=Ie++,Me[De++<<1|1]=ue)}else if(pe==3||pe==4){var we=ue.nodeValue;we.length&&(ge?we=we.replace(/\r\n?/g,`
|
|
`):we=we.replace(/[ \t\r\n]+/g," "),Ee[De]=we,Me[De<<1]=Ie,Ie+=we.length,Me[De++<<1|1]=ue)}}return Fe(me),{sourceCode:Ee.join("").replace(/\n$/,""),spans:Me}}function K(me,ge,be,Ee,Ie){if(!be)return;var Me={sourceNode:me,pre:1,langExtension:null,numberLines:null,sourceCode:be,spans:null,basePos:ge,decorations:null};Ee(Me),Ie.push.apply(Ie,Me.decorations)}var V=/\S/;function re(me){for(var ge=void 0,be=me.firstChild;be;be=be.nextSibling){var Ee=be.nodeType;ge=Ee===1?ge?me:be:Ee===3&&V.test(be.nodeValue)?me:ge}return ge===me?void 0:ge}function ee(me,ge){var be={},Ee;(function(){for(var De=me.concat(ge),Fe=[],ue={},pe=0,ye=De.length;pe<ye;++pe){var Te=De[pe],we=Te[3];if(we)for(var xe=we.length;--xe>=0;)be[we.charAt(xe)]=Te;var ve=Te[1],Ne=""+ve;ue.hasOwnProperty(Ne)||(Fe.push(ve),ue[Ne]=null)}Fe.push(/[\0-\uffff]/),Ee=W(Fe)})();var Ie=ge.length,Me=function(De){for(var Fe=De.sourceCode,ue=De.basePos,pe=De.sourceNode,ye=[ue,d],Te=0,we=Fe.match(Ee)||[],xe={},ve=0,Ne=we.length;ve<Ne;++ve){var Ue=we[ve],he=xe[Ue],Le=void 0,se;if(typeof he=="string")se=!1;else{var te=be[Ue.charAt(0)];if(te)Le=Ue.match(te[1]),he=te[0];else{for(var ae=0;ae<Ie;++ae)if(te=ge[ae],Le=Ue.match(te[1]),Le){he=te[0];break}Le||(he=d)}se=he.length>=5&&he.substring(0,5)==="lang-",se&&!(Le&&typeof Le[1]=="string")&&(se=!1,he=x),se||(xe[Ue]=he)}var G=Te;if(Te+=Ue.length,!se)ye.push(ue+G,he);else{var Y=Le[1],Q=Ue.indexOf(Y),q=Q+Y.length;Le[2]&&(q=Ue.length-Le[2].length,Q=q-Y.length);var ce=he.substring(5);K(pe,ue+G,Ue.substring(0,Q),Me,ye),K(pe,ue+G+Q,Y,z(ce,Y),ye),K(pe,ue+G+q,Ue.substring(q),Me,ye)}}De.decorations=ye};return Me}function le(me){var ge=[],be=[];me.tripleQuotedStrings?ge.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):me.multiLineStrings?ge.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ge.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),me.verbatimStrings&&be.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ee=me.hashComments;Ee&&(me.cStyleComments?(Ee>1?ge.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ge.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),be.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ge.push([y,/^#[^\r\n]*/,null,"#"])),me.cStyleComments&&(be.push([y,/^\/\/[^\r\n]*/,null]),be.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=me.regexLiterals;if(Ie){var Me=Ie>1?"":`
|
|
\r`,De=Me?".":"[\\S\\s]",Fe="/(?=[^/*"+Me+"])(?:[^/\\x5B\\x5C"+Me+"]|\\x5C"+De+"|\\x5B(?:[^\\x5C\\x5D"+Me+"]|\\x5C"+De+")*(?:\\x5D|$))+/";be.push(["lang-regex",RegExp("^"+U+"("+Fe+")")])}var ue=me.types;ue&&be.push([u,ue]);var pe=(""+me.keywords).replace(/^ | $/g,"");pe.length&&be.push([E,new RegExp("^(?:"+pe.replace(/[\s,]+/g,"|")+")\\b"),null]),ge.push([d,/^\s+/,null,` \r
|
|
\xA0`]);var ye="^.[^\\s\\w.$@'\"`/\\\\]*";return me.regexLiterals&&(ye+="(?!s*/)"),be.push([l,/^@[a-z_$][a-z_$@0-9]*/i,null],[u,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[d,/^[a-z_$][a-z_$@0-9]*/i,null],[l,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[d,/^\\[\s\S]?/,null],[h,new RegExp(ye),null]),ee(ge,be)}var oe=le({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function $(me,ge,be){for(var Ee=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,Me=me.ownerDocument,De=Me.createElement("li");me.firstChild;)De.appendChild(me.firstChild);var Fe=[De];function ue(ve){var Ne=ve.nodeType;if(Ne==1&&!Ee.test(ve.className))if(ve.nodeName==="br")pe(ve),ve.parentNode&&ve.parentNode.removeChild(ve);else for(var Ue=ve.firstChild;Ue;Ue=Ue.nextSibling)ue(Ue);else if((Ne==3||Ne==4)&&be){var he=ve.nodeValue,Le=he.match(Ie);if(Le){var se=he.substring(0,Le.index);ve.nodeValue=se;var te=he.substring(Le.index+Le[0].length);if(te){var ae=ve.parentNode;ae.insertBefore(Me.createTextNode(te),ve.nextSibling)}pe(ve),se||ve.parentNode.removeChild(ve)}}}function pe(ve){for(;!ve.nextSibling;)if(ve=ve.parentNode,!ve)return;function Ne(Le,se){var te=se?Le.cloneNode(!1):Le,ae=Le.parentNode;if(ae){var G=Ne(ae,1),Y=Le.nextSibling;G.appendChild(te);for(var Q=Y;Q;Q=Y)Y=Q.nextSibling,G.appendChild(Q)}return te}for(var Ue=Ne(ve.nextSibling,0),he;(he=Ue.parentNode)&&he.nodeType===1;)Ue=he;Fe.push(Ue)}for(var ye=0;ye<Fe.length;++ye)ue(Fe[ye]);ge===(ge|0)&&Fe[0].setAttribute("value",ge);var Te=Me.createElement("ol");Te.className="linenums";for(var we=Math.max(0,ge-1|0)||0,ye=0,xe=Fe.length;ye<xe;++ye)De=Fe[ye],De.className="L"+(ye+we)%10,De.firstChild||De.appendChild(Me.createTextNode("\xA0")),Te.appendChild(De);me.appendChild(Te)}function Z(me){var ge=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ge=ge&&+ge[1]<=8;var be=/\n/g,Ee=me.sourceCode,Ie=Ee.length,Me=0,De=me.spans,Fe=De.length,ue=0,pe=me.decorations,ye=pe.length,Te=0;pe[ye]=Ie;var we,xe;for(xe=we=0;xe<ye;)pe[xe]!==pe[xe+2]?(pe[we++]=pe[xe++],pe[we++]=pe[xe++]):xe+=2;for(ye=we,xe=we=0;xe<ye;){for(var ve=pe[xe],Ne=pe[xe+1],Ue=xe+2;Ue+2<=ye&&pe[Ue+1]===Ne;)Ue+=2;pe[we++]=ve,pe[we++]=Ne,xe=Ue}ye=pe.length=we;var he=me.sourceNode,Le="";he&&(Le=he.style.display,he.style.display="none");try{for(var se=null;ue<Fe;){var te=De[ue],ae=De[ue+2]||Ie,G=pe[Te+2]||Ie,Ue=Math.min(ae,G),Y=De[ue+1],Q;if(Y.nodeType!==1&&(Q=Ee.substring(Me,Ue))){ge&&(Q=Q.replace(be,"\r")),Y.nodeValue=Q;var q=Y.ownerDocument,ce=q.createElement("span");ce.className=pe[Te+1];var _e=Y.parentNode;_e.replaceChild(ce,Y),ce.appendChild(Y),Me<ae&&(De[ue+1]=Y=q.createTextNode(Ee.substring(Ue,ae)),_e.insertBefore(Y,ce.nextSibling))}Me=Ue,Me>=ae&&(ue+=2),Me>=G&&(Te+=2)}}finally{he&&(he.style.display=Le)}}var ne={};function X(me,ge){for(var be=ge.length;--be>=0;){var Ee=ge[be];ne.hasOwnProperty(Ee)?M.console&&console.warn("cannot override language handler %s",Ee):ne[Ee]=me}}function z(me,ge){return me&&ne.hasOwnProperty(me)||(me=/^\s*</.test(ge)?"default-markup":"default-code"),ne[me]}X(oe,["default-code"]),X(ee([],[[d,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[h,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),X(ee([[d,/^[\s]+/,null,` \r
|
|
`],[O,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[h,/^[=<>\/]+/],["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"]),X(ee([],[[O,/^[\s\S]+/]]),["uq.val"]),X(le({keywords:g,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),X(le({keywords:"null,true,false"}),["json"]),X(le({keywords:a,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),X(le({keywords:s,cStyleComments:!0}),["java"]),X(le({keywords:r,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),X(le({keywords:e,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),X(le({keywords:n,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),X(le({keywords:t,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),X(le({keywords:o,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),X(le({keywords:i,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),X(ee([],[[f,/^[\s\S]+/]]),["regex"]);function fe(me){var ge=me.langExtension;try{var be=P(me.sourceNode,me.pre),Ee=be.sourceCode;me.sourceCode=Ee,me.spans=be.spans,me.basePos=0,z(ge,Ee)(me),Z(me)}catch(Ie){M.console&&console.log(Ie&&Ie.stack||Ie)}}function Se(me,ge,be){var Ee=be||!1,Ie=ge||null,Me=document.createElement("div");Me.innerHTML="<pre>"+me+"</pre>",Me=Me.firstChild,Ee&&$(Me,Ee,!0);var De={langExtension:Ie,numberLines:Ee,sourceNode:Me,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return fe(De),Me.innerHTML}function Oe(me,ge){var be=ge||document.body,Ee=be.ownerDocument||document;function Ie(te){return be.getElementsByTagName(te)}for(var Me=[Ie("pre"),Ie("code"),Ie("xmp")],De=[],Fe=0;Fe<Me.length;++Fe)for(var ue=0,pe=Me[Fe].length;ue<pe;++ue)De.push(Me[Fe][ue]);Me=null;var ye=Date;ye.now||(ye={now:function(){return+new Date}});var Te=0,we=/\blang(?:uage)?-([\w.]+)(?!\S)/,xe=/\bprettyprint\b/,ve=/\bprettyprinted\b/,Ne=/pre|xmp/i,Ue=/^code$/i,he=/^(?:pre|code|xmp)$/i,Le={};function se(){for(var te=M.PR_SHOULD_USE_CONTINUATION?ye.now()+250:Infinity;Te<De.length&&ye.now()<te;Te++){for(var ae=De[Te],G=Le,Y=ae;Y=Y.previousSibling;){var Q=Y.nodeType,q=(Q===7||Q===8)&&Y.nodeValue;if(q?!/^\??prettify\b/.test(q):Q!==3||/\S/.test(Y.nodeValue))break;if(q){G={},q.replace(/\b(\w+)=([\w:.%+-]+)/g,function(dt,tt,_t){G[tt]=_t});break}}var ce=ae.className;if((G!==Le||xe.test(ce))&&!ve.test(ce)){for(var _e=!1,ke=ae.parentNode;ke;ke=ke.parentNode){var Ke=ke.tagName;if(he.test(Ke)&&ke.className&&xe.test(ke.className)){_e=!0;break}}if(!_e){ae.className+=" prettyprinted";var Xe=G.lang;if(!Xe){Xe=ce.match(we);var ze;!Xe&&(ze=re(ae))&&Ue.test(ze.tagName)&&(Xe=ze.className.match(we)),Xe&&(Xe=Xe[1])}var qe;if(Ne.test(ae.tagName))qe=1;else{var it=ae.currentStyle,Ye=Ee.defaultView,mt=it?it.whiteSpace:Ye&&Ye.getComputedStyle?Ye.getComputedStyle(ae,null).getPropertyValue("white-space"):0;qe=mt&&mt.substring(0,3)==="pre"}var at=G.linenums;(at=at==="true"||+at)||(at=ce.match(/\blinenums\b(?::(\d+))?/),at=at?at[1]&&at[1].length?+at[1]:!0:!1),at&&$(ae,at,qe);var yt={langExtension:Xe,sourceNode:ae,numberLines:at,pre:qe,sourceCode:null,basePos:null,spans:null,decorations:null};fe(yt)}}}Te<De.length?M.setTimeout(se,250):typeof me=="function"&&me()}se()}var Ae=M.PR={createSimpleLexer:ee,registerLangHandler:X,sourceDecorator:le,PR_ATTRIB_NAME:R,PR_ATTRIB_VALUE:O,PR_COMMENT:y,PR_DECLARATION:p,PR_KEYWORD:E,PR_LITERAL:l,PR_NOCODE:N,PR_PLAIN:d,PR_PUNCTUATION:h,PR_SOURCE:x,PR_STRING:f,PR_TAG:b,PR_TYPE:u,prettyPrintOne:C?M.prettyPrintOne=Se:A=Se,prettyPrint:B=C?M.prettyPrint=Oe:B=Oe},Pe=M.define;typeof Pe=="function"&&Pe.amd&&Pe("google-code-prettify",[],function(){return Ae})})()},TXwP:function(et,We,J){var de,H;(function(){var C;(function(){"use strict";var L=[,,function(w){function S(s){this.__parent=s,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}S.prototype.clone_empty=function(){var s=new S(this.__parent);return s.set_indent(this.__indent_count,this.__alignment_count),s},S.prototype.item=function(s){return s<0?this.__items[this.__items.length+s]:this.__items[s]},S.prototype.has_match=function(s){for(var a=this.__items.length-1;a>=0;a--)if(this.__items[a].match(s))return!0;return!1},S.prototype.set_indent=function(s,a){this.is_empty()&&(this.__indent_count=s||0,this.__alignment_count=a||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},S.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)},S.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},S.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var s=this.__parent.current_line;return s.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),s.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),s.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,s.__items[0]===" "&&(s.__items.splice(0,1),s.__character_count-=1),!0}return!1},S.prototype.is_empty=function(){return this.__items.length===0},S.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},S.prototype.push=function(s){this.__items.push(s);var a=s.lastIndexOf(`
|
|
`);a!==-1?this.__character_count=s.length-a:this.__character_count+=s.length},S.prototype.pop=function(){var s=null;return this.is_empty()||(s=this.__items.pop(),this.__character_count-=s.length),s},S.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},S.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},S.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},S.prototype.toString=function(){var s="";return this.is_empty()?this.__parent.indent_empty_lines&&(s=this.__parent.get_indent_string(this.__indent_count)):(s=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),s+=this.__items.join("")),s};function m(s,a){this.__cache=[""],this.__indent_size=s.indent_size,this.__indent_string=s.indent_char,s.indent_with_tabs||(this.__indent_string=new Array(s.indent_size+1).join(s.indent_char)),a=a||"",s.indent_level>0&&(a=new Array(s.indent_level+1).join(this.__indent_string)),this.__base_string=a,this.__base_string_length=a.length}m.prototype.get_indent_size=function(s,a){var i=this.__base_string_length;return a=a||0,s<0&&(i=0),i+=s*this.__indent_size,i+=a,i},m.prototype.get_indent_string=function(s,a){var i=this.__base_string;return a=a||0,s<0&&(s=0,i=""),a+=s*this.__indent_size,this.__ensure_cache(a),i+=this.__cache[a],i},m.prototype.__ensure_cache=function(s){for(;s>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var s=this.__cache.length,a=0,i="";this.__indent_size&&s>=this.__indent_size&&(a=Math.floor(s/this.__indent_size),s-=a*this.__indent_size,i=new Array(a+1).join(this.__indent_string)),s&&(i+=new Array(s+1).join(" ")),this.__cache.push(i)};function g(s,a){this.__indent_cache=new m(s,a),this.raw=!1,this._end_with_newline=s.end_with_newline,this.indent_size=s.indent_size,this.wrap_line_length=s.wrap_line_length,this.indent_empty_lines=s.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new S(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}g.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},g.prototype.get_line_number=function(){return this.__lines.length},g.prototype.get_indent_string=function(s,a){return this.__indent_cache.get_indent_string(s,a)},g.prototype.get_indent_size=function(s,a){return this.__indent_cache.get_indent_size(s,a)},g.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},g.prototype.add_new_line=function(s){return this.is_empty()||!s&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},g.prototype.get_code=function(s){this.trim(!0);var a=this.current_line.pop();a&&(a[a.length-1]===`
|
|
`&&(a=a.replace(/\n+$/g,"")),this.current_line.push(a)),this._end_with_newline&&this.__add_outputline();var i=this.__lines.join(`
|
|
`);return s!==`
|
|
`&&(i=i.replace(/[\n]/g,s)),i},g.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},g.prototype.set_indent=function(s,a){return s=s||0,a=a||0,this.next_line.set_indent(s,a),this.__lines.length>1?(this.current_line.set_indent(s,a),!0):(this.current_line.set_indent(),!1)},g.prototype.add_raw_token=function(s){for(var a=0;a<s.newlines;a++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(s.whitespace_before),this.current_line.push(s.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},g.prototype.add_token=function(s){this.__add_space_before_token(),this.current_line.push(s),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},g.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},g.prototype.remove_indent=function(s){for(var a=this.__lines.length;s<a;)this.__lines[s]._remove_indent(),s++;this.current_line._remove_wrap_indent()},g.prototype.trim=function(s){for(s=s===void 0?!1:s,this.current_line.trim();s&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},g.prototype.just_added_newline=function(){return this.current_line.is_empty()},g.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},g.prototype.ensure_empty_line_above=function(s,a){for(var i=this.__lines.length-2;i>=0;){var o=this.__lines[i];if(o.is_empty())break;if(o.item(0).indexOf(s)!==0&&o.item(-1)!==a){this.__lines.splice(i+1,0,new S(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},w.exports.Output=g},,,,function(w){function S(s,a){this.raw_options=m(s,a),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"])}S.prototype._get_array=function(s,a){var i=this.raw_options[s],o=a||[];return typeof i=="object"?i!==null&&typeof i.concat=="function"&&(o=i.concat()):typeof i=="string"&&(o=i.split(/[^a-zA-Z0-9_\/\-]+/)),o},S.prototype._get_boolean=function(s,a){var i=this.raw_options[s],o=i===void 0?!!a:!!i;return o},S.prototype._get_characters=function(s,a){var i=this.raw_options[s],o=a||"";return typeof i=="string"&&(o=i.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),o},S.prototype._get_number=function(s,a){var i=this.raw_options[s];a=parseInt(a,10),isNaN(a)&&(a=0);var o=parseInt(i,10);return isNaN(o)&&(o=a),o},S.prototype._get_selection=function(s,a,i){var o=this._get_selection_list(s,a,i);if(o.length!==1)throw new Error("Invalid Option Value: The option '"+s+`' can only be one of the following values:
|
|
`+a+`
|
|
You passed in: '`+this.raw_options[s]+"'");return o[0]},S.prototype._get_selection_list=function(s,a,i){if(!a||a.length===0)throw new Error("Selection list cannot be empty.");if(i=i||[a[0]],!this._is_valid_selection(i,a))throw new Error("Invalid Default Value!");var o=this._get_array(s,i);if(!this._is_valid_selection(o,a))throw new Error("Invalid Option Value: The option '"+s+`' can contain only the following values:
|
|
`+a+`
|
|
You passed in: '`+this.raw_options[s]+"'");return o},S.prototype._is_valid_selection=function(s,a){return s.length&&a.length&&!s.some(function(i){return a.indexOf(i)===-1})};function m(s,a){var i={};s=g(s);var o;for(o in s)o!==a&&(i[o]=s[o]);if(a&&s[a])for(o in s[a])i[o]=s[a][o];return i}function g(s){var a={},i;for(i in s){var o=i.replace(/-/g,"_");a[o]=s[i]}return a}w.exports.Options=S,w.exports.normalizeOpts=g,w.exports.mergeOpts=m},,function(w){var S=RegExp.prototype.hasOwnProperty("sticky");function m(g){this.__input=g||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__input.charAt(this.__position),this.__position+=1),g},m.prototype.peek=function(g){var s=null;return g=g||0,g+=this.__position,g>=0&&g<this.__input_length&&(s=this.__input.charAt(g)),s},m.prototype.__match=function(g,s){g.lastIndex=s;var a=g.exec(this.__input);return a&&!(S&&g.sticky)&&(a.index!==s&&(a=null)),a},m.prototype.test=function(g,s){return s=s||0,s+=this.__position,s>=0&&s<this.__input_length?!!this.__match(g,s):!1},m.prototype.testChar=function(g,s){var a=this.peek(s);return g.lastIndex=0,a!==null&&g.test(a)},m.prototype.match=function(g){var s=this.__match(g,this.__position);return s?this.__position+=s[0].length:s=null,s},m.prototype.read=function(g,s,a){var i="",o;return g&&(o=this.match(g),o&&(i+=o[0])),s&&(o||!g)&&(i+=this.readUntil(s,a)),i},m.prototype.readUntil=function(g,s){var a="",i=this.__position;g.lastIndex=this.__position;var o=g.exec(this.__input);return o?(i=o.index,s&&(i+=o[0].length)):i=this.__input_length,a=this.__input.substring(this.__position,i),this.__position=i,a},m.prototype.readUntilAfter=function(g){return this.readUntil(g,!0)},m.prototype.get_regexp=function(g,s){var a=null,i="g";return s&&S&&(i="y"),typeof g=="string"&&g!==""?a=new RegExp(g,i):g&&(a=new RegExp(g.source,i)),a},m.prototype.get_literal_regexp=function(g){return RegExp(g.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(g){var s=this.__position,a=this.readUntilAfter(g);return this.__position=s,a},m.prototype.lookBack=function(g){var s=this.__position-1;return s>=g.length&&this.__input.substring(s-g.length,s).toLowerCase()===g},w.exports.InputScanner=m},,,,,function(w){function S(m,g){m=typeof m=="string"?m:m.source,g=typeof g=="string"?g:g.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+g,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+g,"g")}S.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var g={};this.__directive_pattern.lastIndex=0;for(var s=this.__directive_pattern.exec(m);s;)g[s[1]]=s[2],s=this.__directive_pattern.exec(m);return g},S.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},w.exports.Directives=S},,function(w,S,m){var g=m(16).Beautifier,s=m(17).Options;function a(i,o){var n=new g(i,o);return n.beautify()}w.exports=a,w.exports.defaultOptions=function(){return new s}},function(w,S,m){var g=m(17).Options,s=m(2).Output,a=m(8).InputScanner,i=m(13).Directives,o=new i(/\/\*/,/\*\//),n=/\r\n|[\r\n]/,e=/\r\n|[\r\n]/g,t=/\s/,r=/(?:\s|\n)+/g,T=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,v=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function f(E,y){this._source_text=E||"",this._options=new g(y),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"]}f.prototype.eatString=function(E){var y="";for(this._ch=this._input.next();this._ch;){if(y+=this._ch,this._ch==="\\")y+=this._input.next();else if(E.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return y},f.prototype.eatWhitespace=function(E){for(var y=t.test(this._input.peek()),u=0;t.test(this._input.peek());)this._ch=this._input.next(),E&&this._ch===`
|
|
`&&((u===0||u<this._options.max_preserve_newlines)&&(u++,this._output.add_new_line(!0)));return y},f.prototype.foundNestedPseudoClass=function(){for(var E=0,y=1,u=this._input.peek(y);u;){if(u==="{")return!0;if(u==="(")E+=1;else if(u===")"){if(E===0)return!1;E-=1}else if(u===";"||u==="}")return!1;y++,u=this._input.peek(y)}return!1},f.prototype.print_string=function(E){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(E)},f.prototype.preserveSingleSpace=function(E){E&&(this._output.space_before_token=!0)},f.prototype.indent=function(){this._indentLevel++},f.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},f.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var E=this._source_text,y=this._options.eol;y==="auto"&&(y=`
|
|
`,E&&n.test(E||"")&&(y=E.match(n)[0])),E=E.replace(e,`
|
|
`);var u=E.match(/^[\t ]*/)[0];this._output=new s(this._options,u),this._input=new a(E),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var l=0,h=!1,d=!1,b=!1,p=!1,x=!1,R=!1,O=this._ch,N=!1,U,W,P;U=this._input.read(r),W=U!=="",P=O,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),O=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var K=this._input.read(T),V=o.get_directives(K);V&&V.ignore==="start"&&(K+=o.readIgnored(this._input)),this.print_string(K),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(v)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(W),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var re=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);re.match(/[ :]$/)&&(re=this.eatString(": ").replace(/\s$/,""),this.print_string(re),this._output.space_before_token=!0),re=re.replace(/\s$/,""),re==="extend"?p=!0:re==="import"&&(x=!0),re in this.NESTED_AT_RULE?(this._nestedLevel+=1,re in this.CONDITIONAL_GROUP_RULE&&(b=!0)):!h&&l===0&&re.indexOf(":")!==-1&&(d=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(W),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")d&&(d=!1,this.outdent()),b?(b=!1,h=this._indentLevel>=this._nestedLevel):h=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&h&&(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)):(P==="("?this._output.space_before_token=!1:P!==","&&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(),P==="{"&&this._output.trim(!0),x=!1,p=!1,d&&(this.outdent(),d=!1),this.print_string(this._ch),h=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var ee=0;ee<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;ee++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[ee])){N=!0;break}(h||b)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!p&&l===0?(this.print_string(":"),d||(d=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var le=P==='"'||P==="'";this.preserveSingleSpace(le||W),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")N=!1,l===0?(d&&(this.outdent(),d=!1),p=!1,x=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),l++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),l&&(l--,this.outdent()));else{var oe=!1;this._input.lookBack("with")&&(oe=!0),this.preserveSingleSpace(W||oe),this.print_string(this._ch),d&&P==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),R=!0):(this.eatWhitespace(),l++,this.indent())}else if(this._ch===")")l&&(l--,this.outdent()),R&&this._input.peek()===";"&&this._options.selector_separator_newline&&(R=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!d||R)&&l===0&&!x&&!p?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!d&&l===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&&t.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(W),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),t.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 $=P==='"'||P==="'";this.preserveSingleSpace($||W),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&N&&this._output.add_new_line()}var Z=this._output.get_code(y);return Z},w.exports.Beautifier=f},function(w,S,m){var g=m(6).Options;function s(a){g.call(this,a,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var i=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||i;var o=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var n=0;n<o.length;n++)o[n]!=="expand"?this.brace_style="collapse":this.brace_style=o[n]}s.prototype=new g,w.exports.Options=s}],A={};function B(w){var S=A[w];if(S!==void 0)return S.exports;var m=A[w]={exports:{}};return L[w](m,m.exports,B),m.exports}var M=B(15);C=M})();var j=C;!(de=[],H=function(){return{css_beautify:j}}.apply(We,de),H!==void 0&&(et.exports=H))})()},"U/Y8":function(et,We,J){et.exports={flex_box_center:"flex_box_center___2aRVA",flex_space_between:"flex_space_between___12c3F",flex_box_vertical_center:"flex_box_vertical_center___30OYS",flex_box_center_end:"flex_box_center_end___12QBt",flex_box_column:"flex_box_column___t6urT",info:"info___2BaCz",bar:"bar___3Aega"}},WaYH:function(et,We,J){"use strict";var de=J("rePB"),H=J("Ff2n"),C=J("VTBJ"),j=J("1OyB"),L=J("vuIU"),A=J("JX7q"),B=J("Ji7U"),M=J("LK+K"),w=J("q1tI"),S=J("TSYQ"),m=J.n(S),g=J("sboe"),s=J("OZM5"),a=function(E){var y=E.prefixCls,u=E.level,l=E.isStart,h=E.isEnd;if(!u)return null;for(var d="".concat(y,"-indent-unit"),b=[],p=0;p<u;p+=1){var x;b.push(w.createElement("span",{key:p,className:m()(d,(x={},Object(de.a)(x,"".concat(d,"-start"),l[p+1]),Object(de.a)(x,"".concat(d,"-end"),h[p+1]),Object(de.a)(x,"".concat(d,"-end-first-level"),!p&&h[0]),x))}))}return w.createElement("span",{"aria-hidden":"true",className:"".concat(y,"-indent")},b)},i=a,o=J("815F"),n="open",e="close",t="---",r=function(f){Object(B.a)(y,f);var E=Object(M.a)(y);function y(){var u;return Object(j.a)(this,y),u=E.apply(this,arguments),u.state={dragNodeHighlight:!1},u.onSelectorClick=function(l){var h=u.props.context.onNodeClick;h(l,Object(o.b)(u.props)),u.isSelectable()?u.onSelect(l):u.onCheck(l)},u.onSelectorDoubleClick=function(l){var h=u.props.context.onNodeDoubleClick;h(l,Object(o.b)(u.props))},u.onSelect=function(l){if(u.isDisabled())return;var h=u.props.context.onNodeSelect;l.preventDefault(),h(l,Object(o.b)(u.props))},u.onCheck=function(l){if(u.isDisabled())return;var h=u.props,d=h.disableCheckbox,b=h.checked,p=u.props.context.onNodeCheck;if(!u.isCheckable()||d)return;l.preventDefault();var x=!b;p(l,Object(o.b)(u.props),x)},u.onMouseEnter=function(l){var h=u.props.context.onNodeMouseEnter;h(l,Object(o.b)(u.props))},u.onMouseLeave=function(l){var h=u.props.context.onNodeMouseLeave;h(l,Object(o.b)(u.props))},u.onContextMenu=function(l){var h=u.props.context.onNodeContextMenu;h(l,Object(o.b)(u.props))},u.onDragStart=function(l){var h=u.props.context.onNodeDragStart;l.stopPropagation(),u.setState({dragNodeHighlight:!0}),h(l,Object(A.a)(u));try{l.dataTransfer.setData("text/plain","")}catch(d){}},u.onDragEnter=function(l){var h=u.props.context.onNodeDragEnter;l.preventDefault(),l.stopPropagation(),h(l,Object(A.a)(u))},u.onDragOver=function(l){var h=u.props.context.onNodeDragOver;l.preventDefault(),l.stopPropagation(),h(l,Object(A.a)(u))},u.onDragLeave=function(l){var h=u.props.context.onNodeDragLeave;l.stopPropagation(),h(l,Object(A.a)(u))},u.onDragEnd=function(l){var h=u.props.context.onNodeDragEnd;l.stopPropagation(),u.setState({dragNodeHighlight:!1}),h(l,Object(A.a)(u))},u.onDrop=function(l){var h=u.props.context.onNodeDrop;l.preventDefault(),l.stopPropagation(),u.setState({dragNodeHighlight:!1}),h(l,Object(A.a)(u))},u.onExpand=function(l){var h=u.props.context.onNodeExpand;h(l,Object(o.b)(u.props))},u.setSelectHandle=function(l){u.selectHandle=l},u.getNodeState=function(){var l=u.props.expanded;return u.isLeaf()?null:l?n:e},u.hasChildren=function(){var l=u.props.eventKey,h=u.props.context.keyEntities,d=h[l]||{},b=d.children;return!!(b||[]).length},u.isLeaf=function(){var l=u.props,h=l.isLeaf,d=l.loaded,b=u.props.context.loadData,p=u.hasChildren();return h===!1?!1:h||!b&&!p||b&&d&&!p},u.isDisabled=function(){var l=u.props.disabled,h=u.props.context.disabled;return!!(h||l)},u.isCheckable=function(){var l=u.props.checkable,h=u.props.context.checkable;return!h||l===!1?!1:h},u.syncLoadData=function(l){var h=l.expanded,d=l.loading,b=l.loaded,p=u.props.context,x=p.loadData,R=p.onNodeLoad;if(d)return;x&&h&&!u.isLeaf()&&(!u.hasChildren()&&!b&&R(Object(o.b)(u.props)))},u.renderSwitcher=function(){var l=u.props,h=l.expanded,d=l.switcherIcon,b=u.props.context,p=b.prefixCls,x=b.switcherIcon,R=d||x;if(u.isLeaf())return w.createElement("span",{className:m()("".concat(p,"-switcher"),"".concat(p,"-switcher-noop"))},typeof R=="function"?R(Object(C.a)(Object(C.a)({},u.props),{},{isLeaf:!0})):R);var O=m()("".concat(p,"-switcher"),"".concat(p,"-switcher_").concat(h?n:e));return w.createElement("span",{onClick:u.onExpand,className:O},typeof R=="function"?R(Object(C.a)(Object(C.a)({},u.props),{},{isLeaf:!1})):R)},u.renderCheckbox=function(){var l=u.props,h=l.checked,d=l.halfChecked,b=l.disableCheckbox,p=u.props.context.prefixCls,x=u.isDisabled(),R=u.isCheckable();if(!R)return null;var O=typeof R!="boolean"?R:null;return w.createElement("span",{className:m()("".concat(p,"-checkbox"),h&&"".concat(p,"-checkbox-checked"),!h&&d&&"".concat(p,"-checkbox-indeterminate"),(x||b)&&"".concat(p,"-checkbox-disabled")),onClick:u.onCheck},O)},u.renderIcon=function(){var l=u.props.loading,h=u.props.context.prefixCls;return w.createElement("span",{className:m()("".concat(h,"-iconEle"),"".concat(h,"-icon__").concat(u.getNodeState()||"docu"),l&&"".concat(h,"-icon_loading"))})},u.renderSelector=function(){var l=u.state.dragNodeHighlight,h=u.props,d=h.title,b=h.selected,p=h.icon,x=h.loading,R=h.data,O=u.props.context,N=O.prefixCls,U=O.showIcon,W=O.icon,P=O.draggable,K=O.loadData,V=O.titleRender,re=u.isDisabled(),ee="".concat(N,"-node-content-wrapper"),le;if(U){var oe=p||W;le=oe?w.createElement("span",{className:m()("".concat(N,"-iconEle"),"".concat(N,"-icon__customize"))},typeof oe=="function"?oe(u.props):oe):u.renderIcon()}else K&&x&&(le=u.renderIcon());var $;typeof d=="function"?$=d(R):V?$=V(R):$=d;var Z=w.createElement("span",{className:"".concat(N,"-title")},$);return w.createElement("span",{ref:u.setSelectHandle,title:typeof d=="string"?d:"",className:m()("".concat(ee),"".concat(ee,"-").concat(u.getNodeState()||"normal"),!re&&(b||l)&&"".concat(N,"-node-selected"),!re&&P&&"draggable"),draggable:!re&&P||void 0,"aria-grabbed":!re&&P||void 0,onMouseEnter:u.onMouseEnter,onMouseLeave:u.onMouseLeave,onContextMenu:u.onContextMenu,onClick:u.onSelectorClick,onDoubleClick:u.onSelectorDoubleClick,onDragStart:P?u.onDragStart:void 0},le,Z)},u}return Object(L.a)(y,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var l=this.props.selectable,h=this.props.context.selectable;return typeof l=="boolean"?l:h}},{key:"render",value:function(){var l,h=this.props,d=h.eventKey,b=h.className,p=h.style,x=h.dragOver,R=h.dragOverGapTop,O=h.dragOverGapBottom,N=h.isLeaf,U=h.isStart,W=h.isEnd,P=h.expanded,K=h.selected,V=h.checked,re=h.halfChecked,ee=h.loading,le=h.domRef,oe=h.active,$=h.onMouseMove,Z=Object(H.a)(h,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),ne=this.props.context,X=ne.prefixCls,z=ne.filterTreeNode,fe=ne.draggable,Se=ne.keyEntities,Oe=this.isDisabled(),Ae=Object(s.f)(Z),Pe=Se[d]||{},me=Pe.level,ge=W[W.length-1];return w.createElement("div",Object.assign({ref:le,className:m()(b,"".concat(X,"-treenode"),(l={},Object(de.a)(l,"".concat(X,"-treenode-disabled"),Oe),Object(de.a)(l,"".concat(X,"-treenode-switcher-").concat(P?"open":"close"),!N),Object(de.a)(l,"".concat(X,"-treenode-checkbox-checked"),V),Object(de.a)(l,"".concat(X,"-treenode-checkbox-indeterminate"),re),Object(de.a)(l,"".concat(X,"-treenode-selected"),K),Object(de.a)(l,"".concat(X,"-treenode-loading"),ee),Object(de.a)(l,"".concat(X,"-treenode-active"),oe),Object(de.a)(l,"".concat(X,"-treenode-leaf-last"),ge),Object(de.a)(l,"drag-over",!Oe&&x),Object(de.a)(l,"drag-over-gap-top",!Oe&&R),Object(de.a)(l,"drag-over-gap-bottom",!Oe&&O),Object(de.a)(l,"filter-node",z&&z(Object(o.b)(this.props))),l)),style:p,onDragEnter:fe?this.onDragEnter:void 0,onDragOver:fe?this.onDragOver:void 0,onDragLeave:fe?this.onDragLeave:void 0,onDrop:fe?this.onDrop:void 0,onDragEnd:fe?this.onDragEnd:void 0,onMouseMove:$},Ae),w.createElement(i,{prefixCls:X,level:me,isStart:U,isEnd:W}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),y}(w.Component),T=function(E){return w.createElement(g.a.Consumer,null,function(y){return w.createElement(r,Object.assign({},E,{context:y}))})};T.displayName="TreeNode",T.defaultProps={title:t},T.isTreeNode=1;var v=We.a=T},Y1PL:function(et,We,J){"use strict";J.r(We),J.d(We,"ResizableTextArea",function(){return re});var de=J("wx14"),H=J("1OyB"),C=J("vuIU"),j=J("Ji7U"),L=J("LK+K"),A=J("q1tI"),B=J("VTBJ"),M=J("rePB"),w=J("Zm9Q"),S=J("Kwbf"),m=J("c+Xe"),g=J("m+aA"),s=J("bdgK"),a=new Map;function i(oe){oe.forEach(function($){var Z,ne=$.target;(Z=a.get(ne))===null||Z===void 0||Z.forEach(function(X){return X(ne)})})}var o=new s.default(i),n=null,e=null;function t(oe,$){a.has(oe)||(a.set(oe,new Set),o.observe(oe)),a.get(oe).add($)}function r(oe,$){a.has(oe)&&(a.get(oe).delete($),a.get(oe).size||(o.unobserve(oe),a.delete(oe)))}var T=function(oe){Object(j.a)(Z,oe);var $=Object(L.a)(Z);function Z(){return Object(H.a)(this,Z),$.apply(this,arguments)}return Object(C.a)(Z,[{key:"render",value:function(){return this.props.children}}]),Z}(A.Component),v=A.createContext(null);function f(oe){var $=oe.children,Z=oe.onBatchResize,ne=A.useRef(0),X=A.useRef([]),z=A.useContext(v),fe=A.useCallback(function(Se,Oe,Ae){ne.current+=1;var Pe=ne.current;X.current.push({size:Se,element:Oe,data:Ae}),Promise.resolve().then(function(){Pe===ne.current&&(Z==null||Z(X.current),X.current=[])}),z==null||z(Se,Oe,Ae)},[Z,z]);return A.createElement(v.Provider,{value:fe},$)}function E(oe){var $=oe.children,Z=oe.disabled,ne=A.useRef(null),X=A.useRef(null),z=A.useContext(v),fe=A.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Se=A.isValidElement($)&&Object(m.c)($),Oe=Se?$.ref:null,Ae=A.useMemo(function(){return Object(m.a)(Oe,ne)},[Oe,ne]),Pe=A.useRef(oe);Pe.current=oe;var me=A.useCallback(function(ge){var be=Pe.current,Ee=be.onResize,Ie=be.data,Me=ge.getBoundingClientRect(),De=Me.width,Fe=Me.height,ue=ge.offsetWidth,pe=ge.offsetHeight,ye=Math.floor(De),Te=Math.floor(Fe);if(fe.current.width!==ye||fe.current.height!==Te||fe.current.offsetWidth!==ue||fe.current.offsetHeight!==pe){var we={width:ye,height:Te,offsetWidth:ue,offsetHeight:pe};fe.current=we;var xe=ue===Math.round(De)?De:ue,ve=pe===Math.round(Fe)?Fe:pe,Ne=Object(B.a)(Object(B.a)({},we),{},{offsetWidth:xe,offsetHeight:ve});z==null||z(Ne,ge,Ie),Ee&&Promise.resolve().then(function(){Ee(Ne,ge)})}},[]);return A.useEffect(function(){var ge=Object(g.a)(ne.current)||Object(g.a)(X.current);return ge&&!Z&&t(ge,me),function(){return r(ge,me)}},[ne.current,Z]),A.createElement(T,{ref:X},Se?A.cloneElement($,{ref:Ae}):$)}var y="rc-observer-key";function u(oe){var $=oe.children,Z=Object(w.a)($);return Z.map(function(ne,X){var z=(ne==null?void 0:ne.key)||"".concat(y,"-").concat(X);return A.createElement(E,Object(de.a)({},oe,{key:z}),ne)})}u.Collection=f;var l=u,h=J("bT9E"),d=J("TSYQ"),b=J.n(d),p=`
|
|
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
|
|
`,x=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],R={},O;function N(oe){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Z=oe.getAttribute("id")||oe.getAttribute("data-reactid")||oe.getAttribute("name");if($&&R[Z])return R[Z];var ne=window.getComputedStyle(oe),X=ne.getPropertyValue("box-sizing")||ne.getPropertyValue("-moz-box-sizing")||ne.getPropertyValue("-webkit-box-sizing"),z=parseFloat(ne.getPropertyValue("padding-bottom"))+parseFloat(ne.getPropertyValue("padding-top")),fe=parseFloat(ne.getPropertyValue("border-bottom-width"))+parseFloat(ne.getPropertyValue("border-top-width")),Se=x.map(function(Ae){return"".concat(Ae,":").concat(ne.getPropertyValue(Ae))}).join(";"),Oe={sizingStyle:Se,paddingSize:z,borderSize:fe,boxSizing:X};return $&&Z&&(R[Z]=Oe),Oe}function U(oe){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ne=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;O||(O=document.createElement("textarea"),O.setAttribute("tab-index","-1"),O.setAttribute("aria-hidden","true"),document.body.appendChild(O)),oe.getAttribute("wrap")?O.setAttribute("wrap",oe.getAttribute("wrap")):O.removeAttribute("wrap");var X=N(oe,$),z=X.paddingSize,fe=X.borderSize,Se=X.boxSizing,Oe=X.sizingStyle;O.setAttribute("style","".concat(Oe,";").concat(p)),O.value=oe.value||oe.placeholder||"";var Ae=Number.MIN_SAFE_INTEGER,Pe=Number.MAX_SAFE_INTEGER,me=O.scrollHeight,ge;if(Se==="border-box"?me+=fe:Se==="content-box"&&(me-=z),Z!==null||ne!==null){O.value=" ";var be=O.scrollHeight-z;Z!==null&&(Ae=be*Z,Se==="border-box"&&(Ae=Ae+z+fe),me=Math.max(Ae,me)),ne!==null&&(Pe=be*ne,Se==="border-box"&&(Pe=Pe+z+fe),ge=me>Pe?"":"hidden",me=Math.min(Pe,me))}return{height:me,minHeight:Ae,maxHeight:Pe,overflowY:ge,resize:"none"}}var W=J("Gytx"),P=J.n(W),K;(function(oe){oe[oe.NONE=0]="NONE",oe[oe.RESIZING=1]="RESIZING",oe[oe.RESIZED=2]="RESIZED"})(K||(K={}));var V=function(oe){Object(j.a)(Z,oe);var $=Object(L.a)(Z);function Z(ne){var X;return Object(H.a)(this,Z),X=$.call(this,ne),X.nextFrameActionId=void 0,X.resizeFrameId=void 0,X.textArea=void 0,X.saveTextArea=function(z){X.textArea=z},X.handleResize=function(z){var fe=X.state.resizeStatus,Se=X.props,Oe=Se.autoSize,Ae=Se.onResize;if(fe!==K.NONE)return;typeof Ae=="function"&&Ae(z),Oe&&X.resizeOnNextFrame()},X.resizeOnNextFrame=function(){cancelAnimationFrame(X.nextFrameActionId),X.nextFrameActionId=requestAnimationFrame(X.resizeTextarea)},X.resizeTextarea=function(){var z=X.props.autoSize;if(!z||!X.textArea)return;var fe=z.minRows,Se=z.maxRows,Oe=U(X.textArea,!1,fe,Se);X.setState({textareaStyles:Oe,resizeStatus:K.RESIZING},function(){cancelAnimationFrame(X.resizeFrameId),X.resizeFrameId=requestAnimationFrame(function(){X.setState({resizeStatus:K.RESIZED},function(){X.resizeFrameId=requestAnimationFrame(function(){X.setState({resizeStatus:K.NONE}),X.fixFirefoxAutoScroll()})})})})},X.renderTextArea=function(){var z=X.props,fe=z.prefixCls,Se=fe===void 0?"rc-textarea":fe,Oe=z.autoSize,Ae=z.onResize,Pe=z.className,me=z.disabled,ge=X.state,be=ge.textareaStyles,Ee=ge.resizeStatus,Ie=Object(h.a)(X.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Me=b()(Se,Pe,Object(M.a)({},"".concat(Se,"-disabled"),me));"value"in Ie&&(Ie.value=Ie.value||"");var De=Object(B.a)(Object(B.a)(Object(B.a)({},X.props.style),be),Ee===K.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return A.createElement(l,{onResize:X.handleResize,disabled:!(Oe||Ae)},A.createElement("textarea",Object(de.a)({},Ie,{className:Me,style:De,ref:X.saveTextArea})))},X.state={textareaStyles:{},resizeStatus:K.NONE},X}return Object(C.a)(Z,[{key:"componentDidUpdate",value:function(X){(X.value!==this.props.value||!P()(X.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 X=this.textArea.selectionStart,z=this.textArea.selectionEnd;this.textArea.setSelectionRange(X,z)}}catch(fe){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Z}(A.Component),re=V,ee=function(oe){Object(j.a)(Z,oe);var $=Object(L.a)(Z);function Z(ne){var X;Object(H.a)(this,Z),X=$.call(this,ne),X.resizableTextArea=void 0,X.focus=function(){X.resizableTextArea.textArea.focus()},X.saveTextArea=function(fe){X.resizableTextArea=fe},X.handleChange=function(fe){var Se=X.props.onChange;X.setValue(fe.target.value,function(){X.resizableTextArea.resizeTextarea()}),Se&&Se(fe)},X.handleKeyDown=function(fe){var Se=X.props,Oe=Se.onPressEnter,Ae=Se.onKeyDown;fe.keyCode===13&&Oe&&Oe(fe),Ae&&Ae(fe)};var z=typeof ne.value=="undefined"||ne.value===null?ne.defaultValue:ne.value;return X.state={value:z},X}return Object(C.a)(Z,[{key:"setValue",value:function(X,z){"value"in this.props||this.setState({value:X},z)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return A.createElement(re,Object(de.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(X){return"value"in X?{value:X.value}:null}}]),Z}(A.Component),le=We.default=ee},ZW9T:function(et,We,J){"use strict";J.d(We,"a",function(){return U});var de=J("k1fw"),H=J("miYZ"),C=J("tsqr"),j=J("rAM+"),L=J("tJVT"),A=J("PpiC"),B=J("q1tI"),M=J.n(B),w=J("bdgK"),S=J("oBTY"),m=J("9og8"),g=J("WmNS"),s=J.n(g),a={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"]},i={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"]},o={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"#include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},n={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(`
|
|
`)}]},e=J("5VLF"),t=J.n(e),r={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"]}},T=function(P,K){return K.map(function(V){return{label:V,kind:P.languages.CompletionItemKind.Keyword,insertText:V}})},v=function(P){return Object.keys(r.tables).map(function(K){return{label:K,kind:P.languages.CompletionItemKind.Variable,insertText:K}})},f=function(P,K){var V=r.tables[P];return V?V.map(function(re){return{label:re,kind:K.languages.CompletionItemKind.Field,insertText:re}}):[]};function E(W,P,K,V,re){var ee=P.getWordUntilPosition(K),le={startLineNumber:K.lineNumber,endLineNumber:K.lineNumber,startColumn:ee.startColumn,endColumn:ee.endColumn},oe=V.map(function($){return{label:$,kind:W.languages.CompletionItemKind.Keyword,insertText:$,insertTextRules:W.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:le}});return re.map(function($){oe.push(Object(de.a)(Object(de.a)({},$),{},{range:le}))}),oe}var y=function(W){r.languages.map(function(re){return W.languages.registerDocumentFormattingEditProvider(re,{provideDocumentFormattingEdits:function(le,oe,$){return Object(m.a)(s.a.mark(function Z(){var ne;return s.a.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return ne=t()(le.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}),z.abrupt("return",[{range:le.getFullModelRange(),text:ne}]);case 2:case"end":return z.stop()}},Z)}))()}}),re});var P=o.quickKey.map(function(re){return{label:re.label,kind:W.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:W.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),K=n.quickKey.map(function(re){return{label:re.label,kind:W.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:W.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),V=i.quickKey.map(function(re){return{label:re.label,kind:W.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:W.languages.CompletionItemInsertTextRule.InsertAsSnippet}});W.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(S.a)(o.keywords),Object(S.a)(o.quickKey.map(function(re){return re.label}))),provideCompletionItems:function(ee,le){var oe=ee.getValueInRange({startLineNumber:le.lineNumber,startColumn:1,endLineNumber:le.lineNumber,endColumn:le.column}),$=oe.match(/cu/gim);console.log("match:",$,le,oe,ee);var Z=[],ne=le.lineNumber,X=le.column,z=ee.getValueInRange({startLineNumber:ne,startColumn:0,endLineNumber:ne,endColumn:X}),fe=z.trim().split(/\s+/),Se=fe[fe.length-1];if(Se.endsWith(".")){var Oe=Se.slice(0,Se.length-1);Object.keys(r.tables).includes(Oe)&&(Z=Object(S.a)(f(Oe,W)))}else Se==="."?Z=[]:Z=[].concat(Object(S.a)(v(W)),Object(S.a)(T(W,o.keywords)),Object(S.a)(P));return{suggestions:Z}}}),W.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(S.a)(a.keywords)),provideCompletionItems:function(ee,le){var oe=ee.getValueInRange({startLineNumber:le.lineNumber,startColumn:1,endLineNumber:le.lineNumber,endColumn:le.column}),$=oe.match(/cu/gim);console.log("match:",$,le,oe,ee);var Z=[],ne=le.lineNumber,X=le.column,z=ee.getValueInRange({startLineNumber:ne,startColumn:0,endLineNumber:ne,endColumn:X}),fe=z.trim().split(/\s+/),Se=fe[fe.length-1];if(Se.endsWith(".")){var Oe=Se.slice(0,Se.length-1);Object.keys(r.tables).includes(Oe)&&(Z=Object(S.a)(f(Oe,W)))}else Se==="."?Z=[]:Z=[].concat(Object(S.a)(v(W)),Object(S.a)(T(W,a.keywords)));return{suggestions:Z}}}),W.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(S.a)(i.keywords)),provideCompletionItems:function(ee,le){var oe=[],$=le.lineNumber,Z=le.column,ne=ee.getValueInRange({startLineNumber:$,startColumn:0,endLineNumber:$,endColumn:Z}),X=ne.trim().split(/\s+/),z=X[X.length-1];if(z.endsWith(".")){var fe=z.slice(0,z.length-1);Object.keys(r.tables).includes(fe)&&(oe=Object(S.a)(f(fe,W)))}else z==="."?oe=[]:oe=[].concat(Object(S.a)(v(W)),Object(S.a)(T(W,i.keywords)),Object(S.a)(V));return{suggestions:oe}}}),W.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(S.a)(n.keywords)),provideCompletionItems:function(ee,le){var oe=[],$=le.lineNumber,Z=le.column,ne=ee.getValueInRange({startLineNumber:$,startColumn:0,endLineNumber:$,endColumn:Z}),X=ne.trim().split(/\s+/),z=X[X.length-1];if(z.endsWith(".")){var fe=z.slice(0,z.length-1);Object.keys(r.tables).includes(fe)&&(oe=Object(S.a)(f(fe,W)))}else z==="."?oe=[]:oe=[].concat(Object(S.a)(v(W)),Object(S.a)(T(W,n.keywords)),Object(S.a)(K));return{suggestions:oe}}})},u="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",l=J("LvDl"),h=J("+ua5");function d(W){return/^\d+$/.test(W)?"".concat(W,"px"):W}function b(){}var p=!1,x={"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 R(){var W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],P=W;if(Array.isArray(W)){for(var K=0;K<W.length;K++){var V=x[W[K]];if(V)return V}return P[0]}return x[P]||P}var O=null,N=We.b=function(W){var P=W.width,K=P===void 0?"100%":P,V=W.height,re=V===void 0?"100%":V,ee=W.value,le=W.language,oe=le===void 0?"javascript":le,$=W.style,Z=$===void 0?{}:$,ne=W.options,X=ne===void 0?{}:ne,z=W.overrideServices,fe=z===void 0?{}:z,Se=W.theme,Oe=Se===void 0?"vs-dark":Se,Ae=W.onEditBlur,Pe=W.onSave,me=W.autoHeight,ge=me===void 0?!1:me,be=W.forbidCopy,Ee=be===void 0?!1:be,Ie=W.onChange,Me=Ie===void 0?b:Ie,De=W.editorDidMount,Fe=De===void 0?b:De,ue=W.onFocus,pe=ue===void 0?b:ue,ye=W.filename,Te=ye===void 0?"educoder.txt":ye,we=W.errorLine,xe=W.errorContent,ve=xe===void 0?"":xe,Ne=Object(A.a)(W,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Ue=Object(B.useRef)(),he=Object(B.useRef)({}),Le=Object(B.useRef)(),se=Object(B.useRef)(!1),te=Object(B.useRef)(),ae=Object(B.useState)(!1),G=Object(L.a)(ae,2),Y=G[0],Q=G[1];function q(){var Be;return Ue.current&&(Be=new w.default(function($e){var Qe=Object(j.a)($e),Je;try{for(Qe.s();!(Je=Qe.n()).done;){var ft=Je.value;(ft.target.offsetHeight>0||ft.target.offsetWidth>0)&&he.current.instance.layout()}}catch(Tt){Qe.e(Tt)}finally{Qe.f()}}),Be.observe(Ue.current)),Be}function ce(){C.b.warn(decodeURIComponent(u))}var _e=function(){var $e=he.current.instance;if(ee!=null&&$e&&Y){var Qe=$e.getModel();Qe&&ee!==Qe.getValue()&&(p=!0,Qe.setValue(ee),$e.layout(),p=!1)}};Object(B.useEffect)(function(){Le.current&&clearTimeout(Le.current),Le.current=setTimeout(function(){_e()},500)},[ee,Y,he.current]),Object(B.useEffect)(function(){if(we&&he.current&&he.current.instance){var Be=he.current.instance;Be.changeViewZones(function(Qe){var Je=document.createElement("div");Je.style.padding="10px 20px",Je.style.width="calc(100% - 20px)",Je.className="my-error-line-wrp",Je.innerHTML=ve,Qe.addZone({afterLineNumber:we||11,heightInLines:3,domNode:Je})});var $e={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}};Be.addOverlayWidget($e),Be.revealPositionInCenter({lineNumber:20,column:1})}},[we,he.current,Y]);function ke(){var Be=he.current.instance;if(Be){var $e=Be.getSelection(),Qe=he.current.pastePos||{},Je=new O.Range(Qe.startLineNumber||$e.endLineNumber,Qe.startColumn||$e.endColumn,Qe.endLineNumber||$e.endLineNumber,Qe.endColumn||$e.endColumn);setTimeout(function(){Be.executeEdits("",[{range:Je,text:""}])},300)}}function Ke(Be){(window.navigator.platform.match("Mac")?Be.metaKey:Be.ctrlKey)&&Be.keyCode==83&&(Be.preventDefault(),Pe())}var Xe=function(){if(ge&&he.current.instance){var $e=he.current.instance.getContentHeight();_t($e<re?re:$e)}else _t(re)};function ze(Be){var $e=document.createEvent("MouseEvents");$e.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Be.dispatchEvent($e)}function qe(Be,$e){var Qe=window.URL||window.webkitURL||window,Je=new Blob([$e]),ft=document.createElementNS("http://www.w3.org/1999/xhtml","a");ft.href=Qe.createObjectURL(Je),ft.download=Be,ze(ft)}Object(B.useEffect)(function(){Xe()},[Xe]),Object(B.useEffect)(function(){Ue.current&&!Y&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(Be){try{O=Be,he.current.instance=O.editor.create(Ue.current,{value:ee,language:R(oe),theme:Oe,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},fe);var $e=he.current.instance;if(Fe($e,O),setTimeout(function(){Xe(),he.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){qe(Te||"educoder.txt",$e.getValue())}})},500),he.current.subscription=$e.onDidChangeModelContent(function(Je){se.current?clearTimeout(te.current):(Xe(),Me($e.getValue(),Je)),te.current=setTimeout(function(){se.current=!1},500)}),window.Monaco||y(O),Ee&&($e.addCommand(O.KeyMod.CtrlCmd|O.KeyMod.Shift|O.KeyCode.KEY_V,function(){return ce(),null}),$e.addCommand(O.KeyMod.CtrlCmd|O.KeyCode.KEY_C,function(){return ce(),null})),window.Monaco=O,Ae&&$e.onDidBlurEditorWidget(function(){Ae($e.getValue())}),pe&&$e.onDidFocusEditorText(function(){pe($e.getValue())}),Ee){$e.addCommand(O.KeyMod.CtrlCmd|O.KeyCode.KEY_V,function(){return ce(),null}),$e.onDidPaste(function(Je){he.current.pastePos=Je});try{window.addEventListener("paste",ke)}catch(Je){}}var Qe=q();return Q(!0),function(){var Je=he.current.instance;Je.dispose();var ft=Je.getModel();ft&&ft.dispose(),he.current.subscription&&he.current.subscription.dispose(),Ee&&window.removeEventListener("paste",ke),Qe.unobserve(Ue.current)}}catch(Je){}})},[]),Object(B.useEffect)(function(){var Be=he.current.instance;if(Be&&Y)return document.addEventListener("keydown",Ke,!1),function(){document.removeEventListener("keydown",Ke)}},[Pe,Y]),Object(B.useEffect)(function(){var Be=he.current.instance;if(Be&&Y){var $e=R(oe);O.editor.setModelLanguage(Be.getModel(),$e),console.log("language:",oe,Be.getModel(),$e)}},[oe,Y]),Object(B.useEffect)(function(){var Be=he.current.instance;Be&&Y&&O.editor.setTheme(Oe)},[Oe,Y]),Object(B.useEffect)(function(){var Be=he.current.instance;Be&&Y&&(Be.updateOptions(Object(de.a)({},X)),setTimeout(function(){Be.getModel().updateOptions(Object(de.a)({},X))},200))},[JSON.stringify(X),Y]),Object(B.useEffect)(function(){var Be=he.current.instance;Be&&Y&&Be.layout()},[K,re,Y]);var it=Object(B.useState)(d(K)),Ye=Object(L.a)(it,2),mt=Ye[0],at=Ye[1],yt=Object(B.useState)(d(re)),dt=Object(L.a)(yt,2),tt=dt[0],_t=dt[1],Et=Object(de.a)(Object(de.a)({},Z),{},{width:mt,height:tt});return M.a.createElement("div",{className:"my-monaco-editor",ref:Ue,style:Et})};function U(W){var P=W.width,K=P===void 0?"100%":P,V=W.height,re=V===void 0?"100%":V,ee=W.original,le=W.modified,oe=W.language,$=W.options,Z=$===void 0?{}:$,ne=Object(B.useRef)(),X=Object(B.useState)(null),z=Object(L.a)(X,2),fe=z[0],Se=z[1];function Oe(ge){var be;return ne.current&&(be=new w.default(function(Ee){var Ie=Object(j.a)(Ee),Me;try{for(Ie.s();!(Me=Ie.n()).done;){var De=Me.value;(De.target.offsetHeight>0||De.target.offsetWidth>0)&&ge.layout()}}catch(Fe){Ie.e(Fe)}finally{Ie.f()}}),be.observe(ne.current)),be}Object(B.useEffect)(function(){ne.current&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(ge){O=ge;var be=O.editor.createDiffEditor(ne.current,Object(de.a)(Object(de.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},Z),{},{wordWrap:!0}));Se(be);var Ee=Oe(be);return function(){be.dispose();var Ie=be.getModel();Ie&&Ie.dispose(),Ee.unobserve(ne.current)}})},[]),Object(B.useEffect)(function(){fe&&fe.setModel({original:O.editor.createModel(ee,oe),modified:O.editor.createModel(le,oe)})},[ee,le,oe,fe]);var Ae=d(K),Pe=d(re),me={width:Ae,height:Pe};return M.a.createElement("div",{className:"my-diff-editor",ref:ne,style:me})}},ZpRC:function(et,We,J){"use strict";function de(m){return typeof m=="object"&&m!=null&&m.nodeType===1}function H(m,g){return(!g||m!=="hidden")&&m!=="visible"&&m!=="clip"}function C(m,g){if(m.clientHeight<m.scrollHeight||m.clientWidth<m.scrollWidth){var s=getComputedStyle(m,null);return H(s.overflowY,g)||H(s.overflowX,g)||function(a){var i=function(o){if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch(n){return null}}(a);return!!i&&(i.clientHeight<a.scrollHeight||i.clientWidth<a.scrollWidth)}(m)}return!1}function j(m,g,s,a,i,o,n,e){return o<m&&n>g||o>m&&n<g?0:o<=m&&e<=s||n>=g&&e>=s?o-m-a:n>g&&e<s||o<m&&e>s?n-g+i:0}var L=function(m,g){var s=window,a=g.scrollMode,i=g.block,o=g.inline,n=g.boundary,e=g.skipOverflowHiddenElements,t=typeof n=="function"?n:function(be){return be!==n};if(!de(m))throw new TypeError("Invalid target");for(var r=document.scrollingElement||document.documentElement,T=[],v=m;de(v)&&t(v);){if((v=v.parentElement)===r){T.push(v);break}v!=null&&v===document.body&&C(v)&&!C(document.documentElement)||v!=null&&C(v,e)&&T.push(v)}for(var f=s.visualViewport?s.visualViewport.width:innerWidth,E=s.visualViewport?s.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,u=window.scrollY||pageYOffset,l=m.getBoundingClientRect(),h=l.height,d=l.width,b=l.top,p=l.right,x=l.bottom,R=l.left,O=i==="start"||i==="nearest"?b:i==="end"?x:b+h/2,N=o==="center"?R+d/2:o==="end"?p:R,U=[],W=0;W<T.length;W++){var P=T[W],K=P.getBoundingClientRect(),V=K.height,re=K.width,ee=K.top,le=K.right,oe=K.bottom,$=K.left;if(a==="if-needed"&&b>=0&&R>=0&&x<=E&&p<=f&&b>=ee&&x<=oe&&R>=$&&p<=le)return U;var Z=getComputedStyle(P),ne=parseInt(Z.borderLeftWidth,10),X=parseInt(Z.borderTopWidth,10),z=parseInt(Z.borderRightWidth,10),fe=parseInt(Z.borderBottomWidth,10),Se=0,Oe=0,Ae="offsetWidth"in P?P.offsetWidth-P.clientWidth-ne-z:0,Pe="offsetHeight"in P?P.offsetHeight-P.clientHeight-X-fe:0;if(r===P)Se=i==="start"?O:i==="end"?O-E:i==="nearest"?j(u,u+E,E,X,fe,u+O,u+O+h,h):O-E/2,Oe=o==="start"?N:o==="center"?N-f/2:o==="end"?N-f:j(y,y+f,f,ne,z,y+N,y+N+d,d),Se=Math.max(0,Se+u),Oe=Math.max(0,Oe+y);else{Se=i==="start"?O-ee-X:i==="end"?O-oe+fe+Pe:i==="nearest"?j(ee,oe,V,X,fe+Pe,O,O+h,h):O-(ee+V/2)+Pe/2,Oe=o==="start"?N-$-ne:o==="center"?N-($+re/2)+Ae/2:o==="end"?N-le+z+Ae:j($,le,re,ne,z+Ae,N,N+d,d);var me=P.scrollLeft,ge=P.scrollTop;O+=ge-(Se=Math.max(0,Math.min(ge+Se,P.scrollHeight-V+Pe))),N+=me-(Oe=Math.max(0,Math.min(me+Oe,P.scrollWidth-re+Ae)))}U.push({el:P,top:Se,left:Oe})}return U};function A(m){return m===Object(m)&&Object.keys(m).length!==0}function B(m,g){g===void 0&&(g="auto");var s="scrollBehavior"in document.body.style;m.forEach(function(a){var i=a.el,o=a.top,n=a.left;i.scroll&&s?i.scroll({top:o,left:n,behavior:g}):(i.scrollTop=o,i.scrollLeft=n)})}function M(m){return m===!1?{block:"end",inline:"nearest"}:A(m)?m:{block:"start",inline:"nearest"}}function w(m,g){var s=!m.ownerDocument.documentElement.contains(m);if(A(g)&&typeof g.behavior=="function")return g.behavior(s?[]:L(m,g));if(s)return;var a=M(g);return B(L(m,a),a.behavior)}var S=We.a=w},bT9E:function(et,We,J){"use strict";J.d(We,"a",function(){return H});var de=J("VTBJ");function H(C,j){var L=Object(de.a)({},C);return Array.isArray(j)&&j.forEach(function(A){delete L[A]}),L}},fAei:function(et,We,J){"use strict";J.d(We,"a",function(){return r.a});var de=J("rePB"),H=J("VTBJ"),C=J("KQm4"),j=J("1OyB"),L=J("vuIU"),A=J("Ji7U"),B=J("LK+K"),M=J("q1tI"),w=J("4IlW"),S=J("Kwbf"),m=J("TSYQ"),g=J.n(m),s=J("sboe"),a=J("OZM5"),i=J("815F"),o=J("ODXe"),n=J("Ff2n"),e=J("+nKL"),t=J("8XRh"),r=J("WaYH"),T=function(le,oe){var $=le.className,Z=le.style,ne=le.motion,X=le.motionNodes,z=le.motionType,fe=le.onMotionStart,Se=le.onMotionEnd,Oe=le.active,Ae=le.treeNodeRequiredProps,Pe=Object(n.a)(le,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),me=M.useState(!0),ge=Object(o.a)(me,2),be=ge[0],Ee=ge[1],Ie=M.useContext(s.a),Me=Ie.prefixCls,De=M.useRef(!1),Fe=function(){De.current||Se(),De.current=!0};return Object(M.useEffect)(function(){X&&z==="hide"&&be&&Ee(!1)},[X]),Object(M.useEffect)(function(){return X&&fe(),function(){X&&Fe()}},[]),X?M.createElement(t.default,Object.assign({ref:oe,visible:be},ne,{motionAppear:z==="show",onAppearEnd:Fe,onLeaveEnd:Fe}),function(ue,pe){var ye=ue.className,Te=ue.style;return M.createElement("div",{ref:pe,className:g()("".concat(Me,"-treenode-motion"),ye),style:Te},X.map(function(we){var xe=we.data,ve=xe.key,Ne=Object(n.a)(xe,["key"]),Ue=we.isStart,he=we.isEnd;delete Ne.children;var Le=Object(i.f)(ve,Ae);return M.createElement(r.a,Object.assign({},Ne,Le,{active:Oe,data:we.data,key:ve,isStart:Ue,isEnd:he}))}))}):M.createElement(r.a,Object.assign({domRef:oe,className:$,style:Z},Pe,{active:Oe}))};T.displayName="MotionTreeNode";var v=M.forwardRef(T),f=v;function E(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],oe=ee.length,$=le.length;if(Math.abs(oe-$)!==1)return{add:!1,key:null};function Z(ne,X){var z=new Map;ne.forEach(function(Se){z.set(Se,!0)});var fe=X.filter(function(Se){return!z.has(Se)});return fe.length===1?fe[0]:null}return oe<$?{add:!0,key:Z(ee,le)}:{add:!1,key:Z(le,ee)}}function y(ee,le,oe){var $=ee.findIndex(function(z){var fe=z.data;return fe.key===oe}),Z=ee[$+1],ne=le.findIndex(function(z){var fe=z.data;return fe.key===oe});if(Z){var X=le.findIndex(function(z){var fe=z.data;return fe.key===Z.data.key});return le.slice(ne+1,X)}return le.slice(ne+1)}var u={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},l=function(){},h="RC_TREE_MOTION_".concat(Math.random()),d={key:h},b={key:h,level:0,index:0,pos:"0",node:d},p={parent:null,children:[],pos:b.pos,data:d,isStart:[],isEnd:[]};function x(ee,le,oe,$){return le===!1||!oe?ee:ee.slice(0,Math.ceil(oe/$)+1)}function R(ee){var le=ee.data.key,oe=ee.pos;return Object(i.e)(le,oe)}function O(ee){for(var le=String(ee.data.key),oe=ee;oe.parent;)oe=oe.parent,le="".concat(oe.data.key," > ").concat(le);return le}var N=function(le,oe){var $=le.prefixCls,Z=le.data,ne=le.selectable,X=le.checkable,z=le.expandedKeys,fe=le.selectedKeys,Se=le.checkedKeys,Oe=le.loadedKeys,Ae=le.loadingKeys,Pe=le.halfCheckedKeys,me=le.keyEntities,ge=le.disabled,be=le.dragging,Ee=le.dragOverNodeKey,Ie=le.dropPosition,Me=le.motion,De=le.height,Fe=le.itemHeight,ue=le.virtual,pe=le.focusable,ye=le.activeItem,Te=le.focused,we=le.tabIndex,xe=le.onKeyDown,ve=le.onFocus,Ne=le.onBlur,Ue=le.onActiveChange,he=le.onListChangeStart,Le=le.onListChangeEnd,se=Object(n.a)(le,["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"]),te=M.useRef(null);M.useImperativeHandle(oe,function(){return{scrollTo:function(Je){te.current.scrollTo(Je)}}});var ae=M.useState(z),G=Object(o.a)(ae,2),Y=G[0],Q=G[1],q=M.useState(Z),ce=Object(o.a)(q,2),_e=ce[0],ke=ce[1],Ke=M.useState(Z),Xe=Object(o.a)(Ke,2),ze=Xe[0],qe=Xe[1],it=M.useState([]),Ye=Object(o.a)(it,2),mt=Ye[0],at=Ye[1],yt=M.useState(null),dt=Object(o.a)(yt,2),tt=dt[0],_t=dt[1];function Et(){ke(Z),qe(Z),at([]),_t(null),Le()}M.useEffect(function(){Q(z);var Qe=E(Y,z);if(Qe.key!==null)if(Qe.add){var Je=_e.findIndex(function(Ze){var ut=Ze.data.key;return ut===Qe.key}),ft=x(y(_e,Z,Qe.key),ue,De,Fe),Tt=_e.slice();Tt.splice(Je+1,0,p),qe(Tt),at(ft),_t("show")}else{var Rt=Z.findIndex(function(Ze){var ut=Ze.data.key;return ut===Qe.key}),ot=x(y(Z,_e,Qe.key),ue,De,Fe),rt=Z.slice();rt.splice(Rt+1,0,p),qe(rt),at(ot),_t("hide")}else _e!==Z&&(ke(Z),qe(Z))},[z,Z]),M.useEffect(function(){be||Et()},[be]);var Be=Me?ze:Z,$e={expandedKeys:z,selectedKeys:fe,loadedKeys:Oe,loadingKeys:Ae,checkedKeys:Se,halfCheckedKeys:Pe,dragOverNodeKey:Ee,dropPosition:Ie,keyEntities:me};return M.createElement(M.Fragment,null,Te&&ye&&M.createElement("span",{style:u,"aria-live":"assertive"},O(ye)),M.createElement("div",{role:"tree"},M.createElement("input",{style:u,disabled:pe===!1||ge,tabIndex:pe!==!1?we:null,onKeyDown:xe,onFocus:ve,onBlur:Ne,value:"",onChange:l})),M.createElement(e.a,Object.assign({},se,{data:Be,itemKey:R,height:De,fullHeight:!1,virtual:ue,itemHeight:Fe,prefixCls:"".concat($,"-list"),ref:te}),function(Qe){var Je=Qe.pos,ft=Qe.data,Tt=ft.key,Rt=Object(n.a)(ft,["key"]),ot=Qe.isStart,rt=Qe.isEnd,Ze=Object(i.e)(Tt,Je);delete Rt.children;var ut=Object(i.f)(Ze,$e);return M.createElement(f,Object.assign({},Rt,ut,{active:ye&&Tt===ye.data.key,pos:Je,data:Qe.data,isStart:ot,isEnd:rt,motion:Me,motionNodes:Tt===h?mt:null,motionType:tt,onMotionStart:he,onMotionEnd:Et,treeNodeRequiredProps:$e,onMouseMove:function(){Ue(null)}}))}))},U=M.forwardRef(N);U.displayName="NodeList";var W=U,P=J("NvD2"),K=function(ee){Object(A.a)(oe,ee);var le=Object(B.a)(oe);function oe(){var $;return Object(j.a)(this,oe),$=le.apply(this,arguments),$.destroyed=!1,$.state={keyEntities:{},selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],dragging:!1,dragNodesKeys:[],dragOverNodeKey:null,dropPosition:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null},$.listRef=M.createRef(),$.onNodeDragStart=function(Z,ne){var X=$.state,z=X.expandedKeys,fe=X.keyEntities,Se=$.props.onDragStart,Oe=ne.props.eventKey;$.dragNode=ne;var Ae=Object(a.b)(z,Oe);$.setState({dragging:!0,dragNodesKeys:Object(a.g)(Oe,fe)}),$.setExpandedKeys(Ae),Se&&Se({event:Z,node:Object(i.b)(ne.props)})},$.onNodeDragEnter=function(Z,ne){var X=$.state,z=X.expandedKeys,fe=X.keyEntities,Se=X.dragNodesKeys,Oe=$.props.onDragEnter,Ae=ne.props,Pe=Ae.pos,me=Ae.eventKey;if(!$.dragNode||Se.indexOf(me)!==-1)return;var ge=Object(a.c)(Z,ne);if($.dragNode.props.eventKey===me&&ge===0){$.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){$.setState({dragOverNodeKey:me,dropPosition:ge}),$.delayedDragEnterLogic||($.delayedDragEnterLogic={}),Object.keys($.delayedDragEnterLogic).forEach(function(be){clearTimeout($.delayedDragEnterLogic[be])}),$.delayedDragEnterLogic[Pe]=window.setTimeout(function(){if(!$.state.dragging)return;var be=Object(C.a)(z),Ee=fe[me];Ee&&(Ee.children||[]).length&&(be=Object(a.a)(z,me)),"expandedKeys"in $.props||$.setExpandedKeys(be),Oe&&Oe({event:Z,node:Object(i.b)(ne.props),expandedKeys:be})},400)},0)},$.onNodeDragOver=function(Z,ne){var X=$.state.dragNodesKeys,z=$.props.onDragOver,fe=ne.props.eventKey;if(X.indexOf(fe)!==-1)return;if($.dragNode&&fe===$.state.dragOverNodeKey){var Se=Object(a.c)(Z,ne);if(Se===$.state.dropPosition)return;$.setState({dropPosition:Se})}z&&z({event:Z,node:Object(i.b)(ne.props)})},$.onNodeDragLeave=function(Z,ne){var X=$.props.onDragLeave;$.setState({dragOverNodeKey:""}),X&&X({event:Z,node:Object(i.b)(ne.props)})},$.onNodeDragEnd=function(Z,ne){var X=$.props.onDragEnd;$.setState({dragOverNodeKey:""}),$.cleanDragState(),X&&X({event:Z,node:Object(i.b)(ne.props)}),$.dragNode=null},$.onNodeDrop=function(Z,ne){var X=$.state,z=X.dragNodesKeys,fe=z===void 0?[]:z,Se=X.dropPosition,Oe=$.props.onDrop,Ae=ne.props,Pe=Ae.eventKey,me=Ae.pos;if($.setState({dragOverNodeKey:""}),$.cleanDragState(),fe.indexOf(Pe)!==-1){Object(S.a)(!1,"Can not drop to dragNode(include it's children node)");return}var ge=Object(a.k)(me),be={event:Z,node:Object(i.b)(ne.props),dragNode:$.dragNode?Object(i.b)($.dragNode.props):null,dragNodesKeys:fe.slice(),dropPosition:Se+Number(ge[ge.length-1]),dropToGap:!1};Se!==0&&(be.dropToGap=!0),Oe&&Oe(be),$.dragNode=null},$.cleanDragState=function(){var Z=$.state.dragging;Z&&$.setState({dragging:!1})},$.onNodeClick=function(Z,ne){var X=$.props.onClick;X&&X(Z,ne)},$.onNodeDoubleClick=function(Z,ne){var X=$.props.onDoubleClick;X&&X(Z,ne)},$.onNodeSelect=function(Z,ne){var X=$.state.selectedKeys,z=$.state.keyEntities,fe=$.props,Se=fe.onSelect,Oe=fe.multiple,Ae=ne.selected,Pe=ne.key,me=!Ae;me?Oe?X=Object(a.a)(X,Pe):X=[Pe]:X=Object(a.b)(X,Pe);var ge=X.map(function(be){var Ee=z[be];return Ee?Ee.node:null}).filter(function(be){return be});$.setUncontrolledState({selectedKeys:X}),Se&&Se(X,{event:"select",selected:me,node:ne,selectedNodes:ge,nativeEvent:Z.nativeEvent})},$.onNodeCheck=function(Z,ne,X){var z=$.state,fe=z.keyEntities,Se=z.checkedKeys,Oe=z.halfCheckedKeys,Ae=$.props,Pe=Ae.checkStrictly,me=Ae.onCheck,ge=ne.key,be,Ee={event:"check",node:ne,checked:X,nativeEvent:Z.nativeEvent};if(Pe){var Ie=X?Object(a.a)(Se,ge):Object(a.b)(Se,ge),Me=Object(a.b)(Oe,ge);be={checked:Ie,halfChecked:Me},Ee.checkedNodes=Ie.map(function(Te){return fe[Te]}).filter(function(Te){return Te}).map(function(Te){return Te.node}),$.setUncontrolledState({checkedKeys:Ie})}else{var De=Object(P.a)([].concat(Object(C.a)(Se),[ge]),!0,fe),Fe=De.checkedKeys,ue=De.halfCheckedKeys;if(!X){var pe=new Set(Fe);pe.delete(ge);var ye=Object(P.a)(Array.from(pe),{checked:!1,halfCheckedKeys:ue},fe);Fe=ye.checkedKeys,ue=ye.halfCheckedKeys}be=Fe,Ee.checkedNodes=[],Ee.checkedNodesPositions=[],Ee.halfCheckedKeys=ue,Fe.forEach(function(Te){var we=fe[Te];if(!we)return;var xe=we.node,ve=we.pos;Ee.checkedNodes.push(xe),Ee.checkedNodesPositions.push({node:xe,pos:ve})}),$.setUncontrolledState({checkedKeys:Fe},!1,{halfCheckedKeys:ue})}me&&me(be,Ee)},$.onNodeLoad=function(Z){return new Promise(function(ne){$.setState(function(X){var z=X.loadedKeys,fe=z===void 0?[]:z,Se=X.loadingKeys,Oe=Se===void 0?[]:Se,Ae=$.props,Pe=Ae.loadData,me=Ae.onLoad,ge=Z.key;if(!Pe||fe.indexOf(ge)!==-1||Oe.indexOf(ge)!==-1)return{};var be=Pe(Z);return be.then(function(){var Ee=$.state,Ie=Ee.loadedKeys,Me=Ee.loadingKeys,De=Object(a.a)(Ie,ge),Fe=Object(a.b)(Me,ge);me&&me(De,{event:"load",node:Z}),$.setUncontrolledState({loadedKeys:De}),$.setState({loadingKeys:Fe}),ne()}),{loadingKeys:Object(a.a)(Oe,ge)}})})},$.onNodeMouseEnter=function(Z,ne){var X=$.props.onMouseEnter;X&&X({event:Z,node:ne})},$.onNodeMouseLeave=function(Z,ne){var X=$.props.onMouseLeave;X&&X({event:Z,node:ne})},$.onNodeContextMenu=function(Z,ne){var X=$.props.onRightClick;X&&(Z.preventDefault(),X({event:Z,node:ne}))},$.onFocus=function(){var Z=$.props.onFocus;$.setState({focused:!0}),Z&&Z.apply(void 0,arguments)},$.onBlur=function(){var Z=$.props.onBlur;$.setState({focused:!1}),$.onActiveChange(null),Z&&Z.apply(void 0,arguments)},$.getTreeNodeRequiredProps=function(){var Z=$.state,ne=Z.expandedKeys,X=Z.selectedKeys,z=Z.loadedKeys,fe=Z.loadingKeys,Se=Z.checkedKeys,Oe=Z.halfCheckedKeys,Ae=Z.dragOverNodeKey,Pe=Z.dropPosition,me=Z.keyEntities;return{expandedKeys:ne||[],selectedKeys:X||[],loadedKeys:z||[],loadingKeys:fe||[],checkedKeys:Se||[],halfCheckedKeys:Oe||[],dragOverNodeKey:Ae,dropPosition:Pe,keyEntities:me}},$.setExpandedKeys=function(Z){var ne=$.state.treeData,X=Object(i.d)(ne,Z);$.setUncontrolledState({expandedKeys:Z,flattenNodes:X},!0)},$.onNodeExpand=function(Z,ne){var X=$.state.expandedKeys,z=$.state.listChanging,fe=$.props,Se=fe.onExpand,Oe=fe.loadData,Ae=ne.key,Pe=ne.expanded;if(z)return;var me=X.indexOf(Ae),ge=!Pe;if(Object(S.a)(Pe&&me!==-1||!Pe&&me===-1,"Expand state not sync with index check"),ge?X=Object(a.a)(X,Ae):X=Object(a.b)(X,Ae),$.setExpandedKeys(X),Se&&Se(X,{node:ne,expanded:ge,nativeEvent:Z.nativeEvent}),ge&&Oe){var be=$.onNodeLoad(ne);be&&be.then(function(){var Ee=Object(i.d)($.state.treeData,X);$.setUncontrolledState({flattenNodes:Ee})})}},$.onListChangeStart=function(){$.setUncontrolledState({listChanging:!0})},$.onListChangeEnd=function(){setTimeout(function(){$.setUncontrolledState({listChanging:!1})})},$.onActiveChange=function(Z){var ne=$.state.activeKey,X=$.props.onActiveChange;if(ne===Z)return;$.setState({activeKey:Z}),Z!==null&&$.scrollTo({key:Z}),X&&X(Z)},$.getActiveItem=function(){var Z=$.state,ne=Z.activeKey,X=Z.flattenNodes;return ne===null?null:X.find(function(z){var fe=z.data.key;return fe===ne})||null},$.offsetActiveKey=function(Z){var ne=$.state,X=ne.flattenNodes,z=ne.activeKey,fe=X.findIndex(function(Ae){var Pe=Ae.data.key;return Pe===z});fe===-1&&Z<0&&(fe=X.length),fe=(fe+Z+X.length)%X.length;var Se=X[fe];if(Se){var Oe=Se.data.key;$.onActiveChange(Oe)}else $.onActiveChange(null)},$.onKeyDown=function(Z){var ne=$.state,X=ne.activeKey,z=ne.expandedKeys,fe=ne.checkedKeys,Se=$.props,Oe=Se.onKeyDown,Ae=Se.checkable,Pe=Se.selectable;switch(Z.which){case w.a.UP:{$.offsetActiveKey(-1),Z.preventDefault();break}case w.a.DOWN:{$.offsetActiveKey(1),Z.preventDefault();break}}var me=$.getActiveItem();if(me&&me.data){var ge=$.getTreeNodeRequiredProps(),be=me.data.isLeaf===!1||!!(me.data.children||[]).length,Ee=Object(i.b)(Object(H.a)(Object(H.a)({},Object(i.f)(X,ge)),{},{data:me.data,active:!0}));switch(Z.which){case w.a.LEFT:{be&&z.includes(X)?$.onNodeExpand({},Ee):me.parent&&$.onActiveChange(me.parent.data.key),Z.preventDefault();break}case w.a.RIGHT:{be&&!z.includes(X)?$.onNodeExpand({},Ee):me.children&&me.children.length&&$.onActiveChange(me.children[0].data.key),Z.preventDefault();break}case w.a.ENTER:case w.a.SPACE:{Ae&&!Ee.disabled&&Ee.checkable!==!1&&!Ee.disableCheckbox?$.onNodeCheck({},Ee,!fe.includes(X)):!Ae&&Pe&&!Ee.disabled&&Ee.selectable!==!1&&$.onNodeSelect({},Ee);break}}}Oe&&Oe(Z)},$.setUncontrolledState=function(Z){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,X=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if($.destroyed)return;var z=!1,fe=!0,Se={};Object.keys(Z).forEach(function(Oe){if(Oe in $.props){fe=!1;return}z=!0,Se[Oe]=Z[Oe]}),z&&(!ne||fe)&&$.setState(Object(H.a)(Object(H.a)({},Se),X))},$.scrollTo=function(Z){$.listRef.current.scrollTo(Z)},$}return Object(L.a)(oe,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var Z,ne=this.state,X=ne.focused,z=ne.flattenNodes,fe=ne.keyEntities,Se=ne.dragging,Oe=ne.activeKey,Ae=this.props,Pe=Ae.prefixCls,me=Ae.className,ge=Ae.style,be=Ae.showLine,Ee=Ae.focusable,Ie=Ae.tabIndex,Me=Ie===void 0?0:Ie,De=Ae.selectable,Fe=Ae.showIcon,ue=Ae.icon,pe=Ae.switcherIcon,ye=Ae.draggable,Te=Ae.checkable,we=Ae.checkStrictly,xe=Ae.disabled,ve=Ae.motion,Ne=Ae.loadData,Ue=Ae.filterTreeNode,he=Ae.height,Le=Ae.itemHeight,se=Ae.virtual,te=Ae.titleRender,ae=Ae.onContextMenu,G=Object(a.f)(this.props);return M.createElement(s.a.Provider,{value:{prefixCls:Pe,selectable:De,showIcon:Fe,icon:ue,switcherIcon:pe,draggable:ye,checkable:Te,checkStrictly:we,disabled:xe,keyEntities:fe,loadData:Ne,filterTreeNode:Ue,titleRender:te,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},M.createElement("div",{className:g()(Pe,me,(Z={},Object(de.a)(Z,"".concat(Pe,"-show-line"),be),Object(de.a)(Z,"".concat(Pe,"-focused"),X),Object(de.a)(Z,"".concat(Pe,"-active-focused"),Oe!==null),Z))},M.createElement(W,Object.assign({ref:this.listRef,prefixCls:Pe,style:ge,data:z,disabled:xe,selectable:De,checkable:!!Te,motion:ve,dragging:Se,height:he,itemHeight:Le,virtual:se,focusable:Ee,focused:X,tabIndex:Me,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:ae},this.getTreeNodeRequiredProps(),G))))}}],[{key:"getDerivedStateFromProps",value:function(Z,ne){var X=ne.prevProps,z={prevProps:Z};function fe(ue){return!X&&ue in Z||X&&X[ue]!==Z[ue]}var Se;if(fe("treeData")?Se=Z.treeData:fe("children")&&(Object(S.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),Se=Object(i.c)(Z.children)),Se){z.treeData=Se;var Oe=Object(i.a)(Se);z.keyEntities=Object(H.a)(Object(de.a)({},h,b),Oe.keyEntities)}var Ae=z.keyEntities||ne.keyEntities;if(fe("expandedKeys")||X&&fe("autoExpandParent"))z.expandedKeys=Z.autoExpandParent||!X&&Z.defaultExpandParent?Object(a.e)(Z.expandedKeys,Ae):Z.expandedKeys;else if(!X&&Z.defaultExpandAll){var Pe=Object(H.a)({},Ae);delete Pe[h],z.expandedKeys=Object.keys(Pe).map(function(ue){return Pe[ue].key})}else!X&&Z.defaultExpandedKeys&&(z.expandedKeys=Z.autoExpandParent||Z.defaultExpandParent?Object(a.e)(Z.defaultExpandedKeys,Ae):Z.defaultExpandedKeys);if(z.expandedKeys||delete z.expandedKeys,Se||z.expandedKeys){var me=Object(i.d)(Se||ne.treeData,z.expandedKeys||ne.expandedKeys);z.flattenNodes=me}if(Z.selectable&&(fe("selectedKeys")?z.selectedKeys=Object(a.d)(Z.selectedKeys,Z):!X&&Z.defaultSelectedKeys&&(z.selectedKeys=Object(a.d)(Z.defaultSelectedKeys,Z))),Z.checkable){var ge;if(fe("checkedKeys")?ge=Object(a.j)(Z.checkedKeys)||{}:!X&&Z.defaultCheckedKeys?ge=Object(a.j)(Z.defaultCheckedKeys)||{}:Se&&(ge=Object(a.j)(Z.checkedKeys)||{checkedKeys:ne.checkedKeys,halfCheckedKeys:ne.halfCheckedKeys}),ge){var be=ge,Ee=be.checkedKeys,Ie=Ee===void 0?[]:Ee,Me=be.halfCheckedKeys,De=Me===void 0?[]:Me;if(!Z.checkStrictly){var Fe=Object(P.a)(Ie,!0,Ae);Ie=Fe.checkedKeys,De=Fe.halfCheckedKeys}z.checkedKeys=Ie,z.halfCheckedKeys=De}}return fe("loadedKeys")&&(z.loadedKeys=Z.loadedKeys),z}}]),oe}(M.Component);K.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[]},K.TreeNode=r.a;var V=K,re=We.b=V},p5ED:function(et,We,J){"use strict";var de=J("+L6B"),H=J("2/Rp"),C=J("5Dmo"),j=J("3S7+"),L=J("k1fw"),A=J("tJVT"),B=J("q1tI"),M=J.n(B),w=J("vHTk"),S=J.n(w),m=J("yEEn"),g=J("ZW9T"),s=J("1vsH");We.a=function(a){var i=a.name,o=a.data,n=a.theme,e=a.type,t=a.filename,r=a.monacoEditor,T=a.className,v=a.style,f=a.close,E=a.onClose,y=a.hasMask,u=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),l=Object(A.a)(u,2),h=l[0],d=l[1],b=Object(B.useState)(""),p=Object(A.a)(b,2),x=p[0],R=p[1],O,N=1024*1024,U=10*N,W=Object(B.useRef)();e==="office"&&(O=Object(s.T)(o).filesize,O>U&&(e="other")),t&&(r.filename=t),Object(B.useEffect)(function(){var V,re,ee=(V=document.cookie)===null||V===void 0||((re=V.replace(/\s/g,""))===null||re===void 0)?void 0:re.split(";");ee==null||ee.map(function(le){var oe=le.split("=");oe[0]==="_educoder_session"&&R(oe[1])})},[]);var P=function(){if(o.startsWith("http")||o.startsWith("/")){K();return}Object(s.z)(t||"educoder",o,t)},K=function(){Object(s.x)(t||i,o)};return console.log("data:",o,"fileanme:",t," name:",i),M.a.createElement("div",{style:Object(L.a)({},v||{}),className:"".concat(y&&S.a.bgBlack," ").concat(e?S.a.wrp:"hide")},f&&M.a.createElement("div",{className:S.a.close,ref:W},M.a.createElement(j.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return W.current}},M.a.createElement("span",{onClick:K},M.a.createElement("i",{className:"icon-quxiaozhiding"}))),M.a.createElement(j.a,{title:"\u5173\u95ED",getPopupContainer:function(){return W.current}},M.a.createElement("span",{className:"",onClick:E},M.a.createElement("i",{className:"icon-guanbi1"})))),M.a.createElement("div",{className:"".concat(S.a[T]," ").concat(T," ").concat(S.a.monaco," ").concat(e==="txt"?"show":"hide")},e==="txt"&&M.a.createElement(g.b,r)),e==="audio"&&M.a.createElement("audio",{src:"".concat(o!=null&&o.startsWith("/")||(o==null?void 0:o.indexOf("https://"))>-1?o:"data:audio/mp3;base64,").concat(o),autoPlay:!0}),e==="video"&&M.a.createElement(M.a.Fragment,null,o!=null&&o.startsWith("/")?M.a.createElement("video",{controls:!0,src:"".concat(o),autoPlay:!0}):M.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(o),autoPlay:!0})),e==="html"&&M.a.createElement("iframe",{src:o+"&disposition=inline"}),e==="pdf"&&M.a.createElement("embed",{className:S.a.embed,src:o}),e==="image"&&M.a.createElement(M.a.Fragment,null,M.a.createElement("img",{src:"".concat(o!=null&&o.startsWith("/")||(o==null?void 0:o.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(o)})),e==="other"&&M.a.createElement("div",null,M.a.createElement(H.a,{type:"primary",size:"large",onClick:P},M.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(e==="download"||e==="office")&&M.a.createElement(H.a,{type:"primary",size:"large",onClick:P},M.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},psGv:function(et,We,J){var de,H;(function(){var C;(function(){"use strict";var B=[,,function(m){function g(i){this.__parent=i,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=[]}g.prototype.clone_empty=function(){var i=new g(this.__parent);return i.set_indent(this.__indent_count,this.__alignment_count),i},g.prototype.item=function(i){return i<0?this.__items[this.__items.length+i]:this.__items[i]},g.prototype.has_match=function(i){for(var o=this.__items.length-1;o>=0;o--)if(this.__items[o].match(i))return!0;return!1},g.prototype.set_indent=function(i,o){this.is_empty()&&(this.__indent_count=i||0,this.__alignment_count=o||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},g.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)},g.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},g.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var i=this.__parent.current_line;return i.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),i.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),i.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,i.__items[0]===" "&&(i.__items.splice(0,1),i.__character_count-=1),!0}return!1},g.prototype.is_empty=function(){return this.__items.length===0},g.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},g.prototype.push=function(i){this.__items.push(i);var o=i.lastIndexOf(`
|
|
`);o!==-1?this.__character_count=i.length-o:this.__character_count+=i.length},g.prototype.pop=function(){var i=null;return this.is_empty()||(i=this.__items.pop(),this.__character_count-=i.length),i},g.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},g.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},g.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},g.prototype.toString=function(){var i="";return this.is_empty()?this.__parent.indent_empty_lines&&(i=this.__parent.get_indent_string(this.__indent_count)):(i=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),i+=this.__items.join("")),i};function s(i,o){this.__cache=[""],this.__indent_size=i.indent_size,this.__indent_string=i.indent_char,i.indent_with_tabs||(this.__indent_string=new Array(i.indent_size+1).join(i.indent_char)),o=o||"",i.indent_level>0&&(o=new Array(i.indent_level+1).join(this.__indent_string)),this.__base_string=o,this.__base_string_length=o.length}s.prototype.get_indent_size=function(i,o){var n=this.__base_string_length;return o=o||0,i<0&&(n=0),n+=i*this.__indent_size,n+=o,n},s.prototype.get_indent_string=function(i,o){var n=this.__base_string;return o=o||0,i<0&&(i=0,n=""),o+=i*this.__indent_size,this.__ensure_cache(o),n+=this.__cache[o],n},s.prototype.__ensure_cache=function(i){for(;i>=this.__cache.length;)this.__add_column()},s.prototype.__add_column=function(){var i=this.__cache.length,o=0,n="";this.__indent_size&&i>=this.__indent_size&&(o=Math.floor(i/this.__indent_size),i-=o*this.__indent_size,n=new Array(o+1).join(this.__indent_string)),i&&(n+=new Array(i+1).join(" ")),this.__cache.push(n)};function a(i,o){this.__indent_cache=new s(i,o),this.raw=!1,this._end_with_newline=i.end_with_newline,this.indent_size=i.indent_size,this.wrap_line_length=i.wrap_line_length,this.indent_empty_lines=i.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new g(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}a.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},a.prototype.get_line_number=function(){return this.__lines.length},a.prototype.get_indent_string=function(i,o){return this.__indent_cache.get_indent_string(i,o)},a.prototype.get_indent_size=function(i,o){return this.__indent_cache.get_indent_size(i,o)},a.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},a.prototype.add_new_line=function(i){return this.is_empty()||!i&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},a.prototype.get_code=function(i){this.trim(!0);var o=this.current_line.pop();o&&(o[o.length-1]===`
|
|
`&&(o=o.replace(/\n+$/g,"")),this.current_line.push(o)),this._end_with_newline&&this.__add_outputline();var n=this.__lines.join(`
|
|
`);return i!==`
|
|
`&&(n=n.replace(/[\n]/g,i)),n},a.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},a.prototype.set_indent=function(i,o){return i=i||0,o=o||0,this.next_line.set_indent(i,o),this.__lines.length>1?(this.current_line.set_indent(i,o),!0):(this.current_line.set_indent(),!1)},a.prototype.add_raw_token=function(i){for(var o=0;o<i.newlines;o++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(i.whitespace_before),this.current_line.push(i.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},a.prototype.add_token=function(i){this.__add_space_before_token(),this.current_line.push(i),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},a.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},a.prototype.remove_indent=function(i){for(var o=this.__lines.length;i<o;)this.__lines[i]._remove_indent(),i++;this.current_line._remove_wrap_indent()},a.prototype.trim=function(i){for(i=i===void 0?!1:i,this.current_line.trim();i&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},a.prototype.just_added_newline=function(){return this.current_line.is_empty()},a.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},a.prototype.ensure_empty_line_above=function(i,o){for(var n=this.__lines.length-2;n>=0;){var e=this.__lines[n];if(e.is_empty())break;if(e.item(0).indexOf(i)!==0&&e.item(-1)!==o){this.__lines.splice(n+1,0,new g(this)),this.previous_line=this.__lines[this.__lines.length-2];break}n--}},m.exports.Output=a},function(m){function g(s,a,i,o){this.type=s,this.text=a,this.comments_before=null,this.newlines=i||0,this.whitespace_before=o||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}m.exports.Token=g},,,function(m){function g(i,o){this.raw_options=s(i,o),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"])}g.prototype._get_array=function(i,o){var n=this.raw_options[i],e=o||[];return typeof n=="object"?n!==null&&typeof n.concat=="function"&&(e=n.concat()):typeof n=="string"&&(e=n.split(/[^a-zA-Z0-9_\/\-]+/)),e},g.prototype._get_boolean=function(i,o){var n=this.raw_options[i],e=n===void 0?!!o:!!n;return e},g.prototype._get_characters=function(i,o){var n=this.raw_options[i],e=o||"";return typeof n=="string"&&(e=n.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),e},g.prototype._get_number=function(i,o){var n=this.raw_options[i];o=parseInt(o,10),isNaN(o)&&(o=0);var e=parseInt(n,10);return isNaN(e)&&(e=o),e},g.prototype._get_selection=function(i,o,n){var e=this._get_selection_list(i,o,n);if(e.length!==1)throw new Error("Invalid Option Value: The option '"+i+`' can only be one of the following values:
|
|
`+o+`
|
|
You passed in: '`+this.raw_options[i]+"'");return e[0]},g.prototype._get_selection_list=function(i,o,n){if(!o||o.length===0)throw new Error("Selection list cannot be empty.");if(n=n||[o[0]],!this._is_valid_selection(n,o))throw new Error("Invalid Default Value!");var e=this._get_array(i,n);if(!this._is_valid_selection(e,o))throw new Error("Invalid Option Value: The option '"+i+`' can contain only the following values:
|
|
`+o+`
|
|
You passed in: '`+this.raw_options[i]+"'");return e},g.prototype._is_valid_selection=function(i,o){return i.length&&o.length&&!i.some(function(n){return o.indexOf(n)===-1})};function s(i,o){var n={};i=a(i);var e;for(e in i)e!==o&&(n[e]=i[e]);if(o&&i[o])for(e in i[o])n[e]=i[o][e];return n}function a(i){var o={},n;for(n in i){var e=n.replace(/-/g,"_");o[e]=i[n]}return o}m.exports.Options=g,m.exports.normalizeOpts=a,m.exports.mergeOpts=s},,function(m){var g=RegExp.prototype.hasOwnProperty("sticky");function s(a){this.__input=a||"",this.__input_length=this.__input.length,this.__position=0}s.prototype.restart=function(){this.__position=0},s.prototype.back=function(){this.__position>0&&(this.__position-=1)},s.prototype.hasNext=function(){return this.__position<this.__input_length},s.prototype.next=function(){var a=null;return this.hasNext()&&(a=this.__input.charAt(this.__position),this.__position+=1),a},s.prototype.peek=function(a){var i=null;return a=a||0,a+=this.__position,a>=0&&a<this.__input_length&&(i=this.__input.charAt(a)),i},s.prototype.__match=function(a,i){a.lastIndex=i;var o=a.exec(this.__input);return o&&!(g&&a.sticky)&&(o.index!==i&&(o=null)),o},s.prototype.test=function(a,i){return i=i||0,i+=this.__position,i>=0&&i<this.__input_length?!!this.__match(a,i):!1},s.prototype.testChar=function(a,i){var o=this.peek(i);return a.lastIndex=0,o!==null&&a.test(o)},s.prototype.match=function(a){var i=this.__match(a,this.__position);return i?this.__position+=i[0].length:i=null,i},s.prototype.read=function(a,i,o){var n="",e;return a&&(e=this.match(a),e&&(n+=e[0])),i&&(e||!a)&&(n+=this.readUntil(i,o)),n},s.prototype.readUntil=function(a,i){var o="",n=this.__position;a.lastIndex=this.__position;var e=a.exec(this.__input);return e?(n=e.index,i&&(n+=e[0].length)):n=this.__input_length,o=this.__input.substring(this.__position,n),this.__position=n,o},s.prototype.readUntilAfter=function(a){return this.readUntil(a,!0)},s.prototype.get_regexp=function(a,i){var o=null,n="g";return i&&g&&(n="y"),typeof a=="string"&&a!==""?o=new RegExp(a,n):a&&(o=new RegExp(a.source,n)),o},s.prototype.get_literal_regexp=function(a){return RegExp(a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},s.prototype.peekUntilAfter=function(a){var i=this.__position,o=this.readUntilAfter(a);return this.__position=i,o},s.prototype.lookBack=function(a){var i=this.__position-1;return i>=a.length&&this.__input.substring(i-a.length,i).toLowerCase()===a},m.exports.InputScanner=s},function(m,g,s){var a=s(8).InputScanner,i=s(3).Token,o=s(10).TokenStream,n=s(11).WhitespacePattern,e={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},t=function(r,T){this._input=new a(r),this._options=T||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new n(this._input)};t.prototype.tokenize=function(){this._input.restart(),this.__tokens=new o,this._reset();for(var r,T=new i(e.START,""),v=null,f=[],E=new o;T.type!==e.EOF;){for(r=this._get_next_token(T,v);this._is_comment(r);)E.add(r),r=this._get_next_token(T,v);E.isEmpty()||(r.comments_before=E,E=new o),r.parent=v,this._is_opening(r)?(f.push(v),v=r):v&&this._is_closing(r,v)&&(r.opened=v,v.closed=r,v=f.pop(),r.parent=v),r.previous=T,T.next=r,this.__tokens.add(r),T=r}return this.__tokens},t.prototype._is_first_token=function(){return this.__tokens.isEmpty()},t.prototype._reset=function(){},t.prototype._get_next_token=function(r,T){this._readWhitespace();var v=this._input.read(/.+/g);return v?this._create_token(e.RAW,v):this._create_token(e.EOF,"")},t.prototype._is_comment=function(r){return!1},t.prototype._is_opening=function(r){return!1},t.prototype._is_closing=function(r,T){return!1},t.prototype._create_token=function(r,T){var v=new i(r,T,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return v},t.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},m.exports.Tokenizer=t,m.exports.TOKEN=e},function(m){function g(s){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=s}g.prototype.restart=function(){this.__position=0},g.prototype.isEmpty=function(){return this.__tokens_length===0},g.prototype.hasNext=function(){return this.__position<this.__tokens_length},g.prototype.next=function(){var s=null;return this.hasNext()&&(s=this.__tokens[this.__position],this.__position+=1),s},g.prototype.peek=function(s){var a=null;return s=s||0,s+=this.__position,s>=0&&s<this.__tokens_length&&(a=this.__tokens[s]),a},g.prototype.add=function(s){this.__parent_token&&(s.parent=this.__parent_token),this.__tokens.push(s),this.__tokens_length+=1},m.exports.TokenStream=g},function(m,g,s){var a=s(12).Pattern;function i(o,n){a.call(this,o,n),n?this._line_regexp=this._input.get_regexp(n._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}i.prototype=new a,i.prototype.__set_whitespace_patterns=function(o,n){o+="\\t ",n+="\\n\\r",this._match_pattern=this._input.get_regexp("["+o+n+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+n+"]")},i.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var o=this._input.read(this._match_pattern);if(o===" ")this.whitespace_before_token=" ";else if(o){var n=this.__split(this._newline_regexp,o);this.newline_count=n.length-1,this.whitespace_before_token=n[this.newline_count]}return o},i.prototype.matching=function(o,n){var e=this._create();return e.__set_whitespace_patterns(o,n),e._update(),e},i.prototype._create=function(){return new i(this._input,this)},i.prototype.__split=function(o,n){o.lastIndex=0;for(var e=0,t=[],r=o.exec(n);r;)t.push(n.substring(e,r.index)),e=r.index+r[0].length,r=o.exec(n);return e<n.length?t.push(n.substring(e,n.length)):t.push(""),t},m.exports.WhitespacePattern=i},function(m){function g(s,a){this._input=s,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,a&&(this._starting_pattern=this._input.get_regexp(a._starting_pattern,!0),this._match_pattern=this._input.get_regexp(a._match_pattern,!0),this._until_pattern=this._input.get_regexp(a._until_pattern),this._until_after=a._until_after)}g.prototype.read=function(){var s=this._input.read(this._starting_pattern);return(!this._starting_pattern||s)&&(s+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),s},g.prototype.read_match=function(){return this._input.match(this._match_pattern)},g.prototype.until_after=function(s){var a=this._create();return a._until_after=!0,a._until_pattern=this._input.get_regexp(s),a._update(),a},g.prototype.until=function(s){var a=this._create();return a._until_after=!1,a._until_pattern=this._input.get_regexp(s),a._update(),a},g.prototype.starting_with=function(s){var a=this._create();return a._starting_pattern=this._input.get_regexp(s,!0),a._update(),a},g.prototype.matching=function(s){var a=this._create();return a._match_pattern=this._input.get_regexp(s,!0),a._update(),a},g.prototype._create=function(){return new g(this._input,this)},g.prototype._update=function(){},m.exports.Pattern=g},function(m){function g(s,a){s=typeof s=="string"?s:s.source,a=typeof a=="string"?a:a.source,this.__directives_block_pattern=new RegExp(s+/ beautify( \w+[:]\w+)+ /.source+a,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(s+/\sbeautify\signore:end\s/.source+a,"g")}g.prototype.get_directives=function(s){if(!s.match(this.__directives_block_pattern))return null;var a={};this.__directive_pattern.lastIndex=0;for(var i=this.__directive_pattern.exec(s);i;)a[i[1]]=i[2],i=this.__directive_pattern.exec(s);return a},g.prototype.readIgnored=function(s){return s.readUntilAfter(this.__directives_end_ignore_pattern)},m.exports.Directives=g},function(m,g,s){var a=s(12).Pattern,i={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function o(n,e){a.call(this,n,e),this.__template_pattern=null,this._disabled=Object.assign({},i),this._excluded=Object.assign({},i),e&&(this.__template_pattern=this._input.get_regexp(e.__template_pattern),this._excluded=Object.assign(this._excluded,e._excluded),this._disabled=Object.assign(this._disabled,e._disabled));var t=new a(n);this.__patterns={handlebars_comment:t.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:t.starting_with(/{{{/).until_after(/}}}/),handlebars:t.starting_with(/{{/).until_after(/}}/),php:t.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:t.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:t.starting_with(/{%/).until_after(/%}/),django_value:t.starting_with(/{{/).until_after(/}}/),django_comment:t.starting_with(/{#/).until_after(/#}/),smarty:t.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:t.starting_with(/{\*/).until_after(/\*}/),smarty_literal:t.starting_with(/{literal}/).until_after(/{\/literal}/)}}o.prototype=new a,o.prototype._create=function(){return new o(this._input,this)},o.prototype._update=function(){this.__set_templated_pattern()},o.prototype.disable=function(n){var e=this._create();return e._disabled[n]=!0,e._update(),e},o.prototype.read_options=function(n){var e=this._create();for(var t in i)e._disabled[t]=n.templating.indexOf(t)===-1;return e._update(),e},o.prototype.exclude=function(n){var e=this._create();return e._excluded[n]=!0,e._update(),e},o.prototype.read=function(){var n="";this._match_pattern?n=this._input.read(this._starting_pattern):n=this._input.read(this._starting_pattern,this.__template_pattern);for(var e=this._read_template();e;)this._match_pattern?e+=this._input.read(this._match_pattern):e+=this._input.readUntil(this.__template_pattern),n+=e,e=this._read_template();return this._until_after&&(n+=this._input.readUntilAfter(this._until_pattern)),n},o.prototype.__set_templated_pattern=function(){var n=[];this._disabled.php||n.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||n.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||n.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(n.push(this.__patterns.django._starting_pattern.source),n.push(this.__patterns.django_value._starting_pattern.source),n.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||n.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&n.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+n.join("|")+")")},o.prototype._read_template=function(){var n="",e=this._input.peek();if(e==="<"){var t=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&t==="?"&&(n=n||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&t==="%"&&(n=n||this.__patterns.erb.read())}else e==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(n=n||this.__patterns.handlebars_comment.read(),n=n||this.__patterns.handlebars_unescaped.read(),n=n||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(n=n||this.__patterns.django_value.read()),this._excluded.django||(n=n||this.__patterns.django_comment.read(),n=n||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(n=n||this.__patterns.smarty_comment.read(),n=n||this.__patterns.smarty_literal.read(),n=n||this.__patterns.smarty.read()));return n},m.exports.TemplatablePattern=o},,,,function(m,g,s){var a=s(19).Beautifier,i=s(20).Options;function o(n,e,t,r){var T=new a(n,e,t,r);return T.beautify()}m.exports=o,m.exports.defaultOptions=function(){return new i}},function(m,g,s){var a=s(20).Options,i=s(2).Output,o=s(21).Tokenizer,n=s(21).TOKEN,e=/\r\n|[\r\n]/,t=/\r\n|[\r\n]/g,r=function(b,p){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 i(b,p)};r.prototype.current_line_has_match=function(b){return this._output.current_line.has_match(b)},r.prototype.set_space_before_token=function(b,p){this._output.space_before_token=b,this._output.non_breaking_space=p},r.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},r.prototype.add_raw_token=function(b){this._output.add_raw_token(b)},r.prototype.print_preserved_newlines=function(b){var p=0;b.type!==n.TEXT&&b.previous.type!==n.TEXT&&(p=b.newlines?1:0),this.preserve_newlines&&(p=b.newlines<this.max_preserve_newlines+1?b.newlines:this.max_preserve_newlines+1);for(var x=0;x<p;x++)this.print_newline(x>0);return p!==0},r.prototype.traverse_whitespace=function(b){return b.whitespace_before||b.newlines?(this.print_preserved_newlines(b)||(this._output.space_before_token=!0),!0):!1},r.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},r.prototype.print_newline=function(b){this._output.add_new_line(b)},r.prototype.print_token=function(b){b.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(b.text))},r.prototype.indent=function(){this.indent_level++},r.prototype.get_full_indent=function(b){return b=this.indent_level+(b||0),b<1?"":this._output.get_indent_string(b)};var T=function(b){for(var p=null,x=b.next;x.type!==n.EOF&&b.closed!==x;){if(x.type===n.ATTRIBUTE&&x.text==="type"){x.next&&x.next.type===n.EQUALS&&x.next.next&&x.next.next.type===n.VALUE&&(p=x.next.next.text);break}x=x.next}return p},v=function(b,p){var x=null,R=null;return p.closed?(b==="script"?x="text/javascript":b==="style"&&(x="text/css"),x=T(p)||x,x.search("text/css")>-1?R="css":x.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?R="javascript":x.search(/(text|application|dojo)\/(x-)?(html)/)>-1?R="html":x.search(/test\/null/)>-1&&(R="null"),R):null};function f(b,p){return p.indexOf(b)!==-1}function E(b,p,x){this.parent=b||null,this.tag=p?p.tag_name:"",this.indent_level=x||0,this.parser_token=p||null}function y(b){this._printer=b,this._current_frame=null}y.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},y.prototype.record_tag=function(b){var p=new E(this._current_frame,b,this._printer.indent_level);this._current_frame=p},y.prototype._try_pop_frame=function(b){var p=null;return b&&(p=b.parser_token,this._printer.indent_level=b.indent_level,this._current_frame=b.parent),p},y.prototype._get_frame=function(b,p){for(var x=this._current_frame;x&&!(b.indexOf(x.tag)!==-1);){if(p&&p.indexOf(x.tag)!==-1){x=null;break}x=x.parent}return x},y.prototype.try_pop=function(b,p){var x=this._get_frame([b],p);return this._try_pop_frame(x)},y.prototype.indent_to_tag=function(b){var p=this._get_frame(b);p&&(this._printer.indent_level=p.indent_level)};function u(b,p,x,R){this._source_text=b||"",p=p||{},this._js_beautify=x,this._css_beautify=R,this._tag_stack=null;var O=new a(p,"html");this._options=O,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"}u.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var b=this._source_text,p=this._options.eol;this._options.eol==="auto"&&(p=`
|
|
`,b&&e.test(b)&&(p=b.match(e)[0])),b=b.replace(t,`
|
|
`);var x=b.match(/^[\t ]*/)[0],R={text:"",type:""},O=new l,N=new r(this._options,x),U=new o(b,this._options).tokenize();this._tag_stack=new y(N);for(var W=null,P=U.next();P.type!==n.EOF;)P.type===n.TAG_OPEN||P.type===n.COMMENT?(W=this._handle_tag_open(N,P,O,R),O=W):P.type===n.ATTRIBUTE||P.type===n.EQUALS||P.type===n.VALUE||P.type===n.TEXT&&!O.tag_complete?W=this._handle_inside_tag(N,P,O,U):P.type===n.TAG_CLOSE?W=this._handle_tag_close(N,P,O):P.type===n.TEXT?W=this._handle_text(N,P,O):N.add_raw_token(P),R=W,P=U.next();var K=N._output.get_code(p);return K},u.prototype._handle_tag_close=function(b,p,x){var R={text:p.text,type:p.type};return b.alignment_size=0,x.tag_complete=!0,b.set_space_before_token(p.newlines||p.whitespace_before!=="",!0),x.is_unformatted?b.add_raw_token(p):(x.tag_start_char==="<"&&(b.set_space_before_token(p.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&x.has_wrapped_attrs&&b.print_newline(!1)),b.print_token(p)),x.indent_content&&!(x.is_unformatted||x.is_content_unformatted)&&(b.indent(),x.indent_content=!1),!x.is_inline_element&&!(x.is_unformatted||x.is_content_unformatted)&&b.set_wrap_point(),R},u.prototype._handle_inside_tag=function(b,p,x,R){var O=x.has_wrapped_attrs,N={text:p.text,type:p.type};if(b.set_space_before_token(p.newlines||p.whitespace_before!=="",!0),x.is_unformatted)b.add_raw_token(p);else if(x.tag_start_char==="{"&&p.type===n.TEXT)b.print_preserved_newlines(p)?(p.newlines=0,b.add_raw_token(p)):b.print_token(p);else{if(p.type===n.ATTRIBUTE?(b.set_space_before_token(!0),x.attr_count+=1):(p.type===n.EQUALS||p.type===n.VALUE&&p.previous.type===n.EQUALS)&&b.set_space_before_token(!1),p.type===n.ATTRIBUTE&&x.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(b.traverse_whitespace(p),O=O||p.newlines!==0),this._is_wrap_attributes_force)){var U=x.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&x.attr_count===1){var W=!0,P=0,K;do{if(K=R.peek(P),K.type===n.ATTRIBUTE){W=!1;break}P+=1}while(P<4&&K.type!==n.EOF&&K.type!==n.TAG_CLOSE);U=!W}U&&(b.print_newline(!1),O=!0)}b.print_token(p),O=O||b.previous_token_wrapped(),x.has_wrapped_attrs=O}return N},u.prototype._handle_text=function(b,p,x){var R={text:p.text,type:"TK_CONTENT"};return x.custom_beautifier_name?this._print_custom_beatifier_text(b,p,x):x.is_unformatted||x.is_content_unformatted?b.add_raw_token(p):(b.traverse_whitespace(p),b.print_token(p)),R},u.prototype._print_custom_beatifier_text=function(b,p,x){var R=this;if(p.text!==""){var O=p.text,N,U=1,W="",P="";x.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?N=this._js_beautify:x.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?N=this._css_beautify:x.custom_beautifier_name==="html"&&(N=function(oe,$){var Z=new u(oe,$,R._js_beautify,R._css_beautify);return Z.beautify()}),this._options.indent_scripts==="keep"?U=0:this._options.indent_scripts==="separate"&&(U=-b.indent_level);var K=b.get_full_indent(U);if(O=O.replace(/\n[ \t]*$/,""),x.custom_beautifier_name!=="html"&&O[0]==="<"&&O.match(/^(<!--|<!\[CDATA\[)/)){var V=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(O);if(!V){b.add_raw_token(p);return}W=K+V[1]+`
|
|
`,O=V[4],V[5]&&(P=K+V[5]),O=O.replace(/\n[ \t]*$/,""),(V[2]||V[3].indexOf(`
|
|
`)!==-1)&&(V=V[3].match(/[ \t]+$/),V&&(p.whitespace_before=V[0]))}if(O)if(N){var re=function(){this.eol=`
|
|
`};re.prototype=this._options.raw_options;var ee=new re;O=N(K+O,ee)}else{var le=p.whitespace_before;le&&(O=O.replace(new RegExp(`
|
|
(`+le+")?","g"),`
|
|
`)),O=K+O.replace(/\n/g,`
|
|
`+K)}W&&(O?O=W+O+`
|
|
`+P:O=W+P),b.print_newline(!1),O&&(p.text=O,p.whitespace_before="",p.newlines=0,b.add_raw_token(p),b.print_newline(!0))}},u.prototype._handle_tag_open=function(b,p,x,R){var O=this._get_tag_open_token(p);return(x.is_unformatted||x.is_content_unformatted)&&!x.is_empty_element&&p.type===n.TAG_OPEN&&p.text.indexOf("</")===0?(b.add_raw_token(p),O.start_tag_token=this._tag_stack.try_pop(O.tag_name)):(b.traverse_whitespace(p),this._set_tag_position(b,p,O,x,R),O.is_inline_element||b.set_wrap_point(),b.print_token(p)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(O.alignment_size=p.text.length+1),!O.tag_complete&&!O.is_unformatted&&(b.alignment_size=O.alignment_size),O};var l=function(b,p){if(this.parent=b||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!p)this.tag_complete=!0;else{var x;this.tag_start_char=p.text[0],this.text=p.text,this.tag_start_char==="<"?(x=p.text.match(/^<([^\s>]*)/),this.tag_check=x?x[1]:""):(x=p.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=x?x[1]:"",(p.text.startsWith("{{#>")||p.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&p.next!==null?this.tag_check=p.next.text.split(" ")[0]:this.tag_check=p.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),p.type===n.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||p.closed&&p.closed.text==="/>";var R=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(R=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(R)))}};u.prototype._get_tag_open_token=function(b){var p=new l(this._tag_stack.get_parser_token(),b);return p.alignment_size=this._options.wrap_attributes_indent_size,p.is_end_tag=p.is_end_tag||f(p.tag_check,this._options.void_elements),p.is_empty_element=p.tag_complete||p.is_start_tag&&p.is_end_tag,p.is_unformatted=!p.tag_complete&&f(p.tag_check,this._options.unformatted),p.is_content_unformatted=!p.is_empty_element&&f(p.tag_check,this._options.content_unformatted),p.is_inline_element=f(p.tag_name,this._options.inline)||p.tag_name.includes("-")||p.tag_start_char==="{",p},u.prototype._set_tag_position=function(b,p,x,R,O){if(x.is_empty_element||(x.is_end_tag?x.start_tag_token=this._tag_stack.try_pop(x.tag_name):(this._do_optional_end_element(x)&&(x.is_inline_element||b.print_newline(!1)),this._tag_stack.record_tag(x),(x.tag_name==="script"||x.tag_name==="style")&&!(x.is_unformatted||x.is_content_unformatted)&&(x.custom_beautifier_name=v(x.tag_check,p)))),f(x.tag_check,this._options.extra_liners)&&(b.print_newline(!1),b._output.just_added_blankline()||b.print_newline(!0)),x.is_empty_element){if(x.tag_start_char==="{"&&x.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),x.indent_content=!0;var N=b.current_line_has_match(/{{#if/);N||b.print_newline(!1)}x.tag_name==="!--"&&O.type===n.TAG_CLOSE&&R.is_end_tag&&x.text.indexOf(`
|
|
`)===-1||(x.is_inline_element||x.is_unformatted||b.print_newline(!1),this._calcluate_parent_multiline(b,x))}else if(x.is_end_tag){var U=!1;U=x.start_tag_token&&x.start_tag_token.multiline_content,U=U||!x.is_inline_element&&!(R.is_inline_element||R.is_unformatted)&&!(O.type===n.TAG_CLOSE&&x.start_tag_token===R)&&O.type!=="TK_CONTENT",(x.is_content_unformatted||x.is_unformatted)&&(U=!1),U&&b.print_newline(!1)}else x.indent_content=!x.custom_beautifier_name,x.tag_start_char==="<"&&(x.tag_name==="html"?x.indent_content=this._options.indent_inner_html:x.tag_name==="head"?x.indent_content=this._options.indent_head_inner_html:x.tag_name==="body"&&(x.indent_content=this._options.indent_body_inner_html)),!(x.is_inline_element||x.is_unformatted)&&(O.type!=="TK_CONTENT"||x.is_content_unformatted)&&b.print_newline(!1),this._calcluate_parent_multiline(b,x)},u.prototype._calcluate_parent_multiline=function(b,p){p.parent&&b._output.just_added_newline()&&!((p.is_inline_element||p.is_unformatted)&&p.parent.is_inline_element)&&(p.parent.multiline_content=!0)};var h=["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"],d=["a","audio","del","ins","map","noscript","video"];u.prototype._do_optional_end_element=function(b){var p=null;if(b.is_empty_element||!b.is_start_tag||!b.parent)return;if(b.tag_name==="body")p=p||this._tag_stack.try_pop("head");else if(b.tag_name==="li")p=p||this._tag_stack.try_pop("li",["ol","ul"]);else if(b.tag_name==="dd"||b.tag_name==="dt")p=p||this._tag_stack.try_pop("dt",["dl"]),p=p||this._tag_stack.try_pop("dd",["dl"]);else if(b.parent.tag_name==="p"&&h.indexOf(b.tag_name)!==-1){var x=b.parent.parent;(!x||d.indexOf(x.tag_name)===-1)&&(p=p||this._tag_stack.try_pop("p"))}else b.tag_name==="rp"||b.tag_name==="rt"?(p=p||this._tag_stack.try_pop("rt",["ruby","rtc"]),p=p||this._tag_stack.try_pop("rp",["ruby","rtc"])):b.tag_name==="optgroup"?p=p||this._tag_stack.try_pop("optgroup",["select"]):b.tag_name==="option"?p=p||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):b.tag_name==="colgroup"?p=p||this._tag_stack.try_pop("caption",["table"]):b.tag_name==="thead"?(p=p||this._tag_stack.try_pop("caption",["table"]),p=p||this._tag_stack.try_pop("colgroup",["table"])):b.tag_name==="tbody"||b.tag_name==="tfoot"?(p=p||this._tag_stack.try_pop("caption",["table"]),p=p||this._tag_stack.try_pop("colgroup",["table"]),p=p||this._tag_stack.try_pop("thead",["table"]),p=p||this._tag_stack.try_pop("tbody",["table"])):b.tag_name==="tr"?(p=p||this._tag_stack.try_pop("caption",["table"]),p=p||this._tag_stack.try_pop("colgroup",["table"]),p=p||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(b.tag_name==="th"||b.tag_name==="td")&&(p=p||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),p=p||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return b.parent=this._tag_stack.get_parser_token(),p},m.exports.Beautifier=u},function(m,g,s){var a=s(6).Options;function i(o){a.call(this,o,"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"])}i.prototype=new a,m.exports.Options=i},function(m,g,s){var a=s(9).Tokenizer,i=s(9).TOKEN,o=s(13).Directives,n=s(14).TemplatablePattern,e=s(12).Pattern,t={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:i.START,RAW:i.RAW,EOF:i.EOF},r=new o(/<\!--/,/-->/),T=function(v,f){a.call(this,v,f),this._current_tag_name="";var E=new n(this._input).read_options(this._options),y=new e(this._input);if(this.__patterns={word:E.until(/[\n\r\t <]/),single_quote:E.until_after(/'/),double_quote:E.until_after(/"/),attribute:E.until(/[\n\r\t =>]|\/>/),element_name:E.until(/[\n\r\t >\/]/),handlebars_comment:y.starting_with(/{{!--/).until_after(/--}}/),handlebars:y.starting_with(/{{/).until_after(/}}/),handlebars_open:y.until(/[\n\r\t }]/),handlebars_raw_close:y.until(/}}/),comment:y.starting_with(/<!--/).until_after(/-->/),cdata:y.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:y.starting_with(/<!\[/).until_after(/]>/),processing:y.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 u=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=y.matching(u).until_after(u)}};T.prototype=new a,T.prototype._is_comment=function(v){return!1},T.prototype._is_opening=function(v){return v.type===t.TAG_OPEN},T.prototype._is_closing=function(v,f){return v.type===t.TAG_CLOSE&&f&&((v.text===">"||v.text==="/>")&&f.text[0]==="<"||v.text==="}}"&&f.text[0]==="{"&&f.text[1]==="{")},T.prototype._reset=function(){this._current_tag_name=""},T.prototype._get_next_token=function(v,f){var E=null;this._readWhitespace();var y=this._input.peek();return y===null?this._create_token(t.EOF,""):(E=E||this._read_open_handlebars(y,f),E=E||this._read_attribute(y,v,f),E=E||this._read_close(y,f),E=E||this._read_raw_content(y,v,f),E=E||this._read_content_word(y),E=E||this._read_comment_or_cdata(y),E=E||this._read_processing(y),E=E||this._read_open(y,f),E=E||this._create_token(t.UNKNOWN,this._input.next()),E)},T.prototype._read_comment_or_cdata=function(v){var f=null,E=null,y=null;if(v==="<"){var u=this._input.peek(1);u==="!"&&(E=this.__patterns.comment.read(),E?(y=r.get_directives(E),y&&y.ignore==="start"&&(E+=r.readIgnored(this._input))):E=this.__patterns.cdata.read()),E&&(f=this._create_token(t.COMMENT,E),f.directives=y)}return f},T.prototype._read_processing=function(v){var f=null,E=null,y=null;if(v==="<"){var u=this._input.peek(1);(u==="!"||u==="?")&&(E=this.__patterns.conditional_comment.read(),E=E||this.__patterns.processing.read()),E&&(f=this._create_token(t.COMMENT,E),f.directives=y)}return f},T.prototype._read_open=function(v,f){var E=null,y=null;return f||v==="<"&&(E=this._input.next(),this._input.peek()==="/"&&(E+=this._input.next()),E+=this.__patterns.element_name.read(),y=this._create_token(t.TAG_OPEN,E)),y},T.prototype._read_open_handlebars=function(v,f){var E=null,y=null;return f||this._options.indent_handlebars&&v==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(E=this.__patterns.handlebars_comment.read(),E=E||this.__patterns.handlebars.read(),y=this._create_token(t.COMMENT,E)):(E=this.__patterns.handlebars_open.read(),y=this._create_token(t.TAG_OPEN,E))),y},T.prototype._read_close=function(v,f){var E=null,y=null;return f&&(f.text[0]==="<"&&(v===">"||v==="/"&&this._input.peek(1)===">")?(E=this._input.next(),v==="/"&&(E+=this._input.next()),y=this._create_token(t.TAG_CLOSE,E)):f.text[0]==="{"&&v==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),y=this._create_token(t.TAG_CLOSE,"}}"))),y},T.prototype._read_attribute=function(v,f,E){var y=null,u="";if(E&&E.text[0]==="<")if(v==="=")y=this._create_token(t.EQUALS,this._input.next());else if(v==='"'||v==="'"){var l=this._input.next();v==='"'?l+=this.__patterns.double_quote.read():l+=this.__patterns.single_quote.read(),y=this._create_token(t.VALUE,l)}else u=this.__patterns.attribute.read(),u&&(f.type===t.EQUALS?y=this._create_token(t.VALUE,u):y=this._create_token(t.ATTRIBUTE,u));return y},T.prototype._is_content_unformatted=function(v){return this._options.void_elements.indexOf(v)===-1&&(this._options.content_unformatted.indexOf(v)!==-1||this._options.unformatted.indexOf(v)!==-1)},T.prototype._read_raw_content=function(v,f,E){var y="";if(E&&E.text[0]==="{")y=this.__patterns.handlebars_raw_close.read();else if(f.type===t.TAG_CLOSE&&f.opened.text[0]==="<"&&f.text[0]!=="/"){var u=f.opened.text.substr(1).toLowerCase();if(u==="script"||u==="style"){var l=this._read_comment_or_cdata(v);if(l)return l.type=t.TEXT,l;y=this._input.readUntil(new RegExp("</"+u+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(u)&&(y=this._input.readUntil(new RegExp("</"+u+"[\\n\\r\\t ]*?>","ig")))}return y?this._create_token(t.TEXT,y):null},T.prototype._read_content_word=function(v){var f="";if(this._options.unformatted_content_delimiter&&(v===this._options.unformatted_content_delimiter[0]&&(f=this.__patterns.unformatted_content_delimiter.read())),f||(f=this.__patterns.word.read()),f)return this._create_token(t.TEXT,f)},m.exports.Tokenizer=T,m.exports.TOKEN=t}],M={};function w(m){var g=M[m];if(g!==void 0)return g.exports;var s=M[m]={exports:{}};return B[m](s,s.exports,w),s.exports}var S=w(18);C=S})();var j=C;if(!0)!(de=[J,J("6UM0"),J("TXwP")],H=function(B){var M=J("6UM0"),w=J("TXwP");return{html_beautify:function(S,m){return j(S,m,M.js_beautify,w.css_beautify)}}}.apply(We,de),H!==void 0&&(et.exports=H));else var L,A})()},"rAM+":function(et,We,J){"use strict";J.d(We,"a",function(){return H});var de=J("Qw5x");function H(C,j){var L;if(typeof Symbol=="undefined"||C[Symbol.iterator]==null){if(Array.isArray(C)||(L=Object(de.a)(C))||j&&C&&typeof C.length=="number"){L&&(C=L);var A=0,B=function(){};return{s:B,n:function(){return A>=C.length?{done:!0}:{done:!1,value:C[A++]}},e:function(g){throw g},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var M=!0,w=!1,S;return{s:function(){L=C[Symbol.iterator]()},n:function(){var g=L.next();return M=g.done,g},e:function(g){w=!0,S=g},f:function(){try{!M&&L.return!=null&&L.return()}finally{if(w)throw S}}}}},rUJ1:function(et,We){const J=/[&<>"']/,de=/[&<>"']/g,H=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,j={"&":"&","<":"<",">":">",'"':""","'":"'"},L=y=>j[y];function A(y,u){if(u){if(J.test(y))return y.replace(de,L)}else if(H.test(y))return y.replace(C,L);return y}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function M(y){return y.replace(B,(u,l)=>(l=l.toLowerCase(),l==="colon"?":":l.charAt(0)==="#"?l.charAt(1)==="x"?String.fromCharCode(parseInt(l.substring(2),16)):String.fromCharCode(+l.substring(1)):""))}const w=/(^|[^\[])\^/g;function S(y,u){y=y.source||y,u=u||"";const l={replace:(h,d)=>(d=d.source||d,d=d.replace(w,"$1"),y=y.replace(h,d),l),getRegex:()=>new RegExp(y,u)};return l}const m=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function s(y,u,l){if(y){let h;try{h=decodeURIComponent(M(l)).replace(m,"").toLowerCase()}catch(d){return null}if(h.indexOf("javascript:")===0||h.indexOf("vbscript:")===0||h.indexOf("data:")===0)return null}u&&!g.test(l)&&(l=e(u,l));try{l=encodeURI(l).replace(/%25/g,"%")}catch(h){return null}return l}const a={},i=/^[^:]+:\/*[^/]*$/,o=/^([^:]+:)[\s\S]*$/,n=/^([^:]+:\/*[^/]*)[\s\S]*$/;function e(y,u){a[" "+y]||(i.test(y)?a[" "+y]=y+"/":a[" "+y]=v(y,"/",!0)),y=a[" "+y];const l=y.indexOf(":")===-1;return u.substring(0,2)==="//"?l?u:y.replace(o,"$1")+u:u.charAt(0)==="/"?l?u:y.replace(n,"$1")+u:y+u}const t={exec:function(){}};function r(y){let u=1,l,h;for(;u<arguments.length;u++){l=arguments[u];for(h in l)Object.prototype.hasOwnProperty.call(l,h)&&(y[h]=l[h])}return y}function T(y,u){const l=y.replace(/\|/g,(b,p,x)=>{let R=!1,O=p;for(;--O>=0&&x[O]==="\\";)R=!R;return R?"|":" |"}),h=l.split(/ \|/);let d=0;if(h.length>u)h.splice(u);else for(;h.length<u;)h.push("");for(;d<h.length;d++)h[d]=h[d].trim().replace(/\\\|/g,"|");return h}function v(y,u,l){const h=y.length;if(h===0)return"";let d=0;for(;d<h;){const b=y.charAt(h-d-1);if(b===u&&!l)d++;else if(b!==u&&l)d++;else break}return y.substr(0,h-d)}function f(y,u){if(y.indexOf(u[1])===-1)return-1;const l=y.length;let h=0,d=0;for(;d<l;d++)if(y[d]==="\\")d++;else if(y[d]===u[0])h++;else if(y[d]===u[1]&&(h--,h<0))return d;return-1}function E(y){y&&y.sanitize&&!y.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}et.exports={escape:A,unescape:M,edit:S,cleanUrl:s,resolveUrl:e,noopTest:t,merge:r,splitCells:T,rtrim:v,findClosingBracket:f,checkSanitizeDeprecation:E}},sboe:function(et,We,J){"use strict";J.d(We,"a",function(){return C});var de=J("q1tI"),H=J.n(de),C=de.createContext(null)},ulZh:function(et,We,J){typeof window!="undefined"&&function(H,C){et.exports=C()}(this,function(){return function(de){var H={};function C(j){if(H[j])return H[j].exports;var L=H[j]={i:j,l:!1,exports:{}};return de[j].call(L.exports,L,L.exports,C),L.l=!0,L.exports}return C.m=de,C.c=H,C.d=function(j,L,A){C.o(j,L)||Object.defineProperty(j,L,{enumerable:!0,get:A})},C.r=function(j){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(j,"__esModule",{value:!0})},C.t=function(j,L){if(L&1&&(j=C(j)),L&8)return j;if(L&4&&typeof j=="object"&&j&&j.__esModule)return j;var A=Object.create(null);if(C.r(A),Object.defineProperty(A,"default",{enumerable:!0,value:j}),L&2&&typeof j!="string")for(var B in j)C.d(A,B,function(M){return j[M]}.bind(null,B));return A},C.n=function(j){var L=j&&j.__esModule?function(){return j.default}:function(){return j};return C.d(L,"a",L),L},C.o=function(j,L){return Object.prototype.hasOwnProperty.call(j,L)},C.p="/dist/",C(C.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(de,H,C){"use strict";var j=Object.prototype.hasOwnProperty,L="~";function A(){}Object.create&&(A.prototype=Object.create(null),new A().__proto__||(L=!1));function B(m,g,s){this.fn=m,this.context=g,this.once=s||!1}function M(m,g,s,a,i){if(typeof s!="function")throw new TypeError("The listener must be a function");var o=new B(s,a||m,i),n=L?L+g:g;return m._events[n]?m._events[n].fn?m._events[n]=[m._events[n],o]:m._events[n].push(o):(m._events[n]=o,m._eventsCount++),m}function w(m,g){--m._eventsCount===0?m._events=new A:delete m._events[g]}function S(){this._events=new A,this._eventsCount=0}S.prototype.eventNames=function(){var g=[],s,a;if(this._eventsCount===0)return g;for(a in s=this._events)j.call(s,a)&&g.push(L?a.slice(1):a);return Object.getOwnPropertySymbols?g.concat(Object.getOwnPropertySymbols(s)):g},S.prototype.listeners=function(g){var s=L?L+g:g,a=this._events[s];if(!a)return[];if(a.fn)return[a.fn];for(var i=0,o=a.length,n=new Array(o);i<o;i++)n[i]=a[i].fn;return n},S.prototype.listenerCount=function(g){var s=L?L+g:g,a=this._events[s];return a?a.fn?1:a.length:0},S.prototype.emit=function(g,s,a,i,o,n){var e=L?L+g:g;if(!this._events[e])return!1;var t=this._events[e],r=arguments.length,T,v;if(t.fn){t.once&&this.removeListener(g,t.fn,void 0,!0);switch(r){case 1:return t.fn.call(t.context),!0;case 2:return t.fn.call(t.context,s),!0;case 3:return t.fn.call(t.context,s,a),!0;case 4:return t.fn.call(t.context,s,a,i),!0;case 5:return t.fn.call(t.context,s,a,i,o),!0;case 6:return t.fn.call(t.context,s,a,i,o,n),!0}for(v=1,T=new Array(r-1);v<r;v++)T[v-1]=arguments[v];t.fn.apply(t.context,T)}else{var f=t.length,E;for(v=0;v<f;v++){t[v].once&&this.removeListener(g,t[v].fn,void 0,!0);switch(r){case 1:t[v].fn.call(t[v].context);break;case 2:t[v].fn.call(t[v].context,s);break;case 3:t[v].fn.call(t[v].context,s,a);break;case 4:t[v].fn.call(t[v].context,s,a,i);break;default:if(!T)for(E=1,T=new Array(r-1);E<r;E++)T[E-1]=arguments[E];t[v].fn.apply(t[v].context,T)}}}return!0},S.prototype.on=function(g,s,a){return M(this,g,s,a,!1)},S.prototype.once=function(g,s,a){return M(this,g,s,a,!0)},S.prototype.removeListener=function(g,s,a,i){var o=L?L+g:g;if(!this._events[o])return this;if(!s)return w(this,o),this;var n=this._events[o];if(n.fn)n.fn===s&&(!i||n.once)&&(!a||n.context===a)&&w(this,o);else{for(var e=0,t=[],r=n.length;e<r;e++)(n[e].fn!==s||i&&!n[e].once||a&&n[e].context!==a)&&t.push(n[e]);t.length?this._events[o]=t.length===1?t[0]:t:w(this,o)}return this},S.prototype.removeAllListeners=function(g){var s;return g?(s=L?L+g:g,this._events[s]&&w(this,s)):(this._events=new A,this._eventsCount=0),this},S.prototype.off=S.prototype.removeListener,S.prototype.addListener=S.prototype.on,S.prefixed=L,S.EventEmitter=S,de.exports=S},"./node_modules/url-toolkit/src/url-toolkit.js":function(de,H,C){(function(j){var L=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,A=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,M=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,w={buildAbsoluteURL:function(S,m,g){if(g=g||{},S=S.trim(),m=m.trim(),!m){if(!g.alwaysNormalize)return S;var s=w.parseURL(S);if(!s)throw new Error("Error trying to parse base URL.");return s.path=w.normalizePath(s.path),w.buildURLFromParts(s)}var a=w.parseURL(m);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return g.alwaysNormalize?(a.path=w.normalizePath(a.path),w.buildURLFromParts(a)):m;var i=w.parseURL(S);if(!i)throw new Error("Error trying to parse base URL.");if(!i.netLoc&&i.path&&i.path[0]!=="/"){var o=A.exec(i.path);i.netLoc=o[1],i.path=o[2]}i.netLoc&&!i.path&&(i.path="/");var n={scheme:i.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(n.netLoc=i.netLoc,a.path[0]!=="/"))if(!a.path)n.path=i.path,a.params||(n.params=i.params,a.query||(n.query=i.query));else{var e=i.path,t=e.substring(0,e.lastIndexOf("/")+1)+a.path;n.path=w.normalizePath(t)}return n.path===null&&(n.path=g.alwaysNormalize?w.normalizePath(a.path):a.path),w.buildURLFromParts(n)},parseURL:function(S){var m=L.exec(S);return m?{scheme:m[1]||"",netLoc:m[2]||"",path:m[3]||"",params:m[4]||"",query:m[5]||"",fragment:m[6]||""}:null},normalizePath:function(S){for(S=S.split("").reverse().join("").replace(B,"");S.length!==(S=S.replace(M,"")).length;);return S.split("").reverse().join("")},buildURLFromParts:function(S){return S.scheme+S.netLoc+S.path+S.params+S.query+S.fragment}};de.exports=w})(this)},"./node_modules/webworkify-webpack/index.js":function(de,H,C){function j(g){var s={};function a(o){if(s[o])return s[o].exports;var n=s[o]={i:o,l:!1,exports:{}};return g[o].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=g,a.c=s,a.i=function(o){return o},a.d=function(o,n,e){a.o(o,n)||Object.defineProperty(o,n,{configurable:!1,enumerable:!0,get:e})},a.r=function(o){Object.defineProperty(o,"__esModule",{value:!0})},a.n=function(o){var n=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(n,"a",n),n},a.o=function(o,n){return Object.prototype.hasOwnProperty.call(o,n)},a.p="/",a.oe=function(o){throw console.error(o),o};var i=a(a.s=ENTRY_MODULE);return i.default||i}var L="[\\.|\\-|\\+|\\w|/|@]+",A="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+L+").*?\\)";function B(g){return(g+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function M(g){return!isNaN(1*g)}function w(g,s,a){var i={};i[a]=[];var o=s.toString(),n=o.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!n)return i;for(var e=n[1],t=new RegExp("(\\\\n|\\W)"+B(e)+A,"g"),r;r=t.exec(o);){if(r[3]==="dll-reference")continue;i[a].push(r[3])}for(t=new RegExp("\\("+B(e)+'\\("(dll-reference\\s('+L+'))"\\)\\)'+A,"g");r=t.exec(o);)g[r[2]]||(i[a].push(r[1]),g[r[2]]=C(r[1]).m),i[r[2]]=i[r[2]]||[],i[r[2]].push(r[4]);for(var T=Object.keys(i),v=0;v<T.length;v++)for(var f=0;f<i[T[v]].length;f++)M(i[T[v]][f])&&(i[T[v]][f]=1*i[T[v]][f]);return i}function S(g){var s=Object.keys(g);return s.reduce(function(a,i){return a||g[i].length>0},!1)}function m(g,s){for(var a={main:[s]},i={main:[]},o={main:{}};S(a);)for(var n=Object.keys(a),e=0;e<n.length;e++){var t=n[e],r=a[t],T=r.pop();if(o[t]=o[t]||{},o[t][T]||!g[t][T])continue;o[t][T]=!0,i[t]=i[t]||[],i[t].push(T);for(var v=w(g,g[t][T],t),f=Object.keys(v),E=0;E<f.length;E++)a[f[E]]=a[f[E]]||[],a[f[E]]=a[f[E]].concat(v[f[E]])}return i}de.exports=function(g,s){s=s||{};var a={main:C.m},i=s.all?{main:Object.keys(a.main)}:m(a,g),o="";Object.keys(i).filter(function(T){return T!=="main"}).forEach(function(T){for(var v=0;i[T][v];)v++;i[T].push(v),a[T][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+T+" = ("+j.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+i[T].map(function(f){return""+JSON.stringify(f)+": "+a[T][f].toString()}).join(",")+`});
|
|
`}),o=o+"new (("+j.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+i.main.map(function(T){return""+JSON.stringify(T)+": "+a.main[T].toString()}).join(",")+"}))(self);";var n=new window.Blob([o],{type:"text/javascript"});if(s.bare)return n;var e=window.URL||window.webkitURL||window.mozURL||window.msURL,t=e.createObjectURL(n),r=new window.Worker(t);return r.objectURL=t,r}},"./src/config.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"hlsDefaultConfig",function(){return E}),C.d(H,"mergeConfig",function(){return u}),C.d(H,"enableStreamingMode",function(){return l});var j=C("./src/controller/abr-controller.ts"),L=C("./src/controller/audio-stream-controller.ts"),A=C("./src/controller/audio-track-controller.ts"),B=C("./src/controller/subtitle-stream-controller.ts"),M=C("./src/controller/subtitle-track-controller.ts"),w=C("./src/controller/buffer-controller.ts"),S=C("./src/controller/timeline-controller.ts"),m=C("./src/controller/cap-level-controller.ts"),g=C("./src/controller/fps-controller.ts"),s=C("./src/controller/eme-controller.ts"),a=C("./src/controller/cmcd-controller.ts"),i=C("./src/utils/xhr-loader.ts"),o=C("./src/utils/fetch-loader.ts"),n=C("./src/utils/cues.ts"),e=C("./src/utils/mediakeys-helper.ts"),t=C("./src/utils/logger.ts");function r(){return r=Object.assign||function(h){for(var d=1;d<arguments.length;d++){var b=arguments[d];for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(h[p]=b[p])}return h},r.apply(this,arguments)}function T(h,d){var b=Object.keys(h);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(h);d&&(p=p.filter(function(x){return Object.getOwnPropertyDescriptor(h,x).enumerable})),b.push.apply(b,p)}return b}function v(h){for(var d=1;d<arguments.length;d++){var b=arguments[d]!=null?arguments[d]:{};d%2?T(Object(b),!0).forEach(function(p){f(h,p,b[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(b)):T(Object(b)).forEach(function(p){Object.defineProperty(h,p,Object.getOwnPropertyDescriptor(b,p))})}return h}function f(h,d,b){return d in h?Object.defineProperty(h,d,{value:b,enumerable:!0,configurable:!0,writable:!0}):h[d]=b,h}var E=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:i.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:j.default,bufferController:w.default,capLevelController:m.default,fpsController:g.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:e.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},y()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:M.default,timelineController:S.TimelineController,audioStreamController:L.default,audioTrackController:A.default,emeController:s.default,cmcdController:a.default});function y(){return{cueHandler:n.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function u(h,d){if((d.liveSyncDurationCount||d.liveMaxLatencyDurationCount)&&(d.liveSyncDuration||d.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(d.liveMaxLatencyDurationCount!==void 0&&(d.liveSyncDurationCount===void 0||d.liveMaxLatencyDurationCount<=d.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(d.liveMaxLatencyDuration!==void 0&&(d.liveSyncDuration===void 0||d.liveMaxLatencyDuration<=d.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return r({},h,d)}function l(h){var d=h.loader;if(d!==o.default&&d!==i.default)t.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1;else{var b=Object(o.fetchSupported)();b&&(h.loader=o.default,h.progressive=!0,h.enableSoftwareAES=!0,t.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/polyfills/number.ts"),L=C("./src/utils/ewma-bandwidth-estimator.ts"),A=C("./src/events.ts"),B=C("./src/utils/buffer-helper.ts"),M=C("./src/errors.ts"),w=C("./src/types/loader.ts"),S=C("./src/utils/logger.ts");function m(a,i){for(var o=0;o<i.length;o++){var n=i[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(a,n.key,n)}}function g(a,i,o){return i&&m(a.prototype,i),o&&m(a,o),a}var s=function(){function a(o){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=o;var n=o.config;this.bwEstimator=new L.default(n.abrEwmaSlowVoD,n.abrEwmaFastVoD,n.abrEwmaDefaultEstimate),this.registerListeners()}var i=a.prototype;return i.registerListeners=function(){var n=this.hls;n.on(A.Events.FRAG_LOADING,this.onFragLoading,this),n.on(A.Events.FRAG_LOADED,this.onFragLoaded,this),n.on(A.Events.FRAG_BUFFERED,this.onFragBuffered,this),n.on(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(A.Events.ERROR,this.onError,this)},i.unregisterListeners=function(){var n=this.hls;n.off(A.Events.FRAG_LOADING,this.onFragLoading,this),n.off(A.Events.FRAG_LOADED,this.onFragLoaded,this),n.off(A.Events.FRAG_BUFFERED,this.onFragBuffered,this),n.off(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(A.Events.ERROR,this.onError,this)},i.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},i.onFragLoading=function(n,e){var t=e.frag;if(t.type===w.PlaylistLevelType.MAIN&&!this.timer){var r;this.fragCurrent=t,this.partCurrent=(r=e.part)!=null?r:null,this.timer=self.setInterval(this.onCheck,100)}},i.onLevelLoaded=function(n,e){var t=this.hls.config;e.details.live?this.bwEstimator.update(t.abrEwmaSlowLive,t.abrEwmaFastLive):this.bwEstimator.update(t.abrEwmaSlowVoD,t.abrEwmaFastVoD)},i._abandonRulesCheck=function(){var n=this.fragCurrent,e=this.partCurrent,t=this.hls,r=t.autoLevelEnabled,T=t.config,v=t.media;if(!n||!v)return;var f=e?e.stats:n.stats,E=e?e.duration:n.duration;if(f.aborted){S.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!r||v.paused||!v.playbackRate||!v.readyState)return;var y=performance.now()-f.loading.start,u=Math.abs(v.playbackRate);if(y<=500*E/u)return;var l=t.levels,h=t.minAutoLevel,d=l[n.level],b=f.total||Math.max(f.loaded,Math.round(E*d.maxBitrate/8)),p=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/y),x=(b-f.loaded)/p,R=v.currentTime,O=(B.BufferHelper.bufferInfo(v,R,T.maxBufferHole).end-R)/u;if(O>=2*E/u||x<=O)return;var N=Number.POSITIVE_INFINITY,U;for(U=n.level-1;U>h;U--){var W=l[U].maxBitrate;if(N=E*W/(8*.8*p),N<O)break}if(N>=x)return;var P=this.bwEstimator.getEstimate();S.logger.warn("Fragment "+n.sn+(e?" part "+e.index:"")+" of level "+n.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+U+`
|
|
Current BW estimate: `+(Object(j.isFiniteNumber)(P)?(P/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+x.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+N.toFixed(3)+` s
|
|
Time to underbuffer: `+O.toFixed(3)+" s"),t.nextLoadLevel=U,this.bwEstimator.sample(y,f.loaded),this.clearTimer(),n.loader&&(this.fragCurrent=this.partCurrent=null,n.loader.abort()),t.trigger(A.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:e,stats:f})},i.onFragLoaded=function(n,e){var t=e.frag,r=e.part;if(t.type===w.PlaylistLevelType.MAIN&&Object(j.isFiniteNumber)(t.sn)){var T=r?r.stats:t.stats,v=r?r.duration:t.duration;if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[t.level],E=(f.loaded?f.loaded.bytes:0)+T.loaded,y=(f.loaded?f.loaded.duration:0)+v;f.loaded={bytes:E,duration:y},f.realBitrate=Math.round(8*E/y)}if(t.bitrateTest){var u={stats:T,frag:t,part:r,id:t.type};this.onFragBuffered(A.Events.FRAG_BUFFERED,u),t.bitrateTest=!1}}},i.onFragBuffered=function(n,e){var t=e.frag,r=e.part,T=r?r.stats:t.stats;if(T.aborted)return;if(t.type!==w.PlaylistLevelType.MAIN||t.sn==="initSegment")return;var v=T.parsing.end-T.loading.start;this.bwEstimator.sample(v,T.loaded),T.bwEstimate=this.bwEstimator.getEstimate(),t.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},i.onError=function(n,e){switch(e.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},i.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},i.getNextABRAutoLevel=function(){var n=this.fragCurrent,e=this.partCurrent,t=this.hls,r=t.maxAutoLevel,T=t.config,v=t.minAutoLevel,f=t.media,E=e?e.duration:n?n.duration:0,y=f?f.currentTime:0,u=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,l=this.bwEstimator?this.bwEstimator.getEstimate():T.abrEwmaDefaultEstimate,h=(B.BufferHelper.bufferInfo(f,y,T.maxBufferHole).end-y)/u,d=this.findBestLevel(l,v,r,h,T.abrBandWidthFactor,T.abrBandWidthUpFactor);if(d>=0)return d;S.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=E?Math.min(E,T.maxStarvationDelay):T.maxStarvationDelay,p=T.abrBandWidthFactor,x=T.abrBandWidthUpFactor;if(!h){var R=this.bitrateTestDelay;if(R){var O=E?Math.min(E,T.maxLoadingDelay):T.maxLoadingDelay;b=O-R,S.logger.trace("bitrate test took "+Math.round(1e3*R)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),p=x=1}}return d=this.findBestLevel(l,v,r,h+b,p,x),Math.max(d,0)},i.findBestLevel=function(n,e,t,r,T,v){for(var f,E=this.fragCurrent,y=this.partCurrent,u=this.lastLoadedFragLevel,l=this.hls.levels,h=l[u],d=!!(h!=null&&(f=h.details)!==null&&f!==void 0&&f.live),b=h==null?void 0:h.codecSet,p=y?y.duration:E?E.duration:0,x=t;x>=e;x--){var R=l[x];if(!R||b&&R.codecSet!==b)continue;var O=R.details,N=(y?O==null?void 0:O.partTarget:O==null?void 0:O.averagetargetduration)||p,U=void 0;x<=u?U=T*n:U=v*n;var W=l[x].maxBitrate,P=W*N/U;if(S.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(U)+"/"+W+"/"+N+"/"+r+"/"+P),U>W&&(!P||d&&!this.bitrateTestDelay||P<r))return x}return-1},g(a,[{key:"nextAutoLevel",get:function(){var n=this._nextAutoLevel,e=this.bwEstimator;if(n!==-1&&(!e||!e.canEstimate()))return n;var t=this.getNextABRAutoLevel();return n!==-1&&(t=Math.min(n,t)),t},set:function(n){this._nextAutoLevel=n}}]),a}();H.default=s},"./src/controller/audio-stream-controller.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/polyfills/number.ts"),L=C("./src/controller/base-stream-controller.ts"),A=C("./src/events.ts"),B=C("./src/utils/buffer-helper.ts"),M=C("./src/controller/fragment-tracker.ts"),w=C("./src/types/level.ts"),S=C("./src/types/loader.ts"),m=C("./src/loader/fragment.ts"),g=C("./src/demux/chunk-cache.ts"),s=C("./src/demux/transmuxer-interface.ts"),a=C("./src/types/transmuxer.ts"),i=C("./src/controller/fragment-finders.ts"),o=C("./src/utils/discontinuities.ts"),n=C("./src/errors.ts"),e=C("./src/utils/logger.ts");function t(){return t=Object.assign||function(E){for(var y=1;y<arguments.length;y++){var u=arguments[y];for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(E[l]=u[l])}return E},t.apply(this,arguments)}function r(E,y){E.prototype=Object.create(y.prototype),E.prototype.constructor=E,T(E,y)}function T(E,y){return T=Object.setPrototypeOf||function(l,h){return l.__proto__=h,l},T(E,y)}var v=100,f=function(E){r(y,E);function y(l,h){var d;return d=E.call(this,l,h,"[audio-stream-controller]")||this,d.videoBuffer=null,d.videoTrackCC=-1,d.waitingVideoCC=-1,d.audioSwitch=!1,d.trackId=-1,d.waitingData=null,d.mainDetails=null,d.bufferFlushed=!1,d._registerListeners(),d}var u=y.prototype;return u.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},u._registerListeners=function(){var h=this.hls;h.on(A.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(A.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(A.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(A.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.on(A.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(A.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(A.Events.ERROR,this.onError,this),h.on(A.Events.BUFFER_RESET,this.onBufferReset,this),h.on(A.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(A.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(A.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.on(A.Events.FRAG_BUFFERED,this.onFragBuffered,this)},u._unregisterListeners=function(){var h=this.hls;h.off(A.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(A.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(A.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(A.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.off(A.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(A.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(A.Events.ERROR,this.onError,this),h.off(A.Events.BUFFER_RESET,this.onBufferReset,this),h.off(A.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(A.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(A.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(A.Events.FRAG_BUFFERED,this.onFragBuffered,this)},u.onInitPtsFound=function(h,d){var b=d.frag,p=d.id,x=d.initPTS;if(p==="main"){var R=b.cc;this.initPTS[b.cc]=x,this.log("InitPTS for cc: "+R+" found from main: "+x),this.videoTrackCC=R,this.state===L.State.WAITING_INIT_PTS&&this.tick()}},u.startLoad=function(h){if(!this.levels){this.startPosition=h,this.state=L.State.STOPPED;return}var d=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,d>0&&h===-1?(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),this.state=L.State.IDLE):(this.loadedmetadata=!1,this.state=L.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()},u.doTick=function(){switch(this.state){case L.State.IDLE:this.doTickIdle();break;case L.State.WAITING_TRACK:{var h,d=this.levels,b=this.trackId,p=d==null||((h=d[b])===null||h===void 0)?void 0:h.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=L.State.WAITING_INIT_PTS}break}case L.State.FRAG_LOADING_WAITING_RETRY:{var x,R=performance.now(),O=this.retryDate;(!O||R>=O||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=L.State.IDLE);break}case L.State.WAITING_INIT_PTS:{var N=this.waitingData;if(N){var U=N.frag,W=N.part,P=N.cache,K=N.complete;if(this.initPTS[U.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=L.State.FRAG_LOADING;var V=P.flush(),re={frag:U,part:W,payload:V,networkDetails:null};this._handleFragmentLoadProgress(re),K&&E.prototype._handleFragmentLoadComplete.call(this,re)}else if(this.videoTrackCC!==this.waitingVideoCC)e.logger.log("Waiting fragment cc ("+U.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ee=this.getLoadPosition(),le=B.BufferHelper.bufferInfo(this.mediaBuffer,ee,this.config.maxBufferHole),oe=Object(i.fragmentWithinToleranceTest)(le.end,this.config.maxFragLookUpTolerance,U);oe<0&&(e.logger.log("Waiting fragment cc ("+U.cc+") @ "+U.start+" cancelled because another fragment at "+le.end+" is needed"),this.clearWaitingFragment())}}else this.state=L.State.IDLE}}this.onTickEnd()},u.clearWaitingFragment=function(){var h=this.waitingData;h&&(this.fragmentTracker.removeFragment(h.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=L.State.IDLE)},u.onTickEnd=function(){var h=this.media;if(!h||!h.readyState)return;var d=this.mediaBuffer?this.mediaBuffer:h,b=d.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=h.currentTime},u.doTickIdle=function(){var h,d,b=this.hls,p=this.levels,x=this.media,R=this.trackId,O=b.config;if(!p||!p[R])return;if(!x&&(this.startFragRequested||!O.startFragPrefetch))return;var N=p[R],U=N.details;if(!U||U.live&&this.levelLastLoaded!==R||this.waitForCdnTuneIn(U)){this.state=L.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,m.ElementaryStreamTypes.AUDIO,S.PlaylistLevelType.AUDIO));var W=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,S.PlaylistLevelType.AUDIO);if(W===null)return;var P=W.len,K=this.getMaxBufferLength(),V=this.audioSwitch;if(P>=K&&!V)return;if(!V&&this._streamEnded(W,U)){b.trigger(A.Events.BUFFER_EOS,{type:"audio"}),this.state=L.State.ENDED;return}var re=U.fragments,ee=re[0].start,le=W.end;if(V){var oe=this.getLoadPosition();le=oe,U.PTSKnown&&oe<ee&&((W.end>ee||W.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=ee+.05))}var $=this.getNextFragment(le,U);if(!$){this.bufferFlushed=!0;return}((h=$.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((d=$.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey($,U):this.loadFragment($,U,le)},u.getMaxBufferLength=function(){var h=E.prototype.getMaxBufferLength.call(this),d=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,S.PlaylistLevelType.MAIN);return d===null?h:Math.max(h,d.len)},u.onMediaDetaching=function(){this.videoBuffer=null,E.prototype.onMediaDetaching.call(this)},u.onAudioTracksUpdated=function(h,d){var b=d.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(p){return new w.Level(p)})},u.onAudioTrackSwitching=function(h,d){var b=!!d.url;this.trackId=d.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(v):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=L.State.IDLE):this.state=L.State.STOPPED,this.tick()},u.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},u.onLevelLoaded=function(h,d){this.mainDetails=d.details},u.onAudioTrackLoaded=function(h,d){var b,p=this.levels,x=d.details,R=d.id;if(!p){this.warn("Audio tracks were reset while loading level "+R);return}this.log("Track "+R+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var O=p[R],N=0;if(x.live||(b=O.details)!==null&&b!==void 0&&b.live){var U=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!U)return;!O.details&&x.hasProgramDateTime&&U.hasProgramDateTime?(Object(o.alignMediaPlaylistByPDT)(x,U),N=x.fragments[0].start):N=this.alignPlaylists(x,O.details)}O.details=x,this.levelLastLoaded=R,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(O.details,N),this.state===L.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=L.State.IDLE),this.tick()},u._handleFragmentLoadProgress=function(h){var d,b=h.frag,p=h.part,x=h.payload,R=this.config,O=this.trackId,N=this.levels;if(!N){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 U=N[O];console.assert(U,"Audio track is defined on fragment load progress");var W=U.details;console.assert(W,"Audio track details are defined on fragment load progress");var P=R.defaultAudioCodec||U.audioCodec||"mp4a.40.2",K=this.transmuxer;K||(K=this.transmuxer=new s.default(this.hls,S.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var V=this.initPTS[b.cc],re=(d=b.initSegment)===null||d===void 0?void 0:d.data;if(V!==void 0){var ee=!1,le=p?p.index:-1,oe=le!==-1,$=new a.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,x.byteLength,le,oe);K.push(x,re,P,"",b,p,W.totalduration,ee,$,V)}else{e.logger.log("Unknown video PTS for cc "+b.cc+", waiting for video PTS before demuxing audio frag "+b.sn+" of ["+W.startSN+" ,"+W.endSN+"],track "+O);var Z=this.waitingData=this.waitingData||{frag:b,part:p,cache:new g.default,complete:!1},ne=Z.cache;ne.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=L.State.WAITING_INIT_PTS}},u._handleFragmentLoadComplete=function(h){if(this.waitingData){this.waitingData.complete=!0;return}E.prototype._handleFragmentLoadComplete.call(this,h)},u.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},u.onBufferCreated=function(h,d){var b=d.tracks.audio;b&&(this.mediaBuffer=b.buffer),d.tracks.video&&(this.videoBuffer=d.tracks.video.buffer)},u.onFragBuffered=function(h,d){var b=d.frag,p=d.part;if(b.type!==S.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(p?" p: "+p.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(A.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,p)},u.onError=function(h,d){switch(d.details){case n.ErrorDetails.FRAG_LOAD_ERROR:case n.ErrorDetails.FRAG_LOAD_TIMEOUT:case n.ErrorDetails.KEY_LOAD_ERROR:case n.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.AUDIO,d);break;case n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case n.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==L.State.ERROR&&this.state!==L.State.STOPPED&&(this.state=d.fatal?L.State.ERROR:L.State.IDLE,this.warn(d.details+" while loading frag, switching to "+this.state+" state"));break;case n.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="audio"&&(this.state===L.State.PARSING||this.state===L.State.PARSED)){var b=!0,p=this.getFwdBufferInfo(this.mediaBuffer,S.PlaylistLevelType.AUDIO);p&&p.len>.5&&(b=!this.reduceMaxBufferLength(p.len)),b&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,E.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},u.onBufferFlushed=function(h,d){var b=d.type;b===m.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},u._handleTransmuxComplete=function(h){var d,b="audio",p=this.hls,x=h.remuxResult,R=h.chunkMeta,O=this.getCurrentContext(R);if(!O){this.warn("The loading context changed while buffering fragment "+R.sn+" of level "+R.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(R.level);return}var N=O.frag,U=O.part,W=x.audio,P=x.text,K=x.id3,V=x.initSegment;if(this.fragContextChanged(N))return;if(this.state=L.State.PARSING,this.audioSwitch&&W&&this.completeAudioSwitch(),V!=null&&V.tracks&&(this._bufferInitSegment(V.tracks,N,R),p.trigger(A.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:b,tracks:V.tracks})),W){var re=W.startPTS,ee=W.endPTS,le=W.startDTS,oe=W.endDTS;U&&(U.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:re,endPTS:ee,startDTS:le,endDTS:oe}),N.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,re,ee,le,oe),this.bufferFragmentData(W,N,U,R)}if(K!=null&&(d=K.samples)!==null&&d!==void 0&&d.length){var $=t({frag:N,id:b},K);p.trigger(A.Events.FRAG_PARSING_METADATA,$)}if(P){var Z=t({frag:N,id:b},P);p.trigger(A.Events.FRAG_PARSING_USERDATA,Z)}},u._bufferInitSegment=function(h,d,b){if(this.state!==L.State.PARSING)return;h.video&&delete h.video;var p=h.audio;if(!p)return;p.levelCodec=p.codec,p.id="audio",this.log("Init audio buffer, container:"+p.container+", codecs[parsed]=["+p.codec+"]"),this.hls.trigger(A.Events.BUFFER_CODECS,h);var x=p.initSegment;if(x!=null&&x.byteLength){var R={type:"audio",frag:d,part:null,chunkMeta:b,parent:d.type,data:x};this.hls.trigger(A.Events.BUFFER_APPENDING,R)}this.tick()},u.loadFragment=function(h,d,b){var p=this.fragmentTracker.getState(h);this.fragCurrent=h,(this.audioSwitch||p===M.FragmentState.NOT_LOADED||p===M.FragmentState.PARTIAL)&&(h.sn==="initSegment"?this._loadInitSegment(h):d.live&&!Object(j.isFiniteNumber)(this.initPTS[h.cc])?(this.log("Waiting for video PTS in continuity counter "+h.cc+" of live stream before loading audio fragment "+h.sn+" of level "+this.trackId),this.state=L.State.WAITING_INIT_PTS):(this.startFragRequested=!0,E.prototype.loadFragment.call(this,h,d,b)))},u.completeAudioSwitch=function(){var h=this.hls,d=this.media,b=this.trackId;d&&(this.log("Switching audio track : flushing all audio"),E.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,h.trigger(A.Events.AUDIO_TRACK_SWITCHED,{id:b})},y}(L.default);H.default=f},"./src/controller/audio-track-controller.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/events.ts"),L=C("./src/errors.ts"),A=C("./src/controller/base-playlist-controller.ts"),B=C("./src/types/loader.ts");function M(s,a){for(var i=0;i<a.length;i++){var o=a[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(s,o.key,o)}}function w(s,a,i){return a&&M(s.prototype,a),i&&M(s,i),s}function S(s,a){s.prototype=Object.create(a.prototype),s.prototype.constructor=s,m(s,a)}function m(s,a){return m=Object.setPrototypeOf||function(o,n){return o.__proto__=n,o},m(s,a)}var g=function(s){S(a,s);function a(o){var n;return n=s.call(this,o,"[audio-track-controller]")||this,n.tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.trackName="",n.selectDefaultTrack=!0,n.registerListeners(),n}var i=a.prototype;return i.registerListeners=function(){var n=this.hls;n.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(j.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.on(j.Events.ERROR,this.onError,this)},i.unregisterListeners=function(){var n=this.hls;n.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(j.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(j.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.off(j.Events.ERROR,this.onError,this)},i.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,s.prototype.destroy.call(this)},i.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},i.onManifestParsed=function(n,e){this.tracks=e.audioTracks||[]},i.onAudioTrackLoaded=function(n,e){var t=e.id,r=e.details,T=this.tracksInGroup[t];if(!T){this.warn("Invalid audio track id "+t);return}var v=T.details;T.details=e.details,this.log("audioTrack "+t+" loaded ["+r.startSN+"-"+r.endSN+"]"),t===this.trackId&&(this.retryCount=0,this.playlistLoaded(t,e,v))},i.onLevelLoading=function(n,e){this.switchLevel(e.level)},i.onLevelSwitching=function(n,e){this.switchLevel(e.level)},i.switchLevel=function(n){var e=this.hls.levels[n];if(!(e!=null&&e.audioGroupIds))return;var t=e.audioGroupIds[e.urlId];if(this.groupId!==t){this.groupId=t;var r=this.tracks.filter(function(v){return!t||v.groupId===t});this.selectDefaultTrack&&!r.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=r;var T={audioTracks:r};this.log("Updating audio tracks, "+r.length+' track(s) found in "'+t+'" group-id'),this.hls.trigger(j.Events.AUDIO_TRACKS_UPDATED,T),this.selectInitialTrack()}},i.onError=function(n,e){if(s.prototype.onError.call(this,n,e),e.fatal||!e.context)return;e.context.type===B.PlaylistContextType.AUDIO_TRACK&&e.context.id===this.trackId&&e.context.groupId===this.groupId&&this.retryLoadingOrFail(e)},i.setAudioTrack=function(n){var e=this.tracksInGroup;if(n<0||n>=e.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var t=e[this.trackId];this.log("Now switching to audio-track index "+n);var r=e[n],T=r.id,v=r.groupId,f=v===void 0?"":v,E=r.name,y=r.type,u=r.url;if(this.trackId=n,this.trackName=E,this.selectDefaultTrack=!1,this.hls.trigger(j.Events.AUDIO_TRACK_SWITCHING,{id:T,groupId:f,name:E,type:y,url:u}),r.details&&!r.details.live)return;var l=this.switchParams(r.url,t==null?void 0:t.details);this.loadPlaylist(l)},i.selectInitialTrack=function(){var n=this.tracksInGroup;console.assert(n.length,"Initial audio track should be selected when tracks are known");var e=this.trackName,t=this.findTrackId(e)||this.findTrackId();t!==-1?this.setAudioTrack(t):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},i.findTrackId=function(n){for(var e=this.tracksInGroup,t=0;t<e.length;t++){var r=e[t];if((!this.selectDefaultTrack||r.default)&&(!n||n===r.name))return r.id}return-1},i.loadPlaylist=function(n){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var t=e.id,r=e.groupId,T=e.url;if(n)try{T=n.addDirectives(T)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+t),this.clearTimer(),this.hls.trigger(j.Events.AUDIO_TRACK_LOADING,{url:T,id:t,groupId:r,deliveryDirectives:n||null})}},w(a,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(n){this.selectDefaultTrack=!1,this.setAudioTrack(n)}}]),a}(A.default);H.default=g},"./src/controller/base-playlist-controller.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return w});var j=C("./src/polyfills/number.ts"),L=C("./src/types/level.ts"),A=C("./src/controller/level-helper.ts"),B=C("./src/utils/logger.ts"),M=C("./src/errors.ts"),w=function(){function S(g,s){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,s+":"),this.warn=B.logger.warn.bind(B.logger,s+":"),this.hls=g}var m=S.prototype;return m.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},m.onError=function(s,a){a.fatal&&a.type===M.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},m.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},m.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},m.stopLoad=function(){this.canLoad=!1,this.clearTimer()},m.switchParams=function(s,a){var i=a==null?void 0:a.renditionReports;if(i)for(var o=0;o<i.length;o++){var n=i[o],e=""+n.URI;if(e===s.substr(-e.length)){var t=parseInt(n["LAST-MSN"]),r=parseInt(n["LAST-PART"]);if(a&&this.hls.config.lowLatencyMode){var T=Math.min(a.age-a.partTarget,a.targetduration);r!==void 0&&T>a.partTarget&&(r+=1)}if(Object(j.isFiniteNumber)(t))return new L.HlsUrlParameters(t,Object(j.isFiniteNumber)(r)?r:void 0,L.HlsSkip.No)}}},m.loadPlaylist=function(s){},m.shouldLoadTrack=function(s){return this.canLoad&&s&&!!s.url&&(!s.details||s.details.live)},m.playlistLoaded=function(s,a,i){var o=this,n=a.details,e=a.stats,t=e.loading.end?Math.max(0,self.performance.now()-e.loading.end):0;if(n.advancedDateTime=Date.now()-t,n.live||i!=null&&i.live){if(n.reloaded(i),i&&this.log("live playlist "+s+" "+(n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:"MISSED")),i&&n.fragments.length>0&&Object(A.mergeDetails)(i,n),!this.canLoad||!n.live)return;var r,T=void 0,v=void 0;if(n.canBlockReload&&n.endSN&&n.advanced){var f=this.hls.config.lowLatencyMode,E=n.lastPartSn,y=n.endSN,u=n.lastPartIndex,l=u!==-1,h=E===y,d=f?0:u;l?(T=h?y+1:E,v=h?d:u+1):T=y+1;var b=n.age,p=b+n.ageHeader,x=Math.min(p-n.partTarget,n.targetduration*1.5);if(x>0){if(i&&x>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+x+" with playlist age: "+n.age),x=0;else{var R=Math.floor(x/n.targetduration);if(T+=R,v!==void 0){var O=Math.round(x%n.targetduration/n.partTarget);v+=O}this.log("CDN Tune-in age: "+n.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+x+" skip sn "+R+" to part "+v)}n.tuneInGoal=x}if(r=this.getDeliveryDirectives(n,a.deliveryDirectives,T,v),f||!h){this.loadPlaylist(r);return}}else r=this.getDeliveryDirectives(n,a.deliveryDirectives,T,v);var N=Object(A.computeReloadInterval)(n,e);T!==void 0&&n.canBlockReload&&(N-=n.partTarget||1),this.log("reload live playlist "+s+" in "+Math.round(N)+" ms"),this.timer=self.setTimeout(function(){return o.loadPlaylist(r)},N)}else this.clearTimer()},m.getDeliveryDirectives=function(s,a,i,o){var n=Object(L.getSkipValue)(s,i);return a!=null&&a.skip&&s.deltaUpdateFailed&&(i=a.msn,o=a.part,n=L.HlsSkip.No),new L.HlsUrlParameters(i,o,n)},m.retryLoadingOrFail=function(s){var a=this,i=this.hls.config,o=this.retryCount<i.levelLoadingMaxRetry;if(o){var n;if(this.retryCount++,s.details.indexOf("LoadTimeOut")>-1&&(n=s.context)!==null&&n!==void 0&&n.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+s.details+'"'),this.loadPlaylist();else{var e=Math.min(Math.pow(2,this.retryCount)*i.levelLoadingRetryDelay,i.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return a.loadPlaylist()},e),this.warn("retry playlist loading #"+this.retryCount+" in "+e+' ms after "'+s.details+'"')}}else this.warn('cannot recover from error "'+s.details+'"'),this.clearTimer(),s.fatal=!0;return o},S}()},"./src/controller/base-stream-controller.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"State",function(){return y}),C.d(H,"default",function(){return u});var j=C("./src/polyfills/number.ts"),L=C("./src/task-loop.ts"),A=C("./src/controller/fragment-tracker.ts"),B=C("./src/utils/buffer-helper.ts"),M=C("./src/utils/logger.ts"),w=C("./src/events.ts"),S=C("./src/errors.ts"),m=C("./src/types/transmuxer.ts"),g=C("./src/utils/mp4-tools.ts"),s=C("./src/utils/discontinuities.ts"),a=C("./src/controller/fragment-finders.ts"),i=C("./src/controller/level-helper.ts"),o=C("./src/loader/fragment-loader.ts"),n=C("./src/crypt/decrypter.ts"),e=C("./src/utils/time-ranges.ts"),t=C("./src/types/loader.ts");function r(l,h){for(var d=0;d<h.length;d++){var b=h[d];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(l,b.key,b)}}function T(l,h,d){return h&&r(l.prototype,h),d&&r(l,d),l}function v(l){if(l===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l}function f(l,h){l.prototype=Object.create(h.prototype),l.prototype.constructor=l,E(l,h)}function E(l,h){return E=Object.setPrototypeOf||function(b,p){return b.__proto__=p,b},E(l,h)}var y={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"},u=function(l){f(h,l);function h(b,p,x){var R;return R=l.call(this)||this,R.hls=void 0,R.fragPrevious=null,R.fragCurrent=null,R.fragmentTracker=void 0,R.transmuxer=null,R._state=y.STOPPED,R.media=void 0,R.mediaBuffer=void 0,R.config=void 0,R.bitrateTest=!1,R.lastCurrentTime=0,R.nextLoadPosition=0,R.startPosition=0,R.loadedmetadata=!1,R.fragLoadError=0,R.retryDate=0,R.levels=null,R.fragmentLoader=void 0,R.levelLastLoaded=null,R.startFragRequested=!1,R.decrypter=void 0,R.initPTS=[],R.onvseeking=null,R.onvended=null,R.logPrefix="",R.log=void 0,R.warn=void 0,R.logPrefix=x,R.log=M.logger.log.bind(M.logger,x+":"),R.warn=M.logger.warn.bind(M.logger,x+":"),R.hls=b,R.fragmentLoader=new o.default(b.config),R.fragmentTracker=p,R.config=b.config,R.decrypter=new n.default(b,b.config),b.on(w.Events.KEY_LOADED,R.onKeyLoaded,v(R)),R}var d=h.prototype;return d.doTick=function(){this.onTickEnd()},d.onTickEnd=function(){},d.startLoad=function(p){},d.stopLoad=function(){this.fragmentLoader.abort();var p=this.fragCurrent;p&&this.fragmentTracker.removeFragment(p),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},d._streamEnded=function(p,x){var R=this.fragCurrent,O=this.fragmentTracker;if(!x.live&&R&&R.sn===x.endSN&&!p.nextStart){var N=O.getState(R);return N===A.FragmentState.PARTIAL||N===A.FragmentState.OK}return!1},d.onMediaAttached=function(p,x){var R=this.media=this.mediaBuffer=x.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),R.addEventListener("seeking",this.onvseeking),R.addEventListener("ended",this.onvended);var O=this.config;this.levels&&O.autoStartLoad&&this.state===y.STOPPED&&this.startLoad(O.startPosition)},d.onMediaDetaching=function(){var p=this.media;p!=null&&p.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),p&&(p.removeEventListener("seeking",this.onvseeking),p.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},d.onMediaSeeking=function(){var p=this.config,x=this.fragCurrent,R=this.media,O=this.mediaBuffer,N=this.state,U=R?R.currentTime:0,W=B.BufferHelper.bufferInfo(O||R,U,p.maxBufferHole);if(this.log("media seeking to "+(Object(j.isFiniteNumber)(U)?U.toFixed(3):U)+", state: "+N),N===y.ENDED)this.resetLoadingState();else if(x&&!W.len){var P=p.maxFragLookUpTolerance,K=x.start-P,V=x.start+x.duration+P,re=U>V;(U<K||re)&&(re&&x.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),x.loader.abort()),this.resetLoadingState())}R&&(this.lastCurrentTime=U),!this.loadedmetadata&&!W.len&&(this.nextLoadPosition=this.startPosition=U),this.tickImmediate()},d.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},d.onKeyLoaded=function(p,x){if(this.state!==y.KEY_LOADING||x.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var R=this.levels[x.frag.level].details;R&&this.loadFragment(x.frag,R,x.frag.start)},d.onHandlerDestroying=function(){this.stopLoad(),l.prototype.onHandlerDestroying.call(this)},d.onHandlerDestroyed=function(){this.state=y.STOPPED,this.hls.off(w.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,l.prototype.onHandlerDestroyed.call(this)},d.loadKey=function(p,x){this.log("Loading key for "+p.sn+" of ["+x.startSN+"-"+x.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=y.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(w.Events.KEY_LOADING,{frag:p})},d.loadFragment=function(p,x,R){this._loadFragForPlayback(p,x,R)},d._loadFragForPlayback=function(p,x,R){var O=this,N=function(W){if(O.fragContextChanged(p)){O.warn("Fragment "+p.sn+(W.part?" p: "+W.part.index:"")+" of level "+p.level+" was dropped during download."),O.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,O._handleFragmentLoadProgress(W)};this._doFragLoad(p,x,R,N).then(function(U){if(!U)return;O.fragLoadError=0;var W=O.state;if(O.fragContextChanged(p)){(W===y.FRAG_LOADING||W===y.BACKTRACKING||!O.fragCurrent&&W===y.PARSING)&&(O.fragmentTracker.removeFragment(p),O.state=y.IDLE);return}if("payload"in U&&(O.log("Loaded fragment "+p.sn+" of level "+p.level),O.hls.trigger(w.Events.FRAG_LOADED,U),O.state===y.BACKTRACKING)){O.fragmentTracker.backtrack(p,U),O.resetFragmentLoading(p);return}O._handleFragmentLoadComplete(U)}).catch(function(U){O.warn(U),O.resetFragmentLoading(p)})},d.flushMainBuffer=function(p,x,R){if(R===void 0&&(R=null),!(p-x))return;var O={startOffset:p,endOffset:x,type:R};this.fragLoadError=0,this.hls.trigger(w.Events.BUFFER_FLUSHING,O)},d._loadInitSegment=function(p){var x=this;this._doFragLoad(p).then(function(R){if(!R||x.fragContextChanged(p)||!x.levels)throw new Error("init load aborted");return R}).then(function(R){var O=x.hls,N=R.payload,U=p.decryptdata;if(N&&N.byteLength>0&&U&&U.key&&U.iv&&U.method==="AES-128"){var W=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(N),U.key.buffer,U.iv.buffer).then(function(P){var K=self.performance.now();return O.trigger(w.Events.FRAG_DECRYPTED,{frag:p,payload:P,stats:{tstart:W,tdecrypt:K}}),R.payload=P,R})}return R}).then(function(R){var O=x.fragCurrent,N=x.hls,U=x.levels;if(!U)throw new Error("init load aborted, missing levels");var W=U[p.level].details;console.assert(W,"Level details are defined when init segment is loaded");var P=p.stats;x.state=y.IDLE,x.fragLoadError=0,p.data=new Uint8Array(R.payload),P.parsing.start=P.buffering.start=self.performance.now(),P.parsing.end=P.buffering.end=self.performance.now(),R.frag===O&&N.trigger(w.Events.FRAG_BUFFERED,{stats:P,frag:O,part:null,id:p.type}),x.tick()}).catch(function(R){x.warn(R),x.resetFragmentLoading(p)})},d.fragContextChanged=function(p){var x=this.fragCurrent;return!p||!x||p.level!==x.level||p.sn!==x.sn||p.urlId!==x.urlId},d.fragBufferedComplete=function(p,x){var R=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+e.default.toString(B.BufferHelper.getBuffered(R))),this.state=y.IDLE,this.tick()},d._handleFragmentLoadComplete=function(p){var x=this.transmuxer;if(!x)return;var R=p.frag,O=p.part,N=p.partsLoaded,U=!N||N.length===0||N.some(function(P){return!P}),W=new m.ChunkMetadata(R.level,R.sn,R.stats.chunkCount+1,0,O?O.index:-1,!U);x.flush(W)},d._handleFragmentLoadProgress=function(p){},d._doFragLoad=function(p,x,R,O){var N=this;if(R===void 0&&(R=null),!this.levels)throw new Error("frag load aborted, missing levels");if(R=Math.max(p.start,R||0),this.config.lowLatencyMode&&x){var U=x.partList;if(U&&O){R>p.end&&x.fragmentHint&&(p=x.fragmentHint);var W=this.getNextPart(U,p,R);if(W>-1){var P=U[W];return this.log("Loading part sn: "+p.sn+" p: "+P.index+" cc: "+p.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+W+"-"+(U.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(R.toFixed(3))),this.nextLoadPosition=P.start+P.duration,this.state=y.FRAG_LOADING,this.hls.trigger(w.Events.FRAG_LOADING,{frag:p,part:U[W],targetBufferTime:R}),this.doFragPartsLoad(p,U,W,O).catch(function(K){return N.handleFragLoadError(K)})}else if(!p.url||this.loadedEndOfParts(U,R))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(R.toFixed(3))),Object(j.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=y.FRAG_LOADING,this.hls.trigger(w.Events.FRAG_LOADING,{frag:p,targetBufferTime:R}),this.fragmentLoader.load(p,O).catch(function(K){return N.handleFragLoadError(K)})},d.doFragPartsLoad=function(p,x,R,O){var N=this;return new Promise(function(U,W){var P=[],K=function V(re){var ee=x[re];N.fragmentLoader.loadPart(p,ee,O).then(function(le){P[ee.index]=le;var oe=le.part;N.hls.trigger(w.Events.FRAG_LOADED,le);var $=x[re+1];if($&&$.fragment===p)V(re+1);else return U({frag:p,part:oe,partsLoaded:P})}).catch(W)};K(R)})},d.handleFragLoadError=function(p){var x=p.data;return x&&x.details===S.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(w.Events.ERROR,x),null},d._handleTransmuxerFlush=function(p){var x=this.getCurrentContext(p);if(!x||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var R=x.frag,O=x.part,N=x.level,U=self.performance.now();R.stats.parsing.end=U,O&&(O.stats.parsing.end=U),this.updateLevelTiming(R,O,N,p.partial)},d.getCurrentContext=function(p){var x=this.levels,R=p.level,O=p.sn,N=p.part;if(!x||!x[R])return this.warn("Levels object was unset while buffering fragment "+O+" of level "+R+". The current chunk will not be buffered."),null;var U=x[R],W=N>-1?Object(i.getPartWith)(U,O,N):null,P=W?W.fragment:Object(i.getFragmentWithSN)(U,O,this.fragCurrent);return P?{frag:P,part:W,level:U}:null},d.bufferFragmentData=function(p,x,R,O){if(!p||this.state!==y.PARSING)return;var N=p.data1,U=p.data2,W=N;if(N&&U&&(W=Object(g.appendUint8Array)(N,U)),!W||!W.length)return;var P={type:p.type,frag:x,part:R,chunkMeta:O,parent:x.type,data:W};this.hls.trigger(w.Events.BUFFER_APPENDING,P),p.dropped&&p.independent&&!R&&this.flushBufferGap(x)},d.flushBufferGap=function(p){var x=this.media;if(!x)return;if(!B.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,p.start);return}var R=x.currentTime,O=B.BufferHelper.bufferInfo(x,R,0),N=p.duration,U=Math.min(this.config.maxFragLookUpTolerance*2,N*.25),W=Math.max(Math.min(p.start-U,O.end-U),R+U);p.start-W>U&&this.flushMainBuffer(W,p.start)},d.getFwdBufferInfo=function(p,x){var R=this.config,O=this.getLoadPosition();if(!Object(j.isFiniteNumber)(O))return null;var N=B.BufferHelper.bufferInfo(p,O,R.maxBufferHole);if(N.len===0&&N.nextStart!==void 0){var U=this.fragmentTracker.getBufferedFrag(O,x);if(U&&N.nextStart<U.end)return B.BufferHelper.bufferInfo(p,O,Math.max(N.nextStart,R.maxBufferHole))}return N},d.getMaxBufferLength=function(p){var x=this.config,R;return p?R=Math.max(8*x.maxBufferSize/p,x.maxBufferLength):R=x.maxBufferLength,Math.min(R,x.maxMaxBufferLength)},d.reduceMaxBufferLength=function(p){var x=this.config,R=p||x.maxBufferLength;return x.maxMaxBufferLength>=R?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},d.getNextFragment=function(p,x){var R,O,N=x.fragments,U=N.length;if(!U)return null;var W=this.config,P=N[0].start,K;if(x.live){var V=W.initialLiveManifestSize;if(U<V)return this.warn("Not enough fragments to start playback (have: "+U+", need: "+V+")"),null;!x.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(K=this.getInitialLiveFragment(x,N),this.startPosition=K?this.hls.liveSyncPosition||K.start:p)}else p<=P&&(K=N[0]);if(!K){var re=W.lowLatencyMode?x.partEnd:x.fragmentEnd;K=this.getFragmentAtPosition(p,re,x)}return(R=K)!==null&&R!==void 0&&R.initSegment&&!((O=K)!==null&&O!==void 0&&O.initSegment.data)&&!this.bitrateTest&&(K=K.initSegment),K},d.getNextPart=function(p,x,R){for(var O=-1,N=!1,U=!0,W=0,P=p.length;W<P;W++){var K=p[W];if(U=U&&!K.independent,O>-1&&R<K.start)break;var V=K.loaded;!V&&(N||K.independent||U)&&K.fragment===x&&(O=W),N=V}return O},d.loadedEndOfParts=function(p,x){var R=p[p.length-1];return R&&x>R.start&&R.loaded},d.getInitialLiveFragment=function(p,x){var R=this.fragPrevious,O=null;if(R){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+R.programDateTime),O=Object(a.findFragmentByPDT)(x,R.endProgramDateTime,this.config.maxFragLookUpTolerance)),!O){var N=R.sn+1;if(N>=p.startSN&&N<=p.endSN){var U=x[N-p.startSN];R.cc===U.cc&&(O=U,this.log("Live playlist, switching playlist, load frag with next SN: "+O.sn))}O||(O=Object(a.findFragWithCC)(x,R.cc),O&&this.log("Live playlist, switching playlist, load frag with same CC: "+O.sn))}}else{var W=this.hls.liveSyncPosition;W!==null&&(O=this.getFragmentAtPosition(W,this.bitrateTest?p.fragmentEnd:p.edge,p))}return O},d.getFragmentAtPosition=function(p,x,R){var O=this.config,N=this.fragPrevious,U=R.fragments,W=R.endSN,P=R.fragmentHint,K=O.maxFragLookUpTolerance,V=!!(O.lowLatencyMode&&R.partList&&P);V&&P&&!this.bitrateTest&&(U=U.concat(P),W=P.sn);var re;if(p<x){var ee=p>x-K?0:K;re=Object(a.findFragmentByPTS)(N,U,p,ee)}else re=U[U.length-1];if(re){var le=re.sn-R.startSN,oe=N&&re.level===N.level,$=U[le+1],Z=this.fragmentTracker.getState(re);if(Z===A.FragmentState.BACKTRACKED){re=null;for(var ne=le;U[ne]&&this.fragmentTracker.getState(U[ne])===A.FragmentState.BACKTRACKED;)N?re=U[ne--]:re=U[--ne];re||(re=$)}else N&&re.sn===N.sn&&!V&&(oe&&(re.sn<W&&this.fragmentTracker.getState($)!==A.FragmentState.OK?(this.log("SN "+re.sn+" just loaded, load next one: "+$.sn),re=$):re=null))}return re},d.synchronizeToLiveEdge=function(p){var x=this.config,R=this.media;if(!R)return;var O=this.hls.liveSyncPosition,N=R.currentTime,U=p.fragments[0].start,W=p.edge,P=N>=U-x.maxFragLookUpTolerance&&N<=W;if(O!==null&&R.duration>O&&(N<O||!P)){var K=x.liveMaxLatencyDuration!==void 0?x.liveMaxLatencyDuration:x.liveMaxLatencyDurationCount*p.targetduration;(!P&&R.readyState<4||N<W-K)&&(this.loadedmetadata||(this.nextLoadPosition=O),R.readyState&&(this.warn("Playback: "+N.toFixed(3)+" is located too far from the end of live sliding playlist: "+W+", reset currentTime to : "+O.toFixed(3)),R.currentTime=O))}},d.alignPlaylists=function(p,x){var R=this.levels,O=this.levelLastLoaded,N=this.fragPrevious,U=O!==null?R[O]:null,W=p.fragments.length;if(!W)return this.warn("No fragments in live playlist"),0;var P=p.fragments[0].start,K=!x,V=p.alignedSliding&&Object(j.isFiniteNumber)(P);if(K||!V&&!P){Object(s.alignStream)(N,U,p);var re=p.fragments[0].start;return this.log("Live playlist sliding: "+re.toFixed(2)+" start-sn: "+(x?x.startSN:"na")+"->"+p.startSN+" prev-sn: "+(N?N.sn:"na")+" fragments: "+W),re}return P},d.waitForCdnTuneIn=function(p){var x=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*x)},d.setStartPosition=function(p,x){var R=this.startPosition;if(R<x&&(R=-1),R===-1||this.lastCurrentTime===-1){var O=p.startTimeOffset;Object(j.isFiniteNumber)(O)?(R=x+O,O<0&&(R+=p.totalduration),R=Math.min(Math.max(x,R),x+p.totalduration),this.log("Start time offset "+O+" found in playlist, adjust startPosition to "+R),this.startPosition=R):p.live?R=this.hls.liveSyncPosition||x:this.startPosition=R=0,this.lastCurrentTime=R}this.nextLoadPosition=R},d.getLoadPosition=function(){var p=this.media,x=0;return this.loadedmetadata&&p?x=p.currentTime:this.nextLoadPosition&&(x=this.nextLoadPosition),x},d.handleFragLoadAborted=function(p,x){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(x?" part"+x.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},d.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=y.IDLE)},d.onFragmentOrKeyLoadError=function(p,x){if(x.fatal)return;var R=x.frag;if(!R||R.type!==p)return;var O=this.fragCurrent;console.assert(O&&R.sn===O.sn&&R.level===O.level&&R.urlId===O.urlId,"Frag load error must match current frag to retry");var N=this.config;if(this.fragLoadError+1<=N.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(R.level))return;var U=Math.min(Math.pow(2,this.fragLoadError)*N.fragLoadingRetryDelay,N.fragLoadingMaxRetryTimeout);this.warn("Fragment "+R.sn+" of "+p+" "+R.level+" failed to load, retrying in "+U+"ms"),this.retryDate=self.performance.now()+U,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else x.levelRetry?(p===t.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(M.logger.error(x.details+" reaches max retry, redispatch as fatal ..."),x.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},d.afterBufferFlushed=function(p,x,R){if(!p)return;var O=B.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(x,O,R),this.state===y.ENDED&&this.resetLoadingState()},d.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},d.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var x=this.levels?this.levels[p].details:null;if(x!=null&&x.live)return this.startPosition=-1,this.setStartPosition(x,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},d.updateLevelTiming=function(p,x,R,O){var N=this,U=R.details;console.assert(!!U,"level.details must be defined");var W=Object.keys(p.elementaryStreams).reduce(function(P,K){var V=p.elementaryStreams[K];if(V){var re=V.endPTS-V.startPTS;if(re<=0)return N.warn("Could not parse fragment "+p.sn+" "+K+" duration reliably ("+re+") resetting transmuxer to fallback to playlist timing"),N.resetTransmuxer(),P||!1;var ee=O?0:Object(i.updateFragPTSDTS)(U,p,V.startPTS,V.endPTS,V.startDTS,V.endDTS);return N.hls.trigger(w.Events.LEVEL_PTS_UPDATED,{details:U,level:R,drift:ee,type:K,frag:p,start:V.startPTS,end:V.endPTS}),!0}return P},!1);W?(this.state=y.PARSED,this.hls.trigger(w.Events.FRAG_PARSED,{frag:p,part:x})):this.resetLoadingState()},d.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},T(h,[{key:"state",get:function(){return this._state},set:function(p){var x=this._state;x!==p&&(this._state=p,this.log(x+"->"+p))}}]),h}(L.default)},"./src/controller/buffer-controller.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return a});var j=C("./src/polyfills/number.ts"),L=C("./src/events.ts"),A=C("./src/utils/logger.ts"),B=C("./src/errors.ts"),M=C("./src/utils/buffer-helper.ts"),w=C("./src/utils/mediasource-helper.ts"),S=C("./src/loader/fragment.ts"),m=C("./src/controller/buffer-operation-queue.ts"),g=Object(w.getMediaSource)(),s=/([ha]vc.)(?:\.[^.,]+)+/,a=function(){function i(n){var e=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 t=e.hls,r=e.media,T=e.mediaSource;A.logger.log("[buffer-controller]: Media source opened"),r&&(e.updateMediaElementDuration(),t.trigger(L.Events.MEDIA_ATTACHED,{media:r})),T&&T.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){A.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){A.logger.log("[buffer-controller]: Media source ended")},this.hls=n,this._initSourceBuffer(),this.registerListeners()}var o=i.prototype;return o.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},o.destroy=function(){this.unregisterListeners(),this.details=null},o.registerListeners=function(){var e=this.hls;e.on(L.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(L.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(L.Events.BUFFER_RESET,this.onBufferReset,this),e.on(L.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(L.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(L.Events.BUFFER_EOS,this.onBufferEos,this),e.on(L.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(L.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(L.Events.FRAG_PARSED,this.onFragParsed,this),e.on(L.Events.FRAG_CHANGED,this.onFragChanged,this)},o.unregisterListeners=function(){var e=this.hls;e.off(L.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(L.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(L.Events.BUFFER_RESET,this.onBufferReset,this),e.off(L.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(L.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(L.Events.BUFFER_EOS,this.onBufferEos,this),e.off(L.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(L.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(L.Events.FRAG_PARSED,this.onFragParsed,this),e.off(L.Events.FRAG_CHANGED,this.onFragChanged,this)},o._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new m.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},o.onManifestParsed=function(e,t){var r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.details=null,A.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},o.onMediaAttaching=function(e,t){var r=this.media=t.media;if(r&&g){var T=this.mediaSource=new g;T.addEventListener("sourceopen",this._onMediaSourceOpen),T.addEventListener("sourceended",this._onMediaSourceEnded),T.addEventListener("sourceclose",this._onMediaSourceClose),r.src=self.URL.createObjectURL(T),this._objectUrl=r.src}},o.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,r=this._objectUrl;if(t){if(A.logger.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(T){A.logger.warn("[buffer-controller]: onMediaDetaching: "+T.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(r&&self.URL.revokeObjectURL(r),e.src===r?(e.removeAttribute("src"),e.load()):A.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(L.Events.MEDIA_DETACHED,void 0)},o.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(t){var r=e.sourceBuffer[t];try{r&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(r),e.sourceBuffer[t]=void 0)}catch(T){A.logger.warn("[buffer-controller]: Failed to reset the "+t+" buffer",T)}}),this._initSourceBuffer()},o.onBufferCodecs=function(e,t){var r=this,T=this.getSourceBufferTypes().length;if(Object.keys(t).forEach(function(v){if(T){var f=r.tracks[v];if(f&&typeof f.buffer.changeType=="function"){var E=t[v],y=E.codec,u=E.levelCodec,l=E.container,h=(f.levelCodec||f.codec).replace(s,"$1"),d=(u||y).replace(s,"$1");if(h!==d){var b=l+";codecs="+(u||y);r.appendChangeType(v,b)}}}else r.pendingTracks[v]=t[v]}),T)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},o.appendChangeType=function(e,t){var r=this,T=this.operationQueue,v={execute:function(){var E=r.sourceBuffer[e];E&&(A.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),E.changeType(t)),T.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(E){A.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",E)}};T.append(v,e)},o.onBufferAppending=function(e,t){var r=this,T=this.hls,v=this.operationQueue,f=this.tracks,E=t.data,y=t.type,u=t.frag,l=t.part,h=t.chunkMeta,d=h.buffering[y],b=self.performance.now();d.start=b;var p=u.stats.buffering,x=l?l.stats.buffering:null;p.start===0&&(p.start=b),x&&x.start===0&&(x.start=b);var R=f.audio,O=y==="audio"&&h.id===1&&(R==null?void 0:R.container)==="audio/mpeg",N={execute:function(){if(d.executeStart=self.performance.now(),O){var W=r.sourceBuffer[y];if(W){var P=u.start-W.timestampOffset;Math.abs(P)>=.1&&(A.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+u.start+" (delta: "+P+") sn: "+u.sn+")"),W.timestampOffset=u.start)}}r.appendExecutor(E,y)},onStart:function(){},onComplete:function(){var W=self.performance.now();d.executeEnd=d.end=W,p.first===0&&(p.first=W),x&&x.first===0&&(x.first=W);var P=r.sourceBuffer,K={};for(var V in P)K[V]=M.BufferHelper.getBuffered(P[V]);r.appendError=0,r.hls.trigger(L.Events.BUFFER_APPENDED,{type:y,frag:u,part:l,chunkMeta:h,parent:u.type,timeRanges:K})},onError:function(W){A.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",W);var P={type:B.ErrorTypes.MEDIA_ERROR,parent:u.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:W,fatal:!1};W.code===DOMException.QUOTA_EXCEEDED_ERR?P.details=B.ErrorDetails.BUFFER_FULL_ERROR:(r.appendError++,P.details=B.ErrorDetails.BUFFER_APPEND_ERROR,r.appendError>T.config.appendErrorMaxRetry&&(A.logger.error("[buffer-controller]: Failed "+T.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),P.fatal=!0)),T.trigger(L.Events.ERROR,P)}};v.append(N,y)},o.onBufferFlushing=function(e,t){var r=this,T=this.operationQueue,v=function(E){return{execute:r.removeExecutor.bind(r,E,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(L.Events.BUFFER_FLUSHED,{type:E})},onError:function(u){A.logger.warn("[buffer-controller]: Failed to remove from "+E+" SourceBuffer",u)}}};t.type?T.append(v(t.type),t.type):this.getSourceBufferTypes().forEach(function(f){T.append(v(f),f)})},o.onFragParsed=function(e,t){var r=this,T=t.frag,v=t.part,f=[],E=v?v.elementaryStreams:T.elementaryStreams;E[S.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(E[S.ElementaryStreamTypes.AUDIO]&&f.push("audio"),E[S.ElementaryStreamTypes.VIDEO]&&f.push("video"));var y=function(){var l=self.performance.now();T.stats.buffering.end=l,v&&(v.stats.buffering.end=l);var h=v?v.stats:T.stats;r.hls.trigger(L.Events.FRAG_BUFFERED,{frag:T,part:v,stats:h,id:T.type})};f.length===0&&A.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+T.type+" level: "+T.level+" sn: "+T.sn),this.blockBuffers(y,f)},o.onFragChanged=function(e,t){this.flushBackBuffer()},o.onBufferEos=function(e,t){var r=this,T=this.getSourceBufferTypes().reduce(function(v,f){var E=r.sourceBuffer[f];return(!t.type||t.type===f)&&(E&&!E.ended&&(E.ended=!0,A.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),v&&!!(!E||E.ended)},!0);T&&this.blockBuffers(function(){var v=r.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},o.onLevelUpdated=function(e,t){var r=t.details;if(!r.fragments.length)return;this.details=r,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},o.flushBackBuffer=function(){var e=this.hls,t=this.details,r=this.media,T=this.sourceBuffer;if(!r||t===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var f=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!Object(j.isFiniteNumber)(f)||f<0)return;var E=r.currentTime,y=t.levelTargetDuration,u=Math.max(f,y),l=Math.floor(E/y)*y-u;v.forEach(function(h){var d=T[h];if(d){var b=M.BufferHelper.getBuffered(d);b.length>0&&l>b.start(0)&&(e.trigger(L.Events.BACK_BUFFER_REACHED,{bufferEnd:l}),t.live&&e.trigger(L.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:l}),e.trigger(L.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:l,type:h}))}})},o.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var e=this.details,t=this.hls,r=this.media,T=this.mediaSource,v=e.fragments[0].start+e.totalduration,f=r.duration,E=Object(j.isFiniteNumber)(T.duration)?T.duration:0;e.live&&t.config.liveDurationInfinity?(A.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),T.duration=Infinity,this.updateSeekableRange(e)):(v>E&&v>f||!Object(j.isFiniteNumber)(f))&&(A.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),T.duration=v)},o.updateSeekableRange=function(e){var t=this.mediaSource,r=e.fragments,T=r.length;if(T&&e.live&&t!==null&&t!==void 0&&t.setLiveSeekableRange){var v=Math.max(0,r[0].start),f=Math.max(v,v+e.totalduration);t.setLiveSeekableRange(v,f)}},o.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,r=this.pendingTracks,T=Object.keys(r).length;if(T&&!e||T===2){this.createSourceBuffers(r),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(L.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(f){t.executeNext(f)})}},o.createSourceBuffers=function(e){var t=this.sourceBuffer,r=this.mediaSource;if(!r)throw Error("createSourceBuffers called when mediaSource was null");var T=0;for(var v in e)if(!t[v]){var f=e[v];if(!f)throw Error("source buffer exists for track "+v+", however track does not");var E=f.levelCodec||f.codec,y=f.container+";codecs="+E;A.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var u=t[v]=r.addSourceBuffer(y),l=v;this.addBufferListener(l,"updatestart",this._onSBUpdateStart),this.addBufferListener(l,"updateend",this._onSBUpdateEnd),this.addBufferListener(l,"error",this._onSBUpdateError),this.tracks[v]={buffer:u,codec:E,container:f.container,levelCodec:f.levelCodec,id:f.id},T++}catch(h){A.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+h.message),this.hls.trigger(L.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,mimeType:y})}}T&&this.hls.trigger(L.Events.BUFFER_CREATED,{tracks:this.tracks})},o._onSBUpdateStart=function(e){var t=this.operationQueue,r=t.current(e);r.onStart()},o._onSBUpdateEnd=function(e){var t=this.operationQueue,r=t.current(e);r.onComplete(),t.shiftAndExecuteNext(e)},o._onSBUpdateError=function(e,t){A.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(L.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var r=this.operationQueue.current(e);r&&r.onError(t)},o.removeExecutor=function(e,t,r){var T=this.media,v=this.mediaSource,f=this.operationQueue,E=this.sourceBuffer,y=E[e];if(!T||!v||!y){A.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(e);return}var u=Object(j.isFiniteNumber)(T.duration)?T.duration:Infinity,l=Object(j.isFiniteNumber)(v.duration)?v.duration:Infinity,h=Math.max(0,t),d=Math.min(r,u,l);d>h?(A.logger.log("[buffer-controller]: Removing ["+h+","+d+"] from the "+e+" SourceBuffer"),console.assert(!y.updating,e+" sourceBuffer must not be updating"),y.remove(h,d)):f.shiftAndExecuteNext(e)},o.appendExecutor=function(e,t){var r=this.operationQueue,T=this.sourceBuffer,v=T[t];if(!v){A.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),r.shiftAndExecuteNext(t);return}v.ended=!1,console.assert(!v.updating,t+" sourceBuffer must not be updating"),v.appendBuffer(e)},o.blockBuffers=function(e,t){var r=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length){A.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(e);return}var T=this.operationQueue,v=t.map(function(f){return T.appendBlocker(f)});Promise.all(v).then(function(){e(),t.forEach(function(f){var E=r.sourceBuffer[f];(!E||!E.updating)&&T.shiftAndExecuteNext(f)})})},o.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},o.addBufferListener=function(e,t,r){var T=this.sourceBuffer[e];if(!T)return;var v=r.bind(this,e);this.listeners[e].push({event:t,listener:v}),T.addEventListener(t,v)},o.removeBufferListeners=function(e){var t=this.sourceBuffer[e];if(!t)return;this.listeners[e].forEach(function(r){t.removeEventListener(r.event,r.listener)})},i}()},"./src/controller/buffer-operation-queue.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return L});var j=C("./src/utils/logger.ts"),L=function(){function A(M){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=M}var B=A.prototype;return B.append=function(w,S){var m=this.queues[S];m.push(w),m.length===1&&this.buffers[S]&&this.executeNext(S)},B.insertAbort=function(w,S){var m=this.queues[S];m.unshift(w),this.executeNext(S)},B.appendBlocker=function(w){var S,m=new Promise(function(s){S=s}),g={execute:S,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(g,w),m},B.executeNext=function(w){var S=this.buffers,m=this.queues,g=S[w],s=m[w];if(s.length){var a=s[0];try{a.execute()}catch(i){j.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),a.onError(i),(!g||!g.updating)&&(s.shift(),this.executeNext(w))}}},B.shiftAndExecuteNext=function(w){this.queues[w].shift(),this.executeNext(w)},B.current=function(w){return this.queues[w][0]},A}()},"./src/controller/cap-level-controller.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/events.ts");function L(M,w){for(var S=0;S<w.length;S++){var m=w[S];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(M,m.key,m)}}function A(M,w,S){return w&&L(M.prototype,w),S&&L(M,S),M}var B=function(){function M(S){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=S,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var w=M.prototype;return w.setStreamController=function(m){this.streamController=m},w.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},w.registerListeners=function(){var m=this.hls;m.on(j.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.on(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.on(j.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},w.unregisterListener=function(){var m=this.hls;m.off(j.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.off(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.off(j.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},w.onFpsDropLevelCapping=function(m,g){M.isLevelAllowed(g.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(g.droppedLevel)},w.onMediaAttaching=function(m,g){this.media=g.media instanceof HTMLVideoElement?g.media:null},w.onManifestParsed=function(m,g){var s=this.hls;this.restrictedLevels=[],this.firstLevel=g.firstLevel,s.config.capLevelToPlayerSize&&g.video&&this.startCapping()},w.onBufferCodecs=function(m,g){var s=this.hls;s.config.capLevelToPlayerSize&&g.video&&this.startCapping()},w.onMediaDetaching=function(){this.stopCapping()},w.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var m=this.hls.levels;if(m.length){var g=this.hls;g.autoLevelCapping=this.getMaxLevel(m.length-1),g.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=g.autoLevelCapping}}},w.getMaxLevel=function(m){var g=this,s=this.hls.levels;if(!s.length)return-1;var a=s.filter(function(i,o){return M.isLevelAllowed(o,g.restrictedLevels)&&o<=m});return this.clientRect=null,M.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)},w.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()},w.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},w.getDimensions=function(){if(this.clientRect)return this.clientRect;var m=this.media,g={width:0,height:0};if(m){var s=m.getBoundingClientRect();g.width=s.width,g.height=s.height,!g.width&&!g.height&&(g.width=s.right-s.left||m.width||0,g.height=s.bottom-s.top||m.height||0)}return this.clientRect=g,g},M.isLevelAllowed=function(m,g){return g===void 0&&(g=[]),g.indexOf(m)===-1},M.getMaxLevelByMediaSize=function(m,g,s){if(!m||!m.length)return-1;for(var a=function(t,r){return r?t.width!==r.width||t.height!==r.height:!0},i=m.length-1,o=0;o<m.length;o+=1){var n=m[o];if((n.width>=g||n.height>=s)&&a(n,m[o+1])){i=o;break}}return i},A(M,[{key:"mediaWidth",get:function(){return this.getDimensions().width*M.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*M.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var m=1;try{m=self.devicePixelRatio}catch(g){}return m}}]),M}();H.default=B},"./src/controller/cmcd-controller.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return a});var j=C("./src/events.ts"),L=C("./src/types/cmcd.ts"),A=C("./src/utils/buffer-helper.ts"),B=C("./src/utils/logger.ts");function M(i,o){for(var n=0;n<o.length;n++){var e=o[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(i,e.key,e)}}function w(i,o,n){return o&&M(i.prototype,o),n&&M(i,n),i}function S(i,o){var n=typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(n)return(n=n.call(i)).next.bind(n);if(Array.isArray(i)||(n=m(i))||o&&i&&typeof i.length=="number"){n&&(i=n);var e=0;return function(){return e>=i.length?{done:!0}:{done:!1,value:i[e++]}}}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 m(i,o){if(!i)return;if(typeof i=="string")return g(i,o);var n=Object.prototype.toString.call(i).slice(8,-1);if(n==="Object"&&i.constructor&&(n=i.constructor.name),n==="Map"||n==="Set")return Array.from(i);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(i,o)}function g(i,o){(o==null||o>i.length)&&(o=i.length);for(var n=0,e=new Array(o);n<o;n++)e[n]=i[n];return e}function s(){return s=Object.assign||function(i){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(i[e]=n[e])}return i},s.apply(this,arguments)}var a=function(){function i(n){var e=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){e.initialized&&(e.starved=!0),e.buffering=!0},this.onPlaying=function(){e.initialized||(e.initialized=!0),e.buffering=!1},this.applyPlaylistData=function(T){try{e.apply(T,{ot:L.CMCDObjectType.MANIFEST,su:!e.initialized})}catch(v){B.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(T){try{var v=T.frag,f=e.hls.levels[v.level],E=e.getObjectType(v),y={d:v.duration*1e3,ot:E};(E===L.CMCDObjectType.VIDEO||E===L.CMCDObjectType.AUDIO||E==L.CMCDObjectType.MUXED)&&(y.br=f.bitrate/1e3,y.tb=e.getTopBandwidth(E),y.bl=e.getBufferLength(E)),e.apply(T,y)}catch(u){B.logger.warn("Could not generate segment CMCD data.",u)}},this.hls=n;var t=this.config=n.config,r=t.cmcd;r!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||i.uuid(),this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.registerListeners())}var o=i.prototype;return o.registerListeners=function(){var e=this.hls;e.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this)},o.unregisterListeners=function(){var e=this.hls;e.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},o.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},o.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},o.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},o.onBufferCreated=function(e,t){var r,T;this.audioBuffer=(r=t.tracks.audio)===null||r===void 0?void 0:r.buffer,this.videoBuffer=(T=t.tracks.video)===null||T===void 0?void 0:T.buffer},o.createData=function(){var e;return{v:L.CMCDVersion,sf:L.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)===null||e===void 0?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},o.apply=function(e,t){t===void 0&&(t={}),s(t,this.createData());var r=t.ot===L.CMCDObjectType.INIT||t.ot===L.CMCDObjectType.VIDEO||t.ot===L.CMCDObjectType.MUXED;if(this.starved&&r&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var T=i.toHeaders(t);if(!Object.keys(T).length)return;e.headers||(e.headers={}),s(e.headers,T)}else{var v=i.toQuery(t);if(!v)return;e.url=i.appendQueryToUri(e.url,v)}},o.getObjectType=function(e){var t=e.type;return t==="subtitle"?L.CMCDObjectType.TIMED_TEXT:e.sn==="initSegment"?L.CMCDObjectType.INIT:t==="audio"?L.CMCDObjectType.AUDIO:t==="main"?this.hls.audioTracks.length?L.CMCDObjectType.VIDEO:L.CMCDObjectType.MUXED:void 0},o.getTopBandwidth=function(e){for(var t=0,r=e===L.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,T=S(r),v;!(v=T()).done;){var f=v.value;f.bitrate>t&&(t=f.bitrate)}return t>0?t:NaN},o.getBufferLength=function(e){var t=this.hls.media,r=e===L.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!r||!t)return NaN;var T=A.BufferHelper.bufferInfo(r,t.currentTime,this.config.maxBufferHole);return T.len*1e3},o.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,r=e||this.config.loader;return function(){function T(f){this.loader=void 0,this.loader=new r(f)}var v=T.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(E,y,u){t(E),this.loader.load(E,y,u)},w(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},o.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,r=e||this.config.loader;return function(){function T(f){this.loader=void 0,this.loader=new r(f)}var v=T.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(E,y,u){t(E),this.loader.load(E,y,u)},w(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},i.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)},i.serialize=function(e){for(var t=[],r=function(O){return!Number.isNaN(O)&&O!=null&&O!==""&&O!==!1},T=function(O){return Math.round(O)},v=function(O){return T(O/100)*100},f=function(O){return encodeURIComponent(O)},E={br:T,d:T,bl:v,dl:v,mtp:v,nor:f,rtp:v,tb:T},y=Object.keys(e||{}).sort(),u=S(y),l;!(l=u()).done;){var h=l.value,d=e[h];if(!r(d))continue;if(h==="v"&&d===1)continue;if(h=="pr"&&d===1)continue;var b=E[h];b&&(d=b(d));var p=typeof d,x=void 0;h==="ot"||h==="sf"||h==="st"?x=h+"="+d:p==="boolean"?x=h:p==="number"?x=h+"="+d:x=h+"="+JSON.stringify(d),t.push(x)}return t.join(",")},i.toHeaders=function(e){for(var t=Object.keys(e),r={},T=["Object","Request","Session","Status"],v=[{},{},{},{}],f={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},E=0,y=t;E<y.length;E++){var u=y[E],l=f[u]!=null?f[u]:1;v[l][u]=e[u]}for(var h=0;h<v.length;h++){var d=i.serialize(v[h]);d&&(r["CMCD-"+T[h]]=d)}return r},i.toQuery=function(e){return"CMCD="+encodeURIComponent(i.serialize(e))},i.appendQueryToUri=function(e,t){if(!t)return e;var r=e.includes("?")?"&":"?";return""+e+r+t},i}()},"./src/controller/eme-controller.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/events.ts"),L=C("./src/errors.ts"),A=C("./src/utils/logger.ts"),B=C("./src/utils/mediakeys-helper.ts");function M(a,i){for(var o=0;o<i.length;o++){var n=i[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(a,n.key,n)}}function w(a,i,o){return i&&M(a.prototype,i),o&&M(a,o),a}var S=3,m=function(i,o,n){var e={audioCapabilities:[],videoCapabilities:[]};return i.forEach(function(t){e.audioCapabilities.push({contentType:'audio/mp4; codecs="'+t+'"',robustness:n.audioRobustness||""})}),o.forEach(function(t){e.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"',robustness:n.videoRobustness||""})}),[e]},g=function(i,o,n,e){switch(i){case B.KeySystems.WIDEVINE:return m(o,n,e);default:throw new Error("Unknown key-system: "+i)}},s=function(){function a(o){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=o,this._config=o.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var i=a.prototype;return i.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},i._registerListeners=function(){this.hls.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this)},i._unregisterListeners=function(){this.hls.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this)},i.getLicenseServerUrl=function(n){switch(n){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+n+'"')},i._attemptKeySystemAccess=function(n,e,t){var r=this,T=g(n,e,t,this._drmSystemOptions);A.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(n,T);this.mediaKeysPromise=v.then(function(f){return r._onMediaKeySystemAccessObtained(n,f)}),v.catch(function(f){A.logger.error('Failed to obtain key-system "'+n+'" access:',f)})},i._onMediaKeySystemAccessObtained=function(n,e){var t=this;A.logger.log('Access for key-system "'+n+'" obtained');var r={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:n};this._mediaKeysList.push(r);var T=Promise.resolve().then(function(){return e.createMediaKeys()}).then(function(v){return r.mediaKeys=v,A.logger.log('Media-keys created for key-system "'+n+'"'),t._onMediaKeysCreated(),v});return T.catch(function(v){A.logger.error("Failed to create media-keys:",v)}),T},i._onMediaKeysCreated=function(){var n=this;this._mediaKeysList.forEach(function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),n._onNewMediaKeySession(e.mediaKeysSession))})},i._onNewMediaKeySession=function(n){var e=this;A.logger.log("New key-system session "+n.sessionId),n.addEventListener("message",function(t){e._onKeySessionMessage(n,t.message)},!1)},i._onKeySessionMessage=function(n,e){A.logger.log("Got EME message event, creating license request"),this._requestLicense(e,function(t){A.logger.log("Received license data (length: "+(t&&t.byteLength)+"), updating key-session"),n.update(t)})},i.onMediaEncrypted=function(n){var e=this;if(A.logger.log('Media is encrypted using "'+n.initDataType+'" init data type'),!this.mediaKeysPromise){A.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var t=function(T){if(!e._media)return;e._attemptSetMediaKeys(T),e._generateRequestWithPreferredKeySession(n.initDataType,n.initData)};this.mediaKeysPromise.then(t).catch(t)},i._attemptSetMediaKeys=function(n){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var e=this._mediaKeysList[0];if(!e||!e.mediaKeys){A.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}A.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},i._generateRequestWithPreferredKeySession=function(n,e){var t=this,r=this._mediaKeysList[0];if(!r){A.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(r.mediaKeysSessionInitialized){A.logger.warn("Key-Session already initialized but requested again");return}var T=r.mediaKeysSession;if(!T){A.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!e){A.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}A.logger.log('Generating key-session request for "'+n+'" init data type'),r.mediaKeysSessionInitialized=!0,T.generateRequest(n,e).then(function(){A.logger.debug("Key-session generation succeeded")}).catch(function(v){A.logger.error("Error generating key-session request:",v),t.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},i._createLicenseXhr=function(n,e,t){var r=new XMLHttpRequest;r.responseType="arraybuffer",r.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,r,n,e,t);var T=this._licenseXhrSetup;if(T)try{T.call(this.hls,r,n),T=void 0}catch(v){A.logger.error(v)}try{r.readyState||r.open("POST",n,!0),T&&T.call(this.hls,r,n)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return r},i._onLicenseRequestReadyStageChange=function(n,e,t,r){switch(n.readyState){case 4:if(n.status===200){this._requestLicenseFailureCount=0,A.logger.log("License request succeeded");var T=n.response,v=this._licenseResponseCallback;if(v)try{T=v.call(this.hls,n,e)}catch(E){A.logger.error(E)}r(T)}else{if(A.logger.error("License Request XHR failed ("+e+"). Status: "+n.status+" ("+n.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>S){this.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=S-this._requestLicenseFailureCount+1;A.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(t,r)}break}},i._generateLicenseRequestChallenge=function(n,e){switch(n.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+n.mediaKeySystemDomain)},i._requestLicense=function(n,e){A.logger.log("Requesting content license for key-system");var t=this._mediaKeysList[0];if(!t){A.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var r=this.getLicenseServerUrl(t.mediaKeySystemDomain),T=this._createLicenseXhr(r,n,e);A.logger.log("Sending license request to URL: "+r);var v=this._generateLicenseRequestChallenge(t,n);T.send(v)}catch(f){A.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},i.onMediaAttached=function(n,e){if(!this._emeEnabled)return;var t=e.media;this._media=t,t.addEventListener("encrypted",this._onMediaEncrypted)},i.onMediaDetached=function(){var n=this._media,e=this._mediaKeysList;if(!n)return;n.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(e.map(function(t){if(t.mediaKeysSession)return t.mediaKeysSession.close().catch(function(){})})).then(function(){return n.setMediaKeys(null)}).catch(function(){})},i.onManifestParsed=function(n,e){if(!this._emeEnabled)return;var t=e.levels.map(function(T){return T.audioCodec}).filter(function(T){return!!T}),r=e.levels.map(function(T){return T.videoCodec}).filter(function(T){return!!T});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,t,r)},w(a,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),a}();H.default=s},"./src/controller/fps-controller.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/events.ts"),L=C("./src/utils/logger.ts"),A=function(){function B(w){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=w,this.registerListeners()}var M=B.prototype;return M.setStreamController=function(S){this.streamController=S},M.registerListeners=function(){this.hls.on(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},M.unregisterListeners=function(){this.hls.off(j.Events.MEDIA_ATTACHING,this.onMediaAttaching)},M.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},M.onMediaAttaching=function(S,m){var g=this.hls.config;if(g.capLevelOnFPSDrop){var s=m.media instanceof self.HTMLVideoElement?m.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),g.fpsDroppedMonitoringPeriod)}},M.checkFPS=function(S,m,g){var s=performance.now();if(m){if(this.lastTime){var a=s-this.lastTime,i=g-this.lastDroppedFrames,o=m-this.lastDecodedFrames,n=1e3*i/a,e=this.hls;if(e.trigger(j.Events.FPS_DROP,{currentDropped:i,currentDecoded:o,totalDroppedFrames:g}),n>0&&i>e.config.fpsDroppedMonitoringThreshold*o){var t=e.currentLevel;L.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+t),t>0&&(e.autoLevelCapping===-1||e.autoLevelCapping>=t)&&(t=t-1,e.trigger(j.Events.FPS_DROP_LEVEL_CAPPING,{level:t,droppedLevel:e.currentLevel}),e.autoLevelCapping=t,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=g,this.lastDecodedFrames=m}},M.checkFPSInterval=function(){var S=this.media;if(S)if(this.isVideoPlaybackQualityAvailable){var m=S.getVideoPlaybackQuality();this.checkFPS(S,m.totalVideoFrames,m.droppedVideoFrames)}else this.checkFPS(S,S.webkitDecodedFrameCount,S.webkitDroppedFrameCount)},B}();H.default=A},"./src/controller/fragment-finders.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"findFragmentByPDT",function(){return A}),C.d(H,"findFragmentByPTS",function(){return B}),C.d(H,"fragmentWithinToleranceTest",function(){return M}),C.d(H,"pdtWithinToleranceTest",function(){return w}),C.d(H,"findFragWithCC",function(){return S});var j=C("./src/polyfills/number.ts"),L=C("./src/utils/binary-search.ts");function A(m,g,s){if(g===null||!Array.isArray(m)||!m.length||!Object(j.isFiniteNumber)(g))return null;var a=m[0].programDateTime;if(g<(a||0))return null;var i=m[m.length-1].endProgramDateTime;if(g>=(i||0))return null;s=s||0;for(var o=0;o<m.length;++o){var n=m[o];if(w(g,s,n))return n}return null}function B(m,g,s,a){s===void 0&&(s=0),a===void 0&&(a=0);var i=null;if(m?i=g[m.sn-g[0].sn+1]||null:s===0&&g[0].start===0&&(i=g[0]),i&&M(s,a,i)===0)return i;var o=L.default.search(g,M.bind(null,s,a));return o||i}function M(m,g,s){m===void 0&&(m=0),g===void 0&&(g=0);var a=Math.min(g,s.duration+(s.deltaPTS?s.deltaPTS:0));return s.start+s.duration-a<=m?1:s.start-a>m&&s.start?-1:0}function w(m,g,s){var a=Math.min(g,s.duration+(s.deltaPTS?s.deltaPTS:0))*1e3,i=s.endProgramDateTime||0;return i-a>m}function S(m,g){return L.default.search(m,function(s){return s.cc<g?1:s.cc>g?-1:0})}},"./src/controller/fragment-tracker.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"FragmentState",function(){return A}),C.d(H,"FragmentTracker",function(){return B});var j=C("./src/events.ts"),L=C("./src/types/loader.ts"),A;(function(S){S.NOT_LOADED="NOT_LOADED",S.BACKTRACKED="BACKTRACKED",S.APPENDING="APPENDING",S.PARTIAL="PARTIAL",S.OK="OK"})(A||(A={}));var B=function(){function S(g){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=g,this._registerListeners()}var m=S.prototype;return m._registerListeners=function(){var s=this.hls;s.on(j.Events.BUFFER_APPENDED,this.onBufferAppended,this),s.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(j.Events.FRAG_LOADED,this.onFragLoaded,this)},m._unregisterListeners=function(){var s=this.hls;s.off(j.Events.BUFFER_APPENDED,this.onBufferAppended,this),s.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(j.Events.FRAG_LOADED,this.onFragLoaded,this)},m.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},m.getAppendedFrag=function(s,a){if(a===L.PlaylistLevelType.MAIN){var i=this.activeFragment,o=this.activeParts;if(!i)return null;if(o)for(var n=o.length;n--;){var e=o[n],t=e?e.end:i.appendedPTS;if(e.start<=s&&t!==void 0&&s<=t)return n>9&&(this.activeParts=o.slice(n-9)),e}else if(i.start<=s&&i.appendedPTS!==void 0&&s<=i.appendedPTS)return i}return this.getBufferedFrag(s,a)},m.getBufferedFrag=function(s,a){for(var i=this.fragments,o=Object.keys(i),n=o.length;n--;){var e=i[o[n]];if((e==null?void 0:e.body.type)===a&&e.buffered){var t=e.body;if(t.start<=s&&s<=t.end)return t}}return null},m.detectEvictedFragments=function(s,a,i){var o=this;Object.keys(this.fragments).forEach(function(n){var e=o.fragments[n];if(!e)return;if(!e.buffered){e.body.type===i&&o.removeFragment(e.body);return}var t=e.range[s];if(!t)return;t.time.some(function(r){var T=!o.isTimeBuffered(r.startPTS,r.endPTS,a);return T&&o.removeFragment(e.body),T})})},m.detectPartialFragments=function(s){var a=this,i=this.timeRanges,o=s.frag,n=s.part;if(!i||o.sn==="initSegment")return;var e=w(o),t=this.fragments[e];if(!t)return;Object.keys(i).forEach(function(r){var T=o.elementaryStreams[r];if(!T)return;var v=i[r],f=n!==null||T.partial===!0;t.range[r]=a.getBufferedTimes(o,n,f,v)}),t.backtrack=t.loaded=null,Object.keys(t.range).length?t.buffered=!0:this.removeFragment(t.body)},m.fragBuffered=function(s){var a=w(s),i=this.fragments[a];i&&(i.backtrack=i.loaded=null,i.buffered=!0)},m.getBufferedTimes=function(s,a,i,o){for(var n={time:[],partial:i},e=a?a.start:s.start,t=a?a.end:s.end,r=s.minEndPTS||t,T=s.maxStartPTS||e,v=0;v<o.length;v++){var f=o.start(v)-this.bufferPadding,E=o.end(v)+this.bufferPadding;if(T>=f&&r<=E){n.time.push({startPTS:Math.max(e,o.start(v)),endPTS:Math.min(t,o.end(v))});break}else if(e<E&&t>f)n.partial=!0,n.time.push({startPTS:Math.max(e,o.start(v)),endPTS:Math.min(t,o.end(v))});else if(t<=f)break}return n},m.getPartialFragment=function(s){var a=null,i,o,n,e=0,t=this.bufferPadding,r=this.fragments;return Object.keys(r).forEach(function(T){var v=r[T];if(!v)return;M(v)&&(o=v.body.start-t,n=v.body.end+t,s>=o&&s<=n&&(i=Math.min(s-o,n-s),e<=i&&(a=v.body,e=i)))}),a},m.getState=function(s){var a=w(s),i=this.fragments[a];return i?i.buffered?M(i)?A.PARTIAL:A.OK:i.backtrack?A.BACKTRACKED:A.APPENDING:A.NOT_LOADED},m.backtrack=function(s,a){var i=w(s),o=this.fragments[i];if(!o||o.backtrack)return null;var n=o.backtrack=a||o.loaded;return o.loaded=null,n},m.getBacktrackData=function(s){var a=w(s),i=this.fragments[a];if(i){var o,n=i.backtrack;if(n!=null&&(o=n.payload)!==null&&o!==void 0&&o.byteLength)return n;this.removeFragment(s)}return null},m.isTimeBuffered=function(s,a,i){for(var o,n,e=0;e<i.length;e++){if(o=i.start(e)-this.bufferPadding,n=i.end(e)+this.bufferPadding,s>=o&&a<=n)return!0;if(a<=o)return!1}return!1},m.onFragLoaded=function(s,a){var i=a.frag,o=a.part;if(i.sn==="initSegment"||i.bitrateTest||o)return;var n=w(i);this.fragments[n]={body:i,loaded:a,backtrack:null,buffered:!1,range:Object.create(null)}},m.onBufferAppended=function(s,a){var i=this,o=a.frag,n=a.part,e=a.timeRanges;if(o.type===L.PlaylistLevelType.MAIN)if(this.activeFragment=o,n){var t=this.activeParts;t||(this.activeParts=t=[]),t.push(n)}else this.activeParts=null;this.timeRanges=e,Object.keys(e).forEach(function(r){var T=e[r];if(i.detectEvictedFragments(r,T),!n)for(var v=0;v<T.length;v++)o.appendedPTS=Math.max(T.end(v),o.appendedPTS||0)})},m.onFragBuffered=function(s,a){this.detectPartialFragments(a)},m.hasFragment=function(s){var a=w(s);return!!this.fragments[a]},m.removeFragmentsInRange=function(s,a,i){var o=this;Object.keys(this.fragments).forEach(function(n){var e=o.fragments[n];if(!e)return;if(e.buffered){var t=e.body;t.type===i&&t.start<a&&t.end>s&&o.removeFragment(t)}})},m.removeFragment=function(s){var a=w(s);s.stats.loaded=0,s.clearElementaryStreamInfo(),delete this.fragments[a]},m.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},S}();function M(S){var m,g;return S.buffered&&(((m=S.range.video)===null||m===void 0?void 0:m.partial)||((g=S.range.audio)===null||g===void 0?void 0:g.partial))}function w(S){return S.type+"_"+S.level+"_"+S.urlId+"_"+S.sn}},"./src/controller/gap-controller.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"STALL_MINIMUM_DURATION_MS",function(){return M}),C.d(H,"MAX_START_GAP_JUMP",function(){return w}),C.d(H,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return S}),C.d(H,"SKIP_BUFFER_RANGE_START",function(){return m}),C.d(H,"default",function(){return g});var j=C("./src/utils/buffer-helper.ts"),L=C("./src/errors.ts"),A=C("./src/events.ts"),B=C("./src/utils/logger.ts"),M=250,w=2,S=.1,m=.05,g=function(){function s(i,o,n,e){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=i,this.media=o,this.fragmentTracker=n,this.hls=e}var a=s.prototype;return a.destroy=function(){this.hls=this.fragmentTracker=this.media=null},a.poll=function(o){var n=this.config,e=this.media,t=this.stalled,r=e.currentTime,T=e.seeking,v=this.seeking&&!T,f=!this.seeking&&T;if(this.seeking=T,r!==o){if(this.moved=!0,t!==null){if(this.stallReported){var E=self.performance.now()-t;B.logger.warn("playback not stuck anymore @"+r+", after "+Math.round(E)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||v)&&(this.stalled=null),e.paused||e.ended||e.playbackRate===0||!j.BufferHelper.getBuffered(e).length)return;var y=j.BufferHelper.bufferInfo(e,r,0),u=y.len>0,l=y.nextStart||0;if(!u&&!l)return;if(T){var h=y.len>w,d=!l||l-r>w&&!this.fragmentTracker.getPartialFragment(r);if(h||d)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,p=Math.max(l,y.start||0)-r,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,R=x==null||((b=x.details)===null||b===void 0)?void 0:b.live,O=R?x.details.targetduration*2:w;if(p>0&&p<=O){this._trySkipBufferHole(null);return}}var N=self.performance.now();if(t===null){this.stalled=N;return}var U=N-t;!T&&U>=M&&this._reportStall(y.len);var W=j.BufferHelper.bufferInfo(e,r,n.maxBufferHole);this._tryFixBufferStall(W,U)},a._tryFixBufferStall=function(o,n){var e=this.config,t=this.fragmentTracker,r=this.media,T=r.currentTime,v=t.getPartialFragment(T);if(v){var f=this._trySkipBufferHole(v);if(f)return}o.len>e.maxBufferHole&&n>e.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},a._reportStall=function(o){var n=this.hls,e=this.media,t=this.stallReported;t||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+e.currentTime+" due to low buffer (buffer="+o+")"),n.trigger(A.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:o}))},a._trySkipBufferHole=function(o){for(var n=this.config,e=this.hls,t=this.media,r=t.currentTime,T=0,v=j.BufferHelper.getBuffered(t),f=0;f<v.length;f++){var E=v.start(f);if(r+n.maxBufferHole>=T&&r<E){var y=Math.max(E+m,t.currentTime+S);return B.logger.warn("skipping hole, adjusting currentTime from "+r+" to "+y),this.moved=!0,this.stalled=null,t.currentTime=y,o&&e.trigger(A.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+r+" to "+y,frag:o}),y}T=v.end(f)}return 0},a._tryNudgeBuffer=function(){var o=this.config,n=this.hls,e=this.media,t=e.currentTime,r=(this.nudgeRetry||0)+1;if(this.nudgeRetry=r,r<o.nudgeMaxRetry){var T=t+r*o.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+t+" to "+T),e.currentTime=T,n.trigger(A.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+t+" after "+o.nudgeMaxRetry+" nudges"),n.trigger(A.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},s}()},"./src/controller/id3-track-controller.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/events.ts"),L=C("./src/utils/texttrack-utils.ts"),A=C("./src/demux/id3.ts"),B=.25,M=function(){function w(m){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=m,this._registerListeners()}var S=w.prototype;return S.destroy=function(){this._unregisterListeners()},S._registerListeners=function(){var g=this.hls;g.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.on(j.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),g.on(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var g=this.hls;g.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.off(j.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),g.off(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.onMediaAttached=function(g,s){this.media=s.media},S.onMediaDetaching=function(){if(!this.id3Track)return;Object(L.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},S.getID3Track=function(g){if(!this.media)return;for(var s=0;s<g.length;s++){var a=g[s];if(a.kind==="metadata"&&a.label==="id3")return Object(L.sendAddTrackEvent)(a,this.media),a}return this.media.addTextTrack("metadata","id3")},S.onFragParsingMetadata=function(g,s){if(!this.media)return;var a=s.frag,i=s.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var o=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,n=0;n<i.length;n++){var e=A.getID3Frames(i[n].data);if(e){var t=i[n].pts,r=n<i.length-1?i[n+1].pts:a.end,T=r-t;T<=0&&(r=t+B);for(var v=0;v<e.length;v++){var f=e[v];if(!A.isTimeStampFrame(f)){var E=new o(t,r,"");E.value=f,this.id3Track.addCue(E)}}}}},S.onBufferFlushing=function(g,s){var a=s.startOffset,i=s.endOffset,o=s.type;if(!o||o==="audio"){var n=this.id3Track;n&&Object(L.removeCuesInRange)(n,a,i)}},w}();H.default=M},"./src/controller/latency-controller.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return w});var j=C("./src/errors.ts"),L=C("./src/events.ts"),A=C("./src/utils/logger.ts");function B(S,m){for(var g=0;g<m.length;g++){var s=m[g];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(S,s.key,s)}}function M(S,m,g){return m&&B(S.prototype,m),g&&B(S,g),S}var w=function(){function S(g){var s=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return s.timeupdate()},this.hls=g,this.config=g.config,this.registerListeners()}var m=S.prototype;return m.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},m.registerListeners=function(){this.hls.on(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(L.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(L.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){this.hls.off(L.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(L.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(L.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(L.Events.ERROR,this.onError)},m.onMediaAttached=function(s,a){this.media=a.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},m.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},m.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},m.onLevelUpdated=function(s,a){var i=a.details;this.levelDetails=i,i.advanced&&this.timeupdate(),!i.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},m.onError=function(s,a){if(a.details!==j.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,A.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},m.timeupdate=function(){var s=this.media,a=this.levelDetails;if(!s||!a)return;this.currentTime=s.currentTime;var i=this.computeLatency();if(i===null)return;this._latency=i;var o=this.config,n=o.lowLatencyMode,e=o.maxLiveSyncPlaybackRate;if(!n||e===1)return;var t=this.targetLatency;if(t===null)return;var r=i-t,T=Math.min(this.maxLatency,t+a.targetduration),v=r<T;if(a.live&&v&&r>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,e)),E=Math.round(2/(1+Math.exp(-.75*r-this.edgeStalled))*20)/20;s.playbackRate=Math.min(f,Math.max(1,E))}else s.playbackRate!==1&&s.playbackRate!==0&&(s.playbackRate=1)},m.estimateLiveEdge=function(){var s=this.levelDetails;return s===null?null:s.edge+s.age},m.computeLatency=function(){var s=this.estimateLiveEdge();return s===null?null:s-this.currentTime},M(S,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var s=this.config,a=this.levelDetails;return s.liveMaxLatencyDuration!==void 0?s.liveMaxLatencyDuration:a?s.liveMaxLatencyDurationCount*a.targetduration:0}},{key:"targetLatency",get:function(){var s=this.levelDetails;if(s===null)return null;var a=s.holdBack,i=s.partHoldBack,o=s.targetduration,n=this.config,e=n.liveSyncDuration,t=n.liveSyncDurationCount,r=n.lowLatencyMode,T=this.hls.userConfig,v=r&&i||a;(T.liveSyncDuration||T.liveSyncDurationCount||v===0)&&(v=e!==void 0?e:t*o);var f=o,E=1;return v+Math.min(this.stallCount*E,f)}},{key:"liveSyncPosition",get:function(){var s=this.estimateLiveEdge(),a=this.targetLatency,i=this.levelDetails;if(s===null||a===null||i===null)return null;var o=i.edge,n=s-a-this.edgeStalled,e=o-i.totalduration,t=o-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(e,n),t)}},{key:"drift",get:function(){var s=this.levelDetails;return s===null?1:s.drift}},{key:"edgeStalled",get:function(){var s=this.levelDetails;if(s===null)return 0;var a=(this.config.lowLatencyMode&&s.partTarget||s.targetduration)*3;return Math.max(s.age-a,0)}},{key:"forwardBufferLength",get:function(){var s=this.media,a=this.levelDetails;if(!s||!a)return 0;var i=s.buffered.length;return i?s.buffered.end(i-1):a.edge-this.currentTime}}]),S}()},"./src/controller/level-controller.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return n});var j=C("./src/types/level.ts"),L=C("./src/events.ts"),A=C("./src/errors.ts"),B=C("./src/utils/codecs.ts"),M=C("./src/controller/level-helper.ts"),w=C("./src/controller/base-playlist-controller.ts"),S=C("./src/types/loader.ts");function m(){return m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var T in r)Object.prototype.hasOwnProperty.call(r,T)&&(e[T]=r[T])}return e},m.apply(this,arguments)}function g(e,t){for(var r=0;r<t.length;r++){var T=t[r];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(e,T.key,T)}}function s(e,t,r){return t&&g(e.prototype,t),r&&g(e,r),e}function a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,i(e,t)}function i(e,t){return i=Object.setPrototypeOf||function(T,v){return T.__proto__=v,T},i(e,t)}var o=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),n=function(e){a(t,e);function t(T){var v;return v=e.call(this,T,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var r=t.prototype;return r._registerListeners=function(){var v=this.hls;v.on(L.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(L.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(L.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(L.Events.ERROR,this.onError,this)},r._unregisterListeners=function(){var v=this.hls;v.off(L.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(L.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(L.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(L.Events.ERROR,this.onError,this)},r.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,e.prototype.destroy.call(this)},r.startLoad=function(){var v=this._levels;v.forEach(function(f){f.loadError=0}),e.prototype.startLoad.call(this)},r.onManifestLoaded=function(v,f){var E=[],y=[],u=[],l,h={},d,b=!1,p=!1,x=!1;if(f.levels.forEach(function(U){var W=U.attrs;b=b||!!(U.width&&U.height),p=p||!!U.videoCodec,x=x||!!U.audioCodec,o&&U.audioCodec&&U.audioCodec.indexOf("mp4a.40.34")!==-1&&(U.audioCodec=void 0);var P=U.bitrate+"-"+U.attrs.RESOLUTION+"-"+U.attrs.CODECS;d=h[P],d?d.url.push(U.url):(d=new j.Level(U),h[P]=d,E.push(d)),W&&(W.AUDIO&&Object(M.addGroupId)(d,"audio",W.AUDIO),W.SUBTITLES&&Object(M.addGroupId)(d,"text",W.SUBTITLES))}),(b||p)&&x&&(E=E.filter(function(U){var W=U.videoCodec,P=U.width,K=U.height;return!!W||!!(P&&K)})),E=E.filter(function(U){var W=U.audioCodec,P=U.videoCodec;return(!W||Object(B.isCodecSupportedInMp4)(W,"audio"))&&(!P||Object(B.isCodecSupportedInMp4)(P,"video"))}),f.audioTracks&&(y=f.audioTracks.filter(function(U){return!U.audioCodec||Object(B.isCodecSupportedInMp4)(U.audioCodec,"audio")}),Object(M.assignTrackIdsByGroup)(y)),f.subtitles&&(u=f.subtitles,Object(M.assignTrackIdsByGroup)(u)),E.length>0){l=E[0].bitrate,E.sort(function(U,W){return U.bitrate-W.bitrate}),this._levels=E;for(var R=0;R<E.length;R++)if(E[R].bitrate===l){this._firstLevel=R,this.log("manifest loaded, "+E.length+" level(s) found, first bitrate: "+l);break}var O=x&&!p,N={levels:E,audioTracks:y,subtitleTracks:u,firstLevel:this._firstLevel,stats:f.stats,audio:x,video:p,altAudio:!O&&y.some(function(U){return!!U.url})};this.hls.trigger(L.Events.MANIFEST_PARSED,N),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(L.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},r.onError=function(v,f){if(e.prototype.onError.call(this,v,f),f.fatal)return;var E=f.context,y=this._levels[this.currentLevelIndex];if(E&&(E.type===S.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&E.groupId===y.audioGroupIds[y.urlId]||E.type===S.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&E.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var u=!1,l=!0,h;switch(f.details){case A.ErrorDetails.FRAG_LOAD_ERROR:case A.ErrorDetails.FRAG_LOAD_TIMEOUT:case A.ErrorDetails.KEY_LOAD_ERROR:case A.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var d=this._levels[f.frag.level];d?(d.fragmentError++,d.fragmentError>this.hls.config.fragLoadingMaxRetry&&(h=f.frag.level)):h=f.frag.level}break;case A.ErrorDetails.LEVEL_LOAD_ERROR:case A.ErrorDetails.LEVEL_LOAD_TIMEOUT:E&&(E.deliveryDirectives&&(l=!1),h=E.level),u=!0;break;case A.ErrorDetails.REMUX_ALLOC_ERROR:h=f.level,u=!0;break}h!==void 0&&this.recoverLevel(f,h,u,l)},r.recoverLevel=function(v,f,E,y){var u=v.details,l=this._levels[f];if(l.loadError++,E){var h=this.retryLoadingOrFail(v);if(h)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var d=l.url.length;if(d>1&&l.loadError<d)v.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var b=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==b&&this._levels[b].loadError===0&&(this.warn(u+": switch to "+b),v.levelRetry=!0,this.hls.nextAutoLevel=b)}}},r.redundantFailover=function(v){var f=this._levels[v],E=f.url.length;if(E>1){var y=(f.urlId+1)%E;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(u){u.urlId=y}),this.level=v}},r.onFragLoaded=function(v,f){var E=f.frag;if(E!==void 0&&E.type===S.PlaylistLevelType.MAIN){var y=this._levels[E.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},r.onLevelLoaded=function(v,f){var E,y=f.level,u=f.details,l=this._levels[y];if(!l){var h;this.warn("Invalid level index "+y),(h=f.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(u.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(l.fragmentError===0&&(l.loadError=0,this.retryCount=0),this.playlistLoaded(y,f,l.details)):(E=f.deliveryDirectives)!==null&&E!==void 0&&E.skip&&(u.deltaUpdateFailed=!0)},r.onAudioTrackSwitched=function(v,f){var E=this.hls.levels[this.currentLevelIndex];if(!E)return;if(E.audioGroupIds){for(var y=-1,u=this.hls.audioTracks[f.id].groupId,l=0;l<E.audioGroupIds.length;l++)if(E.audioGroupIds[l]===u){y=l;break}y!==E.urlId&&(E.urlId=y,this.startLoad())}},r.loadPlaylist=function(v){var f=this.currentLevelIndex,E=this._levels[f];if(this.canLoad&&E&&E.url.length>0){var y=E.urlId,u=E.url[y];if(v)try{u=v.addDirectives(u)}catch(l){this.warn("Could not construct new URL with HLS Delivery Directives: "+l)}this.log("Attempt loading level index "+f+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+y+" "+u),this.clearTimer(),this.hls.trigger(L.Events.LEVEL_LOADING,{url:u,level:f,id:y,deliveryDirectives:v||null})}},r.removeLevel=function(v,f){var E=function(l,h){return h!==f},y=this._levels.filter(function(u,l){return l!==v?!0:u.url.length>1&&f!==void 0?(u.url=u.url.filter(E),u.audioGroupIds&&(u.audioGroupIds=u.audioGroupIds.filter(E)),u.textGroupIds&&(u.textGroupIds=u.textGroupIds.filter(E)),u.urlId=0,!0):!1}).map(function(u,l){var h=u.details;return h!=null&&h.fragments&&h.fragments.forEach(function(d){d.level=l}),u});this._levels=y,this.hls.trigger(L.Events.LEVELS_UPDATED,{levels:y})},s(t,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var f,E=this._levels;if(E.length===0)return;if(this.currentLevelIndex===v&&(f=E[v])!==null&&f!==void 0&&f.details)return;if(v<0||v>=E.length){var y=v<0;if(this.hls.trigger(L.Events.ERROR,{type:A.ErrorTypes.OTHER_ERROR,details:A.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:y,reason:"invalid level idx"}),y)return;v=Math.min(v,E.length-1)}this.clearTimer();var u=this.currentLevelIndex,l=E[u],h=E[v];this.log("switching to level "+v+" from "+u),this.currentLevelIndex=v;var d=m({},h,{level:v,maxBitrate:h.maxBitrate,uri:h.uri,urlId:h.urlId});delete d._urlId,this.hls.trigger(L.Events.LEVEL_SWITCHING,d);var b=h.details;if(!b||b.live){var p=this.switchParams(h.uri,l==null?void 0:l.details);this.loadPlaylist(p)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),t}(w.default)},"./src/controller/level-helper.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"addGroupId",function(){return A}),C.d(H,"assignTrackIdsByGroup",function(){return B}),C.d(H,"updatePTS",function(){return M}),C.d(H,"updateFragPTSDTS",function(){return S}),C.d(H,"mergeDetails",function(){return m}),C.d(H,"mapPartIntersection",function(){return g}),C.d(H,"mapFragmentIntersection",function(){return s}),C.d(H,"adjustSliding",function(){return a}),C.d(H,"addSliding",function(){return i}),C.d(H,"computeReloadInterval",function(){return o}),C.d(H,"getFragmentWithSN",function(){return n}),C.d(H,"getPartWith",function(){return e});var j=C("./src/polyfills/number.ts"),L=C("./src/utils/logger.ts");function A(t,r,T){switch(r){case"audio":t.audioGroupIds||(t.audioGroupIds=[]),t.audioGroupIds.push(T);break;case"text":t.textGroupIds||(t.textGroupIds=[]),t.textGroupIds.push(T);break}}function B(t){var r={};t.forEach(function(T){var v=T.groupId||"";T.id=r[v]=r[v]||0,r[v]++})}function M(t,r,T){var v=t[r],f=t[T];w(v,f)}function w(t,r){var T=r.startPTS;if(Object(j.isFiniteNumber)(T)){var v=0,f;r.sn>t.sn?(v=T-t.start,f=t):(v=t.start-T,f=r),f.duration!==v&&(f.duration=v)}else if(r.sn>t.sn){var E=t.cc===r.cc;E&&t.minEndPTS?r.start=t.start+(t.minEndPTS-t.start):r.start=t.start+t.duration}else r.start=Math.max(t.start-r.duration,0)}function S(t,r,T,v,f,E){var y=v-T;y<=0&&(L.logger.warn("Fragment should have a positive duration",r),v=T+r.duration,E=f+r.duration);var u=T,l=v,h=r.startPTS,d=r.endPTS;if(Object(j.isFiniteNumber)(h)){var b=Math.abs(h-T);Object(j.isFiniteNumber)(r.deltaPTS)?r.deltaPTS=Math.max(b,r.deltaPTS):r.deltaPTS=b,u=Math.max(T,h),T=Math.min(T,h),f=Math.min(f,r.startDTS),l=Math.min(v,d),v=Math.max(v,d),E=Math.max(E,r.endDTS)}r.duration=v-T;var p=T-r.start;r.appendedPTS=v,r.start=r.startPTS=T,r.maxStartPTS=u,r.startDTS=f,r.endPTS=v,r.minEndPTS=l,r.endDTS=E;var x=r.sn;if(!t||x<t.startSN||x>t.endSN)return 0;var R,O=x-t.startSN,N=t.fragments;for(N[O]=r,R=O;R>0;R--)w(N[R],N[R-1]);for(R=O;R<N.length-1;R++)w(N[R],N[R+1]);return t.fragmentHint&&w(N[N.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,p}function m(t,r){for(var T=null,v=t.fragments,f=v.length-1;f>=0;f--){var E=v[f].initSegment;if(E){T=E;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var y=0,u;if(s(t,r,function(R,O){R.relurl&&(y=R.cc-O.cc),Object(j.isFiniteNumber)(R.startPTS)&&Object(j.isFiniteNumber)(R.endPTS)&&(O.start=O.startPTS=R.startPTS,O.startDTS=R.startDTS,O.appendedPTS=R.appendedPTS,O.maxStartPTS=R.maxStartPTS,O.endPTS=R.endPTS,O.endDTS=R.endDTS,O.minEndPTS=R.minEndPTS,O.duration=R.endPTS-R.startPTS,O.duration&&(u=O),r.PTSKnown=r.alignedSliding=!0),O.elementaryStreams=R.elementaryStreams,O.loader=R.loader,O.stats=R.stats,O.urlId=R.urlId,R.initSegment&&(O.initSegment=R.initSegment,T=R.initSegment)}),T){var l=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments;l.forEach(function(R){var O;(!R.initSegment||R.initSegment.relurl===((O=T)===null||O===void 0?void 0:O.relurl))&&(R.initSegment=T)})}if(r.skippedSegments&&(r.deltaUpdateFailed=r.fragments.some(function(R){return!R}),r.deltaUpdateFailed)){L.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var h=r.skippedSegments;h--;)r.fragments.shift();r.startSN=r.fragments[0].sn,r.startCC=r.fragments[0].cc}var d=r.fragments;if(y){L.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b<d.length;b++)d[b].cc+=y}r.skippedSegments&&(r.startCC=r.fragments[0].cc),g(t.partList,r.partList,function(R,O){O.elementaryStreams=R.elementaryStreams,O.stats=R.stats}),u?S(r,u,u.startPTS,u.endPTS,u.startDTS,u.endDTS):a(t,r),d.length&&(r.totalduration=r.edge-d[0].start),r.driftStartTime=t.driftStartTime,r.driftStart=t.driftStart;var p=r.advancedDateTime;if(r.advanced&&p){var x=r.edge;r.driftStart||(r.driftStartTime=p,r.driftStart=x),r.driftEndTime=p,r.driftEnd=x}else r.driftEndTime=t.driftEndTime,r.driftEnd=t.driftEnd,r.advancedDateTime=t.advancedDateTime}function g(t,r,T){if(t&&r)for(var v=0,f=0,E=t.length;f<=E;f++){var y=t[f],u=r[f+v];y&&u&&y.index===u.index&&y.fragment.sn===u.fragment.sn?T(y,u):v--}}function s(t,r,T){for(var v=r.skippedSegments,f=Math.max(t.startSN,r.startSN)-r.startSN,E=(t.fragmentHint?1:0)+(v?r.endSN:Math.min(t.endSN,r.endSN))-r.startSN,y=r.startSN-t.startSN,u=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,h=f;h<=E;h++){var d=l[y+h],b=u[h];v&&!b&&h<v&&(b=r.fragments[h]=d),d&&b&&T(d,b)}}function a(t,r){var T=r.startSN+r.skippedSegments-t.startSN,v=t.fragments;if(T<0||T>=v.length)return;i(r,v[T].start)}function i(t,r){if(r){for(var T=t.fragments,v=t.skippedSegments;v<T.length;v++)T[v].start+=r;t.fragmentHint&&(t.fragmentHint.start+=r)}}function o(t,r){var T=1e3*t.levelTargetDuration,v=T/2,f=t.age,E=f>0&&f<T*3,y=r.loading.end-r.loading.start,u,l=t.availabilityDelay;if(t.updated===!1)if(E){var h=333*t.misses;u=Math.max(Math.min(v,y*2),h),t.availabilityDelay=(t.availabilityDelay||0)+u}else u=v;else E?(l=Math.min(l||T/2,f),t.availabilityDelay=l,u=l+T-f):u=T-y;return Math.round(u)}function n(t,r,T){if(!t||!t.details)return null;var v=t.details,f=v.fragments[r-v.startSN];return f||(f=v.fragmentHint,f&&f.sn===r?f:r<v.startSN&&T&&T.sn===r?T:null)}function e(t,r,T){if(!t||!t.details)return null;var v=t.details.partList;if(v)for(var f=v.length;f--;){var E=v[f];if(E.index===T&&E.fragment.sn===r)return E}return null}},"./src/controller/stream-controller.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return v});var j=C("./src/polyfills/number.ts"),L=C("./src/controller/base-stream-controller.ts"),A=C("./src/is-supported.ts"),B=C("./src/events.ts"),M=C("./src/utils/buffer-helper.ts"),w=C("./src/controller/fragment-tracker.ts"),S=C("./src/types/loader.ts"),m=C("./src/loader/fragment.ts"),g=C("./src/demux/transmuxer-interface.ts"),s=C("./src/types/transmuxer.ts"),a=C("./src/controller/gap-controller.ts"),i=C("./src/errors.ts"),o=C("./src/utils/logger.ts");function n(f,E){for(var y=0;y<E.length;y++){var u=E[y];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(f,u.key,u)}}function e(f,E,y){return E&&n(f.prototype,E),y&&n(f,y),f}function t(f,E){f.prototype=Object.create(E.prototype),f.prototype.constructor=f,r(f,E)}function r(f,E){return r=Object.setPrototypeOf||function(u,l){return u.__proto__=l,u},r(f,E)}var T=100,v=function(f){t(E,f);function E(u,l){var h;return h=f.call(this,u,l,"[stream-controller]")||this,h.audioCodecSwap=!1,h.gapController=null,h.level=-1,h._forceStartLoad=!1,h.altAudio=!1,h.audioOnly=!1,h.fragPlaying=null,h.onvplaying=null,h.onvseeked=null,h.fragLastKbps=0,h.stalled=!1,h.couldBacktrack=!1,h.audioCodecSwitch=!1,h.videoBuffer=null,h._registerListeners(),h}var y=E.prototype;return y._registerListeners=function(){var l=this.hls;l.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),l.on(B.Events.ERROR,this.onError,this),l.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),l.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),l.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var l=this.hls;l.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),l.off(B.Events.ERROR,this.onError,this),l.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),l.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),l.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(l){if(this.levels){var h=this.lastCurrentTime,d=this.hls;if(this.stopLoad(),this.setInterval(T),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var b=d.startLevel;b===-1&&(d.config.testBandwidth?(b=0,this.bitrateTest=!0):b=d.nextAutoLevel),this.level=d.nextLoadLevel=b,this.loadedmetadata=!1}h>0&&l===-1&&(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),l=h),this.state=L.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()}else this._forceStartLoad=!0,this.state=L.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case L.State.IDLE:this.doTickIdle();break;case L.State.WAITING_LEVEL:{var l,h=this.levels,d=this.level,b=h==null||((l=h[d])===null||l===void 0)?void 0:l.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=L.State.IDLE;break}break}case L.State.FRAG_LOADING_WAITING_RETRY:{var p,x=self.performance.now(),R=this.retryDate;(!R||x>=R||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=L.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var l,h,d=this.hls,b=this.levelLastLoaded,p=this.levels,x=this.media,R=d.config,O=d.nextLoadLevel;if(b===null||!x&&(this.startFragRequested||!R.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[O])return;var N=p[O];this.level=d.nextLoadLevel=O;var U=N.details;if(!U||this.state===L.State.WAITING_LEVEL||U.live&&this.levelLastLoaded!==O){this.state=L.State.WAITING_LEVEL;return}var W=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,S.PlaylistLevelType.MAIN);if(W===null)return;var P=W.len,K=this.getMaxBufferLength(N.maxBitrate);if(P>=K)return;if(this._streamEnded(W,U)){var V={};this.altAudio&&(V.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,V),this.state=L.State.ENDED;return}var re=W.end,ee=this.getNextFragment(re,U);if(this.couldBacktrack&&!this.fragPrevious&&ee&&ee.sn!=="initSegment"){var le=ee.sn-U.startSN;le>1&&(ee=U.fragments[le-1],this.fragmentTracker.removeFragment(ee))}if(ee&&this.fragmentTracker.getState(ee)===w.FragmentState.OK&&this.nextLoadPosition>re){var oe=this.audioOnly&&!this.altAudio?m.ElementaryStreamTypes.AUDIO:m.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,oe,S.PlaylistLevelType.MAIN),ee=this.getNextFragment(this.nextLoadPosition,U)}if(!ee)return;ee.initSegment&&!ee.initSegment.data&&!this.bitrateTest&&(ee=ee.initSegment),((l=ee.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((h=ee.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(ee,U):this.loadFragment(ee,U,re)},y.loadFragment=function(l,h,d){var b,p=this.fragmentTracker.getState(l);if(this.fragCurrent=l,p===w.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(l);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else p=w.FragmentState.NOT_LOADED}p===w.FragmentState.NOT_LOADED||p===w.FragmentState.PARTIAL?l.sn==="initSegment"?this._loadInitSegment(l):this.bitrateTest?(l.bitrateTest=!0,this.log("Fragment "+l.sn+" of level "+l.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(l)):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,l,h,d)):p===w.FragmentState.APPENDING?this.reduceMaxBufferLength(l.duration)&&this.fragmentTracker.removeFragment(l):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(l){var h=this.fragmentTracker.getAppendedFrag(l,S.PlaylistLevelType.MAIN);return h&&"fragment"in h?h.fragment:h},y.getBufferedFrag=function(l){return this.fragmentTracker.getBufferedFrag(l,S.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(l){return l?this.getBufferedFrag(l.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var l=this.levels,h=this.media;if(h!=null&&h.readyState){var d,b=this.getAppendedFrag(h.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!h.paused&&l){var p=this.hls.nextLoadLevel,x=l[p],R=this.fragLastKbps;R&&this.fragCurrent?d=this.fragCurrent.duration*x.maxBitrate/(1e3*R)+1:d=0}else d=0;var O=this.getBufferedFrag(h.currentTime+d);if(O){var N=this.followingBufferedFrag(O);if(N){this.abortCurrentFrag();var U=N.maxStartPTS?N.maxStartPTS:N.start,W=N.duration,P=Math.max(O.end,U+Math.min(Math.max(W-this.config.maxFragLookUpTolerance,W*.5),W*.75));this.flushMainBuffer(P,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var l=this.fragCurrent;this.fragCurrent=null,l!=null&&l.loader&&l.loader.abort(),this.state===L.State.KEY_LOADING&&(this.state=L.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(l,h){f.prototype.flushMainBuffer.call(this,l,h,this.altAudio?"video":null)},y.onMediaAttached=function(l,h){f.prototype.onMediaAttached.call(this,l,h);var d=h.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),d.addEventListener("playing",this.onvplaying),d.addEventListener("seeked",this.onvseeked),this.gapController=new a.default(this.config,d,this.fragmentTracker,this.hls)},y.onMediaDetaching=function(){var l=this.media;l&&(l.removeEventListener("playing",this.onvplaying),l.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),f.prototype.onMediaDetaching.call(this)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var l=this.media,h=l?l.currentTime:null;Object(j.isFiniteNumber)(h)&&this.log("Media seeked to "+h.toFixed(3)),this.tick()},y.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},y.onManifestParsed=function(l,h){var d=!1,b=!1,p;h.levels.forEach(function(x){p=x.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(d=!0),p.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=d&&b&&!Object(A.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=h.levels,this.startFragRequested=!1},y.onLevelLoading=function(l,h){var d=this.levels;if(!d||this.state!==L.State.IDLE)return;var b=d[h.level];(!b.details||b.details.live&&this.levelLastLoaded!==h.level||this.waitForCdnTuneIn(b.details))&&(this.state=L.State.WAITING_LEVEL)},y.onLevelLoaded=function(l,h){var d,b=this.levels,p=h.level,x=h.details,R=x.totalduration;if(!b){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+R);var O=this.fragCurrent;O&&(this.state===L.State.FRAG_LOADING||this.state===L.State.FRAG_LOADING_WAITING_RETRY)&&(O.level!==h.level&&O.loader&&(this.state=L.State.IDLE,O.loader.abort()));var N=b[p],U=0;if(x.live||(d=N.details)!==null&&d!==void 0&&d.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;U=this.alignPlaylists(x,N.details)}if(N.details=x,this.levelLastLoaded=p,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:x,level:p}),this.state===L.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=L.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,U),this.tick()},y._handleFragmentLoadProgress=function(l){var h,d=l.frag,b=l.part,p=l.payload,x=this.levels;if(!x){this.warn("Levels were reset while fragment load was in progress. Fragment "+d.sn+" of level "+d.level+" will not be buffered");return}var R=x[d.level],O=R.details;if(!O){this.warn("Dropping fragment "+d.sn+" of level "+d.level+" after level details were reset");return}var N=R.videoCodec,U=O.PTSKnown||!O.live,W=(h=d.initSegment)===null||h===void 0?void 0:h.data,P=this._getAudioCodec(R),K=this.transmuxer=this.transmuxer||new g.default(this.hls,S.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),V=b?b.index:-1,re=V!==-1,ee=new s.ChunkMetadata(d.level,d.sn,d.stats.chunkCount,p.byteLength,V,re),le=this.initPTS[d.cc];K.push(p,W,P,N,d,b,O.totalduration,U,ee,le)},y.onAudioTrackSwitching=function(l,h){var d=this.altAudio,b=!!h.url,p=h.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 x=this.fragCurrent;x!=null&&x.loader&&(this.log("Switching to main audio track, cancel main fragment load"),x.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var R=this.hls;d&&R.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),R.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:p})}},y.onAudioTrackSwitched=function(l,h){var d=h.id,b=!!this.hls.audioTracks[d].url;if(b){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=b,this.tick()},y.onBufferCreated=function(l,h){var d=h.tracks,b,p,x=!1;for(var R in d){var O=d[R];if(O.id==="main"){if(p=R,b=O,R==="video"){var N=d[R];N&&(this.videoBuffer=N.buffer)}}else x=!0}x&&b?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(l,h){var d=h.frag,b=h.part;if(d&&d.type!==S.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(d)){this.warn("Fragment "+d.sn+(b?" p: "+b.index:"")+" of level "+d.level+" finished buffering, but was aborted. state: "+this.state),this.state===L.State.PARSED&&(this.state=L.State.IDLE);return}var p=b?b.stats:d.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),d.sn!=="initSegment"&&(this.fragPrevious=d),this.fragBufferedComplete(d,b)},y.onError=function(l,h){switch(h.details){case i.ErrorDetails.FRAG_LOAD_ERROR:case i.ErrorDetails.FRAG_LOAD_TIMEOUT:case i.ErrorDetails.KEY_LOAD_ERROR:case i.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.MAIN,h);break;case i.ErrorDetails.LEVEL_LOAD_ERROR:case i.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==L.State.ERROR&&(h.fatal?(this.warn(""+h.details),this.state=L.State.ERROR):!h.levelRetry&&this.state===L.State.WAITING_LEVEL&&(this.state=L.State.IDLE));break;case i.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="main"&&(this.state===L.State.PARSING||this.state===L.State.PARSED)){var d=!0,b=this.getFwdBufferInfo(this.media,S.PlaylistLevelType.MAIN);b&&b.len>.5&&(d=!this.reduceMaxBufferLength(b.len)),d&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},y.checkBuffer=function(){var l=this.media,h=this.gapController;if(!l||!h||!l.readyState)return;var d=M.BufferHelper.getBuffered(l);!this.loadedmetadata&&d.length?(this.loadedmetadata=!0,this.seekToStartPos()):h.poll(this.lastCurrentTime),this.lastCurrentTime=l.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=L.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(l,h){var d=h.type;if(d!==m.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(d===m.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,d,S.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(l,h){this.levels=h.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var l=this.media,h=l.currentTime,d=this.startPosition;if(d>=0&&h<d){if(l.seeking){o.logger.log("could not seek to "+d+", already seeking at "+h);return}var b=M.BufferHelper.getBuffered(l),p=b.length?b.start(0):0,x=p-d;x>0&&(x<this.config.maxBufferHole||x<this.config.maxFragLookUpTolerance)&&(o.logger.log("adjusting start position by "+x+" to match buffer start"),d+=x,this.startPosition=d),this.log("seek to target start position "+d+" from current time "+h),l.currentTime=d}},y._getAudioCodec=function(l){var h=this.config.defaultAudioCodec||l.audioCodec;return this.audioCodecSwap&&h&&(this.log("Swapping audio codec"),h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5"),h},y._loadBitrateTestFrag=function(l){var h=this;this._doFragLoad(l).then(function(d){var b=h.hls;if(!d||b.nextLoadLevel||h.fragContextChanged(l))return;h.fragLoadError=0,h.state=L.State.IDLE,h.startFragRequested=!1,h.bitrateTest=!1;var p=l.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),b.trigger(B.Events.FRAG_LOADED,d)})},y._handleTransmuxComplete=function(l){var h,d="main",b=this.hls,p=l.remuxResult,x=l.chunkMeta,R=this.getCurrentContext(x);if(!R){this.warn("The loading context changed while buffering fragment "+x.sn+" of level "+x.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(x.level);return}var O=R.frag,N=R.part,U=R.level,W=p.video,P=p.text,K=p.id3,V=p.initSegment,re=this.altAudio?void 0:p.audio;if(this.fragContextChanged(O))return;if(this.state=L.State.PARSING,V){V.tracks&&(this._bufferInitSegment(U,V.tracks,O,x),b.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:O,id:d,tracks:V.tracks}));var ee=V.initPTS,le=V.timescale;Object(j.isFiniteNumber)(ee)&&(this.initPTS[O.cc]=ee,b.trigger(B.Events.INIT_PTS_FOUND,{frag:O,id:d,initPTS:ee,timescale:le}))}if(W&&p.independent!==!1){if(U.details){var oe=W.startPTS,$=W.endPTS,Z=W.startDTS,ne=W.endDTS;if(N)N.elementaryStreams[W.type]={startPTS:oe,endPTS:$,startDTS:Z,endDTS:ne};else if(W.firstKeyFrame&&W.independent&&(this.couldBacktrack=!0),W.dropped&&W.independent){var X=this.getLoadPosition()+this.config.maxBufferHole;if(X<oe){this.backtrack(O);return}O.setElementaryStreamInfo(W.type,O.start,$,O.start,ne,!0)}O.setElementaryStreamInfo(W.type,oe,$,Z,ne),this.bufferFragmentData(W,O,N,x)}}else if(p.independent===!1){this.backtrack(O);return}if(re){var z=re.startPTS,fe=re.endPTS,Se=re.startDTS,Oe=re.endDTS;N&&(N.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:z,endPTS:fe,startDTS:Se,endDTS:Oe}),O.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,z,fe,Se,Oe),this.bufferFragmentData(re,O,N,x)}if(K!=null&&(h=K.samples)!==null&&h!==void 0&&h.length){var Ae={frag:O,id:d,samples:K.samples};b.trigger(B.Events.FRAG_PARSING_METADATA,Ae)}if(P){var Pe={frag:O,id:d,samples:P.samples};b.trigger(B.Events.FRAG_PARSING_USERDATA,Pe)}},y._bufferInitSegment=function(l,h,d,b){var p=this;if(this.state!==L.State.PARSING)return;this.audioOnly=!!h.audio&&!h.video,this.altAudio&&!this.audioOnly&&delete h.audio;var x=h.audio,R=h.video,O=h.audiovideo;if(x){var N=l.audioCodec,U=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(N&&(N.indexOf("mp4a.40.5")!==-1?N="mp4a.40.2":N="mp4a.40.5"),x.metadata.channelCount!==1&&U.indexOf("firefox")===-1&&(N="mp4a.40.5")),U.indexOf("android")!==-1&&x.container!=="audio/mpeg"&&(N="mp4a.40.2",this.log("Android: force audio codec to "+N)),l.audioCodec&&l.audioCodec!==N&&this.log('Swapping manifest audio codec "'+l.audioCodec+'" for "'+N+'"'),x.levelCodec=N,x.id="main",this.log("Init audio buffer, container:"+x.container+", codecs[selected/level/parsed]=["+(N||"")+"/"+(l.audioCodec||"")+"/"+x.codec+"]")}R&&(R.levelCodec=l.videoCodec,R.id="main",this.log("Init video buffer, container:"+R.container+", codecs[level/parsed]=["+(l.videoCodec||"")+"/"+R.codec+"]")),O&&this.log("Init audiovideo buffer, container:"+O.container+", codecs[level/parsed]=["+(l.attrs.CODECS||"")+"/"+O.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,h),Object.keys(h).forEach(function(W){var P=h[W],K=P.initSegment;K!=null&&K.byteLength&&p.hls.trigger(B.Events.BUFFER_APPENDING,{type:W,data:K,frag:d,part:null,chunkMeta:b,parent:d.type})}),this.tick()},y.backtrack=function(l){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(l);var h=this.fragmentTracker.backtrack(l);this.fragPrevious=null,this.nextLoadPosition=l.start,h?this.resetFragmentLoading(l):this.state=L.State.BACKTRACKING},y.checkFragmentChanged=function(){var l=this.media,h=null;if(l&&l.readyState>1&&l.seeking===!1){var d=l.currentTime;if(M.BufferHelper.isBuffered(l,d)?h=this.getAppendedFrag(d):M.BufferHelper.isBuffered(l,d+.1)&&(h=this.getAppendedFrag(d+.1)),h){var b=this.fragPlaying,p=h.level;(!b||h.sn!==b.sn||b.level!==p||h.urlId!==b.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:h}),(!b||b.level!==p)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=h)}}},e(E,[{key:"nextLevel",get:function(){var l=this.nextBufferedFrag;return l?l.level:-1}},{key:"currentLevel",get:function(){var l=this.media;if(l){var h=this.getAppendedFrag(l.currentTime);if(h)return h.level}return-1}},{key:"nextBufferedFrag",get:function(){var l=this.media;if(l){var h=this.getAppendedFrag(l.currentTime);return this.followingBufferedFrag(h)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),E}(L.default)},"./src/controller/subtitle-stream-controller.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"SubtitleStreamController",function(){return t});var j=C("./src/events.ts"),L=C("./src/utils/logger.ts"),A=C("./src/utils/buffer-helper.ts"),B=C("./src/controller/fragment-finders.ts"),M=C("./src/utils/discontinuities.ts"),w=C("./src/controller/level-helper.ts"),S=C("./src/controller/fragment-tracker.ts"),m=C("./src/controller/base-stream-controller.ts"),g=C("./src/types/loader.ts"),s=C("./src/types/level.ts");function a(r,T){for(var v=0;v<T.length;v++){var f=T[v];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(r,f.key,f)}}function i(r,T,v){return T&&a(r.prototype,T),v&&a(r,v),r}function o(r,T){r.prototype=Object.create(T.prototype),r.prototype.constructor=r,n(r,T)}function n(r,T){return n=Object.setPrototypeOf||function(f,E){return f.__proto__=E,f},n(r,T)}var e=500,t=function(r){o(T,r);function T(f,E){var y;return y=r.call(this,f,E,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var v=T.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var E=this.hls;E.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(j.Events.ERROR,this.onError,this),E.on(j.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),E.on(j.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),E.on(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),E.on(j.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),E.on(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var E=this.hls;E.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(j.Events.ERROR,this.onError,this),E.off(j.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),E.off(j.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),E.off(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),E.off(j.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),E.off(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=m.State.IDLE,this.setInterval(e),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(E,y){this.mainDetails=y.details},v.onSubtitleFragProcessed=function(E,y){var u=y.frag,l=y.success;if(this.fragPrevious=u,this.state=m.State.IDLE,!l)return;var h=this.tracksBuffered[this.currentTrackId];if(!h)return;for(var d,b=u.start,p=0;p<h.length;p++)if(b>=h[p].start&&b<=h[p].end){d=h[p];break}var x=u.start+u.duration;d?d.end=x:(d={start:b,end:x},h.push(d)),this.fragmentTracker.fragBuffered(u)},v.onBufferFlushing=function(E,y){var u=y.startOffset,l=y.endOffset;if(u===0&&l!==Number.POSITIVE_INFINITY){var h=this.currentTrackId,d=this.levels;if(!d.length||!d[h]||!d[h].details)return;var b=d[h].details,p=b.targetduration,x=l-p;if(x<=0)return;y.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(R){for(var O=0;O<R.length;){if(R[O].end<=x){R.shift();continue}else if(R[O].start<x)R[O].start=x;else break;O++}}),this.fragmentTracker.removeFragmentsInRange(u,x,g.PlaylistLevelType.SUBTITLE)}},v.onError=function(E,y){var u,l=y.frag;if(!l||l.type!==g.PlaylistLevelType.SUBTITLE)return;(u=this.fragCurrent)!==null&&u!==void 0&&u.loader&&this.fragCurrent.loader.abort(),this.state=m.State.IDLE},v.onSubtitleTracksUpdated=function(E,y){var u=this,l=y.subtitleTracks;this.tracksBuffered=[],this.levels=l.map(function(h){return new s.Level(h)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(h){u.tracksBuffered[h.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(E,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var u=this.levels[this.currentTrackId];u!=null&&u.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,u&&this.setInterval(e)},v.onSubtitleTrackLoaded=function(E,y){var u,l=y.details,h=y.id,d=this.currentTrackId,b=this.levels;if(!b.length)return;var p=b[d];if(h>=b.length||h!==d||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,l.live||(u=p.details)!==null&&u!==void 0&&u.live){var x=this.mainDetails;if(l.deltaUpdateFailed||!x)return;var R=x.fragments[0];if(!p.details)l.hasProgramDateTime&&x.hasProgramDateTime?Object(M.alignMediaPlaylistByPDT)(l,x):R&&Object(w.addSliding)(l,R.start);else{var O=this.alignPlaylists(l,p.details);O===0&&R&&Object(w.addSliding)(l,R.start)}}if(p.details=l,this.levelLastLoaded=h,this.tick(),l.live&&!this.fragCurrent&&this.media&&this.state===m.State.IDLE){var N=Object(B.findFragmentByPTS)(null,l.fragments,this.media.currentTime,0);N||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},v._handleFragmentLoadComplete=function(E){var y=E.frag,u=E.payload,l=y.decryptdata,h=this.hls;if(this.fragContextChanged(y))return;if(u&&u.byteLength>0&&l&&l.key&&l.iv&&l.method==="AES-128"){var d=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(u),l.key.buffer,l.iv.buffer).then(function(b){var p=performance.now();h.trigger(j.Events.FRAG_DECRYPTED,{frag:y,payload:b,stats:{tstart:d,tdecrypt:p}})})}},v.doTick=function(){if(!this.media){this.state=m.State.IDLE;return}if(this.state===m.State.IDLE){var E,y=this.currentTrackId,u=this.levels;if(!u.length||!u[y]||!u[y].details)return;var l=u[y].details,h=l.targetduration,d=this.config,b=this.media,p=A.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-h,d.maxBufferHole),x=p.end,R=p.len,O=this.getMaxBufferLength()+h;if(R>O)return;console.assert(l,"Subtitle track details are defined on idle subtitle stream controller tick");var N=l.fragments,U=N.length,W=l.edge,P,K=this.fragPrevious;if(x<W){var V=d.maxFragLookUpTolerance;K&&l.hasProgramDateTime&&(P=Object(B.findFragmentByPDT)(N,K.endProgramDateTime,V)),P||(P=Object(B.findFragmentByPTS)(K,N,x,V),!P&&K&&K.start<N[0].start&&(P=N[0]))}else P=N[U-1];(E=P)!==null&&E!==void 0&&E.encrypted?(L.logger.log("Loading key for "+P.sn),this.state=m.State.KEY_LOADING,this.hls.trigger(j.Events.KEY_LOADING,{frag:P})):P&&this.fragmentTracker.getState(P)===S.FragmentState.NOT_LOADED&&this.loadFragment(P,l,x)}},v.loadFragment=function(E,y,u){this.fragCurrent=E,r.prototype.loadFragment.call(this,E,y,u)},i(T,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),T}(m.default)},"./src/controller/subtitle-track-controller.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/events.ts"),L=C("./src/utils/texttrack-utils.ts"),A=C("./src/controller/base-playlist-controller.ts"),B=C("./src/types/loader.ts");function M(a,i){for(var o=0;o<i.length;o++){var n=i[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(a,n.key,n)}}function w(a,i,o){return i&&M(a.prototype,i),o&&M(a,o),a}function S(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,m(a,i)}function m(a,i){return m=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},m(a,i)}var g=function(a){S(i,a);function i(n){var e;return e=a.call(this,n,"[subtitle-track-controller]")||this,e.media=null,e.tracks=[],e.groupId=null,e.tracksInGroup=[],e.trackId=-1,e.selectDefaultTrack=!0,e.queuedDefaultTrack=-1,e.trackChangeListener=function(){return e.onTextTracksChanged()},e.asyncPollTrackChange=function(){return e.pollTrackChange(0)},e.useTextTrackPolling=!1,e.subtitlePollingInterval=-1,e.subtitleDisplay=!0,e.registerListeners(),e}var o=i.prototype;return o.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,a.prototype.destroy.call(this)},o.registerListeners=function(){var e=this.hls;e.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(j.Events.ERROR,this.onError,this)},o.unregisterListeners=function(){var e=this.hls;e.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(j.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(j.Events.ERROR,this.onError,this)},o.onMediaAttached=function(e,t){if(this.media=t.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},o.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},o.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 e=s(this.media.textTracks);e.forEach(function(t){Object(L.clearCurrentCues)(t)}),this.subtitleTrack=-1,this.media=null},o.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},o.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},o.onSubtitleTrackLoaded=function(e,t){var r=t.id,T=t.details,v=this.trackId,f=this.tracksInGroup[v];if(!f){this.warn("Invalid subtitle track id "+r);return}var E=f.details;f.details=t.details,this.log("subtitle track "+r+" loaded ["+T.startSN+"-"+T.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,E))},o.onLevelLoading=function(e,t){this.switchLevel(t.level)},o.onLevelSwitching=function(e,t){this.switchLevel(t.level)},o.switchLevel=function(e){var t=this.hls.levels[e];if(!(t!=null&&t.textGroupIds))return;var r=t.textGroupIds[t.urlId];if(this.groupId!==r){var T=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(y){return!r||y.groupId===r});this.tracksInGroup=v;var f=this.findTrackId(T==null?void 0:T.name)||this.findTrackId();this.groupId=r;var E={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(j.Events.SUBTITLE_TRACKS_UPDATED,E),f!==-1&&this.setSubtitleTrack(f,T)}},o.findTrackId=function(e){for(var t=this.tracksInGroup,r=0;r<t.length;r++){var T=t[r];if((!this.selectDefaultTrack||T.default)&&(!e||e===T.name))return T.id}return-1},o.onError=function(e,t){if(a.prototype.onError.call(this,e,t),t.fatal||!t.context)return;t.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},o.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var r=t.id,T=t.groupId,v=t.url;if(e)try{v=e.addDirectives(v)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+r),this.hls.trigger(j.Events.SUBTITLE_TRACK_LOADING,{url:v,id:r,groupId:T,deliveryDirectives:e||null})}},o.toggleTrackModes=function(e){var t=this,r=this.media,T=this.subtitleDisplay,v=this.trackId;if(!r)return;var f=s(r.textTracks),E=f.filter(function(l){return l.groupId===t.groupId});if(e===-1)[].slice.call(f).forEach(function(l){l.mode="disabled"});else{var y=E[v];y&&(y.mode="disabled")}var u=E[e];u&&(u.mode=T?"showing":"hidden")},o.setSubtitleTrack=function(e,t){var r,T=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(e===-1||(r=T[e])!==null&&r!==void 0&&r.details)||e<-1||e>=T.length)return;this.clearTimer();var v=T[e];if(this.log("Switching to subtitle track "+e),this.trackId=e,v){var f=v.id,E=v.groupId,y=E===void 0?"":E,u=v.name,l=v.type,h=v.url;this.hls.trigger(j.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:y,name:u,type:l,url:h});var d=this.switchParams(v.url,t==null?void 0:t.details);this.loadPlaylist(d)}else this.hls.trigger(j.Events.SUBTITLE_TRACK_SWITCH,{id:e})},o.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var e=-1,t=s(this.media.textTracks),r=0;r<t.length;r++)if(t[r].mode==="hidden")e=r;else if(t[r].mode==="showing"){e=r;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)},w(i,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1;var t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}}]),i}(A.default);function s(a){for(var i=[],o=0;o<a.length;o++){var n=a[o];n.kind==="subtitles"&&n.label&&i.push(a[o])}return i}H.default=g},"./src/controller/timeline-controller.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"TimelineController",function(){return s});var j=C("./src/polyfills/number.ts"),L=C("./src/events.ts"),A=C("./src/utils/cea-608-parser.ts"),B=C("./src/utils/output-filter.ts"),M=C("./src/utils/webvtt-parser.ts"),w=C("./src/utils/texttrack-utils.ts"),S=C("./src/utils/imsc1-ttml-parser.ts"),m=C("./src/types/loader.ts"),g=C("./src/utils/logger.ts"),s=function(){function n(t){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=o(),this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var r=new B.default(this,"textTrack1"),T=new B.default(this,"textTrack2"),v=new B.default(this,"textTrack3"),f=new B.default(this,"textTrack4");this.cea608Parser1=new A.default(1,r,T),this.cea608Parser2=new A.default(3,v,f)}t.on(L.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(L.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(L.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(L.Events.FRAG_LOADING,this.onFragLoading,this),t.on(L.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(L.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(L.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(L.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(L.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=n.prototype;return e.destroy=function(){var r=this.hls;r.off(L.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(L.Events.MANIFEST_LOADED,this.onManifestLoaded,this),r.off(L.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),r.off(L.Events.FRAG_LOADING,this.onFragLoading,this),r.off(L.Events.FRAG_LOADED,this.onFragLoaded,this),r.off(L.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),r.off(L.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),r.off(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),r.off(L.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),r.off(L.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(r,T,v,f,E){for(var y=!1,u=E.length;u--;){var l=E[u],h=i(l[0],l[1],T,v);if(h>=0&&(l[0]=Math.min(l[0],T),l[1]=Math.max(l[1],v),y=!0,h/(v-T)>.5))return}if(y||E.push([T,v]),this.config.renderTextTracksNatively){var d=this.captionsTracks[r];this.Cues.newCue(d,T,v,f)}else{var b=this.Cues.newCue(null,T,v,f);this.hls.trigger(L.Events.CUES_PARSED,{type:"captions",cues:b,track:r})}},e.onInitPtsFound=function(r,T){var v=this,f=T.frag,E=T.id,y=T.initPTS,u=T.timescale,l=this.unparsedVttFrags;E==="main"&&(this.initPTS[f.cc]=y,this.timescale[f.cc]=u),l.length&&(this.unparsedVttFrags=[],l.forEach(function(h){v.onFragLoaded(L.Events.FRAG_LOADED,h)}))},e.getExistingTrack=function(r){var T=this.media;if(T)for(var v=0;v<T.textTracks.length;v++){var f=T.textTracks[v];if(f[r])return f}return null},e.createCaptionsTrack=function(r){this.config.renderTextTracksNatively?this.createNativeTrack(r):this.createNonNativeTrack(r)},e.createNativeTrack=function(r){if(this.captionsTracks[r])return;var T=this.captionsProperties,v=this.captionsTracks,f=this.media,E=T[r],y=E.label,u=E.languageCode,l=this.getExistingTrack(r);if(l)v[r]=l,Object(w.clearCurrentCues)(v[r]),Object(w.sendAddTrackEvent)(v[r],f);else{var h=this.createTextTrack("captions",y,u);h&&(h[r]=!0,v[r]=h)}},e.createNonNativeTrack=function(r){if(this.nonNativeCaptionsTracks[r])return;var T=this.captionsProperties[r];if(!T)return;var v=T.label,f={_id:r,label:v,kind:"captions",default:T.media?!!T.media.default:!1,closedCaptions:T.media};this.nonNativeCaptionsTracks[r]=f,this.hls.trigger(L.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},e.createTextTrack=function(r,T,v){var f=this.media;return f?f.addTextTrack(r,T,v):void 0},e.onMediaAttaching=function(r,T){this.media=T.media,this._cleanTracks()},e.onMediaDetaching=function(){var r=this.captionsTracks;Object.keys(r).forEach(function(T){Object(w.clearCurrentCues)(r[T]),delete r[T]}),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=o(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},e._cleanTracks=function(){var r=this.media;if(!r)return;var T=r.textTracks;if(T)for(var v=0;v<T.length;v++)Object(w.clearCurrentCues)(T[v])},e.onSubtitleTracksUpdated=function(r,T){var v=this;this.textTracks=[];var f=T.subtitleTracks||[],E=f.some(function(h){return h.textCodec===S.IMSC1_CODEC});if(this.config.enableWebVTT||E&&this.config.enableIMSC1){var y=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var u=this.media?this.media.textTracks:[];this.tracks.forEach(function(h,d){var b;if(d<u.length){for(var p=null,x=0;x<u.length;x++)if(a(u[x],h)){p=u[x];break}p&&(b=p)}b?Object(w.clearCurrentCues)(b):(b=v.createTextTrack("subtitles",h.name,h.lang),b&&(b.mode="disabled")),b&&(b.groupId=h.groupId,v.textTracks.push(b))})}else if(!y&&this.tracks&&this.tracks.length){var l=this.tracks.map(function(h){return{label:h.name,kind:h.type.toLowerCase(),default:h.default,subtitleTrack:h}});this.hls.trigger(L.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:l})}}},e.onManifestLoaded=function(r,T){var v=this;this.config.enableCEA708Captions&&T.captions&&T.captions.forEach(function(f){var E=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!E)return;var y="textTrack"+E[1],u=v.captionsProperties[y];if(!u)return;u.label=f.name,f.lang&&(u.languageCode=f.lang),u.media=f})},e.onFragLoading=function(r,T){var v=this.cea608Parser1,f=this.cea608Parser2,E=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(v&&f))return;if(T.frag.type===m.PlaylistLevelType.MAIN){var u,l,h=T.frag.sn,d=(u=T==null||((l=T.part)===null||l===void 0)?void 0:l.index)!=null?u:-1;h===E+1||h===E&&d===y+1||(v.reset(),f.reset()),this.lastSn=h,this.lastPartIndex=d}},e.onFragLoaded=function(r,T){var v=T.frag,f=T.payload,E=this.initPTS,y=this.unparsedVttFrags;if(v.type===m.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(j.isFiniteNumber)(E[v.cc])){y.push(T),E.length&&this.hls.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var u=v.decryptdata;if(u==null||u.key==null||u.method!=="AES-128"){var l=this.tracks[v.level],h=this.vttCCs;h[v.cc]||(h[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),l&&l.textCodec===S.IMSC1_CODEC?this._parseIMSC1(v,f):this._parseVTTs(v,f,h)}}else this.hls.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(r,T){var v=this,f=this.hls;Object(S.parseIMSC1)(T,this.initPTS[r.cc],this.timescale[r.cc],function(E){v._appendCues(E,r.level),f.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},function(E){g.logger.log("Failed to parse IMSC1: "+E),f.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:E})})},e._parseVTTs=function(r,T,v){var f=this,E=this.hls;Object(M.parseWebVTT)(T,this.initPTS[r.cc],this.timescale[r.cc],v,r.cc,r.start,function(y){f._appendCues(y,r.level),E.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},function(y){f._fallbackToIMSC1(r,T),g.logger.log("Failed to parse VTT cue: "+y),E.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:y})})},e._fallbackToIMSC1=function(r,T){var v=this,f=this.tracks[r.level];f.textCodec||Object(S.parseIMSC1)(T,this.initPTS[r.cc],this.timescale[r.cc],function(){f.textCodec=S.IMSC1_CODEC,v._parseIMSC1(r,T)},function(){f.textCodec="wvtt"})},e._appendCues=function(r,T){var v=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[T];if(f.mode==="disabled")return;r.forEach(function(u){return Object(w.addCueToTrack)(f,u)})}else{var E=this.tracks[T],y=E.default?"default":"subtitles"+T;v.trigger(L.Events.CUES_PARSED,{type:"subtitles",cues:r,track:y})}},e.onFragDecrypted=function(r,T){var v=T.frag;if(v.type===m.PlaylistLevelType.SUBTITLE){if(!Object(j.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(T);return}this.onFragLoaded(L.Events.FRAG_LOADED,T)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(r,T){var v=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(v&&f))return;for(var E=0;E<T.samples.length;E++){var y=T.samples[E].bytes;if(y){var u=this.extractCea608Data(y);v.addData(T.samples[E].pts,u[0]),f.addData(T.samples[E].pts,u[1])}}},e.onBufferFlushing=function(r,T){var v=T.startOffset,f=T.endOffset,E=T.endOffsetSubtitles,y=T.type,u=this.media;if(!u||u.currentTime<f)return;if(!y||y==="video"){var l=this.captionsTracks;Object.keys(l).forEach(function(d){return Object(w.removeCuesInRange)(l[d],v,f)})}if(this.config.renderTextTracksNatively&&(v===0&&E!==void 0)){var h=this.textTracks;Object.keys(h).forEach(function(d){return Object(w.removeCuesInRange)(h[d],v,E)})}},e.extractCea608Data=function(r){for(var T=r[0]&31,v=2,f=[[],[]],E=0;E<T;E++){var y=r[v++],u=127&r[v++],l=127&r[v++],h=(4&y)!==0,d=3&y;if(u===0&&l===0)continue;h&&((d===0||d===1)&&(f[d].push(u),f[d].push(l)))}return f},n}();function a(n,e){return n&&n.label===e.name&&!(n.textTrack1||n.textTrack2)}function i(n,e,t,r){return Math.min(e,r)-Math.max(n,t)}function o(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return j});var j=function(){function L(B,M){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=M}var A=L.prototype;return A.decrypt=function(M,w){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},w,M)},L}()},"./src/crypt/aes-decryptor.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"removePadding",function(){return L}),C.d(H,"default",function(){return A});var j=C("./src/utils/typed-array.ts");function L(B){var M=B.byteLength,w=M&&new DataView(B.buffer).getUint8(M-1);return w?Object(j.sliceUint8)(B,0,M-w):B}var A=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var M=B.prototype;return M.uint8ArrayToUint32Array_=function(S){for(var m=new DataView(S),g=new Uint32Array(4),s=0;s<4;s++)g[s]=m.getUint32(s*4);return g},M.initTable=function(){var S=this.sBox,m=this.invSBox,g=this.subMix,s=g[0],a=g[1],i=g[2],o=g[3],n=this.invSubMix,e=n[0],t=n[1],r=n[2],T=n[3],v=new Uint32Array(256),f=0,E=0,y=0;for(y=0;y<256;y++)y<128?v[y]=y<<1:v[y]=y<<1^283;for(y=0;y<256;y++){var u=E^E<<1^E<<2^E<<3^E<<4;u=u>>>8^u&255^99,S[f]=u,m[u]=f;var l=v[f],h=v[l],d=v[h],b=v[u]*257^u*16843008;s[f]=b<<24|b>>>8,a[f]=b<<16|b>>>16,i[f]=b<<8|b>>>24,o[f]=b,b=d*16843009^h*65537^l*257^f*16843008,e[u]=b<<24|b>>>8,t[u]=b<<16|b>>>16,r[u]=b<<8|b>>>24,T[u]=b,f?(f=l^v[v[v[d^l]]],E^=v[v[E]]):f=E=1}},M.expandKey=function(S){for(var m=this.uint8ArrayToUint32Array_(S),g=!0,s=0;s<m.length&&g;)g=m[s]===this.key[s],s++;if(g)return;this.key=m;var a=this.keySize=m.length;if(a!==4&&a!==6&&a!==8)throw new Error("Invalid aes key size="+a);var i=this.ksRows=(a+6+1)*4,o,n,e=this.keySchedule=new Uint32Array(i),t=this.invKeySchedule=new Uint32Array(i),r=this.sBox,T=this.rcon,v=this.invSubMix,f=v[0],E=v[1],y=v[2],u=v[3],l,h;for(o=0;o<i;o++){if(o<a){l=e[o]=m[o];continue}h=l,o%a===0?(h=h<<8|h>>>24,h=r[h>>>24]<<24|r[h>>>16&255]<<16|r[h>>>8&255]<<8|r[h&255],h^=T[o/a|0]<<24):a>6&&o%a===4&&(h=r[h>>>24]<<24|r[h>>>16&255]<<16|r[h>>>8&255]<<8|r[h&255]),e[o]=l=(e[o-a]^h)>>>0}for(n=0;n<i;n++)o=i-n,n&3?h=e[o]:h=e[o-4],n<4||o<=4?t[n]=h:t[n]=f[r[h>>>24]]^E[r[h>>>16&255]]^y[r[h>>>8&255]]^u[r[h&255]],t[n]=t[n]>>>0},M.networkToHostOrderSwap=function(S){return S<<24|(S&65280)<<8|(S&16711680)>>8|S>>>24},M.decrypt=function(S,m,g){for(var s=this.keySize+6,a=this.invKeySchedule,i=this.invSBox,o=this.invSubMix,n=o[0],e=o[1],t=o[2],r=o[3],T=this.uint8ArrayToUint32Array_(g),v=T[0],f=T[1],E=T[2],y=T[3],u=new Int32Array(S),l=new Int32Array(u.length),h,d,b,p,x,R,O,N,U,W,P,K,V,re,ee=this.networkToHostOrderSwap;m<u.length;){for(U=ee(u[m]),W=ee(u[m+1]),P=ee(u[m+2]),K=ee(u[m+3]),x=U^a[0],R=K^a[1],O=P^a[2],N=W^a[3],V=4,re=1;re<s;re++)h=n[x>>>24]^e[R>>16&255]^t[O>>8&255]^r[N&255]^a[V],d=n[R>>>24]^e[O>>16&255]^t[N>>8&255]^r[x&255]^a[V+1],b=n[O>>>24]^e[N>>16&255]^t[x>>8&255]^r[R&255]^a[V+2],p=n[N>>>24]^e[x>>16&255]^t[R>>8&255]^r[O&255]^a[V+3],x=h,R=d,O=b,N=p,V=V+4;h=i[x>>>24]<<24^i[R>>16&255]<<16^i[O>>8&255]<<8^i[N&255]^a[V],d=i[R>>>24]<<24^i[O>>16&255]<<16^i[N>>8&255]<<8^i[x&255]^a[V+1],b=i[O>>>24]<<24^i[N>>16&255]<<16^i[x>>8&255]<<8^i[R&255]^a[V+2],p=i[N>>>24]<<24^i[x>>16&255]<<16^i[R>>8&255]<<8^i[O&255]^a[V+3],l[m]=ee(h^v),l[m+1]=ee(p^f),l[m+2]=ee(b^E),l[m+3]=ee(d^y),v=U,f=W,E=P,y=K,m=m+4}return l.buffer},B}()},"./src/crypt/decrypter.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return m});var j=C("./src/crypt/aes-crypto.ts"),L=C("./src/crypt/fast-aes-key.ts"),A=C("./src/crypt/aes-decryptor.ts"),B=C("./src/utils/logger.ts"),M=C("./src/utils/mp4-tools.ts"),w=C("./src/utils/typed-array.ts"),S=16,m=function(){function g(a,i,o){var n=o===void 0?{}:o,e=n.removePKCS7Padding,t=e===void 0?!0:e;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=a,this.config=i,this.removePKCS7Padding=t,t)try{var r=self.crypto;r&&(this.subtle=r.subtle||r.webkitSubtle)}catch(T){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var s=g.prototype;return s.destroy=function(){this.observer=null},s.isSync=function(){return this.config.enableSoftwareAES},s.flush=function(){var i=this.currentResult;if(!i){this.reset();return}var o=new Uint8Array(i);return this.reset(),this.removePKCS7Padding?Object(A.removePadding)(o):o},s.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},s.decrypt=function(i,o,n,e){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(i),o,n);var t=this.flush();t&&e(t.buffer)}else this.webCryptoDecrypt(new Uint8Array(i),o,n).then(e)},s.softwareDecrypt=function(i,o,n){var e=this.currentIV,t=this.currentResult,r=this.remainderData;this.logOnce("JS AES decrypt"),r&&(i=Object(M.appendUint8Array)(r,i),this.remainderData=null);var T=this.getValidChunk(i);if(!T.length)return null;e&&(n=e);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new A.default),v.expandKey(o);var f=t;return this.currentResult=v.decrypt(T.buffer,0,n),this.currentIV=Object(w.sliceUint8)(T,-16).buffer,f||null},s.webCryptoDecrypt=function(i,o,n){var e=this,t=this.subtle;return(this.key!==o||!this.fastAesKey)&&(this.key=o,this.fastAesKey=new L.default(t,o)),this.fastAesKey.expandKey().then(function(r){if(!t)return Promise.reject(new Error("web crypto not initialized"));var T=new j.default(t,n);return T.decrypt(i.buffer,r)}).catch(function(r){return e.onWebCryptoError(r,i,o,n)})},s.onWebCryptoError=function(i,o,n,e){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",i),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(o,n,e)},s.getValidChunk=function(i){var o=i,n=i.length-i.length%S;return n!==i.length&&(o=Object(w.sliceUint8)(i,0,n),this.remainderData=Object(w.sliceUint8)(i,n)),o},s.logOnce=function(i){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+i),this.logEnabled=!1},g}()},"./src/crypt/fast-aes-key.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return j});var j=function(){function L(B,M){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=M}var A=L.prototype;return A.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},L}()},"./src/demux/aacdemuxer.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/demux/base-audio-demuxer.ts"),L=C("./src/demux/adts.ts"),A=C("./src/utils/logger.ts"),B=C("./src/demux/id3.ts");function M(m,g){m.prototype=Object.create(g.prototype),m.prototype.constructor=m,w(m,g)}function w(m,g){return w=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},w(m,g)}var S=function(m){M(g,m);function g(a,i){var o;return o=m.call(this)||this,o.observer=void 0,o.config=void 0,o.observer=a,o.config=i,o}var s=g.prototype;return s.resetInitSegment=function(i,o,n){m.prototype.resetInitSegment.call(this,i,o,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:i,duration:n,inputTimeScale:9e4,dropped:0}},g.probe=function(i){if(!i)return!1;for(var o=B.getID3Data(i,0)||[],n=o.length,e=i.length;n<e;n++)if(L.probe(i,n))return A.logger.log("ADTS sync word found !"),!0;return!1},s.canParse=function(i,o){return L.canParse(i,o)},s.appendFrame=function(i,o,n){L.initTrackConfig(i,this.observer,o,n,i.manifestCodec);var e=L.appendFrame(i,o,n,this.initPTS,this.frameIndex);if(e&&e.missing===0)return e},g}(j.default);S.minProbeByteLength=9,H.default=S},"./src/demux/adts.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"getAudioConfig",function(){return B}),C.d(H,"isHeaderPattern",function(){return M}),C.d(H,"getHeaderLength",function(){return w}),C.d(H,"getFullFrameLength",function(){return S}),C.d(H,"canGetFrameLength",function(){return m}),C.d(H,"isHeader",function(){return g}),C.d(H,"canParse",function(){return s}),C.d(H,"probe",function(){return a}),C.d(H,"initTrackConfig",function(){return i}),C.d(H,"getFrameDuration",function(){return o}),C.d(H,"parseFrameHeader",function(){return n}),C.d(H,"appendFrame",function(){return e});var j=C("./src/utils/logger.ts"),L=C("./src/errors.ts"),A=C("./src/events.ts");function B(t,r,T,v){var f,E,y,u,l=navigator.userAgent.toLowerCase(),h=v,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((r[T+2]&192)>>>6)+1;var b=(r[T+2]&60)>>>2;if(b>d.length-1){t.trigger(A.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return y=(r[T+2]&1)<<2,y|=(r[T+3]&192)>>>6,j.logger.log("manifest codec:"+v+", ADTS type:"+f+", samplingIndex:"+b),/firefox/i.test(l)?b>=6?(f=5,u=new Array(4),E=b-3):(f=2,u=new Array(2),E=b):l.indexOf("android")!==-1?(f=2,u=new Array(2),E=b):(f=5,u=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&b>=6?E=b-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(b>=6&&y===1||/vivaldi/i.test(l))||!v&&y===1)&&(f=2,u=new Array(2)),E=b)),u[0]=f<<3,u[0]|=(b&14)>>1,u[1]|=(b&1)<<7,u[1]|=y<<3,f===5&&(u[1]|=(E&14)>>1,u[2]=(E&1)<<7,u[2]|=2<<2,u[3]=0),{config:u,samplerate:d[b],channelCount:y,codec:"mp4a.40."+f,manifestCodec:h}}function M(t,r){return t[r]===255&&(t[r+1]&246)===240}function w(t,r){return t[r+1]&1?7:9}function S(t,r){return(t[r+3]&3)<<11|t[r+4]<<3|(t[r+5]&224)>>>5}function m(t,r){return r+5<t.length}function g(t,r){return r+1<t.length&&M(t,r)}function s(t,r){return m(t,r)&&M(t,r)&&S(t,r)<=t.length-r}function a(t,r){if(g(t,r)){var T=w(t,r);if(r+T>=t.length)return!1;var v=S(t,r);if(v<=T)return!1;var f=r+v;return f===t.length||g(t,f)}return!1}function i(t,r,T,v,f){if(!t.samplerate){var E=B(r,T,v,f);if(!E)return;t.config=E.config,t.samplerate=E.samplerate,t.channelCount=E.channelCount,t.codec=E.codec,t.manifestCodec=E.manifestCodec,j.logger.log("parsed codec:"+t.codec+", rate:"+E.samplerate+", channels:"+E.channelCount)}}function o(t){return 1024*9e4/t}function n(t,r,T,v,f){var E=w(t,r),y=S(t,r);if(y-=E,y>0){var u=T+v*f;return{headerLength:E,frameLength:y,stamp:u}}}function e(t,r,T,v,f){var E=o(t.samplerate),y=n(r,T,v,f,E);if(y){var u=y.frameLength,l=y.headerLength,h=y.stamp,d=l+u,b=Math.max(0,T+d-r.length),p;b?(p=new Uint8Array(d-l),p.set(r.subarray(T+l,r.length),0)):p=r.subarray(T+l,T+d);var x={unit:p,pts:h};return b||t.samples.push(x),{sample:x,length:d,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"initPTSFn",function(){return S});var j=C("./src/polyfills/number.ts"),L=C("./src/demux/id3.ts"),A=C("./src/demux/dummy-demuxed-track.ts"),B=C("./src/utils/mp4-tools.ts"),M=C("./src/utils/typed-array.ts"),w=function(){function m(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var g=m.prototype;return g.resetInitSegment=function(a,i,o){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},g.resetTimeStamp=function(){},g.resetContiguity=function(){},g.canParse=function(a,i){return!1},g.appendFrame=function(a,i,o){},g.demux=function(a,i){this.cachedData&&(a=Object(B.appendUint8Array)(this.cachedData,a),this.cachedData=null);var o=L.getID3Data(a,0),n=o?o.length:0,e,t,r=this._audioTrack,T=this._id3Track,v=o?L.getTimeStamp(o):void 0,f=a.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=S(v,i)),o&&o.length>0&&T.samples.push({pts:this.initPTS,dts:this.initPTS,data:o}),t=this.initPTS;n<f;){if(this.canParse(a,n)){var E=this.appendFrame(r,a,n);E?(this.frameIndex++,t=E.sample.pts,n+=E.length,e=n):n=f}else L.canParse(a,n)?(o=L.getID3Data(a,n),T.samples.push({pts:t,dts:t,data:o}),n+=o.length,e=n):n++;if(n===f&&e!==f){var y=Object(M.sliceUint8)(a,e);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:r,avcTrack:Object(A.dummyTrack)(),id3Track:T,textTrack:Object(A.dummyTrack)()}},g.demuxSampleAes=function(a,i,o){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},g.flush=function(a){var i=this.cachedData;return i&&(this.cachedData=null,this.demux(i,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(A.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(A.dummyTrack)()}},g.destroy=function(){},m}(),S=function(g,s){return Object(j.isFiniteNumber)(g)?g*90:s*9e4};H.default=w},"./src/demux/chunk-cache.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return j});var j=function(){function A(){this.chunks=[],this.dataLength=0}var B=A.prototype;return B.push=function(w){this.chunks.push(w),this.dataLength+=w.length},B.flush=function(){var w=this.chunks,S=this.dataLength,m;if(w.length)w.length===1?m=w[0]:m=L(w,S);else return new Uint8Array(0);return this.reset(),m},B.reset=function(){this.chunks.length=0,this.dataLength=0},A}();function L(A,B){for(var M=new Uint8Array(B),w=0,S=0;S<A.length;S++){var m=A[S];M.set(m,w),w+=m.length}return M}},"./src/demux/dummy-demuxed-track.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"dummyTrack",function(){return j});function j(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/utils/logger.ts"),L=function(){function A(M){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=M,this.bytesAvailable=M.byteLength,this.word=0,this.bitsAvailable=0}var B=A.prototype;return B.loadWord=function(){var w=this.data,S=this.bytesAvailable,m=w.byteLength-S,g=new Uint8Array(4),s=Math.min(4,S);if(s===0)throw new Error("no bytes available");g.set(w.subarray(m,m+s)),this.word=new DataView(g.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s},B.skipBits=function(w){var S;this.bitsAvailable>w?(this.word<<=w,this.bitsAvailable-=w):(w-=this.bitsAvailable,S=w>>3,w-=S>>3,this.bytesAvailable-=S,this.loadWord(),this.word<<=w,this.bitsAvailable-=w)},B.readBits=function(w){var S=Math.min(this.bitsAvailable,w),m=this.word>>>32-S;return w>32&&j.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=S,this.bitsAvailable>0?this.word<<=S:this.bytesAvailable>0&&this.loadWord(),S=w-S,S>0&&this.bitsAvailable?m<<S|this.readBits(S):m},B.skipLZ=function(){var w;for(w=0;w<this.bitsAvailable;++w)if((this.word&2147483648>>>w)!==0)return this.word<<=w,this.bitsAvailable-=w,w;return this.loadWord(),w+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var w=this.skipLZ();return this.readBits(w+1)-1},B.readEG=function(){var w=this.readUEG();return 1&w?1+w>>>1:-1*(w>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(w){for(var S=8,m=8,g,s=0;s<w;s++)m!==0&&(g=this.readEG(),m=(S+g+256)%256),S=m===0?S:m},B.readSPS=function(){var w=0,S=0,m=0,g=0,s,a,i,o=this.readUByte.bind(this),n=this.readBits.bind(this),e=this.readUEG.bind(this),t=this.readBoolean.bind(this),r=this.skipBits.bind(this),T=this.skipEG.bind(this),v=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);o();var E=o();if(n(5),r(3),o(),v(),E===100||E===110||E===122||E===244||E===44||E===83||E===86||E===118||E===128){var y=e();if(y===3&&r(1),v(),v(),r(1),t())for(a=y!==3?8:12,i=0;i<a;i++)t()&&(i<6?f(16):f(64))}v();var u=e();if(u===0)e();else if(u===1)for(r(1),T(),T(),s=e(),i=0;i<s;i++)T();v(),r(1);var l=e(),h=e(),d=n(1);d===0&&r(1),r(1),t()&&(w=e(),S=e(),m=e(),g=e());var b=[1,1];if(t()&&t()){var p=o();switch(p){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[o()<<8|o(),o()<<8|o()];break}}}return{width:Math.ceil((l+1)*16-w*2-S*2),height:(2-d)*(h+1)*16-(d?2:4)*(m+g),pixelRatio:b}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},A}();H.default=L},"./src/demux/id3.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"isHeader",function(){return j}),C.d(H,"isFooter",function(){return L}),C.d(H,"getID3Data",function(){return A}),C.d(H,"canParse",function(){return M}),C.d(H,"getTimeStamp",function(){return w}),C.d(H,"isTimeStampFrame",function(){return S}),C.d(H,"getID3Frames",function(){return g}),C.d(H,"decodeFrame",function(){return s}),C.d(H,"utf8ArrayToStr",function(){return e}),C.d(H,"testables",function(){return t});var j=function(f,E){return E+10<=f.length&&(f[E]===73&&f[E+1]===68&&f[E+2]===51&&(f[E+3]<255&&f[E+4]<255&&(f[E+6]<128&&f[E+7]<128&&f[E+8]<128&&f[E+9]<128)))},L=function(f,E){return E+10<=f.length&&(f[E]===51&&f[E+1]===68&&f[E+2]===73&&(f[E+3]<255&&f[E+4]<255&&(f[E+6]<128&&f[E+7]<128&&f[E+8]<128&&f[E+9]<128)))},A=function(f,E){for(var y=E,u=0;j(f,E);){u+=10;var l=B(f,E+6);u+=l,L(f,E+10)&&(u+=10),E+=u}return u>0?f.subarray(y,y+u):void 0},B=function(f,E){var y=0;return y=(f[E]&127)<<21,y|=(f[E+1]&127)<<14,y|=(f[E+2]&127)<<7,y|=f[E+3]&127,y},M=function(f,E){return j(f,E)&&B(f,E+6)+10<=f.length-E},w=function(f){for(var E=g(f),y=0;y<E.length;y++){var u=E[y];if(S(u))return n(u)}return},S=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},m=function(f){var E=String.fromCharCode(f[0],f[1],f[2],f[3]),y=B(f,4),u=10;return{type:E,size:y,data:f.subarray(u,u+y)}},g=function(f){for(var E=0,y=[];j(f,E);){var u=B(f,E+6);E+=10;for(var l=E+u;E+8<l;){var h=m(f.subarray(E)),d=s(h);d&&y.push(d),E+=h.size+10}L(f,E)&&(E+=10)}return y},s=function(f){return f.type==="PRIV"?a(f):f.type[0]==="W"?o(f):i(f)},a=function(f){if(f.size<2)return;var E=e(f.data,!0),y=new Uint8Array(f.data.subarray(E.length+1));return{key:f.type,info:E,data:y.buffer}},i=function(f){if(f.size<2)return;if(f.type==="TXXX"){var E=1,y=e(f.data.subarray(E),!0);E+=y.length+1;var u=e(f.data.subarray(E));return{key:f.type,info:y,data:u}}var l=e(f.data.subarray(1));return{key:f.type,data:l}},o=function(f){if(f.type==="WXXX"){if(f.size<2)return;var E=1,y=e(f.data.subarray(E),!0);E+=y.length+1;var u=e(f.data.subarray(E));return{key:f.type,info:y,data:u}}var l=e(f.data);return{key:f.type,data:l}},n=function(f){if(f.data.byteLength===8){var E=new Uint8Array(f.data),y=E[3]&1,u=(E[4]<<23)+(E[5]<<15)+(E[6]<<7)+E[7];return u/=45,y&&(u+=4772185884e-2),Math.round(u)}return},e=function(f,E){E===void 0&&(E=!1);var y=T();if(y){var u=y.decode(f);if(E){var l=u.indexOf("\0");return l!==-1?u.substring(0,l):u}return u.replace(/\0/g,"")}for(var h=f.length,d,b,p,x="",R=0;R<h;){if(d=f[R++],d===0&&E)return x;if(d===0||d===3)continue;switch(d>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:x+=String.fromCharCode(d);break;case 12:case 13:b=f[R++],x+=String.fromCharCode((d&31)<<6|b&63);break;case 14:b=f[R++],p=f[R++],x+=String.fromCharCode((d&15)<<12|(b&63)<<6|(p&63)<<0);break;default:}}return x},t={decodeTextFrame:i},r;function T(){return!r&&typeof self.TextDecoder!="undefined"&&(r=new self.TextDecoder("utf-8")),r}},"./src/demux/mp3demuxer.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/demux/base-audio-demuxer.ts"),L=C("./src/demux/id3.ts"),A=C("./src/utils/logger.ts"),B=C("./src/demux/mpegaudio.ts");function M(m,g){m.prototype=Object.create(g.prototype),m.prototype.constructor=m,w(m,g)}function w(m,g){return w=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},w(m,g)}var S=function(m){M(g,m);function g(){return m.apply(this,arguments)||this}var s=g.prototype;return s.resetInitSegment=function(i,o,n){m.prototype.resetInitSegment.call(this,i,o,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:i,duration:n,inputTimeScale:9e4,dropped:0}},g.probe=function(i){if(!i)return!1;for(var o=L.getID3Data(i,0)||[],n=o.length,e=i.length;n<e;n++)if(B.probe(i,n))return A.logger.log("MPEG Audio sync word found !"),!0;return!1},s.canParse=function(i,o){return B.canParse(i,o)},s.appendFrame=function(i,o,n){return this.initPTS===null?void 0:B.appendFrame(i,o,n,this.initPTS,this.frameIndex)},g}(j.default);S.minProbeByteLength=4,H.default=S},"./src/demux/mp4demuxer.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/utils/mp4-tools.ts"),L=C("./src/demux/dummy-demuxed-track.ts"),A=function(){function B(w,S){this.remainderData=null,this.config=void 0,this.config=S}var M=B.prototype;return M.resetTimeStamp=function(){},M.resetInitSegment=function(){},M.resetContiguity=function(){},B.probe=function(S){return Object(j.findBox)({data:S,start:0,end:Math.min(S.length,16384)},["moof"]).length>0},M.demux=function(S){var m=S,g=Object(L.dummyTrack)();if(this.config.progressive){this.remainderData&&(m=Object(j.appendUint8Array)(this.remainderData,S));var s=Object(j.segmentValidRange)(m);this.remainderData=s.remainder,g.samples=s.valid||new Uint8Array}else g.samples=m;return{audioTrack:Object(L.dummyTrack)(),avcTrack:g,id3Track:Object(L.dummyTrack)(),textTrack:Object(L.dummyTrack)()}},M.flush=function(){var S=Object(L.dummyTrack)();return S.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(L.dummyTrack)(),avcTrack:S,id3Track:Object(L.dummyTrack)(),textTrack:Object(L.dummyTrack)()}},M.demuxSampleAes=function(S,m,g){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},M.destroy=function(){},B}();A.minProbeByteLength=1024,H.default=A},"./src/demux/mpegaudio.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"appendFrame",function(){return w}),C.d(H,"parseHeader",function(){return S}),C.d(H,"isHeaderPattern",function(){return m}),C.d(H,"isHeader",function(){return g}),C.d(H,"canParse",function(){return s}),C.d(H,"probe",function(){return a});var j=null,L=[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],A=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],M=[0,1,1,4];function w(i,o,n,e,t){if(n+24>o.length)return;var r=S(o,n);if(r&&n+r.frameLength<=o.length){var T=r.samplesPerFrame*9e4/r.sampleRate,v=e+t*T,f={unit:o.subarray(n,n+r.frameLength),pts:v,dts:v};return i.config=[],i.channelCount=r.channelCount,i.samplerate=r.sampleRate,i.samples.push(f),{sample:f,length:r.frameLength,missing:0}}}function S(i,o){var n=i[o+1]>>3&3,e=i[o+1]>>1&3,t=i[o+2]>>4&15,r=i[o+2]>>2&3;if(n!==1&&t!==0&&t!==15&&r!==3){var T=i[o+2]>>1&1,v=i[o+3]>>6,f=n===3?3-e:e===3?3:4,E=L[f*14+t-1]*1e3,y=n===3?0:n===2?1:2,u=A[y*3+r],l=v===3?1:2,h=B[n][e],d=M[e],b=h*8*d,p=Math.floor(h*E/u+T)*d;if(j===null){var x=navigator.userAgent||"",R=x.match(/Chrome\/(\d+)/i);j=R?parseInt(R[1]):0}var O=!!j&&j<=87;return O&&e===2&&E>=224e3&&v===0&&(i[o+3]=i[o+3]|128),{sampleRate:u,channelCount:l,frameLength:p,samplesPerFrame:b}}}function m(i,o){return i[o]===255&&(i[o+1]&224)===224&&(i[o+1]&6)!==0}function g(i,o){return o+1<i.length&&m(i,o)}function s(i,o){var n=4;return m(i,o)&&n<=i.length-o}function a(i,o){if(o+1<i.length&&m(i,o)){var n=4,e=S(i,o),t=n;e!=null&&e.frameLength&&(t=e.frameLength);var r=o+t;return r===i.length||g(i,r)}return!1}},"./src/demux/sample-aes.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/crypt/decrypter.ts"),L=C("./src/demux/tsdemuxer.ts"),A=function(){function B(w,S,m){this.keyData=void 0,this.decrypter=void 0,this.keyData=m,this.decrypter=new j.default(w,S,{removePKCS7Padding:!1})}var M=B.prototype;return M.decryptBuffer=function(S,m){this.decrypter.decrypt(S,this.keyData.key.buffer,this.keyData.iv.buffer,m)},M.decryptAacSample=function(S,m,g,s){var a=S[m].unit,i=a.subarray(16,a.length-a.length%16),o=i.buffer.slice(i.byteOffset,i.byteOffset+i.length),n=this;this.decryptBuffer(o,function(e){var t=new Uint8Array(e);a.set(t,16),s||n.decryptAacSamples(S,m+1,g)})},M.decryptAacSamples=function(S,m,g){for(;;m++){if(m>=S.length){g();return}if(S[m].unit.length<32)continue;var s=this.decrypter.isSync();if(this.decryptAacSample(S,m,g,s),!s)return}},M.getAvcEncryptedData=function(S){for(var m=Math.floor((S.length-48)/160)*16+16,g=new Int8Array(m),s=0,a=32;a<=S.length-16;a+=160,s+=16)g.set(S.subarray(a,a+16),s);return g},M.getAvcDecryptedUnit=function(S,m){for(var g=new Uint8Array(m),s=0,a=32;a<=S.length-16;a+=160,s+=16)S.set(g.subarray(s,s+16),a);return S},M.decryptAvcSample=function(S,m,g,s,a,i){var o=Object(L.discardEPB)(a.data),n=this.getAvcEncryptedData(o),e=this;this.decryptBuffer(n.buffer,function(t){a.data=e.getAvcDecryptedUnit(o,t),i||e.decryptAvcSamples(S,m,g+1,s)})},M.decryptAvcSamples=function(S,m,g,s){if(S instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;m++,g=0){if(m>=S.length){s();return}for(var a=S[m].units;!(g>=a.length);g++){var i=a[g];if(i.data.length<=48||i.type!==1&&i.type!==5)continue;var o=this.decrypter.isSync();if(this.decryptAvcSample(S,m,g,s,i,o),!o)return}}},B}();H.default=A},"./src/demux/transmuxer-interface.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return a});var j=C("./node_modules/webworkify-webpack/index.js"),L=C.n(j),A=C("./src/events.ts"),B=C("./src/demux/transmuxer.ts"),M=C("./src/utils/logger.ts"),w=C("./src/errors.ts"),S=C("./src/utils/mediasource-helper.ts"),m=C("./node_modules/eventemitter3/index.js"),g=C.n(m),s=Object(S.getMediaSource)()||{isTypeSupported:function(){return!1}},a=function(){function i(n,e,t,r){var T=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=n,this.id=e,this.onTransmuxComplete=t,this.onFlush=r;var v=n.config,f=function(h,d){d=d||{},d.frag=T.frag,d.id=T.id,n.trigger(h,d)};this.observer=new m.EventEmitter,this.observer.on(A.Events.FRAG_DECRYPTED,f),this.observer.on(A.Events.ERROR,f);var E={mp4:s.isTypeSupported("video/mp4"),mpeg:s.isTypeSupported("audio/mpeg"),mp3:s.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){M.logger.log("demuxing in webworker");var u;try{u=this.worker=j("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),u.addEventListener("message",this.onwmsg),u.onerror=function(l){n.trigger(A.Events.ERROR,{type:w.ErrorTypes.OTHER_ERROR,details:w.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(l.message+" ("+l.filename+":"+l.lineno+")")})},u.postMessage({cmd:"init",typeSupported:E,vendor:y,id:e,config:JSON.stringify(v)})}catch(l){M.logger.warn("Error in worker:",l),M.logger.error("Error while initializing DemuxerWorker, fallback to inline"),u&&self.URL.revokeObjectURL(u.objectURL),this.transmuxer=new B.default(this.observer,E,v,y,e),this.worker=null}}else this.transmuxer=new B.default(this.observer,E,v,y,e)}var o=i.prototype;return o.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null;else{var t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}var r=this.observer;r&&r.removeAllListeners(),this.observer=null},o.push=function(e,t,r,T,v,f,E,y,u,l){var h=this;u.transmuxing.start=self.performance.now();var d=this.transmuxer,b=this.worker,p=f?f.start:v.start,x=v.decryptdata,R=this.frag,O=!(R&&v.cc===R.cc),N=!(R&&u.level===R.level),U=R?u.sn-R.sn:-1,W=this.part?u.part-this.part.index:1,P=!N&&(U===1||U===0&&W===1),K=self.performance.now();(N||U||v.stats.parsing.start===0)&&(v.stats.parsing.start=K),f&&(W||!P)&&(f.stats.parsing.start=K);var V=new B.TransmuxState(O,P,y,N,p);if(!P||O){M.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+u.sn+" p: "+u.part+" level: "+u.level+" id: "+u.id+`
|
|
discontinuity: `+O+`
|
|
trackSwitch: `+N+`
|
|
contiguous: `+P+`
|
|
accurateTimeOffset: `+y+`
|
|
timeOffset: `+p);var re=new B.TransmuxConfig(r,T,t,E,l);this.configureTransmuxer(re)}if(this.frag=v,this.part=f,b)b.postMessage({cmd:"demux",data:e,decryptdata:x,chunkMeta:u,state:V},e instanceof ArrayBuffer?[e]:[]);else if(d){var ee=d.push(e,x,u,V);Object(B.isPromise)(ee)?ee.then(function(le){h.handleTransmuxComplete(le)}):this.handleTransmuxComplete(ee)}},o.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var r=this.transmuxer,T=this.worker;if(T)T.postMessage({cmd:"flush",chunkMeta:e});else if(r){var v=r.flush(e);Object(B.isPromise)(v)?v.then(function(f){t.handleFlushResult(f,e)}):this.handleFlushResult(v,e)}},o.handleFlushResult=function(e,t){var r=this;e.forEach(function(T){r.handleTransmuxComplete(T)}),this.onFlush(t)},o.onWorkerMessage=function(e){var t=e.data,r=this.hls;switch(t.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,r.trigger(t.event,t.data);break}}},o.configureTransmuxer=function(e){var t=this.worker,r=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):r&&r.configure(e)},o.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},i}()},"./src/demux/transmuxer-worker.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return w});var j=C("./src/demux/transmuxer.ts"),L=C("./src/events.ts"),A=C("./src/utils/logger.ts"),B=C("./node_modules/eventemitter3/index.js"),M=C.n(B);function w(a){var i=new B.EventEmitter,o=function(e,t){a.postMessage({event:e,data:t})};i.on(L.Events.FRAG_DECRYPTED,o),i.on(L.Events.ERROR,o),a.addEventListener("message",function(n){var e=n.data;switch(e.cmd){case"init":{var t=JSON.parse(e.config);a.transmuxer=new j.default(i,e.typeSupported,t,e.vendor,e.id),Object(A.enableLogs)(t.debug),o("init",null);break}case"configure":{a.transmuxer.configure(e.config);break}case"demux":{var r=a.transmuxer.push(e.data,e.decryptdata,e.chunkMeta,e.state);Object(j.isPromise)(r)?r.then(function(f){S(a,f)}):S(a,r);break}case"flush":{var T=e.chunkMeta,v=a.transmuxer.flush(T);Object(j.isPromise)(v)?v.then(function(f){g(a,f,T)}):g(a,v,T);break}default:break}})}function S(a,i){if(s(i.remuxResult))return;var o=[],n=i.remuxResult,e=n.audio,t=n.video;e&&m(o,e),t&&m(o,t),a.postMessage({event:"transmuxComplete",data:i},o)}function m(a,i){i.data1&&a.push(i.data1.buffer),i.data2&&a.push(i.data2.buffer)}function g(a,i,o){i.forEach(function(n){S(a,n)}),a.postMessage({event:"flush",data:o})}function s(a){return!a.audio&&!a.video&&!a.text&&!a.id3&&!a.initSegment}},"./src/demux/transmuxer.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return t}),C.d(H,"isPromise",function(){return v}),C.d(H,"TransmuxConfig",function(){return f}),C.d(H,"TransmuxState",function(){return E});var j=C("./src/events.ts"),L=C("./src/errors.ts"),A=C("./src/crypt/decrypter.ts"),B=C("./src/demux/aacdemuxer.ts"),M=C("./src/demux/mp4demuxer.ts"),w=C("./src/demux/tsdemuxer.ts"),S=C("./src/demux/mp3demuxer.ts"),m=C("./src/remux/mp4-remuxer.ts"),g=C("./src/remux/passthrough-remuxer.ts"),s=C("./src/demux/chunk-cache.ts"),a=C("./src/utils/mp4-tools.ts"),i=C("./src/utils/logger.ts"),o;try{o=self.performance.now.bind(self.performance)}catch(y){i.logger.debug("Unable to use Performance API on this environment"),o=self.Date.now}var n=[{demux:w.default,remux:m.default},{demux:M.default,remux:g.default},{demux:B.default,remux:m.default},{demux:S.default,remux:m.default}],e=1024;n.forEach(function(y){var u=y.demux;e=Math.max(e,u.minProbeByteLength)});var t=function(){function y(l,h,d,b,p){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 s.default,this.observer=l,this.typeSupported=h,this.config=d,this.vendor=b,this.id=p}var u=y.prototype;return u.configure=function(h){this.transmuxConfig=h,this.decrypter&&this.decrypter.reset()},u.push=function(h,d,b,p){var x=this,R=b.transmuxing;R.executeStart=o();var O=new Uint8Array(h),N=this.cache,U=this.config,W=this.currentTransmuxState,P=this.transmuxConfig;p&&(this.currentTransmuxState=p);var K=r(O,d);if(K&&K.method==="AES-128"){var V=this.getDecrypter();if(U.enableSoftwareAES){var re=V.softwareDecrypt(O,K.key.buffer,K.iv.buffer);if(!re)return R.executeEnd=o(),T(b);O=new Uint8Array(re)}else return this.decryptionPromise=V.webCryptoDecrypt(O,K.key.buffer,K.iv.buffer).then(function(ge){var be=x.push(ge,null,b);return x.decryptionPromise=null,be}),this.decryptionPromise}var ee=p||W,le=ee.contiguous,oe=ee.discontinuity,$=ee.trackSwitch,Z=ee.accurateTimeOffset,ne=ee.timeOffset,X=P.audioCodec,z=P.videoCodec,fe=P.defaultInitPts,Se=P.duration,Oe=P.initSegmentData;if((oe||$)&&this.resetInitSegment(Oe,X,z,Se),oe&&this.resetInitialTimestamp(fe),le||this.resetContiguity(),this.needsProbing(O,oe,$)){if(N.dataLength){var Ae=N.flush();O=Object(a.appendUint8Array)(Ae,O)}this.configureTransmuxer(O,P)}var Pe=this.transmux(O,K,ne,Z,b),me=this.currentTransmuxState;return me.contiguous=!0,me.discontinuity=!1,me.trackSwitch=!1,R.executeEnd=o(),Pe},u.flush=function(h){var d=this,b=h.transmuxing;b.executeStart=o();var p=this.decrypter,x=this.cache,R=this.currentTransmuxState,O=this.decryptionPromise;if(O)return O.then(function(){return d.flush(h)});var N=[],U=R.timeOffset;if(p){var W=p.flush();W&&N.push(this.push(W,null,h))}var P=x.dataLength;x.reset();var K=this.demuxer,V=this.remuxer;if(!K||!V)return P>=e&&this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=o(),[T(h)];var re=K.flush(U);return v(re)?re.then(function(ee){return d.flushRemux(N,ee,h),N}):(this.flushRemux(N,re,h),N)},u.flushRemux=function(h,d,b){var p=d.audioTrack,x=d.avcTrack,R=d.id3Track,O=d.textTrack,N=this.currentTransmuxState,U=N.accurateTimeOffset,W=N.timeOffset;i.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var P=this.remuxer.remux(p,x,R,O,W,U,!0,this.id);h.push({remuxResult:P,chunkMeta:b}),b.transmuxing.executeEnd=o()},u.resetInitialTimestamp=function(h){var d=this.demuxer,b=this.remuxer;if(!d||!b)return;d.resetTimeStamp(h),b.resetTimeStamp(h)},u.resetContiguity=function(){var h=this.demuxer,d=this.remuxer;if(!h||!d)return;h.resetContiguity(),d.resetNextTimestamp()},u.resetInitSegment=function(h,d,b,p){var x=this.demuxer,R=this.remuxer;if(!x||!R)return;x.resetInitSegment(d,b,p),R.resetInitSegment(h,d,b)},u.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},u.transmux=function(h,d,b,p,x){var R;return d&&d.method==="SAMPLE-AES"?R=this.transmuxSampleAes(h,d,b,p,x):R=this.transmuxUnencrypted(h,b,p,x),R},u.transmuxUnencrypted=function(h,d,b,p){var x=this.demuxer.demux(h,d,!1,!this.config.progressive),R=x.audioTrack,O=x.avcTrack,N=x.id3Track,U=x.textTrack,W=this.remuxer.remux(R,O,N,U,d,b,!1,this.id);return{remuxResult:W,chunkMeta:p}},u.transmuxSampleAes=function(h,d,b,p,x){var R=this;return this.demuxer.demuxSampleAes(h,d,b).then(function(O){var N=R.remuxer.remux(O.audioTrack,O.avcTrack,O.id3Track,O.textTrack,b,p,!1,R.id);return{remuxResult:N,chunkMeta:x}})},u.configureTransmuxer=function(h,d){for(var b=this.config,p=this.observer,x=this.typeSupported,R=this.vendor,O=d.audioCodec,N=d.defaultInitPts,U=d.duration,W=d.initSegmentData,P=d.videoCodec,K,V=0,re=n.length;V<re;V++)if(n[V].demux.probe(h)){K=n[V];break}K||(i.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),K={demux:M.default,remux:g.default});var ee=this.demuxer,le=this.remuxer,oe=K.remux,$=K.demux;(!le||!(le instanceof oe))&&(this.remuxer=new oe(p,b,x,R)),(!ee||!(ee instanceof $))&&(this.demuxer=new $(p,b,x),this.probe=$.probe),this.resetInitSegment(W,O,P,U),this.resetInitialTimestamp(N)},u.needsProbing=function(h,d,b){return!this.demuxer||!this.remuxer||d||b},u.getDecrypter=function(){var h=this.decrypter;return h||(h=this.decrypter=new A.default(this.observer,this.config)),h},y}();function r(y,u){var l=null;return y.byteLength>0&&u!=null&&u.key!=null&&u.iv!==null&&u.method!=null&&(l=u),l}var T=function(u){return{remuxResult:{},chunkMeta:u}};function v(y){return"then"in y&&y.then instanceof Function}var f=function(u,l,h,d,b){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=u,this.videoCodec=l,this.initSegmentData=h,this.duration=d,this.defaultInitPts=b},E=function(u,l,h,d,b){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=u,this.contiguous=l,this.accurateTimeOffset=h,this.trackSwitch=d,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"discardEPB",function(){return T});var j=C("./src/demux/adts.ts"),L=C("./src/demux/mpegaudio.ts"),A=C("./src/demux/exp-golomb.ts"),B=C("./src/demux/id3.ts"),M=C("./src/demux/sample-aes.ts"),w=C("./src/events.ts"),S=C("./src/utils/mp4-tools.ts"),m=C("./src/utils/logger.ts"),g=C("./src/errors.ts"),s={video:1,audio:2,id3:3,text:4},a=function(){function v(E,y,u){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=E,this.config=y,this.typeSupported=u}v.probe=function(y){var u=v.syncOffset(y);return u<0?!1:(u&&m.logger.warn("MPEG2-TS detected but first sync word found @ offset "+u+", junk ahead ?"),!0)},v.syncOffset=function(y){for(var u=Math.min(1e3,y.length-3*188),l=0;l<u;){if(y[l]===71&&y[l+188]===71&&y[l+2*188]===71)return l;l++}return-1},v.createTrack=function(y,u){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:s[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?u:void 0}};var f=v.prototype;return f.resetInitSegment=function(y,u,l){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",l),this._audioTrack=v.createTrack("audio",l),this._id3Track=v.createTrack("id3",l),this._txtTrack=v.createTrack("text",l),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=u,this._duration=l},f.resetTimeStamp=function(){},f.resetContiguity=function(){var y=this._audioTrack,u=this._avcTrack,l=this._id3Track;y&&(y.pesData=null),u&&(u.pesData=null),l&&(l.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(y,u,l,h){l===void 0&&(l=!1),h===void 0&&(h=!1),l||(this.sampleAes=null);var d,b=this._avcTrack,p=this._audioTrack,x=this._id3Track,R=b.pid,O=b.pesData,N=p.pid,U=x.pid,W=p.pesData,P=x.pesData,K=!1,V=this.pmtParsed,re=this._pmtId,ee=y.length;if(this.remainderData&&(y=Object(S.appendUint8Array)(this.remainderData,y),ee=y.length,this.remainderData=null),ee<188&&!h)return this.remainderData=y,{audioTrack:p,avcTrack:b,id3Track:x,textTrack:this._txtTrack};var le=Math.max(0,v.syncOffset(y));ee-=(ee+le)%188,ee<y.byteLength&&!h&&(this.remainderData=new Uint8Array(y.buffer,ee,y.buffer.byteLength-ee));for(var oe=le;oe<ee;oe+=188)if(y[oe]===71){var $=!!(y[oe+1]&64),Z=((y[oe+1]&31)<<8)+y[oe+2],ne=(y[oe+3]&48)>>4,X=void 0;if(ne>1){if(X=oe+5+y[oe+4],X===oe+188)continue}else X=oe+4;switch(Z){case R:$&&(O&&(d=e(O))&&this.parseAVCPES(d,!1),O={data:[],size:0}),O&&(O.data.push(y.subarray(X,oe+188)),O.size+=oe+188-X);break;case N:$&&(W&&(d=e(W))&&(p.isAAC?this.parseAACPES(d):this.parseMPEGPES(d)),W={data:[],size:0}),W&&(W.data.push(y.subarray(X,oe+188)),W.size+=oe+188-X);break;case U:$&&(P&&(d=e(P))&&this.parseID3PES(d),P={data:[],size:0}),P&&(P.data.push(y.subarray(X,oe+188)),P.size+=oe+188-X);break;case 0:$&&(X+=y[X]+1),re=this._pmtId=o(y,X);break;case re:{$&&(X+=y[X]+1);var z=n(y,X,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,l);R=z.avc,R>0&&(b.pid=R),N=z.audio,N>0&&(p.pid=N,p.isAAC=z.isAAC),U=z.id3,U>0&&(x.pid=U),K&&!V&&(m.logger.log("reparse from beginning"),K=!1,oe=le-188),V=this.pmtParsed=!0;break}case 17:case 8191:break;default:K=!0;break}}else this.observer.emit(w.Events.ERROR,w.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=O,p.pesData=W,x.pesData=P;var fe={audioTrack:p,avcTrack:b,id3Track:x,textTrack:this._txtTrack};return h&&this.extractRemainingSamples(fe),fe},f.flush=function(){var y=this.remainderData;this.remainderData=null;var u;return y?u=this.demux(y,-1,!1,!0):u={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(u),this.sampleAes?this.decrypt(u,this.sampleAes):u},f.extractRemainingSamples=function(y){var u=y.audioTrack,l=y.avcTrack,h=y.id3Track,d=l.pesData,b=u.pesData,p=h.pesData,x;d&&(x=e(d))?(this.parseAVCPES(x,!0),l.pesData=null):l.pesData=d,b&&(x=e(b))?(u.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),u.pesData=null):(b!=null&&b.size&&m.logger.log("last AAC PES packet truncated,might overlap between fragments"),u.pesData=b),p&&(x=e(p))?(this.parseID3PES(x),h.pesData=null):h.pesData=p},f.demuxSampleAes=function(y,u,l){var h=this.demux(y,l,!0,!this.config.progressive),d=this.sampleAes=new M.default(this.observer,this.config,u);return this.decrypt(h,d)},f.decrypt=function(y,u){return new Promise(function(l){var h=y.audioTrack,d=y.avcTrack;h.samples&&h.isAAC?u.decryptAacSamples(h.samples,0,function(){d.samples?u.decryptAvcSamples(d.samples,0,0,function(){l(y)}):l(y)}):d.samples&&u.decryptAvcSamples(d.samples,0,0,function(){l(y)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(y,u){var l=this,h=this._avcTrack,d=this.parseAVCNALu(y.data),b=!1,p=this.avcSample,x,R=!1;y.data=null,p&&d.length&&!h.audFound&&(t(p,h),p=this.avcSample=i(!1,y.pts,y.dts,"")),d.forEach(function(O){switch(O.type){case 1:{x=!0,p||(p=l.avcSample=i(!0,y.pts,y.dts,"")),b&&(p.debug+="NDR "),p.frame=!0;var N=O.data;if(R&&N.length>4){var U=new A.default(N).readSliceType();(U===2||U===4||U===7||U===9)&&(p.key=!0)}break}case 5:x=!0,p||(p=l.avcSample=i(!0,y.pts,y.dts,"")),b&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{x=!0,b&&p&&(p.debug+="SEI ");var W=new A.default(T(O.data));W.readUByte();for(var P=0,K=0,V=!1,re=0;!V&&W.bytesAvailable>1;){P=0;do re=W.readUByte(),P+=re;while(re===255);K=0;do re=W.readUByte(),K+=re;while(re===255);if(P===4&&W.bytesAvailable!==0){V=!0;var ee=W.readUByte();if(ee===181){var le=W.readUShort();if(le===49){var oe=W.readUInt();if(oe===1195456820){var $=W.readUByte();if($===3){for(var Z=W.readUByte(),ne=W.readUByte(),X=31&Z,z=[Z,ne],fe=0;fe<X;fe++)z.push(W.readUByte()),z.push(W.readUByte()),z.push(W.readUByte());r(l._txtTrack.samples,{type:3,pts:y.pts,bytes:z})}}}}}else if(P===5&&W.bytesAvailable!==0){if(V=!0,K>16){for(var Se=[],Oe=0;Oe<16;Oe++)Se.push(W.readUByte().toString(16)),(Oe===3||Oe===5||Oe===7||Oe===9)&&Se.push("-");for(var Ae=K-16,Pe=new Uint8Array(Ae),me=0;me<Ae;me++)Pe[me]=W.readUByte();r(l._txtTrack.samples,{pts:y.pts,payloadType:P,uuid:Se.join(""),userData:Object(B.utf8ArrayToStr)(Pe),userDataBytes:Pe})}}else if(K<W.bytesAvailable)for(var ge=0;ge<K;ge++)W.readUByte()}break}case 7:if(x=!0,R=!0,b&&p&&(p.debug+="SPS "),!h.sps){var be=new A.default(O.data),Ee=be.readSPS();h.width=Ee.width,h.height=Ee.height,h.pixelRatio=Ee.pixelRatio,h.sps=[O.data],h.duration=l._duration;for(var Ie=O.data.subarray(1,4),Me="avc1.",De=0;De<3;De++){var Fe=Ie[De].toString(16);Fe.length<2&&(Fe="0"+Fe),Me+=Fe}h.codec=Me}break;case 8:x=!0,b&&p&&(p.debug+="PPS "),h.pps||(h.pps=[O.data]);break;case 9:x=!1,h.audFound=!0,p&&t(p,h),p=l.avcSample=i(!1,y.pts,y.dts,b?"AUD ":"");break;case 12:x=!1;break;default:x=!1,p&&(p.debug+="unknown NAL "+O.type+" ");break}if(p&&x){var ue=p.units;ue.push(O)}}),u&&p&&(t(p,h),this.avcSample=null)},f.getLastNalUnit=function(){var y,u=this.avcSample,l;if(!u||u.units.length===0){var h=this._avcTrack.samples;u=h[h.length-1]}if((y=u)!==null&&y!==void 0&&y.units){var d=u.units;l=d[d.length-1]}return l},f.parseAVCNALu=function(y){var u=y.byteLength,l=this._avcTrack,h=l.naluState||0,d=h,b=[],p=0,x,R,O,N=-1,U=0;for(h===-1&&(N=0,U=y[0]&31,h=0,p=1);p<u;){if(x=y[p++],!h){h=x?0:1;continue}if(h===1){h=x?0:2;continue}if(!x)h=3;else if(x===1){if(N>=0){var W={data:y.subarray(N,p-h-1),type:U};b.push(W)}else{var P=this.getLastNalUnit();if(P&&(d&&p<=4-d&&(P.state&&(P.data=P.data.subarray(0,P.data.byteLength-d))),R=p-h-1,R>0)){var K=new Uint8Array(P.data.byteLength+R);K.set(P.data,0),K.set(y.subarray(0,R),P.data.byteLength),P.data=K,P.state=0}}p<u?(O=y[p]&31,N=p,U=O,h=0):h=-1}else h=0}if(N>=0&&h>=0){var V={data:y.subarray(N,u),type:U,state:h};b.push(V)}if(b.length===0){var re=this.getLastNalUnit();if(re){var ee=new Uint8Array(re.data.byteLength+y.byteLength);ee.set(re.data,0),ee.set(y,re.data.byteLength),re.data=ee}}return l.naluState=h,b},f.parseAACPES=function(y){var u=0,l=this._audioTrack,h=this.aacOverFlow,d=y.data;if(h){this.aacOverFlow=null;var b=h.sample.unit.byteLength,p=Math.min(h.missing,b),x=b-p;h.sample.unit.set(d.subarray(0,p),x),l.samples.push(h.sample),u=h.missing}var R,O;for(R=u,O=d.length;R<O-1&&!j.isHeader(d,R);R++);if(R!==u){var N,U;if(R<O-1?(N="AAC PES did not start with ADTS header,offset:"+R,U=!1):(N="no ADTS header found in AAC PES",U=!0),m.logger.warn("parsing error:"+N),this.observer.emit(w.Events.ERROR,w.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.FRAG_PARSING_ERROR,fatal:U,reason:N}),U)return}j.initTrackConfig(l,this.observer,d,R,this.audioCodec);var W;if(y.pts!==void 0)W=y.pts;else if(h){var P=j.getFrameDuration(l.samplerate);W=h.sample.pts+P}else{m.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var K=0;R<O;)if(j.isHeader(d,R)){if(R+5<O){var V=j.appendFrame(l,d,R,W,K);if(V)if(V.missing)this.aacOverFlow=V;else{R+=V.length,K++;continue}}break}else R++},f.parseMPEGPES=function(y){var u=y.data,l=u.length,h=0,d=0,b=y.pts;if(b===void 0){m.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;d<l;)if(L.isHeader(u,d)){var p=L.appendFrame(this._audioTrack,u,d,b,h);if(p)d+=p.length,h++;else break}else d++},f.parseID3PES=function(y){if(y.pts===void 0){m.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},v}();a.minProbeByteLength=188;function i(v,f,E,y){return{key:v,frame:!1,pts:f,dts:E,units:[],debug:y,length:0}}function o(v,f){return(v[f+10]&31)<<8|v[f+11]}function n(v,f,E,y){var u={audio:-1,avc:-1,id3:-1,isAAC:!0},l=(v[f+1]&15)<<8|v[f+2],h=f+3+l-4,d=(v[f+10]&15)<<8|v[f+11];for(f+=12+d;f<h;){var b=(v[f+1]&31)<<8|v[f+2];switch(v[f]){case 207:if(!y){m.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:u.audio===-1&&(u.audio=b);break;case 21:u.id3===-1&&(u.id3=b);break;case 219:if(!y){m.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:u.avc===-1&&(u.avc=b);break;case 3:case 4:E?u.audio===-1&&(u.audio=b,u.isAAC=!1):m.logger.log("MPEG audio found, not supported in this browser");break;case 36:m.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((v[f+3]&15)<<8|v[f+4])+5}return u}function e(v){var f=0,E,y,u,l,h,d=v.data;if(!v||v.size===0)return null;for(;d[0].length<19&&d.length>1;){var b=new Uint8Array(d[0].length+d[1].length);b.set(d[0]),b.set(d[1],d[0].length),d[0]=b,d.splice(1,1)}E=d[0];var p=(E[0]<<16)+(E[1]<<8)+E[2];if(p===1){if(y=(E[4]<<8)+E[5],y&&y>v.size-6)return null;var x=E[7];x&192&&(l=(E[9]&14)*536870912+(E[10]&255)*4194304+(E[11]&254)*16384+(E[12]&255)*128+(E[13]&254)/2,x&64?(h=(E[14]&14)*536870912+(E[15]&255)*4194304+(E[16]&254)*16384+(E[17]&255)*128+(E[18]&254)/2,l-h>60*9e4&&(m.logger.warn(Math.round((l-h)/9e4)+"s delta between PTS and DTS, align them"),l=h)):h=l),u=E[8];var R=u+9;if(v.size<=R)return null;v.size-=R;for(var O=new Uint8Array(v.size),N=0,U=d.length;N<U;N++){E=d[N];var W=E.byteLength;if(R)if(R>W){R-=W;continue}else E=E.subarray(R),W-=R,R=0;O.set(E,f),f+=W}return y&&(y-=u+3),{data:O,pts:l,dts:h,len:y}}return null}function t(v,f){if(v.units.length&&v.frame){if(v.pts===void 0){var E=f.samples,y=E.length;if(y){var u=E[y-1];v.pts=u.pts,v.dts=u.dts}else{f.dropped++;return}}f.samples.push(v)}v.debug.length&&m.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function r(v,f){var E=v.length;if(E>0){if(f.pts>=v[E-1].pts)v.push(f);else for(var y=E-1;y>=0;y--)if(f.pts<v[y].pts){v.splice(y,0,f);break}}else v.push(f)}function T(v){for(var f=v.byteLength,E=[],y=1;y<f-2;)v[y]===0&&v[y+1]===0&&v[y+2]===3?(E.push(y+2),y+=2):y++;if(E.length===0)return v;var u=f-E.length,l=new Uint8Array(u),h=0;for(y=0;y<u;h++,y++)h===E[0]&&(h++,E.shift()),l[y]=v[h];return l}H.default=a},"./src/errors.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"ErrorTypes",function(){return j}),C.d(H,"ErrorDetails",function(){return L});var j;(function(A){A.NETWORK_ERROR="networkError",A.MEDIA_ERROR="mediaError",A.KEY_SYSTEM_ERROR="keySystemError",A.MUX_ERROR="muxError",A.OTHER_ERROR="otherError"})(j||(j={}));var L;(function(A){A.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",A.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",A.KEY_SYSTEM_NO_SESSION="keySystemNoSession",A.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",A.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",A.MANIFEST_LOAD_ERROR="manifestLoadError",A.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",A.MANIFEST_PARSING_ERROR="manifestParsingError",A.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",A.LEVEL_EMPTY_ERROR="levelEmptyError",A.LEVEL_LOAD_ERROR="levelLoadError",A.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",A.LEVEL_SWITCH_ERROR="levelSwitchError",A.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",A.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",A.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",A.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",A.FRAG_LOAD_ERROR="fragLoadError",A.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",A.FRAG_DECRYPT_ERROR="fragDecryptError",A.FRAG_PARSING_ERROR="fragParsingError",A.REMUX_ALLOC_ERROR="remuxAllocError",A.KEY_LOAD_ERROR="keyLoadError",A.KEY_LOAD_TIMEOUT="keyLoadTimeOut",A.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",A.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",A.BUFFER_APPEND_ERROR="bufferAppendError",A.BUFFER_APPENDING_ERROR="bufferAppendingError",A.BUFFER_STALLED_ERROR="bufferStalledError",A.BUFFER_FULL_ERROR="bufferFullError",A.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",A.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",A.INTERNAL_EXCEPTION="internalException",A.INTERNAL_ABORTED="aborted",A.UNKNOWN="unknown"})(L||(L={}))},"./src/events.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"Events",function(){return j});var j;(function(L){L.MEDIA_ATTACHING="hlsMediaAttaching",L.MEDIA_ATTACHED="hlsMediaAttached",L.MEDIA_DETACHING="hlsMediaDetaching",L.MEDIA_DETACHED="hlsMediaDetached",L.BUFFER_RESET="hlsBufferReset",L.BUFFER_CODECS="hlsBufferCodecs",L.BUFFER_CREATED="hlsBufferCreated",L.BUFFER_APPENDING="hlsBufferAppending",L.BUFFER_APPENDED="hlsBufferAppended",L.BUFFER_EOS="hlsBufferEos",L.BUFFER_FLUSHING="hlsBufferFlushing",L.BUFFER_FLUSHED="hlsBufferFlushed",L.MANIFEST_LOADING="hlsManifestLoading",L.MANIFEST_LOADED="hlsManifestLoaded",L.MANIFEST_PARSED="hlsManifestParsed",L.LEVEL_SWITCHING="hlsLevelSwitching",L.LEVEL_SWITCHED="hlsLevelSwitched",L.LEVEL_LOADING="hlsLevelLoading",L.LEVEL_LOADED="hlsLevelLoaded",L.LEVEL_UPDATED="hlsLevelUpdated",L.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",L.LEVELS_UPDATED="hlsLevelsUpdated",L.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",L.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",L.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",L.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",L.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",L.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",L.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",L.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",L.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",L.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",L.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",L.CUES_PARSED="hlsCuesParsed",L.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",L.INIT_PTS_FOUND="hlsInitPtsFound",L.FRAG_LOADING="hlsFragLoading",L.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",L.FRAG_LOADED="hlsFragLoaded",L.FRAG_DECRYPTED="hlsFragDecrypted",L.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",L.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",L.FRAG_PARSING_METADATA="hlsFragParsingMetadata",L.FRAG_PARSED="hlsFragParsed",L.FRAG_BUFFERED="hlsFragBuffered",L.FRAG_CHANGED="hlsFragChanged",L.FPS_DROP="hlsFpsDrop",L.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",L.ERROR="hlsError",L.DESTROYING="hlsDestroying",L.KEY_LOADING="hlsKeyLoading",L.KEY_LOADED="hlsKeyLoaded",L.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",L.BACK_BUFFER_REACHED="hlsBackBufferReached"})(j||(j={}))},"./src/hls.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return v});var j=C("./node_modules/url-toolkit/src/url-toolkit.js"),L=C.n(j),A=C("./src/loader/playlist-loader.ts"),B=C("./src/loader/key-loader.ts"),M=C("./src/controller/id3-track-controller.ts"),w=C("./src/controller/latency-controller.ts"),S=C("./src/controller/level-controller.ts"),m=C("./src/controller/fragment-tracker.ts"),g=C("./src/controller/stream-controller.ts"),s=C("./src/is-supported.ts"),a=C("./src/utils/logger.ts"),i=C("./src/config.ts"),o=C("./node_modules/eventemitter3/index.js"),n=C.n(o),e=C("./src/events.ts"),t=C("./src/errors.ts");function r(f,E){for(var y=0;y<E.length;y++){var u=E[y];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(f,u.key,u)}}function T(f,E,y){return E&&r(f.prototype,E),y&&r(f,y),f}var v=function(){f.isSupported=function(){return Object(s.isSupported)()};function f(y){y===void 0&&(y={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new o.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var u=this.config=Object(i.mergeConfig)(f.DefaultConfig,y);this.userConfig=y,Object(a.enableLogs)(u.debug),this._autoLevelCapping=-1,u.progressive&&Object(i.enableStreamingMode)(u);var l=u.abrController,h=u.bufferController,d=u.capLevelController,b=u.fpsController,p=this.abrController=new l(this),x=this.bufferController=new h(this),R=this.capLevelController=new d(this),O=new b(this),N=new A.default(this),U=new B.default(this),W=new M.default(this),P=this.levelController=new S.default(this),K=new m.FragmentTracker(this),V=this.streamController=new g.default(this,K);R.setStreamController(V),O.setStreamController(V);var re=[P,V];this.networkControllers=re;var ee=[N,U,p,x,R,O,W,K];this.audioTrackController=this.createController(u.audioTrackController,null,re),this.createController(u.audioStreamController,K,re),this.subtitleTrackController=this.createController(u.subtitleTrackController,null,re),this.createController(u.subtitleStreamController,K,re),this.createController(u.timelineController,null,ee),this.emeController=this.createController(u.emeController,null,ee),this.cmcdController=this.createController(u.cmcdController,null,ee),this.latencyController=this.createController(w.default,null,ee),this.coreComponents=ee}var E=f.prototype;return E.createController=function(u,l,h){if(u){var d=l?new u(this,l):new u(this);return h&&h.push(d),d}return null},E.on=function(u,l,h){h===void 0&&(h=this),this._emitter.on(u,l,h)},E.once=function(u,l,h){h===void 0&&(h=this),this._emitter.once(u,l,h)},E.removeAllListeners=function(u){this._emitter.removeAllListeners(u)},E.off=function(u,l,h,d){h===void 0&&(h=this),this._emitter.off(u,l,h,d)},E.listeners=function(u){return this._emitter.listeners(u)},E.emit=function(u,l,h){return this._emitter.emit(u,l,h)},E.trigger=function(u,l){if(this.config.debug)return this.emit(u,u,l);try{return this.emit(u,u,l)}catch(h){a.logger.error("An internal error happened while handling event "+u+'. Error message: "'+h.message+'". Here is a stacktrace:',h),this.trigger(e.Events.ERROR,{type:t.ErrorTypes.OTHER_ERROR,details:t.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:u,error:h})}return!1},E.listenerCount=function(u){return this._emitter.listenerCount(u)},E.destroy=function(){a.logger.log("destroy"),this.trigger(e.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(u){return u.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(u){return u.destroy()}),this.coreComponents.length=0},E.attachMedia=function(u){a.logger.log("attachMedia"),this._media=u,this.trigger(e.Events.MEDIA_ATTACHING,{media:u})},E.detachMedia=function(){a.logger.log("detachMedia"),this.trigger(e.Events.MEDIA_DETACHING,void 0),this._media=null},E.loadSource=function(u){this.stopLoad();var l=this.media,h=this.url,d=this.url=j.buildAbsoluteURL(self.location.href,u,{alwaysNormalize:!0});a.logger.log("loadSource:"+d),l&&h&&h!==d&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(l)),this.trigger(e.Events.MANIFEST_LOADING,{url:u})},E.startLoad=function(u){u===void 0&&(u=-1),a.logger.log("startLoad("+u+")"),this.networkControllers.forEach(function(l){l.startLoad(u)})},E.stopLoad=function(){a.logger.log("stopLoad"),this.networkControllers.forEach(function(u){u.stopLoad()})},E.swapAudioCodec=function(){a.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},E.recoverMediaError=function(){a.logger.log("recoverMediaError");var u=this._media;this.detachMedia(),u&&this.attachMedia(u)},E.removeLevel=function(u,l){l===void 0&&(l=0),this.levelController.removeLevel(u,l)},T(f,[{key:"levels",get:function(){var u=this.levelController.levels;return u||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(u){a.logger.log("set currentLevel:"+u),this.loadLevel=u,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(u){a.logger.log("set nextLevel:"+u),this.levelController.manualLevel=u,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(u){a.logger.log("set loadLevel:"+u),this.levelController.manualLevel=u}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(u){this.levelController.nextLoadLevel=u}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(u){a.logger.log("set firstLevel:"+u),this.levelController.firstLevel=u}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(u){a.logger.log("set startLevel:"+u),u!==-1&&(u=Math.max(u,this.minAutoLevel)),this.levelController.startLevel=u}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(u){var l=!!u;l!==this.config.capLevelToPlayerSize&&(l?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=l)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(u){this._autoLevelCapping!==u&&(a.logger.log("set autoLevelCapping:"+u),this._autoLevelCapping=u)}},{key:"bandwidthEstimate",get:function(){var u=this.abrController.bwEstimator;return u?u.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var u=this.levels,l=this.config.minAutoBitrate;if(!u)return 0;for(var h=u.length,d=0;d<h;d++)if(u[d].maxBitrate>l)return d;return 0}},{key:"maxAutoLevel",get:function(){var u=this.levels,l=this.autoLevelCapping,h;return l===-1&&u&&u.length?h=u.length-1:h=l,h}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(u){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,u)}},{key:"audioTracks",get:function(){var u=this.audioTrackController;return u?u.audioTracks:[]}},{key:"audioTrack",get:function(){var u=this.audioTrackController;return u?u.audioTrack:-1},set:function(u){var l=this.audioTrackController;l&&(l.audioTrack=u)}},{key:"subtitleTracks",get:function(){var u=this.subtitleTrackController;return u?u.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var u=this.subtitleTrackController;return u?u.subtitleTrack:-1},set:function(u){var l=this.subtitleTrackController;l&&(l.subtitleTrack=u)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var u=this.subtitleTrackController;return u?u.subtitleDisplay:!1},set:function(u){var l=this.subtitleTrackController;l&&(l.subtitleDisplay=u)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(u){this.config.lowLatencyMode=u}},{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 e.Events}},{key:"ErrorTypes",get:function(){return t.ErrorTypes}},{key:"ErrorDetails",get:function(){return t.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:i.hlsDefaultConfig},set:function(u){f.defaultConfig=u}}]),f}();v.defaultConfig=void 0},"./src/is-supported.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"isSupported",function(){return A}),C.d(H,"changeTypeSupported",function(){return B});var j=C("./src/utils/mediasource-helper.ts");function L(){return self.SourceBuffer||self.WebKitSourceBuffer}function A(){var M=Object(j.getMediaSource)();if(!M)return!1;var w=L(),S=M&&typeof M.isTypeSupported=="function"&&M.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),m=!w||w.prototype&&typeof w.prototype.appendBuffer=="function"&&typeof w.prototype.remove=="function";return!!S&&!!m}function B(){var M,w=L();return typeof(w==null||((M=w.prototype)===null||M===void 0)?void 0:M.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return a}),C.d(H,"LoadError",function(){return o});var j=C("./src/polyfills/number.ts"),L=C("./src/errors.ts");function A(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,m(n,e)}function B(n){var e=typeof Map=="function"?new Map:void 0;return B=function(r){if(r===null||!S(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(r))return e.get(r);e.set(r,T)}function T(){return M(r,arguments,g(this).constructor)}return T.prototype=Object.create(r.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),m(T,r)},B(n)}function M(n,e,t){return w()?M=Reflect.construct:M=function(T,v,f){var E=[null];E.push.apply(E,v);var y=Function.bind.apply(T,E),u=new y;return f&&m(u,f.prototype),u},M.apply(null,arguments)}function w(){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(n){return!1}}function S(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function m(n,e){return m=Object.setPrototypeOf||function(r,T){return r.__proto__=T,r},m(n,e)}function g(n){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},g(n)}var s=Math.pow(2,17),a=function(){function n(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}var e=n.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(r,T){var v=this,f=r.url;if(!f)return Promise.reject(new o({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:r,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var E=this.config,y=E.fLoader,u=E.loader;return new Promise(function(l,h){v.loader&&v.loader.destroy();var d=v.loader=r.loader=y?new y(E):new u(E),b=i(r),p={timeout:E.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:E.fragLoadingMaxRetryTimeout,highWaterMark:s};r.stats=d.stats,d.load(b,p,{onSuccess:function(R,O,N,U){v.resetLoader(r,d),l({frag:r,part:null,payload:R.data,networkDetails:U})},onError:function(R,O,N){v.resetLoader(r,d),h(new o({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:r,response:R,networkDetails:N}))},onAbort:function(R,O,N){v.resetLoader(r,d),h(new o({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:r,networkDetails:N}))},onTimeout:function(R,O,N){v.resetLoader(r,d),h(new o({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:r,networkDetails:N}))},onProgress:function(R,O,N,U){T&&T({frag:r,part:null,payload:N,networkDetails:U})}})})},e.loadPart=function(r,T,v){var f=this;this.abort();var E=this.config,y=E.fLoader,u=E.loader;return new Promise(function(l,h){f.loader&&f.loader.destroy();var d=f.loader=r.loader=y?new y(E):new u(E),b=i(r,T),p={timeout:E.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:E.fragLoadingMaxRetryTimeout,highWaterMark:s};T.stats=d.stats,d.load(b,p,{onSuccess:function(R,O,N,U){f.resetLoader(r,d),f.updateStatsFromPart(r,T);var W={frag:r,part:T,payload:R.data,networkDetails:U};v(W),l(W)},onError:function(R,O,N){f.resetLoader(r,d),h(new o({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:r,part:T,response:R,networkDetails:N}))},onAbort:function(R,O,N){r.stats.aborted=T.stats.aborted,f.resetLoader(r,d),h(new o({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:r,part:T,networkDetails:N}))},onTimeout:function(R,O,N){f.resetLoader(r,d),h(new o({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:r,part:T,networkDetails:N}))}})})},e.updateStatsFromPart=function(r,T){var v=r.stats,f=T.stats,E=f.total;if(v.loaded+=f.loaded,E){var y=Math.round(r.duration/T.duration),u=Math.min(Math.round(v.loaded/E),y),l=y-u,h=l*Math.round(v.loaded/u);v.total=v.loaded+h}else v.total=Math.max(v.loaded,v.total);var d=v.loading,b=f.loading;d.start?d.first+=b.first-b.start:(d.start=b.start,d.first=b.first),d.end=b.end},e.resetLoader=function(r,T){r.loader=null,this.loader===T&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),T.destroy()},n}();function i(n,e){e===void 0&&(e=null);var t=e||n,r={frag:n,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},T=t.byteRangeStartOffset,v=t.byteRangeEndOffset;return Object(j.isFiniteNumber)(T)&&Object(j.isFiniteNumber)(v)&&(r.rangeStart=T,r.rangeEnd=v),r}var o=function(n){A(e,n);function e(t){for(var r,T=arguments.length,v=new Array(T>1?T-1:0),f=1;f<T;f++)v[f-1]=arguments[f];return r=n.call.apply(n,[this].concat(v))||this,r.data=void 0,r.data=t,r}return e}(B(Error))},"./src/loader/fragment.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"ElementaryStreamTypes",function(){return a}),C.d(H,"BaseSegment",function(){return i}),C.d(H,"Fragment",function(){return o}),C.d(H,"Part",function(){return n});var j=C("./src/polyfills/number.ts"),L=C("./node_modules/url-toolkit/src/url-toolkit.js"),A=C.n(L),B=C("./src/utils/logger.ts"),M=C("./src/loader/level-key.ts"),w=C("./src/loader/load-stats.ts");function S(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,m(e,t)}function m(e,t){return m=Object.setPrototypeOf||function(T,v){return T.__proto__=v,T},m(e,t)}function g(e,t){for(var r=0;r<t.length;r++){var T=t[r];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(e,T.key,T)}}function s(e,t,r){return t&&g(e.prototype,t),r&&g(e,r),e}var a;(function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"})(a||(a={}));var i=function(){function e(r){var T;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(T={},T[a.AUDIO]=null,T[a.VIDEO]=null,T[a.AUDIOVIDEO]=null,T),this.baseurl=r}var t=e.prototype;return t.setByteRange=function(T,v){var f=T.split("@",2),E=[];f.length===1?E[0]=v?v.byteRangeEndOffset:0:E[0]=parseInt(f[1]),E[1]=parseInt(f[0])+E[0],this._byteRange=E},s(e,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(L.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(T){this._url=T}}]),e}(),o=function(e){S(t,e);function t(T,v){var f;return f=e.call(this,v)||this,f._decryptdata=null,f.rawProgramDateTime=null,f.programDateTime=null,f.tagList=[],f.duration=0,f.sn=0,f.levelkey=void 0,f.type=void 0,f.loader=null,f.level=-1,f.cc=0,f.startPTS=void 0,f.endPTS=void 0,f.appendedPTS=void 0,f.startDTS=void 0,f.endDTS=void 0,f.start=0,f.deltaPTS=void 0,f.maxStartPTS=void 0,f.minEndPTS=void 0,f.stats=new w.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=T,f}var r=t.prototype;return r.createInitializationVector=function(v){for(var f=new Uint8Array(16),E=12;E<16;E++)f[E]=v>>8*(15-E)&255;return f},r.setDecryptDataFromLevelKey=function(v,f){var E=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(E=M.LevelKey.fromURI(v.uri),E.method=v.method,E.iv=this.createInitializationVector(f),E.keyFormat="identity"),E},r.setElementaryStreamInfo=function(v,f,E,y,u,l){l===void 0&&(l=!1);var h=this.elementaryStreams,d=h[v];if(!d){h[v]={startPTS:f,endPTS:E,startDTS:y,endDTS:u,partial:l};return}d.startPTS=Math.min(d.startPTS,f),d.endPTS=Math.max(d.endPTS,E),d.startDTS=Math.min(d.startDTS,y),d.endDTS=Math.max(d.endDTS,u)},r.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[a.AUDIO]=null,v[a.VIDEO]=null,v[a.AUDIOVIDEO]=null},s(t,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(j.isFiniteNumber)(this.programDateTime))return null;var v=Object(j.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),t}(i),n=function(e){S(t,e);function t(r,T,v,f,E){var y;y=e.call(this,v)||this,y.fragOffset=0,y.duration=0,y.gap=!1,y.independent=!1,y.relurl=void 0,y.fragment=void 0,y.index=void 0,y.stats=new w.LoadStats,y.duration=r.decimalFloatingPoint("DURATION"),y.gap=r.bool("GAP"),y.independent=r.bool("INDEPENDENT"),y.relurl=r.enumeratedString("URI"),y.fragment=T,y.index=f;var u=r.enumeratedString("BYTERANGE");return u&&y.setByteRange(u,E),E&&(y.fragOffset=E.fragOffset+E.duration),y}return s(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var T=this.elementaryStreams;return!!(T.audio||T.video||T.audiovideo)}}]),t}(i)},"./src/loader/key-loader.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return B});var j=C("./src/events.ts"),L=C("./src/errors.ts"),A=C("./src/utils/logger.ts"),B=function(){function M(S){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=S,this._registerListeners()}var w=M.prototype;return w._registerListeners=function(){this.hls.on(j.Events.KEY_LOADING,this.onKeyLoading,this)},w._unregisterListeners=function(){this.hls.off(j.Events.KEY_LOADING,this.onKeyLoading)},w.destroy=function(){this._unregisterListeners();for(var m in this.loaders){var g=this.loaders[m];g&&g.destroy()}this.loaders={}},w.onKeyLoading=function(m,g){var s=g.frag,a=s.type,i=this.loaders[a];if(!s.decryptdata){A.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var o=s.decryptdata.uri;if(o!==this.decrypturl||this.decryptkey===null){var n=this.hls.config;if(i&&(A.logger.warn("abort previous key loader for type:"+a),i.abort()),!o){A.logger.warn("key uri is falsy");return}var e=n.loader,t=s.loader=this.loaders[a]=new e(n);this.decrypturl=o,this.decryptkey=null;var r={url:o,frag:s,responseType:"arraybuffer"},T={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:n.fragLoadingRetryDelay,maxRetryDelay:n.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};t.load(r,T,v)}else this.decryptkey&&(s.decryptdata.key=this.decryptkey,this.hls.trigger(j.Events.KEY_LOADED,{frag:s}))},w.loadsuccess=function(m,g,s){var a=s.frag;if(!a.decryptdata){A.logger.error("after key load, decryptdata unset");return}this.decryptkey=a.decryptdata.key=new Uint8Array(m.data),a.loader=null,delete this.loaders[a.type],this.hls.trigger(j.Events.KEY_LOADED,{frag:a})},w.loaderror=function(m,g){var s=g.frag,a=s.loader;a&&a.abort(),delete this.loaders[s.type],this.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:s,response:m})},w.loadtimeout=function(m,g){var s=g.frag,a=s.loader;a&&a.abort(),delete this.loaders[s.type],this.hls.trigger(j.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:s})},M}()},"./src/loader/level-details.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"LevelDetails",function(){return M});var j=C("./src/polyfills/number.ts");function L(w,S){for(var m=0;m<S.length;m++){var g=S[m];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(w,g.key,g)}}function A(w,S,m){return S&&L(w.prototype,S),m&&L(w,m),w}var B=10,M=function(){function w(m){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=m}var S=w.prototype;return S.reloaded=function(g){if(!g){this.advanced=!0,this.updated=!0;return}var s=this.lastPartSn-g.lastPartSn,a=this.lastPartIndex-g.lastPartIndex;this.updated=this.endSN!==g.endSN||!!a||!!s,this.advanced=this.endSN>g.endSN||s>0||s===0&&a>0,this.updated||this.advanced?this.misses=Math.floor(g.misses*.6):this.misses=g.misses+1,this.availabilityDelay=g.availabilityDelay},A(w,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(j.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var g=this.driftEndTime-this.driftStartTime;if(g>0){var s=this.driftEnd-this.driftStart;return s*1e3/g}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var g;return(g=this.partList)!==null&&g!==void 0&&g.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var g;return(g=this.fragments)!==null&&g!==void 0&&g.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 g;return(g=this.partList)!==null&&g!==void 0&&g.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var g;return(g=this.partList)!==null&&g!==void 0&&g.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),w}()},"./src/loader/level-key.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"LevelKey",function(){return M});var j=C("./node_modules/url-toolkit/src/url-toolkit.js"),L=C.n(j);function A(w,S){for(var m=0;m<S.length;m++){var g=S[m];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(w,g.key,g)}}function B(w,S,m){return S&&A(w.prototype,S),m&&A(w,m),w}var M=function(){w.fromURL=function(m,g){return new w(m,g)},w.fromURI=function(m){return new w(m)};function w(S,m){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,m?this._uri=Object(j.buildAbsoluteURL)(S,m,{alwaysNormalize:!0}):this._uri=S}return B(w,[{key:"uri",get:function(){return this._uri}}]),w}()},"./src/loader/load-stats.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"LoadStats",function(){return j});var j=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return t});var j=C("./src/polyfills/number.ts"),L=C("./node_modules/url-toolkit/src/url-toolkit.js"),A=C.n(L),B=C("./src/loader/fragment.ts"),M=C("./src/loader/level-details.ts"),w=C("./src/loader/level-key.ts"),S=C("./src/utils/attr-list.ts"),m=C("./src/utils/logger.ts"),g=C("./src/utils/codecs.ts"),s=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,a=/#EXT-X-MEDIA:(.*)/g,i=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),o=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),n=/\.(mp4|m4s|m4v|m4a)$/i;function e(E){var y,u;return n.test((y=(u=L.parseURL(E))===null||u===void 0?void 0:u.path)!=null?y:"")}var t=function(){function E(){}return E.findGroup=function(u,l){for(var h=0;h<u.length;h++){var d=u[h];if(d.id===l)return d}},E.convertAVC1ToAVCOTI=function(u){var l=u.split(".");if(l.length>2){var h=l.shift()+".";return h+=parseInt(l.shift()).toString(16),h+=("000"+parseInt(l.shift()).toString(16)).substr(-4),h}return u},E.resolve=function(u,l){return L.buildAbsoluteURL(l,u,{alwaysNormalize:!0})},E.parseMasterPlaylist=function(u,l){var h=[],d={},b=!1;s.lastIndex=0;for(var p;(p=s.exec(u))!=null;)if(p[1]){var x=new S.AttrList(p[1]),R={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:E.resolve(p[2],l)},O=x.decimalResolution("RESOLUTION");O&&(R.width=O.width,R.height=O.height),r((x.CODECS||"").split(/[ ,]+/).filter(function(U){return U}),R),R.videoCodec&&R.videoCodec.indexOf("avc1")!==-1&&(R.videoCodec=E.convertAVC1ToAVCOTI(R.videoCodec)),h.push(R)}else if(p[3]){var N=new S.AttrList(p[3]);N["DATA-ID"]&&(b=!0,d[N["DATA-ID"]]=N)}return{levels:h,sessionData:b?d:null}},E.parseMasterPlaylistMedia=function(u,l,h,d){d===void 0&&(d=[]);var b,p=[],x=0;for(a.lastIndex=0;(b=a.exec(u))!==null;){var R=new S.AttrList(b[1]);if(R.TYPE===h){var O={attrs:R,bitrate:0,id:x++,groupId:R["GROUP-ID"],instreamId:R["INSTREAM-ID"],name:R.NAME||R.LANGUAGE||"",type:h,default:R.bool("DEFAULT"),autoselect:R.bool("AUTOSELECT"),forced:R.bool("FORCED"),lang:R.LANGUAGE,url:R.URI?E.resolve(R.URI,l):""};if(d.length){var N=E.findGroup(d,O.groupId)||d[0];T(O,N,"audioCodec"),T(O,N,"textCodec")}p.push(O)}}return p},E.parseLevelPlaylist=function(u,l,h,d,b){var p=new M.LevelDetails(l),x=p.fragments,R=null,O=0,N=0,U=0,W=0,P=null,K=new B.Fragment(d,l),V,re,ee,le=-1,oe=!1;for(i.lastIndex=0,p.m3u8=u;(V=i.exec(u))!==null;){oe&&(oe=!1,K=new B.Fragment(d,l),K.start=U,K.sn=O,K.cc=W,K.level=h,R&&(K.initSegment=R,K.rawProgramDateTime=R.rawProgramDateTime));var $=V[1];if($){K.duration=parseFloat($);var Z=(" "+V[2]).slice(1);K.title=Z||null,K.tagList.push(Z?["INF",$,Z]:["INF",$])}else if(V[3])Object(j.isFiniteNumber)(K.duration)&&(K.start=U,ee&&(K.levelkey=ee),K.sn=O,K.level=h,K.cc=W,K.urlId=b,x.push(K),K.relurl=(" "+V[3]).slice(1),f(K,P),P=K,U+=K.duration,O++,N=0,oe=!0);else if(V[4]){var ne=(" "+V[4]).slice(1);P?K.setByteRange(ne,P):K.setByteRange(ne)}else if(V[5])K.rawProgramDateTime=(" "+V[5]).slice(1),K.tagList.push(["PROGRAM-DATE-TIME",K.rawProgramDateTime]),le===-1&&(le=x.length);else{if(V=V[0].match(o),!V){m.logger.warn("No matches on slow regex match for level playlist!");continue}for(re=1;re<V.length&&!(typeof V[re]!="undefined");re++);var X=(" "+V[re]).slice(1),z=(" "+V[re+1]).slice(1),fe=V[re+2]?(" "+V[re+2]).slice(1):"";switch(X){case"PLAYLIST-TYPE":p.type=z.toUpperCase();break;case"MEDIA-SEQUENCE":O=p.startSN=parseInt(z);break;case"SKIP":{var Se=new S.AttrList(z),Oe=Se.decimalInteger("SKIPPED-SEGMENTS");if(Object(j.isFiniteNumber)(Oe)){p.skippedSegments=Oe;for(var Ae=Oe;Ae--;)x.unshift(null);O+=Oe}var Pe=Se.enumeratedString("RECENTLY-REMOVED-DATERANGES");Pe&&(p.recentlyRemovedDateranges=Pe.split(" "));break}case"TARGETDURATION":p.targetduration=parseFloat(z);break;case"VERSION":p.version=parseInt(z);break;case"EXTM3U":break;case"ENDLIST":p.live=!1;break;case"#":(z||fe)&&K.tagList.push(fe?[z,fe]:[z]);break;case"DIS":W++;case"GAP":K.tagList.push([X]);break;case"BITRATE":K.tagList.push([X,z]);break;case"DISCONTINUITY-SEQ":W=parseInt(z);break;case"KEY":{var me,ge=new S.AttrList(z),be=ge.enumeratedString("METHOD"),Ee=ge.URI,Ie=ge.hexadecimalInteger("IV"),Me=ge.enumeratedString("KEYFORMATVERSIONS"),De=ge.enumeratedString("KEYID"),Fe=(me=ge.enumeratedString("KEYFORMAT"))!=null?me:"identity",ue=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ue.indexOf(Fe)>-1){m.logger.warn("Keyformat "+Fe+" is not supported from the manifest");continue}else if(Fe!=="identity")continue;be&&(ee=w.LevelKey.fromURL(l,Ee),Ee&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(be)>=0&&(ee.method=be,ee.keyFormat=Fe,De&&(ee.keyID=De),Me&&(ee.keyFormatVersions=Me),ee.iv=Ie));break}case"START":{var pe=new S.AttrList(z),ye=pe.decimalFloatingPoint("TIME-OFFSET");Object(j.isFiniteNumber)(ye)&&(p.startTimeOffset=ye);break}case"MAP":{var Te=new S.AttrList(z);K.relurl=Te.URI,Te.BYTERANGE&&K.setByteRange(Te.BYTERANGE),K.level=h,K.sn="initSegment",ee&&(K.levelkey=ee),K.initSegment=null,R=K,oe=!0;break}case"SERVER-CONTROL":{var we=new S.AttrList(z);p.canBlockReload=we.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=we.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&we.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=we.optionalFloat("PART-HOLD-BACK",0),p.holdBack=we.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var xe=new S.AttrList(z);p.partTarget=xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ve=p.partList;ve||(ve=p.partList=[]);var Ne=N>0?ve[ve.length-1]:void 0,Ue=N++,he=new B.Part(new S.AttrList(z),K,l,Ue,Ne);ve.push(he),K.duration+=he.duration;break}case"PRELOAD-HINT":{var Le=new S.AttrList(z);p.preloadHint=Le;break}case"RENDITION-REPORT":{var se=new S.AttrList(z);p.renditionReports=p.renditionReports||[],p.renditionReports.push(se);break}default:m.logger.warn("line parsed but not handled: "+V);break}}}P&&!P.relurl?(x.pop(),U-=P.duration,p.partList&&(p.fragmentHint=P)):p.partList&&(f(K,P),K.cc=W,p.fragmentHint=K);var te=x.length,ae=x[0],G=x[te-1];if(U+=p.skippedSegments*p.targetduration,U>0&&te&&G){p.averagetargetduration=U/te;var Y=G.sn;p.endSN=Y!=="initSegment"?Y:0,ae&&(p.startCC=ae.cc,ae.initSegment||p.fragments.every(function(Q){return Q.relurl&&e(Q.relurl)})&&(m.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),K=new B.Fragment(d,l),K.relurl=G.relurl,K.level=h,K.sn="initSegment",ae.initSegment=K,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(U+=p.fragmentHint.duration),p.totalduration=U,p.endCC=W,le>0&&v(x,le),p},E}();function r(E,y){["video","audio","text"].forEach(function(u){var l=E.filter(function(d){return Object(g.isCodecType)(d,u)});if(l.length){var h=l.filter(function(d){return d.lastIndexOf("avc1",0)===0||d.lastIndexOf("mp4a",0)===0});y[u+"Codec"]=h.length>0?h[0]:l[0],E=E.filter(function(d){return l.indexOf(d)===-1})}}),y.unknownCodecs=E}function T(E,y,u){var l=y[u];l&&(E[u]=l)}function v(E,y){for(var u=E[y],l=y;l--;){var h=E[l];if(!h)return;h.programDateTime=u.programDateTime-h.duration*1e3,u=h}}function f(E,y){E.rawProgramDateTime?E.programDateTime=Date.parse(E.rawProgramDateTime):y!=null&&y.programDateTime&&(E.programDateTime=y.endProgramDateTime),Object(j.isFiniteNumber)(E.programDateTime)||(E.programDateTime=null,E.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/polyfills/number.ts"),L=C("./src/events.ts"),A=C("./src/errors.ts"),B=C("./src/utils/logger.ts"),M=C("./src/utils/mp4-tools.ts"),w=C("./src/loader/m3u8-parser.ts"),S=C("./src/types/loader.ts"),m=C("./src/utils/attr-list.ts");function g(i){var o=i.type;switch(o){case S.PlaylistContextType.AUDIO_TRACK:return S.PlaylistLevelType.AUDIO;case S.PlaylistContextType.SUBTITLE_TRACK:return S.PlaylistLevelType.SUBTITLE;default:return S.PlaylistLevelType.MAIN}}function s(i,o){var n=i.url;return(n===void 0||n.indexOf("data:")===0)&&(n=o.url),n}var a=function(){function i(n){this.hls=void 0,this.loaders=Object.create(null),this.hls=n,this.registerListeners()}var o=i.prototype;return o.registerListeners=function(){var e=this.hls;e.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(L.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(L.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(L.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},o.unregisterListeners=function(){var e=this.hls;e.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(L.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(L.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(L.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},o.createInternalLoader=function(e){var t=this.hls.config,r=t.pLoader,T=t.loader,v=r||T,f=new v(t);return e.loader=f,this.loaders[e.type]=f,f},o.getInternalLoader=function(e){return this.loaders[e.type]},o.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},o.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},o.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},o.onManifestLoading=function(e,t){var r=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:S.PlaylistContextType.MANIFEST,url:r,deliveryDirectives:null})},o.onLevelLoading=function(e,t){var r=t.id,T=t.level,v=t.url,f=t.deliveryDirectives;this.load({id:r,groupId:null,level:T,responseType:"text",type:S.PlaylistContextType.LEVEL,url:v,deliveryDirectives:f})},o.onAudioTrackLoading=function(e,t){var r=t.id,T=t.groupId,v=t.url,f=t.deliveryDirectives;this.load({id:r,groupId:T,level:null,responseType:"text",type:S.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:f})},o.onSubtitleTrackLoading=function(e,t){var r=t.id,T=t.groupId,v=t.url,f=t.deliveryDirectives;this.load({id:r,groupId:T,level:null,responseType:"text",type:S.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:f})},o.load=function(e){var t,r=this.hls.config,T=this.getInternalLoader(e);if(T){var v=T.context;if(v&&v.url===e.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),T.abort()}var f,E,y,u;switch(e.type){case S.PlaylistContextType.MANIFEST:f=r.manifestLoadingMaxRetry,E=r.manifestLoadingTimeOut,y=r.manifestLoadingRetryDelay,u=r.manifestLoadingMaxRetryTimeout;break;case S.PlaylistContextType.LEVEL:case S.PlaylistContextType.AUDIO_TRACK:case S.PlaylistContextType.SUBTITLE_TRACK:f=0,E=r.levelLoadingTimeOut;break;default:f=r.levelLoadingMaxRetry,E=r.levelLoadingTimeOut,y=r.levelLoadingRetryDelay,u=r.levelLoadingMaxRetryTimeout;break}if(T=this.createInternalLoader(e),(t=e.deliveryDirectives)!==null&&t!==void 0&&t.part){var l;if(e.type===S.PlaylistContextType.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===S.PlaylistContextType.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===S.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){var h=l.partTarget,d=l.targetduration;h&&d&&(E=Math.min(Math.max(h*3,d*.8)*1e3,E))}}var b={timeout:E,maxRetry:f,retryDelay:y,maxRetryDelay:u,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};T.load(e,b,p)},o.loadsuccess=function(e,t,r,T){if(T===void 0&&(T=null),r.isSidxRequest){this.handleSidxRequest(e,r),this.handlePlaylistLoaded(e,t,r,T);return}this.resetInternalLoader(r.type);var v=e.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(e,r,"no EXTM3U delimiter",T);return}t.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,r,T):this.handleMasterPlaylist(e,t,r,T)},o.loaderror=function(e,t,r){r===void 0&&(r=null),this.handleNetworkError(t,r,!1,e)},o.loadtimeout=function(e,t,r){r===void 0&&(r=null),this.handleNetworkError(t,r,!0)},o.handleMasterPlaylist=function(e,t,r,T){var v=this.hls,f=e.data,E=s(e,r),y=w.default.parseMasterPlaylist(f,E),u=y.levels,l=y.sessionData;if(!u.length){this.handleManifestParsingError(e,r,"no level found in manifest",T);return}var h=u.map(function(O){return{id:O.attrs.AUDIO,audioCodec:O.audioCodec}}),d=u.map(function(O){return{id:O.attrs.SUBTITLES,textCodec:O.textCodec}}),b=w.default.parseMasterPlaylistMedia(f,E,"AUDIO",h),p=w.default.parseMasterPlaylistMedia(f,E,"SUBTITLES",d),x=w.default.parseMasterPlaylistMedia(f,E,"CLOSED-CAPTIONS");if(b.length){var R=b.some(function(O){return!O.url});!R&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(B.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 m.AttrList({}),bitrate:0,url:""}))}v.trigger(L.Events.MANIFEST_LOADED,{levels:u,audioTracks:b,subtitles:p,captions:x,url:E,stats:t,networkDetails:T,sessionData:l})},o.handleTrackOrLevelPlaylist=function(e,t,r,T){var v=this.hls,f=r.id,E=r.level,y=r.type,u=s(e,r),l=Object(j.isFiniteNumber)(f)?f:0,h=Object(j.isFiniteNumber)(E)?E:l,d=g(r),b=w.default.parseLevelPlaylist(e.data,u,h,d,l);if(!b.fragments.length){v.trigger(L.Events.ERROR,{type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:u,reason:"no fragments found in level",level:typeof r.level=="number"?r.level:void 0});return}if(y===S.PlaylistContextType.MANIFEST){var p={attrs:new m.AttrList({}),bitrate:0,details:b,name:"",url:u};v.trigger(L.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:u,stats:t,networkDetails:T,sessionData:null})}if(t.parsing.end=performance.now(),b.needSidxRanges){var x,R=(x=b.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:R,isSidxRequest:!0,type:y,level:E,levelDetails:b,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}r.levelDetails=b,this.handlePlaylistLoaded(e,t,r,T)},o.handleSidxRequest=function(e,t){var r=Object(M.parseSegmentIndex)(new Uint8Array(e.data));if(!r)return;var T=r.references,v=t.levelDetails;T.forEach(function(f,E){var y=f.info,u=v.fragments[E];u.byteRange.length===0&&u.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),u.initSegment&&u.initSegment.setByteRange(String(r.moovEndOffset)+"@0")})},o.handleManifestParsingError=function(e,t,r,T){this.hls.trigger(L.Events.ERROR,{type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===S.PlaylistContextType.MANIFEST,url:e.url,reason:r,response:e,context:t,networkDetails:T})},o.handleNetworkError=function(e,t,r,T){r===void 0&&(r=!1),B.logger.warn("[playlist-loader]: A network "+(r?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var v=A.ErrorDetails.UNKNOWN,f=!1,E=this.getInternalLoader(e);switch(e.type){case S.PlaylistContextType.MANIFEST:v=r?A.ErrorDetails.MANIFEST_LOAD_TIMEOUT:A.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case S.PlaylistContextType.LEVEL:v=r?A.ErrorDetails.LEVEL_LOAD_TIMEOUT:A.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case S.PlaylistContextType.AUDIO_TRACK:v=r?A.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:A.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case S.PlaylistContextType.SUBTITLE_TRACK:v=r?A.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:A.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}E&&this.resetInternalLoader(e.type);var y={type:A.ErrorTypes.NETWORK_ERROR,details:v,fatal:f,url:e.url,loader:E,context:e,networkDetails:t};T&&(y.response=T),this.hls.trigger(L.Events.ERROR,y)},o.handlePlaylistLoaded=function(e,t,r,T){var v=r.type,f=r.level,E=r.id,y=r.groupId,u=r.loader,l=r.levelDetails,h=r.deliveryDirectives;if(!(l!=null&&l.targetduration)){this.handleManifestParsingError(e,r,"invalid target duration",T);return}if(!u)return;l.live&&(u.getCacheAge&&(l.ageHeader=u.getCacheAge()||0),(!u.getCacheAge||isNaN(l.ageHeader))&&(l.ageHeader=0));switch(v){case S.PlaylistContextType.MANIFEST:case S.PlaylistContextType.LEVEL:this.hls.trigger(L.Events.LEVEL_LOADED,{details:l,level:f||0,id:E||0,stats:t,networkDetails:T,deliveryDirectives:h});break;case S.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(L.Events.AUDIO_TRACK_LOADED,{details:l,id:E||0,groupId:y||"",stats:t,networkDetails:T,deliveryDirectives:h});break;case S.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(L.Events.SUBTITLE_TRACK_LOADED,{details:l,id:E||0,groupId:y||"",stats:t,networkDetails:T,deliveryDirectives:h});break}},i}();H.default=a},"./src/polyfills/number.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"isFiniteNumber",function(){return j}),C.d(H,"MAX_SAFE_INTEGER",function(){return L});var j=Number.isFinite||function(A){return typeof A=="number"&&isFinite(A)},L=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(de,H,C){"use strict";C.r(H);var j=function(){function L(){}return L.getSilentFrame=function(B,M){switch(B){case"mp4a.40.2":if(M===1)return new Uint8Array([0,200,0,128,35,128]);if(M===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(M===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(M===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(M===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(M===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(M===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(M===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(M===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},L}();H.default=j},"./src/remux/mp4-generator.ts":function(de,H,C){"use strict";C.r(H);var j=Math.pow(2,32)-1,L=function(){function A(){}return A.init=function(){A.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 M;for(M in A.types)A.types.hasOwnProperty(M)&&(A.types[M]=[M.charCodeAt(0),M.charCodeAt(1),M.charCodeAt(2),M.charCodeAt(3)]);var w=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]),S=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]);A.HDLR_TYPES={video:w,audio:S};var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),g=new Uint8Array([0,0,0,0,0,0,0,0]);A.STTS=A.STSC=A.STCO=g,A.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),A.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),A.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),A.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),i=new Uint8Array([0,0,0,1]);A.FTYP=A.box(A.types.ftyp,s,i,s,a),A.DINF=A.box(A.types.dinf,A.box(A.types.dref,m))},A.box=function(M){for(var w=8,S=arguments.length,m=new Array(S>1?S-1:0),g=1;g<S;g++)m[g-1]=arguments[g];for(var s=m.length,a=s;s--;)w+=m[s].byteLength;var i=new Uint8Array(w);for(i[0]=w>>24&255,i[1]=w>>16&255,i[2]=w>>8&255,i[3]=w&255,i.set(M,4),s=0,w=8;s<a;s++)i.set(m[s],w),w+=m[s].byteLength;return i},A.hdlr=function(M){return A.box(A.types.hdlr,A.HDLR_TYPES[M])},A.mdat=function(M){return A.box(A.types.mdat,M)},A.mdhd=function(M,w){w*=M;var S=Math.floor(w/(j+1)),m=Math.floor(w%(j+1));return A.box(A.types.mdhd,new Uint8Array([1,0,0,0,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,S>>24,S>>16&255,S>>8&255,S&255,m>>24,m>>16&255,m>>8&255,m&255,85,196,0,0]))},A.mdia=function(M){return A.box(A.types.mdia,A.mdhd(M.timescale,M.duration),A.hdlr(M.type),A.minf(M))},A.mfhd=function(M){return A.box(A.types.mfhd,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255]))},A.minf=function(M){return M.type==="audio"?A.box(A.types.minf,A.box(A.types.smhd,A.SMHD),A.DINF,A.stbl(M)):A.box(A.types.minf,A.box(A.types.vmhd,A.VMHD),A.DINF,A.stbl(M))},A.moof=function(M,w,S){return A.box(A.types.moof,A.mfhd(M),A.traf(S,w))},A.moov=function(M){for(var w=M.length,S=[];w--;)S[w]=A.trak(M[w]);return A.box.apply(null,[A.types.moov,A.mvhd(M[0].timescale,M[0].duration)].concat(S).concat(A.mvex(M)))},A.mvex=function(M){for(var w=M.length,S=[];w--;)S[w]=A.trex(M[w]);return A.box.apply(null,[A.types.mvex].concat(S))},A.mvhd=function(M,w){w*=M;var S=Math.floor(w/(j+1)),m=Math.floor(w%(j+1)),g=new Uint8Array([1,0,0,0,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,S>>24,S>>16&255,S>>8&255,S&255,m>>24,m>>16&255,m>>8&255,m&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 A.box(A.types.mvhd,g)},A.sdtp=function(M){var w=M.samples||[],S=new Uint8Array(4+w.length),m,g;for(m=0;m<w.length;m++)g=w[m].flags,S[m+4]=g.dependsOn<<4|g.isDependedOn<<2|g.hasRedundancy;return A.box(A.types.sdtp,S)},A.stbl=function(M){return A.box(A.types.stbl,A.stsd(M),A.box(A.types.stts,A.STTS),A.box(A.types.stsc,A.STSC),A.box(A.types.stsz,A.STSZ),A.box(A.types.stco,A.STCO))},A.avc1=function(M){var w=[],S=[],m,g,s;for(m=0;m<M.sps.length;m++)g=M.sps[m],s=g.byteLength,w.push(s>>>8&255),w.push(s&255),w=w.concat(Array.prototype.slice.call(g));for(m=0;m<M.pps.length;m++)g=M.pps[m],s=g.byteLength,S.push(s>>>8&255),S.push(s&255),S=S.concat(Array.prototype.slice.call(g));var a=A.box(A.types.avcC,new Uint8Array([1,w[3],w[4],w[5],252|3,224|M.sps.length].concat(w).concat([M.pps.length]).concat(S))),i=M.width,o=M.height,n=M.pixelRatio[0],e=M.pixelRatio[1];return A.box(A.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,i>>8&255,i&255,o>>8&255,o&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]),a,A.box(A.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),A.box(A.types.pasp,new Uint8Array([n>>24,n>>16&255,n>>8&255,n&255,e>>24,e>>16&255,e>>8&255,e&255])))},A.esds=function(M){var w=M.config.length;return new Uint8Array([0,0,0,0,3,23+w,0,1,0,4,15+w,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([w]).concat(M.config).concat([6,1,2]))},A.mp4a=function(M){var w=M.samplerate;return A.box(A.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,w>>8&255,w&255,0,0]),A.box(A.types.esds,A.esds(M)))},A.mp3=function(M){var w=M.samplerate;return A.box(A.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,w>>8&255,w&255,0,0]))},A.stsd=function(M){return M.type==="audio"?!M.isAAC&&M.codec==="mp3"?A.box(A.types.stsd,A.STSD,A.mp3(M)):A.box(A.types.stsd,A.STSD,A.mp4a(M)):A.box(A.types.stsd,A.STSD,A.avc1(M))},A.tkhd=function(M){var w=M.id,S=M.duration*M.timescale,m=M.width,g=M.height,s=Math.floor(S/(j+1)),a=Math.floor(S%(j+1));return A.box(A.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,w>>24&255,w>>16&255,w>>8&255,w&255,0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,a>>24,a>>16&255,a>>8&255,a&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,m>>8&255,m&255,0,0,g>>8&255,g&255,0,0]))},A.traf=function(M,w){var S=A.sdtp(M),m=M.id,g=Math.floor(w/(j+1)),s=Math.floor(w%(j+1));return A.box(A.types.traf,A.box(A.types.tfhd,new Uint8Array([0,0,0,0,m>>24,m>>16&255,m>>8&255,m&255])),A.box(A.types.tfdt,new Uint8Array([1,0,0,0,g>>24,g>>16&255,g>>8&255,g&255,s>>24,s>>16&255,s>>8&255,s&255])),A.trun(M,S.length+16+20+8+16+8+8),S)},A.trak=function(M){return M.duration=M.duration||4294967295,A.box(A.types.trak,A.tkhd(M),A.mdia(M))},A.trex=function(M){var w=M.id;return A.box(A.types.trex,new Uint8Array([0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},A.trun=function(M,w){var S=M.samples||[],m=S.length,g=12+16*m,s=new Uint8Array(g),a,i,o,n,e,t;for(w+=8+g,s.set([0,0,15,1,m>>>24&255,m>>>16&255,m>>>8&255,m&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255],0),a=0;a<m;a++)i=S[a],o=i.duration,n=i.size,e=i.flags,t=i.cts,s.set([o>>>24&255,o>>>16&255,o>>>8&255,o&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,e.isLeading<<2|e.dependsOn,e.isDependedOn<<6|e.hasRedundancy<<4|e.paddingValue<<1|e.isNonSync,e.degradPrio&240<<8,e.degradPrio&15,t>>>24&255,t>>>16&255,t>>>8&255,t&255],12+16*a);return A.box(A.types.trun,s)},A.initSegment=function(M){A.types||A.init();var w=A.moov(M),S=new Uint8Array(A.FTYP.byteLength+w.byteLength);return S.set(A.FTYP),S.set(w,A.FTYP.byteLength),S},A}();L.types=void 0,L.HDLR_TYPES=void 0,L.STTS=void 0,L.STSC=void 0,L.STCO=void 0,L.STSZ=void 0,L.VMHD=void 0,L.SMHD=void 0,L.STSD=void 0,L.FTYP=void 0,L.DINF=void 0,H.default=L},"./src/remux/mp4-remuxer.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return t}),C.d(H,"normalizePts",function(){return r});var j=C("./src/polyfills/number.ts"),L=C("./src/remux/aac-helper.ts"),A=C("./src/remux/mp4-generator.ts"),B=C("./src/events.ts"),M=C("./src/errors.ts"),w=C("./src/utils/logger.ts"),S=C("./src/types/loader.ts"),m=C("./src/utils/timescale-conversion.ts");function g(){return g=Object.assign||function(E){for(var y=1;y<arguments.length;y++){var u=arguments[y];for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(E[l]=u[l])}return E},g.apply(this,arguments)}var s=10*1e3,a=1024,i=1152,o=null,n=null,e=!1,t=function(){function E(u,l,h,d){if(d===void 0&&(d=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=u,this.config=l,this.typeSupported=h,this.ISGenerated=!1,o===null){var b=navigator.userAgent||"",p=b.match(/Chrome\/(\d+)/i);o=p?parseInt(p[1]):0}if(n===null){var x=navigator.userAgent.match(/Safari\/(\d+)/i);n=x?parseInt(x[1]):0}e=!!o&&o<75||!!n&&n<600}var y=E.prototype;return y.destroy=function(){},y.resetTimeStamp=function(l){w.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=l},y.resetNextTimestamp=function(){w.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){w.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(l){var h=!1,d=l.reduce(function(b,p){var x=p.pts-b;return x<-4294967296?(h=!0,r(b,p.pts)):x>0?b:p.pts},l[0].pts);return h&&w.logger.debug("PTS rollover detected"),d},y.remux=function(l,h,d,b,p,x,R,O){var N,U,W,P,K,V,re=p,ee=p,le=l.pid>-1,oe=h.pid>-1,$=h.samples.length,Z=l.samples.length>0,ne=$>1,X=(!le||Z)&&(!oe||ne)||this.ISGenerated||R;if(X){this.ISGenerated||(W=this.generateIS(l,h,p));var z=this.isVideoContiguous,fe=-1;if(ne&&(fe=T(h.samples),!z&&this.config.forceKeyFrameOnDiscontinuity))if(V=!0,fe>0){w.logger.warn("[mp4-remuxer]: Dropped "+fe+" out of "+$+" video samples due to a missing keyframe");var Se=this.getVideoStartPts(h.samples);h.samples=h.samples.slice(fe),h.dropped+=fe,ee+=(h.samples[0].pts-Se)/(h.timescale||9e4)}else fe===-1&&(w.logger.warn("[mp4-remuxer]: No keyframe found out of "+$+" video samples"),V=!1);if(this.ISGenerated){if(Z&&ne){var Oe=this.getVideoStartPts(h.samples),Ae=r(l.samples[0].pts,Oe)-Oe,Pe=Ae/h.inputTimeScale;re+=Math.max(0,Pe),ee+=Math.max(0,-Pe)}if(Z){if(l.samplerate||(w.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),W=this.generateIS(l,h,p)),U=this.remuxAudio(l,re,this.isAudioContiguous,x,oe||ne||O===S.PlaylistLevelType.AUDIO?ee:void 0),ne){var me=U?U.endPTS-U.startPTS:0;h.inputTimeScale||(w.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),W=this.generateIS(l,h,p)),N=this.remuxVideo(h,ee,z,me)}}else ne&&(N=this.remuxVideo(h,ee,z,0));N&&(N.firstKeyFrame=fe,N.independent=fe!==-1)}}return this.ISGenerated&&(d.samples.length&&(K=this.remuxID3(d,p)),b.samples.length&&(P=this.remuxText(b,p))),{audio:U,video:N,initSegment:W,independent:V,text:P,id3:K}},y.generateIS=function(l,h,d){var b=l.samples,p=h.samples,x=this.typeSupported,R={},O=!Object(j.isFiniteNumber)(this._initPTS),N="audio/mp4",U,W,P;if(O&&(U=W=Infinity),l.config&&b.length&&(l.timescale=l.samplerate,l.isAAC||(x.mpeg?(N="audio/mpeg",l.codec=""):x.mp3&&(l.codec="mp3")),R.audio={id:"audio",container:N,codec:l.codec,initSegment:!l.isAAC&&x.mpeg?new Uint8Array(0):A.default.initSegment([l]),metadata:{channelCount:l.channelCount}},O&&(P=l.inputTimeScale,U=W=b[0].pts-Math.round(P*d))),h.sps&&h.pps&&p.length&&(h.timescale=h.inputTimeScale,R.video={id:"main",container:"video/mp4",codec:h.codec,initSegment:A.default.initSegment([h]),metadata:{width:h.width,height:h.height}},O)){P=h.inputTimeScale;var K=this.getVideoStartPts(p),V=Math.round(P*d);W=Math.min(W,r(p[0].dts,K)-V),U=Math.min(U,K-V)}if(Object.keys(R).length)return this.ISGenerated=!0,O&&(this._initPTS=U,this._initDTS=W),{tracks:R,initPTS:U,timescale:P}},y.remuxVideo=function(l,h,d,b){var p=l.inputTimeScale,x=l.samples,R=[],O=x.length,N=this._initPTS,U=this.nextAvcDts,W=8,P,K,V,re=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,le=0,oe=!1;if(!d||U===null){var $=h*p,Z=x[0].pts-r(x[0].dts,x[0].pts);U=$-Z}for(var ne=0;ne<O;ne++){var X=x[ne];if(X.pts=r(X.pts-N,U),X.dts=r(X.dts-N,U),X.dts>X.pts){var z=9e4*.2;le=Math.max(Math.min(le,X.pts-X.dts),-1*z)}X.dts<x[ne>0?ne-1:ne].dts&&(oe=!0)}oe&&x.sort(function(qe,it){var Ye=qe.dts-it.dts,mt=qe.pts-it.pts;return Ye||mt}),K=x[0].dts,V=x[x.length-1].dts;var fe=Math.round((V-K)/(O-1));if(le<0){if(le<fe*-2){w.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(m.toMsFromMpegTsClock)(-fe,!0)+" ms");for(var Se=le,Oe=0;Oe<O;Oe++)x[Oe].dts=Se=Math.max(Se,x[Oe].pts-fe),x[Oe].pts=Math.max(Se,x[Oe].pts)}else{w.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(m.toMsFromMpegTsClock)(le,!0)+" ms to overcome this issue");for(var Ae=0;Ae<O;Ae++)x[Ae].dts=x[Ae].dts+le}K=x[0].dts}if(d){var Pe=K-U,me=Pe>fe,ge=Pe<-1;if(me||ge){me?w.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(Pe,!0)+" ms ("+Pe+"dts) hole between fragments detected, filling it"):w.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(-Pe,!0)+" ms ("+Pe+"dts) overlapping between fragments detected"),K=U;var be=x[0].pts-Pe;x[0].dts=K,x[0].pts=be,w.logger.log("Video: First PTS/DTS adjusted: "+Object(m.toMsFromMpegTsClock)(be,!0)+"/"+Object(m.toMsFromMpegTsClock)(K,!0)+", delta: "+Object(m.toMsFromMpegTsClock)(Pe,!0)+" ms")}}e&&(K=Math.max(0,K));for(var Ee=0,Ie=0,Me=0;Me<O;Me++){for(var De=x[Me],Fe=De.units,ue=Fe.length,pe=0,ye=0;ye<ue;ye++)pe+=Fe[ye].data.length;Ie+=pe,Ee+=ue,De.length=pe,De.dts=Math.max(De.dts,K),De.pts=Math.max(De.pts,De.dts,0),re=Math.min(De.pts,re),ee=Math.max(De.pts,ee)}V=x[O-1].dts;var Te=Ie+4*Ee+8,we;try{we=new Uint8Array(Te)}catch(qe){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Te,reason:"fail allocating video mdat "+Te});return}var xe=new DataView(we.buffer);xe.setUint32(0,Te),we.set(A.default.types.mdat,4);for(var ve=0;ve<O;ve++){for(var Ne=x[ve],Ue=Ne.units,he=0,Le=0,se=Ue.length;Le<se;Le++){var te=Ue[Le],ae=te.data,G=te.data.byteLength;xe.setUint32(W,G),W+=4,we.set(ae,W),W+=G,he+=4+G}if(ve<O-1)P=x[ve+1].dts-Ne.dts;else{var Y=this.config,Q=Ne.dts-x[ve>0?ve-1:ve].dts;if(Y.stretchShortVideoTrack&&this.nextAudioPts!==null){var q=Math.floor(Y.maxBufferHole*p),ce=(b?re+b*p:this.nextAudioPts)-Ne.pts;ce>q?(P=ce-Q,P<0&&(P=Q),w.logger.log("[mp4-remuxer]: It is approximately "+ce/90+" ms to the next segment; using duration "+P/90+" ms for the last video frame.")):P=Q}else P=Q}var _e=Math.round(Ne.pts-Ne.dts);R.push(new v(Ne.key,P,he,_e))}if(R.length&&o&&o<70){var ke=R[0].flags;ke.dependsOn=2,ke.isNonSync=0}console.assert(P!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=U=V+P,this.isVideoContiguous=!0;var Ke=A.default.moof(l.sequenceNumber++,K,g({},l,{samples:R})),Xe="video",ze={data1:Ke,data2:we,startPTS:re/p,endPTS:(ee+P)/p,startDTS:K/p,endDTS:U/p,type:Xe,hasAudio:!1,hasVideo:!0,nb:R.length,dropped:l.dropped};return l.samples=[],l.dropped=0,console.assert(we.length,"MDAT length must not be zero"),ze},y.remuxAudio=function(l,h,d,b,p){var x=l.inputTimeScale,R=l.samplerate?l.samplerate:x,O=x/R,N=l.isAAC?a:i,U=N*O,W=this._initPTS,P=!l.isAAC&&this.typeSupported.mpeg,K=[],V=l.samples,re=P?0:8,ee=this.nextAudioPts||-1,le=h*x;if(this.isAudioContiguous=d=d||V.length&&ee>0&&(b&&Math.abs(le-ee)<9e3||Math.abs(r(V[0].pts-W,le)-ee)<20*U),V.forEach(function(ae){ae.pts=r(ae.pts-W,le)}),!d||ee<0){if(V=V.filter(function(ae){return ae.pts>=0}),!V.length)return;p===0?ee=0:b?ee=Math.max(0,le):ee=V[0].pts}if(l.isAAC)for(var oe=p!==void 0,$=this.config.maxAudioFramesDrift,Z=0,ne=ee;Z<V.length;Z++){var X=V[Z],z=X.pts,fe=z-ne,Se=Math.abs(1e3*fe/x);if(fe<=-$*U&&oe)Z===0&&(w.logger.warn("Audio frame @ "+(z/x).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*fe/x)+" ms."),this.nextAudioPts=ee=ne=z);else if(fe>=$*U&&Se<s&&oe){var Oe=Math.round(fe/U);ne=z-Oe*U,ne<0&&(Oe--,ne+=U),Z===0&&(this.nextAudioPts=ee=ne),w.logger.warn("[mp4-remuxer]: Injecting "+Oe+" audio frame @ "+(ne/x).toFixed(3)+"s due to "+Math.round(1e3*fe/x)+" ms gap.");for(var Ae=0;Ae<Oe;Ae++){var Pe=Math.max(ne,0),me=L.default.getSilentFrame(l.manifestCodec||l.codec,l.channelCount);me||(w.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),me=X.unit.subarray()),V.splice(Z,0,{unit:me,pts:Pe}),ne+=U,Z++}}X.pts=ne,ne+=U}for(var ge=null,be=null,Ee,Ie=0,Me=V.length;Me--;)Ie+=V[Me].unit.byteLength;for(var De=0,Fe=V.length;De<Fe;De++){var ue=V[De],pe=ue.unit,ye=ue.pts;if(be!==null){var Te=K[De-1];Te.duration=Math.round((ye-be)/O)}else if(d&&l.isAAC&&(ye=ee),ge=ye,Ie>0){Ie+=re;try{Ee=new Uint8Array(Ie)}catch(ae){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating audio mdat "+Ie});return}if(!P){var we=new DataView(Ee.buffer);we.setUint32(0,Ie),Ee.set(A.default.types.mdat,4)}}else return;Ee.set(pe,re);var xe=pe.byteLength;re+=xe,K.push(new v(!0,N,xe,0)),be=ye}var ve=K.length;if(!ve)return;var Ne=K[K.length-1];this.nextAudioPts=ee=be+O*Ne.duration;var Ue=P?new Uint8Array(0):A.default.moof(l.sequenceNumber++,ge/O,g({},l,{samples:K}));l.samples=[];var he=ge/x,Le=ee/x,se="audio",te={data1:Ue,data2:Ee,startPTS:he,endPTS:Le,startDTS:he,endDTS:Le,type:se,hasAudio:!0,hasVideo:!1,nb:ve};return this.isAudioContiguous=!0,console.assert(Ee.length,"MDAT length must not be zero"),te},y.remuxEmptyAudio=function(l,h,d,b){var p=l.inputTimeScale,x=l.samplerate?l.samplerate:p,R=p/x,O=this.nextAudioPts,N=(O!==null?O:b.startDTS*p)+this._initDTS,U=b.endDTS*p+this._initDTS,W=R*a,P=Math.ceil((U-N)/W),K=L.default.getSilentFrame(l.manifestCodec||l.codec,l.channelCount);if(w.logger.warn("[mp4-remuxer]: remux empty Audio"),!K){w.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var V=[],re=0;re<P;re++){var ee=N+re*W;V.push({unit:K,pts:ee,dts:ee})}return l.samples=V,this.remuxAudio(l,h,d,!1)},y.remuxID3=function(l,h){var d=l.samples.length;if(!d)return;for(var b=l.inputTimeScale,p=this._initPTS,x=this._initDTS,R=0;R<d;R++){var O=l.samples[R];O.pts=r(O.pts-p,h*b)/b,O.dts=r(O.dts-x,h*b)/b}var N=l.samples;return l.samples=[],{samples:N}},y.remuxText=function(l,h){var d=l.samples.length;if(!d)return;for(var b=l.inputTimeScale,p=this._initPTS,x=0;x<d;x++){var R=l.samples[x];R.pts=r(R.pts-p,h*b)/b}l.samples.sort(function(N,U){return N.pts-U.pts});var O=l.samples;return l.samples=[],{samples:O}},E}();function r(E,y){var u;if(y===null)return E;for(y<E?u=-8589934592:u=8589934592;Math.abs(E-y)>4294967296;)E+=u;return E}function T(E){for(var y=0;y<E.length;y++)if(E[y].key)return y;return-1}var v=function(y,u,l,h){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=u,this.size=l,this.cts=h,this.flags=new f(y)},f=function(y){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=y?2:1,this.isNonSync=y?0:1}},"./src/remux/passthrough-remuxer.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/polyfills/number.ts"),L=C("./src/utils/mp4-tools.ts"),A=C("./src/loader/fragment.ts"),B=C("./src/utils/logger.ts"),M=function(){function m(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var g=m.prototype;return g.destroy=function(){},g.resetTimeStamp=function(a){this.initPTS=a,this.lastEndDTS=null},g.resetNextTimestamp=function(){this.lastEndDTS=null},g.resetInitSegment=function(a,i,o){this.audioCodec=i,this.videoCodec=o,this.generateInitSegment(a),this.emitInitSegment=!0},g.generateInitSegment=function(a){var i=this.audioCodec,o=this.videoCodec;if(!a||!a.byteLength){this.initTracks=void 0,this.initData=void 0;return}var n=this.initData=Object(L.parseInitSegment)(a);i||(i=S(n.audio,A.ElementaryStreamTypes.AUDIO)),o||(o=S(n.video,A.ElementaryStreamTypes.VIDEO));var e={};n.audio&&n.video?e.audiovideo={container:"video/mp4",codec:i+","+o,initSegment:a,id:"main"}:n.audio?e.audio={container:"audio/mp4",codec:i,initSegment:a,id:"audio"}:n.video?e.video={container:"video/mp4",codec:o,initSegment:a,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=e},g.remux=function(a,i,o,n,e){var t=this.initPTS,r=this.lastEndDTS,T={audio:void 0,video:void 0,text:n,id3:o,initSegment:void 0};Object(j.isFiniteNumber)(r)||(r=this.lastEndDTS=e||0);var v=i.samples;if(!v||!v.length)return T;var f={initPTS:void 0,timescale:1},E=this.initData;if((!E||!E.length)&&(this.generateInitSegment(v),E=this.initData),!E||!E.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),T;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(j.isFiniteNumber)(t)||(this.initPTS=f.initPTS=t=w(E,v,r));var y=Object(L.getDuration)(v,E),u=r,l=y+u;Object(L.offsetStartDTS)(E,v,t),y>0?this.lastEndDTS=l:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var h=!!E.audio,d=!!E.video,b="";h&&(b+="audio"),d&&(b+="video");var p={data1:v,startPTS:u,startDTS:u,endPTS:l,endDTS:l,type:b,hasAudio:h,hasVideo:d,nb:1,dropped:0};return T.audio=p.type==="audio"?p:void 0,T.video=p.type!=="audio"?p:void 0,T.text=n,T.id3=o,T.initSegment=f,T},m}(),w=function(g,s,a){return Object(L.getStartDTS)(g,s)-a};function S(m,g){var s=m==null?void 0:m.codec;return s&&s.length>4?s:s==="hvc1"?"hvc1.1.c.L120.90":s==="av01"?"av01.0.04M.08":s==="avc1"||g===A.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}H.default=M},"./src/task-loop.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return j});var j=function(){function L(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var A=L.prototype;return A.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},A.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},A.onHandlerDestroyed=function(){},A.hasInterval=function(){return!!this._tickInterval},A.hasNextTick=function(){return!!this._tickTimer},A.setInterval=function(M){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,M),!0)},A.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},A.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},A.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},A.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},A.doTick=function(){},L}()},"./src/types/cmcd.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"CMCDVersion",function(){return j}),C.d(H,"CMCDObjectType",function(){return L}),C.d(H,"CMCDStreamingFormat",function(){return A}),C.d(H,"CMCDStreamType",function(){return B});var j=1,L;(function(M){M.MANIFEST="m",M.AUDIO="a",M.VIDEO="v",M.MUXED="av",M.INIT="i",M.CAPTION="c",M.TIMED_TEXT="tt",M.KEY="k",M.OTHER="o"})(L||(L={}));var A;(function(M){M.DASH="d",M.HLS="h",M.SMOOTH="s",M.OTHER="o"})(A||(A={}));var B;(function(M){M.VOD="v",M.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"HlsSkip",function(){return A}),C.d(H,"getSkipValue",function(){return B}),C.d(H,"HlsUrlParameters",function(){return M}),C.d(H,"Level",function(){return w});function j(S,m){for(var g=0;g<m.length;g++){var s=m[g];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(S,s.key,s)}}function L(S,m,g){return m&&j(S.prototype,m),g&&j(S,g),S}var A;(function(S){S.No="",S.Yes="YES",S.v2="v2"})(A||(A={}));function B(S,m){var g=S.canSkipUntil,s=S.canSkipDateRanges,a=S.endSN,i=m!==void 0?m-a:0;return g&&i<g?s?A.v2:A.Yes:A.No}var M=function(){function S(g,s,a){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=g,this.part=s,this.skip=a}var m=S.prototype;return m.addDirectives=function(s){var a=new self.URL(s);return this.msn!==void 0&&a.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&a.searchParams.set("_HLS_part",this.part.toString()),this.skip&&a.searchParams.set("_HLS_skip",this.skip),a.toString()},S}(),w=function(){function S(m){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[m.url],this.attrs=m.attrs,this.bitrate=m.bitrate,m.details&&(this.details=m.details),this.id=m.id||0,this.name=m.name,this.width=m.width||0,this.height=m.height||0,this.audioCodec=m.audioCodec,this.videoCodec=m.videoCodec,this.unknownCodecs=m.unknownCodecs,this.codecSet=[m.videoCodec,m.audioCodec].filter(function(g){return g}).join(",").replace(/\.[^.,]+/g,"")}return L(S,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(g){var s=g%this.url.length;this._urlId!==s&&(this.details=void 0,this._urlId=s)}}]),S}()},"./src/types/loader.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"PlaylistContextType",function(){return j}),C.d(H,"PlaylistLevelType",function(){return L});var j;(function(A){A.MANIFEST="manifest",A.LEVEL="level",A.AUDIO_TRACK="audioTrack",A.SUBTITLE_TRACK="subtitleTrack"})(j||(j={}));var L;(function(A){A.MAIN="main",A.AUDIO="audio",A.SUBTITLE="subtitle"})(L||(L={}))},"./src/types/transmuxer.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"ChunkMetadata",function(){return j});var j=function(B,M,w,S,m,g){S===void 0&&(S=0),m===void 0&&(m=-1),g===void 0&&(g=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=L(),this.buffering={audio:L(),video:L(),audiovideo:L()},this.level=B,this.sn=M,this.id=w,this.size=S,this.part=m,this.partial=g};function L(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"AttrList",function(){return A});var j=/^(\d+)x(\d+)$/,L=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,A=function(){function B(w){typeof w=="string"&&(w=B.parseAttrList(w));for(var S in w)w.hasOwnProperty(S)&&(this[S]=w[S])}var M=B.prototype;return M.decimalInteger=function(S){var m=parseInt(this[S],10);return m>Number.MAX_SAFE_INTEGER?Infinity:m},M.hexadecimalInteger=function(S){if(this[S]){var m=(this[S]||"0x").slice(2);m=(m.length&1?"0":"")+m;for(var g=new Uint8Array(m.length/2),s=0;s<m.length/2;s++)g[s]=parseInt(m.slice(s*2,s*2+2),16);return g}else return null},M.hexadecimalIntegerAsNumber=function(S){var m=parseInt(this[S],16);return m>Number.MAX_SAFE_INTEGER?Infinity:m},M.decimalFloatingPoint=function(S){return parseFloat(this[S])},M.optionalFloat=function(S,m){var g=this[S];return g?parseFloat(g):m},M.enumeratedString=function(S){return this[S]},M.bool=function(S){return this[S]==="YES"},M.decimalResolution=function(S){var m=j.exec(this[S]);return m===null?void 0:{width:parseInt(m[1],10),height:parseInt(m[2],10)}},B.parseAttrList=function(S){var m,g={},s='"';for(L.lastIndex=0;(m=L.exec(S))!==null;){var a=m[2];a.indexOf(s)===0&&a.lastIndexOf(s)===a.length-1&&(a=a.slice(1,-1)),g[m[1]]=a}return g},B}()},"./src/utils/binary-search.ts":function(de,H,C){"use strict";C.r(H);var j={search:function(A,B){for(var M=0,w=A.length-1,S=null,m=null;M<=w;){S=(M+w)/2|0,m=A[S];var g=B(m);if(g>0)M=S+1;else if(g<0)w=S-1;else return m}return null}};H.default=j},"./src/utils/buffer-helper.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"BufferHelper",function(){return A});var j=C("./src/utils/logger.ts"),L={length:0,start:function(){return 0},end:function(){return 0}},A=function(){function B(){}return B.isBuffered=function(w,S){try{if(w){for(var m=B.getBuffered(w),g=0;g<m.length;g++)if(S>=m.start(g)&&S<=m.end(g))return!0}}catch(s){}return!1},B.bufferInfo=function(w,S,m){try{if(w){var g=B.getBuffered(w),s=[],a;for(a=0;a<g.length;a++)s.push({start:g.start(a),end:g.end(a)});return this.bufferedInfo(s,S,m)}}catch(i){}return{len:0,start:S,end:S,nextStart:void 0}},B.bufferedInfo=function(w,S,m){S=Math.max(0,S),w.sort(function(f,E){var y=f.start-E.start;return y||E.end-f.end});var g=[];if(m)for(var s=0;s<w.length;s++){var a=g.length;if(a){var i=g[a-1].end;w[s].start-i<m?w[s].end>i&&(g[a-1].end=w[s].end):g.push(w[s])}else g.push(w[s])}else g=w;for(var o=0,n,e=S,t=S,r=0;r<g.length;r++){var T=g[r].start,v=g[r].end;if(S+m>=T&&S<v)e=T,t=v,o=t-S;else if(S+m<T){n=T;break}}return{len:o,start:e||0,end:t||0,nextStart:n}},B.getBuffered=function(w){try{return w.buffered}catch(S){return j.logger.log("failed to get media.buffered",S),L}},B}()},"./src/utils/cea-608-parser.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"Row",function(){return t}),C.d(H,"CaptionScreen",function(){return r});var j=C("./src/utils/logger.ts"),L={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},A=function(l){var h=l;return L.hasOwnProperty(l)&&(h=L[l]),String.fromCharCode(h)},B=15,M=100,w={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},S={17:2,18:4,21:6,22:8,23:10,19:13,20:15},m={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},g={25:2,26:4,29:6,30:8,31:10,27:13,28:15},s=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],a;(function(u){u[u.ERROR=0]="ERROR",u[u.TEXT=1]="TEXT",u[u.WARNING=2]="WARNING",u[u.INFO=2]="INFO",u[u.DEBUG=3]="DEBUG",u[u.DATA=3]="DATA"})(a||(a={}));var i=function(){function u(){this.time=null,this.verboseLevel=a.ERROR}var l=u.prototype;return l.log=function(d,b){this.verboseLevel>=d&&j.logger.log(this.time+" ["+d+"] "+b)},u}(),o=function(l){for(var h=[],d=0;d<l.length;d++)h.push(l[d].toString(16));return h},n=function(){function u(h,d,b,p,x){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=h||"white",this.underline=d||!1,this.italics=b||!1,this.background=p||"black",this.flash=x||!1}var l=u.prototype;return l.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},l.setStyles=function(d){for(var b=["foreground","underline","italics","background","flash"],p=0;p<b.length;p++){var x=b[p];d.hasOwnProperty(x)&&(this[x]=d[x])}},l.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},l.equals=function(d){return this.foreground===d.foreground&&this.underline===d.underline&&this.italics===d.italics&&this.background===d.background&&this.flash===d.flash},l.copy=function(d){this.foreground=d.foreground,this.underline=d.underline,this.italics=d.italics,this.background=d.background,this.flash=d.flash},l.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},u}(),e=function(){function u(h,d,b,p,x,R){this.uchar=void 0,this.penState=void 0,this.uchar=h||" ",this.penState=new n(d,b,p,x,R)}var l=u.prototype;return l.reset=function(){this.uchar=" ",this.penState.reset()},l.setChar=function(d,b){this.uchar=d,this.penState.copy(b)},l.setPenState=function(d){this.penState.copy(d)},l.equals=function(d){return this.uchar===d.uchar&&this.penState.equals(d.penState)},l.copy=function(d){this.uchar=d.uchar,this.penState.copy(d.penState)},l.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},u}(),t=function(){function u(h){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var d=0;d<M;d++)this.chars.push(new e);this.logger=h,this.pos=0,this.currPenState=new n}var l=u.prototype;return l.equals=function(d){for(var b=!0,p=0;p<M;p++)if(!this.chars[p].equals(d.chars[p])){b=!1;break}return b},l.copy=function(d){for(var b=0;b<M;b++)this.chars[b].copy(d.chars[b])},l.isEmpty=function(){for(var d=!0,b=0;b<M;b++)if(!this.chars[b].isEmpty()){d=!1;break}return d},l.setCursor=function(d){this.pos!==d&&(this.pos=d),this.pos<0?(this.logger.log(a.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>M&&(this.logger.log(a.DEBUG,"Too large cursor position "+this.pos),this.pos=M)},l.moveCursor=function(d){var b=this.pos+d;if(d>1)for(var p=this.pos+1;p<b+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(b)},l.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},l.insertChar=function(d){d>=144&&this.backSpace();var b=A(d);if(this.pos>=M){this.logger.log(a.ERROR,"Cannot insert "+d.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},l.clearFromPos=function(d){var b;for(b=d;b<M;b++)this.chars[b].reset()},l.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},l.clearToEndOfRow=function(){this.clearFromPos(this.pos)},l.getTextString=function(){for(var d=[],b=!0,p=0;p<M;p++){var x=this.chars[p].uchar;x!==" "&&(b=!1),d.push(x)}return b?"":d.join("")},l.setPenStyles=function(d){this.currPenState.setStyles(d);var b=this.chars[this.pos];b.setPenState(this.currPenState)},u}(),r=function(){function u(h){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var d=0;d<B;d++)this.rows.push(new t(h));this.logger=h,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var l=u.prototype;return l.reset=function(){for(var d=0;d<B;d++)this.rows[d].clear();this.currRow=B-1},l.equals=function(d){for(var b=!0,p=0;p<B;p++)if(!this.rows[p].equals(d.rows[p])){b=!1;break}return b},l.copy=function(d){for(var b=0;b<B;b++)this.rows[b].copy(d.rows[b])},l.isEmpty=function(){for(var d=!0,b=0;b<B;b++)if(!this.rows[b].isEmpty()){d=!1;break}return d},l.backSpace=function(){var d=this.rows[this.currRow];d.backSpace()},l.clearToEndOfRow=function(){var d=this.rows[this.currRow];d.clearToEndOfRow()},l.insertChar=function(d){var b=this.rows[this.currRow];b.insertChar(d)},l.setPen=function(d){var b=this.rows[this.currRow];b.setPenStyles(d)},l.moveCursor=function(d){var b=this.rows[this.currRow];b.moveCursor(d)},l.setCursor=function(d){this.logger.log(a.INFO,"setCursor: "+d);var b=this.rows[this.currRow];b.setCursor(d)},l.setPAC=function(d){this.logger.log(a.INFO,"pacData = "+JSON.stringify(d));var b=d.row-1;if(this.nrRollUpRows&&b<this.nrRollUpRows-1&&(b=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==b){for(var p=0;p<B;p++)this.rows[p].clear();var x=this.currRow+1-this.nrRollUpRows,R=this.lastOutputScreen;if(R){var O=R.rows[x].cueStartTime,N=this.logger.time;if(O&&N!==null&&O<N)for(var U=0;U<this.nrRollUpRows;U++)this.rows[b-this.nrRollUpRows+U+1].copy(R.rows[x+U])}}this.currRow=b;var W=this.rows[this.currRow];if(d.indent!==null){var P=d.indent,K=Math.max(P-1,0);W.setCursor(d.indent),d.color=W.chars[K].penState.foreground}var V={foreground:d.color,underline:d.underline,italics:d.italics,background:"black",flash:!1};this.setPen(V)},l.setBkgData=function(d){this.logger.log(a.INFO,"bkgData = "+JSON.stringify(d)),this.backSpace(),this.setPen(d),this.insertChar(32)},l.setRollUpRows=function(d){this.nrRollUpRows=d},l.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(a.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(a.TEXT,this.getDisplayText());var d=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(d,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),this.logger.log(a.INFO,"Rolling up")},l.getDisplayText=function(d){d=d||!1;for(var b=[],p="",x=-1,R=0;R<B;R++){var O=this.rows[R].getTextString();O&&(x=R+1,d?b.push("Row "+x+": '"+O+"'"):b.push(O.trim()))}return b.length>0&&(d?p="["+b.join(" | ")+"]":p=b.join(`
|
|
`)),p},l.getTextAndFormat=function(){return this.rows},u}(),T=function(){function u(h,d,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=h,this.outputFilter=d,this.mode=null,this.verbose=0,this.displayedMemory=new r(b),this.nonDisplayedMemory=new r(b),this.lastOutputScreen=new r(b),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}var l=u.prototype;return l.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},l.getHandler=function(){return this.outputFilter},l.setHandler=function(d){this.outputFilter=d},l.setPAC=function(d){this.writeScreen.setPAC(d)},l.setBkgData=function(d){this.writeScreen.setBkgData(d)},l.setMode=function(d){if(d===this.mode)return;this.mode=d,this.logger.log(a.INFO,"MODE="+d),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=d},l.insertChars=function(d){for(var b=0;b<d.length;b++)this.writeScreen.insertChar(d[b]);var p=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(a.INFO,p+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(a.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},l.ccRCL=function(){this.logger.log(a.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},l.ccBS=function(){if(this.logger.log(a.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},l.ccAOF=function(){},l.ccAON=function(){},l.ccDER=function(){this.logger.log(a.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},l.ccRU=function(d){this.logger.log(a.INFO,"RU("+d+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(d)},l.ccFON=function(){this.logger.log(a.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},l.ccRDC=function(){this.logger.log(a.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},l.ccTR=function(){this.logger.log(a.INFO,"TR"),this.setMode("MODE_TEXT")},l.ccRTD=function(){this.logger.log(a.INFO,"RTD"),this.setMode("MODE_TEXT")},l.ccEDM=function(){this.logger.log(a.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},l.ccCR=function(){this.logger.log(a.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},l.ccENM=function(){this.logger.log(a.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},l.ccEOC=function(){if(this.logger.log(a.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var d=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=d,this.writeScreen=this.nonDisplayedMemory,this.logger.log(a.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},l.ccTO=function(d){this.logger.log(a.INFO,"TO("+d+") - Tab Offset"),this.writeScreen.moveCursor(d)},l.ccMIDROW=function(d){var b={flash:!1};if(b.underline=d%2===1,b.italics=d>=46,b.italics)b.foreground="white";else{var p=Math.floor(d/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=x[p]}this.logger.log(a.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},l.outputDataUpdate=function(d){d===void 0&&(d=!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),d&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},l.cueSplitAtTime=function(d){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,d,this.displayedMemory),this.cueStartTime=d))},u}(),v=function(){function u(h,d,b){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new i;this.channels=[null,new T(h,d,p),new T(h+1,b,p)],this.cmdHistory=y(),this.logger=p}var l=u.prototype;return l.getHandler=function(d){return this.channels[d].getHandler()},l.setHandler=function(d,b){this.channels[d].setHandler(b)},l.addData=function(d,b){var p,x,R,O=!1;this.logger.time=d;for(var N=0;N<b.length;N+=2){if(x=b[N]&127,R=b[N+1]&127,x===0&&R===0)continue;if(this.logger.log(a.DATA,"["+o([b[N],b[N+1]])+"] -> ("+o([x,R])+")"),p=this.parseCmd(x,R),p||(p=this.parseMidrow(x,R)),p||(p=this.parsePAC(x,R)),p||(p=this.parseBackgroundAttributes(x,R)),!p&&(O=this.parseChars(x,R),O)){var U=this.currentChannel;if(U&&U>0){var W=this.channels[U];W.insertChars(O)}else this.logger.log(a.WARNING,"No channel found yet. TEXT-MODE?")}!p&&!O&&this.logger.log(a.WARNING,"Couldn't parse cleaned data "+o([x,R])+" orig: "+o([b[N],b[N+1]]))}},l.parseCmd=function(d,b){var p=this.cmdHistory,x=(d===20||d===28||d===21||d===29)&&b>=32&&b<=47,R=(d===23||d===31)&&b>=33&&b<=35;if(!(x||R))return!1;if(E(d,b,p))return f(null,null,p),this.logger.log(a.DEBUG,"Repeated command ("+o([d,b])+") is dropped"),!0;var O=d===20||d===21||d===23?1:2,N=this.channels[O];return d===20||d===21||d===28||d===29?b===32?N.ccRCL():b===33?N.ccBS():b===34?N.ccAOF():b===35?N.ccAON():b===36?N.ccDER():b===37?N.ccRU(2):b===38?N.ccRU(3):b===39?N.ccRU(4):b===40?N.ccFON():b===41?N.ccRDC():b===42?N.ccTR():b===43?N.ccRTD():b===44?N.ccEDM():b===45?N.ccCR():b===46?N.ccENM():b===47&&N.ccEOC():N.ccTO(b-32),f(d,b,p),this.currentChannel=O,!0},l.parseMidrow=function(d,b){var p=0;if((d===17||d===25)&&b>=32&&b<=47){if(d===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(a.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[p];return x?(x.ccMIDROW(b),this.logger.log(a.DEBUG,"MIDROW ("+o([d,b])+")"),!0):!1}return!1},l.parsePAC=function(d,b){var p,x=this.cmdHistory,R=(d>=17&&d<=23||d>=25&&d<=31)&&b>=64&&b<=127,O=(d===16||d===24)&&b>=64&&b<=95;if(!(R||O))return!1;if(E(d,b,x))return f(null,null,x),!0;var N=d<=23?1:2;b>=64&&b<=95?p=N===1?w[d]:m[d]:p=N===1?S[d]:g[d];var U=this.channels[N];return U?(U.setPAC(this.interpretPAC(p,b)),f(d,b,x),this.currentChannel=N,!0):!1},l.interpretPAC=function(d,b){var p,x={color:null,italics:!1,indent:null,underline:!1,row:d};return b>95?p=b-96:p=b-64,x.underline=(p&1)===1,p<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((p-16)/2)*4,x},l.parseChars=function(d,b){var p,x=null,R=null;if(d>=25?(p=2,R=d-8):(p=1,R=d),R>=17&&R<=19){var O;R===17?O=b+80:R===18?O=b+112:O=b+144,this.logger.log(a.INFO,"Special char '"+A(O)+"' in channel "+p),x=[O]}else d>=32&&d<=127&&(x=b===0?[d]:[d,b]);if(x){var N=o(x);this.logger.log(a.DEBUG,"Char codes = "+N.join(",")),f(d,b,this.cmdHistory)}return x},l.parseBackgroundAttributes=function(d,b){var p=(d===16||d===24)&&b>=32&&b<=47,x=(d===23||d===31)&&b>=45&&b<=47;if(!(p||x))return!1;var R,O={};d===16||d===24?(R=Math.floor((b-32)/2),O.background=s[R],b%2===1&&(O.background=O.background+"_semi")):b===45?O.background="transparent":(O.foreground="black",b===47&&(O.underline=!0));var N=d<=23?1:2,U=this.channels[N];return U.setBkgData(O),f(d,b,this.cmdHistory),!0},l.reset=function(){for(var d=0;d<Object.keys(this.channels).length;d++){var b=this.channels[d];b&&b.reset()}this.cmdHistory=y()},l.cueSplitAtTime=function(d){for(var b=0;b<this.channels.length;b++){var p=this.channels[b];p&&p.cueSplitAtTime(d)}},u}();function f(u,l,h){h.a=u,h.b=l}function E(u,l,h){return h.a===u&&h.b===l}function y(){return{a:null,b:null}}H.default=v},"./src/utils/codecs.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"isCodecType",function(){return L}),C.d(H,"isCodecSupportedInMp4",function(){return A});var j={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function L(B,M){var w=j[M];return!!w&&w[B.slice(0,4)]===!0}function A(B,M){return MediaSource.isTypeSupported((M||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/utils/vttparser.ts"),L=C("./src/utils/webvtt-parser.ts"),A=C("./src/utils/texttrack-utils.ts"),B=/\s/,M={newCue:function(S,m,g,s){for(var a=[],i,o,n,e,t,r=self.VTTCue||self.TextTrackCue,T=0;T<s.rows.length;T++)if(i=s.rows[T],n=!0,e=0,t="",!i.isEmpty()){for(var v=0;v<i.chars.length;v++)B.test(i.chars[v].uchar)&&n?e++:(t+=i.chars[v].uchar,n=!1);i.cueStartTime=m,m===g&&(g+=1e-4),e>=16?e--:e++;var f=Object(j.fixLineBreaks)(t.trim()),E=Object(L.generateCueId)(m,g,f);(!S||!S.cues||!S.cues.getCueById(E))&&(o=new r(m,g,f),o.id=E,o.line=T+1,o.align="left",o.position=10+Math.min(80,Math.floor(e*8/32)*10),a.push(o))}return S&&a.length&&(a.sort(function(y,u){return y.line==="auto"||u.line==="auto"?0:y.line>8&&u.line>8?u.line-y.line:y.line-u.line}),a.forEach(function(y){return Object(A.addCueToTrack)(S,y)})),a}};H.default=M},"./src/utils/discontinuities.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"findFirstFragWithCC",function(){return B}),C.d(H,"shouldAlignOnDiscontinuities",function(){return M}),C.d(H,"findDiscontinuousReferenceFrag",function(){return w}),C.d(H,"adjustSlidingStart",function(){return m}),C.d(H,"alignStream",function(){return g}),C.d(H,"alignPDT",function(){return a}),C.d(H,"alignFragmentByPDTDelta",function(){return i}),C.d(H,"alignMediaPlaylistByPDT",function(){return o});var j=C("./src/polyfills/number.ts"),L=C("./src/utils/logger.ts"),A=C("./src/controller/level-helper.ts");function B(n,e){for(var t=null,r=0,T=n.length;r<T;r++){var v=n[r];if(v&&v.cc===e){t=v;break}}return t}function M(n,e,t){return!!(e.details&&(t.endCC>t.startCC||n&&n.cc<t.startCC))}function w(n,e){var t=n.fragments,r=e.fragments;if(!r.length||!t.length){L.logger.log("No fragments to align");return}var T=B(t,r[0].cc);if(!T||T&&!T.startPTS){L.logger.log("No frag in previous level to align on");return}return T}function S(n,e){if(n){var t=n.start+e;n.start=n.startPTS=t,n.endPTS=t+n.duration}}function m(n,e){for(var t=e.fragments,r=0,T=t.length;r<T;r++)S(t[r],n);e.fragmentHint&&S(e.fragmentHint,n),e.alignedSliding=!0}function g(n,e,t){if(!e)return;s(n,t,e),!t.alignedSliding&&e.details&&a(t,e.details),!t.alignedSliding&&e.details&&!t.skippedSegments&&Object(A.adjustSliding)(e.details,t)}function s(n,e,t){if(M(n,t,e)){var r=w(t.details,e);r&&Object(j.isFiniteNumber)(r.start)&&(L.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),m(r.start,e))}}function a(n,e){if(!e.fragments.length||!n.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,r=n.fragments[0].programDateTime,T=(r-t)/1e3+e.fragments[0].start;T&&Object(j.isFiniteNumber)(T)&&(L.logger.log("Adjusting PTS using programDateTime delta "+(r-t)+"ms, sliding:"+T.toFixed(3)+" "+n.url+" "),m(T,n))}function i(n,e){var t=n.programDateTime;if(!t)return;var r=(t-e)/1e3;n.start=n.startPTS=r,n.endPTS=r+n.duration}function o(n,e){if(!e.fragments.length||!n.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,r=e.fragments[0].start,T=t-r*1e3;n.fragments.forEach(function(v){i(v,T)}),n.fragmentHint&&i(n.fragmentHint,T),n.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/utils/ewma.ts"),L=function(){function A(M,w,S){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=S,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new j.default(M),this.fast_=new j.default(w)}var B=A.prototype;return B.update=function(w,S){var m=this.slow_,g=this.fast_;this.slow_.halfLife!==w&&(this.slow_=new j.default(w,m.getEstimate(),m.getTotalWeight())),this.fast_.halfLife!==S&&(this.fast_=new j.default(S,g.getEstimate(),g.getTotalWeight()))},B.sample=function(w,S){w=Math.max(w,this.minDelayMs_);var m=8*S,g=w/1e3,s=m/g;this.fast_.sample(g,s),this.slow_.sample(g,s)},B.canEstimate=function(){var w=this.fast_;return w&&w.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},A}();H.default=L},"./src/utils/ewma.ts":function(de,H,C){"use strict";C.r(H);var j=function(){function L(B,M,w){M===void 0&&(M=0),w===void 0&&(w=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=M,this.totalWeight_=w}var A=L.prototype;return A.sample=function(M,w){var S=Math.pow(this.alpha_,M);this.estimate_=w*(1-S)+S*this.estimate_,this.totalWeight_+=M},A.getTotalWeight=function(){return this.totalWeight_},A.getEstimate=function(){if(this.alpha_){var M=1-Math.pow(this.alpha_,this.totalWeight_);if(M)return this.estimate_/M}return this.estimate_},L}();H.default=j},"./src/utils/fetch-loader.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"fetchSupported",function(){return i});var j=C("./src/polyfills/number.ts"),L=C("./src/loader/load-stats.ts"),A=C("./src/demux/chunk-cache.ts");function B(r,T){r.prototype=Object.create(T.prototype),r.prototype.constructor=r,g(r,T)}function M(r){var T=typeof Map=="function"?new Map:void 0;return M=function(f){if(f===null||!m(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof T!="undefined"){if(T.has(f))return T.get(f);T.set(f,E)}function E(){return w(f,arguments,s(this).constructor)}return E.prototype=Object.create(f.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),g(E,f)},M(r)}function w(r,T,v){return S()?w=Reflect.construct:w=function(E,y,u){var l=[null];l.push.apply(l,y);var h=Function.bind.apply(E,l),d=new h;return u&&g(d,u.prototype),d},w.apply(null,arguments)}function S(){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(r){return!1}}function m(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function g(r,T){return g=Object.setPrototypeOf||function(f,E){return f.__proto__=E,f},g(r,T)}function s(r){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},s(r)}function a(){return a=Object.assign||function(r){for(var T=1;T<arguments.length;T++){var v=arguments[T];for(var f in v)Object.prototype.hasOwnProperty.call(v,f)&&(r[f]=v[f])}return r},a.apply(this,arguments)}function i(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(r){}return!1}var o=function(){function r(v){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=v.fetchSetup||e,this.controller=new self.AbortController,this.stats=new L.LoadStats}var T=r.prototype;return T.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},T.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},T.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},T.load=function(f,E,y){var u=this,l=this.stats;if(l.loading.start)throw new Error("Loader can only be used once.");l.loading.start=self.performance.now();var h=n(f,this.controller.signal),d=y.onProgress,b=f.responseType==="arraybuffer",p=b?"byteLength":"length";this.context=f,this.config=E,this.callbacks=y,this.request=this.fetchSetup(f,h),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){u.abortInternal(),y.onTimeout(l,f,u.response)},E.timeout),self.fetch(this.request).then(function(x){if(u.response=u.loader=x,!x.ok){var R=x.status,O=x.statusText;throw new t(O||"fetch, bad network response",R,x)}return l.loading.first=Math.max(self.performance.now(),l.loading.start),l.total=parseInt(x.headers.get("Content-Length")||"0"),d&&Object(j.isFiniteNumber)(E.highWaterMark)?u.loadProgressively(x,l,f,E.highWaterMark,d):b?x.arrayBuffer():x.text()}).then(function(x){var R=u.response;self.clearTimeout(u.requestTimeout),l.loading.end=Math.max(self.performance.now(),l.loading.first),l.loaded=l.total=x[p];var O={url:R.url,data:x};d&&!Object(j.isFiniteNumber)(E.highWaterMark)&&d(l,f,x,R),y.onSuccess(O,l,f,R)}).catch(function(x){if(self.clearTimeout(u.requestTimeout),l.aborted)return;var R=x.code||0;y.onError({code:R,text:x.message},f,x.details)})},T.getCacheAge=function(){var f=null;if(this.response){var E=this.response.headers.get("age");f=E?parseFloat(E):null}return f},T.loadProgressively=function(f,E,y,u,l){u===void 0&&(u=0);var h=new A.default,d=f.body.getReader(),b=function p(){return d.read().then(function(x){if(x.done)return h.dataLength&&l(E,y,h.flush(),f),Promise.resolve(new ArrayBuffer(0));var R=x.value,O=R.length;return E.loaded+=O,O<u||h.dataLength?(h.push(R),h.dataLength>=u&&l(E,y,h.flush(),f)):l(E,y,R,f),p()}).catch(function(){return Promise.reject()})};return b()},r}();function n(r,T){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:T,headers:new self.Headers(a({},r.headers))};return r.rangeEnd&&v.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),v}function e(r,T){return new self.Request(r.url,T)}var t=function(r){B(T,r);function T(v,f,E){var y;return y=r.call(this,v)||this,y.code=void 0,y.details=void 0,y.code=f,y.details=E,y}return T}(M(Error));H.default=o},"./src/utils/imsc1-ttml-parser.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"IMSC1_CODEC",function(){return m}),C.d(H,"parseIMSC1",function(){return i});var j=C("./src/utils/mp4-tools.ts"),L=C("./src/utils/vttparser.ts"),A=C("./src/utils/vttcue.ts"),B=C("./src/demux/id3.ts"),M=C("./src/utils/timescale-conversion.ts"),w=C("./src/utils/webvtt-parser.ts");function S(){return S=Object.assign||function(u){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(u[d]=h[d])}return u},S.apply(this,arguments)}var m="stpp.ttml.im1t",g=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,s=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,a={left:"start",center:"center",right:"end",start:"start",end:"end"};function i(u,l,h,d,b){var p=Object(j.findBox)(new Uint8Array(u),["mdat"]);if(p.length===0){b(new Error("Could not parse IMSC1 mdat"));return}var x=p[0],R=Object(B.utf8ArrayToStr)(new Uint8Array(u,x.start,x.end-x.start)),O=Object(M.toTimescaleFromScale)(l,1,h);try{d(o(R,O))}catch(N){b(N)}}function o(u,l){var h=new DOMParser,d=h.parseFromString(u,"text/xml"),b=d.getElementsByTagName("tt")[0];if(!b)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},x=Object.keys(p).reduce(function(W,P){return W[P]=b.getAttribute("ttp:"+P)||p[P],W},{}),R=b.getAttribute("xml:space")!=="preserve",O=e(n(b,"styling","style")),N=e(n(b,"layout","region")),U=n(b,"body","[begin]");return[].map.call(U,function(W){var P=t(W,R);if(!P||!W.hasAttribute("begin"))return null;var K=f(W.getAttribute("begin"),x),V=f(W.getAttribute("dur"),x),re=f(W.getAttribute("end"),x);if(K===null)throw v(W);if(re===null){if(V===null)throw v(W);re=K+V}var ee=new A.default(K-l,re-l,P);ee.id=Object(w.generateCueId)(ee.startTime,ee.endTime,ee.text);var le=N[W.getAttribute("region")],oe=O[W.getAttribute("style")];ee.position=10,ee.size=80;var $=r(le,oe),Z=$.textAlign;if(Z){var ne=a[Z];ne&&(ee.lineAlign=ne),ee.align=Z}return S(ee,$),ee}).filter(function(W){return W!==null})}function n(u,l,h){var d=u.getElementsByTagName(l)[0];return d?[].slice.call(d.querySelectorAll(h)):[]}function e(u){return u.reduce(function(l,h){var d=h.getAttribute("xml:id");return d&&(l[d]=h),l},{})}function t(u,l){return[].slice.call(u.childNodes).reduce(function(h,d,b){var p;return d.nodeName==="br"&&b?h+`
|
|
`:(p=d.childNodes)!==null&&p!==void 0&&p.length?t(d,l):l?h+d.textContent.trim().replace(/\s+/g," "):h+d.textContent},"")}function r(u,l){var h="http://www.w3.org/ns/ttml#styling",d=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return d.reduce(function(b,p){var x=T(l,h,p)||T(u,h,p);return x&&(b[p]=x),b},{})}function T(u,l,h){return u.hasAttributeNS(l,h)?u.getAttributeNS(l,h):null}function v(u){return new Error("Could not parse ttml timestamp "+u)}function f(u,l){if(!u)return null;var h=Object(L.parseTimeStamp)(u);return h===null&&(g.test(u)?h=E(u,l):s.test(u)&&(h=y(u,l))),h}function E(u,l){var h=g.exec(u),d=(h[4]|0)+(h[5]|0)/l.subFrameRate;return(h[1]|0)*3600+(h[2]|0)*60+(h[3]|0)+d/l.frameRate}function y(u,l){var h=s.exec(u),d=Number(h[1]),b=h[2];switch(b){case"h":return d*3600;case"m":return d*60;case"ms":return d*1e3;case"f":return d/l.frameRate;case"t":return d/l.tickRate}return d}},"./src/utils/logger.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"enableLogs",function(){return w}),C.d(H,"logger",function(){return S});var j=function(){},L={trace:j,debug:j,log:j,warn:j,info:j,error:j},A=L;function B(m){var g=self.console[m];return g?g.bind(self.console,"["+m+"] >"):j}function M(m){for(var g=arguments.length,s=new Array(g>1?g-1:0),a=1;a<g;a++)s[a-1]=arguments[a];s.forEach(function(i){A[i]=m[i]?m[i].bind(m):B(i)})}function w(m){if(self.console&&m===!0||typeof m=="object"){M(m,"debug","log","info","warn","error");try{A.log()}catch(g){A=L}}else A=L}var S=A},"./src/utils/mediakeys-helper.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"KeySystems",function(){return j}),C.d(H,"requestMediaKeySystemAccess",function(){return L});var j;(function(A){A.WIDEVINE="com.widevine.alpha",A.PLAYREADY="com.microsoft.playready"})(j||(j={}));var L=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"getMediaSource",function(){return j});function j(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"bin2str",function(){return M}),C.d(H,"readUint16",function(){return w}),C.d(H,"readUint32",function(){return S}),C.d(H,"writeUint32",function(){return m}),C.d(H,"findBox",function(){return g}),C.d(H,"parseSegmentIndex",function(){return s}),C.d(H,"parseInitSegment",function(){return a}),C.d(H,"getStartDTS",function(){return i}),C.d(H,"getDuration",function(){return o}),C.d(H,"computeRawDurationFromSamples",function(){return n}),C.d(H,"offsetStartDTS",function(){return e}),C.d(H,"segmentValidRange",function(){return t}),C.d(H,"appendUint8Array",function(){return r});var j=C("./src/utils/typed-array.ts"),L=C("./src/loader/fragment.ts"),A=Math.pow(2,32)-1,B=[].push;function M(T){return String.fromCharCode.apply(null,T)}function w(T,v){"data"in T&&(v+=T.start,T=T.data);var f=T[v]<<8|T[v+1];return f<0?65536+f:f}function S(T,v){"data"in T&&(v+=T.start,T=T.data);var f=T[v]<<24|T[v+1]<<16|T[v+2]<<8|T[v+3];return f<0?4294967296+f:f}function m(T,v,f){"data"in T&&(v+=T.start,T=T.data),T[v]=f>>24,T[v+1]=f>>16&255,T[v+2]=f>>8&255,T[v+3]=f&255}function g(T,v){var f=[];if(!v.length)return f;var E,y,u;"data"in T?(E=T.data,y=T.start,u=T.end):(E=T,y=0,u=E.byteLength);for(var l=y;l<u;){var h=S(E,l),d=M(E.subarray(l+4,l+8)),b=h>1?l+h:u;if(d===v[0])if(v.length===1)f.push({data:E,start:l+8,end:b});else{var p=g({data:E,start:l+8,end:b},v.slice(1));p.length&&B.apply(f,p)}l=b}return f}function s(T){var v=g(T,["moov"]),f=v[0],E=f?f.end:null,y=g(T,["sidx"]);if(!y||!y[0])return null;var u=[],l=y[0],h=l.data[0],d=h===0?8:16,b=S(l,d);d+=4;var p=0,x=0;h===0?d+=8:d+=16,d+=2;var R=l.end+x,O=w(l,d);d+=2;for(var N=0;N<O;N++){var U=d,W=S(l,U);U+=4;var P=W&2147483647,K=(W&2147483648)>>>31;if(K===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var V=S(l,U);U+=4,u.push({referenceSize:P,subsegmentDuration:V,info:{duration:V/b,start:R,end:R+P-1}}),R+=P,U+=4,d=U}return{earliestPresentationTime:p,timescale:b,version:h,referencesCount:O,references:u,moovEndOffset:E}}function a(T){for(var v=[],f=g(T,["moov","trak"]),E=0;E<f.length;E++){var y=f[E],u=g(y,["tkhd"])[0];if(u){var l=u.data[u.start],h=l===0?12:20,d=S(u,h),b=g(y,["mdia","mdhd"])[0];if(b){l=b.data[b.start],h=l===0?12:20;var p=S(b,h),x=g(y,["mdia","hdlr"])[0];if(x){var R=M(x.data.subarray(x.start+8,x.start+12)),O={soun:L.ElementaryStreamTypes.AUDIO,vide:L.ElementaryStreamTypes.VIDEO}[R];if(O){var N=g(y,["mdia","minf","stbl","stsd"])[0],U=void 0;N&&(U=M(N.data.subarray(N.start+12,N.start+16))),v[d]={timescale:p,type:O},v[O]={timescale:p,id:d,codec:U}}}}}}var W=g(T,["moov","mvex","trex"]);return W.forEach(function(P){var K=S(P,4),V=v[K];V&&(V.default={duration:S(P,12),flags:S(P,20)})}),v}function i(T,v){return g(v,["moof","traf"]).reduce(function(f,E){var y=g(E,["tfdt"])[0],u=y.data[y.start],l=g(E,["tfhd"]).reduce(function(h,d){var b=S(d,4),p=T[b];if(p){var x=S(y,4);u===1&&(x*=Math.pow(2,32),x+=S(y,8));var R=p.timescale||9e4,O=x/R;if(isFinite(O)&&(h===null||O<h))return O}return h},null);return l!==null&&isFinite(l)&&(f===null||l<f)?l:f},null)||0}function o(T,v){for(var f=0,E=0,y=0,u=g(T,["moof","traf"]),l=0;l<u.length;l++){var h=u[l],d=g(h,["tfhd"])[0],b=S(d,4),p=v[b];if(!p)continue;var x=p.default,R=S(d,0)|(x==null?void 0:x.flags),O=x==null?void 0:x.duration;R&8&&(R&2?O=S(d,12):O=S(d,8));for(var N=p.timescale||9e4,U=g(h,["trun"]),W=0;W<U.length;W++){if(O){var P=S(U[W],4);f=O*P}else f=n(U[W]);p.type===L.ElementaryStreamTypes.VIDEO?E+=f/N:p.type===L.ElementaryStreamTypes.AUDIO&&(y+=f/N)}}if(E===0&&y===0){var K=s(T);if(K!=null&&K.references)return K.references.reduce(function(V,re){return V+re.info.duration||0},0)}return E||y}function n(T){var v=S(T,0),f=8;v&1&&(f+=4),v&4&&(f+=4);for(var E=0,y=S(T,4),u=0;u<y;u++){if(v&256){var l=S(T,f);E+=l,f+=4}v&512&&(f+=4),v&1024&&(f+=4),v&2048&&(f+=4)}return E}function e(T,v,f){g(v,["moof","traf"]).forEach(function(E){g(E,["tfhd"]).forEach(function(y){var u=S(y,4),l=T[u];if(!l)return;var h=l.timescale||9e4;g(E,["tfdt"]).forEach(function(d){var b=d.data[d.start],p=S(d,4);if(b===0)m(d,4,p-f*h);else{p*=Math.pow(2,32),p+=S(d,8),p-=f*h,p=Math.max(p,0);var x=Math.floor(p/(A+1)),R=Math.floor(p%(A+1));m(d,4,x),m(d,8,R)}})})})}function t(T){var v={valid:null,remainder:null},f=g(T,["moof"]);if(f){if(f.length<2)return v.remainder=T,v}else return v;var E=f[f.length-1];return v.valid=Object(j.sliceUint8)(T,0,E.start-8),v.remainder=Object(j.sliceUint8)(T,E.start-8),v}function r(T,v){var f=new Uint8Array(T.length+v.length);return f.set(T),f.set(v,T.length),f}},"./src/utils/output-filter.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"default",function(){return j});var j=function(){function L(B,M){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=M}var A=L.prototype;return A.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},A.newCue=function(M,w,S){(this.startTime===null||this.startTime>M)&&(this.startTime=M),this.endTime=w,this.screen=S,this.timelineController.createCaptionsTrack(this.trackName)},A.reset=function(){this.cueRanges=[]},L}()},"./src/utils/texttrack-utils.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"sendAddTrackEvent",function(){return L}),C.d(H,"addCueToTrack",function(){return A}),C.d(H,"clearCurrentCues",function(){return B}),C.d(H,"removeCuesInRange",function(){return M}),C.d(H,"getCuesInRange",function(){return S});var j=C("./src/utils/logger.ts");function L(m,g){var s;try{s=new Event("addtrack")}catch(a){s=document.createEvent("Event"),s.initEvent("addtrack",!1,!1)}s.track=m,g.dispatchEvent(s)}function A(m,g){var s=m.mode;if(s==="disabled"&&(m.mode="hidden"),m.cues&&!m.cues.getCueById(g.id))try{if(m.addCue(g),!m.cues.getCueById(g.id))throw new Error("addCue is failed for: "+g)}catch(i){j.logger.debug("[texttrack-utils]: "+i);var a=new self.TextTrackCue(g.startTime,g.endTime,g.text);a.id=g.id,m.addCue(a)}s==="disabled"&&(m.mode=s)}function B(m){var g=m.mode;if(g==="disabled"&&(m.mode="hidden"),m.cues)for(var s=m.cues.length;s--;)m.removeCue(m.cues[s]);g==="disabled"&&(m.mode=g)}function M(m,g,s){var a=m.mode;if(a==="disabled"&&(m.mode="hidden"),m.cues&&m.cues.length>0)for(var i=S(m.cues,g,s),o=0;o<i.length;o++)m.removeCue(i[o]);a==="disabled"&&(m.mode=a)}function w(m,g){if(g<m[0].startTime)return 0;var s=m.length-1;if(g>m[s].endTime)return-1;for(var a=0,i=s;a<=i;){var o=Math.floor((i+a)/2);if(g<m[o].startTime)i=o-1;else if(g>m[o].startTime&&a<s)a=o+1;else return o}return m[a].startTime-g<g-m[i].startTime?a:i}function S(m,g,s){var a=[],i=w(m,g);if(i>-1)for(var o=i,n=m.length;o<n;o++){var e=m[o];if(e.startTime>=g&&e.endTime<=s)a.push(e);else if(e.startTime>s)return a}return a}},"./src/utils/time-ranges.ts":function(de,H,C){"use strict";C.r(H);var j={toString:function(A){for(var B="",M=A.length,w=0;w<M;w++)B+="["+A.start(w).toFixed(3)+","+A.end(w).toFixed(3)+"]";return B}};H.default=j},"./src/utils/timescale-conversion.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"toTimescaleFromBase",function(){return L}),C.d(H,"toTimescaleFromScale",function(){return A}),C.d(H,"toMsFromMpegTsClock",function(){return B}),C.d(H,"toMpegTsClockFromTimescale",function(){return M});var j=9e4;function L(w,S,m,g){m===void 0&&(m=1),g===void 0&&(g=!1);var s=w*S*m;return g?Math.round(s):s}function A(w,S,m,g){return m===void 0&&(m=1),g===void 0&&(g=!1),L(w,S,1/m,g)}function B(w,S){return S===void 0&&(S=!1),L(w,1e3,1/j,S)}function M(w,S){return S===void 0&&(S=1),L(w,j,1/S)}},"./src/utils/typed-array.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"sliceUint8",function(){return j});function j(L,A,B){return Uint8Array.prototype.slice?L.slice(A,B):new Uint8Array(Array.prototype.slice.call(L,A,B))}},"./src/utils/vttcue.ts":function(de,H,C){"use strict";C.r(H),H.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var j=["","lr","rl"],L=["start","middle","end","left","right"];function A(m,g){if(typeof g!="string")return!1;if(!Array.isArray(m))return!1;var s=g.toLowerCase();return~m.indexOf(s)?s:!1}function B(m){return A(j,m)}function M(m){return A(L,m)}function w(m){for(var g=arguments.length,s=new Array(g>1?g-1:0),a=1;a<g;a++)s[a-1]=arguments[a];for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var n in o)m[n]=o[n]}return m}function S(m,g,s){var a=this,i={enumerable:!0};a.hasBeenReset=!1;var o="",n=!1,e=m,t=g,r=s,T=null,v="",f=!0,E="auto",y="start",u=50,l="middle",h=50,d="middle";Object.defineProperty(a,"id",w({},i,{get:function(){return o},set:function(p){o=""+p}})),Object.defineProperty(a,"pauseOnExit",w({},i,{get:function(){return n},set:function(p){n=!!p}})),Object.defineProperty(a,"startTime",w({},i,{get:function(){return e},set:function(p){if(typeof p!="number")throw new TypeError("Start time must be set to a number.");e=p,this.hasBeenReset=!0}})),Object.defineProperty(a,"endTime",w({},i,{get:function(){return t},set:function(p){if(typeof p!="number")throw new TypeError("End time must be set to a number.");t=p,this.hasBeenReset=!0}})),Object.defineProperty(a,"text",w({},i,{get:function(){return r},set:function(p){r=""+p,this.hasBeenReset=!0}})),Object.defineProperty(a,"region",w({},i,{get:function(){return T},set:function(p){T=p,this.hasBeenReset=!0}})),Object.defineProperty(a,"vertical",w({},i,{get:function(){return v},set:function(p){var x=B(p);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=x,this.hasBeenReset=!0}})),Object.defineProperty(a,"snapToLines",w({},i,{get:function(){return f},set:function(p){f=!!p,this.hasBeenReset=!0}})),Object.defineProperty(a,"line",w({},i,{get:function(){return E},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");E=p,this.hasBeenReset=!0}})),Object.defineProperty(a,"lineAlign",w({},i,{get:function(){return y},set:function(p){var x=M(p);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");y=x,this.hasBeenReset=!0}})),Object.defineProperty(a,"position",w({},i,{get:function(){return u},set:function(p){if(p<0||p>100)throw new Error("Position must be between 0 and 100.");u=p,this.hasBeenReset=!0}})),Object.defineProperty(a,"positionAlign",w({},i,{get:function(){return l},set:function(p){var x=M(p);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");l=x,this.hasBeenReset=!0}})),Object.defineProperty(a,"size",w({},i,{get:function(){return h},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");h=p,this.hasBeenReset=!0}})),Object.defineProperty(a,"align",w({},i,{get:function(){return d},set:function(p){var x=M(p);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");d=x,this.hasBeenReset=!0}})),a.displayState=void 0}return S.prototype.getCueAsHTML=function(){var m=self.WebVTT;return m.convertCueToDOMTree(self,this.text)},S}()},"./src/utils/vttparser.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"parseTimeStamp",function(){return A}),C.d(H,"fixLineBreaks",function(){return g}),C.d(H,"VTTParser",function(){return s});var j=C("./src/utils/vttcue.ts"),L=function(){function a(){}var i=a.prototype;return i.decode=function(n,e){if(!n)return"";if(typeof n!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(n))},a}();function A(a){function i(n,e,t,r){return(n|0)*3600+(e|0)*60+(t|0)+parseFloat(r||0)}var o=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return o?parseFloat(o[2])>59?i(o[2],o[3],0,o[4]):i(o[1],o[2],o[3],o[4]):null}var B=function(){function a(){this.values=Object.create(null)}var i=a.prototype;return i.set=function(n,e){!this.get(n)&&e!==""&&(this.values[n]=e)},i.get=function(n,e,t){return t?this.has(n)?this.values[n]:e[t]:this.has(n)?this.values[n]:e},i.has=function(n){return n in this.values},i.alt=function(n,e,t){for(var r=0;r<t.length;++r)if(e===t[r]){this.set(n,e);break}},i.integer=function(n,e){/^-?\d+$/.test(e)&&this.set(n,parseInt(e,10))},i.percent=function(n,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var t=parseFloat(e);if(t>=0&&t<=100)return this.set(n,t),!0}return!1},a}();function M(a,i,o,n){var e=n?a.split(n):[a];for(var t in e){if(typeof e[t]!="string")continue;var r=e[t].split(o);if(r.length!==2)continue;var T=r[0],v=r[1];i(T,v)}}var w=new j.default(0,0,""),S=w.align==="middle"?"middle":"center";function m(a,i,o){var n=a;function e(){var T=A(a);if(T===null)throw new Error("Malformed timestamp: "+n);return a=a.replace(/^[^\sa-zA-Z-]+/,""),T}function t(T,v){var f=new B;M(T,function(u,l){var h;switch(u){case"region":for(var d=o.length-1;d>=0;d--)if(o[d].id===l){f.set(u,o[d].region);break}break;case"vertical":f.alt(u,l,["rl","lr"]);break;case"line":h=l.split(","),f.integer(u,h[0]),f.percent(u,h[0])&&f.set("snapToLines",!1),f.alt(u,h[0],["auto"]),h.length===2&&f.alt("lineAlign",h[1],["start",S,"end"]);break;case"position":h=l.split(","),f.percent(u,h[0]),h.length===2&&f.alt("positionAlign",h[1],["start",S,"end","line-left","line-right","auto"]);break;case"size":f.percent(u,l);break;case"align":f.alt(u,l,["start",S,"end","left","right"]);break}},/:/,/\s/),v.region=f.get("region",null),v.vertical=f.get("vertical","");var E=f.get("line","auto");E==="auto"&&w.line===-1&&(E=-1),v.line=E,v.lineAlign=f.get("lineAlign","start"),v.snapToLines=f.get("snapToLines",!0),v.size=f.get("size",100),v.align=f.get("align",S);var y=f.get("position","auto");y==="auto"&&w.position===50&&(y=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=y}function r(){a=a.replace(/^\s+/,"")}if(r(),i.startTime=e(),r(),a.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);a=a.substr(3),r(),i.endTime=e(),r(),t(a,i)}function g(a){return a.replace(/<br(?: \/)?>/gi,`
|
|
`)}var s=function(){function a(){this.state="INITIAL",this.buffer="",this.decoder=new L,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var i=a.prototype;return i.parse=function(n){var e=this;n&&(e.buffer+=e.decoder.decode(n,{stream:!0}));function t(){var y=e.buffer,u=0;for(y=g(y);u<y.length&&y[u]!=="\r"&&y[u]!==`
|
|
`;)++u;var l=y.substr(0,u);return y[u]==="\r"&&++u,y[u]===`
|
|
`&&++u,e.buffer=y.substr(u),l}function r(y){M(y,function(u,l){},/:/)}try{var T="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;T=t();var v=T.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var f=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;f?f=!1:T=t();switch(e.state){case"HEADER":/:/.test(T)?r(T):T||(e.state="ID");continue;case"NOTE":T||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(T)){e.state="NOTE";break}if(!T)continue;if(e.cue=new j.default(0,0,""),e.state="CUE",T.indexOf("-->")===-1){e.cue.id=T;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{m(T,e.cue,e.regionList)}catch(y){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var E=T.indexOf("-->")!==-1;if(!T||E&&(f=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(e.cue===null)continue;e.cue.text&&(e.cue.text+=`
|
|
`),e.cue.text+=T}continue;case"BADCUE":T||(e.state="ID")}}}catch(y){e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},i.flush=function(){var n=this;try{if((n.cue||n.state==="HEADER")&&(n.buffer+=`
|
|
|
|
`,n.parse()),n.state==="INITIAL"||n.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(e){n.onparsingerror&&n.onparsingerror(e)}return n.onflush&&n.onflush(),this},a}()},"./src/utils/webvtt-parser.ts":function(de,H,C){"use strict";C.r(H),C.d(H,"generateCueId",function(){return s}),C.d(H,"parseWebVTT",function(){return i});var j=C("./src/polyfills/number.ts"),L=C("./src/utils/vttparser.ts"),A=C("./src/demux/id3.ts"),B=C("./src/utils/timescale-conversion.ts"),M=C("./src/remux/mp4-remuxer.ts"),w=/\r\n|\n\r|\n|\r/g,S=function(n,e,t){return t===void 0&&(t=0),n.substr(t,e.length)===e},m=function(n){var e=parseInt(n.substr(-3)),t=parseInt(n.substr(-6,2)),r=parseInt(n.substr(-9,2)),T=n.length>9?parseInt(n.substr(0,n.indexOf(":"))):0;if(!Object(j.isFiniteNumber)(e)||!Object(j.isFiniteNumber)(t)||!Object(j.isFiniteNumber)(r)||!Object(j.isFiniteNumber)(T))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+n);return e+=1e3*t,e+=60*1e3*r,e+=60*60*1e3*T,e},g=function(n){for(var e=5381,t=n.length;t;)e=e*33^n.charCodeAt(--t);return(e>>>0).toString()};function s(o,n,e){return g(o.toString())+g(n.toString())+g(e)}var a=function(n,e,t){var r=n[e],T=n[r.prevCC];if(!T||!T.new&&r.new){n.ccOffset=n.presentationOffset=r.start,r.new=!1;return}for(;(v=T)!==null&&v!==void 0&&v.new;){var v;n.ccOffset+=r.start-T.start,r.new=!1,r=T,T=n[r.prevCC]}n.presentationOffset=t};function i(o,n,e,t,r,T,v,f){var E=new L.VTTParser,y=Object(A.utf8ArrayToStr)(new Uint8Array(o)).trim().replace(w,`
|
|
`).split(`
|
|
`),u=[],l=Object(B.toMpegTsClockFromTimescale)(n,e),h="00:00.000",d=0,b=0,p,x=!0,R=!1;E.oncue=function(O){var N=t[r],U=t.ccOffset,W=(d-l)/9e4;if(N!=null&&N.new&&(b!==void 0?U=t.ccOffset=N.start:a(t,r,W)),W&&(U=W-t.presentationOffset),R){var P=O.endTime-O.startTime,K=Object(M.normalizePts)((O.startTime+U-b)*9e4,T*9e4)/9e4;O.startTime=K,O.endTime=K+P}var V=O.text.trim();O.text=decodeURIComponent(encodeURIComponent(V)),O.id||(O.id=s(O.startTime,O.endTime,V)),O.endTime>0&&u.push(O)},E.onparsingerror=function(O){p=O},E.onflush=function(){if(p){f(p);return}v(u)},y.forEach(function(O){if(x)if(S(O,"X-TIMESTAMP-MAP=")){x=!1,R=!0,O.substr(16).split(",").forEach(function(N){S(N,"LOCAL:")?h=N.substr(6):S(N,"MPEGTS:")&&(d=parseInt(N.substr(7)))});try{b=m(h)/1e3}catch(N){R=!1,p=N}return}else O===""&&(x=!1);E.parse(O+`
|
|
`)}),E.flush()}},"./src/utils/xhr-loader.ts":function(de,H,C){"use strict";C.r(H);var j=C("./src/utils/logger.ts"),L=C("./src/loader/load-stats.ts"),A=/^age:\s*[\d.]+\s*$/m,B=function(){function M(S){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=S?S.xhrSetup:null,this.stats=new L.LoadStats,this.retryDelay=0}var w=M.prototype;return w.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},w.abortInternal=function(){var m=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),m&&(m.onreadystatechange=null,m.onprogress=null,m.readyState!==4&&(this.stats.aborted=!0,m.abort()))},w.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},w.load=function(m,g,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=m,this.config=g,this.callbacks=s,this.retryDelay=g.retryDelay,this.loadInternal()},w.loadInternal=function(){var m=this.config,g=this.context;if(!m)return;var s=this.loader=new self.XMLHttpRequest,a=this.stats;a.loading.first=0,a.loaded=0;var i=this.xhrSetup;try{if(i)try{i(s,g.url)}catch(e){s.open("GET",g.url,!0),i(s,g.url)}s.readyState||s.open("GET",g.url,!0);var o=this.context.headers;if(o)for(var n in o)s.setRequestHeader(n,o[n])}catch(e){this.callbacks.onError({code:s.status,text:e.message},g,s);return}g.rangeEnd&&s.setRequestHeader("Range","bytes="+g.rangeStart+"-"+(g.rangeEnd-1)),s.onreadystatechange=this.readystatechange.bind(this),s.onprogress=this.loadprogress.bind(this),s.responseType=g.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout),s.send()},w.readystatechange=function(){var m=this.context,g=this.loader,s=this.stats;if(!m||!g)return;var a=g.readyState,i=this.config;if(s.aborted)return;if(a>=2)if(self.clearTimeout(this.requestTimeout),s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start)),a===4){g.onreadystatechange=null,g.onprogress=null;var o=g.status;if(o>=200&&o<300){s.loading.end=Math.max(self.performance.now(),s.loading.first);var n,e;if(m.responseType==="arraybuffer"?(n=g.response,e=n.byteLength):(n=g.responseText,e=n.length),s.loaded=s.total=e,!this.callbacks)return;var t=this.callbacks.onProgress;if(t&&t(s,m,n,g),!this.callbacks)return;var r={url:g.responseURL,data:n};this.callbacks.onSuccess(r,s,m,g)}else s.retry>=i.maxRetry||o>=400&&o<499?(j.logger.error(o+" while loading "+m.url),this.callbacks.onError({code:o,text:g.statusText},m,g)):(j.logger.warn(o+" while loading "+m.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,i.maxRetryDelay),s.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout)},w.loadtimeout=function(){j.logger.warn("timeout while loading "+this.context.url);var m=this.callbacks;m&&(this.abortInternal(),m.onTimeout(this.stats,this.context,this.loader))},w.loadprogress=function(m){var g=this.stats;g.loaded=m.loaded,m.lengthComputable&&(g.total=m.total)},w.getCacheAge=function(){var m=null;if(this.loader&&A.test(this.loader.getAllResponseHeaders())){var g=this.loader.getResponseHeader("age");m=g?parseFloat(g):null}return m},M}();H.default=B}}).default})},vHTk:function(et,We,J){et.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|