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
813 KiB
394 lines
813 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[278,5,7],{"+ua5":function(ut,tt,ne){},"55Ip":function(ut,tt,ne){"use strict";ne.d(tt,"a",function(){return t});var ce=ne("Ty5D"),W=ne("dI71"),w=ne("q1tI"),j=ne.n(w),I=ne("YS25"),A=ne("17x9"),F=ne.n(A),M=ne("wx14"),O=ne("zLVn"),S=ne("9R94"),m=function(i){Object(W.a)(d,i);function d(){for(var y,v=arguments.length,x=new Array(v),k=0;k<v;k++)x[k]=arguments[k];return y=i.call.apply(i,[this].concat(x))||this,y.history=Object(I.a)(y.props),y}var h=d.prototype;return h.render=function(){return j.a.createElement(ce.c,{history:this.history,children:this.props.children})},d}(j.a.Component),p=function(i){Object(W.a)(d,i);function d(){for(var y,v=arguments.length,x=new Array(v),k=0;k<v;k++)x[k]=arguments[k];return y=i.call.apply(i,[this].concat(x))||this,y.history=Object(I.b)(y.props),y}var h=d.prototype;return h.render=function(){return j.a.createElement(ce.c,{history:this.history,children:this.props.children})},d}(j.a.Component),o=function(d,h){return typeof d=="function"?d(h):d},a=function(d,h){return typeof d=="string"?Object(I.c)(d,null,null,h):d},n=function(d){return d},l=j.a.forwardRef;typeof l=="undefined"&&(l=n);function s(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}var e=l(function(i,d){var h=i.innerRef,y=i.navigate,v=i.onClick,x=Object(O.a)(i,["innerRef","navigate","onClick"]),k=x.target,R=Object(M.a)({},x,{onClick:function(N){try{v&&v(N)}catch(G){throw N.preventDefault(),G}!N.defaultPrevented&&N.button===0&&(!k||k==="_self")&&!s(N)&&(N.preventDefault(),y())}});return n!==l?R.ref=d||h:R.ref=h,j.a.createElement("a",R)}),t=l(function(i,d){var h=i.component,y=h===void 0?e:h,v=i.replace,x=i.to,k=i.innerRef,R=Object(O.a)(i,["component","replace","to","innerRef"]);return j.a.createElement(ce.e.Consumer,null,function(U){U||Object(S.a)(!1);var N=U.history,G=a(o(x,U.location),U.location),L=G?N.createHref(G):"",H=Object(M.a)({},R,{href:L,navigate:function(){var $=o(x,U.location),q=v?N.replace:N.push;q($)}});return n!==l?H.ref=d||k:H.innerRef=k,j.a.createElement(y,H)})});if(!1)var r,T;var g=function(d){return d},_=j.a.forwardRef;typeof _=="undefined"&&(_=g);function E(){for(var i=arguments.length,d=new Array(i),h=0;h<i;h++)d[h]=arguments[h];return d.filter(function(y){return y}).join(" ")}var b=_(function(i,d){var h=i["aria-current"],y=h===void 0?"page":h,v=i.activeClassName,x=v===void 0?"active":v,k=i.activeStyle,R=i.className,U=i.exact,N=i.isActive,G=i.location,L=i.sensitive,H=i.strict,V=i.style,$=i.to,q=i.innerRef,he=Object(O.a)(i,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return j.a.createElement(ce.e.Consumer,null,function(ae){ae||Object(S.a)(!1);var oe=G||ae.location,ue=a(o($,oe),oe),de=ue.pathname,ie=de&&de.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),X=ie?Object(ce.f)(oe.pathname,{path:ie,exact:U,sensitive:L,strict:H}):null,Se=!!(N?N(X,oe):X),Ie=Se?E(R,x):R,Ae=Se?Object(M.a)({},V,{},k):V,je=Object(M.a)({"aria-current":Se&&y||null,className:Ie,style:Ae,to:ue},he);return g!==_?je.ref=d||q:je.innerRef=q,j.a.createElement(t,je)})});if(!1)var c},"5VLF":function(ut,tt,ne){"use strict";var ce,W;function w(j,I,A){var F=function(M,O){return j.js_beautify(M,O)};return F.js=j.js_beautify,F.css=I.css_beautify,F.html=A.html_beautify,F.js_beautify=j.js_beautify,F.css_beautify=I.css_beautify,F.html_beautify=A.html_beautify,F}!(ce=[ne("6UM0"),ne("TXwP"),ne("psGv")],W=function(j,I,A){return w(j,I,A)}.apply(tt,ce),W!==void 0&&(ut.exports=W))},"6UM0":function(ut,tt,ne){var ce,W;(function(){var w;(function(){"use strict";var I=[function(O,S,m){var p=m(1).Beautifier,o=m(5).Options;function a(n,l){var s=new p(n,l);return s.beautify()}O.exports=a,O.exports.defaultOptions=function(){return new o}},function(O,S,m){var p=m(2).Output,o=m(3).Token,a=m(4),n=m(5).Options,l=m(7).Tokenizer,s=m(7).line_starters,e=m(7).positionable_operators,t=m(7).TOKEN;function r(L,H){return H.indexOf(L)!==-1}function T(L){return L.replace(/^\s+/g,"")}function g(L){for(var H={},V=0;V<L.length;V++)H[L[V].replace(/-/g,"_")]=L[V];return H}function _(L,H){return L&&L.type===t.RESERVED&&L.text===H}function E(L,H){return L&&L.type===t.RESERVED&&r(L.text,H)}var b=["case","return","do","if","throw","else","await","break","continue","async"],c=["before-newline","after-newline","preserve-newline"],i=g(c),d=[i.before_newline,i.preserve_newline],h={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function y(L,H){if(H.multiline_frame||H.mode===h.ForInitializer||H.mode===h.Conditional)return;L.remove_indent(H.start_line_index)}function v(L){L=L.replace(a.allLineBreaks,`
|
|
`);for(var H=[],V=L.indexOf(`
|
|
`);V!==-1;)H.push(L.substring(0,V)),L=L.substring(V+1),V=L.indexOf(`
|
|
`);return L.length&&H.push(L),H}function x(L){return L===h.ArrayLiteral}function k(L){return r(L,[h.Expression,h.ForInitializer,h.Conditional])}function R(L,H){for(var V=0;V<L.length;V++){var $=L[V].trim();if($.charAt(0)!==H)return!1}return!0}function U(L,H){for(var V=0,$=L.length,q;V<$;V++)if(q=L[V],q&&q.indexOf(H)!==0)return!1;return!0}function N(L,H){H=H||{},this._source_text=L||"",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 n(H)}N.prototype.create_flags=function(L,H){var V=0;L&&(V=L.indentation_level,!this._output.just_added_newline()&&L.line_indent_level>V&&(V=L.line_indent_level));var $={mode:H,parent:L,last_token:L?L.last_token:new o(t.START_BLOCK,""),last_word:L?L.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:L?L.line_indent_level:V,start_line_index:this._output.get_line_number(),ternary_depth:0};return $},N.prototype._reset=function(L){var H=L.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new p(this._options,H),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(h.BlockStatement);var V=new l(L,this._options);return this._tokens=V.tokenize(),L},N.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var L,H=this._reset(this._source_text),V=this._options.eol;this._options.eol==="auto"&&(V=`
|
|
`,H&&a.lineBreak.test(H||"")&&(V=H.match(a.lineBreak)[0]));for(var $=this._tokens.next();$;)this.handle_token($),this._last_last_text=this._flags.last_token.text,this._flags.last_token=$,$=this._tokens.next();return L=this._output.get_code(V),L},N.prototype.handle_token=function(L,H){L.type===t.START_EXPR?this.handle_start_expr(L):L.type===t.END_EXPR?this.handle_end_expr(L):L.type===t.START_BLOCK?this.handle_start_block(L):L.type===t.END_BLOCK?this.handle_end_block(L):L.type===t.WORD?this.handle_word(L):L.type===t.RESERVED?this.handle_word(L):L.type===t.SEMICOLON?this.handle_semicolon(L):L.type===t.STRING?this.handle_string(L):L.type===t.EQUALS?this.handle_equals(L):L.type===t.OPERATOR?this.handle_operator(L):L.type===t.COMMA?this.handle_comma(L):L.type===t.BLOCK_COMMENT?this.handle_block_comment(L,H):L.type===t.COMMENT?this.handle_comment(L,H):L.type===t.DOT?this.handle_dot(L):L.type===t.EOF?this.handle_eof(L):L.type===t.UNKNOWN?this.handle_unknown(L,H):this.handle_unknown(L,H)},N.prototype.handle_whitespace_and_comments=function(L,H){var V=L.newlines,$=this._options.keep_array_indentation&&x(this._flags.mode);if(L.comments_before)for(var q=L.comments_before.next();q;)this.handle_whitespace_and_comments(q,H),this.handle_token(q,H),q=L.comments_before.next();if($)for(var he=0;he<V;he+=1)this.print_newline(he>0,H);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,H);for(var ae=1;ae<V;ae+=1)this.print_newline(!0,H)}};var G=["async","break","continue","return","throw","yield"];N.prototype.allow_wrap_or_preserved_newline=function(L,H){if(H=H===void 0?!1:H,this._output.just_added_newline())return;var V=this._options.preserve_newlines&&L.newlines||H,$=r(this._flags.last_token.text,e)||r(L.text,e);if($){var q=r(this._flags.last_token.text,e)&&r(this._options.operator_position,d)||r(L.text,e);V=V&&q}if(V)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(E(this._flags.last_token,G))return;this._output.set_wrap_point()}},N.prototype.print_newline=function(L,H){if(!H&&(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===h.Statement&&!(this._flags.if_block&&_(V,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(L)&&(this._flags.multiline_frame=!0)},N.prototype.print_token_line_indentation=function(L){this._output.just_added_newline()&&(this._options.keep_array_indentation&&L.newlines&&(L.text==="["||x(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(L.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))},N.prototype.print_token=function(L){if(this._output.raw){this._output.add_raw_token(L);return}if(this._options.comma_first&&L.previous&&L.previous.type===t.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var H=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(H),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(L),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(L),this._output.non_breaking_space=!0,this._output.add_token(L.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},N.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},N.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))},N.prototype.set_mode=function(L){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,L),this._flags=this.create_flags(this._previous_flags,L),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},N.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===h.Statement&&y(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},N.prototype.start_of_object_property=function(){return this._flags.parent.mode===h.ObjectLiteral&&this._flags.mode===h.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||E(this._flags.last_token,["get","set"]))},N.prototype.start_of_statement=function(L){var H=!1;return H=H||E(this._flags.last_token,["var","let","const"])&&L.type===t.WORD,H=H||_(this._flags.last_token,"do"),H=H||!(this._flags.parent.mode===h.ObjectLiteral&&this._flags.mode===h.Statement)&&E(this._flags.last_token,G)&&!L.newlines,H=H||_(this._flags.last_token,"else")&&!(_(L,"if")&&!L.comments_before),H=H||this._flags.last_token.type===t.END_EXPR&&(this._previous_flags.mode===h.ForInitializer||this._previous_flags.mode===h.Conditional),H=H||this._flags.last_token.type===t.WORD&&this._flags.mode===h.BlockStatement&&!this._flags.in_case&&!(L.text==="--"||L.text==="++")&&this._last_last_text!=="function"&&L.type!==t.WORD&&L.type!==t.RESERVED,H=H||this._flags.mode===h.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||E(this._flags.last_token,["get","set"])),H?(this.set_mode(h.Statement),this.indent(),this.handle_whitespace_and_comments(L,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(L,E(L,["do","for","if","while"])),!0):!1},N.prototype.handle_start_expr=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L);var H=h.Expression;if(L.text==="["){if(this._flags.last_token.type===t.WORD||this._flags.last_token.text===")"){E(this._flags.last_token,s)&&(this._output.space_before_token=!0),this.print_token(L),this.set_mode(H),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}H=h.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,H=h.ForInitializer):r(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,H=h.Conditional):r(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&L.whitespace_before===""?this._output.space_before_token=!1:(r(this._flags.last_token.text,s)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===t.EQUALS||this._flags.last_token.type===t.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(L);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 $=this._tokens.peek(-4);E(V,["async","function"])||V.text==="*"&&E($,["async","function"])?this._output.space_before_token=!0:this._flags.mode===h.ObjectLiteral?(V.text==="{"||V.text===","||V.text==="*"&&($.text==="{"||$.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(L);(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===h.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(L,L.newlines),this.print_token(L),this.set_mode(H),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},N.prototype.handle_end_expr=function(L){for(;this._flags.mode===h.Statement;)this.restore_mode();this.handle_whitespace_and_comments(L),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(L,L.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(L),this.restore_mode(),y(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===h.Conditional&&(this._previous_flags.mode=h.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},N.prototype.handle_start_block=function(L){this.handle_whitespace_and_comments(L);var H=this._tokens.peek(),V=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===t.END_EXPR?(this.set_mode(h.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(h.BlockStatement):V&&(r(V.text,[":",","])&&r(H.type,[t.STRING,t.WORD,t.RESERVED])||r(H.text,["get","set","..."])&&r(V.type,[t.WORD,t.RESERVED]))?r(this._last_last_text,["class","interface"])&&!r(V.text,[":",","])?this.set_mode(h.BlockStatement):this.set_mode(h.ObjectLiteral):this._flags.last_token.type===t.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(h.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(h.ObjectLiteral):this.set_mode(h.BlockStatement),this._flags.last_token&&(E(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var $=!H.comments_before&&H.text==="}",q=$&&this._flags.last_word==="function"&&this._flags.last_token.type===t.END_EXPR;if(this._options.brace_preserve_inline){var he=0,ae=null;this._flags.inline_frame=!0;do if(he+=1,ae=this._tokens.peek(he-1),ae.newlines){this._flags.inline_frame=!1;break}while(ae.type!==t.EOF&&!(ae.type===t.END_BLOCK&&ae.opened===L))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&L.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==t.OPERATOR&&(q||this._flags.last_token.type===t.EQUALS||E(this._flags.last_token,b)&&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(L),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(L),this.indent(),!$&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},N.prototype.handle_end_block=function(L){for(this.handle_whitespace_and_comments(L);this._flags.mode===h.Statement;)this.restore_mode();var H=this._flags.last_token.type===t.START_BLOCK;this._flags.inline_frame&&!H?this._output.space_before_token=!0:this._options.brace_style==="expand"?H||this.print_newline():H||(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(L)},N.prototype.handle_word=function(L){if(L.type===t.RESERVED){if(r(L.text,["set","get"])&&this._flags.mode!==h.ObjectLiteral)L.type=t.WORD;else if(L.text==="import"&&r(this._tokens.peek().text,["(","."]))L.type=t.WORD;else if(r(L.text,["as","from"])&&!this._flags.import_block)L.type=t.WORD;else if(this._flags.mode===h.ObjectLiteral){var H=this._tokens.peek();H.text===":"&&(L.type=t.WORD)}}if(this.start_of_statement(L)?E(this._flags.last_token,["var","let","const"])&&L.type===t.WORD&&(this._flags.declaration_statement=!0):L.newlines&&!k(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(L),this.print_newline()):this.handle_whitespace_and_comments(L),this._flags.do_block&&!this._flags.do_while)if(_(L,"while")){this._output.space_before_token=!0,this.print_token(L),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&&_(L,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===h.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&E(L,["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(L),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(L)),_(L,"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()&&!L.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,G)?this._output.space_before_token=!0:_(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&&(k(this._flags.mode)||x(this._flags.mode))||this.print_newline(),this.print_token(L),this._flags.last_word=L.text;return}var V="NONE";if(this._flags.last_token.type===t.END_BLOCK?this._previous_flags.inline_frame?V="SPACE":E(L,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&L.newlines?V="NEWLINE":(V="SPACE",this._output.space_before_token=!0):V="NEWLINE":this._flags.last_token.type===t.SEMICOLON&&this._flags.mode===h.BlockStatement?V="NEWLINE":this._flags.last_token.type===t.SEMICOLON&&k(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===h.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(L,s)&&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(L,["else","catch","finally"]))if((!(this._flags.last_token.type===t.END_BLOCK&&this._previous_flags.mode===h.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&L.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var $=this._output.current_line;$.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else V==="NEWLINE"?E(this._flags.last_token,b)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&E(L,["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(L,["var","let","const"]))&&this._flags.last_token.text!==":"&&(_(L,"if")&&_(L.previous,"else")?this._output.space_before_token=!0:this.print_newline()):E(L,s)&&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);L.previous&&(L.previous.type===t.WORD||L.previous.type===t.RESERVED)&&(this._output.space_before_token=!0),this.print_token(L),this._flags.last_word=L.text,L.type===t.RESERVED&&(L.text==="do"?this._flags.do_block=!0:L.text==="if"?this._flags.if_block=!0:L.text==="import"?this._flags.import_block=!0:this._flags.import_block&&_(L,"from")&&(this._flags.import_block=!1))},N.prototype.handle_semicolon=function(L){this.start_of_statement(L)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(L);for(var H=this._tokens.peek();this._flags.mode===h.Statement&&!(this._flags.if_block&&_(H,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(L)},N.prototype.handle_string=function(L){L.text.startsWith("`")&&L.newlines===0&&L.whitespace_before===""&&(L.previous.text===")"||this._flags.last_token.type===t.WORD)||(this.start_of_statement(L)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(L),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(L):L.text.startsWith("`")&&this._flags.last_token.type===t.END_EXPR&&(L.previous.text==="]"||L.previous.text===")")&&L.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(L)},N.prototype.handle_equals=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(L),this._output.space_before_token=!0},N.prototype.handle_comma=function(L){this.handle_whitespace_and_comments(L,!0),this.print_token(L),this._output.space_before_token=!0,this._flags.declaration_statement?(k(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(L)):this._flags.mode===h.ObjectLiteral||this._flags.mode===h.Statement&&this._flags.parent.mode===h.ObjectLiteral?(this._flags.mode===h.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(L)},N.prototype.handle_operator=function(L){var H=L.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(L.text,["-","+"])&&(r(this._flags.last_token.type,[t.START_BLOCK,t.START_EXPR,t.EQUALS,t.OPERATOR])||r(this._flags.last_token.text,s)||this._flags.last_token.text===",");if(!this.start_of_statement(L)){var $=!H;this.handle_whitespace_and_comments(L,$)}if(L.text==="*"&&this._flags.last_token.type===t.DOT){this.print_token(L);return}if(L.text==="::"){this.print_token(L);return}if(this._flags.last_token.type===t.OPERATOR&&r(this._options.operator_position,d)&&this.allow_wrap_or_preserved_newline(L),L.text===":"&&this._flags.in_case){this.print_token(L),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 q=!0,he=!0,ae=!1;if(L.text===":"?this._flags.ternary_depth===0?q=!1:(this._flags.ternary_depth-=1,ae=!0):L.text==="?"&&(this._flags.ternary_depth+=1),!V&&!H&&this._options.preserve_newlines&&r(L.text,e)){var oe=L.text===":",ue=oe&&ae,de=oe&&!ae;switch(this._options.operator_position){case i.before_newline:this._output.space_before_token=!de,this.print_token(L),(!oe||ue)&&this.allow_wrap_or_preserved_newline(L),this._output.space_before_token=!0;return;case i.after_newline:this._output.space_before_token=!0,!oe||ue?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(L):this._output.space_before_token=!1,this.print_token(L),this._output.space_before_token=!0;return;case i.preserve_newline:de||this.allow_wrap_or_preserved_newline(L),q=!(this._output.just_added_newline()||de),this._output.space_before_token=q,this.print_token(L),this._output.space_before_token=!0;return}}if(H){this.allow_wrap_or_preserved_newline(L),q=!1;var ie=this._tokens.peek();he=ie&&r(ie.type,[t.WORD,t.RESERVED])}else if(L.text==="...")this.allow_wrap_or_preserved_newline(L),q=this._flags.last_token.type===t.START_BLOCK,he=!1;else if(r(L.text,["--","++","!","~"])||V){if((this._flags.last_token.type===t.COMMA||this._flags.last_token.type===t.START_EXPR)&&this.allow_wrap_or_preserved_newline(L),q=!1,he=!1,L.newlines&&(L.text==="--"||L.text==="++"||L.text==="~")){var X=E(this._flags.last_token,b)&&L.newlines;X&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(X,!0)}this._flags.last_token.text===";"&&k(this._flags.mode)&&(q=!0),this._flags.last_token.type===t.RESERVED?q=!0:this._flags.last_token.type===t.END_EXPR?q=!(this._flags.last_token.text==="]"&&(L.text==="--"||L.text==="++")):this._flags.last_token.type===t.OPERATOR&&(q=r(L.text,["--","-","++","+"])&&r(this._flags.last_token.text,["--","-","++","+"]),r(L.text,["+","-"])&&r(this._flags.last_token.text,["--","++"])&&(he=!0)),(this._flags.mode===h.BlockStatement&&!this._flags.inline_frame||this._flags.mode===h.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||q,this.print_token(L),this._output.space_before_token=he},N.prototype.handle_block_comment=function(L,H){if(this._output.raw){this._output.add_raw_token(L),L.directives&&L.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(L.directives){this.print_newline(!1,H),this.print_token(L),L.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!a.newline.test(L.text)&&!L.newlines){this._output.space_before_token=!0,this.print_token(L),this._output.space_before_token=!0;return}else this.print_block_commment(L,H)},N.prototype.print_block_commment=function(L,H){var V=v(L.text),$,q=!1,he=!1,ae=L.whitespace_before,oe=ae.length;if(this.print_newline(!1,H),this.print_token_line_indentation(L),this._output.add_token(V[0]),this.print_newline(!1,H),V.length>1){for(V=V.slice(1),q=R(V,"*"),he=U(V,ae),q&&(this._flags.alignment=1),$=0;$<V.length;$++)q?(this.print_token_line_indentation(L),this._output.add_token(T(V[$]))):he&&V[$]?(this.print_token_line_indentation(L),this._output.add_token(V[$].substring(oe))):(this._output.current_line.set_indent(-1),this._output.add_token(V[$])),this.print_newline(!1,H);this._flags.alignment=0}},N.prototype.handle_comment=function(L,H){L.newlines?this.print_newline(!1,H):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(L),this.print_newline(!1,H)},N.prototype.handle_dot=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),E(this._flags.last_token,b)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(L,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(L)},N.prototype.handle_unknown=function(L,H){this.print_token(L),L.text[L.text.length-1]===`
|
|
`&&this.print_newline(!1,H)},N.prototype.handle_eof=function(L){for(;this._flags.mode===h.Statement;)this.restore_mode();this.handle_whitespace_and_comments(L)},O.exports.Beautifier=N},function(O){function S(o){this.__parent=o,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}S.prototype.clone_empty=function(){var o=new S(this.__parent);return o.set_indent(this.__indent_count,this.__alignment_count),o},S.prototype.item=function(o){return o<0?this.__items[this.__items.length+o]:this.__items[o]},S.prototype.has_match=function(o){for(var a=this.__items.length-1;a>=0;a--)if(this.__items[a].match(o))return!0;return!1},S.prototype.set_indent=function(o,a){this.is_empty()&&(this.__indent_count=o||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 o=this.__parent.current_line;return o.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),o.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),o.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,o.__items[0]===" "&&(o.__items.splice(0,1),o.__character_count-=1),!0}return!1},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(o){this.__items.push(o);var a=o.lastIndexOf(`
|
|
`);a!==-1?this.__character_count=o.length-a:this.__character_count+=o.length},S.prototype.pop=function(){var o=null;return this.is_empty()||(o=this.__items.pop(),this.__character_count-=o.length),o},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 o="";return this.is_empty()?this.__parent.indent_empty_lines&&(o=this.__parent.get_indent_string(this.__indent_count)):(o=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),o+=this.__items.join("")),o};function m(o,a){this.__cache=[""],this.__indent_size=o.indent_size,this.__indent_string=o.indent_char,o.indent_with_tabs||(this.__indent_string=new Array(o.indent_size+1).join(o.indent_char)),a=a||"",o.indent_level>0&&(a=new Array(o.indent_level+1).join(this.__indent_string)),this.__base_string=a,this.__base_string_length=a.length}m.prototype.get_indent_size=function(o,a){var n=this.__base_string_length;return a=a||0,o<0&&(n=0),n+=o*this.__indent_size,n+=a,n},m.prototype.get_indent_string=function(o,a){var n=this.__base_string;return a=a||0,o<0&&(o=0,n=""),a+=o*this.__indent_size,this.__ensure_cache(a),n+=this.__cache[a],n},m.prototype.__ensure_cache=function(o){for(;o>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var o=this.__cache.length,a=0,n="";this.__indent_size&&o>=this.__indent_size&&(a=Math.floor(o/this.__indent_size),o-=a*this.__indent_size,n=new Array(a+1).join(this.__indent_string)),o&&(n+=new Array(o+1).join(" ")),this.__cache.push(n)};function p(o,a){this.__indent_cache=new m(o,a),this.raw=!1,this._end_with_newline=o.end_with_newline,this.indent_size=o.indent_size,this.wrap_line_length=o.wrap_line_length,this.indent_empty_lines=o.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new S(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(o,a){return this.__indent_cache.get_indent_string(o,a)},p.prototype.get_indent_size=function(o,a){return this.__indent_cache.get_indent_size(o,a)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(o){return this.is_empty()||!o&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(o){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 n=this.__lines.join(`
|
|
`);return o!==`
|
|
`&&(n=n.replace(/[\n]/g,o)),n},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(o,a){return o=o||0,a=a||0,this.next_line.set_indent(o,a),this.__lines.length>1?(this.current_line.set_indent(o,a),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(o){for(var a=0;a<o.newlines;a++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(o.whitespace_before),this.current_line.push(o.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(o){this.__add_space_before_token(),this.current_line.push(o),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(o){for(var a=this.__lines.length;o<a;)this.__lines[o]._remove_indent(),o++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(o){for(o=o===void 0?!1:o,this.current_line.trim();o&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(o,a){for(var n=this.__lines.length-2;n>=0;){var l=this.__lines[n];if(l.is_empty())break;if(l.item(0).indexOf(o)!==0&&l.item(-1)!==a){this.__lines.splice(n+1,0,new S(this)),this.previous_line=this.__lines[this.__lines.length-2];break}n--}},O.exports.Output=p},function(O){function S(m,p,o,a){this.type=m,this.text=p,this.comments_before=null,this.newlines=o||0,this.whitespace_before=a||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}O.exports.Token=S},function(O,S){var m="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",o="\\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",n="(?:\\\\u[0-9a-fA-F]{4}|["+m+o+"])",l="(?:\\\\u[0-9a-fA-F]{4}|["+p+o+a+"])*";S.identifier=new RegExp(n+l,"g"),S.identifierStart=new RegExp(n),S.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+o+a+"])+");var s=/[\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(O,S,m){var p=m(6).Options,o=["before-newline","after-newline","preserve-newline"];function a(n){p.call(this,n,"js");var l=this.raw_options.brace_style||null;l==="expand-strict"?this.raw_options.brace_style="expand":l==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var s=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var e=0;e<s.length;e++)s[e]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=s[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",o),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}a.prototype=new p,O.exports.Options=a},function(O){function S(o,a){this.raw_options=m(o,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(o,a){var n=this.raw_options[o],l=a||[];return typeof n=="object"?n!==null&&typeof n.concat=="function"&&(l=n.concat()):typeof n=="string"&&(l=n.split(/[^a-zA-Z0-9_\/\-]+/)),l},S.prototype._get_boolean=function(o,a){var n=this.raw_options[o],l=n===void 0?!!a:!!n;return l},S.prototype._get_characters=function(o,a){var n=this.raw_options[o],l=a||"";return typeof n=="string"&&(l=n.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),l},S.prototype._get_number=function(o,a){var n=this.raw_options[o];a=parseInt(a,10),isNaN(a)&&(a=0);var l=parseInt(n,10);return isNaN(l)&&(l=a),l},S.prototype._get_selection=function(o,a,n){var l=this._get_selection_list(o,a,n);if(l.length!==1)throw new Error("Invalid Option Value: The option '"+o+`' can only be one of the following values:
|
|
`+a+`
|
|
You passed in: '`+this.raw_options[o]+"'");return l[0]},S.prototype._get_selection_list=function(o,a,n){if(!a||a.length===0)throw new Error("Selection list cannot be empty.");if(n=n||[a[0]],!this._is_valid_selection(n,a))throw new Error("Invalid Default Value!");var l=this._get_array(o,n);if(!this._is_valid_selection(l,a))throw new Error("Invalid Option Value: The option '"+o+`' can contain only the following values:
|
|
`+a+`
|
|
You passed in: '`+this.raw_options[o]+"'");return l},S.prototype._is_valid_selection=function(o,a){return o.length&&a.length&&!o.some(function(n){return a.indexOf(n)===-1})};function m(o,a){var n={};o=p(o);var l;for(l in o)l!==a&&(n[l]=o[l]);if(a&&o[a])for(l in o[a])n[l]=o[a][l];return n}function p(o){var a={},n;for(n in o){var l=n.replace(/-/g,"_");a[l]=o[n]}return a}O.exports.Options=S,O.exports.normalizeOpts=p,O.exports.mergeOpts=m},function(O,S,m){var p=m(8).InputScanner,o=m(9).Tokenizer,a=m(9).TOKEN,n=m(13).Directives,l=m(4),s=m(12).Pattern,e=m(14).TemplatablePattern;function t(R,U){return U.indexOf(R)!==-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 n(/\/\*/,/\*\//),g=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,_=/[0-9]/,E=/[^\d\.]/,b=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),c=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";c=c.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),c="\\?\\.(?!\\d) "+c,c=c.replace(/ /g,"|");var i=new RegExp(c),d="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),h=d.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),y=new RegExp("^(?:"+h.join("|")+")$"),v,x=function(R,U){o.call(this,R,U),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var N=new s(this._input),G=new e(this._input).read_options(this._options);this.__patterns={template:G,identifier:G.starting_with(l.identifier).matching(l.identifierMatch),number:N.matching(g),punct:N.matching(i),comment:N.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:N.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:N.matching(/<!--/),html_comment_end:N.matching(/-->/),include:N.starting_with(/#include/).until_after(l.lineBreak),shebang:N.starting_with(/#!/).until_after(l.lineBreak),xml:N.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:G.until(/['\\\n\r\u2028\u2029]/),double_quote:G.until(/["\\\n\r\u2028\u2029]/),template_text:G.until(/[`\\$]/),template_expression:G.until(/[`}\\]/)}};x.prototype=new o,x.prototype._is_comment=function(R){return R.type===r.COMMENT||R.type===r.BLOCK_COMMENT||R.type===r.UNKNOWN},x.prototype._is_opening=function(R){return R.type===r.START_BLOCK||R.type===r.START_EXPR},x.prototype._is_closing=function(R,U){return(R.type===r.END_BLOCK||R.type===r.END_EXPR)&&U&&(R.text==="]"&&U.text==="["||R.text===")"&&U.text==="("||R.text==="}"&&U.text==="{")},x.prototype._reset=function(){v=!1},x.prototype._get_next_token=function(R,U){var N=null;this._readWhitespace();var G=this._input.peek();return G===null?this._create_token(r.EOF,""):(N=N||this._read_non_javascript(G),N=N||this._read_string(G),N=N||this._read_word(R),N=N||this._read_singles(G),N=N||this._read_comment(G),N=N||this._read_regexp(G,R),N=N||this._read_xml(G,R),N=N||this._read_punctuation(),N=N||this._create_token(r.UNKNOWN,this._input.next()),N)},x.prototype._read_word=function(R){var U;if(U=this.__patterns.identifier.read(),U!=="")return U=U.replace(l.allLineBreaks,`
|
|
`),!(R.type===r.DOT||R.type===r.RESERVED&&(R.text==="set"||R.text==="get"))&&y.test(U)?(U==="in"||U==="of")&&(R.type===r.WORD||R.type===r.STRING)?this._create_token(r.OPERATOR,U):this._create_token(r.RESERVED,U):this._create_token(r.WORD,U);if(U=this.__patterns.number.read(),U!=="")return this._create_token(r.WORD,U)},x.prototype._read_singles=function(R){var U=null;return R==="("||R==="["?U=this._create_token(r.START_EXPR,R):R===")"||R==="]"?U=this._create_token(r.END_EXPR,R):R==="{"?U=this._create_token(r.START_BLOCK,R):R==="}"?U=this._create_token(r.END_BLOCK,R):R===";"?U=this._create_token(r.SEMICOLON,R):R==="."&&E.test(this._input.peek(1))?U=this._create_token(r.DOT,R):R===","&&(U=this._create_token(r.COMMA,R)),U&&this._input.next(),U},x.prototype._read_punctuation=function(){var R=this.__patterns.punct.read();if(R!=="")return R==="="?this._create_token(r.EQUALS,R):R==="?."?this._create_token(r.DOT,R):this._create_token(r.OPERATOR,R)},x.prototype._read_non_javascript=function(R){var U="";if(R==="#"){if(this._is_first_token()&&(U=this.__patterns.shebang.read(),U))return this._create_token(r.UNKNOWN,U.trim()+`
|
|
`);if(U=this.__patterns.include.read(),U)return this._create_token(r.UNKNOWN,U.trim()+`
|
|
`);R=this._input.next();var N="#";if(this._input.hasNext()&&this._input.testChar(_)){do R=this._input.next(),N+=R;while(this._input.hasNext()&&R!=="#"&&R!=="=");return R==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(N+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(N+="{}",this._input.next(),this._input.next())),this._create_token(r.WORD,N)}this._input.back()}else if(R==="<"&&this._is_first_token()){if(U=this.__patterns.html_comment_start.read(),U){for(;this._input.hasNext()&&!this._input.testChar(l.newline);)U+=this._input.next();return v=!0,this._create_token(r.COMMENT,U)}}else if(v&&R==="-"&&(U=this.__patterns.html_comment_end.read(),U))return v=!1,this._create_token(r.COMMENT,U);return null},x.prototype._read_comment=function(R){var U=null;if(R==="/"){var N="";if(this._input.peek(1)==="*"){N=this.__patterns.block_comment.read();var G=T.get_directives(N);G&&G.ignore==="start"&&(N+=T.readIgnored(this._input)),N=N.replace(l.allLineBreaks,`
|
|
`),U=this._create_token(r.BLOCK_COMMENT,N),U.directives=G}else this._input.peek(1)==="/"&&(N=this.__patterns.comment.read(),U=this._create_token(r.COMMENT,N))}return U},x.prototype._read_string=function(R){if(R==="`"||R==="'"||R==='"'){var U=this._input.next();return this.has_char_escapes=!1,R==="`"?U+=this._read_string_recursive("`",!0,"${"):U+=this._read_string_recursive(R),this.has_char_escapes&&this._options.unescape_strings&&(U=k(U)),this._input.peek()===R&&(U+=this._input.next()),U=U.replace(l.allLineBreaks,`
|
|
`),this._create_token(r.STRING,U)}return null},x.prototype._allow_regexp_or_xml=function(R){return R.type===r.RESERVED&&t(R.text,["return","case","throw","else","do","typeof","yield"])||R.type===r.END_EXPR&&R.text===")"&&R.opened.previous.type===r.RESERVED&&t(R.opened.previous.text,["if","while","for"])||t(R.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(R,U){if(R==="/"&&this._allow_regexp_or_xml(U)){for(var N=this._input.next(),G=!1,L=!1;this._input.hasNext()&&(G||L||this._input.peek()!==R)&&!this._input.testChar(l.newline);)N+=this._input.peek(),G?G=!1:(G=this._input.peek()==="\\",this._input.peek()==="["?L=!0:this._input.peek()==="]"&&(L=!1)),this._input.next();return this._input.peek()===R&&(N+=this._input.next(),N+=this._input.read(l.identifier)),this._create_token(r.STRING,N)}return null},x.prototype._read_xml=function(R,U){if(this._options.e4x&&R==="<"&&this._allow_regexp_or_xml(U)){var N="",G=this.__patterns.xml.read_match();if(G){for(var L=G[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),H=L.indexOf("{")===0,V=0;G;){var $=!!G[1],q=G[2],he=!!G[G.length-1]||q.slice(0,8)==="![CDATA[";if(!he&&(q===L||H&&q.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&($?--V:++V),N+=G[0],V<=0)break;G=this.__patterns.xml.read_match()}return G||(N+=this._input.match(/[\s\S]*/g)[0]),N=N.replace(l.allLineBreaks,`
|
|
`),this._create_token(r.STRING,N)}}return null};function k(R){for(var U="",N=0,G=new p(R),L=null;G.hasNext();)if(L=G.match(/([\s]|[^\\]|\\\\)+/g),L&&(U+=L[0]),G.peek()==="\\"){if(G.next(),G.peek()==="x")L=G.match(/x([0-9A-Fa-f]{2})/g);else if(G.peek()==="u")L=G.match(/u([0-9A-Fa-f]{4})/g);else{U+="\\",G.hasNext()&&(U+=G.next());continue}if(!L)return R;if(N=parseInt(L[1],16),N>126&&N<=255&&L[0].indexOf("x")===0)return R;if(N>=0&&N<32){U+="\\"+L[0];continue}else N===34||N===39||N===92?U+="\\"+String.fromCharCode(N):U+=String.fromCharCode(N)}return U}x.prototype._read_string_recursive=function(R,U,N){var G,L;R==="'"?L=this.__patterns.single_quote:R==='"'?L=this.__patterns.double_quote:R==="`"?L=this.__patterns.template_text:R==="}"&&(L=this.__patterns.template_expression);for(var H=L.read(),V="";this._input.hasNext();){if(V=this._input.next(),V===R||!U&&l.newline.test(V)){this._input.back();break}else V==="\\"&&this._input.hasNext()?(G=this._input.peek(),G==="x"||G==="u"?this.has_char_escapes=!0:G==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),V+=this._input.next()):N&&(N==="${"&&V==="$"&&this._input.peek()==="{"&&(V+=this._input.next()),N===V&&(R==="`"?V+=this._read_string_recursive("}",U,"`"):V+=this._read_string_recursive("`",U,"${"),this._input.hasNext()&&(V+=this._input.next())));V+=L.read(),H+=V}return H},O.exports.Tokenizer=x,O.exports.TOKEN=r,O.exports.positionable_operators=b.slice(),O.exports.line_starters=d.slice()},function(O){var S=RegExp.prototype.hasOwnProperty("sticky");function m(p){this.__input=p||"",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 p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},m.prototype.peek=function(p){var o=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(o=this.__input.charAt(p)),o},m.prototype.__match=function(p,o){p.lastIndex=o;var a=p.exec(this.__input);return a&&!(S&&p.sticky)&&(a.index!==o&&(a=null)),a},m.prototype.test=function(p,o){return o=o||0,o+=this.__position,o>=0&&o<this.__input_length?!!this.__match(p,o):!1},m.prototype.testChar=function(p,o){var a=this.peek(o);return p.lastIndex=0,a!==null&&p.test(a)},m.prototype.match=function(p){var o=this.__match(p,this.__position);return o?this.__position+=o[0].length:o=null,o},m.prototype.read=function(p,o,a){var n="",l;return p&&(l=this.match(p),l&&(n+=l[0])),o&&(l||!p)&&(n+=this.readUntil(o,a)),n},m.prototype.readUntil=function(p,o){var a="",n=this.__position;p.lastIndex=this.__position;var l=p.exec(this.__input);return l?(n=l.index,o&&(n+=l[0].length)):n=this.__input_length,a=this.__input.substring(this.__position,n),this.__position=n,a},m.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},m.prototype.get_regexp=function(p,o){var a=null,n="g";return o&&S&&(n="y"),typeof p=="string"&&p!==""?a=new RegExp(p,n):p&&(a=new RegExp(p.source,n)),a},m.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(p){var o=this.__position,a=this.readUntilAfter(p);return this.__position=o,a},m.prototype.lookBack=function(p){var o=this.__position-1;return o>=p.length&&this.__input.substring(o-p.length,o).toLowerCase()===p},O.exports.InputScanner=m},function(O,S,m){var p=m(8).InputScanner,o=m(3).Token,a=m(10).TokenStream,n=m(11).WhitespacePattern,l={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},s=function(e,t){this._input=new p(e),this._options=t||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new n(this._input)};s.prototype.tokenize=function(){this._input.restart(),this.__tokens=new a,this._reset();for(var e,t=new o(l.START,""),r=null,T=[],g=new a;t.type!==l.EOF;){for(e=this._get_next_token(t,r);this._is_comment(e);)g.add(e),e=this._get_next_token(t,r);g.isEmpty()||(e.comments_before=g,g=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},s.prototype._is_first_token=function(){return this.__tokens.isEmpty()},s.prototype._reset=function(){},s.prototype._get_next_token=function(e,t){this._readWhitespace();var r=this._input.read(/.+/g);return r?this._create_token(l.RAW,r):this._create_token(l.EOF,"")},s.prototype._is_comment=function(e){return!1},s.prototype._is_opening=function(e){return!1},s.prototype._is_closing=function(e,t){return!1},s.prototype._create_token=function(e,t){var r=new o(e,t,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return r},s.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},O.exports.Tokenizer=s,O.exports.TOKEN=l},function(O){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 p=null;return m=m||0,m+=this.__position,m>=0&&m<this.__tokens_length&&(p=this.__tokens[m]),p},S.prototype.add=function(m){this.__parent_token&&(m.parent=this.__parent_token),this.__tokens.push(m),this.__tokens_length+=1},O.exports.TokenStream=S},function(O,S,m){var p=m(12).Pattern;function o(a,n){p.call(this,a,n),n?this._line_regexp=this._input.get_regexp(n._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}o.prototype=new p,o.prototype.__set_whitespace_patterns=function(a,n){a+="\\t ",n+="\\n\\r",this._match_pattern=this._input.get_regexp("["+a+n+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+n+"]")},o.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 n=this.__split(this._newline_regexp,a);this.newline_count=n.length-1,this.whitespace_before_token=n[this.newline_count]}return a},o.prototype.matching=function(a,n){var l=this._create();return l.__set_whitespace_patterns(a,n),l._update(),l},o.prototype._create=function(){return new o(this._input,this)},o.prototype.__split=function(a,n){a.lastIndex=0;for(var l=0,s=[],e=a.exec(n);e;)s.push(n.substring(l,e.index)),l=e.index+e[0].length,e=a.exec(n);return l<n.length?s.push(n.substring(l,n.length)):s.push(""),s},O.exports.WhitespacePattern=o},function(O){function S(m,p){this._input=m,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,p&&(this._starting_pattern=this._input.get_regexp(p._starting_pattern,!0),this._match_pattern=this._input.get_regexp(p._match_pattern,!0),this._until_pattern=this._input.get_regexp(p._until_pattern),this._until_after=p._until_after)}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 p=this._create();return p._until_after=!0,p._until_pattern=this._input.get_regexp(m),p._update(),p},S.prototype.until=function(m){var p=this._create();return p._until_after=!1,p._until_pattern=this._input.get_regexp(m),p._update(),p},S.prototype.starting_with=function(m){var p=this._create();return p._starting_pattern=this._input.get_regexp(m,!0),p._update(),p},S.prototype.matching=function(m){var p=this._create();return p._match_pattern=this._input.get_regexp(m,!0),p._update(),p},S.prototype._create=function(){return new S(this._input,this)},S.prototype._update=function(){},O.exports.Pattern=S},function(O){function S(m,p){m=typeof m=="string"?m:m.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+p,"g")}S.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var o=this.__directive_pattern.exec(m);o;)p[o[1]]=o[2],o=this.__directive_pattern.exec(m);return p},S.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},O.exports.Directives=S},function(O,S,m){var p=m(12).Pattern,o={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function a(n,l){p.call(this,n,l),this.__template_pattern=null,this._disabled=Object.assign({},o),this._excluded=Object.assign({},o),l&&(this.__template_pattern=this._input.get_regexp(l.__template_pattern),this._excluded=Object.assign(this._excluded,l._excluded),this._disabled=Object.assign(this._disabled,l._disabled));var s=new p(n);this.__patterns={handlebars_comment:s.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:s.starting_with(/{{{/).until_after(/}}}/),handlebars:s.starting_with(/{{/).until_after(/}}/),php:s.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:s.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:s.starting_with(/{%/).until_after(/%}/),django_value:s.starting_with(/{{/).until_after(/}}/),django_comment:s.starting_with(/{#/).until_after(/#}/),smarty:s.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:s.starting_with(/{\*/).until_after(/\*}/),smarty_literal:s.starting_with(/{literal}/).until_after(/{\/literal}/)}}a.prototype=new p,a.prototype._create=function(){return new a(this._input,this)},a.prototype._update=function(){this.__set_templated_pattern()},a.prototype.disable=function(n){var l=this._create();return l._disabled[n]=!0,l._update(),l},a.prototype.read_options=function(n){var l=this._create();for(var s in o)l._disabled[s]=n.templating.indexOf(s)===-1;return l._update(),l},a.prototype.exclude=function(n){var l=this._create();return l._excluded[n]=!0,l._update(),l},a.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 l=this._read_template();l;)this._match_pattern?l+=this._input.read(this._match_pattern):l+=this._input.readUntil(this.__template_pattern),n+=l,l=this._read_template();return this._until_after&&(n+=this._input.readUntilAfter(this._until_pattern)),n},a.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("|")+")")},a.prototype._read_template=function(){var n="",l=this._input.peek();if(l==="<"){var s=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&s==="?"&&(n=n||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&s==="%"&&(n=n||this.__patterns.erb.read())}else l==="{"&&(!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},O.exports.TemplatablePattern=a}],A={};function F(O){var S=A[O];if(S!==void 0)return S.exports;var m=A[O]={exports:{}};return I[O](m,m.exports,F),m.exports}var M=F(0);w=M})();var j=w;!(ce=[],W=function(){return{js_beautify:j}}.apply(tt,ce),W!==void 0&&(ut.exports=W))})()},"7iMQ":function(ut,tt,ne){ut.exports={flex_box_center:"flex_box_center___2gbXl",flex_space_between:"flex_space_between___1wCja",flex_box_vertical_center:"flex_box_vertical_center___1SR9W",flex_box_center_end:"flex_box_center_end___iQrwG",flex_box_column:"flex_box_column___1FzsI",bg:"bg___Fnp9V",containerTitle:"containerTitle___3SWYr",containerDesc:"containerDesc___1vOga",listItem:"listItem___3Ygyv",info:"info___q0zEQ",title:"title___1lfph",titleLeft:"titleLeft___YAW8a",titleRight:"titleRight___24IYl",acitons:"acitons___1eW6L"}},"8hTe":function(ut,tt,ne){ut.exports={button:"button___1wy9m"}},"9Bee":function(ut,tt,ne){"use strict";var ce=ne("DYRE"),W=ne("zeV3"),w=ne("+L6B"),j=ne("2/Rp"),I=ne("k1fw"),A=ne("9og8"),F=ne("tJVT"),M=ne("WmNS"),O=ne.n(M),S=ne("q1tI"),m=ne.n(S),p=ne("vg9a"),o=ne("DlQD"),a=ne.n(o),n=ne("rUJ1");function l(D,u){var f=D.match(/^(\s+)(?:```)/);if(f===null)return u;var C=f[1];return u.split(`
|
|
`).map(function(B){var P=B.match(/^\s+/);if(P===null)return B;var Z=Object(F.a)(P,1),ge=Z[0];return ge.length>=C.length?B.slice(C.length):B}).join(`
|
|
`)}var s=[],e=["<ul>"],t=new a.a.Renderer,r=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function T(){s.length=0,e=["<ul>"]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function _(D,u,f,C){if(u>=D.length||D[u].level<=f)return u;var B=D[u];C.push("<li><a href='#"+B.anchor+"'>"+B.text+"</a>"),u++;var P=[];return u=_(D,u,B.level,P),P.length>0&&(C.push("<ul>"),P.forEach(function(Z){C.push(Z)}),C.push("</ul>")),C.push("</li>"),u=_(D,u,f,C),u}function E(){return _(s,0,0,e),e.push("</ul>"),e.join("")}var b={heading:function(u){var f=r.exec(u);if(f)return{type:"heading",raw:f[0],depth:f[1].length,text:f[2]}},fences:function(u){var f=this.rules.block.fences.exec(u);if(f){var C=f[0],B=l(C,f[3]||""),P=f[2]?f[2].trim():f[2];if(["latex","katex","math"].indexOf(P)>=0){var Z=d(),ge=B;B=Z,h[Z]={type:"block",expression:ge}}return{type:"code",raw:C,lang:P,text:B}}}},c=/(?:\${2})([^\n`]+?)(?:\${2})/gi,i=0,d=function(){return"__special_katext_id_".concat(i++,"__")},h={};function y(){return h}function v(){i=0,h={}}function x(D){return D=D.replace(c,function(u,f){var C=d();return h[C]={type:"inline",expression:f},C}),D}var k=t.listitem;t.listitem=function(D){return k(x(D))};var R=t.paragraph;t.paragraph=function(D){return R(x(D))};var U=t.tablecell;t.tablecell=function(D,u){return U(x(D),u)},t.code=function(D,u,f){var C=(u||"").match(/\S*/)[0];return C?["latex","katex","math"].indexOf(C)>=0?"<p class='editormd-tex'>".concat(D,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(u,'">').concat(f?D:Object(n.escape)(D,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(f?D:Object(n.escape)(D,!0))+"</code></pre>"},t.heading=function(D,u,f){var C=this.options.headerPrefix+f.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return s.push({anchor:C,level:u,text:D}),"<h"+u+' id="'+C+'">'+D+"</h"+u+">"},a.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),a.a.use({tokenizer:b,renderer:t});var N=a.a,G=ne("SJMd"),L=ne("ulZh"),H=ne.n(L),V=ne("m3rI"),$=ne("Oy/b"),q=ne("p5ED"),he=ne("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 ae=function(D,u){return(ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,C){f.__proto__=C}||function(f,C){for(var B in C)Object.prototype.hasOwnProperty.call(C,B)&&(f[B]=C[B])})(D,u)};function oe(D,u){function f(){this.constructor=D}ae(D,u),D.prototype=u===null?Object.create(u):(f.prototype=u.prototype,new f)}function ue(D,u,f,C){return new(f||(f=Promise))(function(B,P){function Z(Ve){try{Ne(C.next(Ve))}catch(_e){P(_e)}}function ge(Ve){try{Ne(C.throw(Ve))}catch(_e){P(_e)}}function Ne(Ve){var _e;Ve.done?B(Ve.value):(_e=Ve.value,_e instanceof f?_e:new f(function(qe){qe(_e)})).then(Z,ge)}Ne((C=C.apply(D,u||[])).next())})}function de(D,u){var f,C,B,P,Z={label:0,sent:function(){if(1&B[0])throw B[1];return B[1]},trys:[],ops:[]};return P={next:ge(0),throw:ge(1),return:ge(2)},typeof Symbol=="function"&&(P[Symbol.iterator]=function(){return this}),P;function ge(Ne){return function(Ve){return function(_e){if(f)throw new TypeError("Generator is already executing.");for(;Z;)try{if(f=1,C&&(B=2&_e[0]?C.return:_e[0]?C.throw||((B=C.return)&&B.call(C),0):C.next)&&!(B=B.call(C,_e[1])).done)return B;switch(C=0,B&&(_e=[2&_e[0],B.value]),_e[0]){case 0:case 1:B=_e;break;case 4:return Z.label++,{value:_e[1],done:!1};case 5:Z.label++,C=_e[1],_e=[0];continue;case 7:_e=Z.ops.pop(),Z.trys.pop();continue;default:if(!(B=Z.trys,(B=B.length>0&&B[B.length-1])||_e[0]!==6&&_e[0]!==2)){Z=0;continue}if(_e[0]===3&&(!B||_e[1]>B[0]&&_e[1]<B[3])){Z.label=_e[1];break}if(_e[0]===6&&Z.label<B[1]){Z.label=B[1],B=_e;break}if(B&&Z.label<B[2]){Z.label=B[2],Z.ops.push(_e);break}B[2]&&Z.ops.pop(),Z.trys.pop();continue}_e=u.call(D,Z)}catch(qe){_e=[6,qe],C=0}finally{f=B=0}if(5&_e[0])throw _e[1];return{value:_e[0]?_e[1]:void 0,done:!0}}([Ne,Ve])}}}function ie(){for(var D=0,u=0,f=arguments.length;u<f;u++)D+=arguments[u].length;var C=Array(D),B=0;for(u=0;u<f;u++)for(var P=arguments[u],Z=0,ge=P.length;Z<ge;Z++,B++)C[B]=P[Z];return C}var X=function(){function D(){}return D.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},D.setAttributes=function(u,f){for(var C=0,B=f;C<B.length;C++){var P=B[C],Z=P[0],ge=P[1];u.setAttribute(Z,ge)}},D.createRect=function(u,f,C){var B=document.createElementNS("http://www.w3.org/2000/svg","rect");return B.setAttribute("width",u.toString()),B.setAttribute("height",f.toString()),C&&D.setAttributes(B,C),B},D.createLine=function(u,f,C,B,P){var Z=document.createElementNS("http://www.w3.org/2000/svg","line");return Z.setAttribute("x1",u.toString()),Z.setAttribute("y1",f.toString()),Z.setAttribute("x2",C.toString()),Z.setAttribute("y2",B.toString()),P&&D.setAttributes(Z,P),Z},D.createPolygon=function(u,f){var C=document.createElementNS("http://www.w3.org/2000/svg","polygon");return C.setAttribute("points",u),f&&D.setAttributes(C,f),C},D.createCircle=function(u,f){var C=document.createElementNS("http://www.w3.org/2000/svg","circle");return C.setAttribute("cx",(u/2).toString()),C.setAttribute("cy",(u/2).toString()),C.setAttribute("r",u.toString()),f&&D.setAttributes(C,f),C},D.createEllipse=function(u,f,C){var B=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return B.setAttribute("cx",(u/2).toString()),B.setAttribute("cy",(f/2).toString()),B.setAttribute("rx",(u/2).toString()),B.setAttribute("ry",(f/2).toString()),C&&D.setAttributes(B,C),B},D.createGroup=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return u&&D.setAttributes(f,u),f},D.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},D.createMarker=function(u,f,C,B,P,Z,ge){var Ne=document.createElementNS("http://www.w3.org/2000/svg","marker");return D.setAttributes(Ne,[["id",u],["orient",f],["markerWidth",C.toString()],["markerHeight",B.toString()],["refX",P.toString()],["refY",Z.toString()]]),Ne.appendChild(ge),Ne},D.createText=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),u&&D.setAttributes(f,u),f},D.createTSpan=function(u,f){var C=document.createElementNS("http://www.w3.org/2000/svg","tspan");return C.textContent=u,f&&D.setAttributes(C,f),C},D.createImage=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return u&&D.setAttributes(f,u),f},D.createPoint=function(u,f){var C=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return C.x=u,C.y=f,C},D.createPath=function(u,f){var C=document.createElementNS("http://www.w3.org/2000/svg","path");return C.setAttribute("d",u),f&&D.setAttributes(C,f),C},D}(),Se=function(){function D(){}return D.addKey=function(u){D.key=u},Object.defineProperty(D,"isLicensed",{get:function(){return!!D.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(D.key)},enumerable:!1,configurable:!0}),D}(),Ie=function(){function D(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return D.prototype.rasterize=function(u,f,C){var B=this;return new Promise(function(P){var Z=C!==void 0?C:document.createElement("canvas");u===null&&(B.markersOnly=!0,B.naturalSize=!1);var ge=document.createElementNS("http://www.w3.org/2000/svg","svg");ge.setAttribute("xmlns","http://www.w3.org/2000/svg"),ge.setAttribute("width",f.width.baseVal.valueAsString),ge.setAttribute("height",f.height.baseVal.valueAsString),ge.setAttribute("viewBox","0 0 "+f.viewBox.baseVal.width.toString()+" "+f.viewBox.baseVal.height.toString()),ge.innerHTML=f.innerHTML,B.naturalSize===!0?(ge.width.baseVal.value=u.naturalWidth,ge.height.baseVal.value=u.naturalHeight):B.width!==void 0&&B.height!==void 0&&(ge.width.baseVal.value=B.width,ge.height.baseVal.value=B.height),Z.width=ge.width.baseVal.value,Z.height=ge.height.baseVal.value;var Ne=ge.outerHTML,Ve=Z.getContext("2d");B.markersOnly!==!0&&Ve.drawImage(u,0,0,Z.width,Z.height);var _e=window.URL,qe=new Image(Z.width,Z.height);qe.setAttribute("crossOrigin","anonymous");var _t=new Blob([Ne],{type:"image/svg+xml"}),Et=_e.createObjectURL(_t);qe.onload=function(){Ve.drawImage(qe,0,0),_e.revokeObjectURL(Et);var Mt=Z.toDataURL(B.imageType,B.imageQuality);P(Mt)},qe.src=Et})},D}(),Ae=function(){},je=function(){function D(u){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+u+"_"}return Object.defineProperty(D.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(D.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(D.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),D.prototype.addClass=function(u){return this.styleSheet===void 0&&this.addStyleSheet(),u.name=""+this.classNamePrefix+u.localName,this.classes.push(u),this.styleSheet.sheet.insertRule("."+u.name+" {"+u.style+"}",this.styleSheet.sheet.cssRules.length),u},D.prototype.addRule=function(u){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(u),this.styleSheet.sheet.insertRule(u.selector+" {"+u.style+"}",this.styleSheet.sheet.cssRules.length)},D.prototype.addStyleSheet=function(){var u;this.styleSheet=document.createElement("style"),((u=this.styleSheetRoot)!==null&&u!==void 0?u:document.head).appendChild(this.styleSheet),this.addRule(new He("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new He("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new He("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new pe("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new pe("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},D.prototype.removeStyleSheet=function(){var u;this.styleSheet&&(((u=this.styleSheetRoot)!==null&&u!==void 0?u:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},D}(),He=function(D,u){this.selector=D,this.style=u},pe=function(D,u){this.localName=D,this.style=u},we=function(){function D(u,f,C,B,P){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=u,this.displayMode=f,this.markerItems=C,this.uiStyleSettings=B,this.styles=P,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return D.prototype.show=function(u){var f=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=u,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var C=document.createElement("div");C.className=this.toolbarBlockStyleClass.name,C.style.whiteSpace="nowrap",this.uiContainer.appendChild(C),this.addActionButton(C,'<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(C,'<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(C,'<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(C,'<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(C,'<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(C,'<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(C,'<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(C,'<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(P){var Z=document.createElement("div");Z.className=""+f.toolbarButtonStyleClass.name,Z.setAttribute("data-type-name",P.typeName),Z.innerHTML=P.icon,Z.addEventListener("click",function(){f.markerToolbarButtonClicked(Z,P)}),f.buttons.push(Z),f.markerButtons.push(Z)}),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 B=document.createElement("div");B.className=this.toolbarBlockStyleClass.name,B.style.whiteSpace="nowrap",B.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(B),this.addActionButton(B,'<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(B,'<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()},D.prototype.addButtonClickListener=function(u){this.buttonClickListeners.push(u)},D.prototype.removeButtonClickListener=function(u){this.buttonClickListeners.indexOf(u)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(u),1)},D.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},D.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var u=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var f=0;f<this.markerButtons.length;f++)f<u||f===u&&this.markerButtons.length-1===u?this.markerButtonBlock.appendChild(this.markerButtons[f]):(f===u&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[f]))}},D.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")},D.prototype.resetButtonStyles=function(){var u=this;this.buttons.forEach(function(f){f.className=f.className.replace(u.uiStyleSettings.toolbarButtonStyleColorsClassName?u.uiStyleSettings.toolbarButtonStyleColorsClassName:u.toolbarButtonStyleColorsClass.name,"").trim(),f.className=f.className.replace(u.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?u.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:u.toolbarActiveButtonStyleColorsClass.name,"").trim(),f.className+=" "+(u.uiStyleSettings.toolbarButtonStyleColorsClassName?u.uiStyleSettings.toolbarButtonStyleColorsClassName:u.toolbarButtonStyleColorsClass.name)})},D.prototype.addActionButton=function(u,f,C){var B=this,P=document.createElement("div");switch(P.className=""+this.toolbarButtonStyleClass.name,P.innerHTML=f,P.setAttribute("data-action",C),P.addEventListener("click",function(){B.actionToolbarButtonClicked(P,C)}),C){case"select":P.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":P.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":P.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":P.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":P.style.fill=this.uiStyleSettings.closeButtonColor}u.appendChild(P),this.buttons.push(P)},D.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new pe("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 pe("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new pe("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new pe("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 pe("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var u=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new pe("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*u)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*u)+`px;
|
|
padding: `+u+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new pe("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new pe("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new He("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new He("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},D.prototype.markerToolbarButtonClicked=function(u,f){this.setActiveButton(u),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(C){return C("marker",f)}),this.markerButtonOverflowBlock.style.display="none"},D.prototype.actionToolbarButtonClicked=function(u,f){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(C){return C("action",f)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},D.prototype.setActiveButton=function(u){this.resetButtonStyles(),u.className=u.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),u.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},D.prototype.setActiveMarkerButton=function(u){var f=this.markerButtons.find(function(C){return C.getAttribute("data-type-name")===u});f&&this.setActiveButton(f)},D.prototype.setCurrentMarker=function(u){var f=this;this.currentMarker=u,this.buttons.filter(function(C){return/delete|notes/.test(C.getAttribute("data-action"))}).forEach(function(C){f.currentMarker===void 0?(C.style.fillOpacity="0.4",C.style.pointerEvents="none"):(C.style.fillOpacity="1",C.style.pointerEvents="all")})},D}(),Ee=function(){function D(u,f,C,B){this.panels=[],this.panelButtons=[],this.markerjsContainer=u,this.displayMode=f,this.uiStyleSettings=C,this.styles=B,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return D.prototype.addStyles=function(){var u;this.toolboxStyleClass=this.styles.addClass(new pe("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 pe("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var f=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new pe("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new pe("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new pe("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 pe("toolbox-panel-row_colors",`
|
|
background-color: `+((u=this.uiStyleSettings.toolboxBackgroundColor)!==null&&u!==void 0?u:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new pe("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
|
|
padding: `+f+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new pe("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new pe("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new He("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new He("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},D.prototype.show=function(u){var f;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=u,this.uiContainer.className=this.toolboxStyleClass.name+" "+((f=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},D.prototype.setPanelButtons=function(u){var f,C,B=this;this.panels=u,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((f=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((C=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&C!==void 0?C:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(P){var Z;P.uiStyleSettings=B.uiStyleSettings;var ge=document.createElement("div");ge.className=B.toolboxButtonStyleClass.name+" "+((Z=B.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Z!==void 0?Z:B.toolboxButtonStyleColorsClass.name),ge.innerHTML=P.icon,ge.title=P.title,ge.addEventListener("click",function(){B.panelButtonClick(P)}),B.panelButtons.push(ge),B.buttonRow.appendChild(ge)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},D.prototype.panelButtonClick=function(u){var f=this,C=-1;if(u!==this.activePanel){C=this.panels.indexOf(u),this.panelRow.innerHTML="";var B=u.getUi();B.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(B),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=u}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){f.displayMode==="inline"?f.panelRow.style.display="none":f.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(P,Z){var ge,Ne;P.className=f.toolboxButtonStyleClass.name+" "+(Z===C?""+((ge=f.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ge!==void 0?ge:f.toolboxActiveButtonStyleColorsClass.name):""+((Ne=f.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ne!==void 0?Ne:f.toolboxButtonStyleColorsClass.name))})},D}(),me=function(D,u){this.title=D,this.icon=u},ye=function(D){function u(f,C,B,P){var Z=D.call(this,f,P||'<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 Z.colors=[],Z.addTransparent=!1,Z.colorBoxes=[],Z.colors=C,Z.currentColor=B,Z.setCurrentColor=Z.setCurrentColor.bind(Z),Z.getColorBox=Z.getColorBox.bind(Z),Z}return oe(u,D),u.prototype.getUi=function(){var f=this,C=document.createElement("div");return C.style.overflow="hidden",C.style.whiteSpace="nowrap",this.colors.forEach(function(B){var P=f.getColorBox(B);C.appendChild(P),f.colorBoxes.push(P)}),C},u.prototype.getColorBox=function(f){var C=this,B=this.uiStyleSettings.toolbarHeight/4,P=this.uiStyleSettings.toolbarHeight-B,Z=document.createElement("div");Z.style.display="inline-block",Z.style.boxSizing="content-box",Z.style.width=P-2+"px",Z.style.height=P-2+"px",Z.style.padding="1px",Z.style.marginRight="2px",Z.style.marginBottom="2px",Z.style.borderWidth="2px",Z.style.borderStyle="solid",Z.style.borderRadius=(P+2)/2+"px",Z.style.borderColor=f===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",Z.addEventListener("click",function(){C.setCurrentColor(f,Z)});var ge=document.createElement("div");return ge.style.display="inline-block",ge.style.width=P-2+"px",ge.style.height=P-2+"px",ge.style.backgroundColor=f,ge.style.borderRadius=P/2+"px",f==="transparent"&&(ge.style.fill=this.uiStyleSettings.toolboxAccentColor,ge.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>`),Z.appendChild(ge),Z},u.prototype.setCurrentColor=function(f,C){var B=this;this.currentColor=f,this.colorBoxes.forEach(function(P){P.style.borderColor=P===C?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(f)},u}(me),ve=function(){function D(u,f,C){this._state="new",this._isSelected=!1,this._container=u,this._overlayContainer=f,this.globalSettings=C,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(D.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),D.prototype.ownsTarget=function(u){return!1},Object.defineProperty(D.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),D.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},D.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},D.prototype.pointerDown=function(u,f){},D.prototype.dblClick=function(u,f){},D.prototype.manipulate=function(u){},D.prototype.pointerUp=function(u){this.stateChanged()},D.prototype.dispose=function(){},D.prototype.addMarkerVisualToContainer=function(u){this.container.childNodes.length>0?this.container.insertBefore(u,this.container.childNodes[0]):this.container.appendChild(u)},D.prototype.getState=function(){return{typeName:D.typeName,state:this.state,notes:this.notes}},D.prototype.restoreState=function(u){this._state=u.state,this.notes=u.notes},D.prototype.scale=function(u,f){},D.prototype.colorChanged=function(u){this.onColorChanged&&this.onColorChanged(u),this.stateChanged()},D.prototype.fillColorChanged=function(u){this.onFillColorChanged&&this.onFillColorChanged(u),this.stateChanged()},D.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var u=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),u.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(u)&&this.onStateChanged(this)}},D.typeName="MarkerBase",D}(),be=function(){function D(){this.findGripByVisual=this.findGripByVisual.bind(this)}return D.prototype.findGripByVisual=function(u){return this.topLeft.ownsTarget(u)?this.topLeft:this.topCenter.ownsTarget(u)?this.topCenter:this.topRight.ownsTarget(u)?this.topRight:this.centerLeft.ownsTarget(u)?this.centerLeft:this.centerRight.ownsTarget(u)?this.centerRight:this.bottomLeft.ownsTarget(u)?this.bottomLeft:this.bottomCenter.ownsTarget(u)?this.bottomCenter:this.bottomRight.ownsTarget(u)?this.bottomRight:void 0},D}(),Ke=function(){function D(){this.GRIP_SIZE=10,this.visual=X.createGroup(),this.visual.appendChild(X.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(X.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return D.prototype.ownsTarget=function(u){return u===this.visual||u===this.visual.childNodes[0]||u===this.visual.childNodes[1]},D}(),De=function(){function D(){}return D.toITransformMatrix=function(u){return{a:u.a,b:u.b,c:u.c,d:u.d,e:u.e,f:u.f}},D.toSVGMatrix=function(u,f){return u.a=f.a,u.b=f.b,u.c=f.c,u.d=f.d,u.e=f.e,u.f=f.f,u},D}(),ke=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.left=0,P.top=0,P.width=0,P.height=0,P.defaultSize={x:50,y:20},P.offsetX=0,P.offsetY=0,P.rotationAngle=0,P.CB_DISTANCE=10,P._suppressMarkerCreateEvent=!1,P.container.transform.baseVal.appendItem(X.createTransform()),P.setupControlBox(),P}return oe(u,D),Object.defineProperty(u.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"visual",{get:function(){return this._visual},set:function(f){this._visual=f;var C=X.createTransform();this._visual.transform.baseVal.appendItem(C)},enumerable:!1,configurable:!0}),u.prototype.ownsTarget=function(f){return!!D.prototype.ownsTarget.call(this,f)||!!(this.controlGrips.findGripByVisual(f)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(f))},u.prototype.pointerDown=function(f,C){D.prototype.pointerDown.call(this,f,C),this.state==="new"&&(this.left=f.x,this.top=f.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var B=this.unrotatePoint(f);if(this.manipulationStartX=B.x,this.manipulationStartY=B.y,this.offsetX=B.x-this.left,this.offsetY=B.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(C),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(C)){this.activeGrip=this.rotatorGrip;var P=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=P.x-this.width/2,this.top=P.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var Z=this.container.transform.baseVal.getItem(0);Z.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(Z,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},u.prototype.pointerUp=function(f){var C=this.state;D.prototype.pointerUp.call(this,f),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(f),this._state="select",C==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},u.prototype.moveVisual=function(f){this.visual.style.transform="translate("+f.x+"px, "+f.y+"px)"},u.prototype.manipulate=function(f){var C=this.unrotatePoint(f);this.state==="creating"?this.resize(f):this.state==="move"?(this.left=this.manipulationStartLeft+(C.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(C.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(C):this.state==="rotate"&&this.rotate(f)},u.prototype.resize=function(f){var C=this.manipulationStartLeft,B=this.manipulationStartWidth,P=this.manipulationStartTop,Z=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:C=this.manipulationStartLeft+f.x-this.manipulationStartX,B=this.manipulationStartWidth+this.manipulationStartLeft-C;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:B=this.manipulationStartWidth+f.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:P=this.manipulationStartTop+f.y-this.manipulationStartY,Z=this.manipulationStartHeight+this.manipulationStartTop-P;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:Z=this.manipulationStartHeight+f.y-this.manipulationStartY}B>=0?(this.left=C,this.width=B):(this.left=C+B,this.width=-B),Z>=0?(this.top=P,this.height=Z):(this.top=P+Z,this.height=-Z),this.setSize()},u.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},u.prototype.rotate=function(f){if(Math.abs(f.x-this.centerX)>.1){var C=Math.sign(f.x-this.centerX);this.rotationAngle=180*Math.atan((f.y-this.centerY)/(f.x-this.centerX))/Math.PI+90*C,this.applyRotation()}},u.prototype.applyRotation=function(){var f=this.container.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(f,0)},u.prototype.rotatePoint=function(f){if(this.rotationAngle===0)return f;var C=this.container.getCTM(),B=X.createPoint(f.x,f.y);return{x:(B=B.matrixTransform(C)).x,y:B.y}},u.prototype.unrotatePoint=function(f){if(this.rotationAngle===0)return f;var C=this.container.getCTM();C=C.inverse();var B=X.createPoint(f.x,f.y);return{x:(B=B.matrixTransform(C)).x,y:B.y}},u.prototype.select=function(){D.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},u.prototype.deselect=function(){D.prototype.deselect.call(this),this.controlBox.style.display="none"},u.prototype.setupControlBox=function(){this.controlBox=X.createGroup();var f=X.createTransform();f.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(f),this.container.appendChild(this.controlBox),this.controlRect=X.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=X.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 be,this.addControlGrips(),this.controlBox.style.display="none"},u.prototype.adjustControlBox=function(){var f=this.controlBox.transform.baseVal.getItem(0);f.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(f,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()},u.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()},u.prototype.createGrip=function(){var f=new Ke;return f.visual.transform.baseVal.appendItem(X.createTransform()),this.controlBox.appendChild(f.visual),f},u.prototype.positionGrips=function(){var f=this.controlGrips.topLeft.GRIP_SIZE,C=-f/2,B=C,P=(this.width+this.CB_DISTANCE)/2-f/2,Z=(this.height+this.CB_DISTANCE)/2-f/2,ge=this.height+this.CB_DISTANCE-f/2,Ne=this.width+this.CB_DISTANCE-f/2;this.positionGrip(this.controlGrips.topLeft.visual,C,B),this.positionGrip(this.controlGrips.topCenter.visual,P,B),this.positionGrip(this.controlGrips.topRight.visual,Ne,B),this.positionGrip(this.controlGrips.centerLeft.visual,C,Z),this.positionGrip(this.controlGrips.centerRight.visual,Ne,Z),this.positionGrip(this.controlGrips.bottomLeft.visual,C,ge),this.positionGrip(this.controlGrips.bottomCenter.visual,P,ge),this.positionGrip(this.controlGrips.bottomRight.visual,Ne,ge),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,P,B-3*this.CB_DISTANCE)},u.prototype.positionGrip=function(f,C,B){var P=f.transform.baseVal.getItem(0);P.setTranslate(C,B),f.transform.baseVal.replaceItem(P,0)},u.prototype.hideControlBox=function(){this.controlBox.style.display="none"},u.prototype.showControlBox=function(){this.controlBox.style.display=""},u.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:De.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:De.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},D.prototype.getState.call(this))},u.prototype.restoreState=function(f){D.prototype.restoreState.call(this,f);var C=f;this.left=C.left,this.top=C.top,this.width=C.width,this.height=C.height,this.rotationAngle=C.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(De.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,C.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(De.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,C.containerTransformMatrix))},u.prototype.scale=function(f,C){D.prototype.scale.call(this,f,C);var B=this.rotatePoint({x:this.left,y:this.top}),P=this.unrotatePoint({x:B.x*f,y:B.y*C});this.left=P.x,this.top=P.y,this.width=this.width*f,this.height=this.height*C,this.adjustControlBox()},u}(ve),Fe=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.fillColor="transparent",P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.opacity=1,P.setStrokeColor=P.setStrokeColor.bind(P),P.setFillColor=P.setFillColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.createVisual=P.createVisual.bind(P),P}return oe(u,D),u.prototype.ownsTarget=function(f){return!(!D.prototype.ownsTarget.call(this,f)&&f!==this.visual)},u.prototype.createVisual=function(){this.visual=X.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)},u.prototype.pointerDown=function(f,C){D.prototype.pointerDown.call(this,f,C),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},u.prototype.manipulate=function(f){D.prototype.manipulate.call(this,f)},u.prototype.resize=function(f){D.prototype.resize.call(this,f),this.setSize()},u.prototype.setSize=function(){D.prototype.setSize.call(this),X.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},u.prototype.pointerUp=function(f){D.prototype.pointerUp.call(this,f),this.setSize()},u.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&X.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},u.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&X.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},u.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&X.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},u.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&X.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},u.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},D.prototype.getState.call(this))},u.prototype.restoreState=function(f){var C=f;this.fillColor=C.fillColor,this.strokeColor=C.strokeColor,this.strokeWidth=C.strokeWidth,this.strokeDasharray=C.strokeDasharray,this.opacity=C.opacity,this.createVisual(),D.prototype.restoreState.call(this,f),this.setSize()},u.prototype.scale=function(f,C){D.prototype.scale.call(this,f,C),this.setSize()},u.title="Rectangle marker",u}(ke),re=function(D){function u(f,C,B,P){var Z=D.call(this,f,P||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return Z.widths=[],Z.widthBoxes=[],Z.widths=C,Z.currentWidth=B,Z.setCurrentWidth=Z.setCurrentWidth.bind(Z),Z}return oe(u,D),u.prototype.getUi=function(){var f=this,C=document.createElement("div");return C.style.display="flex",C.style.overflow="hidden",C.style.flexGrow="2",this.widths.forEach(function(B){var P=document.createElement("div");P.style.display="flex",P.style.flexGrow="2",P.style.alignItems="center",P.style.justifyContent="space-between",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.borderColor=B===f.currentWidth?f.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){f.setCurrentWidth(B,P)}),C.appendChild(P);var Z=document.createElement("div");Z.innerText=B.toString(),Z.style.marginRight="5px",P.appendChild(Z);var ge=document.createElement("div");ge.style.minHeight="20px",ge.style.flexGrow="2",ge.style.display="flex",ge.style.alignItems="center";var Ne=document.createElement("hr");Ne.style.minWidth="20px",Ne.style.border="0px",Ne.style.borderTop=B+"px solid "+f.uiStyleSettings.toolboxColor,Ne.style.flexGrow="2",ge.appendChild(Ne),P.appendChild(ge),f.widthBoxes.push(P)}),C},u.prototype.setCurrentWidth=function(f,C){var B=this;this.currentWidth=f,this.widthBoxes.forEach(function(P){P.style.borderColor=P===C?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},u}(me),Be=function(D){function u(f,C,B,P){var Z=D.call(this,f,P||'<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 Z.styles=[],Z.styleBoxes=[],Z.styles=C,Z.currentStyle=B,Z.setCurrentStyle=Z.setCurrentStyle.bind(Z),Z}return oe(u,D),u.prototype.getUi=function(){var f=this,C=document.createElement("div");return C.style.display="flex",C.style.overflow="hidden",C.style.flexGrow="2",this.styles.forEach(function(B){var P=document.createElement("div");P.style.display="flex",P.style.alignItems="center",P.style.justifyContent="space-between",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.overflow="hidden",P.style.maxWidth=100/f.styles.length-5+"%",P.style.borderColor=B===f.currentStyle?f.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){f.setCurrentStyle(B,P)}),C.appendChild(P);var Z=document.createElement("div");Z.style.minHeight="20px",Z.style.flexGrow="2",Z.style.overflow="hidden";var ge=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+f.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(B!==""?'stroke-dasharray="'+B+'"':"")+` />
|
|
</svg>`;Z.innerHTML=ge,P.appendChild(Z),f.styleBoxes.push(P)}),C},u.prototype.setCurrentStyle=function(f,C){var B=this;this.currentStyle=f,this.styleBoxes.forEach(function(P){P.style.borderColor=P===C?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},u}(me),Oe=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.strokeColor=B.defaultColor,P.strokeWidth=B.defaultStrokeWidth,P.strokeDasharray=B.defaultStrokeDasharray,P.strokePanel=new ye("Line color",B.defaultColorSet,B.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new re("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new Be("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return oe(u,D),Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=D.prototype.getState.call(this);return f.typeName=u.typeName,f},u.typeName="FrameMarker",u.title="Frame marker",u.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',u}(Fe),Re=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},Ge=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.x1=0,P.y1=0,P.x2=0,P.y2=0,P.defaultLength=50,P.manipulationStartX=0,P.manipulationStartY=0,P.manipulationStartX1=0,P.manipulationStartY1=0,P.manipulationStartX2=0,P.manipulationStartY2=0,P.setupControlBox(),P}return oe(u,D),u.prototype.ownsTarget=function(f){return!!D.prototype.ownsTarget.call(this,f)||!(!this.grip1.ownsTarget(f)&&!this.grip2.ownsTarget(f))},u.prototype.pointerDown=function(f,C){D.prototype.pointerDown.call(this,f,C),this.manipulationStartX=f.x,this.manipulationStartY=f.y,this.state==="new"&&(this.x1=f.x,this.y1=f.y,this.x2=f.x,this.y2=f.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(C)?this.activeGrip=this.grip1:this.grip2.ownsTarget(C)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},u.prototype.pointerUp=function(f){var C=this.state;D.prototype.pointerUp.call(this,f),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(f),this._state="select",C==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},u.prototype.adjustVisual=function(){},u.prototype.manipulate=function(f){this.state==="creating"?this.resize(f):this.state==="move"?(this.x1=this.manipulationStartX1+f.x-this.manipulationStartX,this.y1=this.manipulationStartY1+f.y-this.manipulationStartY,this.x2=this.manipulationStartX2+f.x-this.manipulationStartX,this.y2=this.manipulationStartY2+f.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(f)},u.prototype.resize=function(f){switch(this.activeGrip){case this.grip1:this.x1=f.x,this.y1=f.y;break;case this.grip2:case void 0:this.x2=f.x,this.y2=f.y}this.adjustVisual(),this.adjustControlBox()},u.prototype.select=function(){D.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},u.prototype.deselect=function(){D.prototype.deselect.call(this),this.controlBox.style.display="none"},u.prototype.setupControlBox=function(){this.controlBox=X.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},u.prototype.adjustControlBox=function(){this.positionGrips()},u.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},u.prototype.createGrip=function(){var f=new Ke;return f.visual.transform.baseVal.appendItem(X.createTransform()),this.controlBox.appendChild(f.visual),f},u.prototype.positionGrips=function(){var f=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-f/2,this.y1-f/2),this.positionGrip(this.grip2.visual,this.x2-f/2,this.y2-f/2)},u.prototype.positionGrip=function(f,C,B){var P=f.transform.baseVal.getItem(0);P.setTranslate(C,B),f.transform.baseVal.replaceItem(P,0)},u.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},D.prototype.getState.call(this))},u.prototype.restoreState=function(f){D.prototype.restoreState.call(this,f);var C=f;this.x1=C.x1,this.y1=C.y1,this.x2=C.x2,this.y2=C.y2},u.prototype.scale=function(f,C){D.prototype.scale.call(this,f,C),this.x1=this.x1*f,this.y1=this.y1*C,this.x2=this.x2*f,this.y2=this.y2*C,this.adjustVisual(),this.adjustControlBox()},u}(ve),Le=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.setStrokeColor=P.setStrokeColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.strokeColor=B.defaultColor,P.strokeWidth=B.defaultStrokeWidth,P.strokeDasharray=B.defaultStrokeDasharray,P.strokePanel=new ye("Line color",B.defaultColorSet,B.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new re("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new Be("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return oe(u,D),u.prototype.ownsTarget=function(f){return!(!D.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorLine&&f!==this.visibleLine)},u.prototype.createVisual=function(){this.visual=X.createGroup(),this.selectorLine=X.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=X.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)},u.prototype.pointerDown=function(f,C){D.prototype.pointerDown.call(this,f,C),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},u.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()),X.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),X.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),X.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},u.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},u.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},u.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},D.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){D.prototype.restoreState.call(this,f);var C=f;this.strokeColor=C.strokeColor,this.strokeWidth=C.strokeWidth,this.strokeDasharray=C.strokeDasharray,this.createVisual(),this.adjustVisual()},u.typeName="LineMarker",u.title="Line marker",u.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',u}(Ge),le=function(D){function u(f,C,B,P){var Z=D.call(this,f,P||'<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 Z.fonts=[],Z.fontBoxes=[],Z.fonts=C,Z.currentFont=B,Z.setCurrentFont=Z.setCurrentFont.bind(Z),Z}return oe(u,D),u.prototype.getUi=function(){var f=this,C=document.createElement("div");return C.style.overflow="hidden",C.style.flexGrow="2",this.fonts.forEach(function(B){var P=document.createElement("div");P.style.display="inline-block",P.style.alignItems="center",P.style.justifyContent="space-between",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.overflow="hidden",P.style.maxWidth=100/f.fonts.length-5+"%",P.style.borderColor=B===f.currentFont?f.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){f.setCurrentFont(B,P)}),C.appendChild(P);var Z=document.createElement("div");Z.style.display="flex",Z.style.minHeight="20px",Z.style.flexGrow="2",Z.style.fontFamily=B,Z.style.overflow="hidden";var ge=document.createElement("div");ge.style.whiteSpace="nowrap",ge.style.overflow="hidden",ge.style.textOverflow="ellipsis",ge.innerHTML="The quick brown fox jumps over the lazy dog",Z.appendChild(ge),P.appendChild(Z),f.fontBoxes.push(P)}),C},u.prototype.setCurrentFont=function(f,C){var B=this;this.currentFont=f,this.fontBoxes.forEach(function(P){P.style.borderColor=P===C?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},u}(me),Te=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.color="transparent",P.padding=5,P.DEFAULT_TEXT="your text here",P.text=P.DEFAULT_TEXT,P.isMoved=!1,P.color=B.defaultColor,P.fontFamily=B.defaultFontFamily,P.defaultSize={x:100,y:30},P.setColor=P.setColor.bind(P),P.setFont=P.setFont.bind(P),P.renderText=P.renderText.bind(P),P.sizeText=P.sizeText.bind(P),P.textEditDivClicked=P.textEditDivClicked.bind(P),P.showTextEditor=P.showTextEditor.bind(P),P.setSize=P.setSize.bind(P),P.positionTextEditor=P.positionTextEditor.bind(P),P.colorPanel=new ye("Color",B.defaultColorSet,B.defaultColor),P.colorPanel.onColorChanged=P.setColor,P.fontFamilyPanel=new le("Font",B.defaultFontFamilies,B.defaultFontFamily),P.fontFamilyPanel.onFontChanged=P.setFont,P}return oe(u,D),u.prototype.ownsTarget=function(f){if(D.prototype.ownsTarget.call(this,f)||f===this.visual||f===this.textElement||f===this.bgRectangle)return!0;var C=!1;return this.textElement.childNodes.forEach(function(B){B===f&&(C=!0)}),C},u.prototype.createVisual=function(){this.visual=X.createGroup(),this.bgRectangle=X.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=X.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(X.createTransform()),this.textElement.transform.baseVal.appendItem(X.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},u.prototype.pointerDown=function(f,C){D.prototype.pointerDown.call(this,f,C),this.isMoved=!1,this.pointerDownPoint=f,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},u.prototype.renderText=function(){var f=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(C){f.textElement.appendChild(X.createTSpan(C.trim()===""?" ":C.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},u.prototype.getTextScale=function(){var f=this.textElement.getBBox(),C=1;if(f.width>0&&f.height>0){var B=(1*this.width-this.width*this.padding*2/100)/f.width,P=(1*this.height-this.height*this.padding*2/100)/f.height;C=Math.min(B,P)}return C},u.prototype.getTextPosition=function(f){var C=this.textElement.getBBox(),B=0,P=0;return C.width>0&&C.height>0&&(B=(this.width-C.width*f)/2,P=this.height/2-C.height*f/2),{x:B,y:P}},u.prototype.sizeText=function(){var f=this.textElement.getBBox(),C=this.getTextScale(),B=this.getTextPosition(C);B.y-=f.y*C,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+B.x+"px, "+B.y+"px) scale("+C+", "+C+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(B.x,B.y),this.textElement.transform.baseVal.getItem(1).setScale(C,C))},u.prototype.manipulate=function(f){D.prototype.manipulate.call(this,f),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(f.x-this.pointerDownPoint.x)>5||Math.abs(f.y-this.pointerDownPoint.y)>5)},u.prototype.resize=function(f){D.prototype.resize.call(this,f),this.isMoved=!0,this.setSize(),this.sizeText()},u.prototype.setSize=function(){D.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(X.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),X.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},u.prototype.pointerUp=function(f){var C=this.state;C==="creating"&&(this._suppressMarkerCreateEvent=!0),D.prototype.pointerUp.call(this,f),this.setSize(),(C==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},u.prototype.showTextEditor=function(){var f=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(C){C.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var C=Number.parseFloat(f.textEditor.style.fontSize);f.textEditor.clientWidth>=Number.parseInt(f.textEditor.style.maxWidth)&&C>.9;)C-=.1,f.textEditor.style.fontSize=Math.max(C,.9)+"em"}),this.textEditor.addEventListener("keyup",function(C){C.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(C){if(C.clipboardData){var B=C.clipboardData.getData("text"),P=window.getSelection();if(!P.rangeCount)return!1;P.deleteFromDocument(),P.getRangeAt(0).insertNode(document.createTextNode(B)),C.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){f.textEditDivClicked(f.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},u.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var f=this.getTextScale(),C=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),B=this.textElement.getBBox(),P={x:B.width*f,y:B.height*f};C.x-=P.x/2,C.y-=P.y/2,this.textEditor.style.top=C.y+"px",this.textEditor.style.left=C.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-C.x+"px",this.textEditor.style.fontSize=Math.max(16*f,12)+"px",this.textElement.style.display="none"}},u.prototype.textEditDivClicked=function(f){this.text=f.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},u.prototype.select=function(){D.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},u.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),D.prototype.deselect.call(this)},u.prototype.dblClick=function(f,C){D.prototype.dblClick.call(this,f,C),this.showTextEditor()},u.prototype.setColor=function(f){this.textElement&&X.setAttributes(this.textElement,[["fill",f]]),this.color=f,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(f)},u.prototype.setFont=function(f){this.textElement&&X.setAttributes(this.textElement,[["font-family",f]]),this.fontFamily=f,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},u.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},u.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},D.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){var C=f;this.color=C.color,this.fontFamily=C.fontFamily,this.padding=C.padding,this.text=C.text,this.createVisual(),D.prototype.restoreState.call(this,f),this.setSize()},u.prototype.scale=function(f,C){D.prototype.scale.call(this,f,C),this.setSize(),this.sizeText(),this.positionTextEditor()},u.typeName="TextMarker",u.title="Text marker",u.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>',u}(ke),te=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.color="transparent",P.lineWidth=3,P.drawing=!1,P.pixelRatio=1,P.color=B.defaultColor,P.lineWidth=B.defaultStrokeWidth,P.pixelRatio=B.freehandPixelRatio,P.setColor=P.setColor.bind(P),P.addCanvas=P.addCanvas.bind(P),P.finishCreation=P.finishCreation.bind(P),P.setLineWidth=P.setLineWidth.bind(P),P.colorPanel=new ye("Color",B.defaultColorSet,B.defaultColor),P.colorPanel.onColorChanged=P.setColor,P.lineWidthPanel=new re("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),P.lineWidthPanel.onWidthChanged=P.setLineWidth,P}return oe(u,D),u.prototype.ownsTarget=function(f){return!(!D.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.drawingImage)},u.prototype.createVisual=function(){this.visual=X.createGroup(),this.drawingImage=X.createImage(),this.visual.appendChild(this.drawingImage);var f=X.createTransform();this.visual.transform.baseVal.appendItem(f),this.addMarkerVisualToContainer(this.visual)},u.prototype.pointerDown=function(f,C){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(f.x,f.y),this.drawing=!0):D.prototype.pointerDown.call(this,f,C)},u.prototype.manipulate=function(f){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(f.x,f.y),this.canvasContext.stroke()):D.prototype.manipulate.call(this,f)},u.prototype.resize=function(f){D.prototype.resize.call(this,f),X.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),X.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},u.prototype.pointerUp=function(f){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):D.prototype.pointerUp.call(this,f)},u.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)},u.prototype.select=function(){this.state==="creating"&&this.finishCreation(),D.prototype.select.call(this)},u.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),D.prototype.deselect.call(this)},u.prototype.finishCreation=function(){for(var f=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),C=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],B=C[0],P=C[1],Z=C[2],ge=C[3],Ne=!1,Ve=0;Ve<this.canvasElement.height;Ve++)for(var _e=0;_e<this.canvasElement.width;_e++)f.data[Ve*this.canvasElement.width*4+4*_e+3]>0&&(Ne=!0,Ve<P&&(P=Ve),_e<B&&(B=_e),Ve>ge&&(ge=Ve),_e>Z&&(Z=_e));if(Ne){this.left=B/this.pixelRatio,this.top=P/this.pixelRatio,this.width=(Z-B)/this.pixelRatio,this.height=(ge-P)/this.pixelRatio;var qe=document.createElement("canvas");qe.width=Z-B,qe.height=ge-P,qe.getContext("2d").putImageData(this.canvasContext.getImageData(B,P,Z-B,ge-P),0,0),this.drawingImgUrl=qe.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},u.prototype.setDrawingImage=function(){X.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),X.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},u.prototype.setColor=function(f){this.color=f,this.colorChanged(f)},u.prototype.setLineWidth=function(f){this.lineWidth=f},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({drawingImgUrl:this.drawingImgUrl},D.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){this.createVisual(),D.prototype.restoreState.call(this,f),this.drawingImgUrl=f.drawingImgUrl,this.setDrawingImage()},u.prototype.scale=function(f,C){D.prototype.scale.call(this,f,C),this.setDrawingImage()},u.typeName="FreehandMarker",u.title="Freehand marker",u.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>',u}(ke),J=function(D){function u(f,C,B){var P=D.call(this,f,B||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return P.typeBoxes=[],P.currentType=C,P.setCurrentType=P.setCurrentType.bind(P),P}return oe(u,D),u.prototype.getUi=function(){var f=this,C=document.createElement("div");C.style.display="flex",C.style.overflow="hidden",C.style.flexGrow="2";for(var B=function(ge){var Ne="both";switch(ge){case 0:Ne="both";break;case 1:Ne="start";break;case 2:Ne="end";break;case 3:Ne="none"}var Ve=document.createElement("div");if(Ve.style.display="flex",Ve.style.flexGrow="2",Ve.style.alignItems="center",Ve.style.justifyContent="space-between",Ve.style.padding="5px",Ve.style.borderWidth="2px",Ve.style.borderStyle="solid",Ve.style.borderColor=Ne===P.currentType?P.uiStyleSettings.toolboxAccentColor:"transparent",Ve.addEventListener("click",function(){f.setCurrentType(Ne,Ve)}),C.appendChild(Ve),Ne==="both"||Ne==="start"){var _e=document.createElement("div");_e.style.display="flex",_e.style.alignItems="center",_e.style.minHeight="20px",_e.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="`+(P.uiStyleSettings!==void 0?P.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,_e.style.marginLeft="5px",Ve.appendChild(_e)}var qe=document.createElement("div");qe.style.display="flex",qe.style.alignItems="center",qe.style.minHeight="20px",qe.style.flexGrow="2";var _t=document.createElement("hr");if(_t.style.minWidth="20px",_t.style.border="0px",_t.style.borderTop="3px solid "+(P.uiStyleSettings!==void 0?P.uiStyleSettings.toolboxColor:"#eeeeee"),_t.style.flexGrow="2",qe.appendChild(_t),Ve.appendChild(qe),Ne==="both"||Ne==="end"){var Et=document.createElement("div");Et.style.display="flex",Et.style.alignItems="center",Et.style.minHeight="20px",Et.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="`+(P.uiStyleSettings!==void 0?P.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Et.style.marginRight="5px",Ve.appendChild(Et)}P.typeBoxes.push(Ve)},P=this,Z=0;Z<4;Z++)B(Z);return C},u.prototype.setCurrentType=function(f,C){var B=this;this.currentType=f,this.typeBoxes.forEach(function(P){P.style.borderColor=P===C?B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},u}(me),ee=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.arrowType="end",P.arrowBaseHeight=10,P.arrowBaseWidth=10,P.getArrowPoints=P.getArrowPoints.bind(P),P.setArrowType=P.setArrowType.bind(P),P.arrowTypePanel=new J("Arrow type","end"),P.arrowTypePanel.onArrowTypeChanged=P.setArrowType,P}return oe(u,D),u.prototype.ownsTarget=function(f){return!(!D.prototype.ownsTarget.call(this,f)&&f!==this.arrow1&&f!==this.arrow2)},u.prototype.getArrowPoints=function(f,C){var B=this.arrowBaseWidth+2*this.strokeWidth,P=this.arrowBaseHeight+2*this.strokeWidth;return f-B/2+","+(C+P/2)+" "+f+","+(C-P/2)+" "+(f+B/2)+","+(C+P/2)},u.prototype.createTips=function(){this.arrow1=X.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(X.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=X.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(X.createTransform()),this.visual.appendChild(this.arrow2)},u.prototype.pointerDown=function(f,C){D.prototype.pointerDown.call(this,f,C),this.state==="creating"&&this.createTips()},u.prototype.adjustVisual=function(){if(D.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",X.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),X.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),C=this.arrow1.transform.baseVal.getItem(0);C.setRotate(f,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(C,0);var B=this.arrow2.transform.baseVal.getItem(0);B.setRotate(f+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(B,0)}},u.prototype.setArrowType=function(f){this.arrowType=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({arrowType:this.arrowType},D.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){D.prototype.restoreState.call(this,f);var C=f;this.arrowType=C.arrowType,this.createTips(),this.adjustVisual()},u.typeName="ArrowMarker",u.title="Arrow marker",u.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',u}(Le),K=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.fillColor=B.defaultFillColor,P.strokeWidth=0,P.fillPanel=new ye("Color",B.defaultColorSet,B.defaultFillColor),P.fillPanel.onColorChanged=P.setFillColor,P}return oe(u,D),Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=D.prototype.getState.call(this);return f.typeName=u.typeName,f},u.typeName="CoverMarker",u.title="Cover marker",u.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',u}(Fe),z=function(D){function u(f,C,B,P){var Z=D.call(this,f,P||'<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 Z.opacities=[],Z.opacityBoxes=[],Z.opacities=C,Z.currentOpacity=B,Z.setCurrentOpacity=Z.setCurrentOpacity.bind(Z),Z}return oe(u,D),u.prototype.getUi=function(){var f=this,C=document.createElement("div");return C.style.display="flex",C.style.overflow="hidden",C.style.flexGrow="2",C.style.justifyContent="space-between",this.opacities.forEach(function(B){var P=document.createElement("div");P.style.display="flex",P.style.alignItems="center",P.style.justifyContent="center",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.borderColor=B===f.currentOpacity?f.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){f.setCurrentOpacity(B,P)}),C.appendChild(P);var Z=document.createElement("div");Z.innerText=100*B+"%",P.appendChild(Z),f.opacityBoxes.push(P)}),C},u.prototype.setCurrentOpacity=function(f,C){var B=this;this.currentOpacity=f,this.opacityBoxes.forEach(function(P){P.style.borderColor=P===C?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},u}(me),Y=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.setOpacity=P.setOpacity.bind(P),P.fillColor=B.defaultHighlightColor,P.strokeWidth=0,P.opacity=B.defaultHighlightOpacity,P.fillPanel=new ye("Color",B.defaultColorSet,P.fillColor),P.fillPanel.onColorChanged=P.setFillColor,P.opacityPanel=new z("Opacity",B.defaultOpacitySteps,P.opacity),P.opacityPanel.onOpacityChanged=P.setOpacity,P}return oe(u,D),u.prototype.setOpacity=function(f){this.opacity=f,this.visual&&X.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=D.prototype.getState.call(this);return f.typeName=u.typeName,f},u.typeName="HighlightMarker",u.title="Highlight marker",u.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>',u}(K),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>',se=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.bgColor="transparent",P.tipPosition={x:0,y:0},P.tipBase1Position={x:0,y:0},P.tipBase2Position={x:0,y:0},P.tipMoving=!1,P.color=B.defaultStrokeColor,P.bgColor=B.defaultFillColor,P.fontFamily=B.defaultFontFamily,P.defaultSize={x:100,y:30},P.setBgColor=P.setBgColor.bind(P),P.getTipPoints=P.getTipPoints.bind(P),P.positionTip=P.positionTip.bind(P),P.setTipPoints=P.setTipPoints.bind(P),P.colorPanel=new ye("Text color",B.defaultColorSet,P.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>'),P.colorPanel.onColorChanged=P.setColor,P.bgColorPanel=new ye("Fill color",B.defaultColorSet,P.bgColor,Q),P.bgColorPanel.onColorChanged=P.setBgColor,P.fontFamilyPanel=new le("Font",B.defaultFontFamilies,B.defaultFontFamily),P.fontFamilyPanel.onFontChanged=P.setFont,P.tipGrip=new Ke,P.tipGrip.visual.transform.baseVal.appendItem(X.createTransform()),P.controlBox.appendChild(P.tipGrip.visual),P}return oe(u,D),u.prototype.ownsTarget=function(f){return D.prototype.ownsTarget.call(this,f)||this.tipGrip.ownsTarget(f)||this.tip===f},u.prototype.createTip=function(){X.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=X.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},u.prototype.pointerDown=function(f,C){this.state==="new"&&D.prototype.pointerDown.call(this,f,C),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(C)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):D.prototype.pointerDown.call(this,f,C)},u.prototype.pointerUp=function(f){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,D.prototype.pointerUp.call(this,f);else{var C=this.state==="creating";D.prototype.pointerUp.call(this,f),this.setTipPoints(C),this.positionTip()}},u.prototype.manipulate=function(f){if(this.tipMoving){var C=this.unrotatePoint(f);this.tipPosition={x:C.x-this.manipulationStartLeft,y:C.y-this.manipulationStartTop},this.positionTip()}else D.prototype.manipulate.call(this,f)},u.prototype.setBgColor=function(f){this.bgRectangle&&this.tip&&(X.setAttributes(this.bgRectangle,[["fill",f]]),X.setAttributes(this.tip,[["fill",f]])),this.bgColor=f,this.fillColorChanged(f)},u.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},u.prototype.setTipPoints=function(f){f===void 0&&(f=!1);var C=Math.min(this.height/2,15),B=this.height/5;f&&(this.tipPosition={x:C+B/2,y:this.height+20});var P=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?P<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(B=this.width/5,C=Math.min(this.width/2,15),this.tipBase1Position={x:C,y:0},this.tipBase2Position={x:C+B,y:0}):(this.tipBase1Position={x:0,y:C},this.tipBase2Position={x:0,y:C+B}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?P<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(B=this.width/5,C=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-C-B,y:0},this.tipBase2Position={x:this.width-C,y:0}):(this.tipBase1Position={x:this.width,y:C},this.tipBase2Position={x:this.width,y:C+B}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?P<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(B=this.width/5,C=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-C-B,y:this.height},this.tipBase2Position={x:this.width-C,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-C-B},this.tipBase2Position={x:this.width,y:this.height-C}):P<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(B=this.width/5,C=Math.min(this.width/2,15),this.tipBase1Position={x:C,y:this.height},this.tipBase2Position={x:C+B,y:this.height}):(this.tipBase1Position={x:0,y:this.height-C},this.tipBase2Position={x:0,y:this.height-C-B})},u.prototype.resize=function(f){D.prototype.resize.call(this,f),this.positionTip()},u.prototype.positionTip=function(){X.setAttributes(this.tip,[["points",this.getTipPoints()]]);var f=this.tipGrip.visual.transform.baseVal.getItem(0);f.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(f,0)},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),u.prototype.select=function(){this.positionTip(),D.prototype.select.call(this)},u.prototype.getState=function(){var f=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},D.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){var C=f;this.bgColor=C.bgColor,this.tipPosition=C.tipPosition,D.prototype.restoreState.call(this,f),this.createTip(),this.setTipPoints()},u.prototype.scale=function(f,C){D.prototype.scale.call(this,f,C),this.tipPosition={x:this.tipPosition.x*f,y:this.tipPosition.y*C},this.positionTip()},u.typeName="CalloutMarker",u.title="Callout marker",u.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>',u}(Te),fe=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.fillColor="transparent",P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.opacity=1,P.strokeColor=B.defaultColor,P.strokeWidth=B.defaultStrokeWidth,P.strokeDasharray=B.defaultStrokeDasharray,P.fillColor=B.defaultFillColor,P.setStrokeColor=P.setStrokeColor.bind(P),P.setFillColor=P.setFillColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.setOpacity=P.setOpacity.bind(P),P.createVisual=P.createVisual.bind(P),P.strokePanel=new ye("Line color",ie(B.defaultColorSet,["transparent"]),B.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.fillPanel=new ye("Fill color",ie(B.defaultColorSet,["transparent"]),P.fillColor,Q),P.fillPanel.onColorChanged=P.setFillColor,P.strokeWidthPanel=new re("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new Be("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P.opacityPanel=new z("Opacity",B.defaultOpacitySteps,P.opacity),P.opacityPanel.onOpacityChanged=P.setOpacity,P}return oe(u,D),u.prototype.ownsTarget=function(f){return!(!D.prototype.ownsTarget.call(this,f)&&f!==this.visual)},u.prototype.createVisual=function(){this.visual=X.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)},u.prototype.pointerDown=function(f,C){D.prototype.pointerDown.call(this,f,C),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},u.prototype.manipulate=function(f){D.prototype.manipulate.call(this,f)},u.prototype.resize=function(f){D.prototype.resize.call(this,f),this.setSize()},u.prototype.setSize=function(){D.prototype.setSize.call(this),X.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},u.prototype.pointerUp=function(f){D.prototype.pointerUp.call(this,f),this.setSize()},u.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&X.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},u.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&X.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(f),this.stateChanged()},u.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&X.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},u.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&X.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},u.prototype.setOpacity=function(f){this.opacity=f,this.visual&&X.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},D.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){var C=f;this.fillColor=C.fillColor,this.strokeColor=C.strokeColor,this.strokeWidth=C.strokeWidth,this.strokeDasharray=C.strokeDasharray,this.opacity=C.opacity,this.createVisual(),D.prototype.restoreState.call(this,f),this.setSize()},u.prototype.scale=function(f,C){D.prototype.scale.call(this,f,C),this.setSize()},u.typeName="EllipseMarker",u.title="Ellipse marker",u.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>',u}(ke),xe=function(D){function u(f,C,B){return D.call(this,f,C,B)||this}return oe(u,D),Object.defineProperty(u.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),u.prototype.ownsTarget=function(f){return!(!D.prototype.ownsTarget.call(this,f)&&f!==this.tip1&&f!==this.tip2)},u.prototype.createTips=function(){this.tip1=X.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(X.createTransform()),this.visual.appendChild(this.tip1),this.tip2=X.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(X.createTransform()),this.visual.appendChild(this.tip2)},u.prototype.pointerDown=function(f,C){D.prototype.pointerDown.call(this,f,C),this.state==="creating"&&this.createTips()},u.prototype.adjustVisual=function(){if(D.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(X.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()]]),X.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 f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),C=this.tip1.transform.baseVal.getItem(0);C.setRotate(f,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(C,0);var B=this.tip2.transform.baseVal.getItem(0);B.setRotate(f+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(B,0)}},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=D.prototype.getState.call(this);return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){D.prototype.restoreState.call(this,f),this.createTips(),this.adjustVisual()},u.typeName="MeasurementMarker",u.title="Measurement marker",u.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>',u}(Le),Pe=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.strokePanel.colors=B.defaultColorSet,P.fillColor="transparent",P}return oe(u,D),Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=D.prototype.getState.call(this);return f.typeName=u.typeName,f},u.typeName="EllipseFrameMarker",u.title="Ellipse frame marker",u.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>',u}(fe),Ue=function(){function D(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(D.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),D.prototype.addUndoStep=function(u){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(u)||(this.undoStack.push(u),JSON.stringify(this.lastRedoStep)!==JSON.stringify(u)&&this.redoStack.splice(0,this.redoStack.length))},D.prototype.replaceLastUndoStep=function(u){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=u)},D.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},D.prototype.undo=function(){if(this.undoStack.length>1){var u=this.undoStack.pop();return u!==void 0&&this.redoStack.push(u),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},D.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},D}(),Me=function(D){function u(f,C,B){var P=D.call(this,f,C,B)||this;return P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.curveX=0,P.curveY=0,P.manipulationStartCurveX=0,P.manipulationStartCurveY=0,P.setStrokeColor=P.setStrokeColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.positionGrips=P.positionGrips.bind(P),P.addControlGrips=P.addControlGrips.bind(P),P.adjustVisual=P.adjustVisual.bind(P),P.setupControlBox=P.setupControlBox.bind(P),P.resize=P.resize.bind(P),P.strokeColor=B.defaultColor,P.strokeWidth=B.defaultStrokeWidth,P.strokeDasharray=B.defaultStrokeDasharray,P.strokePanel=new ye("Line color",B.defaultColorSet,B.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new re("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new Be("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return oe(u,D),u.prototype.ownsTarget=function(f){return!(!D.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorCurve&&f!==this.visibleCurve&&!this.curveGrip.ownsTarget(f))},u.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},u.prototype.createVisual=function(){this.visual=X.createGroup(),this.selectorCurve=X.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=X.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)},u.prototype.pointerDown=function(f,C){D.prototype.pointerDown.call(this,f,C),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=f.x,this.curveY=f.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(C)&&(this.activeGrip=this.curveGrip,this._state="resize")},u.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),X.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),X.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),X.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},u.prototype.setupControlBox=function(){D.prototype.setupControlBox.call(this),this.curveControlLine1=X.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=X.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)},u.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,D.prototype.addControlGrips.call(this)},u.prototype.positionGrips=function(){D.prototype.positionGrips.call(this);var f=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-f/2,this.curveY-f/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()))},u.prototype.manipulate=function(f){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+f.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+f.y-this.manipulationStartY),D.prototype.manipulate.call(this,f)},u.prototype.resize=function(f){this.activeGrip===this.curveGrip&&(this.curveX=f.x,this.curveY=f.y),D.prototype.resize.call(this,f),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},u.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},u.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},u.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual()},u.prototype.scale=function(f,C){this.curveX=this.curveX*f,this.curveY=this.curveY*C,D.prototype.scale.call(this,f,C)},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},D.prototype.getState.call(this));return f.typeName=u.typeName,f},u.prototype.restoreState=function(f){D.prototype.restoreState.call(this,f);var C=f;this.strokeColor=C.strokeColor,this.strokeWidth=C.strokeWidth,this.strokeDasharray=C.strokeDasharray,this.curveX=C.curveX,this.curveY=C.curveY,this.createVisual(),this.adjustVisual()},u.typeName="CurveMarker",u.title="Curve marker",u.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>',u}(Ge),Ye=function(){function D(u,f){f===void 0&&(f=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=u,this.cancelable=f}return Object.defineProperty(D.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),D.prototype.preventDefault=function(){this._defaultPrevented=!0},D}(),Qe=function(D){function u(f,C,B){var P=D.call(this,f,!1)||this;return P.dataUrl=C,P.state=B,P}return oe(u,D),u}(Ye),We=function(D){function u(f,C,B){B===void 0&&(B=!1);var P=D.call(this,f,B)||this;return P.marker=C,P}return oe(u,D),u}(Ye),Je=function(){function D(){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 D.prototype.addEventListener=function(u,f){this[u].push(f)},D.prototype.removeEventListener=function(u,f){var C=this[u].indexOf(f);C>-1&&this[u].splice(C,1)},D}(),ot=function(){function D(u){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Re,this._isOpen=!1,this.undoRedoManager=new Ue,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 Je,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=D.instanceCounter++,this.styles=new je(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=u,this.targetRoot=document.body,this.width=u.clientWidth,this.height=u.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(D.prototype,"ALL_MARKER_TYPES",{get:function(){return[Oe,te,ee,Te,Pe,fe,Y,se,xe,K,Le,Me]},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Oe,te,ee,Te,fe,Y,se]},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Oe,te,ee,Te,Y]},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(u){var f=this;this._availableMarkerTypes.splice(0),u.forEach(function(C){if(typeof C=="string"){var B=f.ALL_MARKER_TYPES.find(function(P){return P.typeName===C});B!==void 0&&f._availableMarkerTypes.push(B)}else f._availableMarkerTypes.push(C)})},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(u){this._zoomLevel=u,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(D.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),D.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Se.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},D.prototype.show=function(){var u=this;this.styles.styleSheetRoot===void 0&&Ae.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Ae.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(f){return f(new Ye(u))})},D.prototype.render=function(){return ue(this,void 0,void 0,function(){var u;return de(this,function(f){switch(f.label){case 0:return this.setCurrentMarker(),(u=new Ie).naturalSize=this.renderAtNaturalSize,u.imageType=this.renderImageType,u.imageQuality=this.renderImageQuality,u.markersOnly=this.renderMarkersOnly,u.width=this.renderWidth,u.height=this.renderHeight,[4,u.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return f.sent(),[4,u.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,f.sent()]}})})},D.prototype.close=function(u){var f=this;if(u===void 0&&(u=!1),this.isOpen){var C=!1;u||this.eventListeners.beforeclose.forEach(function(B){var P=new Ye(f,!0);B(P),P.defaultPrevented&&(C=!0)}),C||(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(B){return B(new Ye(f))}),this.detachEvents(),this._isOpen=!1)}},D.prototype.addMarkersToToolbar=function(){for(var u,f=[],C=0;C<arguments.length;C++)f[C]=arguments[C];(u=this._availableMarkerTypes).push.apply(u,f)},D.prototype.addRenderEventListener=function(u){this.addEventListener("render",function(f){u(f.dataUrl,f.state)})},D.prototype.removeRenderEventListener=function(u){},D.prototype.addCloseEventListener=function(u){this.addEventListener("close",function(){u()})},D.prototype.removeCloseEventListener=function(u){},D.prototype.setupResizeObserver=function(){var u=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){u.resize(u.target.clientWidth,u.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return u.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},D.prototype.onPopupTargetResize=function(){var u=1*this.target.clientWidth/this.target.clientHeight,f=this.editorCanvas.clientWidth/u>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*u:this.editorCanvas.clientWidth,C=f<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/u;this.resize(f,C)},D.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},D.prototype.resize=function(u,f){this._isResizing=!0;var C=u/this.imageWidth,B=f/this.imageHeight;this.imageWidth=Math.round(u),this.imageHeight=Math.round(f),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(C,B),this._isResizing=!1},D.prototype.scaleMarkers=function(u,f){var C,B=this;this._currentMarker&&this._currentMarker instanceof Te?this._currentMarker.scale(u,f):(C=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(P){P!==B._currentMarker&&P.scale(u,f)}),C!==void 0&&this.setCurrentMarker(C)},D.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"},D.prototype.setTopLeft=function(){var u=this.editingTarget.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=u.left-f.left,this.top=u.top-f.top},D.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)},D.prototype.addDefs=function(){for(var u,f=[],C=0;C<arguments.length;C++)f[C]=arguments[C];this.defs=X.createDefs(),this.addDefsToImage(),(u=this.defs).append.apply(u,f)},D.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},D.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)},D.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},D.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},D.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)},D.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},D.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)},D.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 u=document.createElement("a");u.href="https://markerjs.com/",u.target="_blank",u.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>',u.title="Powered by marker.js",u.style.display="grid",u.style.alignItems="center",u.style.justifyItems="center",u.style.padding="3px",u.style.width="20px",u.style.height="20px",this.logoUI.appendChild(u),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},D.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")},D.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"},D.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},D.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 u=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=u+"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 we(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 Ee(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},D.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},D.prototype.removeMarker=function(u){this.markerImage.removeChild(u.container),this.markers.indexOf(u)>-1&&this.markers.splice(this.markers.indexOf(u),1),u.dispose()},D.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())},D.prototype.toolbarButtonClicked=function(u,f){if(u==="marker"&&f!==void 0)this.createNewMarker(f);else if(u==="action")switch(f){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()}},D.prototype.deleteSelectedMarker=function(){var u=this;if(this._currentMarker!==void 0){var f=!1;if(this.eventListeners.markerbeforedelete.forEach(function(B){var P=new We(u,u._currentMarker,!0);B(P),P.defaultPrevented&&(f=!0)}),!f){var C=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(B){return B(new We(u,C))})}}},D.prototype.clear=function(){var u=this,f=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(Z){var ge=new We(u,void 0,!0);Z(ge),ge.defaultPrevented&&(f=!0)}),!f)){this.setCurrentMarker();for(var C=function(Z){var ge=B.markers[Z];B.setCurrentMarker(B.markers[Z]),B._currentMarker.dispose(),B.markerImage.removeChild(B._currentMarker.container),B.markers.splice(B.markers.indexOf(B._currentMarker),1),B.eventListeners.markerdelete.forEach(function(Ne){return Ne(new We(u,ge))})},B=this,P=this.markers.length-1;P>=0;P--)C(P);this.addUndoStep()}},Object.defineProperty(D.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),D.prototype.showNotesEditor=function(){var u;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=(u=this._currentMarker.notes)!==null&&u!==void 0?u:"",this.overlayContainer.appendChild(this.notesArea))},D.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)},D.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},D.prototype.addUndoStep=function(){var u=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var f=this.getState(),C=this.undoRedoManager.getLastUndoStep();if(!C||C.width===f.width&&C.height===f.height){var B=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(f),B<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(P){return P(new Ye(u))})}else this.undoRedoManager.replaceLastUndoStep(f),this.eventListeners.statechange.forEach(function(P){return P(new Ye(u))})}},D.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},D.prototype.undoStep=function(){var u=this,f=this.undoRedoManager.undo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(C){return C(new Ye(u))}))},D.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},D.prototype.redoStep=function(){var u=this,f=this.undoRedoManager.redo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(C){return C(new Ye(u))}))},D.prototype.stepZoom=function(){var u=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=u<this.zoomSteps.length-1?this.zoomSteps[u+1]:this.zoomSteps[0]},D.prototype.panTo=function(u){this.contentDiv.scrollBy({left:this.prevPanPoint.x-u.x,top:this.prevPanPoint.y-u.y}),this.prevPanPoint=u},D.prototype.startRenderAndClose=function(){return ue(this,void 0,void 0,function(){var u,f,C=this;return de(this,function(B){switch(B.label){case 0:return[4,this.render()];case 1:return u=B.sent(),f=this.getState(),this.eventListeners.render.forEach(function(P){return P(new Qe(C,u,f))}),this.close(!0),[2]}})})},D.prototype.getState=function(u){u===!0&&this.setCurrentMarker();var f={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(C){return f.markers.push(C.getState())}),f},D.prototype.restoreState=function(u){var f=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);u.markers.forEach(function(C){var B=f._availableMarkerTypes.find(function(Z){return Z.typeName===C.typeName});if(B!==void 0){var P=f.addNewMarker(B);P.restoreState(C),f.markers.push(P)}}),u.width&&u.height&&(u.width!==this.imageWidth||u.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/u.width,this.imageHeight/u.height),this.eventListeners.restorestate.forEach(function(C){return C(new Ye(f))})},D.prototype.addNewMarker=function(u){var f=X.createGroup();return this.markerImage.appendChild(f),new u(f,this.overlayContainer,this.settings)},D.prototype.createNewMarker=function(u){var f,C=this;(f=typeof u=="string"?this._availableMarkerTypes.find(function(B){return B.typeName===u}):u)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(f),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(f.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(B){return B(new We(C,C._currentMarker))}))},D.prototype.markerCreated=function(u){var f=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(u),this.setCurrentMarker(u),u instanceof te&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(te):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(C){return C(new We(f,f._currentMarker))})},D.prototype.colorChanged=function(u){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=u,this.settings.defaultStrokeColor=u)},D.prototype.fillColorChanged=function(u){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=u)},D.prototype.markerStateChanged=function(u){var f=this;this.eventListeners.markerchange.forEach(function(C){return C(new We(f,u))})},D.prototype.setCurrentMarker=function(u){var f=this;this._currentMarker!==u&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(C){return C(new We(f,f._currentMarker))})),this._currentMarker=u,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(C){return C(new We(f,f._currentMarker))}))},D.prototype.onPointerDown=function(u){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||u.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var f=this.markers.find(function(C){return C.ownsTarget(u.target)});f!==void 0?(this.setCurrentMarker(f),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(u.clientX,u.clientY),u.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:u.clientX,y:u.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(u.clientX,u.clientY))},D.prototype.onDblClick=function(u){if(this._isFocused||this.focus(),this.mode==="select"){var f=this.markers.find(function(C){return C.ownsTarget(u.target)});f!==void 0&&f!==this._currentMarker&&this.setCurrentMarker(f),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(u.clientX,u.clientY),u.target):this.setCurrentMarker()}},D.prototype.onPointerMove=function(u){this.touchPoints!==1&&u.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||u.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(u.clientX,u.clientY)):this.zoomLevel>1&&this.panTo({x:u.clientX,y:u.clientY}))},D.prototype.onPointerUp=function(u){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(u.clientX,u.clientY)),this.isDragging=!1,this.addUndoStep()},D.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},D.prototype.onKeyUp=function(u){this._currentMarker===void 0||this.notesArea!==void 0||u.key!=="Delete"&&u.key!=="Backspace"||this.deleteSelectedMarker()},D.prototype.clientToLocalCoordinates=function(u,f){var C=this.markerImage.getBoundingClientRect();return{x:(u-C.left)/this.zoomLevel,y:(f-C.top)/this.zoomLevel}},D.prototype.onWindowResize=function(){this.positionUI()},D.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var u=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=u+"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()},D.prototype.addLicenseKey=function(u){Se.addKey(u)},D.prototype.addEventListener=function(u,f){this.eventListeners.addEventListener(u,f)},D.prototype.removeEventListener=function(u,f){this.eventListeners.removeEventListener(u,f)},D.prototype.renderState=function(u){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(u),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(D.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),D.prototype.focus=function(){var u=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(f){return f(new Ye(u))}))},D.prototype.blur=function(){var u=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(f){return f(new Ye(u))}))},D.instanceCounter=0,D}();/* **********************************
|
|
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 dt=function(D,u){return(dt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,C){f.__proto__=C}||function(f,C){for(var B in C)Object.prototype.hasOwnProperty.call(C,B)&&(f[B]=C[B])})(D,u)};function Ze(D,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");function f(){this.constructor=D}dt(D,u),D.prototype=u===null?Object.create(u):(f.prototype=u.prototype,new f)}function nt(D,u,f,C){return new(f||(f=Promise))(function(B,P){function Z(Ve){try{Ne(C.next(Ve))}catch(_e){P(_e)}}function ge(Ve){try{Ne(C.throw(Ve))}catch(_e){P(_e)}}function Ne(Ve){var _e;Ve.done?B(Ve.value):(_e=Ve.value,_e instanceof f?_e:new f(function(qe){qe(_e)})).then(Z,ge)}Ne((C=C.apply(D,u||[])).next())})}function mt(D,u){var f,C,B,P,Z={label:0,sent:function(){if(1&B[0])throw B[1];return B[1]},trys:[],ops:[]};return P={next:ge(0),throw:ge(1),return:ge(2)},typeof Symbol=="function"&&(P[Symbol.iterator]=function(){return this}),P;function ge(Ne){return function(Ve){return function(_e){if(f)throw new TypeError("Generator is already executing.");for(;Z;)try{if(f=1,C&&(B=2&_e[0]?C.return:_e[0]?C.throw||((B=C.return)&&B.call(C),0):C.next)&&!(B=B.call(C,_e[1])).done)return B;switch(C=0,B&&(_e=[2&_e[0],B.value]),_e[0]){case 0:case 1:B=_e;break;case 4:return Z.label++,{value:_e[1],done:!1};case 5:Z.label++,C=_e[1],_e=[0];continue;case 7:_e=Z.ops.pop(),Z.trys.pop();continue;default:if(!(B=Z.trys,(B=B.length>0&&B[B.length-1])||_e[0]!==6&&_e[0]!==2)){Z=0;continue}if(_e[0]===3&&(!B||_e[1]>B[0]&&_e[1]<B[3])){Z.label=_e[1];break}if(_e[0]===6&&Z.label<B[1]){Z.label=B[1],B=_e;break}if(B&&Z.label<B[2]){Z.label=B[2],Z.ops.push(_e);break}B[2]&&Z.ops.pop(),Z.trys.pop();continue}_e=u.call(D,Z)}catch(qe){_e=[6,qe],C=0}finally{f=B=0}if(5&_e[0])throw _e[1];return{value:_e[0]?_e[1]:void 0,done:!0}}([Ne,Ve])}}}var It=function(){function D(){}return D.addKey=function(u){D.key=u},Object.defineProperty(D,"isLicensed",{get:function(){return!!D.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(D.key)},enumerable:!1,configurable:!0}),D}(),Ce=function(){function D(){}return D.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},D.setAttributes=function(u,f){for(var C=0,B=f;C<B.length;C++){var P=B[C],Z=P[0],ge=P[1];u.setAttribute(Z,ge)}},D.createRect=function(u,f,C){var B=document.createElementNS("http://www.w3.org/2000/svg","rect");return B.setAttribute("width",u.toString()),B.setAttribute("height",f.toString()),C&&D.setAttributes(B,C),B},D.createLine=function(u,f,C,B,P){var Z=document.createElementNS("http://www.w3.org/2000/svg","line");return Z.setAttribute("x1",u.toString()),Z.setAttribute("y1",f.toString()),Z.setAttribute("x2",C.toString()),Z.setAttribute("y2",B.toString()),P&&D.setAttributes(Z,P),Z},D.createPolygon=function(u,f){var C=document.createElementNS("http://www.w3.org/2000/svg","polygon");return C.setAttribute("points",u),f&&D.setAttributes(C,f),C},D.createCircle=function(u,f){var C=document.createElementNS("http://www.w3.org/2000/svg","circle");return C.setAttribute("cx",(u/2).toString()),C.setAttribute("cy",(u/2).toString()),C.setAttribute("r",u.toString()),f&&D.setAttributes(C,f),C},D.createEllipse=function(u,f,C){var B=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return B.setAttribute("cx",(u/2).toString()),B.setAttribute("cy",(f/2).toString()),B.setAttribute("rx",(u/2).toString()),B.setAttribute("ry",(f/2).toString()),C&&D.setAttributes(B,C),B},D.createGroup=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return u&&D.setAttributes(f,u),f},D.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},D.createMarker=function(u,f,C,B,P,Z,ge){var Ne=document.createElementNS("http://www.w3.org/2000/svg","marker");return D.setAttributes(Ne,[["id",u],["orient",f],["markerWidth",C.toString()],["markerHeight",B.toString()],["refX",P.toString()],["refY",Z.toString()]]),Ne.appendChild(ge),Ne},D.createText=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),u&&D.setAttributes(f,u),f},D.createTSpan=function(u,f){var C=document.createElementNS("http://www.w3.org/2000/svg","tspan");return C.textContent=u,f&&D.setAttributes(C,f),C},D.createImage=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return u&&D.setAttributes(f,u),f},D.createPoint=function(u,f){var C=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return C.x=u,C.y=f,C},D.createPath=function(u,f){var C=document.createElementNS("http://www.w3.org/2000/svg","path");return C.setAttribute("d",u),f&&D.setAttributes(C,f),C},D.createElement=function(u,f){var C=document.createElementNS("http://www.w3.org/2000/svg",u);return f&&D.setAttributes(C,f),C},D.getHollowRectanglePath=function(u,f,C,B,P,Z,ge,Ne){return"M"+u+","+f+"V"+(f+B)+"H"+(u+C)+"V"+f+"H"+P+"V"+Z+"H"+(P+ge)+"V"+(Z+Ne)+"H"+P+"V"+f+"Z"},D}(),$e=function(){function D(u){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+u+"_"}return Object.defineProperty(D.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(D.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(D.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),D.prototype.addClass=function(u){return this.styleSheet===void 0&&this.addStyleSheet(),u.name=""+this.classNamePrefix+u.localName,this.classes.push(u),this.styleSheet.sheet.insertRule("."+u.name+" {"+u.style+"}",this.styleSheet.sheet.cssRules.length),u},D.prototype.addRule=function(u){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(u),this.styleSheet.sheet.insertRule(u.selector+" {"+u.style+"}",this.styleSheet.sheet.cssRules.length)},D.prototype.addStyleSheet=function(){var u;this.styleSheet=document.createElement("style"),((u=this.styleSheetRoot)!==null&&u!==void 0?u:document.head).appendChild(this.styleSheet),this.addRule(new rt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new rt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new rt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Xe("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Xe("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},D.prototype.removeStyleSheet=function(){var u;this.styleSheet&&(((u=this.styleSheetRoot)!==null&&u!==void 0?u:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},D}(),rt=function(D,u){this.selector=D,this.style=u},Xe=function(D,u){this.localName=D,this.style=u},et=function(){function D(){this.blocks=[],this.display=""}return D.prototype.addButtonBlock=function(u){u.className=this.blockClassName,u.buttonClassName=this.buttonClassName,u.buttonColorsClassName=this.buttonColorsClassName,u.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(u)},D.prototype.addElementBlock=function(u){u.className===void 0&&(u.className=this.blockClassName),this.blocks.push(u)},D.prototype.getUI=function(){var u=document.createElement("div");return u.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,u.style.display=this.display,this.blocks.forEach(function(f){return u.appendChild(f.getUI())}),u},D}(),lt=function(){function D(){}return D.prototype.getUI=function(){var u=document.createElement("div");if(u.className=this.className,this.minWidth!==void 0&&(u.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":u.style.justifyContent="flex-start";break;case"center":u.style.justifyContent="center";break;case"end":u.style.justifyContent="flex-end"}return u.style.whiteSpace="nowrap",u},D}(),Tt=function(D){function u(){var f=D!==null&&D.apply(this,arguments)||this;return f.buttons=[],f}return Ze(u,D),u.prototype.addButton=function(f){f.className=this.buttonClassName,f.colorsClassName=this.buttonColorsClassName,f.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(f)},u.prototype.getUI=function(){var f=D.prototype.getUI.call(this);return this.buttons.forEach(function(C){return f.appendChild(C.getUI())}),f},u}(lt),at=function(){function D(u,f){this._isActive=!1,this._isHidden=!1,this._icon=u,this.title=f,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(D.prototype,"icon",{get:function(){return this._icon},set:function(u){this._icon=u,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isActive",{get:function(){return this._isActive},set:function(u){this._isActive=u,this.adjustClassName()},enumerable:!1,configurable:!0}),D.prototype.getUI=function(){var u=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 u.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},D.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,"")))},D.prototype.hide=function(){this._isHidden=!0},D}(),it=function(D){function u(){var f=D!==null&&D.apply(this,arguments)||this;return f.elements=[],f}return Ze(u,D),u.prototype.addElement=function(f){this.elements.push(f)},u.prototype.getUI=function(){var f=D.prototype.getUI.call(this);return this.elements.forEach(function(C){return f.appendChild(C)}),f},u}(lt),st=function(){function D(u,f){this.horizontal=u,this.vertical=f}return Object.defineProperty(D.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),D.prototype.getVerticalLength=function(u){return u/this.ratio},D.prototype.getHorizontalLength=function(u){return u*this.ratio},D}(),gt=function(){function D(){}return D.getIcon=function(u,f){if(u>0&&f>0){var C=new st(u,f),B=C.ratio>=1?20:C.getHorizontalLength(20),P=C.ratio<1?20:C.getVerticalLength(20),Z=document.createElementNS("http://www.w3.org/2000/svg","svg");Z.setAttribute("xmlns","http://www.w3.org/2000/svg"),Z.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(Z);var ge=Ce.createDefs();Z.appendChild(ge);var Ne=Ce.createElement("clipPath",[["id","text-bg-clip"]]);ge.appendChild(Ne);var Ve=Ce.createPath(Ce.getHollowRectanglePath((24-B)/2,(24-P)/2,B,P,(24-B)/2+2,(24-P)/2+2,B-4,P-4));Z.appendChild(Ve);var _e=Ce.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);_e.appendChild(Ce.createTSpan(u+":"+f)),Z.appendChild(_e);var qe=_e.getBBox();Ce.setAttributes(_e,[["x",((24-qe.width)/2).toString()],["y",((24-qe.height)/2-qe.y).toString()]]);var _t=Ce.createPath(Ce.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(qe.width))/2,(24-Math.ceil(qe.height))/2,Math.ceil(qe.width),Math.ceil(qe.height)));return Ne.appendChild(_t),Ce.setAttributes(Ve,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(Z),Z.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>'},D}(),bt=function(D){function u(f,C,B){var P=D.call(this,f,C)||this;return P.isDropdownOpen=!1,P.onClick=P.dropdownButtonClicked,P.dropdownButtons=B,P}return Ze(u,D),u.prototype.setupDropdown=function(){var f=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(C){C.className=f.className,C.colorsClassName=f.colorsClassName,f.dropdownBlock.appendChild(C.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},u.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},u.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},u.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},u.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},u.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},u}(at),Rt=function(){function D(u,f){this.GRIP_SIZE=10,this.color=u,this.fillColor=f,this.visual=Ce.createGroup(),this.visual.appendChild(Ce.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Ce.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return D.prototype.ownsTarget=function(u){return u===this.visual||u===this.visual.childNodes[0]||u===this.visual.childNodes[1]},D.prototype.setCenter=function(u,f){this.visual.childNodes.forEach(function(C){return Ce.setAttributes(C,[["cx",u.toString()],["cy",f.toString()]])})},D}(),ct=function(){function D(u,f,C,B){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=u,this.canvasHeight=f,this.margin=C,this.container=B,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(D.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(u){this._aspectRatio=u,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(u){this._isGridVisible=u,this.gridContainer&&Ce.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(u){this._zoomFactor=u,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),D.prototype.open=function(){var u=this;this.cropShadeElement=Ce.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Ce.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var f=0;f<this.numberOfGridLines;f++)this.horizontalGridLines.push(Ce.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Ce.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(C){return u.gridContainer.appendChild(C)}),this.verticalGridLines.forEach(function(C){return u.gridContainer.appendChild(C)}),this.cropRectElement=Ce.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Rt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Rt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Rt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Rt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},D.prototype.setCropRectangle=function(u){this.cropRect=u;var f=Object.assign({},this.cropRect);this.zoomFactor!==1&&(f.width=this.cropRect.width*this.zoomFactor,f.height=this.cropRect.height*this.zoomFactor,f.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-f.width/2,f.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-f.height/2),Ce.setAttributes(this.cropRectElement,[["x",f.x.toString()],["y",f.y.toString()],["width",f.width.toString()],["height",f.height.toString()]]);var C=f.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(P,Z){var ge=f.y+C*(Z+1);Ce.setAttributes(P,[["x1",""+f.x],["y1",""+ge],["x2",""+(f.x+f.width)],["y2",""+ge]])});var B=f.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(P,Z){var ge=f.x+B*(Z+1);Ce.setAttributes(P,[["x1",""+ge],["y1",""+f.y],["x2",""+ge],["y2",""+(f.y+f.height)]])}),Ce.setAttributes(this.cropShadeElement,[["d",Ce.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,f.x,f.y,f.width,f.height)]]),this.topLeftGrip.setCenter(f.x,f.y),this.topRightGrip.setCenter(f.x+f.width,f.y),this.bottomLeftGrip.setCenter(f.x,f.y+f.height),this.bottomRightGrip.setCenter(f.x+f.width,f.y+f.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},D.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)},D.prototype.clientToLocalCoordinates=function(u,f){var C=this.container.getBoundingClientRect();return{x:u-C.left+this.margin,y:f-C.top+this.margin}},D.prototype.onPointerDown=function(u){this.container.setPointerCapture(u.pointerId),this.previousPoint=this.clientToLocalCoordinates(u.clientX,u.clientY),this.cropRectElement===u.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(u.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(u.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(u.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(u.target)&&(this.activeGrip=this.bottomRightGrip)},D.prototype.onPointerMove=function(u){if(this.isMoving)this.move(this.clientToLocalCoordinates(u.clientX,u.clientY));else if(this.activeGrip){var f=this.clientToLocalCoordinates(u.clientX,u.clientY);this.resize(f)}u.preventDefault()},D.prototype.onPointerUp=function(u){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(u.pointerId)},D.prototype.move=function(u){var f=u.x-this.previousPoint.x,C=u.y-this.previousPoint.y;this.zoomFactor!==1&&(f=-f/this.zoomFactor,C=-C/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+f),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+C),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=u},D.prototype.resize=function(u){var f=Object.assign({},this.cropRect),C=u.x-this.previousPoint.x,B=u.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:f.x+C<this.margin&&(C=this.margin-f.x),f.x+=C,f.width=this.cropRect.x+this.cropRect.width-f.x;break;case this.bottomRightGrip:case this.topRightGrip:f.width+C>this.canvasWidth*this.zoomFactor&&(C=this.canvasWidth*this.zoomFactor-f.width),f.width+=C}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(f.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(C),f.height=this.aspectRatio.getVerticalLength(f.width)):(f.y+=B,f.height=this.cropRect.y+this.cropRect.height-f.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?f.height=this.aspectRatio.getVerticalLength(f.width):f.height+=B}f.width<10&&(f.x=this.cropRect.x,f.width=10),f.height<10&&(f.y=this.cropRect.y,f.height=10),this.previousPoint=u,f.x>=this.margin&&f.y>=this.margin&&f.x-this.margin+f.width<=this.canvasWidth&&f.y-this.margin+f.height<=this.canvasHeight&&(this.cropRect=f,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},D.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var u=this.cropRect.x+this.cropRect.width/2,f=this.cropRect.y+this.cropRect.height/2,C=this.aspectRatio.getHorizontalLength(this.cropRect.height),B=this.aspectRatio.getVerticalLength(this.cropRect.width);C/this.canvasWidth<B/this.canvasHeight?this.cropRect.width=C:this.cropRect.height=B,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=u-this.cropRect.width/2,this.cropRect.y=f-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)}},D.prototype.getRescaledRect=function(u,f,C,B,P,Z){var ge=C/u,Ne=B/f;return{x:(P.x-Z)*ge+Z,y:(P.y-Z)*Ne+Z,width:P.width*ge,height:P.height*Ne}},D.prototype.scaleCanvas=function(u,f){var C=this.getRescaledRect(this.canvasWidth,this.canvasHeight,u,f,this.cropRect,this.margin);this.canvasWidth=u,this.canvasHeight=f,this.onCropChange&&this.onCropChange(C),this.setCropRectangle(C)},D}(),Pt=function(){function D(u){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=u,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(D.prototype,"angle",{get:function(){return this._angle},set:function(u){this._angle=u,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),D.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},D.prototype.onPointerDown=function(u){this.controlContainer.setPointerCapture(u.pointerId),this.isDragging=!0,this.previousPoint={x:u.clientX,y:u.clientY}},D.prototype.onPointerMove=function(u){this.isDragging&&(this.onAngleChange&&this.onAngleChange((u.clientX-this.previousPoint.x)/5),this.previousPoint.x=u.clientX)},D.prototype.onPointerUp=function(u){this.isDragging&&this.onAngleChange&&this.onAngleChange((u.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(u.pointerId)},D.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var u=this.angleLabelText.getBBox();Ce.setAttributes(this.angleLabelElement,[["x",((this.width-u.width)/2).toString()],["y",(this.height/2).toString()]])}},D.prototype.positionScaleShape=function(){if(this.scaleShape){var u=this.scaleShape.transform.baseVal.getItem(0);u.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(u,0)}},D.prototype.getVisual=function(){var u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("xmlns","http://www.w3.org/2000/svg"),u.setAttribute("width",this.width+"px"),u.setAttribute("height",this.height+"px"),u.setAttribute("viewBox","0 0 "+this.width+" "+this.height),u.style.flexShrink="0",document.body.appendChild(u);for(var f="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,C=1;C<=this.width/5+10;C++){var B=C%5==0?this.height/3:this.height/6;f+="h4v"+-B+"h1v"+B}f+="v1H0Z",this.scaleShape=Ce.createPath(f);var P=Ce.createTransform();this.scaleShape.transform.baseVal.appendItem(P),u.appendChild(this.scaleShape),this.angleLabelElement=Ce.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Ce.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var Z=Ce.createTSpan("");return Z.innerHTML="°",this.angleLabelElement.appendChild(Z),u.appendChild(this.angleLabelElement),document.body.removeChild(u),u},D}(),Ct=function(){function D(){this.naturalSize=!1,this.imageType="image/png"}return D.prototype.rasterize=function(u,f,C,B,P,Z,ge){var Ne=this;return new Promise(function(Ve){var _e=document.createElement("canvas");_e.width=u.width.baseVal.value-2*B,_e.height=u.height.baseVal.value-2*B;var qe=1,_t=1;Ne.naturalSize===!0?(qe=f.naturalWidth/(u.width.baseVal.value-2*B)/Z,_t=f.naturalHeight/(u.height.baseVal.value-2*B)/ge,_e.width=f.naturalWidth/Z,_e.height=f.naturalHeight/ge):Ne.width!==void 0&&Ne.height!==void 0&&(qe=Ne.width/C.width,_t=Ne.height/C.height,_e.width*=qe,_e.height*=_t);var Et=_e.getContext("2d");Et.translate(_e.width/2,_e.height/2),Et.rotate(P*Math.PI/180),Et.scale(Z,ge),Et.translate(-_e.width/2,-_e.height/2),Et.drawImage(f,0,0,_e.width,_e.height);var Mt=document.createElement("canvas");Mt.width=C.width*qe,Mt.height=C.height*_t,Mt.getContext("2d").putImageData(Et.getImageData((C.x-B)*qe,(C.y-B)*_t,C.width*qe,C.height*_t),0,0),Ve(Mt.toDataURL(Ne.imageType,Ne.imageQuality))})},D}(),ht=function(){function D(u){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=D.instanceCounter++,this.styles=new $e(this.instanceNo),this.target=u,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(D.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(u){this._zoomToCropEnabled=u,u?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(u){this._isGridVisible=u,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"gridLines",{get:function(){return this._gridLines},set:function(u){this._gridLines=u,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(u){this._rotationAngle=u,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"aspectRatio",{get:function(){var u;return(u=this._aspectRatio)!==null&&u!==void 0?u:this.aspectRatios[0]},set:function(u){this._aspectRatio=u},enumerable:!1,configurable:!0}),D.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},D.prototype.show=function(){this.showUI(),this.open()},D.prototype.close=function(u){u===void 0&&(u=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),u||this.closeEventListeners.forEach(function(f){return f()}),this._isOpen=!1)},D.prototype.addRenderEventListener=function(u){this.renderEventListeners.push(u)},D.prototype.removeRenderEventListener=function(u){this.renderEventListeners.indexOf(u)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(u),1)},D.prototype.addCloseEventListener=function(u){this.closeEventListeners.push(u)},D.prototype.removeCloseEventListener=function(u){this.closeEventListeners.indexOf(u)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(u),1)},D.prototype.setupResizeObserver=function(){var u=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){u.resize(u.target.clientWidth,u.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))},D.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var u=1*this.target.clientWidth/this.target.clientHeight,f=this.contentDiv.clientWidth/u>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*u:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,C=f+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/u;this.resize(f,C)}},D.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},D.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",Ce.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},D.prototype.resize=function(u,f){this.imageWidth=Math.round(u),this.imageHeight=Math.round(f),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()},D.prototype.setEditingTarget=function(){var u=document.createElement("canvas");u.width=this.target.naturalWidth,u.height=this.target.naturalHeight,u.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var f=u.toDataURL();Ce.setAttributes(this.editingTarget,[["href",f]]),this.setEditingTargetSize()},D.prototype.setTopLeft=function(){var u=this.target.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=u.left-f.left-this.CANVAS_MARGIN,this.top=u.top-f.top-this.CANVAS_MARGIN},D.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=Ce.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Ce.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Ce.createGroup(),this.editingTargetRotationScaleContainer=Ce.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var u=Ce.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(u);var f=Ce.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(f),this.editingTargetContainer=Ce.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)},D.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},D.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Ce.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new ct(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()},D.prototype.zoomToCrop=function(){if(this.cropRect){var u=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,f=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=u+"px "+f+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-u+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-f+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},D.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)},D.prototype.cropRectChanged=function(u){this.cropRect=u,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},D.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},D.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"},D.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},D.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 u=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,f=this.target.offsetTop>u+this.CANVAS_MARGIN?this.target.offsetTop-(u+this.CANVAS_MARGIN):0;this.coverDiv.style.top=f+"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},D.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},D.prototype.addTopToolbar=function(){var u=this;this.topToolbar=new et,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 f=new Tt;f.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(f);var C=[];this.aspectRatios.forEach(function(_t){var Et=new at(gt.getIcon(_t.horizontal,_t.vertical),_t.horizontal===0&&_t.vertical===0?"FREE":_t.horizontal+":"+_t.vertical);Et.onClick=function(){return u.ratioButtonClicked(_t)},C.push(Et)}),this.aspectRatioButton=new bt(gt.getIcon(0,0),"Aspect ratio",C),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,f.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var B=new at('<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");B.isActive=this.isGridVisible,B.onClick=function(){u.isGridVisible=!u.isGridVisible,B.isActive=u.isGridVisible},f.addButton(B);var P=new at('<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(P.isActive=this.zoomToCropEnabled,P.onClick=function(){u.zoomToCropEnabled=!u.zoomToCropEnabled,P.isActive=u.zoomToCropEnabled},f.addButton(P),!It.isLicensed){var Z=new it;this.topToolbar.addElementBlock(Z);var ge=document.createElement("div");ge.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ne=document.createElement("a");Ne.style.color="currentColor",Ne.href="https://markerjs.com/products/cropro",Ne.target="_blank",Ne.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>',ge.appendChild(Ne),Z.addElement(ge)}var Ve=new Tt;Ve.minWidth=3*this.toolbarHeight+"px",Ve.contentAlign="end",this.topToolbar.addButtonBlock(Ve);var _e=new at('<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");_e.onClick=this.startRenderAndClose,Ve.addButton(_e),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(_e.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var qe=new at('<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");qe.onClick=this.close,Ve.addButton(qe),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(qe.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},D.prototype.addBottomToolbar=function(){var u=this;this.bottomToolbar=new et,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 f=new Tt;f.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(f);var C=new at('<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");C.onClick=this.rotateLeftButtonClicked,f.addButton(C);var B=new at('<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");B.onClick=this.rotateRightButtonClicked,f.addButton(B);var P=new it;P.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(P),this.straightener=new Pt("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(Ve){u.rotateBy(Ve),u.straightener.angle=u.rotationAngle},P.addElement(this.straightener.getUI());var Z=new Tt;Z.minWidth=2*this.toolbarHeight+"px",Z.contentAlign="end",this.bottomToolbar.addButtonBlock(Z);var ge=new at('<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");ge.onClick=this.flipHorizontallyButtonClicked,Z.addButton(ge);var Ne=new at('<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");Ne.onClick=this.flipVerticallyButtonClicked,Z.addButton(Ne)},D.prototype.ratioButtonClicked=function(u){this.aspectRatio=u,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},D.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=gt.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},D.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new st(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},D.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},D.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},D.prototype.restoreState=function(u){if(u){var f=this.cropLayer.getRescaledRect(u.width,u.height,this.imageWidth,this.imageHeight,u.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(f),this.cropRectChanged(f),this.flippedHorizontally=u.flippedHorizontally,this.flippedVertically=u.flippedVertically,this.applyFlip(),this.rotationAngle=u.rotationAngle,this.applyRotation()}},D.prototype.clientToLocalCoordinates=function(u,f){var C=this.cropImage.getBoundingClientRect();return{x:u-C.left,y:f-C.top}},D.prototype.onWindowResize=function(){this.positionUI()},D.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var u=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=u+"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()},D.prototype.rotateLeftButtonClicked=function(){var u=this.rotationAngle-90;this.rotationAngle%90!=0&&(u+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(u)},D.prototype.rotateRightButtonClicked=function(){var u=this.rotationAngle+90;this.rotationAngle%90!=0&&(u-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(u)},D.prototype.rotateTo=function(u){u=(u=u>180?u-360:u)<=-180?u+360:u,this.rotationAngle=u,this.applyRotation()},D.prototype.rotateBy=function(u){this.rotateTo((this.rotationAngle+u)%360)},D.prototype.applyRotation=function(){var u=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var f=this.editingTargetRotationContainer.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(f,0);var C=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/C.width,this.imageHeight/C.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=u},D.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},D.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},D.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},D.prototype.startRenderAndClose=function(){return nt(this,void 0,void 0,function(){var u,f;return mt(this,function(C){switch(C.label){case 0:return[4,this.render()];case 1:return u=C.sent(),f=this.getState(),this.renderEventListeners.forEach(function(B){return B(u,f)}),this.close(!0),[2]}})})},D.prototype.render=function(){return nt(this,void 0,void 0,function(){var u;return mt(this,function(f){switch(f.label){case 0:return(u=new Ct).naturalSize=this.renderAtNaturalSize,u.imageType=this.renderImageType,u.imageQuality=this.renderImageQuality,u.width=this.renderWidth,u.height=this.renderHeight,this.unzoomFromCrop(),Ce.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,u.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 f.sent(),[4,u.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,f.sent()]}})})},D.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Xe("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 Xe("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Xe("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var u=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Xe("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*u)+`px;
|
|
height: `+(this.toolbarHeight-2*u)+`px;
|
|
padding: `+u+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Xe("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Xe("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new rt("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new rt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Xe("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 Xe("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Xe("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 Xe("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*u)+`px;
|
|
padding: `+u+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Xe("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},D.instanceCounter=0,D}(),ze=ne("8hTe"),ft=ne.n(ze),xt=/<pre[^>]*>/g;function St(D){var u=document.createElement("div");return u.innerHTML=D,u.childNodes.length===0?"":u.childNodes[0].nodeValue}var pt=tt.a=function(D){var u=D.value,f=u===void 0?"":u,C=D.edit,B=C===void 0?!1:C,P=D.className,Z=D.showTextOnly,ge=D.showLines,Ne=D.replaces,Ve=D.zoomImg,_e=D.hasMask,qe=D.style,_t=qe===void 0?{}:qe,Et=D.stylesPrev,Mt=Et===void 0?{}:Et,Bt=String(f),Lt=Object(S.useRef)(),Nt=Object(S.useRef)(),Xt=Object(S.useState)(""),zt=Object(F.a)(Xt,2),jt=zt[0],Ft=zt[1],$t=Object(S.useState)("office"),Vt=Object(F.a)($t,2),Qt=Vt[0],Ht=Vt[1],Zt=function(){var yt=new ht(Nt.current);yt.displayMode="popup",yt.addRenderEventListener(function(){var Dt=Object(A.a)(O.a.mark(function vt(kt){var wt;return O.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:return Lt.current.style.display="none",Ot.next=3,Object(he.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:kt}});case 3:wt=Ot.sent,wt!=null&&wt.id&&Ne(Nt.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 Ot.stop()}},vt)}));return function(vt){return Dt.apply(this,arguments)}}()),yt.show()},Jt=function(){var yt=new ot(Nt.current);yt.settings.displayMode="popup",yt.addEventListener("render",function(){var Dt=Object(A.a)(O.a.mark(function vt(kt){var wt;return O.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:if(Lt.current.style.display="none",!Nt.current){Ot.next=6;break}return Ot.next=4,Object(he.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:kt.dataUrl}});case 4:wt=Ot.sent,wt!=null&&wt.id&&Ne(Nt.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 Ot.stop()}},vt)}));return function(vt){return Dt.apply(this,arguments)}}()),yt.show(),window.markerArea=yt},Wt=Object(S.useMemo)(function(){Lt.current&&(Lt.current.style.zIndex=-1);try{var At=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,yt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Dt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Bt=Bt.replace(At,"("+V.a.API_SERVER+"/api/attachments/").replace(yt,'"'+V.a.API_SERVER+"/api/attachments/").replace(Dt,'"'+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(Kt){}var vt=N(Bt),kt=y();if(Bt.match(/\[TOC\]/)&&(vt=vt.replace("<p>[TOC]</p>",E()),T()),vt=vt.replace(/(__special_katext_id_\d+__)/g,function(Kt,Ot){var Yt=kt[Ot],ti=Yt.type,ii=Yt.expression;return Object($.renderToString)(St(ii)||"",{displayMode:ti==="block",throwOnError:!1,output:"html"})}),vt=vt.replace(/▁/g,"\u2581\u2581\u2581"),v(),Z){var wt=document.createElement("div");return wt.innerHTML=vt,wt.innerText}return setTimeout(function(){return qt()},500),vt},[Bt]),Ut=Object(S.useRef)();g.WebkitLineClamp=ge,ge&&(_t=Object(I.a)(Object(I.a)({},_t),g));function Gt(At){var yt=At.target;if(yt.tagName.toUpperCase()==="IMG"){if(Ve){var Dt=yt.getAttribute("src");Ft(Dt),Ht("image")}}else if(yt.tagName.toUpperCase()==="A"){var vt=yt.getAttribute("href");if(vt.indexOf("office")>-1)At.preventDefault(),Ft(vt),Ht("office");else if(vt.indexOf("application/pdf")>-1)At.preventDefault(),Ft(vt),Ht("pdf");else if(vt.indexOf("text/html")>-1)At.preventDefault(),Ft(vt),Ht("html");else if(vt.startsWith("#")){At.preventDefault();var kt=document.getElementById(vt.replace("#",""));kt&&kt.scrollIntoView(!0)}}}var qt=function(){var yt,Dt=(yt=Ut.current)===null||yt===void 0?void 0:yt.querySelectorAll("video");Dt==null||Dt.forEach(function(vt){if(vt.oncontextmenu=function(){return!1},vt.src.indexOf(".m3u8")>-1&&!vt.canPlayType("application/vnd.apple.mpegurl")){if(H.a.isSupported()){var kt=new H.a;kt.loadSource(vt.src),kt.attachMedia(vt)}}})};Object(S.useEffect)(function(){if(Ut.current&&Wt&&(Wt.match(xt)&&window.PR.prettyPrint()),Ut.current)return Ut.current.addEventListener("click",Gt),function(){Ut.current.removeEventListener("click",Gt),v(),T()}},[Wt,Ut.current,Gt]);var ei=function(yt){if(!B)return;yt.target.nodeName==="IMG"?(Lt.current.style.zIndex=1,Lt.current.style.display="flex",Lt.current.style.width=yt.target.clientWidth+"px",Lt.current.style.height=yt.target.clientHeight+"px",Lt.current.style.top=yt.target.offsetTop+"px",Lt.current.style.left=yt.target.offsetLeft+"px",Nt.current.src=yt.target.getAttribute("src")):Lt.current.style.display="none"};return m.a.createElement("div",{style:{position:"relative"}},m.a.createElement("div",{ref:Ut,style:Object(I.a)({},_t),className:"".concat(P||""," markdown-body ").concat(ft.a.mdBody),onMouseOver:ei,dangerouslySetInnerHTML:{__html:Wt}}),m.a.createElement("div",{ref:Lt,className:ft.a.button},m.a.createElement(W.a,null,m.a.createElement(j.a,{onClick:function(){return Zt()}},"\u88C1\u526A"),m.a.createElement(j.a,{onClick:function(){return Jt()}},"\u7F16\u8F91"))),m.a.createElement("img",{ref:Nt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),m.a.createElement(q.a,{close:!0,data:jt,type:jt!=null&&jt.length?Qt:"",style:Object(I.a)({},Mt),onClose:function(){return Ft("")}}))}},BU3w:function(ut,tt,ne){"use strict";ne.d(tt,"a",function(){return A});var ce=ne("MNnm"),W="rc-util-key";function w(F){if(F.attachTo)return F.attachTo;var M=document.querySelector("head");return M||document.body}function j(F){var M,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ce.a)())return null;var S=document.createElement("style");if((M=O.csp)===null||M===void 0?void 0:M.nonce){var m;S.nonce=(m=O.csp)===null||m===void 0?void 0:m.nonce}S.innerHTML=F;var p=w(O),o=p.firstChild;return O.prepend&&p.prepend?p.prepend(S):O.prepend&&o?p.insertBefore(S,o):p.appendChild(S),S}var I=new Map;function A(F,M){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=w(O);if(!I.has(S)){var m=j("",O),p=m.parentNode;I.set(S,p),p.removeChild(m)}var o=Array.from(I.get(S).children).find(function(e){return e.tagName==="STYLE"&&e[W]===M});if(o){var a,n;if(((a=O.csp)===null||a===void 0?void 0:a.nonce)&&o.nonce!==((n=O.csp)===null||n===void 0?void 0:n.nonce)){var l;o.nonce=(l=O.csp)===null||l===void 0?void 0:l.nonce}return o.innerHTML!==F&&(o.innerHTML=F),o}var s=j(F,O);return s[W]=M,s}},DlQD:function(ut,tt,ne){(function(ce,W){ut.exports=W()})(this,function(){"use strict";function ce(te,J){for(var ee=0;ee<J.length;ee++){var K=J[ee];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(te,K.key,K)}}function W(te,J,ee){return J&&ce(te.prototype,J),ee&&ce(te,ee),te}function w(te,J){if(!te)return;if(typeof te=="string")return j(te,J);var ee=Object.prototype.toString.call(te).slice(8,-1);if(ee==="Object"&&te.constructor&&(ee=te.constructor.name),ee==="Map"||ee==="Set")return Array.from(te);if(ee==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ee))return j(te,J)}function j(te,J){(J==null||J>te.length)&&(J=te.length);for(var ee=0,K=new Array(J);ee<J;ee++)K[ee]=te[ee];return K}function I(te,J){var ee;if(typeof Symbol=="undefined"||te[Symbol.iterator]==null){if(Array.isArray(te)||(ee=w(te))||J&&te&&typeof te.length=="number"){ee&&(te=ee);var K=0;return function(){return K>=te.length?{done:!0}:{done:!1,value:te[K++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ee=te[Symbol.iterator](),ee.next.bind(ee)}function A(te,J){return J={exports:{}},te(J,J.exports),J.exports}var F=A(function(te){function J(){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 ee(K){te.exports.defaults=K}te.exports={defaults:J(),getDefaults:J,changeDefaults:ee}}),M=F.defaults,O=F.getDefaults,S=F.changeDefaults,m=/[&<>"']/,p=/[&<>"']/g,o=/[<>"']|&(?!#?\w+;)/,a=/[<>"']|&(?!#?\w+;)/g,n={"&":"&","<":"<",">":">",'"':""","'":"'"},l=function(J){return n[J]};function s(te,J){if(J){if(m.test(te))return te.replace(p,l)}else if(o.test(te))return te.replace(a,l);return te}var e=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function t(te){return te.replace(e,function(J,ee){return ee=ee.toLowerCase(),ee==="colon"?":":ee.charAt(0)==="#"?ee.charAt(1)==="x"?String.fromCharCode(parseInt(ee.substring(2),16)):String.fromCharCode(+ee.substring(1)):""})}var r=/(^|[^\[])\^/g;function T(te,J){te=te.source||te,J=J||"";var ee={replace:function(z,Y){return Y=Y.source||Y,Y=Y.replace(r,"$1"),te=te.replace(z,Y),ee},getRegex:function(){return new RegExp(te,J)}};return ee}var g=/[^\w:]/g,_=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function E(te,J,ee){if(te){var K;try{K=decodeURIComponent(t(ee)).replace(g,"").toLowerCase()}catch(z){return null}if(K.indexOf("javascript:")===0||K.indexOf("vbscript:")===0||K.indexOf("data:")===0)return null}J&&!_.test(ee)&&(ee=h(J,ee));try{ee=encodeURI(ee).replace(/%25/g,"%")}catch(z){return null}return ee}var b={},c=/^[^:]+:\/*[^/]*$/,i=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function h(te,J){b[" "+te]||(c.test(te)?b[" "+te]=te+"/":b[" "+te]=k(te,"/",!0)),te=b[" "+te];var ee=te.indexOf(":")===-1;return J.substring(0,2)==="//"?ee?J:te.replace(i,"$1")+J:J.charAt(0)==="/"?ee?J:te.replace(d,"$1")+J:te+J}var y={exec:function(){}};function v(te){for(var J=1,ee,K;J<arguments.length;J++){ee=arguments[J];for(K in ee)Object.prototype.hasOwnProperty.call(ee,K)&&(te[K]=ee[K])}return te}function x(te,J){var ee=te.replace(/\|/g,function(Y,Q,se){for(var fe=!1,xe=Q;--xe>=0&&se[xe]==="\\";)fe=!fe;return fe?"|":" |"}),K=ee.split(/ \|/),z=0;if(K.length>J)K.splice(J);else for(;K.length<J;)K.push("");for(;z<K.length;z++)K[z]=K[z].trim().replace(/\\\|/g,"|");return K}function k(te,J,ee){var K=te.length;if(K===0)return"";for(var z=0;z<K;){var Y=te.charAt(K-z-1);if(Y===J&&!ee)z++;else if(Y!==J&&ee)z++;else break}return te.substr(0,K-z)}function R(te,J){if(te.indexOf(J[1])===-1)return-1;for(var ee=te.length,K=0,z=0;z<ee;z++)if(te[z]==="\\")z++;else if(te[z]===J[0])K++;else if(te[z]===J[1]&&(K--,K<0))return z;return-1}function U(te){te&&te.sanitize&&!te.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 N={escape:s,unescape:t,edit:T,cleanUrl:E,resolveUrl:h,noopTest:y,merge:v,splitCells:x,rtrim:k,findClosingBracket:R,checkSanitizeDeprecation:U},G=F.defaults,L=N.rtrim,H=N.splitCells,V=N.escape,$=N.findClosingBracket;function q(te,J,ee){var K=J.href,z=J.title?V(J.title):null,Y=te[1].replace(/\\([\[\]])/g,"$1");return te[0].charAt(0)!=="!"?{type:"link",raw:ee,href:K,title:z,text:Y}:{type:"image",raw:ee,href:K,title:z,text:V(Y)}}function he(te,J){var ee=te.match(/^(\s+)(?:```)/);if(ee===null)return J;var K=ee[1];return J.split(`
|
|
`).map(function(z){var Y=z.match(/^\s+/);if(Y===null)return z;var Q=Y[0];return Q.length>=K.length?z.slice(K.length):z}).join(`
|
|
`)}var ae=function(){function te(ee){this.options=ee||G}var J=te.prototype;return J.space=function(K){var z=this.rules.block.newline.exec(K);if(z)return z[0].length>1?{type:"space",raw:z[0]}:{raw:`
|
|
`}},J.code=function(K,z){var Y=this.rules.block.code.exec(K);if(Y){var Q=z[z.length-1];if(Q&&Q.type==="paragraph")return{raw:Y[0],text:Y[0].trimRight()};var se=Y[0].replace(/^ {4}/gm,"");return{type:"code",raw:Y[0],codeBlockStyle:"indented",text:this.options.pedantic?se:L(se,`
|
|
`)}}},J.fences=function(K){var z=this.rules.block.fences.exec(K);if(z){var Y=z[0],Q=he(Y,z[3]||"");return{type:"code",raw:Y,lang:z[2]?z[2].trim():z[2],text:Q}}},J.heading=function(K){var z=this.rules.block.heading.exec(K);if(z)return{type:"heading",raw:z[0],depth:z[1].length,text:z[2]}},J.nptable=function(K){var z=this.rules.block.nptable.exec(K);if(z){var Y={type:"table",header:H(z[1].replace(/^ *| *\| *$/g,"")),align:z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:z[3]?z[3].replace(/\n$/,"").split(`
|
|
`):[],raw:z[0]};if(Y.header.length===Y.align.length){var Q=Y.align.length,se;for(se=0;se<Q;se++)/^ *-+: *$/.test(Y.align[se])?Y.align[se]="right":/^ *:-+: *$/.test(Y.align[se])?Y.align[se]="center":/^ *:-+ *$/.test(Y.align[se])?Y.align[se]="left":Y.align[se]=null;for(Q=Y.cells.length,se=0;se<Q;se++)Y.cells[se]=H(Y.cells[se],Y.header.length);return Y}}},J.hr=function(K){var z=this.rules.block.hr.exec(K);if(z)return{type:"hr",raw:z[0]}},J.blockquote=function(K){var z=this.rules.block.blockquote.exec(K);if(z){var Y=z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:z[0],text:Y}}},J.list=function(K){var z=this.rules.block.list.exec(K);if(z){for(var Y=z[0],Q=z[2],se=Q.length>1,fe=Q[Q.length-1]===")",xe={type:"list",raw:Y,ordered:se,start:se?+Q.slice(0,-1):"",loose:!1,items:[]},Pe=z[0].match(this.rules.block.item),Ue=!1,Me,Ye,Qe,We,Je,ot,dt,Ze=Pe.length,nt=0;nt<Ze;nt++)Me=Pe[nt],Y=Me,Ye=Me.length,Me=Me.replace(/^ *([*+-]|\d+[.)]) */,""),~Me.indexOf(`
|
|
`)&&(Ye-=Me.length,Me=this.options.pedantic?Me.replace(/^ {1,4}/gm,""):Me.replace(new RegExp("^ {1,"+Ye+"}","gm"),"")),nt!==Ze-1&&(Qe=this.rules.block.bullet.exec(Pe[nt+1])[0],(se?Qe.length===1||!fe&&Qe[Qe.length-1]===")":Qe.length>1||this.options.smartLists&&Qe!==Q)&&(We=Pe.slice(nt+1).join(`
|
|
`),xe.raw=xe.raw.substring(0,xe.raw.length-We.length),nt=Ze-1)),Je=Ue||/\n\n(?!\s*$)/.test(Me),nt!==Ze-1&&(Ue=Me.charAt(Me.length-1)===`
|
|
`,Je||(Je=Ue)),Je&&(xe.loose=!0),ot=/^\[[ xX]\] /.test(Me),dt=void 0,ot&&(dt=Me[1]!==" ",Me=Me.replace(/^\[[ xX]\] +/,"")),xe.items.push({type:"list_item",raw:Y,task:ot,checked:dt,loose:Je,text:Me});return xe}},J.html=function(K){var z=this.rules.block.html.exec(K);if(z)return{type:this.options.sanitize?"paragraph":"html",raw:z[0],pre:!this.options.sanitizer&&(z[1]==="pre"||z[1]==="script"||z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(z[0]):V(z[0]):z[0]}},J.def=function(K){var z=this.rules.block.def.exec(K);if(z){z[3]&&(z[3]=z[3].substring(1,z[3].length-1));var Y=z[1].toLowerCase().replace(/\s+/g," ");return{tag:Y,raw:z[0],href:z[2],title:z[3]}}},J.table=function(K){var z=this.rules.block.table.exec(K);if(z){var Y={type:"table",header:H(z[1].replace(/^ *| *\| *$/g,"")),align:z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:z[3]?z[3].replace(/\n$/,"").split(`
|
|
`):[]};if(Y.header.length===Y.align.length){Y.raw=z[0];var Q=Y.align.length,se;for(se=0;se<Q;se++)/^ *-+: *$/.test(Y.align[se])?Y.align[se]="right":/^ *:-+: *$/.test(Y.align[se])?Y.align[se]="center":/^ *:-+ *$/.test(Y.align[se])?Y.align[se]="left":Y.align[se]=null;for(Q=Y.cells.length,se=0;se<Q;se++)Y.cells[se]=H(Y.cells[se].replace(/^ *\| *| *\| *$/g,""),Y.header.length);return Y}}},J.lheading=function(K){var z=this.rules.block.lheading.exec(K);if(z)return{type:"heading",raw:z[0],depth:z[2].charAt(0)==="="?1:2,text:z[1]}},J.paragraph=function(K){var z=this.rules.block.paragraph.exec(K);if(z)return{type:"paragraph",raw:z[0],text:z[1].charAt(z[1].length-1)===`
|
|
`?z[1].slice(0,-1):z[1]}},J.text=function(K,z){var Y=this.rules.block.text.exec(K);if(Y){var Q=z[z.length-1];return Q&&Q.type==="text"?{raw:Y[0],text:Y[0]}:{type:"text",raw:Y[0],text:Y[0]}}},J.escape=function(K){var z=this.rules.inline.escape.exec(K);if(z)return{type:"escape",raw:z[0],text:V(z[1])}},J.tag=function(K,z,Y){var Q=this.rules.inline.tag.exec(K);if(Q)return!z&&/^<a /i.test(Q[0])?z=!0:z&&/^<\/a>/i.test(Q[0])&&(z=!1),!Y&&/^<(pre|code|kbd|script)(\s|>)/i.test(Q[0])?Y=!0:Y&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(Q[0])&&(Y=!1),{type:this.options.sanitize?"text":"html",raw:Q[0],inLink:z,inRawBlock:Y,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):V(Q[0]):Q[0]}},J.link=function(K){var z=this.rules.inline.link.exec(K);if(z){var Y=$(z[2],"()");if(Y>-1){var Q=z[0].indexOf("!")===0?5:4,se=Q+z[1].length+Y;z[2]=z[2].substring(0,Y),z[0]=z[0].substring(0,se).trim(),z[3]=""}var fe=z[2],xe="";if(this.options.pedantic){var Pe=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(fe);Pe?(fe=Pe[1],xe=Pe[3]):xe=""}else xe=z[3]?z[3].slice(1,-1):"";fe=fe.trim().replace(/^<([\s\S]*)>$/,"$1");var Ue=q(z,{href:fe&&fe.replace(this.rules.inline._escapes,"$1"),title:xe&&xe.replace(this.rules.inline._escapes,"$1")},z[0]);return Ue}},J.reflink=function(K,z){var Y;if((Y=this.rules.inline.reflink.exec(K))||(Y=this.rules.inline.nolink.exec(K))){var Q=(Y[2]||Y[1]).replace(/\s+/g," ");if(Q=z[Q.toLowerCase()],!Q||!Q.href){var se=Y[0].charAt(0);return{type:"text",raw:se,text:se}}var fe=q(Y,Q,Y[0]);return fe}},J.strong=function(K,z,Y){Y===void 0&&(Y="");var Q=this.rules.inline.strong.start.exec(K);if(Q&&(!Q[1]||Q[1]&&(Y===""||this.rules.inline.punctuation.exec(Y)))){z=z.slice(-1*K.length);var se=Q[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;se.lastIndex=0;for(var fe;(Q=se.exec(z))!=null;)if(fe=this.rules.inline.strong.middle.exec(z.slice(0,Q.index+3)),fe)return{type:"strong",raw:K.slice(0,fe[0].length),text:K.slice(2,fe[0].length-2)}}},J.em=function(K,z,Y){Y===void 0&&(Y="");var Q=this.rules.inline.em.start.exec(K);if(Q&&(!Q[1]||Q[1]&&(Y===""||this.rules.inline.punctuation.exec(Y)))){z=z.slice(-1*K.length);var se=Q[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;se.lastIndex=0;for(var fe;(Q=se.exec(z))!=null;)if(fe=this.rules.inline.em.middle.exec(z.slice(0,Q.index+2)),fe)return{type:"em",raw:K.slice(0,fe[0].length),text:K.slice(1,fe[0].length-1)}}},J.codespan=function(K){var z=this.rules.inline.code.exec(K);if(z){var Y=z[2].replace(/\n/g," "),Q=/[^ ]/.test(Y),se=Y.startsWith(" ")&&Y.endsWith(" ");return Q&&se&&(Y=Y.substring(1,Y.length-1)),Y=V(Y,!0),{type:"codespan",raw:z[0],text:Y}}},J.br=function(K){var z=this.rules.inline.br.exec(K);if(z)return{type:"br",raw:z[0]}},J.del=function(K){var z=this.rules.inline.del.exec(K);if(z)return{type:"del",raw:z[0],text:z[1]}},J.autolink=function(K,z){var Y=this.rules.inline.autolink.exec(K);if(Y){var Q,se;return Y[2]==="@"?(Q=V(this.options.mangle?z(Y[1]):Y[1]),se="mailto:"+Q):(Q=V(Y[1]),se=Q),{type:"link",raw:Y[0],text:Q,href:se,tokens:[{type:"text",raw:Q,text:Q}]}}},J.url=function(K,z){var Y;if(Y=this.rules.inline.url.exec(K)){var Q,se;if(Y[2]==="@")Q=V(this.options.mangle?z(Y[0]):Y[0]),se="mailto:"+Q;else{var fe;do fe=Y[0],Y[0]=this.rules.inline._backpedal.exec(Y[0])[0];while(fe!==Y[0]);Q=V(Y[0]),Y[1]==="www."?se="http://"+Q:se=Q}return{type:"link",raw:Y[0],text:Q,href:se,tokens:[{type:"text",raw:Q,text:Q}]}}},J.inlineText=function(K,z,Y){var Q=this.rules.inline.text.exec(K);if(Q){var se;return z?se=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):V(Q[0]):Q[0]:se=V(this.options.smartypants?Y(Q[0]):Q[0]),{type:"text",raw:Q[0],text:se}}},te}(),oe=N.noopTest,ue=N.edit,de=N.merge,ie={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:oe,table:oe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=ue(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=ue(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=ue(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ie._comment=/<!--(?!-?>)[\s\S]*?-->/,ie.html=ue(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=ue(ie._paragraph).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.blockquote=ue(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=de({},ie),ie.gfm=de({},ie.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ie.gfm.nptable=ue(ie.gfm.nptable).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.gfm.table=ue(ie.gfm.table).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.pedantic=de({},ie.normal,{html:ue(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:oe,paragraph:ue(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var X={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:oe,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:oe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};X._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",X.punctuation=ue(X.punctuation).replace(/punctuation/g,X._punctuation).getRegex(),X._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",X._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",X.em.start=ue(X.em.start).replace(/punctuation/g,X._punctuation).getRegex(),X.em.middle=ue(X.em.middle).replace(/punctuation/g,X._punctuation).replace(/overlapSkip/g,X._overlapSkip).getRegex(),X.em.endAst=ue(X.em.endAst,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.em.endUnd=ue(X.em.endUnd,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.strong.start=ue(X.strong.start).replace(/punctuation/g,X._punctuation).getRegex(),X.strong.middle=ue(X.strong.middle).replace(/punctuation/g,X._punctuation).replace(/blockSkip/g,X._blockSkip).getRegex(),X.strong.endAst=ue(X.strong.endAst,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.strong.endUnd=ue(X.strong.endUnd,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.blockSkip=ue(X._blockSkip,"g").getRegex(),X.overlapSkip=ue(X._overlapSkip,"g").getRegex(),X._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,X._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,X._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])?)+(?![-_])/,X.autolink=ue(X.autolink).replace("scheme",X._scheme).replace("email",X._email).getRegex(),X._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,X.tag=ue(X.tag).replace("comment",ie._comment).replace("attribute",X._attribute).getRegex(),X._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,X._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,X._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,X.link=ue(X.link).replace("label",X._label).replace("href",X._href).replace("title",X._title).getRegex(),X.reflink=ue(X.reflink).replace("label",X._label).getRegex(),X.reflinkSearch=ue(X.reflinkSearch,"g").replace("reflink",X.reflink).replace("nolink",X.nolink).getRegex(),X.normal=de({},X),X.pedantic=de({},X.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:ue(/^!?\[(label)\]\((.*?)\)/).replace("label",X._label).getRegex(),reflink:ue(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",X._label).getRegex()}),X.gfm=de({},X.normal,{escape:ue(X.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),X.gfm.url=ue(X.gfm.url,"i").replace("email",X.gfm._extended_email).getRegex(),X.breaks=de({},X.gfm,{br:ue(X.br).replace("{2,}","*").getRegex(),text:ue(X.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Se={block:ie,inline:X},Ie=F.defaults,Ae=Se.block,je=Se.inline;function He(te){return te.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 pe(te){var J="",ee,K,z=te.length;for(ee=0;ee<z;ee++)K=te.charCodeAt(ee),Math.random()>.5&&(K="x"+K.toString(16)),J+="&#"+K+";";return J}var we=function(){function te(ee){this.tokens=[],this.tokens.links=Object.create(null),this.options=ee||Ie,this.options.tokenizer=this.options.tokenizer||new ae,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var K={block:Ae.normal,inline:je.normal};this.options.pedantic?(K.block=Ae.pedantic,K.inline=je.pedantic):this.options.gfm&&(K.block=Ae.gfm,this.options.breaks?K.inline=je.breaks:K.inline=je.gfm),this.tokenizer.rules=K}te.lex=function(K,z){var Y=new te(z);return Y.lex(K)};var J=te.prototype;return J.lex=function(K){return K=K.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(K,this.tokens,!0),this.inline(this.tokens),this.tokens},J.blockTokens=function(K,z,Y){z===void 0&&(z=[]),Y===void 0&&(Y=!0),K=K.replace(/^ +$/gm,"");for(var Q,se,fe,xe;K;){if(Q=this.tokenizer.space(K)){K=K.substring(Q.raw.length),Q.type&&z.push(Q);continue}if(Q=this.tokenizer.code(K,z)){K=K.substring(Q.raw.length),Q.type?z.push(Q):(xe=z[z.length-1],xe.raw+=`
|
|
`+Q.raw,xe.text+=`
|
|
`+Q.text);continue}if(Q=this.tokenizer.fences(K)){K=K.substring(Q.raw.length),z.push(Q);continue}if(Q=this.tokenizer.heading(K)){K=K.substring(Q.raw.length),z.push(Q);continue}if(Q=this.tokenizer.nptable(K)){K=K.substring(Q.raw.length),z.push(Q);continue}if(Q=this.tokenizer.hr(K)){K=K.substring(Q.raw.length),z.push(Q);continue}if(Q=this.tokenizer.blockquote(K)){K=K.substring(Q.raw.length),Q.tokens=this.blockTokens(Q.text,[],Y),z.push(Q);continue}if(Q=this.tokenizer.list(K)){for(K=K.substring(Q.raw.length),fe=Q.items.length,se=0;se<fe;se++)Q.items[se].tokens=this.blockTokens(Q.items[se].text,[],!1);z.push(Q);continue}if(Q=this.tokenizer.html(K)){K=K.substring(Q.raw.length),z.push(Q);continue}if(Y&&(Q=this.tokenizer.def(K))){K=K.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(K)){K=K.substring(Q.raw.length),z.push(Q);continue}if(Q=this.tokenizer.lheading(K)){K=K.substring(Q.raw.length),z.push(Q);continue}if(Y&&(Q=this.tokenizer.paragraph(K))){K=K.substring(Q.raw.length),z.push(Q);continue}if(Q=this.tokenizer.text(K,z)){K=K.substring(Q.raw.length),Q.type?z.push(Q):(xe=z[z.length-1],xe.raw+=`
|
|
`+Q.raw,xe.text+=`
|
|
`+Q.text);continue}if(K){var Pe="Infinite loop on byte: "+K.charCodeAt(0);if(this.options.silent){console.error(Pe);break}else throw new Error(Pe)}}return z},J.inline=function(K){var z,Y,Q,se,fe,xe,Pe=K.length;for(z=0;z<Pe;z++){xe=K[z];switch(xe.type){case"paragraph":case"text":case"heading":{xe.tokens=[],this.inlineTokens(xe.text,xe.tokens);break}case"table":{for(xe.tokens={header:[],cells:[]},se=xe.header.length,Y=0;Y<se;Y++)xe.tokens.header[Y]=[],this.inlineTokens(xe.header[Y],xe.tokens.header[Y]);for(se=xe.cells.length,Y=0;Y<se;Y++)for(fe=xe.cells[Y],xe.tokens.cells[Y]=[],Q=0;Q<fe.length;Q++)xe.tokens.cells[Y][Q]=[],this.inlineTokens(fe[Q],xe.tokens.cells[Y][Q]);break}case"blockquote":{this.inline(xe.tokens);break}case"list":{for(se=xe.items.length,Y=0;Y<se;Y++)this.inline(xe.items[Y].tokens);break}}}return K},J.inlineTokens=function(K,z,Y,Q,se){z===void 0&&(z=[]),Y===void 0&&(Y=!1),Q===void 0&&(Q=!1),se===void 0&&(se="");var fe,xe=K,Pe;if(this.tokens.links){var Ue=Object.keys(this.tokens.links);if(Ue.length>0)for(;(Pe=this.tokenizer.rules.inline.reflinkSearch.exec(xe))!=null;)Ue.includes(Pe[0].slice(Pe[0].lastIndexOf("[")+1,-1))&&(xe=xe.slice(0,Pe.index)+"["+"a".repeat(Pe[0].length-2)+"]"+xe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Pe=this.tokenizer.rules.inline.blockSkip.exec(xe))!=null;)xe=xe.slice(0,Pe.index)+"["+"a".repeat(Pe[0].length-2)+"]"+xe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;K;){if(fe=this.tokenizer.escape(K)){K=K.substring(fe.raw.length),z.push(fe);continue}if(fe=this.tokenizer.tag(K,Y,Q)){K=K.substring(fe.raw.length),Y=fe.inLink,Q=fe.inRawBlock,z.push(fe);continue}if(fe=this.tokenizer.link(K)){K=K.substring(fe.raw.length),fe.type==="link"&&(fe.tokens=this.inlineTokens(fe.text,[],!0,Q)),z.push(fe);continue}if(fe=this.tokenizer.reflink(K,this.tokens.links)){K=K.substring(fe.raw.length),fe.type==="link"&&(fe.tokens=this.inlineTokens(fe.text,[],!0,Q)),z.push(fe);continue}if(fe=this.tokenizer.strong(K,xe,se)){K=K.substring(fe.raw.length),fe.tokens=this.inlineTokens(fe.text,[],Y,Q),z.push(fe);continue}if(fe=this.tokenizer.em(K,xe,se)){K=K.substring(fe.raw.length),fe.tokens=this.inlineTokens(fe.text,[],Y,Q),z.push(fe);continue}if(fe=this.tokenizer.codespan(K)){K=K.substring(fe.raw.length),z.push(fe);continue}if(fe=this.tokenizer.br(K)){K=K.substring(fe.raw.length),z.push(fe);continue}if(fe=this.tokenizer.del(K)){K=K.substring(fe.raw.length),fe.tokens=this.inlineTokens(fe.text,[],Y,Q),z.push(fe);continue}if(fe=this.tokenizer.autolink(K,pe)){K=K.substring(fe.raw.length),z.push(fe);continue}if(!Y&&(fe=this.tokenizer.url(K,pe))){K=K.substring(fe.raw.length),z.push(fe);continue}if(fe=this.tokenizer.inlineText(K,Q,He)){K=K.substring(fe.raw.length),se=fe.raw.slice(-1),z.push(fe);continue}if(K){var Me="Infinite loop on byte: "+K.charCodeAt(0);if(this.options.silent){console.error(Me);break}else throw new Error(Me)}}return z},W(te,null,[{key:"rules",get:function(){return{block:Ae,inline:je}}}]),te}(),Ee=F.defaults,me=N.cleanUrl,ye=N.escape,ve=function(){function te(ee){this.options=ee||Ee}var J=te.prototype;return J.code=function(K,z,Y){var Q=(z||"").match(/\S*/)[0];if(this.options.highlight){var se=this.options.highlight(K,Q);se!=null&&se!==K&&(Y=!0,K=se)}return Q?'<pre><code class="'+this.options.langPrefix+ye(Q,!0)+'">'+(Y?K:ye(K,!0))+`</code></pre>
|
|
`:"<pre><code>"+(Y?K:ye(K,!0))+`</code></pre>
|
|
`},J.blockquote=function(K){return`<blockquote>
|
|
`+K+`</blockquote>
|
|
`},J.html=function(K){return K},J.heading=function(K,z,Y,Q){return this.options.headerIds?"<h"+z+' id="'+this.options.headerPrefix+Q.slug(Y)+'">'+K+"</h"+z+`>
|
|
`:"<h"+z+">"+K+"</h"+z+`>
|
|
`},J.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},J.list=function(K,z,Y){var Q=z?"ol":"ul",se=z&&Y!==1?' start="'+Y+'"':"";return"<"+Q+se+`>
|
|
`+K+"</"+Q+`>
|
|
`},J.listitem=function(K){return"<li>"+K+`</li>
|
|
`},J.checkbox=function(K){return"<input "+(K?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},J.paragraph=function(K){return"<p>"+K+`</p>
|
|
`},J.table=function(K,z){return z&&(z="<tbody>"+z+"</tbody>"),`<table>
|
|
<thead>
|
|
`+K+`</thead>
|
|
`+z+`</table>
|
|
`},J.tablerow=function(K){return`<tr>
|
|
`+K+`</tr>
|
|
`},J.tablecell=function(K,z){var Y=z.header?"th":"td",Q=z.align?"<"+Y+' align="'+z.align+'">':"<"+Y+">";return Q+K+"</"+Y+`>
|
|
`},J.strong=function(K){return"<strong>"+K+"</strong>"},J.em=function(K){return"<em>"+K+"</em>"},J.codespan=function(K){return"<code>"+K+"</code>"},J.br=function(){return this.options.xhtml?"<br/>":"<br>"},J.del=function(K){return"<del>"+K+"</del>"},J.link=function(K,z,Y){if(K=me(this.options.sanitize,this.options.baseUrl,K),K===null)return Y;var Q='<a href="'+ye(K)+'"';return z&&(Q+=' title="'+z+'"'),Q+=">"+Y+"</a>",Q},J.image=function(K,z,Y){if(K=me(this.options.sanitize,this.options.baseUrl,K),K===null)return Y;var Q='<img src="'+K+'" alt="'+Y+'"';return z&&(Q+=' title="'+z+'"'),Q+=this.options.xhtml?"/>":">",Q},J.text=function(K){return K},te}(),be=function(){function te(){}var J=te.prototype;return J.strong=function(K){return K},J.em=function(K){return K},J.codespan=function(K){return K},J.del=function(K){return K},J.html=function(K){return K},J.text=function(K){return K},J.link=function(K,z,Y){return""+Y},J.image=function(K,z,Y){return""+Y},J.br=function(){return""},te}(),Ke=function(){function te(){this.seen={}}var J=te.prototype;return J.slug=function(K){var z=K.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(z)){var Y=z;do this.seen[Y]++,z=Y+"-"+this.seen[Y];while(this.seen.hasOwnProperty(z))}return this.seen[z]=0,z},te}(),De=F.defaults,ke=N.unescape,Fe=function(){function te(ee){this.options=ee||De,this.options.renderer=this.options.renderer||new ve,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new be,this.slugger=new Ke}te.parse=function(K,z){var Y=new te(z);return Y.parse(K)};var J=te.prototype;return J.parse=function(K,z){z===void 0&&(z=!0);var Y="",Q,se,fe,xe,Pe,Ue,Me,Ye,Qe,We,Je,ot,dt,Ze,nt,mt,It,Ce,$e=K.length;for(Q=0;Q<$e;Q++){We=K[Q];switch(We.type){case"space":continue;case"hr":{Y+=this.renderer.hr();continue}case"heading":{Y+=this.renderer.heading(this.parseInline(We.tokens),We.depth,ke(this.parseInline(We.tokens,this.textRenderer)),this.slugger);continue}case"code":{Y+=this.renderer.code(We.text,We.lang,We.escaped);continue}case"table":{for(Ye="",Me="",xe=We.header.length,se=0;se<xe;se++)Me+=this.renderer.tablecell(this.parseInline(We.tokens.header[se]),{header:!0,align:We.align[se]});for(Ye+=this.renderer.tablerow(Me),Qe="",xe=We.cells.length,se=0;se<xe;se++){for(Ue=We.tokens.cells[se],Me="",Pe=Ue.length,fe=0;fe<Pe;fe++)Me+=this.renderer.tablecell(this.parseInline(Ue[fe]),{header:!1,align:We.align[fe]});Qe+=this.renderer.tablerow(Me)}Y+=this.renderer.table(Ye,Qe);continue}case"blockquote":{Qe=this.parse(We.tokens),Y+=this.renderer.blockquote(Qe);continue}case"list":{for(Je=We.ordered,ot=We.start,dt=We.loose,xe=We.items.length,Qe="",se=0;se<xe;se++)nt=We.items[se],mt=nt.checked,It=nt.task,Ze="",nt.task&&(Ce=this.renderer.checkbox(mt),dt?nt.tokens.length>0&&nt.tokens[0].type==="text"?(nt.tokens[0].text=Ce+" "+nt.tokens[0].text,nt.tokens[0].tokens&&nt.tokens[0].tokens.length>0&&nt.tokens[0].tokens[0].type==="text"&&(nt.tokens[0].tokens[0].text=Ce+" "+nt.tokens[0].tokens[0].text)):nt.tokens.unshift({type:"text",text:Ce}):Ze+=Ce),Ze+=this.parse(nt.tokens,dt),Qe+=this.renderer.listitem(Ze,It,mt);Y+=this.renderer.list(Qe,Je,ot);continue}case"html":{Y+=this.renderer.html(We.text);continue}case"paragraph":{Y+=this.renderer.paragraph(this.parseInline(We.tokens));continue}case"text":{for(Qe=We.tokens?this.parseInline(We.tokens):We.text;Q+1<$e&&K[Q+1].type==="text";)We=K[++Q],Qe+=`
|
|
`+(We.tokens?this.parseInline(We.tokens):We.text);Y+=z?this.renderer.paragraph(Qe):Qe;continue}default:{var rt='Token with "'+We.type+'" type was not found.';if(this.options.silent){console.error(rt);return}else throw new Error(rt)}}}return Y},J.parseInline=function(K,z){z=z||this.renderer;var Y="",Q,se,fe=K.length;for(Q=0;Q<fe;Q++){se=K[Q];switch(se.type){case"escape":{Y+=z.text(se.text);break}case"html":{Y+=z.html(se.text);break}case"link":{Y+=z.link(se.href,se.title,this.parseInline(se.tokens,z));break}case"image":{Y+=z.image(se.href,se.title,se.text);break}case"strong":{Y+=z.strong(this.parseInline(se.tokens,z));break}case"em":{Y+=z.em(this.parseInline(se.tokens,z));break}case"codespan":{Y+=z.codespan(se.text);break}case"br":{Y+=z.br();break}case"del":{Y+=z.del(this.parseInline(se.tokens,z));break}case"text":{Y+=z.text(se.text);break}default:{var xe='Token with "'+se.type+'" type was not found.';if(this.options.silent){console.error(xe);return}else throw new Error(xe)}}}return Y},te}(),re=N.merge,Be=N.checkSanitizeDeprecation,Oe=N.escape,Re=F.getDefaults,Ge=F.changeDefaults,Le=F.defaults;function le(te,J,ee){if(typeof te=="undefined"||te===null)throw new Error("marked(): input parameter is undefined or null");if(typeof te!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(te)+", string expected");if(typeof J=="function"&&(ee=J,J=null),J=re({},le.defaults,J||{}),Be(J),ee){var K=J.highlight,z;try{z=we.lex(te,J)}catch(fe){return ee(fe)}var Y=function(xe){var Pe;if(!xe)try{Pe=Fe.parse(z,J)}catch(Ue){xe=Ue}return J.highlight=K,xe?ee(xe):ee(null,Pe)};if(!K||K.length<3)return Y();if(delete J.highlight,!z.length)return Y();var Q=0;le.walkTokens(z,function(fe){fe.type==="code"&&(Q++,setTimeout(function(){K(fe.text,fe.lang,function(xe,Pe){if(xe)return Y(xe);Pe!=null&&Pe!==fe.text&&(fe.text=Pe,fe.escaped=!0),Q--,Q===0&&Y()})},0))}),Q===0&&Y();return}try{var se=we.lex(te,J);return J.walkTokens&&le.walkTokens(se,J.walkTokens),Fe.parse(se,J)}catch(fe){if(fe.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,J.silent)return"<p>An error occurred:</p><pre>"+Oe(fe.message+"",!0)+"</pre>";throw fe}}le.options=le.setOptions=function(te){return re(le.defaults,te),Ge(le.defaults),le},le.getDefaults=Re,le.defaults=Le,le.use=function(te){var J=re({},te);if(te.renderer&&function(){var K=le.defaults.renderer||new ve,z=function(se){var fe=K[se];K[se]=function(){for(var xe=arguments.length,Pe=new Array(xe),Ue=0;Ue<xe;Ue++)Pe[Ue]=arguments[Ue];var Me=te.renderer[se].apply(K,Pe);return Me===!1&&(Me=fe.apply(K,Pe)),Me}};for(var Y in te.renderer)z(Y);J.renderer=K}(),te.tokenizer&&function(){var K=le.defaults.tokenizer||new ae,z=function(se){var fe=K[se];K[se]=function(){for(var xe=arguments.length,Pe=new Array(xe),Ue=0;Ue<xe;Ue++)Pe[Ue]=arguments[Ue];var Me=te.tokenizer[se].apply(K,Pe);return Me===!1&&(Me=fe.apply(K,Pe)),Me}};for(var Y in te.tokenizer)z(Y);J.tokenizer=K}(),te.walkTokens){var ee=le.defaults.walkTokens;J.walkTokens=function(K){te.walkTokens(K),ee&&ee(K)}}le.setOptions(J)},le.walkTokens=function(te,J){for(var ee=I(te),K;!(K=ee()).done;){var z=K.value;J(z);switch(z.type){case"table":{for(var Y=I(z.tokens.header),Q;!(Q=Y()).done;){var se=Q.value;le.walkTokens(se,J)}for(var fe=I(z.tokens.cells),xe;!(xe=fe()).done;)for(var Pe=xe.value,Ue=I(Pe),Me;!(Me=Ue()).done;){var Ye=Me.value;le.walkTokens(Ye,J)}break}case"list":{le.walkTokens(z.items,J);break}default:z.tokens&&le.walkTokens(z.tokens,J)}}},le.Parser=Fe,le.parser=Fe.parse,le.Renderer=ve,le.TextRenderer=be,le.Lexer=we,le.lexer=we.lex,le.Tokenizer=ae,le.Slugger=Ke,le.parse=le;var Te=le;return Te})},LdHM:function(ut,tt,ne){"use strict";ne.d(tt,"b",function(){return r}),ne.d(tt,"a",function(){return g});var ce=ne("1OyB"),W=ne("vuIU"),w=ne("Ji7U"),j=ne("LK+K"),I=ne("q1tI"),A=ne("rePB"),F=ne("Ff2n"),M=ne("ODXe"),O=ne("4IlW"),S=ne("bX4T"),m=ne("YrtM"),p=ne("TSYQ"),o=ne.n(p),a=ne("+nKL"),n=ne("8OUc"),l=function(H,V){var $=H.prefixCls,q=H.id,he=H.flattenOptions,ae=H.childrenAsData,oe=H.values,ue=H.searchValue,de=H.multiple,ie=H.defaultActiveFirstOption,X=H.height,Se=H.itemHeight,Ie=H.notFoundContent,Ae=H.open,je=H.menuItemSelectedIcon,He=H.virtual,pe=H.onSelect,we=H.onToggleOpen,Ee=H.onActiveValue,me=H.onScroll,ye=H.onMouseEnter,ve="".concat($,"-item"),be=Object(m.a)(function(){return he},[Ae,he],function(Te,te){return te[0]&&Te[1]!==te[1]}),Ke=I.useRef(null),De=function(te){te.preventDefault()},ke=function(te){Ke.current&&Ke.current.scrollTo({index:te})},Fe=function(te){for(var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ee=be.length,K=0;K<ee;K+=1){var z=(te+K*J+ee)%ee,Y=be[z],Q=Y.group,se=Y.data;if(!Q&&!se.disabled)return z}return-1},re=I.useState(function(){return Fe(0)}),Be=Object(M.a)(re,2),Oe=Be[0],Re=Be[1],Ge=function(te){Re(te);var J=be[te];if(!J){Ee(null,-1);return}Ee(J.data.value,te)};I.useEffect(function(){Ge(ie!==!1?Fe(0):-1)},[be.length,ue]),I.useEffect(function(){var Te=setTimeout(function(){if(!de&&Ae&&oe.size===1){var te=Array.from(oe)[0],J=be.findIndex(function(ee){var K=ee.data;return K.value===te});Ge(J),ke(J)}});return function(){return clearTimeout(Te)}},[Ae]);var Le=function(te){te!==void 0&&pe(te,{selected:!oe.has(te)}),de||we(!1)};if(I.useImperativeHandle(V,function(){return{onKeyDown:function(te){var J=te.which;switch(J){case O.a.UP:case O.a.DOWN:{var ee=0;if(J===O.a.UP?ee=-1:J===O.a.DOWN&&(ee=1),ee!==0){var K=Fe(Oe+ee,ee);ke(K),Ge(K)}break}case O.a.ENTER:{var z=be[Oe];z&&!z.data.disabled?Le(z.data.value):Le(void 0),Ae&&te.preventDefault();break}case O.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(te){ke(te)}}}),be.length===0)return I.createElement("div",{role:"listbox",id:"".concat(q,"_list"),className:"".concat(ve,"-empty"),onMouseDown:De},Ie);function le(Te){var te=be[Te];if(!te)return null;var J=te.data||{},ee=J.value,K=J.label,z=J.children,Y=Object(S.a)(J,!0),Q=ae?z:K;return te?I.createElement("div",Object.assign({"aria-label":typeof Q=="string"?Q:null},Y,{key:Te,role:"option",id:"".concat(q,"_list_").concat(Te),"aria-selected":oe.has(ee)}),ee):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(q,"_list"),style:{height:0,width:0,overflow:"hidden"}},le(Oe-1),le(Oe),le(Oe+1)),I.createElement(a.a,{itemKey:"key",ref:Ke,data:be,height:X,itemHeight:Se,fullHeight:!1,onMouseDown:De,onScroll:me,virtual:He,onMouseEnter:ye},function(Te,te){var J,ee=Te.group,K=Te.groupOption,z=Te.data,Y=z.label,Q=z.key;if(ee)return I.createElement("div",{className:o()(ve,"".concat(ve,"-group"))},Y!==void 0?Y:Q);var se=z.disabled,fe=z.value,xe=z.title,Pe=z.children,Ue=z.style,Me=z.className,Ye=Object(F.a)(z,["disabled","value","title","children","style","className"]),Qe=oe.has(fe),We="".concat(ve,"-option"),Je=o()(ve,We,Me,(J={},Object(A.a)(J,"".concat(We,"-grouped"),K),Object(A.a)(J,"".concat(We,"-active"),Oe===te&&!se),Object(A.a)(J,"".concat(We,"-disabled"),se),Object(A.a)(J,"".concat(We,"-selected"),Qe),J)),ot=ae?Pe:Y,dt=!je||typeof je=="function"||Qe;return I.createElement("div",Object.assign({},Ye,{"aria-selected":Qe,className:Je,title:xe,onMouseMove:function(){if(Oe===te||se)return;Ge(te)},onClick:function(){se||Le(fe)},style:Ue}),I.createElement("div",{className:"".concat(We,"-content")},ot||fe),I.isValidElement(je)||Qe,dt&&I.createElement(n.a,{className:"".concat(ve,"-option-state"),customizeIcon:je,customizeIconProps:{isSelected:Qe}},Qe?"\u2713":null))}))},s=I.forwardRef(l);s.displayName="OptionList";var e=s,t=function(){return null};t.isSelectOption=!0;var r=t,T=function(){return null};T.isSelectOptGroup=!0;var g=T,_=ne("VTBJ"),E=ne("Zm9Q");function b(L){var H=L.key,V=L.props,$=V.children,q=V.value,he=Object(F.a)(V,["children","value"]);return Object(_.a)({key:H,value:q!==void 0?q:H,children:$},he)}function c(L){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(E.a)(L).map(function(V,$){if(!I.isValidElement(V)||!V.type)return null;var q=V.type.isSelectOptGroup,he=V.key,ae=V.props,oe=ae.children,ue=Object(F.a)(ae,["children"]);return H||!q?b(V):Object(_.a)(Object(_.a)({key:"__RC_SELECT_GRP__".concat(he===null?$:he,"__"),label:he},ue),{},{options:c(oe)})}).filter(function(V){return V})}var i=ne("2Qr1"),d=ne("qNPg"),h=ne("U8pU"),y=ne("Kwbf"),v=ne("WKfj");function x(L){var H=L.mode,V=L.options,$=L.children,q=L.backfill,he=L.allowClear,ae=L.placeholder,oe=L.getInputElement,ue=L.showSearch,de=L.onSearch,ie=L.defaultOpen,X=L.autoFocus,Se=L.labelInValue,Ie=L.value,Ae=L.inputValue,je=L.optionLabelProp,He=H==="multiple"||H==="tags",pe=ue!==void 0?ue:He||H==="combobox",we=V||c($);if(Object(y.a)(H!=="tags"||we.every(function(ve){return!ve.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var Ee=we.some(function(ve){return ve.options?ve.options.some(function(be){return typeof("value"in be?be.value:be.key)=="number"}):typeof("value"in ve?ve.value:ve.key)=="number"});Object(y.a)(!Ee,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(y.a)(H!=="combobox"||!je,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(y.a)(H==="combobox"||!q,"`backfill` only works with `combobox` mode."),Object(y.a)(H==="combobox"||!oe,"`getInputElement` only work with `combobox` mode."),Object(y.b)(H!=="combobox"||!oe||!he||!ae,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),de&&!pe&&H!=="combobox"&&H!=="tags"&&Object(y.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(y.b)(!ie||X,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Ie!=null){var me=Object(v.d)(Ie);Object(y.a)(!Se||me.every(function(ve){return Object(h.a)(ve)==="object"&&("key"in ve||"value"in ve)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(y.a)(!He||Array.isArray(Ie),"`value` should be array when `mode` is `multiple` or `tags`")}if($){var ye=null;Object(E.a)($).some(function(ve){if(!I.isValidElement(ve)||!ve.type)return!1;var be=ve.type;if(be.isSelectOption)return!1;if(be.isSelectOptGroup){var Ke=Object(E.a)(ve.props.children).every(function(De){return!I.isValidElement(De)||!ve.type||De.type.isSelectOption?!0:(ye=De.type,!1)});return!Ke}return ye=be,!0}),ye&&Object(y.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ye.displayName||ye.name||ye,"`.")),Object(y.a)(Ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var k=x,R=Object(d.a)({prefixCls:"rc-select",components:{optionList:e},convertChildrenToData:c,flattenOptions:i.d,getLabeledValue:i.e,filterOptions:i.b,isValueDisabled:i.g,findValueOption:i.c,warningProps:k,fillOptionsWithMissingValue:i.a}),U=function(L){Object(w.a)(V,L);var H=Object(j.a)(V);function V(){var $;return Object(ce.a)(this,V),$=H.apply(this,arguments),$.selectRef=I.createRef(),$.focus=function(){$.selectRef.current.focus()},$.blur=function(){$.selectRef.current.blur()},$}return Object(W.a)(V,[{key:"render",value:function(){return I.createElement(R,Object.assign({ref:this.selectRef},this.props))}}]),V}(I.Component);U.Option=r,U.OptGroup=g;var N=U,G=tt.c=N},SJMd:function(ut,tt){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var ne,ce,W,w=!1,j,I;window.PR_SHOULD_USE_CONTINUATION=!0;var A,F;(function(){var M=window,O=["break,continue,do,else,for,if,return,while"],S=[O,"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"],p=[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"],o=[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"],n="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",l=[m,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",e=[O,"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=[O,"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=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[p,a,o,l,s,e,t,r],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,_="str",E="kwd",b="com",c="typ",i="lit",d="pun",h="pln",y="tag",v="dec",x="src",k="atn",R="atv",U="nocode",N="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(pe){for(var we=0,Ee=!1,me=!1,ye=0,ve=pe.length;ye<ve;++ye){var be=pe[ye];if(be.ignoreCase)me=!0;else if(/[a-z]/i.test(be.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ee=!0,me=!1;break}}var Ke={b:8,t:9,n:10,v:11,f:12,r:13};function De(Oe){var Re=Oe.charCodeAt(0);if(Re!==92)return Re;var Ge=Oe.charAt(1);return Re=Ke[Ge],Re||("0"<=Ge&&Ge<="7"?parseInt(Oe.substring(1),8):Ge==="u"||Ge==="x"?parseInt(Oe.substring(2),16):Oe.charCodeAt(1))}function ke(Oe){if(Oe<32)return(Oe<16?"\\x0":"\\x")+Oe.toString(16);var Re=String.fromCharCode(Oe);return Re==="\\"||Re==="-"||Re==="]"||Re==="^"?"\\"+Re:Re}function Fe(Oe){var Re=Oe.substring(1,Oe.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")),Ge=[],Le=Re[0]==="^",le=["["];Le&&le.push("^");for(var Te=Le?1:0,te=Re.length;Te<te;++Te){var J=Re[Te];if(/\\[bdsw]/i.test(J))le.push(J);else{var ee=De(J),K;Te+2<te&&Re[Te+1]==="-"?(K=De(Re[Te+2]),Te+=2):K=ee,Ge.push([ee,K]),K<65||ee>122||(K<65||ee>90||Ge.push([Math.max(65,ee)|32,Math.min(K,90)|32]),K<97||ee>122||Ge.push([Math.max(97,ee)&~32,Math.min(K,122)&~32]))}}Ge.sort(function(se,fe){return se[0]-fe[0]||fe[1]-se[1]});for(var z=[],Y=[],Te=0;Te<Ge.length;++Te){var Q=Ge[Te];Q[0]<=Y[1]+1?Y[1]=Math.max(Y[1],Q[1]):z.push(Y=Q)}for(var Te=0;Te<z.length;++Te){var Q=z[Te];le.push(ke(Q[0])),Q[1]>Q[0]&&(Q[1]+1>Q[0]&&le.push("-"),le.push(ke(Q[1])))}return le.push("]"),le.join("")}function re(Oe){for(var Re=Oe.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")),Ge=Re.length,Le=[],le=0,Te=0;le<Ge;++le){var te=Re[le];if(te==="(")++Te;else if(te.charAt(0)==="\\"){var J=+te.substring(1);J&&(J<=Te?Le[J]=-1:Re[le]=ke(J))}}for(var le=1;le<Le.length;++le)Le[le]===-1&&(Le[le]=++we);for(var le=0,Te=0;le<Ge;++le){var te=Re[le];if(te==="(")++Te,Le[Te]||(Re[le]="(?:");else if(te.charAt(0)==="\\"){var J=+te.substring(1);J&&J<=Te&&(Re[le]="\\"+Le[J])}}for(var le=0;le<Ge;++le)Re[le]==="^"&&Re[le+1]!=="^"&&(Re[le]="");if(Oe.ignoreCase&&Ee)for(var le=0;le<Ge;++le){var te=Re[le],ee=te.charAt(0);te.length>=2&&ee==="["?Re[le]=Fe(te):ee!=="\\"&&(Re[le]=te.replace(/[a-zA-Z]/g,function(Y){var Q=Y.charCodeAt(0);return"["+String.fromCharCode(Q&~32,Q|32)+"]"}))}return Re.join("")}for(var Be=[],ye=0,ve=pe.length;ye<ve;++ye){var be=pe[ye];if(be.global||be.multiline)throw new Error(""+be);Be.push("(?:"+re(be)+")")}return new RegExp(Be.join("|"),me?"gi":"g")}function L(pe,we){var Ee=/(?:^|\s)nocode(?:\s|$)/,me=[],ye=0,ve=[],be=0;function Ke(De){var ke=De.nodeType;if(ke==1){if(Ee.test(De.className))return;for(var Fe=De.firstChild;Fe;Fe=Fe.nextSibling)Ke(Fe);var re=De.nodeName.toLowerCase();(re==="br"||re==="li")&&(me[be]=`
|
|
`,ve[be<<1]=ye++,ve[be++<<1|1]=De)}else if(ke==3||ke==4){var Be=De.nodeValue;Be.length&&(we?Be=Be.replace(/\r\n?/g,`
|
|
`):Be=Be.replace(/[ \t\r\n]+/g," "),me[be]=Be,ve[be<<1]=ye,ye+=Be.length,ve[be++<<1|1]=De)}}return Ke(pe),{sourceCode:me.join("").replace(/\n$/,""),spans:ve}}function H(pe,we,Ee,me,ye){if(!Ee)return;var ve={sourceNode:pe,pre:1,langExtension:null,numberLines:null,sourceCode:Ee,spans:null,basePos:we,decorations:null};me(ve),ye.push.apply(ye,ve.decorations)}var V=/\S/;function $(pe){for(var we=void 0,Ee=pe.firstChild;Ee;Ee=Ee.nextSibling){var me=Ee.nodeType;we=me===1?we?pe:Ee:me===3&&V.test(Ee.nodeValue)?pe:we}return we===pe?void 0:we}function q(pe,we){var Ee={},me;(function(){for(var be=pe.concat(we),Ke=[],De={},ke=0,Fe=be.length;ke<Fe;++ke){var re=be[ke],Be=re[3];if(Be)for(var Oe=Be.length;--Oe>=0;)Ee[Be.charAt(Oe)]=re;var Re=re[1],Ge=""+Re;De.hasOwnProperty(Ge)||(Ke.push(Re),De[Ge]=null)}Ke.push(/[\0-\uffff]/),me=G(Ke)})();var ye=we.length,ve=function(be){for(var Ke=be.sourceCode,De=be.basePos,ke=be.sourceNode,Fe=[De,h],re=0,Be=Ke.match(me)||[],Oe={},Re=0,Ge=Be.length;Re<Ge;++Re){var Le=Be[Re],le=Oe[Le],Te=void 0,te;if(typeof le=="string")te=!1;else{var J=Ee[Le.charAt(0)];if(J)Te=Le.match(J[1]),le=J[0];else{for(var ee=0;ee<ye;++ee)if(J=we[ee],Te=Le.match(J[1]),Te){le=J[0];break}Te||(le=h)}te=le.length>=5&&le.substring(0,5)==="lang-",te&&!(Te&&typeof Te[1]=="string")&&(te=!1,le=x),te||(Oe[Le]=le)}var K=re;if(re+=Le.length,!te)Fe.push(De+K,le);else{var z=Te[1],Y=Le.indexOf(z),Q=Y+z.length;Te[2]&&(Q=Le.length-Te[2].length,Y=Q-z.length);var se=le.substring(5);H(ke,De+K,Le.substring(0,Y),ve,Fe),H(ke,De+K+Y,z,X(se,z),Fe),H(ke,De+K+Q,Le.substring(Q),ve,Fe)}}be.decorations=Fe};return ve}function he(pe){var we=[],Ee=[];pe.tripleQuotedStrings?we.push([_,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):pe.multiLineStrings?we.push([_,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([_,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),pe.verbatimStrings&&Ee.push([_,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var me=pe.hashComments;me&&(pe.cStyleComments?(me>1?we.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ee.push([_,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([b,/^#[^\r\n]*/,null,"#"])),pe.cStyleComments&&(Ee.push([b,/^\/\/[^\r\n]*/,null]),Ee.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ye=pe.regexLiterals;if(ye){var ve=ye>1?"":`
|
|
\r`,be=ve?".":"[\\S\\s]",Ke="/(?=[^/*"+ve+"])(?:[^/\\x5B\\x5C"+ve+"]|\\x5C"+be+"|\\x5B(?:[^\\x5C\\x5D"+ve+"]|\\x5C"+be+")*(?:\\x5D|$))+/";Ee.push(["lang-regex",RegExp("^"+N+"("+Ke+")")])}var De=pe.types;De&&Ee.push([c,De]);var ke=(""+pe.keywords).replace(/^ | $/g,"");ke.length&&Ee.push([E,new RegExp("^(?:"+ke.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([h,/^\s+/,null,` \r
|
|
\xA0`]);var Fe="^.[^\\s\\w.$@'\"`/\\\\]*";return pe.regexLiterals&&(Fe+="(?!s*/)"),Ee.push([i,/^@[a-z_$][a-z_$@0-9]*/i,null],[c,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[h,/^[a-z_$][a-z_$@0-9]*/i,null],[i,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[h,/^\\[\s\S]?/,null],[d,new RegExp(Fe),null]),q(we,Ee)}var ae=he({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function oe(pe,we,Ee){for(var me=/(?:^|\s)nocode(?:\s|$)/,ye=/\r\n?|\n/,ve=pe.ownerDocument,be=ve.createElement("li");pe.firstChild;)be.appendChild(pe.firstChild);var Ke=[be];function De(Re){var Ge=Re.nodeType;if(Ge==1&&!me.test(Re.className))if(Re.nodeName==="br")ke(Re),Re.parentNode&&Re.parentNode.removeChild(Re);else for(var Le=Re.firstChild;Le;Le=Le.nextSibling)De(Le);else if((Ge==3||Ge==4)&&Ee){var le=Re.nodeValue,Te=le.match(ye);if(Te){var te=le.substring(0,Te.index);Re.nodeValue=te;var J=le.substring(Te.index+Te[0].length);if(J){var ee=Re.parentNode;ee.insertBefore(ve.createTextNode(J),Re.nextSibling)}ke(Re),te||Re.parentNode.removeChild(Re)}}}function ke(Re){for(;!Re.nextSibling;)if(Re=Re.parentNode,!Re)return;function Ge(Te,te){var J=te?Te.cloneNode(!1):Te,ee=Te.parentNode;if(ee){var K=Ge(ee,1),z=Te.nextSibling;K.appendChild(J);for(var Y=z;Y;Y=z)z=Y.nextSibling,K.appendChild(Y)}return J}for(var Le=Ge(Re.nextSibling,0),le;(le=Le.parentNode)&&le.nodeType===1;)Le=le;Ke.push(Le)}for(var Fe=0;Fe<Ke.length;++Fe)De(Ke[Fe]);we===(we|0)&&Ke[0].setAttribute("value",we);var re=ve.createElement("ol");re.className="linenums";for(var Be=Math.max(0,we-1|0)||0,Fe=0,Oe=Ke.length;Fe<Oe;++Fe)be=Ke[Fe],be.className="L"+(Fe+Be)%10,be.firstChild||be.appendChild(ve.createTextNode("\xA0")),re.appendChild(be);pe.appendChild(re)}function ue(pe){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var Ee=/\n/g,me=pe.sourceCode,ye=me.length,ve=0,be=pe.spans,Ke=be.length,De=0,ke=pe.decorations,Fe=ke.length,re=0;ke[Fe]=ye;var Be,Oe;for(Oe=Be=0;Oe<Fe;)ke[Oe]!==ke[Oe+2]?(ke[Be++]=ke[Oe++],ke[Be++]=ke[Oe++]):Oe+=2;for(Fe=Be,Oe=Be=0;Oe<Fe;){for(var Re=ke[Oe],Ge=ke[Oe+1],Le=Oe+2;Le+2<=Fe&&ke[Le+1]===Ge;)Le+=2;ke[Be++]=Re,ke[Be++]=Ge,Oe=Le}Fe=ke.length=Be;var le=pe.sourceNode,Te="";le&&(Te=le.style.display,le.style.display="none");try{for(var te=null;De<Ke;){var J=be[De],ee=be[De+2]||ye,K=ke[re+2]||ye,Le=Math.min(ee,K),z=be[De+1],Y;if(z.nodeType!==1&&(Y=me.substring(ve,Le))){we&&(Y=Y.replace(Ee,"\r")),z.nodeValue=Y;var Q=z.ownerDocument,se=Q.createElement("span");se.className=ke[re+1];var fe=z.parentNode;fe.replaceChild(se,z),se.appendChild(z),ve<ee&&(be[De+1]=z=Q.createTextNode(me.substring(Le,ee)),fe.insertBefore(z,se.nextSibling))}ve=Le,ve>=ee&&(De+=2),ve>=K&&(re+=2)}}finally{le&&(le.style.display=Te)}}var de={};function ie(pe,we){for(var Ee=we.length;--Ee>=0;){var me=we[Ee];de.hasOwnProperty(me)?M.console&&console.warn("cannot override language handler %s",me):de[me]=pe}}function X(pe,we){return pe&&de.hasOwnProperty(pe)||(pe=/^\s*</.test(we)?"default-markup":"default-code"),de[pe]}ie(ae,["default-code"]),ie(q([],[[h,/^[^<?]+/],[v,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ie(q([[h,/^[\s]+/,null,` \r
|
|
`],[R,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[y,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[k,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ie(q([],[[R,/^[\s\S]+/]]),["uq.val"]),ie(he({keywords:p,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),ie(he({keywords:"null,true,false"}),["json"]),ie(he({keywords:a,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),ie(he({keywords:o,cStyleComments:!0}),["java"]),ie(he({keywords:r,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(he({keywords:e,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(he({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(he({keywords:t,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(he({keywords:l,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(he({keywords:n,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(q([],[[_,/^[\s\S]+/]]),["regex"]);function Se(pe){var we=pe.langExtension;try{var Ee=L(pe.sourceNode,pe.pre),me=Ee.sourceCode;pe.sourceCode=me,pe.spans=Ee.spans,pe.basePos=0,X(we,me)(pe),ue(pe)}catch(ye){M.console&&console.log(ye&&ye.stack||ye)}}function Ie(pe,we,Ee){var me=Ee||!1,ye=we||null,ve=document.createElement("div");ve.innerHTML="<pre>"+pe+"</pre>",ve=ve.firstChild,me&&oe(ve,me,!0);var be={langExtension:ye,numberLines:me,sourceNode:ve,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Se(be),ve.innerHTML}function Ae(pe,we){var Ee=we||document.body,me=Ee.ownerDocument||document;function ye(J){return Ee.getElementsByTagName(J)}for(var ve=[ye("pre"),ye("code"),ye("xmp")],be=[],Ke=0;Ke<ve.length;++Ke)for(var De=0,ke=ve[Ke].length;De<ke;++De)be.push(ve[Ke][De]);ve=null;var Fe=Date;Fe.now||(Fe={now:function(){return+new Date}});var re=0,Be=/\blang(?:uage)?-([\w.]+)(?!\S)/,Oe=/\bprettyprint\b/,Re=/\bprettyprinted\b/,Ge=/pre|xmp/i,Le=/^code$/i,le=/^(?:pre|code|xmp)$/i,Te={};function te(){for(var J=M.PR_SHOULD_USE_CONTINUATION?Fe.now()+250:Infinity;re<be.length&&Fe.now()<J;re++){for(var ee=be[re],K=Te,z=ee;z=z.previousSibling;){var Y=z.nodeType,Q=(Y===7||Y===8)&&z.nodeValue;if(Q?!/^\??prettify\b/.test(Q):Y!==3||/\S/.test(z.nodeValue))break;if(Q){K={},Q.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ze,nt,mt){K[nt]=mt});break}}var se=ee.className;if((K!==Te||Oe.test(se))&&!Re.test(se)){for(var fe=!1,xe=ee.parentNode;xe;xe=xe.parentNode){var Pe=xe.tagName;if(le.test(Pe)&&xe.className&&Oe.test(xe.className)){fe=!0;break}}if(!fe){ee.className+=" prettyprinted";var Ue=K.lang;if(!Ue){Ue=se.match(Be);var Me;!Ue&&(Me=$(ee))&&Le.test(Me.tagName)&&(Ue=Me.className.match(Be)),Ue&&(Ue=Ue[1])}var Ye;if(Ge.test(ee.tagName))Ye=1;else{var Qe=ee.currentStyle,We=me.defaultView,Je=Qe?Qe.whiteSpace:We&&We.getComputedStyle?We.getComputedStyle(ee,null).getPropertyValue("white-space"):0;Ye=Je&&Je.substring(0,3)==="pre"}var ot=K.linenums;(ot=ot==="true"||+ot)||(ot=se.match(/\blinenums\b(?::(\d+))?/),ot=ot?ot[1]&&ot[1].length?+ot[1]:!0:!1),ot&&oe(ee,ot,Ye);var dt={langExtension:Ue,sourceNode:ee,numberLines:ot,pre:Ye,sourceCode:null,basePos:null,spans:null,decorations:null};Se(dt)}}}re<be.length?M.setTimeout(te,250):typeof pe=="function"&&pe()}te()}var je=M.PR={createSimpleLexer:q,registerLangHandler:ie,sourceDecorator:he,PR_ATTRIB_NAME:k,PR_ATTRIB_VALUE:R,PR_COMMENT:b,PR_DECLARATION:v,PR_KEYWORD:E,PR_LITERAL:i,PR_NOCODE:U,PR_PLAIN:h,PR_PUNCTUATION:d,PR_SOURCE:x,PR_STRING:_,PR_TAG:y,PR_TYPE:c,prettyPrintOne:w?M.prettyPrintOne=Ie:A=Ie,prettyPrint:F=w?M.prettyPrint=Ae:F=Ae},He=M.define;typeof He=="function"&&He.amd&&He("google-code-prettify",[],function(){return je})})()},TXwP:function(ut,tt,ne){var ce,W;(function(){var w;(function(){"use strict";var I=[,,function(O){function S(o){this.__parent=o,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}S.prototype.clone_empty=function(){var o=new S(this.__parent);return o.set_indent(this.__indent_count,this.__alignment_count),o},S.prototype.item=function(o){return o<0?this.__items[this.__items.length+o]:this.__items[o]},S.prototype.has_match=function(o){for(var a=this.__items.length-1;a>=0;a--)if(this.__items[a].match(o))return!0;return!1},S.prototype.set_indent=function(o,a){this.is_empty()&&(this.__indent_count=o||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 o=this.__parent.current_line;return o.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),o.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),o.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,o.__items[0]===" "&&(o.__items.splice(0,1),o.__character_count-=1),!0}return!1},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(o){this.__items.push(o);var a=o.lastIndexOf(`
|
|
`);a!==-1?this.__character_count=o.length-a:this.__character_count+=o.length},S.prototype.pop=function(){var o=null;return this.is_empty()||(o=this.__items.pop(),this.__character_count-=o.length),o},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 o="";return this.is_empty()?this.__parent.indent_empty_lines&&(o=this.__parent.get_indent_string(this.__indent_count)):(o=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),o+=this.__items.join("")),o};function m(o,a){this.__cache=[""],this.__indent_size=o.indent_size,this.__indent_string=o.indent_char,o.indent_with_tabs||(this.__indent_string=new Array(o.indent_size+1).join(o.indent_char)),a=a||"",o.indent_level>0&&(a=new Array(o.indent_level+1).join(this.__indent_string)),this.__base_string=a,this.__base_string_length=a.length}m.prototype.get_indent_size=function(o,a){var n=this.__base_string_length;return a=a||0,o<0&&(n=0),n+=o*this.__indent_size,n+=a,n},m.prototype.get_indent_string=function(o,a){var n=this.__base_string;return a=a||0,o<0&&(o=0,n=""),a+=o*this.__indent_size,this.__ensure_cache(a),n+=this.__cache[a],n},m.prototype.__ensure_cache=function(o){for(;o>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var o=this.__cache.length,a=0,n="";this.__indent_size&&o>=this.__indent_size&&(a=Math.floor(o/this.__indent_size),o-=a*this.__indent_size,n=new Array(a+1).join(this.__indent_string)),o&&(n+=new Array(o+1).join(" ")),this.__cache.push(n)};function p(o,a){this.__indent_cache=new m(o,a),this.raw=!1,this._end_with_newline=o.end_with_newline,this.indent_size=o.indent_size,this.wrap_line_length=o.wrap_line_length,this.indent_empty_lines=o.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new S(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(o,a){return this.__indent_cache.get_indent_string(o,a)},p.prototype.get_indent_size=function(o,a){return this.__indent_cache.get_indent_size(o,a)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(o){return this.is_empty()||!o&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(o){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 n=this.__lines.join(`
|
|
`);return o!==`
|
|
`&&(n=n.replace(/[\n]/g,o)),n},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(o,a){return o=o||0,a=a||0,this.next_line.set_indent(o,a),this.__lines.length>1?(this.current_line.set_indent(o,a),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(o){for(var a=0;a<o.newlines;a++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(o.whitespace_before),this.current_line.push(o.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(o){this.__add_space_before_token(),this.current_line.push(o),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(o){for(var a=this.__lines.length;o<a;)this.__lines[o]._remove_indent(),o++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(o){for(o=o===void 0?!1:o,this.current_line.trim();o&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(o,a){for(var n=this.__lines.length-2;n>=0;){var l=this.__lines[n];if(l.is_empty())break;if(l.item(0).indexOf(o)!==0&&l.item(-1)!==a){this.__lines.splice(n+1,0,new S(this)),this.previous_line=this.__lines[this.__lines.length-2];break}n--}},O.exports.Output=p},,,,function(O){function S(o,a){this.raw_options=m(o,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(o,a){var n=this.raw_options[o],l=a||[];return typeof n=="object"?n!==null&&typeof n.concat=="function"&&(l=n.concat()):typeof n=="string"&&(l=n.split(/[^a-zA-Z0-9_\/\-]+/)),l},S.prototype._get_boolean=function(o,a){var n=this.raw_options[o],l=n===void 0?!!a:!!n;return l},S.prototype._get_characters=function(o,a){var n=this.raw_options[o],l=a||"";return typeof n=="string"&&(l=n.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),l},S.prototype._get_number=function(o,a){var n=this.raw_options[o];a=parseInt(a,10),isNaN(a)&&(a=0);var l=parseInt(n,10);return isNaN(l)&&(l=a),l},S.prototype._get_selection=function(o,a,n){var l=this._get_selection_list(o,a,n);if(l.length!==1)throw new Error("Invalid Option Value: The option '"+o+`' can only be one of the following values:
|
|
`+a+`
|
|
You passed in: '`+this.raw_options[o]+"'");return l[0]},S.prototype._get_selection_list=function(o,a,n){if(!a||a.length===0)throw new Error("Selection list cannot be empty.");if(n=n||[a[0]],!this._is_valid_selection(n,a))throw new Error("Invalid Default Value!");var l=this._get_array(o,n);if(!this._is_valid_selection(l,a))throw new Error("Invalid Option Value: The option '"+o+`' can contain only the following values:
|
|
`+a+`
|
|
You passed in: '`+this.raw_options[o]+"'");return l},S.prototype._is_valid_selection=function(o,a){return o.length&&a.length&&!o.some(function(n){return a.indexOf(n)===-1})};function m(o,a){var n={};o=p(o);var l;for(l in o)l!==a&&(n[l]=o[l]);if(a&&o[a])for(l in o[a])n[l]=o[a][l];return n}function p(o){var a={},n;for(n in o){var l=n.replace(/-/g,"_");a[l]=o[n]}return a}O.exports.Options=S,O.exports.normalizeOpts=p,O.exports.mergeOpts=m},,function(O){var S=RegExp.prototype.hasOwnProperty("sticky");function m(p){this.__input=p||"",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 p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},m.prototype.peek=function(p){var o=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(o=this.__input.charAt(p)),o},m.prototype.__match=function(p,o){p.lastIndex=o;var a=p.exec(this.__input);return a&&!(S&&p.sticky)&&(a.index!==o&&(a=null)),a},m.prototype.test=function(p,o){return o=o||0,o+=this.__position,o>=0&&o<this.__input_length?!!this.__match(p,o):!1},m.prototype.testChar=function(p,o){var a=this.peek(o);return p.lastIndex=0,a!==null&&p.test(a)},m.prototype.match=function(p){var o=this.__match(p,this.__position);return o?this.__position+=o[0].length:o=null,o},m.prototype.read=function(p,o,a){var n="",l;return p&&(l=this.match(p),l&&(n+=l[0])),o&&(l||!p)&&(n+=this.readUntil(o,a)),n},m.prototype.readUntil=function(p,o){var a="",n=this.__position;p.lastIndex=this.__position;var l=p.exec(this.__input);return l?(n=l.index,o&&(n+=l[0].length)):n=this.__input_length,a=this.__input.substring(this.__position,n),this.__position=n,a},m.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},m.prototype.get_regexp=function(p,o){var a=null,n="g";return o&&S&&(n="y"),typeof p=="string"&&p!==""?a=new RegExp(p,n):p&&(a=new RegExp(p.source,n)),a},m.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(p){var o=this.__position,a=this.readUntilAfter(p);return this.__position=o,a},m.prototype.lookBack=function(p){var o=this.__position-1;return o>=p.length&&this.__input.substring(o-p.length,o).toLowerCase()===p},O.exports.InputScanner=m},,,,,function(O){function S(m,p){m=typeof m=="string"?m:m.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+p,"g")}S.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var o=this.__directive_pattern.exec(m);o;)p[o[1]]=o[2],o=this.__directive_pattern.exec(m);return p},S.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},O.exports.Directives=S},,function(O,S,m){var p=m(16).Beautifier,o=m(17).Options;function a(n,l){var s=new p(n,l);return s.beautify()}O.exports=a,O.exports.defaultOptions=function(){return new o}},function(O,S,m){var p=m(17).Options,o=m(2).Output,a=m(8).InputScanner,n=m(13).Directives,l=new n(/\/\*/,/\*\//),s=/\r\n|[\r\n]/,e=/\r\n|[\r\n]/g,t=/\s/,r=/(?:\s|\n)+/g,T=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,g=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function _(E,b){this._source_text=E||"",this._options=new p(b),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"]}_.prototype.eatString=function(E){var b="";for(this._ch=this._input.next();this._ch;){if(b+=this._ch,this._ch==="\\")b+=this._input.next();else if(E.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return b},_.prototype.eatWhitespace=function(E){for(var b=t.test(this._input.peek()),c=0;t.test(this._input.peek());)this._ch=this._input.next(),E&&this._ch===`
|
|
`&&((c===0||c<this._options.max_preserve_newlines)&&(c++,this._output.add_new_line(!0)));return b},_.prototype.foundNestedPseudoClass=function(){for(var E=0,b=1,c=this._input.peek(b);c;){if(c==="{")return!0;if(c==="(")E+=1;else if(c===")"){if(E===0)return!1;E-=1}else if(c===";"||c==="}")return!1;b++,c=this._input.peek(b)}return!1},_.prototype.print_string=function(E){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(E)},_.prototype.preserveSingleSpace=function(E){E&&(this._output.space_before_token=!0)},_.prototype.indent=function(){this._indentLevel++},_.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},_.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var E=this._source_text,b=this._options.eol;b==="auto"&&(b=`
|
|
`,E&&s.test(E||"")&&(b=E.match(s)[0])),E=E.replace(e,`
|
|
`);var c=E.match(/^[\t ]*/)[0];this._output=new o(this._options,c),this._input=new a(E),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var i=0,d=!1,h=!1,y=!1,v=!1,x=!1,k=!1,R=this._ch,U=!1,N,G,L;N=this._input.read(r),G=N!=="",L=R,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),R=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var H=this._input.read(T),V=l.get_directives(H);V&&V.ignore==="start"&&(H+=l.readIgnored(this._input)),this.print_string(H),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(g)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(G),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var $=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);$.match(/[ :]$/)&&($=this.eatString(": ").replace(/\s$/,""),this.print_string($),this._output.space_before_token=!0),$=$.replace(/\s$/,""),$==="extend"?v=!0:$==="import"&&(x=!0),$ in this.NESTED_AT_RULE?(this._nestedLevel+=1,$ in this.CONDITIONAL_GROUP_RULE&&(y=!0)):!d&&i===0&&$.indexOf(":")!==-1&&(h=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(G),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")h&&(h=!1,this.outdent()),y?(y=!1,d=this._indentLevel>=this._nestedLevel):d=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&d&&(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)):(L==="("?this._output.space_before_token=!1:L!==","&&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(),L==="{"&&this._output.trim(!0),x=!1,v=!1,h&&(this.outdent(),h=!1),this.print_string(this._ch),d=!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 q=0;q<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;q++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[q])){U=!0;break}(d||y)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!v&&i===0?(this.print_string(":"),h||(h=!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 he=L==='"'||L==="'";this.preserveSingleSpace(he||G),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")U=!1,i===0?(h&&(this.outdent(),h=!1),v=!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(),i++,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(")")),i&&(i--,this.outdent()));else{var ae=!1;this._input.lookBack("with")&&(ae=!0),this.preserveSingleSpace(G||ae),this.print_string(this._ch),h&&L==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),k=!0):(this.eatWhitespace(),i++,this.indent())}else if(this._ch===")")i&&(i--,this.outdent()),k&&this._input.peek()===";"&&this._options.selector_separator_newline&&(k=!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&&(!h||k)&&i===0&&!x&&!v?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!h&&i===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(G),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 oe=L==='"'||L==="'";this.preserveSingleSpace(oe||G),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&U&&this._output.add_new_line()}var ue=this._output.get_code(b);return ue},O.exports.Beautifier=_},function(O,S,m){var p=m(6).Options;function o(a){p.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 n=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||n;var l=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var s=0;s<l.length;s++)l[s]!=="expand"?this.brace_style="collapse":this.brace_style=l[s]}o.prototype=new p,O.exports.Options=o}],A={};function F(O){var S=A[O];if(S!==void 0)return S.exports;var m=A[O]={exports:{}};return I[O](m,m.exports,F),m.exports}var M=F(15);w=M})();var j=w;!(ce=[],W=function(){return{css_beautify:j}}.apply(tt,ce),W!==void 0&&(ut.exports=W))})()},VSi8:function(ut,tt,ne){"use strict";ne.r(tt);var ce=ne("+L6B"),W=ne("2/Rp"),w=ne("5NDa"),j=ne("5rEg"),I=ne("5Dmo"),A=ne("3S7+"),F=ne("14J3"),M=ne("BMrR"),O=ne("jCWc"),S=ne("kPKH"),m=ne("sPJy"),p=ne("bE4q"),o=ne("/zsF"),a=ne("PArb"),n=ne("miYZ"),l=ne("tsqr"),s=ne("9og8"),e=ne("k1fw"),t=ne("oBTY"),r=ne("y8nQ"),T=ne("Vl3Y"),g=ne("tJVT"),_=ne("PpiC"),E=ne("WmNS"),b=ne.n(E),c=ne("q1tI"),i=ne.n(c),d=ne("Ty5D"),h=ne("55Ip"),y=ne("9kvl"),v=ne("w5pM"),x=ne("tgas"),k=ne("OaEy"),R=ne("2fM7"),U=ne("sRBo"),N=ne("kaz8"),G=ne("2qtc"),L=ne("kLXV"),H=ne("9Bee"),V=ne("otbz"),$=ne.n(V),q=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],he=function(me,ye){var ve=me.problemset,be=me.globalSetting,Ke=me.loading,De=me.dispatch,ke=me.onRef,Fe=ke===void 0?function(){}:ke,re=me.editData,Be=me.editKey,Oe=me.callback,Re=Object(_.a)(me,["problemset","globalSetting","loading","dispatch","onRef","editData","editKey","callback"]),Ge=Object(c.useState)([]),Le=Object(g.a)(Ge,2),le=Le[0],Te=Le[1],te=Object(c.useState)(),J=Object(g.a)(te,2),ee=J[0],K=J[1],z=Object(c.useState)([]),Y=Object(g.a)(z,2),Q=Y[0],se=Y[1],fe=Object(c.useState)(""),xe=Object(g.a)(fe,2),Pe=xe[0],Ue=xe[1],Me=Object(c.useState)(0),Ye=Object(g.a)(Me,2),Qe=Ye[0],We=Ye[1],Je=Object(c.useState)(!0),ot=Object(g.a)(Je,2),dt=ot[0],Ze=ot[1],nt=Object(c.useState)(!1),mt=Object(g.a)(nt,2),It=mt[0],Ce=mt[1],$e=Object(d.i)(),rt=Object(c.useState)(""),Xe=Object(g.a)(rt,2),et=Xe[0],lt=Xe[1],Tt=Object(c.useState)(""),at=Object(g.a)(Tt,2),it=at[0],st=at[1];Object(c.useEffect)(function(){var Ct,ht,ze,ft,xt,St,pt,D;if(!(re!=null&&(Ct=re.question)!==null&&Ct!==void 0&&Ct.question_title)){Te([{disabled:!1,value:""},{disabled:!1,value:""},{disabled:!1,value:""},{disabled:!1,value:""}]),Ze(!0),Ue(""),Ce(!1);return}lt(re==null||((ht=re.question)===null||ht===void 0)?void 0:ht.max_choices),st(re==null||((ze=re.question)===null||ze===void 0)?void 0:ze.min_choices),Ue(re==null||((ft=re.question)===null||ft===void 0)?void 0:ft.question_title),Ze(!!(re!=null&&(xt=re.question)!==null&&xt!==void 0&&xt.is_necessary)),Te(re==null||((St=re.question)===null||St===void 0)?void 0:St.answers.map(function(u){return{value:u.answer_text,disabled:u.answer_text==="\u5176\u5B83"}})),Ce(!!(re!=null&&(pt=re.question)!==null&&pt!==void 0&&(D=pt.answers)!==null&&D!==void 0&&D.find(function(u){return u.answer_text==="\u5176\u5B83"})))},[re]),Object(c.useImperativeHandle)(ye,function(){return{onSave:gt}});var gt=function(){var Ct=Object(s.a)(b.a.mark(function ht(ze){var ft,xt,St,pt,D,u;return b.a.wrap(function(C){for(;;)switch(C.prev=C.next){case 0:if(!(et&&!it||!et&&it)){C.next=3;break}return l.b.info('\u53EF\u9009\uFF1A\u6700\u5C0F\u548C\u6700\u5927\u9650\u5236\u987B\u540C\u65F6\u4E3A\u6570\u503C\u6216\u8005\u201C--"'),C.abrupt("return");case 3:if(!(it>et)){C.next=6;break}return l.b.info("\u53EF\u9009\u7684\u6700\u5927\u9650\u5236\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u9650\u5236"),C.abrupt("return");case 6:if(Pe){C.next=9;break}return l.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),C.abrupt("return",!1);case 9:if(xt=le.findIndex(function(B){return!B.value}),!(xt>-1)){C.next=13;break}return l.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(q[xt]," \u9009\u9879\u7684\u5185\u5BB9")),C.abrupt("return",!1);case 13:if(pt={question_title:Pe,question_type:2,insert_id:re.insert_id,is_necessary:Math.ceil(dt),max_choices:et,min_choices:it,question_answers:le.map(function(B){return B.value})},!((ft=re.question)!==null&&ft!==void 0&&ft.id)){C.next=20;break}return C.next=17,Object(x.w)(Object(e.a)({pollsId:re.question.id},pt));case 17:St=C.sent,C.next=23;break;case 20:return C.next=22,Object(x.c)(Object(e.a)({exercise_bank_id:$e.topicId},pt));case 22:St=C.sent;case 23:if(!(St.status===0)){C.next=30;break}return l.b.success("\u4FDD\u5B58\u6210\u529F"),Oe("edit",-1),C.next=28,De({type:"polls/getExerciseBanks",payload:Object(e.a)({},$e)});case 28:D=C.sent,ze&&(pt.answers=pt.question_answers.map(function(B){return{answer_text:B}}),u=[].concat(Object(t.a)(D==null?void 0:D.questions),[{question:Object(e.a)({type:2,insert_id:re.question.id,key:re.key,question_type:2},pt)}]),Oe("addContinue",{editData:u}));case 30:case"end":return C.stop()}},ht)}));return function(ze){return Ct.apply(this,arguments)}}(),bt=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-xiangshangyi current",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiangxiayi current",id:"down"},{name:"\u6DFB\u52A0",icon:"iconfont c-green ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjidaibeijing current",id:"edit"}],Rt=function(){var Ct=Object(s.a)(b.a.mark(function ht(ze){var ft,xt;return b.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:pt.t0=ze.id,pt.next=pt.t0==="del"?3:pt.t0==="up"||pt.t0==="down"?5:pt.t0==="edit"?9:pt.t0==="add"?11:13;break;case 3:return L.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(s.a)(b.a.mark(function u(){var f;return b.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,Object(x.e)({pollsId:re==null||((f=re.question)===null||f===void 0)?void 0:f.id});case 2:De({type:"polls/getExerciseBanks",payload:Object(e.a)({},$e)});case 3:case"end":return B.stop()}},u)}))()}}),pt.abrupt("break",13);case 5:return pt.next=7,Object(x.i)({pollsId:re==null||((ft=re.question)===null||ft===void 0)?void 0:ft.id,opr:ze.id});case 7:return De({type:"polls/getExerciseBanks",payload:Object(e.a)({},$e)}),pt.abrupt("break",13);case 9:return Oe("edit",re.key),pt.abrupt("break",13);case 11:return Oe("add",{type:2,key:re.key,insert_id:re==null||((xt=re.question)===null||xt===void 0)?void 0:xt.id,question_type:2}),pt.abrupt("break",13);case 13:case"end":return pt.stop()}},ht)}));return function(ze){return Ct.apply(this,arguments)}}(),ct=function(){var ht,ze,ft,xt;return i.a.createElement("aside",null,i.a.createElement("div",{className:$.a.questionType},i.a.createElement("div",null,i.a.createElement("span",{className:"font16"},"\u7B2C",re.key,"\u9898"),i.a.createElement("span",{className:"font16 c-light-black ml10"},"\u591A\u9009\u9898"),i.a.createElement("span",{className:"tag-grey-eae ml10 mr10"},(re==null||((ht=re.question)===null||ht===void 0)?void 0:ht.is_necessary)===0?"\u9009\u7B54":"\u5FC5\u7B54"),"\u53EF\u9009",re==null||((ze=re.question)===null||ze===void 0)?void 0:ze.min_choices,"-",re==null||((ft=re.question)===null||ft===void 0)?void 0:ft.max_choices,"\u9879"),bt.map(function(St,pt){return St.id==="up"&&re.key===1||St.id==="down"&&re.key===re.len?null:i.a.createElement(A.a,{key:pt,placement:"bottom",title:St.name},i.a.createElement("span",{onClick:function(){return Rt(St)},className:St.icon}))})),i.a.createElement("div",{className:"mt5"},i.a.createElement(H.a,{value:re.question.question_title})),i.a.createElement("div",{className:$.a.questionChoices},re==null||((xt=re.question.answers)===null||xt===void 0)?void 0:xt.map(function(St,pt){return i.a.createElement(M.a,null,i.a.createElement(S.a,null,i.a.createElement(N.a,{key:pt,disabled:!0},i.a.createElement("span",{className:"c-black font14"},St.answer_text))))})))},Pt=function(){return i.a.createElement("aside",null,i.a.createElement("div",{className:$.a.questionType},i.a.createElement("div",null,i.a.createElement("span",{className:"font16 c-blue"},"\u591A\u9009\u9898")," ",i.a.createElement(N.a,{checked:!!dt,className:"ml10",onChange:function(ze){return Ze(ze.target.checked)}},"\u5FC5\u7B54"))),i.a.createElement("p",{className:$.a.titleWrap},i.a.createElement(j.a.TextArea,{autoSize:{maxRows:5},rows:1,value:Pe,placeholder:"\u8BF7\u8F93\u5165\u9898\u76EE",onChange:function(ze){return Ue(ze.target.value)}})),le.map(function(ht,ze){return i.a.createElement(M.a,{className:$.a.choiceWrap,key:ze,gutter:[12,12]},i.a.createElement(S.a,null,i.a.createElement("span",{className:"font16"},"\u9009\u9879")),i.a.createElement(S.a,{className:$.a.editorWrap,flex:"1"},i.a.createElement(j.a.TextArea,{autoSize:{maxRows:5},value:le[ze].value,rows:1,disabled:!!ht.disabled,onChange:function(xt){le[ze].value=xt.target.value,Te(Object(t.a)(le))}})),i.a.createElement(S.a,null,ze>1&&i.a.createElement(A.a,{title:"\u5220\u9664"},i.a.createElement("i",{className:"".concat($.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){Te(le.filter(function(xt,St){return St!==ze})),ht.disabled&&Ce(!1)}}))))}),i.a.createElement(M.a,{gutter:[12,12]},i.a.createElement(S.a,null,"\u53EF\u9009"),i.a.createElement(S.a,null,i.a.createElement(R.a,{value:it||"",style:{width:120},onChange:function(ze){return st(ze)}},i.a.createElement(R.a.Option,{value:""},"--"),le.map(function(ht,ze){return i.a.createElement(R.a.Option,{value:String(ze+2)},ze+2)})),i.a.createElement("span",{className:"ml10 mr10"},"~"),i.a.createElement(R.a,{style:{width:120},value:et||"",onChange:function(ze){return lt(ze)}},i.a.createElement(R.a.Option,{value:""},"--"),le.map(function(ht,ze){return i.a.createElement(R.a.Option,{value:String(ze+2)},ze+2)})),i.a.createElement("span",{className:"font14 c-grey-999"},"\uFF08\u5B66\u751F\u7B54\u9898\u65F6\uFF0C\u7CFB\u7EDF\u5BF9\u5176\u9009\u62E9\u7684\u9009\u9879\u4E2A\u6570\u8FDB\u884C\u9650\u5236\uFF0C--\u8868\u793A\u4E0D\u9650\u5236\uFF09"))),i.a.createElement(M.a,{gutter:[12,12]},i.a.createElement(S.a,{flex:"1"},i.a.createElement(W.a,{type:"default",onClick:function(){le.find(function(ze){return ze.value==="\u5176\u5B83"})?Te([].concat(Object(t.a)(le.filter(function(ze){return ze.value!=="\u5176\u5B83"})),[{value:""},{value:"\u5176\u5B83",disabled:!0}])):Te([].concat(Object(t.a)(le),[{value:""}]))}},"\u65B0\u589E\u9009\u9879"),!It&&i.a.createElement(W.a,{type:"default",className:"ml20",onClick:function(){Te([].concat(Object(t.a)(le),[{disabled:!0,value:"\u5176\u5B83"}])),Ce(!0)}},"\u65B0\u589E\u5176\u5B83\u9009\u9879")),i.a.createElement(S.a,{className:"tl"},i.a.createElement(W.a,{type:"default",onClick:function(){var ze;(ze=re.question)!==null&&ze!==void 0&&ze.id?Oe("edit",-1):Oe("del",re.key)}},"\u53D6\u6D88"),i.a.createElement(W.a,{className:"ml20",type:"primary",onClick:function(){return gt()}},"\u4FDD\u5B58"),i.a.createElement(W.a,{className:"ml20",type:"primary",onClick:function(){return gt(!0)}},"\u4FDD\u5B58\u5E76\u7EE7\u7EED"))))};return i.a.createElement("section",{className:$.a.wrap},Be!==re.key&&ct(),Be===re.key&&Pt())},ae=Object(y.a)(function(Ee){var me=Ee.problemset,ye=Ee.loading,ve=Ee.globalSetting;return{problemset:me,globalSetting:ve,loading:ye.effects}},null,null,{forwardRef:!0})(Object(c.forwardRef)(he)),oe=ne("7Kak"),ue=ne("9yH6"),de=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ie=function(me,ye){var ve=me.problemset,be=me.globalSetting,Ke=me.loading,De=me.dispatch,ke=me.onRef,Fe=ke===void 0?function(){}:ke,re=me.editData,Be=me.editKey,Oe=me.callback,Re=Object(_.a)(me,["problemset","globalSetting","loading","dispatch","onRef","editData","editKey","callback"]),Ge=Object(c.useState)([]),Le=Object(g.a)(Ge,2),le=Le[0],Te=Le[1],te=Object(c.useState)(),J=Object(g.a)(te,2),ee=J[0],K=J[1],z=Object(c.useState)([]),Y=Object(g.a)(z,2),Q=Y[0],se=Y[1],fe=Object(c.useState)(""),xe=Object(g.a)(fe,2),Pe=xe[0],Ue=xe[1],Me=Object(c.useState)(0),Ye=Object(g.a)(Me,2),Qe=Ye[0],We=Ye[1],Je=Object(c.useState)(!1),ot=Object(g.a)(Je,2),dt=ot[0],Ze=ot[1],nt=Object(c.useState)(!1),mt=Object(g.a)(nt,2),It=mt[0],Ce=mt[1],$e=Object(d.i)();Object(c.useEffect)(function(){var at,it,st,gt,bt,Rt;if(!(re!=null&&(at=re.question)!==null&&at!==void 0&&at.question_title)){Te([{disabled:!1,value:""},{disabled:!1,value:""},{disabled:!1,value:""},{disabled:!1,value:""}]),Ze(!1),Ue(""),Ce(!1);return}Ue(re==null||((it=re.question)===null||it===void 0)?void 0:it.question_title),Ze(!!(re!=null&&(st=re.question)!==null&&st!==void 0&&st.is_necessary)),Te(re==null||((gt=re.question)===null||gt===void 0)?void 0:gt.answers.map(function(ct){return{value:ct.answer_text,disabled:ct.answer_text==="\u5176\u5B83"}})),Ce(!!(re!=null&&(bt=re.question)!==null&&bt!==void 0&&(Rt=bt.answers)!==null&&Rt!==void 0&&Rt.find(function(ct){return ct.answer_text==="\u5176\u5B83"})))},[re]),Object(c.useImperativeHandle)(ye,function(){return{onSave:rt}});var rt=function(){var at=Object(s.a)(b.a.mark(function it(st){var gt,bt,Rt,ct,Pt,Ct;return b.a.wrap(function(ze){for(;;)switch(ze.prev=ze.next){case 0:if(Pe){ze.next=3;break}return l.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),ze.abrupt("return",!1);case 3:if(bt=le.findIndex(function(ft){return!ft.value}),!(bt>-1)){ze.next=7;break}return l.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(de[bt]," \u9009\u9879\u7684\u5185\u5BB9")),ze.abrupt("return",!1);case 7:if(ct={question_title:Pe,question_type:1,insert_id:re.insert_id,is_necessary:Math.ceil(dt),question_answers:le.map(function(ft){return ft.value})},!((gt=re.question)!==null&>!==void 0&>.id)){ze.next=14;break}return ze.next=11,Object(x.w)(Object(e.a)({pollsId:re.question.id},ct));case 11:Rt=ze.sent,ze.next=17;break;case 14:return ze.next=16,Object(x.c)(Object(e.a)({exercise_bank_id:$e.topicId},ct));case 16:Rt=ze.sent;case 17:if(!(Rt.status===0)){ze.next=24;break}return l.b.success("\u4FDD\u5B58\u6210\u529F"),Oe("edit",-1),ze.next=22,De({type:"polls/getExerciseBanks",payload:Object(e.a)({},$e)});case 22:Pt=ze.sent,st&&(ct.answers=ct.question_answers.map(function(ft){return{answer_text:ft}}),Ct=[].concat(Object(t.a)(Pt==null?void 0:Pt.questions),[{question:Object(e.a)({type:1,insert_id:re.question.id,key:re.key,question_type:1},ct)}]),Oe("addContinue",{editData:Ct}));case 24:case"end":return ze.stop()}},it)}));return function(st){return at.apply(this,arguments)}}(),Xe=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-xiangshangyi current",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiangxiayi current",id:"down"},{name:"\u6DFB\u52A0",icon:"iconfont c-green ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjidaibeijing current",id:"edit"}],et=function(){var at=Object(s.a)(b.a.mark(function it(st){var gt,bt;return b.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:ct.t0=st.id,ct.next=ct.t0==="del"?3:ct.t0==="up"||ct.t0==="down"?5:ct.t0==="edit"?9:ct.t0==="add"?11:13;break;case 3:return L.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(s.a)(b.a.mark(function Ct(){var ht;return b.a.wrap(function(ft){for(;;)switch(ft.prev=ft.next){case 0:return ft.next=2,Object(x.e)({pollsId:re==null||((ht=re.question)===null||ht===void 0)?void 0:ht.id});case 2:De({type:"polls/getExerciseBanks",payload:Object(e.a)({},$e)});case 3:case"end":return ft.stop()}},Ct)}))()}}),ct.abrupt("break",13);case 5:return ct.next=7,Object(x.i)({pollsId:re==null||((gt=re.question)===null||gt===void 0)?void 0:gt.id,opr:st.id});case 7:return De({type:"polls/getExerciseBanks",payload:Object(e.a)({},$e)}),ct.abrupt("break",13);case 9:return Oe("edit",re.key),ct.abrupt("break",13);case 11:return Oe("add",{type:1,key:re.key,insert_id:re==null||((bt=re.question)===null||bt===void 0)?void 0:bt.id,question_type:1}),ct.abrupt("break",13);case 13:case"end":return ct.stop()}},it)}));return function(st){return at.apply(this,arguments)}}(),lt=function(){var it,st;return i.a.createElement("aside",null,i.a.createElement("div",{className:$.a.questionType},i.a.createElement("div",null,i.a.createElement("span",{className:"font16"},"\u7B2C",re.key,"\u9898"),i.a.createElement("span",{className:"font16 c-light-black ml10"},"\u5355\u9009\u9898"),i.a.createElement("span",{className:"tag-grey-eae ml10"},(re==null||((it=re.question)===null||it===void 0)?void 0:it.is_necessary)===0?"\u9009\u7B54":"\u5FC5\u7B54")),Xe.map(function(gt,bt){return gt.id==="up"&&re.key===1||gt.id==="down"&&re.key===re.len?null:i.a.createElement(A.a,{key:bt,placement:"bottom",title:gt.name},i.a.createElement("span",{onClick:function(){return et(gt)},className:gt.icon}))})),i.a.createElement("div",{className:"mt5"},i.a.createElement(H.a,{value:re.question.question_title})),i.a.createElement("div",{className:$.a.questionChoices},re==null||((st=re.question.answers)===null||st===void 0)?void 0:st.map(function(gt,bt){return i.a.createElement(M.a,null,i.a.createElement(S.a,null,i.a.createElement(ue.a,{key:bt,disabled:!0})),i.a.createElement(S.a,{flex:"1"},i.a.createElement("span",{className:"c-black font14"},gt.answer_text)))})))},Tt=function(){return i.a.createElement("aside",null,i.a.createElement("div",{className:$.a.questionType},i.a.createElement("div",null,i.a.createElement("span",{className:"font16 c-blue"},"\u5355\u9009\u9898")," ",i.a.createElement(N.a,{checked:!!dt,className:"ml10",onChange:function(st){return Ze(st.target.checked)}},"\u5FC5\u7B54"))),i.a.createElement("p",{className:$.a.titleWrap},i.a.createElement(j.a.TextArea,{autoSize:{maxRows:5},rows:1,value:Pe,placeholder:"\u8BF7\u8F93\u5165\u9898\u76EE",onChange:function(st){return Ue(st.target.value)}})),le.map(function(it,st){return i.a.createElement(M.a,{className:$.a.choiceWrap,key:st,gutter:[12,12]},i.a.createElement(S.a,null,i.a.createElement("span",{className:"font16"},"\u9009\u9879")),i.a.createElement(S.a,{className:$.a.editorWrap,flex:"1"},i.a.createElement(j.a.TextArea,{autoSize:{maxRows:5},value:le[st].value,rows:1,disabled:!!it.disabled,onChange:function(bt){le[st].value=bt.target.value,Te(Object(t.a)(le))}})),i.a.createElement(S.a,null,st>1&&i.a.createElement(A.a,{title:"\u5220\u9664"},i.a.createElement("i",{className:"".concat($.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){Te(le.filter(function(bt,Rt){return Rt!==st})),it.disabled&&Ce(!1)}}))))}),i.a.createElement(M.a,{gutter:[12,12]},i.a.createElement(S.a,{flex:"1"},i.a.createElement(W.a,{type:"default",onClick:function(){le.find(function(st){return st.value==="\u5176\u5B83"})?Te([].concat(Object(t.a)(le.filter(function(st){return st.value!=="\u5176\u5B83"})),[{value:""},{value:"\u5176\u5B83",disabled:!0}])):Te([].concat(Object(t.a)(le),[{value:""}]))}},"\u65B0\u589E\u9009\u9879"),!It&&i.a.createElement(W.a,{type:"default",className:"ml20",onClick:function(){Te([].concat(Object(t.a)(le),[{disabled:!0,value:"\u5176\u5B83"}])),Ce(!0)}},"\u65B0\u589E\u5176\u5B83\u9009\u9879")),i.a.createElement(S.a,{className:"tl"},i.a.createElement(W.a,{type:"default",onClick:function(){var st;(st=re.question)!==null&&st!==void 0&&st.id?Oe("edit",-1):Oe("del",re.key)}},"\u53D6\u6D88"),i.a.createElement(W.a,{className:"ml20",type:"primary",onClick:function(){return rt()}},"\u4FDD\u5B58"),i.a.createElement(W.a,{className:"ml20",type:"primary",onClick:function(){return rt(!0)}},"\u4FDD\u5B58\u5E76\u7EE7\u7EED"))))};return i.a.createElement("section",{className:$.a.wrap},Be!==re.key&<(),Be===re.key&&Tt())},X=Object(y.a)(function(Ee){var me=Ee.problemset,ye=Ee.loading,ve=Ee.globalSetting;return{problemset:me,globalSetting:ve,loading:ye.effects}},null,null,{forwardRef:!0})(Object(c.forwardRef)(ie)),Se=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ie=function(me,ye){var ve=me.problemset,be=me.globalSetting,Ke=me.loading,De=me.dispatch,ke=me.onRef,Fe=ke===void 0?function(){}:ke,re=me.editData,Be=me.editKey,Oe=me.callback,Re=Object(_.a)(me,["problemset","globalSetting","loading","dispatch","onRef","editData","editKey","callback"]),Ge=Object(c.useState)(""),Le=Object(g.a)(Ge,2),le=Le[0],Te=Le[1],te=Object(c.useState)(!0),J=Object(g.a)(te,2),ee=J[0],K=J[1],z=Object(d.i)();Object(c.useEffect)(function(){var Pe,Ue,Me;if(!(re!=null&&(Pe=re.question)!==null&&Pe!==void 0&&Pe.question_title)){K(!0),Te("");return}Te(re==null||((Ue=re.question)===null||Ue===void 0)?void 0:Ue.question_title),K(!!(re!=null&&(Me=re.question)!==null&&Me!==void 0&&Me.is_necessary))},[re]),Object(c.useImperativeHandle)(ye,function(){return{onSave:Y}});var Y=function(){var Pe=Object(s.a)(b.a.mark(function Ue(Me){var Ye,Qe,We,Je,ot;return b.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:if(le){Ze.next=3;break}return l.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),Ze.abrupt("return",!1);case 3:if(We={question_title:le,question_type:3,insert_id:re.insert_id,is_necessary:Math.ceil(ee)},!((Ye=re.question)!==null&&Ye!==void 0&&Ye.id)){Ze.next=10;break}return Ze.next=7,Object(x.w)(Object(e.a)({pollsId:re.question.id},We));case 7:Qe=Ze.sent,Ze.next=13;break;case 10:return Ze.next=12,Object(x.c)(Object(e.a)({exercise_bank_id:z.topicId},We));case 12:Qe=Ze.sent;case 13:if(!(Qe.status===0)){Ze.next=20;break}return l.b.success("\u4FDD\u5B58\u6210\u529F"),Oe("edit",-1),Ze.next=18,De({type:"polls/getExerciseBanks",payload:Object(e.a)({},z)});case 18:Je=Ze.sent,Me&&(ot=[].concat(Object(t.a)(Je==null?void 0:Je.questions),[{question:Object(e.a)({type:3,insert_id:re.question.id,key:re.key,question_type:3},We)}]),Oe("addContinue",{editData:ot}));case 20:case"end":return Ze.stop()}},Ue)}));return function(Me){return Pe.apply(this,arguments)}}(),Q=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-xiangshangyi current",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiangxiayi current",id:"down"},{name:"\u6DFB\u52A0",icon:"iconfont c-green ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianjidaibeijing current",id:"edit"}],se=function(){var Pe=Object(s.a)(b.a.mark(function Ue(Me){var Ye,Qe;return b.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:Je.t0=Me.id,Je.next=Je.t0==="del"?3:Je.t0==="up"||Je.t0==="down"?5:Je.t0==="edit"?9:Je.t0==="add"?11:13;break;case 3:return L.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk:function(){return Object(s.a)(b.a.mark(function dt(){var Ze;return b.a.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:return mt.next=2,Object(x.e)({pollsId:re==null||((Ze=re.question)===null||Ze===void 0)?void 0:Ze.id});case 2:De({type:"polls/getExerciseBanks",payload:Object(e.a)({},z)});case 3:case"end":return mt.stop()}},dt)}))()}}),Je.abrupt("break",13);case 5:return Je.next=7,Object(x.i)({pollsId:re==null||((Ye=re.question)===null||Ye===void 0)?void 0:Ye.id,opr:Me.id});case 7:return De({type:"polls/getExerciseBanks",payload:Object(e.a)({},z)}),Je.abrupt("break",13);case 9:return Oe("edit",re.key),Je.abrupt("break",13);case 11:return Oe("add",{type:3,key:re.key,insert_id:re==null||((Qe=re.question)===null||Qe===void 0)?void 0:Qe.id,question_type:3}),Je.abrupt("break",13);case 13:case"end":return Je.stop()}},Ue)}));return function(Me){return Pe.apply(this,arguments)}}(),fe=function(){var Ue,Me;return i.a.createElement("aside",null,i.a.createElement("div",{className:$.a.questionType},i.a.createElement("div",null,i.a.createElement("span",{className:"font16"},"\u7B2C",re.key,"\u9898"),i.a.createElement("span",{className:"font16 c-light-black ml10"},"\u4E3B\u89C2\u9898"),i.a.createElement("span",{className:"tag-grey-eae ml10 mr10"},(re==null||((Ue=re.question)===null||Ue===void 0)?void 0:Ue.is_necessary)===0?"\u9009\u7B54":"\u5FC5\u7B54")),Q.map(function(Ye,Qe){return Ye.id==="up"&&re.key===1||Ye.id==="down"&&re.key===re.len?null:i.a.createElement(A.a,{key:Qe,placement:"bottom",title:Ye.name},i.a.createElement("span",{onClick:function(){return se(Ye)},className:Ye.icon}))})),i.a.createElement("div",{className:"mt5"},i.a.createElement(H.a,{value:re.question.question_title}),i.a.createElement("div",{className:"mt15"},i.a.createElement(j.a.TextArea,{placeholder:"\u5728\u6B64\u586B\u5165\u7B54\u6848",rows:5,disabled:!0}))),i.a.createElement("div",{className:$.a.questionChoices},re==null||((Me=re.question.answers)===null||Me===void 0)?void 0:Me.map(function(Ye,Qe){return i.a.createElement(M.a,null,i.a.createElement(S.a,null,i.a.createElement(N.a,{key:Qe,disabled:!0},i.a.createElement("span",{className:"c-black font14"},Ye.answer_text))))})))},xe=function(){return i.a.createElement("aside",null,i.a.createElement("div",{className:$.a.questionType},i.a.createElement("div",null,i.a.createElement("span",{className:"font16 c-blue"},"\u4E3B\u89C2\u9898")," ",i.a.createElement(N.a,{checked:!!ee,className:"ml10",onChange:function(Me){return K(Me.target.checked)}},"\u5FC5\u7B54"))),i.a.createElement("p",{className:$.a.titleWrap},i.a.createElement(j.a.TextArea,{autoSize:{maxRows:5},rows:1,value:le,placeholder:"\u8BF7\u8F93\u5165\u9898\u76EE",onChange:function(Me){return Te(Me.target.value)}})),i.a.createElement(M.a,{gutter:[12,12]},i.a.createElement(S.a,{flex:"1"}),i.a.createElement(S.a,{className:"tl"},i.a.createElement(W.a,{type:"default",onClick:function(){var Me;(Me=re.question)!==null&&Me!==void 0&&Me.id?Oe("edit",-1):Oe("del",re.key)}},"\u53D6\u6D88"),i.a.createElement(W.a,{className:"ml20",type:"primary",onClick:function(){return Y()}},"\u4FDD\u5B58"),i.a.createElement(W.a,{className:"ml20",type:"primary",onClick:function(){return Y(!0)}},"\u4FDD\u5B58\u5E76\u7EE7\u7EED"))))};return i.a.createElement("section",{className:$.a.wrap},Be!==re.key&&fe(),Be===re.key&&xe())},Ae=Object(y.a)(function(Ee){var me=Ee.problemset,ye=Ee.loading,ve=Ee.globalSetting;return{problemset:me,globalSetting:ve,loading:ye.effects}},null,null,{forwardRef:!0})(Object(c.forwardRef)(Ie)),je=ne("7iMQ"),He=ne.n(je),pe=function(me){var ye,ve,be,Ke,De,ke,Fe,re,Be,Oe,Re,Ge,Le=me.polls,le=me.globalSetting,Te=me.loading,te=me.user,J=me.dispatch,ee=Object(_.a)(me,["polls","globalSetting","loading","user","dispatch"]),K=Object(d.i)(),z=te.userInfo,Y=T.a.useForm(),Q=Object(g.a)(Y,1),se=Q[0],fe=Object(c.useState)([]),xe=Object(g.a)(fe,2),Pe=xe[0],Ue=xe[1],Me=Object(c.useState)(!1),Ye=Object(g.a)(Me,2),Qe=Ye[0],We=Ye[1],Je=Object(c.useState)(-1),ot=Object(g.a)(Je,2),dt=ot[0],Ze=ot[1],nt=[{name:"\u5355\u9009\u9898",id:1},{name:"\u591A\u9009\u9898",id:2},{name:"\u4E3B\u89C2\u9898",id:3}],mt=Object(c.useRef)();Object(c.useEffect)(function(){var Xe;if((Xe=Le.exerciseBanks)!==null&&Xe!==void 0&&Xe.questions){var et,lt,Tt,at,it;Ue(Object(t.a)((et=Le.exerciseBanks)===null||et===void 0?void 0:et.questions)),se.setFieldsValue({exercise_name:(lt=Le.exerciseBanks)===null||lt===void 0||((Tt=lt.poll)===null||Tt===void 0)?void 0:Tt.name,exercise_description:(at=Le.exerciseBanks)===null||at===void 0||((it=at.poll)===null||it===void 0)?void 0:it.description})}},[Le.exerciseBanks]),Object(c.useEffect)(function(){J({type:"polls/getExerciseBanks",payload:Object(e.a)({},K)})},[K.categoryId]);var It=function(){var Xe=Object(s.a)(b.a.mark(function et(){var lt;return b.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:return at.next=2,se.validateFields();case 2:return lt=se.getFieldValue(),lt.is_md=!0,lt.topicId=K.topicId,We(!1),at.next=8,Object(x.v)(Object(e.a)({},lt));case 8:J({type:"polls/getExerciseBanks",payload:Object(e.a)({},K)});case 9:case"end":return at.stop()}},et)}));return function(){return Xe.apply(this,arguments)}}(),Ce=function(){var Xe=Object(s.a)(b.a.mark(function et(lt){var Tt;return b.a.wrap(function(it){for(;;)switch(it.prev=it.next){case 0:if(Tt=mt==null?void 0:mt.current,!(dt!==-1)){it.next=4;break}return l.b.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898"),it.abrupt("return");case 4:Ze(Pe.length+1),Ue([].concat(Object(t.a)(Pe),[{question:{question_type:lt}}]));case 6:case"end":return it.stop()}},et)}));return function(lt){return Xe.apply(this,arguments)}}(),$e=function(et,lt,Tt){var at;switch(et){case"edit":if(lt!==-1&&dt!==-1&<!==dt){l.b.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898");return}Ze(lt);return;case"add":if(dt!=-1){l.b.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898");return}Ze(-1);break;case"addContinue":Ue(Object(t.a)(lt==null?void 0:lt.editData)),Ze(lt==null||((at=lt.editData)===null||at===void 0)?void 0:at.length);break;case"del":Pe.splice(lt-1,1),Ue(Object(t.a)(Pe)),Ze(-1);break}},rt=function(){return Pe==null?void 0:Pe.map(function(et,lt){var Tt;if(et.key=lt+1,et.len=Pe.length,et.question.question_type===1)return i.a.createElement("aside",{key:et.id},i.a.createElement(X,{ref:mt,editKey:dt,callback:$e,editData:et}),i.a.createElement(a.a,null));if(et.question.question_type===2)return i.a.createElement("aside",{key:et.id},i.a.createElement(ae,{ref:mt,editKey:dt,callback:$e,editData:et}),i.a.createElement(a.a,null));if(((Tt=et.question)===null||Tt===void 0?void 0:Tt.question_type)===3)return i.a.createElement("aside",{key:et.id},i.a.createElement(Ae,{ref:mt,editKey:dt,callback:$e,editData:et}),i.a.createElement(a.a,null))})};return i.a.createElement("section",{className:"edu-container"},i.a.createElement("section",{className:"animated fadeIn"},i.a.createElement("aside",{className:"mt10"},z&&i.a.createElement(p.a,{separator:">"},i.a.createElement(p.a.Item,null,i.a.createElement(h.a,{to:"/users/".concat(K.username,"/").concat(K.topictype==="personal"?"topics":"topicbank","/").concat(K.topictype)},K.topictype==="personal"?"\u6211\u7684\u8BFE\u5802\u8D44\u6E90":"\u516C\u5171\u9898\u5E93")),i.a.createElement(p.a.Item,null,i.a.createElement(h.a,{to:"/users/".concat(z==null?void 0:z.login,"/topics/").concat(K.topicId,"/").concat(K.topictype,"/poll/detail")},"\u8BE6\u60C5")),i.a.createElement(p.a.Item,null,"\u7F16\u8F91"))),i.a.createElement("aside",{className:[He.a.title,"mt20"].join(" ")},i.a.createElement(M.a,{style:{width:"100%"}},i.a.createElement(S.a,{flex:"1"},i.a.createElement("strong",{className:"font20 ml5"},"\u7F16\u8F91")),i.a.createElement(S.a,null,i.a.createElement(h.a,{className:"font16 c-light-black",to:"/users/".concat(z.login,"/topics/").concat(K.topictype)},"\u8FD4\u56DE"))))),i.a.createElement("section",{className:[He.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},!Qe&&i.a.createElement("aside",null,i.a.createElement("div",{className:He.a.containerDesc},i.a.createElement("div",null,(ye=Le.exerciseBanks)===null||ye===void 0||((ve=ye.poll)===null||ve===void 0)?void 0:ve.name),i.a.createElement("div",null,i.a.createElement(A.a,{title:"\u7F16\u8F91"},i.a.createElement("span",{onClick:function(){return We(!0)},className:"iconfont c-green ml30 icon-bianjidaibeijing"})))),i.a.createElement("div",{className:"c-light-black"},(be=Le.exerciseBanks)===null||be===void 0||((Ke=be.poll)===null||Ke===void 0)?void 0:Ke.description)),Qe&&i.a.createElement(T.a,{layout:"vertical",form:se},i.a.createElement(T.a.Item,{name:"exercise_name",label:"\u95EE\u5377\u6807\u9898\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u95EE\u5377\u6807\u9898"}]},i.a.createElement(j.a,{maxLength:60,placeholder:"\u95EE\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),i.a.createElement(T.a.Item,{label:"\u95EE\u5377\u987B\u77E5\uFF1A",name:"exercise_description"},i.a.createElement(j.a.TextArea,{rows:6,placeholder:"\u8BF7\u5728\u6B64\u8F93\u5165\u672C\u6B21\u95EE\u5377\u7B54\u9898\u7684\u76F8\u5173\u8BF4\u660E\uFF0C\u6700\u5927\u9650\u5236100\u4E2A\u5B57\u7B26"})),i.a.createElement(T.a.Item,{className:"tr"},i.a.createElement(W.a,{type:"primary",onClick:function(){It()}},"\u4FDD\u5B58")))),i.a.createElement("section",{className:"mt20"},i.a.createElement(M.a,null,i.a.createElement(S.a,{flex:1},i.a.createElement("span",{className:"c-light-black mr20"},"\u5355\u9009\u9898 ",(De=Le.exerciseBanks)===null||De===void 0||((ke=De.question_types)===null||ke===void 0)?void 0:ke.q_singles," \u9898"),i.a.createElement("span",{className:"c-light-black mr20"},"\u591A\u9009\u9898 ",(Fe=Le.exerciseBanks)===null||Fe===void 0||((re=Fe.question_types)===null||re===void 0)?void 0:re.q_doubles," \u9898"),i.a.createElement("span",{className:"c-light-black"},"\u4E3B\u89C2\u9898 ",(Be=Le.exerciseBanks)===null||Be===void 0||((Oe=Be.question_types)===null||Oe===void 0)?void 0:Oe.q_mains," \u9898")),i.a.createElement(S.a,{className:"c-light-black"},"\u5408\u8BA1 ",i.a.createElement("span",{className:"c-orange"},(Re=Le.exerciseBanks)===null||Re===void 0||((Ge=Re.question_types)===null||Ge===void 0)?void 0:Ge.q_counts)," \u9898"))),Pe!=""&&i.a.createElement("section",{className:[He.a.bg,"pt30","pl20","pr20","pb20","mt20"].join(" ")},rt()),i.a.createElement("section",{className:[He.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},nt.map(function(Xe,et){return i.a.createElement(W.a,{className:"mr20",type:"primary",onClick:function(){return Ce(Xe.id)}},i.a.createElement(v.a,{className:"mr5"}),Xe.name)})))},we=tt.default=Object(y.a)(function(Ee){var me=Ee.polls,ye=Ee.loading,ve=Ee.user,be=Ee.globalSetting;return{polls:me,globalSetting:be,user:ve,loading:ye.effects}})(pe)},Y1PL:function(ut,tt,ne){"use strict";ne.r(tt),ne.d(tt,"ResizableTextArea",function(){return $});var ce=ne("wx14"),W=ne("1OyB"),w=ne("vuIU"),j=ne("Ji7U"),I=ne("LK+K"),A=ne("q1tI"),F=ne("VTBJ"),M=ne("rePB"),O=ne("Zm9Q"),S=ne("Kwbf"),m=ne("c+Xe"),p=ne("m+aA"),o=ne("bdgK"),a=new Map;function n(ae){ae.forEach(function(oe){var ue,de=oe.target;(ue=a.get(de))===null||ue===void 0||ue.forEach(function(ie){return ie(de)})})}var l=new o.default(n),s=null,e=null;function t(ae,oe){a.has(ae)||(a.set(ae,new Set),l.observe(ae)),a.get(ae).add(oe)}function r(ae,oe){a.has(ae)&&(a.get(ae).delete(oe),a.get(ae).size||(l.unobserve(ae),a.delete(ae)))}var T=function(ae){Object(j.a)(ue,ae);var oe=Object(I.a)(ue);function ue(){return Object(W.a)(this,ue),oe.apply(this,arguments)}return Object(w.a)(ue,[{key:"render",value:function(){return this.props.children}}]),ue}(A.Component),g=A.createContext(null);function _(ae){var oe=ae.children,ue=ae.onBatchResize,de=A.useRef(0),ie=A.useRef([]),X=A.useContext(g),Se=A.useCallback(function(Ie,Ae,je){de.current+=1;var He=de.current;ie.current.push({size:Ie,element:Ae,data:je}),Promise.resolve().then(function(){He===de.current&&(ue==null||ue(ie.current),ie.current=[])}),X==null||X(Ie,Ae,je)},[ue,X]);return A.createElement(g.Provider,{value:Se},oe)}function E(ae){var oe=ae.children,ue=ae.disabled,de=A.useRef(null),ie=A.useRef(null),X=A.useContext(g),Se=A.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ie=A.isValidElement(oe)&&Object(m.c)(oe),Ae=Ie?oe.ref:null,je=A.useMemo(function(){return Object(m.a)(Ae,de)},[Ae,de]),He=A.useRef(ae);He.current=ae;var pe=A.useCallback(function(we){var Ee=He.current,me=Ee.onResize,ye=Ee.data,ve=we.getBoundingClientRect(),be=ve.width,Ke=ve.height,De=we.offsetWidth,ke=we.offsetHeight,Fe=Math.floor(be),re=Math.floor(Ke);if(Se.current.width!==Fe||Se.current.height!==re||Se.current.offsetWidth!==De||Se.current.offsetHeight!==ke){var Be={width:Fe,height:re,offsetWidth:De,offsetHeight:ke};Se.current=Be;var Oe=De===Math.round(be)?be:De,Re=ke===Math.round(Ke)?Ke:ke,Ge=Object(F.a)(Object(F.a)({},Be),{},{offsetWidth:Oe,offsetHeight:Re});X==null||X(Ge,we,ye),me&&Promise.resolve().then(function(){me(Ge,we)})}},[]);return A.useEffect(function(){var we=Object(p.a)(de.current)||Object(p.a)(ie.current);return we&&!ue&&t(we,pe),function(){return r(we,pe)}},[de.current,ue]),A.createElement(T,{ref:ie},Ie?A.cloneElement(oe,{ref:je}):oe)}var b="rc-observer-key";function c(ae){var oe=ae.children,ue=Object(O.a)(oe);return ue.map(function(de,ie){var X=(de==null?void 0:de.key)||"".concat(b,"-").concat(ie);return A.createElement(E,Object(ce.a)({},ae,{key:X}),de)})}c.Collection=_;var i=c,d=ne("bT9E"),h=ne("TSYQ"),y=ne.n(h),v=`
|
|
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"],k={},R;function U(ae){var oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ue=ae.getAttribute("id")||ae.getAttribute("data-reactid")||ae.getAttribute("name");if(oe&&k[ue])return k[ue];var de=window.getComputedStyle(ae),ie=de.getPropertyValue("box-sizing")||de.getPropertyValue("-moz-box-sizing")||de.getPropertyValue("-webkit-box-sizing"),X=parseFloat(de.getPropertyValue("padding-bottom"))+parseFloat(de.getPropertyValue("padding-top")),Se=parseFloat(de.getPropertyValue("border-bottom-width"))+parseFloat(de.getPropertyValue("border-top-width")),Ie=x.map(function(je){return"".concat(je,":").concat(de.getPropertyValue(je))}).join(";"),Ae={sizingStyle:Ie,paddingSize:X,borderSize:Se,boxSizing:ie};return oe&&ue&&(k[ue]=Ae),Ae}function N(ae){var oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ue=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,de=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;R||(R=document.createElement("textarea"),R.setAttribute("tab-index","-1"),R.setAttribute("aria-hidden","true"),document.body.appendChild(R)),ae.getAttribute("wrap")?R.setAttribute("wrap",ae.getAttribute("wrap")):R.removeAttribute("wrap");var ie=U(ae,oe),X=ie.paddingSize,Se=ie.borderSize,Ie=ie.boxSizing,Ae=ie.sizingStyle;R.setAttribute("style","".concat(Ae,";").concat(v)),R.value=ae.value||ae.placeholder||"";var je=Number.MIN_SAFE_INTEGER,He=Number.MAX_SAFE_INTEGER,pe=R.scrollHeight,we;if(Ie==="border-box"?pe+=Se:Ie==="content-box"&&(pe-=X),ue!==null||de!==null){R.value=" ";var Ee=R.scrollHeight-X;ue!==null&&(je=Ee*ue,Ie==="border-box"&&(je=je+X+Se),pe=Math.max(je,pe)),de!==null&&(He=Ee*de,Ie==="border-box"&&(He=He+X+Se),we=pe>He?"":"hidden",pe=Math.min(He,pe))}return{height:pe,minHeight:je,maxHeight:He,overflowY:we,resize:"none"}}var G=ne("Gytx"),L=ne.n(G),H;(function(ae){ae[ae.NONE=0]="NONE",ae[ae.RESIZING=1]="RESIZING",ae[ae.RESIZED=2]="RESIZED"})(H||(H={}));var V=function(ae){Object(j.a)(ue,ae);var oe=Object(I.a)(ue);function ue(de){var ie;return Object(W.a)(this,ue),ie=oe.call(this,de),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(X){ie.textArea=X},ie.handleResize=function(X){var Se=ie.state.resizeStatus,Ie=ie.props,Ae=Ie.autoSize,je=Ie.onResize;if(Se!==H.NONE)return;typeof je=="function"&&je(X),Ae&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var X=ie.props.autoSize;if(!X||!ie.textArea)return;var Se=X.minRows,Ie=X.maxRows,Ae=N(ie.textArea,!1,Se,Ie);ie.setState({textareaStyles:Ae,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:H.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:H.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var X=ie.props,Se=X.prefixCls,Ie=Se===void 0?"rc-textarea":Se,Ae=X.autoSize,je=X.onResize,He=X.className,pe=X.disabled,we=ie.state,Ee=we.textareaStyles,me=we.resizeStatus,ye=Object(d.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),ve=y()(Ie,He,Object(M.a)({},"".concat(Ie,"-disabled"),pe));"value"in ye&&(ye.value=ye.value||"");var be=Object(F.a)(Object(F.a)(Object(F.a)({},ie.props.style),Ee),me===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return A.createElement(i,{onResize:ie.handleResize,disabled:!(Ae||je)},A.createElement("textarea",Object(ce.a)({},ye,{className:ve,style:be,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:H.NONE},ie}return Object(w.a)(ue,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!L()(ie.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ie=this.textArea.selectionStart,X=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,X)}}catch(Se){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ue}(A.Component),$=V,q=function(ae){Object(j.a)(ue,ae);var oe=Object(I.a)(ue);function ue(de){var ie;Object(W.a)(this,ue),ie=oe.call(this,de),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function(Se){ie.resizableTextArea=Se},ie.handleChange=function(Se){var Ie=ie.props.onChange;ie.setValue(Se.target.value,function(){ie.resizableTextArea.resizeTextarea()}),Ie&&Ie(Se)},ie.handleKeyDown=function(Se){var Ie=ie.props,Ae=Ie.onPressEnter,je=Ie.onKeyDown;Se.keyCode===13&&Ae&&Ae(Se),je&&je(Se)};var X=typeof de.value=="undefined"||de.value===null?de.defaultValue:de.value;return ie.state={value:X},ie}return Object(w.a)(ue,[{key:"setValue",value:function(ie,X){"value"in this.props||this.setState({value:ie},X)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return A.createElement($,Object(ce.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),ue}(A.Component),he=tt.default=q},ZW9T:function(ut,tt,ne){"use strict";ne.d(tt,"a",function(){return N});var ce=ne("k1fw"),W=ne("miYZ"),w=ne("tsqr"),j=ne("rAM+"),I=ne("tJVT"),A=ne("PpiC"),F=ne("q1tI"),M=ne.n(F),O=ne("bdgK"),S=ne("oBTY"),m=ne("9og8"),p=ne("WmNS"),o=ne.n(p),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"]},n={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"]},l={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"#include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},s={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},e=ne("5VLF"),t=ne.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(L,H){return H.map(function(V){return{label:V,kind:L.languages.CompletionItemKind.Keyword,insertText:V}})},g=function(L){return Object.keys(r.tables).map(function(H){return{label:H,kind:L.languages.CompletionItemKind.Variable,insertText:H}})},_=function(L,H){var V=r.tables[L];return V?V.map(function($){return{label:$,kind:H.languages.CompletionItemKind.Field,insertText:$}}):[]};function E(G,L,H,V,$){var q=L.getWordUntilPosition(H),he={startLineNumber:H.lineNumber,endLineNumber:H.lineNumber,startColumn:q.startColumn,endColumn:q.endColumn},ae=V.map(function(oe){return{label:oe,kind:G.languages.CompletionItemKind.Keyword,insertText:oe,insertTextRules:G.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:he}});return $.map(function(oe){ae.push(Object(ce.a)(Object(ce.a)({},oe),{},{range:he}))}),ae}var b=function(G){r.languages.map(function($){return G.languages.registerDocumentFormattingEditProvider($,{provideDocumentFormattingEdits:function(he,ae,oe){return Object(m.a)(o.a.mark(function ue(){var de;return o.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return de=t()(he.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}),X.abrupt("return",[{range:he.getFullModelRange(),text:de}]);case 2:case"end":return X.stop()}},ue)}))()}}),$});var L=l.quickKey.map(function($){return{label:$.label,kind:G.languages.CompletionItemKind.Method,insertText:$.content,insertTextRules:G.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),H=s.quickKey.map(function($){return{label:$.label,kind:G.languages.CompletionItemKind.Method,insertText:$.content,insertTextRules:G.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),V=n.quickKey.map(function($){return{label:$.label,kind:G.languages.CompletionItemKind.Method,insertText:$.content,insertTextRules:G.languages.CompletionItemInsertTextRule.InsertAsSnippet}});G.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(S.a)(l.keywords),Object(S.a)(l.quickKey.map(function($){return $.label}))),provideCompletionItems:function(q,he){var ae=q.getValueInRange({startLineNumber:he.lineNumber,startColumn:1,endLineNumber:he.lineNumber,endColumn:he.column}),oe=ae.match(/cu/gim);console.log("match:",oe,he,ae,q);var ue=[],de=he.lineNumber,ie=he.column,X=q.getValueInRange({startLineNumber:de,startColumn:0,endLineNumber:de,endColumn:ie}),Se=X.trim().split(/\s+/),Ie=Se[Se.length-1];if(Ie.endsWith(".")){var Ae=Ie.slice(0,Ie.length-1);Object.keys(r.tables).includes(Ae)&&(ue=Object(S.a)(_(Ae,G)))}else Ie==="."?ue=[]:ue=[].concat(Object(S.a)(g(G)),Object(S.a)(T(G,l.keywords)),Object(S.a)(L));return{suggestions:ue}}}),G.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(S.a)(a.keywords)),provideCompletionItems:function(q,he){var ae=q.getValueInRange({startLineNumber:he.lineNumber,startColumn:1,endLineNumber:he.lineNumber,endColumn:he.column}),oe=ae.match(/cu/gim);console.log("match:",oe,he,ae,q);var ue=[],de=he.lineNumber,ie=he.column,X=q.getValueInRange({startLineNumber:de,startColumn:0,endLineNumber:de,endColumn:ie}),Se=X.trim().split(/\s+/),Ie=Se[Se.length-1];if(Ie.endsWith(".")){var Ae=Ie.slice(0,Ie.length-1);Object.keys(r.tables).includes(Ae)&&(ue=Object(S.a)(_(Ae,G)))}else Ie==="."?ue=[]:ue=[].concat(Object(S.a)(g(G)),Object(S.a)(T(G,a.keywords)));return{suggestions:ue}}}),G.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(S.a)(n.keywords)),provideCompletionItems:function(q,he){var ae=[],oe=he.lineNumber,ue=he.column,de=q.getValueInRange({startLineNumber:oe,startColumn:0,endLineNumber:oe,endColumn:ue}),ie=de.trim().split(/\s+/),X=ie[ie.length-1];if(X.endsWith(".")){var Se=X.slice(0,X.length-1);Object.keys(r.tables).includes(Se)&&(ae=Object(S.a)(_(Se,G)))}else X==="."?ae=[]:ae=[].concat(Object(S.a)(g(G)),Object(S.a)(T(G,n.keywords)),Object(S.a)(V));return{suggestions:ae}}}),G.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(S.a)(s.keywords)),provideCompletionItems:function(q,he){var ae=[],oe=he.lineNumber,ue=he.column,de=q.getValueInRange({startLineNumber:oe,startColumn:0,endLineNumber:oe,endColumn:ue}),ie=de.trim().split(/\s+/),X=ie[ie.length-1];if(X.endsWith(".")){var Se=X.slice(0,X.length-1);Object.keys(r.tables).includes(Se)&&(ae=Object(S.a)(_(Se,G)))}else X==="."?ae=[]:ae=[].concat(Object(S.a)(g(G)),Object(S.a)(T(G,s.keywords)),Object(S.a)(H));return{suggestions:ae}}})},c="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",i=ne("LvDl"),d=ne("+ua5");function h(G){return/^\d+$/.test(G)?"".concat(G,"px"):G}function y(){}var v=!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 k(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],L=G;if(Array.isArray(G)){for(var H=0;H<G.length;H++){var V=x[G[H]];if(V)return V}return L[0]}return x[L]||L}var R=null,U=tt.b=function(G){var L=G.width,H=L===void 0?"100%":L,V=G.height,$=V===void 0?"100%":V,q=G.value,he=G.language,ae=he===void 0?"javascript":he,oe=G.style,ue=oe===void 0?{}:oe,de=G.options,ie=de===void 0?{}:de,X=G.overrideServices,Se=X===void 0?{}:X,Ie=G.theme,Ae=Ie===void 0?"vs-dark":Ie,je=G.onEditBlur,He=G.onSave,pe=G.autoHeight,we=pe===void 0?!1:pe,Ee=G.forbidCopy,me=Ee===void 0?!1:Ee,ye=G.onChange,ve=ye===void 0?y:ye,be=G.editorDidMount,Ke=be===void 0?y:be,De=G.onFocus,ke=De===void 0?y:De,Fe=G.filename,re=Fe===void 0?"educoder.txt":Fe,Be=G.errorLine,Oe=G.errorContent,Re=Oe===void 0?"":Oe,Ge=Object(A.a)(G,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Le=Object(F.useRef)(),le=Object(F.useRef)({}),Te=Object(F.useRef)(),te=Object(F.useRef)(!1),J=Object(F.useRef)(),ee=Object(F.useState)(!1),K=Object(I.a)(ee,2),z=K[0],Y=K[1];function Q(){var Ce;return Le.current&&(Ce=new O.default(function($e){var rt=Object(j.a)($e),Xe;try{for(rt.s();!(Xe=rt.n()).done;){var et=Xe.value;(et.target.offsetHeight>0||et.target.offsetWidth>0)&&le.current.instance.layout()}}catch(lt){rt.e(lt)}finally{rt.f()}}),Ce.observe(Le.current)),Ce}function se(){w.b.warn(decodeURIComponent(c))}var fe=function(){var $e=le.current.instance;if(q!=null&&$e&&z){var rt=$e.getModel();rt&&q!==rt.getValue()&&(v=!0,rt.setValue(q),$e.layout(),v=!1)}};Object(F.useEffect)(function(){Te.current&&clearTimeout(Te.current),Te.current=setTimeout(function(){fe()},500)},[q,z,le.current]),Object(F.useEffect)(function(){if(Be&&le.current&&le.current.instance){var Ce=le.current.instance;Ce.changeViewZones(function(rt){var Xe=document.createElement("div");Xe.style.padding="10px 20px",Xe.style.width="calc(100% - 20px)",Xe.className="my-error-line-wrp",Xe.innerHTML=Re,rt.addZone({afterLineNumber:Be||11,heightInLines:3,domNode:Xe})});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}};Ce.addOverlayWidget($e),Ce.revealPositionInCenter({lineNumber:20,column:1})}},[Be,le.current,z]);function xe(){var Ce=le.current.instance;if(Ce){var $e=Ce.getSelection(),rt=le.current.pastePos||{},Xe=new R.Range(rt.startLineNumber||$e.endLineNumber,rt.startColumn||$e.endColumn,rt.endLineNumber||$e.endLineNumber,rt.endColumn||$e.endColumn);setTimeout(function(){Ce.executeEdits("",[{range:Xe,text:""}])},300)}}function Pe(Ce){(window.navigator.platform.match("Mac")?Ce.metaKey:Ce.ctrlKey)&&Ce.keyCode==83&&(Ce.preventDefault(),He())}var Ue=function(){if(we&&le.current.instance){var $e=le.current.instance.getContentHeight();mt($e<$?$:$e)}else mt($)};function Me(Ce){var $e=document.createEvent("MouseEvents");$e.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Ce.dispatchEvent($e)}function Ye(Ce,$e){var rt=window.URL||window.webkitURL||window,Xe=new Blob([$e]),et=document.createElementNS("http://www.w3.org/1999/xhtml","a");et.href=rt.createObjectURL(Xe),et.download=Ce,Me(et)}Object(F.useEffect)(function(){Ue()},[Ue]),Object(F.useEffect)(function(){Le.current&&!z&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Ce){try{R=Ce,le.current.instance=R.editor.create(Le.current,{value:q,language:k(ae),theme:Ae,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Se);var $e=le.current.instance;if(Ke($e,R),setTimeout(function(){Ue(),le.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ye(re||"educoder.txt",$e.getValue())}})},500),le.current.subscription=$e.onDidChangeModelContent(function(Xe){te.current?clearTimeout(J.current):(Ue(),ve($e.getValue(),Xe)),J.current=setTimeout(function(){te.current=!1},500)}),window.Monaco||b(R),me&&($e.addCommand(R.KeyMod.CtrlCmd|R.KeyMod.Shift|R.KeyCode.KEY_V,function(){return se(),null}),$e.addCommand(R.KeyMod.CtrlCmd|R.KeyCode.KEY_C,function(){return se(),null})),window.Monaco=R,je&&$e.onDidBlurEditorWidget(function(){je($e.getValue())}),ke&&$e.onDidFocusEditorText(function(){ke($e.getValue())}),me){$e.addCommand(R.KeyMod.CtrlCmd|R.KeyCode.KEY_V,function(){return se(),null}),$e.onDidPaste(function(Xe){le.current.pastePos=Xe});try{window.addEventListener("paste",xe)}catch(Xe){}}var rt=Q();return Y(!0),function(){var Xe=le.current.instance;Xe.dispose();var et=Xe.getModel();et&&et.dispose(),le.current.subscription&&le.current.subscription.dispose(),me&&window.removeEventListener("paste",xe),rt.unobserve(Le.current)}}catch(Xe){}})},[]),Object(F.useEffect)(function(){var Ce=le.current.instance;if(Ce&&z)return document.addEventListener("keydown",Pe,!1),function(){document.removeEventListener("keydown",Pe)}},[He,z]),Object(F.useEffect)(function(){var Ce=le.current.instance;if(Ce&&z){var $e=k(ae);R.editor.setModelLanguage(Ce.getModel(),$e),console.log("language:",ae,Ce.getModel(),$e)}},[ae,z]),Object(F.useEffect)(function(){var Ce=le.current.instance;Ce&&z&&R.editor.setTheme(Ae)},[Ae,z]),Object(F.useEffect)(function(){var Ce=le.current.instance;Ce&&z&&(Ce.updateOptions(Object(ce.a)({},ie)),setTimeout(function(){Ce.getModel().updateOptions(Object(ce.a)({},ie))},200))},[JSON.stringify(ie),z]),Object(F.useEffect)(function(){var Ce=le.current.instance;Ce&&z&&Ce.layout()},[H,$,z]);var Qe=Object(F.useState)(h(H)),We=Object(I.a)(Qe,2),Je=We[0],ot=We[1],dt=Object(F.useState)(h($)),Ze=Object(I.a)(dt,2),nt=Ze[0],mt=Ze[1],It=Object(ce.a)(Object(ce.a)({},ue),{},{width:Je,height:nt});return M.a.createElement("div",{className:"my-monaco-editor",ref:Le,style:It})};function N(G){var L=G.width,H=L===void 0?"100%":L,V=G.height,$=V===void 0?"100%":V,q=G.original,he=G.modified,ae=G.language,oe=G.options,ue=oe===void 0?{}:oe,de=Object(F.useRef)(),ie=Object(F.useState)(null),X=Object(I.a)(ie,2),Se=X[0],Ie=X[1];function Ae(we){var Ee;return de.current&&(Ee=new O.default(function(me){var ye=Object(j.a)(me),ve;try{for(ye.s();!(ve=ye.n()).done;){var be=ve.value;(be.target.offsetHeight>0||be.target.offsetWidth>0)&&we.layout()}}catch(Ke){ye.e(Ke)}finally{ye.f()}}),Ee.observe(de.current)),Ee}Object(F.useEffect)(function(){de.current&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(we){R=we;var Ee=R.editor.createDiffEditor(de.current,Object(ce.a)(Object(ce.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},ue),{},{wordWrap:!0}));Ie(Ee);var me=Ae(Ee);return function(){Ee.dispose();var ye=Ee.getModel();ye&&ye.dispose(),me.unobserve(de.current)}})},[]),Object(F.useEffect)(function(){Se&&Se.setModel({original:R.editor.createModel(q,ae),modified:R.editor.createModel(he,ae)})},[q,he,ae,Se]);var je=h(H),He=h($),pe={width:je,height:He};return M.a.createElement("div",{className:"my-diff-editor",ref:de,style:pe})}},ZpRC:function(ut,tt,ne){"use strict";function ce(m){return typeof m=="object"&&m!=null&&m.nodeType===1}function W(m,p){return(!p||m!=="hidden")&&m!=="visible"&&m!=="clip"}function w(m,p){if(m.clientHeight<m.scrollHeight||m.clientWidth<m.scrollWidth){var o=getComputedStyle(m,null);return W(o.overflowY,p)||W(o.overflowX,p)||function(a){var n=function(l){if(!l.ownerDocument||!l.ownerDocument.defaultView)return null;try{return l.ownerDocument.defaultView.frameElement}catch(s){return null}}(a);return!!n&&(n.clientHeight<a.scrollHeight||n.clientWidth<a.scrollWidth)}(m)}return!1}function j(m,p,o,a,n,l,s,e){return l<m&&s>p||l>m&&s<p?0:l<=m&&e<=o||s>=p&&e>=o?l-m-a:s>p&&e<o||l<m&&e>o?s-p+n:0}var I=function(m,p){var o=window,a=p.scrollMode,n=p.block,l=p.inline,s=p.boundary,e=p.skipOverflowHiddenElements,t=typeof s=="function"?s:function(Ee){return Ee!==s};if(!ce(m))throw new TypeError("Invalid target");for(var r=document.scrollingElement||document.documentElement,T=[],g=m;ce(g)&&t(g);){if((g=g.parentElement)===r){T.push(g);break}g!=null&&g===document.body&&w(g)&&!w(document.documentElement)||g!=null&&w(g,e)&&T.push(g)}for(var _=o.visualViewport?o.visualViewport.width:innerWidth,E=o.visualViewport?o.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,c=window.scrollY||pageYOffset,i=m.getBoundingClientRect(),d=i.height,h=i.width,y=i.top,v=i.right,x=i.bottom,k=i.left,R=n==="start"||n==="nearest"?y:n==="end"?x:y+d/2,U=l==="center"?k+h/2:l==="end"?v:k,N=[],G=0;G<T.length;G++){var L=T[G],H=L.getBoundingClientRect(),V=H.height,$=H.width,q=H.top,he=H.right,ae=H.bottom,oe=H.left;if(a==="if-needed"&&y>=0&&k>=0&&x<=E&&v<=_&&y>=q&&x<=ae&&k>=oe&&v<=he)return N;var ue=getComputedStyle(L),de=parseInt(ue.borderLeftWidth,10),ie=parseInt(ue.borderTopWidth,10),X=parseInt(ue.borderRightWidth,10),Se=parseInt(ue.borderBottomWidth,10),Ie=0,Ae=0,je="offsetWidth"in L?L.offsetWidth-L.clientWidth-de-X:0,He="offsetHeight"in L?L.offsetHeight-L.clientHeight-ie-Se:0;if(r===L)Ie=n==="start"?R:n==="end"?R-E:n==="nearest"?j(c,c+E,E,ie,Se,c+R,c+R+d,d):R-E/2,Ae=l==="start"?U:l==="center"?U-_/2:l==="end"?U-_:j(b,b+_,_,de,X,b+U,b+U+h,h),Ie=Math.max(0,Ie+c),Ae=Math.max(0,Ae+b);else{Ie=n==="start"?R-q-ie:n==="end"?R-ae+Se+He:n==="nearest"?j(q,ae,V,ie,Se+He,R,R+d,d):R-(q+V/2)+He/2,Ae=l==="start"?U-oe-de:l==="center"?U-(oe+$/2)+je/2:l==="end"?U-he+X+je:j(oe,he,$,de,X+je,U,U+h,h);var pe=L.scrollLeft,we=L.scrollTop;R+=we-(Ie=Math.max(0,Math.min(we+Ie,L.scrollHeight-V+He))),U+=pe-(Ae=Math.max(0,Math.min(pe+Ae,L.scrollWidth-$+je)))}N.push({el:L,top:Ie,left:Ae})}return N};function A(m){return m===Object(m)&&Object.keys(m).length!==0}function F(m,p){p===void 0&&(p="auto");var o="scrollBehavior"in document.body.style;m.forEach(function(a){var n=a.el,l=a.top,s=a.left;n.scroll&&o?n.scroll({top:l,left:s,behavior:p}):(n.scrollTop=l,n.scrollLeft=s)})}function M(m){return m===!1?{block:"end",inline:"nearest"}:A(m)?m:{block:"start",inline:"nearest"}}function O(m,p){var o=!m.ownerDocument.documentElement.contains(m);if(A(p)&&typeof p.behavior=="function")return p.behavior(o?[]:I(m,p));if(o)return;var a=M(p);return F(I(m,a),a.behavior)}var S=tt.a=O},bT9E:function(ut,tt,ne){"use strict";ne.d(tt,"a",function(){return W});var ce=ne("VTBJ");function W(w,j){var I=Object(ce.a)({},w);return Array.isArray(j)&&j.forEach(function(A){delete I[A]}),I}},otbz:function(ut,tt,ne){ut.exports={flex_box_center:"flex_box_center___3WVQg",flex_space_between:"flex_space_between___qOmUA",flex_box_vertical_center:"flex_box_vertical_center___3Tvh1",flex_box_center_end:"flex_box_center_end___vdEZx",flex_box_column:"flex_box_column___1y_IJ",wrap:"wrap___ciPTn",modal:"modal___2lr4h",titleWrap:"titleWrap___2Szy4",required:"required___2OpIu",title:"title___hZmu6",colorGray:"colorGray___32oND",choiceWrap:"choiceWrap___24IrF",answer:"answer___3w_7N",activeAnswer:"activeAnswer___f89lY",deleteIcon:"deleteIcon___qd0T4",addIcon:"addIcon___GQKIw",editorWrap:"editorWrap___iuxhH",htmlWrap:"htmlWrap___17kgS",radio:"radio___3IfyE",color333:"color333___1rjEP",color999:"color999___25PqS",questionType:"questionType___3G5uc",questionChoices:"questionChoices___GBK2t"}},p5ED:function(ut,tt,ne){"use strict";var ce=ne("+L6B"),W=ne("2/Rp"),w=ne("5Dmo"),j=ne("3S7+"),I=ne("k1fw"),A=ne("tJVT"),F=ne("q1tI"),M=ne.n(F),O=ne("vHTk"),S=ne.n(O),m=ne("yEEn"),p=ne("ZW9T"),o=ne("1vsH");tt.a=function(a){var n=a.name,l=a.data,s=a.theme,e=a.type,t=a.filename,r=a.monacoEditor,T=a.className,g=a.style,_=a.close,E=a.onClose,b=a.hasMask,c=Object(F.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),i=Object(A.a)(c,2),d=i[0],h=i[1],y=Object(F.useState)(""),v=Object(A.a)(y,2),x=v[0],k=v[1],R,U=1024*1024,N=10*U,G=Object(F.useRef)();e==="office"&&(R=Object(o.T)(l).filesize,R>N&&(e="other")),t&&(r.filename=t),Object(F.useEffect)(function(){var V,$,q=(V=document.cookie)===null||V===void 0||(($=V.replace(/\s/g,""))===null||$===void 0)?void 0:$.split(";");q==null||q.map(function(he){var ae=he.split("=");ae[0]==="_educoder_session"&&k(ae[1])})},[]);var L=function(){if(l.startsWith("http")||l.startsWith("/")){H();return}Object(o.z)(t||"educoder",l,t)},H=function(){Object(o.x)(t||n,l)};return console.log("data:",l,"fileanme:",t," name:",n),M.a.createElement("div",{style:Object(I.a)({},g||{}),className:"".concat(b&&S.a.bgBlack," ").concat(e?S.a.wrp:"hide")},_&&M.a.createElement("div",{className:S.a.close,ref:G},M.a.createElement(j.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return G.current}},M.a.createElement("span",{onClick:H},M.a.createElement("i",{className:"icon-quxiaozhiding"}))),M.a.createElement(j.a,{title:"\u5173\u95ED",getPopupContainer:function(){return G.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(p.b,r)),e==="audio"&&M.a.createElement("audio",{src:"".concat(l!=null&&l.startsWith("/")||(l==null?void 0:l.indexOf("https://"))>-1?l:"data:audio/mp3;base64,").concat(l),autoPlay:!0}),e==="video"&&M.a.createElement(M.a.Fragment,null,l!=null&&l.startsWith("/")?M.a.createElement("video",{controls:!0,src:"".concat(l),autoPlay:!0}):M.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(l),autoPlay:!0})),e==="html"&&M.a.createElement("iframe",{src:l+"&disposition=inline"}),e==="pdf"&&M.a.createElement("embed",{className:S.a.embed,src:l}),e==="image"&&M.a.createElement(M.a.Fragment,null,M.a.createElement("img",{src:"".concat(l!=null&&l.startsWith("/")||(l==null?void 0:l.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(l)})),e==="other"&&M.a.createElement("div",null,M.a.createElement(W.a,{type:"primary",size:"large",onClick:L},M.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(e==="download"||e==="office")&&M.a.createElement(W.a,{type:"primary",size:"large",onClick:L},M.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},psGv:function(ut,tt,ne){var ce,W;(function(){var w;(function(){"use strict";var F=[,,function(m){function p(n){this.__parent=n,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}p.prototype.clone_empty=function(){var n=new p(this.__parent);return n.set_indent(this.__indent_count,this.__alignment_count),n},p.prototype.item=function(n){return n<0?this.__items[this.__items.length+n]:this.__items[n]},p.prototype.has_match=function(n){for(var l=this.__items.length-1;l>=0;l--)if(this.__items[l].match(n))return!0;return!1},p.prototype.set_indent=function(n,l){this.is_empty()&&(this.__indent_count=n||0,this.__alignment_count=l||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},p.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},p.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},p.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var n=this.__parent.current_line;return n.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),n.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),n.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,n.__items[0]===" "&&(n.__items.splice(0,1),n.__character_count-=1),!0}return!1},p.prototype.is_empty=function(){return this.__items.length===0},p.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},p.prototype.push=function(n){this.__items.push(n);var l=n.lastIndexOf(`
|
|
`);l!==-1?this.__character_count=n.length-l:this.__character_count+=n.length},p.prototype.pop=function(){var n=null;return this.is_empty()||(n=this.__items.pop(),this.__character_count-=n.length),n},p.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},p.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},p.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},p.prototype.toString=function(){var n="";return this.is_empty()?this.__parent.indent_empty_lines&&(n=this.__parent.get_indent_string(this.__indent_count)):(n=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),n+=this.__items.join("")),n};function o(n,l){this.__cache=[""],this.__indent_size=n.indent_size,this.__indent_string=n.indent_char,n.indent_with_tabs||(this.__indent_string=new Array(n.indent_size+1).join(n.indent_char)),l=l||"",n.indent_level>0&&(l=new Array(n.indent_level+1).join(this.__indent_string)),this.__base_string=l,this.__base_string_length=l.length}o.prototype.get_indent_size=function(n,l){var s=this.__base_string_length;return l=l||0,n<0&&(s=0),s+=n*this.__indent_size,s+=l,s},o.prototype.get_indent_string=function(n,l){var s=this.__base_string;return l=l||0,n<0&&(n=0,s=""),l+=n*this.__indent_size,this.__ensure_cache(l),s+=this.__cache[l],s},o.prototype.__ensure_cache=function(n){for(;n>=this.__cache.length;)this.__add_column()},o.prototype.__add_column=function(){var n=this.__cache.length,l=0,s="";this.__indent_size&&n>=this.__indent_size&&(l=Math.floor(n/this.__indent_size),n-=l*this.__indent_size,s=new Array(l+1).join(this.__indent_string)),n&&(s+=new Array(n+1).join(" ")),this.__cache.push(s)};function a(n,l){this.__indent_cache=new o(n,l),this.raw=!1,this._end_with_newline=n.end_with_newline,this.indent_size=n.indent_size,this.wrap_line_length=n.wrap_line_length,this.indent_empty_lines=n.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new p(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}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(n,l){return this.__indent_cache.get_indent_string(n,l)},a.prototype.get_indent_size=function(n,l){return this.__indent_cache.get_indent_size(n,l)},a.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},a.prototype.add_new_line=function(n){return this.is_empty()||!n&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},a.prototype.get_code=function(n){this.trim(!0);var l=this.current_line.pop();l&&(l[l.length-1]===`
|
|
`&&(l=l.replace(/\n+$/g,"")),this.current_line.push(l)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(`
|
|
`);return n!==`
|
|
`&&(s=s.replace(/[\n]/g,n)),s},a.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},a.prototype.set_indent=function(n,l){return n=n||0,l=l||0,this.next_line.set_indent(n,l),this.__lines.length>1?(this.current_line.set_indent(n,l),!0):(this.current_line.set_indent(),!1)},a.prototype.add_raw_token=function(n){for(var l=0;l<n.newlines;l++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(n.whitespace_before),this.current_line.push(n.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},a.prototype.add_token=function(n){this.__add_space_before_token(),this.current_line.push(n),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(n){for(var l=this.__lines.length;n<l;)this.__lines[n]._remove_indent(),n++;this.current_line._remove_wrap_indent()},a.prototype.trim=function(n){for(n=n===void 0?!1:n,this.current_line.trim();n&&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(n,l){for(var s=this.__lines.length-2;s>=0;){var e=this.__lines[s];if(e.is_empty())break;if(e.item(0).indexOf(n)!==0&&e.item(-1)!==l){this.__lines.splice(s+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},m.exports.Output=a},function(m){function p(o,a,n,l){this.type=o,this.text=a,this.comments_before=null,this.newlines=n||0,this.whitespace_before=l||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}m.exports.Token=p},,,function(m){function p(n,l){this.raw_options=o(n,l),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}p.prototype._get_array=function(n,l){var s=this.raw_options[n],e=l||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(e=s.concat()):typeof s=="string"&&(e=s.split(/[^a-zA-Z0-9_\/\-]+/)),e},p.prototype._get_boolean=function(n,l){var s=this.raw_options[n],e=s===void 0?!!l:!!s;return e},p.prototype._get_characters=function(n,l){var s=this.raw_options[n],e=l||"";return typeof s=="string"&&(e=s.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),e},p.prototype._get_number=function(n,l){var s=this.raw_options[n];l=parseInt(l,10),isNaN(l)&&(l=0);var e=parseInt(s,10);return isNaN(e)&&(e=l),e},p.prototype._get_selection=function(n,l,s){var e=this._get_selection_list(n,l,s);if(e.length!==1)throw new Error("Invalid Option Value: The option '"+n+`' can only be one of the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[n]+"'");return e[0]},p.prototype._get_selection_list=function(n,l,s){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[l[0]],!this._is_valid_selection(s,l))throw new Error("Invalid Default Value!");var e=this._get_array(n,s);if(!this._is_valid_selection(e,l))throw new Error("Invalid Option Value: The option '"+n+`' can contain only the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[n]+"'");return e},p.prototype._is_valid_selection=function(n,l){return n.length&&l.length&&!n.some(function(s){return l.indexOf(s)===-1})};function o(n,l){var s={};n=a(n);var e;for(e in n)e!==l&&(s[e]=n[e]);if(l&&n[l])for(e in n[l])s[e]=n[l][e];return s}function a(n){var l={},s;for(s in n){var e=s.replace(/-/g,"_");l[e]=n[s]}return l}m.exports.Options=p,m.exports.normalizeOpts=a,m.exports.mergeOpts=o},,function(m){var p=RegExp.prototype.hasOwnProperty("sticky");function o(a){this.__input=a||"",this.__input_length=this.__input.length,this.__position=0}o.prototype.restart=function(){this.__position=0},o.prototype.back=function(){this.__position>0&&(this.__position-=1)},o.prototype.hasNext=function(){return this.__position<this.__input_length},o.prototype.next=function(){var a=null;return this.hasNext()&&(a=this.__input.charAt(this.__position),this.__position+=1),a},o.prototype.peek=function(a){var n=null;return a=a||0,a+=this.__position,a>=0&&a<this.__input_length&&(n=this.__input.charAt(a)),n},o.prototype.__match=function(a,n){a.lastIndex=n;var l=a.exec(this.__input);return l&&!(p&&a.sticky)&&(l.index!==n&&(l=null)),l},o.prototype.test=function(a,n){return n=n||0,n+=this.__position,n>=0&&n<this.__input_length?!!this.__match(a,n):!1},o.prototype.testChar=function(a,n){var l=this.peek(n);return a.lastIndex=0,l!==null&&a.test(l)},o.prototype.match=function(a){var n=this.__match(a,this.__position);return n?this.__position+=n[0].length:n=null,n},o.prototype.read=function(a,n,l){var s="",e;return a&&(e=this.match(a),e&&(s+=e[0])),n&&(e||!a)&&(s+=this.readUntil(n,l)),s},o.prototype.readUntil=function(a,n){var l="",s=this.__position;a.lastIndex=this.__position;var e=a.exec(this.__input);return e?(s=e.index,n&&(s+=e[0].length)):s=this.__input_length,l=this.__input.substring(this.__position,s),this.__position=s,l},o.prototype.readUntilAfter=function(a){return this.readUntil(a,!0)},o.prototype.get_regexp=function(a,n){var l=null,s="g";return n&&p&&(s="y"),typeof a=="string"&&a!==""?l=new RegExp(a,s):a&&(l=new RegExp(a.source,s)),l},o.prototype.get_literal_regexp=function(a){return RegExp(a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},o.prototype.peekUntilAfter=function(a){var n=this.__position,l=this.readUntilAfter(a);return this.__position=n,l},o.prototype.lookBack=function(a){var n=this.__position-1;return n>=a.length&&this.__input.substring(n-a.length,n).toLowerCase()===a},m.exports.InputScanner=o},function(m,p,o){var a=o(8).InputScanner,n=o(3).Token,l=o(10).TokenStream,s=o(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 s(this._input)};t.prototype.tokenize=function(){this._input.restart(),this.__tokens=new l,this._reset();for(var r,T=new n(e.START,""),g=null,_=[],E=new l;T.type!==e.EOF;){for(r=this._get_next_token(T,g);this._is_comment(r);)E.add(r),r=this._get_next_token(T,g);E.isEmpty()||(r.comments_before=E,E=new l),r.parent=g,this._is_opening(r)?(_.push(g),g=r):g&&this._is_closing(r,g)&&(r.opened=g,g.closed=r,g=_.pop(),r.parent=g),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 g=this._input.read(/.+/g);return g?this._create_token(e.RAW,g):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 g=new n(r,T,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return g},t.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},m.exports.Tokenizer=t,m.exports.TOKEN=e},function(m){function p(o){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=o}p.prototype.restart=function(){this.__position=0},p.prototype.isEmpty=function(){return this.__tokens_length===0},p.prototype.hasNext=function(){return this.__position<this.__tokens_length},p.prototype.next=function(){var o=null;return this.hasNext()&&(o=this.__tokens[this.__position],this.__position+=1),o},p.prototype.peek=function(o){var a=null;return o=o||0,o+=this.__position,o>=0&&o<this.__tokens_length&&(a=this.__tokens[o]),a},p.prototype.add=function(o){this.__parent_token&&(o.parent=this.__parent_token),this.__tokens.push(o),this.__tokens_length+=1},m.exports.TokenStream=p},function(m,p,o){var a=o(12).Pattern;function n(l,s){a.call(this,l,s),s?this._line_regexp=this._input.get_regexp(s._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}n.prototype=new a,n.prototype.__set_whitespace_patterns=function(l,s){l+="\\t ",s+="\\n\\r",this._match_pattern=this._input.get_regexp("["+l+s+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+s+"]")},n.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var l=this._input.read(this._match_pattern);if(l===" ")this.whitespace_before_token=" ";else if(l){var s=this.__split(this._newline_regexp,l);this.newline_count=s.length-1,this.whitespace_before_token=s[this.newline_count]}return l},n.prototype.matching=function(l,s){var e=this._create();return e.__set_whitespace_patterns(l,s),e._update(),e},n.prototype._create=function(){return new n(this._input,this)},n.prototype.__split=function(l,s){l.lastIndex=0;for(var e=0,t=[],r=l.exec(s);r;)t.push(s.substring(e,r.index)),e=r.index+r[0].length,r=l.exec(s);return e<s.length?t.push(s.substring(e,s.length)):t.push(""),t},m.exports.WhitespacePattern=n},function(m){function p(o,a){this._input=o,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)}p.prototype.read=function(){var o=this._input.read(this._starting_pattern);return(!this._starting_pattern||o)&&(o+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),o},p.prototype.read_match=function(){return this._input.match(this._match_pattern)},p.prototype.until_after=function(o){var a=this._create();return a._until_after=!0,a._until_pattern=this._input.get_regexp(o),a._update(),a},p.prototype.until=function(o){var a=this._create();return a._until_after=!1,a._until_pattern=this._input.get_regexp(o),a._update(),a},p.prototype.starting_with=function(o){var a=this._create();return a._starting_pattern=this._input.get_regexp(o,!0),a._update(),a},p.prototype.matching=function(o){var a=this._create();return a._match_pattern=this._input.get_regexp(o,!0),a._update(),a},p.prototype._create=function(){return new p(this._input,this)},p.prototype._update=function(){},m.exports.Pattern=p},function(m){function p(o,a){o=typeof o=="string"?o:o.source,a=typeof a=="string"?a:a.source,this.__directives_block_pattern=new RegExp(o+/ beautify( \w+[:]\w+)+ /.source+a,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(o+/\sbeautify\signore:end\s/.source+a,"g")}p.prototype.get_directives=function(o){if(!o.match(this.__directives_block_pattern))return null;var a={};this.__directive_pattern.lastIndex=0;for(var n=this.__directive_pattern.exec(o);n;)a[n[1]]=n[2],n=this.__directive_pattern.exec(o);return a},p.prototype.readIgnored=function(o){return o.readUntilAfter(this.__directives_end_ignore_pattern)},m.exports.Directives=p},function(m,p,o){var a=o(12).Pattern,n={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function l(s,e){a.call(this,s,e),this.__template_pattern=null,this._disabled=Object.assign({},n),this._excluded=Object.assign({},n),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(s);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}/)}}l.prototype=new a,l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){this.__set_templated_pattern()},l.prototype.disable=function(s){var e=this._create();return e._disabled[s]=!0,e._update(),e},l.prototype.read_options=function(s){var e=this._create();for(var t in n)e._disabled[t]=s.templating.indexOf(t)===-1;return e._update(),e},l.prototype.exclude=function(s){var e=this._create();return e._excluded[s]=!0,e._update(),e},l.prototype.read=function(){var s="";this._match_pattern?s=this._input.read(this._starting_pattern):s=this._input.read(this._starting_pattern,this.__template_pattern);for(var e=this._read_template();e;)this._match_pattern?e+=this._input.read(this._match_pattern):e+=this._input.readUntil(this.__template_pattern),s+=e,e=this._read_template();return this._until_after&&(s+=this._input.readUntilAfter(this._until_pattern)),s},l.prototype.__set_templated_pattern=function(){var s=[];this._disabled.php||s.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||s.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||s.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(s.push(this.__patterns.django._starting_pattern.source),s.push(this.__patterns.django_value._starting_pattern.source),s.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||s.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&s.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+s.join("|")+")")},l.prototype._read_template=function(){var s="",e=this._input.peek();if(e==="<"){var t=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&t==="?"&&(s=s||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&t==="%"&&(s=s||this.__patterns.erb.read())}else e==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(s=s||this.__patterns.handlebars_comment.read(),s=s||this.__patterns.handlebars_unescaped.read(),s=s||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(s=s||this.__patterns.django_value.read()),this._excluded.django||(s=s||this.__patterns.django_comment.read(),s=s||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(s=s||this.__patterns.smarty_comment.read(),s=s||this.__patterns.smarty_literal.read(),s=s||this.__patterns.smarty.read()));return s},m.exports.TemplatablePattern=l},,,,function(m,p,o){var a=o(19).Beautifier,n=o(20).Options;function l(s,e,t,r){var T=new a(s,e,t,r);return T.beautify()}m.exports=l,m.exports.defaultOptions=function(){return new n}},function(m,p,o){var a=o(20).Options,n=o(2).Output,l=o(21).Tokenizer,s=o(21).TOKEN,e=/\r\n|[\r\n]/,t=/\r\n|[\r\n]/g,r=function(y,v){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=y.max_preserve_newlines,this.preserve_newlines=y.preserve_newlines,this._output=new n(y,v)};r.prototype.current_line_has_match=function(y){return this._output.current_line.has_match(y)},r.prototype.set_space_before_token=function(y,v){this._output.space_before_token=y,this._output.non_breaking_space=v},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(y){this._output.add_raw_token(y)},r.prototype.print_preserved_newlines=function(y){var v=0;y.type!==s.TEXT&&y.previous.type!==s.TEXT&&(v=y.newlines?1:0),this.preserve_newlines&&(v=y.newlines<this.max_preserve_newlines+1?y.newlines:this.max_preserve_newlines+1);for(var x=0;x<v;x++)this.print_newline(x>0);return v!==0},r.prototype.traverse_whitespace=function(y){return y.whitespace_before||y.newlines?(this.print_preserved_newlines(y)||(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(y){this._output.add_new_line(y)},r.prototype.print_token=function(y){y.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(y.text))},r.prototype.indent=function(){this.indent_level++},r.prototype.get_full_indent=function(y){return y=this.indent_level+(y||0),y<1?"":this._output.get_indent_string(y)};var T=function(y){for(var v=null,x=y.next;x.type!==s.EOF&&y.closed!==x;){if(x.type===s.ATTRIBUTE&&x.text==="type"){x.next&&x.next.type===s.EQUALS&&x.next.next&&x.next.next.type===s.VALUE&&(v=x.next.next.text);break}x=x.next}return v},g=function(y,v){var x=null,k=null;return v.closed?(y==="script"?x="text/javascript":y==="style"&&(x="text/css"),x=T(v)||x,x.search("text/css")>-1?k="css":x.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?k="javascript":x.search(/(text|application|dojo)\/(x-)?(html)/)>-1?k="html":x.search(/test\/null/)>-1&&(k="null"),k):null};function _(y,v){return v.indexOf(y)!==-1}function E(y,v,x){this.parent=y||null,this.tag=v?v.tag_name:"",this.indent_level=x||0,this.parser_token=v||null}function b(y){this._printer=y,this._current_frame=null}b.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},b.prototype.record_tag=function(y){var v=new E(this._current_frame,y,this._printer.indent_level);this._current_frame=v},b.prototype._try_pop_frame=function(y){var v=null;return y&&(v=y.parser_token,this._printer.indent_level=y.indent_level,this._current_frame=y.parent),v},b.prototype._get_frame=function(y,v){for(var x=this._current_frame;x&&!(y.indexOf(x.tag)!==-1);){if(v&&v.indexOf(x.tag)!==-1){x=null;break}x=x.parent}return x},b.prototype.try_pop=function(y,v){var x=this._get_frame([y],v);return this._try_pop_frame(x)},b.prototype.indent_to_tag=function(y){var v=this._get_frame(y);v&&(this._printer.indent_level=v.indent_level)};function c(y,v,x,k){this._source_text=y||"",v=v||{},this._js_beautify=x,this._css_beautify=k,this._tag_stack=null;var R=new a(v,"html");this._options=R,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"}c.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var y=this._source_text,v=this._options.eol;this._options.eol==="auto"&&(v=`
|
|
`,y&&e.test(y)&&(v=y.match(e)[0])),y=y.replace(t,`
|
|
`);var x=y.match(/^[\t ]*/)[0],k={text:"",type:""},R=new i,U=new r(this._options,x),N=new l(y,this._options).tokenize();this._tag_stack=new b(U);for(var G=null,L=N.next();L.type!==s.EOF;)L.type===s.TAG_OPEN||L.type===s.COMMENT?(G=this._handle_tag_open(U,L,R,k),R=G):L.type===s.ATTRIBUTE||L.type===s.EQUALS||L.type===s.VALUE||L.type===s.TEXT&&!R.tag_complete?G=this._handle_inside_tag(U,L,R,N):L.type===s.TAG_CLOSE?G=this._handle_tag_close(U,L,R):L.type===s.TEXT?G=this._handle_text(U,L,R):U.add_raw_token(L),k=G,L=N.next();var H=U._output.get_code(v);return H},c.prototype._handle_tag_close=function(y,v,x){var k={text:v.text,type:v.type};return y.alignment_size=0,x.tag_complete=!0,y.set_space_before_token(v.newlines||v.whitespace_before!=="",!0),x.is_unformatted?y.add_raw_token(v):(x.tag_start_char==="<"&&(y.set_space_before_token(v.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&x.has_wrapped_attrs&&y.print_newline(!1)),y.print_token(v)),x.indent_content&&!(x.is_unformatted||x.is_content_unformatted)&&(y.indent(),x.indent_content=!1),!x.is_inline_element&&!(x.is_unformatted||x.is_content_unformatted)&&y.set_wrap_point(),k},c.prototype._handle_inside_tag=function(y,v,x,k){var R=x.has_wrapped_attrs,U={text:v.text,type:v.type};if(y.set_space_before_token(v.newlines||v.whitespace_before!=="",!0),x.is_unformatted)y.add_raw_token(v);else if(x.tag_start_char==="{"&&v.type===s.TEXT)y.print_preserved_newlines(v)?(v.newlines=0,y.add_raw_token(v)):y.print_token(v);else{if(v.type===s.ATTRIBUTE?(y.set_space_before_token(!0),x.attr_count+=1):(v.type===s.EQUALS||v.type===s.VALUE&&v.previous.type===s.EQUALS)&&y.set_space_before_token(!1),v.type===s.ATTRIBUTE&&x.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(y.traverse_whitespace(v),R=R||v.newlines!==0),this._is_wrap_attributes_force)){var N=x.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&x.attr_count===1){var G=!0,L=0,H;do{if(H=k.peek(L),H.type===s.ATTRIBUTE){G=!1;break}L+=1}while(L<4&&H.type!==s.EOF&&H.type!==s.TAG_CLOSE);N=!G}N&&(y.print_newline(!1),R=!0)}y.print_token(v),R=R||y.previous_token_wrapped(),x.has_wrapped_attrs=R}return U},c.prototype._handle_text=function(y,v,x){var k={text:v.text,type:"TK_CONTENT"};return x.custom_beautifier_name?this._print_custom_beatifier_text(y,v,x):x.is_unformatted||x.is_content_unformatted?y.add_raw_token(v):(y.traverse_whitespace(v),y.print_token(v)),k},c.prototype._print_custom_beatifier_text=function(y,v,x){var k=this;if(v.text!==""){var R=v.text,U,N=1,G="",L="";x.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?U=this._js_beautify:x.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?U=this._css_beautify:x.custom_beautifier_name==="html"&&(U=function(ae,oe){var ue=new c(ae,oe,k._js_beautify,k._css_beautify);return ue.beautify()}),this._options.indent_scripts==="keep"?N=0:this._options.indent_scripts==="separate"&&(N=-y.indent_level);var H=y.get_full_indent(N);if(R=R.replace(/\n[ \t]*$/,""),x.custom_beautifier_name!=="html"&&R[0]==="<"&&R.match(/^(<!--|<!\[CDATA\[)/)){var V=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(R);if(!V){y.add_raw_token(v);return}G=H+V[1]+`
|
|
`,R=V[4],V[5]&&(L=H+V[5]),R=R.replace(/\n[ \t]*$/,""),(V[2]||V[3].indexOf(`
|
|
`)!==-1)&&(V=V[3].match(/[ \t]+$/),V&&(v.whitespace_before=V[0]))}if(R)if(U){var $=function(){this.eol=`
|
|
`};$.prototype=this._options.raw_options;var q=new $;R=U(H+R,q)}else{var he=v.whitespace_before;he&&(R=R.replace(new RegExp(`
|
|
(`+he+")?","g"),`
|
|
`)),R=H+R.replace(/\n/g,`
|
|
`+H)}G&&(R?R=G+R+`
|
|
`+L:R=G+L),y.print_newline(!1),R&&(v.text=R,v.whitespace_before="",v.newlines=0,y.add_raw_token(v),y.print_newline(!0))}},c.prototype._handle_tag_open=function(y,v,x,k){var R=this._get_tag_open_token(v);return(x.is_unformatted||x.is_content_unformatted)&&!x.is_empty_element&&v.type===s.TAG_OPEN&&v.text.indexOf("</")===0?(y.add_raw_token(v),R.start_tag_token=this._tag_stack.try_pop(R.tag_name)):(y.traverse_whitespace(v),this._set_tag_position(y,v,R,x,k),R.is_inline_element||y.set_wrap_point(),y.print_token(v)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(R.alignment_size=v.text.length+1),!R.tag_complete&&!R.is_unformatted&&(y.alignment_size=R.alignment_size),R};var i=function(y,v){if(this.parent=y||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!v)this.tag_complete=!0;else{var x;this.tag_start_char=v.text[0],this.text=v.text,this.tag_start_char==="<"?(x=v.text.match(/^<([^\s>]*)/),this.tag_check=x?x[1]:""):(x=v.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=x?x[1]:"",(v.text.startsWith("{{#>")||v.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&v.next!==null?this.tag_check=v.next.text.split(" ")[0]:this.tag_check=v.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),v.type===s.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||v.closed&&v.closed.text==="/>";var k=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(k=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(k)))}};c.prototype._get_tag_open_token=function(y){var v=new i(this._tag_stack.get_parser_token(),y);return v.alignment_size=this._options.wrap_attributes_indent_size,v.is_end_tag=v.is_end_tag||_(v.tag_check,this._options.void_elements),v.is_empty_element=v.tag_complete||v.is_start_tag&&v.is_end_tag,v.is_unformatted=!v.tag_complete&&_(v.tag_check,this._options.unformatted),v.is_content_unformatted=!v.is_empty_element&&_(v.tag_check,this._options.content_unformatted),v.is_inline_element=_(v.tag_name,this._options.inline)||v.tag_name.includes("-")||v.tag_start_char==="{",v},c.prototype._set_tag_position=function(y,v,x,k,R){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||y.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=g(x.tag_check,v)))),_(x.tag_check,this._options.extra_liners)&&(y.print_newline(!1),y._output.just_added_blankline()||y.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 U=y.current_line_has_match(/{{#if/);U||y.print_newline(!1)}x.tag_name==="!--"&&R.type===s.TAG_CLOSE&&k.is_end_tag&&x.text.indexOf(`
|
|
`)===-1||(x.is_inline_element||x.is_unformatted||y.print_newline(!1),this._calcluate_parent_multiline(y,x))}else if(x.is_end_tag){var N=!1;N=x.start_tag_token&&x.start_tag_token.multiline_content,N=N||!x.is_inline_element&&!(k.is_inline_element||k.is_unformatted)&&!(R.type===s.TAG_CLOSE&&x.start_tag_token===k)&&R.type!=="TK_CONTENT",(x.is_content_unformatted||x.is_unformatted)&&(N=!1),N&&y.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)&&(R.type!=="TK_CONTENT"||x.is_content_unformatted)&&y.print_newline(!1),this._calcluate_parent_multiline(y,x)},c.prototype._calcluate_parent_multiline=function(y,v){v.parent&&y._output.just_added_newline()&&!((v.is_inline_element||v.is_unformatted)&&v.parent.is_inline_element)&&(v.parent.multiline_content=!0)};var d=["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"],h=["a","audio","del","ins","map","noscript","video"];c.prototype._do_optional_end_element=function(y){var v=null;if(y.is_empty_element||!y.is_start_tag||!y.parent)return;if(y.tag_name==="body")v=v||this._tag_stack.try_pop("head");else if(y.tag_name==="li")v=v||this._tag_stack.try_pop("li",["ol","ul"]);else if(y.tag_name==="dd"||y.tag_name==="dt")v=v||this._tag_stack.try_pop("dt",["dl"]),v=v||this._tag_stack.try_pop("dd",["dl"]);else if(y.parent.tag_name==="p"&&d.indexOf(y.tag_name)!==-1){var x=y.parent.parent;(!x||h.indexOf(x.tag_name)===-1)&&(v=v||this._tag_stack.try_pop("p"))}else y.tag_name==="rp"||y.tag_name==="rt"?(v=v||this._tag_stack.try_pop("rt",["ruby","rtc"]),v=v||this._tag_stack.try_pop("rp",["ruby","rtc"])):y.tag_name==="optgroup"?v=v||this._tag_stack.try_pop("optgroup",["select"]):y.tag_name==="option"?v=v||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):y.tag_name==="colgroup"?v=v||this._tag_stack.try_pop("caption",["table"]):y.tag_name==="thead"?(v=v||this._tag_stack.try_pop("caption",["table"]),v=v||this._tag_stack.try_pop("colgroup",["table"])):y.tag_name==="tbody"||y.tag_name==="tfoot"?(v=v||this._tag_stack.try_pop("caption",["table"]),v=v||this._tag_stack.try_pop("colgroup",["table"]),v=v||this._tag_stack.try_pop("thead",["table"]),v=v||this._tag_stack.try_pop("tbody",["table"])):y.tag_name==="tr"?(v=v||this._tag_stack.try_pop("caption",["table"]),v=v||this._tag_stack.try_pop("colgroup",["table"]),v=v||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(y.tag_name==="th"||y.tag_name==="td")&&(v=v||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),v=v||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return y.parent=this._tag_stack.get_parser_token(),v},m.exports.Beautifier=c},function(m,p,o){var a=o(6).Options;function n(l){a.call(this,l,"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"])}n.prototype=new a,m.exports.Options=n},function(m,p,o){var a=o(9).Tokenizer,n=o(9).TOKEN,l=o(13).Directives,s=o(14).TemplatablePattern,e=o(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:n.START,RAW:n.RAW,EOF:n.EOF},r=new l(/<\!--/,/-->/),T=function(g,_){a.call(this,g,_),this._current_tag_name="";var E=new s(this._input).read_options(this._options),b=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:b.starting_with(/{{!--/).until_after(/--}}/),handlebars:b.starting_with(/{{/).until_after(/}}/),handlebars_open:b.until(/[\n\r\t }]/),handlebars_raw_close:b.until(/}}/),comment:b.starting_with(/<!--/).until_after(/-->/),cdata:b.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:b.starting_with(/<!\[/).until_after(/]>/),processing:b.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 c=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=b.matching(c).until_after(c)}};T.prototype=new a,T.prototype._is_comment=function(g){return!1},T.prototype._is_opening=function(g){return g.type===t.TAG_OPEN},T.prototype._is_closing=function(g,_){return g.type===t.TAG_CLOSE&&_&&((g.text===">"||g.text==="/>")&&_.text[0]==="<"||g.text==="}}"&&_.text[0]==="{"&&_.text[1]==="{")},T.prototype._reset=function(){this._current_tag_name=""},T.prototype._get_next_token=function(g,_){var E=null;this._readWhitespace();var b=this._input.peek();return b===null?this._create_token(t.EOF,""):(E=E||this._read_open_handlebars(b,_),E=E||this._read_attribute(b,g,_),E=E||this._read_close(b,_),E=E||this._read_raw_content(b,g,_),E=E||this._read_content_word(b),E=E||this._read_comment_or_cdata(b),E=E||this._read_processing(b),E=E||this._read_open(b,_),E=E||this._create_token(t.UNKNOWN,this._input.next()),E)},T.prototype._read_comment_or_cdata=function(g){var _=null,E=null,b=null;if(g==="<"){var c=this._input.peek(1);c==="!"&&(E=this.__patterns.comment.read(),E?(b=r.get_directives(E),b&&b.ignore==="start"&&(E+=r.readIgnored(this._input))):E=this.__patterns.cdata.read()),E&&(_=this._create_token(t.COMMENT,E),_.directives=b)}return _},T.prototype._read_processing=function(g){var _=null,E=null,b=null;if(g==="<"){var c=this._input.peek(1);(c==="!"||c==="?")&&(E=this.__patterns.conditional_comment.read(),E=E||this.__patterns.processing.read()),E&&(_=this._create_token(t.COMMENT,E),_.directives=b)}return _},T.prototype._read_open=function(g,_){var E=null,b=null;return _||g==="<"&&(E=this._input.next(),this._input.peek()==="/"&&(E+=this._input.next()),E+=this.__patterns.element_name.read(),b=this._create_token(t.TAG_OPEN,E)),b},T.prototype._read_open_handlebars=function(g,_){var E=null,b=null;return _||this._options.indent_handlebars&&g==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(E=this.__patterns.handlebars_comment.read(),E=E||this.__patterns.handlebars.read(),b=this._create_token(t.COMMENT,E)):(E=this.__patterns.handlebars_open.read(),b=this._create_token(t.TAG_OPEN,E))),b},T.prototype._read_close=function(g,_){var E=null,b=null;return _&&(_.text[0]==="<"&&(g===">"||g==="/"&&this._input.peek(1)===">")?(E=this._input.next(),g==="/"&&(E+=this._input.next()),b=this._create_token(t.TAG_CLOSE,E)):_.text[0]==="{"&&g==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),b=this._create_token(t.TAG_CLOSE,"}}"))),b},T.prototype._read_attribute=function(g,_,E){var b=null,c="";if(E&&E.text[0]==="<")if(g==="=")b=this._create_token(t.EQUALS,this._input.next());else if(g==='"'||g==="'"){var i=this._input.next();g==='"'?i+=this.__patterns.double_quote.read():i+=this.__patterns.single_quote.read(),b=this._create_token(t.VALUE,i)}else c=this.__patterns.attribute.read(),c&&(_.type===t.EQUALS?b=this._create_token(t.VALUE,c):b=this._create_token(t.ATTRIBUTE,c));return b},T.prototype._is_content_unformatted=function(g){return this._options.void_elements.indexOf(g)===-1&&(this._options.content_unformatted.indexOf(g)!==-1||this._options.unformatted.indexOf(g)!==-1)},T.prototype._read_raw_content=function(g,_,E){var b="";if(E&&E.text[0]==="{")b=this.__patterns.handlebars_raw_close.read();else if(_.type===t.TAG_CLOSE&&_.opened.text[0]==="<"&&_.text[0]!=="/"){var c=_.opened.text.substr(1).toLowerCase();if(c==="script"||c==="style"){var i=this._read_comment_or_cdata(g);if(i)return i.type=t.TEXT,i;b=this._input.readUntil(new RegExp("</"+c+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(c)&&(b=this._input.readUntil(new RegExp("</"+c+"[\\n\\r\\t ]*?>","ig")))}return b?this._create_token(t.TEXT,b):null},T.prototype._read_content_word=function(g){var _="";if(this._options.unformatted_content_delimiter&&(g===this._options.unformatted_content_delimiter[0]&&(_=this.__patterns.unformatted_content_delimiter.read())),_||(_=this.__patterns.word.read()),_)return this._create_token(t.TEXT,_)},m.exports.Tokenizer=T,m.exports.TOKEN=t}],M={};function O(m){var p=M[m];if(p!==void 0)return p.exports;var o=M[m]={exports:{}};return F[m](o,o.exports,O),o.exports}var S=O(18);w=S})();var j=w;if(!0)!(ce=[ne,ne("6UM0"),ne("TXwP")],W=function(F){var M=ne("6UM0"),O=ne("TXwP");return{html_beautify:function(S,m){return j(S,m,M.js_beautify,O.css_beautify)}}}.apply(tt,ce),W!==void 0&&(ut.exports=W));else var I,A})()},"rAM+":function(ut,tt,ne){"use strict";ne.d(tt,"a",function(){return W});var ce=ne("Qw5x");function W(w,j){var I;if(typeof Symbol=="undefined"||w[Symbol.iterator]==null){if(Array.isArray(w)||(I=Object(ce.a)(w))||j&&w&&typeof w.length=="number"){I&&(w=I);var A=0,F=function(){};return{s:F,n:function(){return A>=w.length?{done:!0}:{done:!1,value:w[A++]}},e:function(p){throw p},f:F}}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,O=!1,S;return{s:function(){I=w[Symbol.iterator]()},n:function(){var p=I.next();return M=p.done,p},e:function(p){O=!0,S=p},f:function(){try{!M&&I.return!=null&&I.return()}finally{if(O)throw S}}}}},rUJ1:function(ut,tt){const ne=/[&<>"']/,ce=/[&<>"']/g,W=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,j={"&":"&","<":"<",">":">",'"':""","'":"'"},I=b=>j[b];function A(b,c){if(c){if(ne.test(b))return b.replace(ce,I)}else if(W.test(b))return b.replace(w,I);return b}const F=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function M(b){return b.replace(F,(c,i)=>(i=i.toLowerCase(),i==="colon"?":":i.charAt(0)==="#"?i.charAt(1)==="x"?String.fromCharCode(parseInt(i.substring(2),16)):String.fromCharCode(+i.substring(1)):""))}const O=/(^|[^\[])\^/g;function S(b,c){b=b.source||b,c=c||"";const i={replace:(d,h)=>(h=h.source||h,h=h.replace(O,"$1"),b=b.replace(d,h),i),getRegex:()=>new RegExp(b,c)};return i}const m=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function o(b,c,i){if(b){let d;try{d=decodeURIComponent(M(i)).replace(m,"").toLowerCase()}catch(h){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}c&&!p.test(i)&&(i=e(c,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(d){return null}return i}const a={},n=/^[^:]+:\/*[^/]*$/,l=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function e(b,c){a[" "+b]||(n.test(b)?a[" "+b]=b+"/":a[" "+b]=g(b,"/",!0)),b=a[" "+b];const i=b.indexOf(":")===-1;return c.substring(0,2)==="//"?i?c:b.replace(l,"$1")+c:c.charAt(0)==="/"?i?c:b.replace(s,"$1")+c:b+c}const t={exec:function(){}};function r(b){let c=1,i,d;for(;c<arguments.length;c++){i=arguments[c];for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(b[d]=i[d])}return b}function T(b,c){const i=b.replace(/\|/g,(y,v,x)=>{let k=!1,R=v;for(;--R>=0&&x[R]==="\\";)k=!k;return k?"|":" |"}),d=i.split(/ \|/);let h=0;if(d.length>c)d.splice(c);else for(;d.length<c;)d.push("");for(;h<d.length;h++)d[h]=d[h].trim().replace(/\\\|/g,"|");return d}function g(b,c,i){const d=b.length;if(d===0)return"";let h=0;for(;h<d;){const y=b.charAt(d-h-1);if(y===c&&!i)h++;else if(y!==c&&i)h++;else break}return b.substr(0,d-h)}function _(b,c){if(b.indexOf(c[1])===-1)return-1;const i=b.length;let d=0,h=0;for(;h<i;h++)if(b[h]==="\\")h++;else if(b[h]===c[0])d++;else if(b[h]===c[1]&&(d--,d<0))return h;return-1}function E(b){b&&b.sanitize&&!b.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}ut.exports={escape:A,unescape:M,edit:S,cleanUrl:o,resolveUrl:e,noopTest:t,merge:r,splitCells:T,rtrim:g,findClosingBracket:_,checkSanitizeDeprecation:E}},ulZh:function(ut,tt,ne){typeof window!="undefined"&&function(W,w){ut.exports=w()}(this,function(){return function(ce){var W={};function w(j){if(W[j])return W[j].exports;var I=W[j]={i:j,l:!1,exports:{}};return ce[j].call(I.exports,I,I.exports,w),I.l=!0,I.exports}return w.m=ce,w.c=W,w.d=function(j,I,A){w.o(j,I)||Object.defineProperty(j,I,{enumerable:!0,get:A})},w.r=function(j){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(j,"__esModule",{value:!0})},w.t=function(j,I){if(I&1&&(j=w(j)),I&8)return j;if(I&4&&typeof j=="object"&&j&&j.__esModule)return j;var A=Object.create(null);if(w.r(A),Object.defineProperty(A,"default",{enumerable:!0,value:j}),I&2&&typeof j!="string")for(var F in j)w.d(A,F,function(M){return j[M]}.bind(null,F));return A},w.n=function(j){var I=j&&j.__esModule?function(){return j.default}:function(){return j};return w.d(I,"a",I),I},w.o=function(j,I){return Object.prototype.hasOwnProperty.call(j,I)},w.p="/dist/",w(w.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ce,W,w){"use strict";var j=Object.prototype.hasOwnProperty,I="~";function A(){}Object.create&&(A.prototype=Object.create(null),new A().__proto__||(I=!1));function F(m,p,o){this.fn=m,this.context=p,this.once=o||!1}function M(m,p,o,a,n){if(typeof o!="function")throw new TypeError("The listener must be a function");var l=new F(o,a||m,n),s=I?I+p:p;return m._events[s]?m._events[s].fn?m._events[s]=[m._events[s],l]:m._events[s].push(l):(m._events[s]=l,m._eventsCount++),m}function O(m,p){--m._eventsCount===0?m._events=new A:delete m._events[p]}function S(){this._events=new A,this._eventsCount=0}S.prototype.eventNames=function(){var p=[],o,a;if(this._eventsCount===0)return p;for(a in o=this._events)j.call(o,a)&&p.push(I?a.slice(1):a);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(o)):p},S.prototype.listeners=function(p){var o=I?I+p:p,a=this._events[o];if(!a)return[];if(a.fn)return[a.fn];for(var n=0,l=a.length,s=new Array(l);n<l;n++)s[n]=a[n].fn;return s},S.prototype.listenerCount=function(p){var o=I?I+p:p,a=this._events[o];return a?a.fn?1:a.length:0},S.prototype.emit=function(p,o,a,n,l,s){var e=I?I+p:p;if(!this._events[e])return!1;var t=this._events[e],r=arguments.length,T,g;if(t.fn){t.once&&this.removeListener(p,t.fn,void 0,!0);switch(r){case 1:return t.fn.call(t.context),!0;case 2:return t.fn.call(t.context,o),!0;case 3:return t.fn.call(t.context,o,a),!0;case 4:return t.fn.call(t.context,o,a,n),!0;case 5:return t.fn.call(t.context,o,a,n,l),!0;case 6:return t.fn.call(t.context,o,a,n,l,s),!0}for(g=1,T=new Array(r-1);g<r;g++)T[g-1]=arguments[g];t.fn.apply(t.context,T)}else{var _=t.length,E;for(g=0;g<_;g++){t[g].once&&this.removeListener(p,t[g].fn,void 0,!0);switch(r){case 1:t[g].fn.call(t[g].context);break;case 2:t[g].fn.call(t[g].context,o);break;case 3:t[g].fn.call(t[g].context,o,a);break;case 4:t[g].fn.call(t[g].context,o,a,n);break;default:if(!T)for(E=1,T=new Array(r-1);E<r;E++)T[E-1]=arguments[E];t[g].fn.apply(t[g].context,T)}}}return!0},S.prototype.on=function(p,o,a){return M(this,p,o,a,!1)},S.prototype.once=function(p,o,a){return M(this,p,o,a,!0)},S.prototype.removeListener=function(p,o,a,n){var l=I?I+p:p;if(!this._events[l])return this;if(!o)return O(this,l),this;var s=this._events[l];if(s.fn)s.fn===o&&(!n||s.once)&&(!a||s.context===a)&&O(this,l);else{for(var e=0,t=[],r=s.length;e<r;e++)(s[e].fn!==o||n&&!s[e].once||a&&s[e].context!==a)&&t.push(s[e]);t.length?this._events[l]=t.length===1?t[0]:t:O(this,l)}return this},S.prototype.removeAllListeners=function(p){var o;return p?(o=I?I+p:p,this._events[o]&&O(this,o)):(this._events=new A,this._eventsCount=0),this},S.prototype.off=S.prototype.removeListener,S.prototype.addListener=S.prototype.on,S.prefixed=I,S.EventEmitter=S,ce.exports=S},"./node_modules/url-toolkit/src/url-toolkit.js":function(ce,W,w){(function(j){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,A=/^([^\/?#]*)([^]*)$/,F=/(?:\/|^)\.(?=\/)/g,M=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(S,m,p){if(p=p||{},S=S.trim(),m=m.trim(),!m){if(!p.alwaysNormalize)return S;var o=O.parseURL(S);if(!o)throw new Error("Error trying to parse base URL.");return o.path=O.normalizePath(o.path),O.buildURLFromParts(o)}var a=O.parseURL(m);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return p.alwaysNormalize?(a.path=O.normalizePath(a.path),O.buildURLFromParts(a)):m;var n=O.parseURL(S);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&n.path[0]!=="/"){var l=A.exec(n.path);n.netLoc=l[1],n.path=l[2]}n.netLoc&&!n.path&&(n.path="/");var s={scheme:n.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(s.netLoc=n.netLoc,a.path[0]!=="/"))if(!a.path)s.path=n.path,a.params||(s.params=n.params,a.query||(s.query=n.query));else{var e=n.path,t=e.substring(0,e.lastIndexOf("/")+1)+a.path;s.path=O.normalizePath(t)}return s.path===null&&(s.path=p.alwaysNormalize?O.normalizePath(a.path):a.path),O.buildURLFromParts(s)},parseURL:function(S){var m=I.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(F,"");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}};ce.exports=O})(this)},"./node_modules/webworkify-webpack/index.js":function(ce,W,w){function j(p){var o={};function a(l){if(o[l])return o[l].exports;var s=o[l]={i:l,l:!1,exports:{}};return p[l].call(s.exports,s,s.exports,a),s.l=!0,s.exports}a.m=p,a.c=o,a.i=function(l){return l},a.d=function(l,s,e){a.o(l,s)||Object.defineProperty(l,s,{configurable:!1,enumerable:!0,get:e})},a.r=function(l){Object.defineProperty(l,"__esModule",{value:!0})},a.n=function(l){var s=l&&l.__esModule?function(){return l.default}:function(){return l};return a.d(s,"a",s),s},a.o=function(l,s){return Object.prototype.hasOwnProperty.call(l,s)},a.p="/",a.oe=function(l){throw console.error(l),l};var n=a(a.s=ENTRY_MODULE);return n.default||n}var I="[\\.|\\-|\\+|\\w|/|@]+",A="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function F(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function M(p){return!isNaN(1*p)}function O(p,o,a){var n={};n[a]=[];var l=o.toString(),s=l.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return n;for(var e=s[1],t=new RegExp("(\\\\n|\\W)"+F(e)+A,"g"),r;r=t.exec(l);){if(r[3]==="dll-reference")continue;n[a].push(r[3])}for(t=new RegExp("\\("+F(e)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+A,"g");r=t.exec(l);)p[r[2]]||(n[a].push(r[1]),p[r[2]]=w(r[1]).m),n[r[2]]=n[r[2]]||[],n[r[2]].push(r[4]);for(var T=Object.keys(n),g=0;g<T.length;g++)for(var _=0;_<n[T[g]].length;_++)M(n[T[g]][_])&&(n[T[g]][_]=1*n[T[g]][_]);return n}function S(p){var o=Object.keys(p);return o.reduce(function(a,n){return a||p[n].length>0},!1)}function m(p,o){for(var a={main:[o]},n={main:[]},l={main:{}};S(a);)for(var s=Object.keys(a),e=0;e<s.length;e++){var t=s[e],r=a[t],T=r.pop();if(l[t]=l[t]||{},l[t][T]||!p[t][T])continue;l[t][T]=!0,n[t]=n[t]||[],n[t].push(T);for(var g=O(p,p[t][T],t),_=Object.keys(g),E=0;E<_.length;E++)a[_[E]]=a[_[E]]||[],a[_[E]]=a[_[E]].concat(g[_[E]])}return n}ce.exports=function(p,o){o=o||{};var a={main:w.m},n=o.all?{main:Object.keys(a.main)}:m(a,p),l="";Object.keys(n).filter(function(T){return T!=="main"}).forEach(function(T){for(var g=0;n[T][g];)g++;n[T].push(g),a[T][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",l=l+"var "+T+" = ("+j.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+n[T].map(function(_){return""+JSON.stringify(_)+": "+a[T][_].toString()}).join(",")+`});
|
|
`}),l=l+"new (("+j.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+n.main.map(function(T){return""+JSON.stringify(T)+": "+a.main[T].toString()}).join(",")+"}))(self);";var s=new window.Blob([l],{type:"text/javascript"});if(o.bare)return s;var e=window.URL||window.webkitURL||window.mozURL||window.msURL,t=e.createObjectURL(s),r=new window.Worker(t);return r.objectURL=t,r}},"./src/config.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"hlsDefaultConfig",function(){return E}),w.d(W,"mergeConfig",function(){return c}),w.d(W,"enableStreamingMode",function(){return i});var j=w("./src/controller/abr-controller.ts"),I=w("./src/controller/audio-stream-controller.ts"),A=w("./src/controller/audio-track-controller.ts"),F=w("./src/controller/subtitle-stream-controller.ts"),M=w("./src/controller/subtitle-track-controller.ts"),O=w("./src/controller/buffer-controller.ts"),S=w("./src/controller/timeline-controller.ts"),m=w("./src/controller/cap-level-controller.ts"),p=w("./src/controller/fps-controller.ts"),o=w("./src/controller/eme-controller.ts"),a=w("./src/controller/cmcd-controller.ts"),n=w("./src/utils/xhr-loader.ts"),l=w("./src/utils/fetch-loader.ts"),s=w("./src/utils/cues.ts"),e=w("./src/utils/mediakeys-helper.ts"),t=w("./src/utils/logger.ts");function r(){return r=Object.assign||function(d){for(var h=1;h<arguments.length;h++){var y=arguments[h];for(var v in y)Object.prototype.hasOwnProperty.call(y,v)&&(d[v]=y[v])}return d},r.apply(this,arguments)}function T(d,h){var y=Object.keys(d);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(d);h&&(v=v.filter(function(x){return Object.getOwnPropertyDescriptor(d,x).enumerable})),y.push.apply(y,v)}return y}function g(d){for(var h=1;h<arguments.length;h++){var y=arguments[h]!=null?arguments[h]:{};h%2?T(Object(y),!0).forEach(function(v){_(d,v,y[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(y)):T(Object(y)).forEach(function(v){Object.defineProperty(d,v,Object.getOwnPropertyDescriptor(y,v))})}return d}function _(d,h,y){return h in d?Object.defineProperty(d,h,{value:y,enumerable:!0,configurable:!0,writable:!0}):d[h]=y,d}var E=g(g({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:n.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:j.default,bufferController:O.default,capLevelController:m.default,fpsController:p.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:e.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:F.SubtitleStreamController,subtitleTrackController:M.default,timelineController:S.TimelineController,audioStreamController:I.default,audioTrackController:A.default,emeController:o.default,cmcdController:a.default});function b(){return{cueHandler:s.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function c(d,h){if((h.liveSyncDurationCount||h.liveMaxLatencyDurationCount)&&(h.liveSyncDuration||h.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(h.liveMaxLatencyDurationCount!==void 0&&(h.liveSyncDurationCount===void 0||h.liveMaxLatencyDurationCount<=h.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(h.liveMaxLatencyDuration!==void 0&&(h.liveSyncDuration===void 0||h.liveMaxLatencyDuration<=h.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return r({},d,h)}function i(d){var h=d.loader;if(h!==l.default&&h!==n.default)t.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var y=Object(l.fetchSupported)();y&&(d.loader=l.default,d.progressive=!0,d.enableSoftwareAES=!0,t.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/polyfills/number.ts"),I=w("./src/utils/ewma-bandwidth-estimator.ts"),A=w("./src/events.ts"),F=w("./src/utils/buffer-helper.ts"),M=w("./src/errors.ts"),O=w("./src/types/loader.ts"),S=w("./src/utils/logger.ts");function m(a,n){for(var l=0;l<n.length;l++){var s=n[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(a,s.key,s)}}function p(a,n,l){return n&&m(a.prototype,n),l&&m(a,l),a}var o=function(){function a(l){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=l;var s=l.config;this.bwEstimator=new I.default(s.abrEwmaSlowVoD,s.abrEwmaFastVoD,s.abrEwmaDefaultEstimate),this.registerListeners()}var n=a.prototype;return n.registerListeners=function(){var s=this.hls;s.on(A.Events.FRAG_LOADING,this.onFragLoading,this),s.on(A.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(A.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(A.Events.ERROR,this.onError,this)},n.unregisterListeners=function(){var s=this.hls;s.off(A.Events.FRAG_LOADING,this.onFragLoading,this),s.off(A.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(A.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(A.Events.ERROR,this.onError,this)},n.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},n.onFragLoading=function(s,e){var t=e.frag;if(t.type===O.PlaylistLevelType.MAIN&&!this.timer){var r;this.fragCurrent=t,this.partCurrent=(r=e.part)!=null?r:null,this.timer=self.setInterval(this.onCheck,100)}},n.onLevelLoaded=function(s,e){var t=this.hls.config;e.details.live?this.bwEstimator.update(t.abrEwmaSlowLive,t.abrEwmaFastLive):this.bwEstimator.update(t.abrEwmaSlowVoD,t.abrEwmaFastVoD)},n._abandonRulesCheck=function(){var s=this.fragCurrent,e=this.partCurrent,t=this.hls,r=t.autoLevelEnabled,T=t.config,g=t.media;if(!s||!g)return;var _=e?e.stats:s.stats,E=e?e.duration:s.duration;if(_.aborted){S.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!r||g.paused||!g.playbackRate||!g.readyState)return;var b=performance.now()-_.loading.start,c=Math.abs(g.playbackRate);if(b<=500*E/c)return;var i=t.levels,d=t.minAutoLevel,h=i[s.level],y=_.total||Math.max(_.loaded,Math.round(E*h.maxBitrate/8)),v=Math.max(1,_.bwEstimate?_.bwEstimate/8:_.loaded*1e3/b),x=(y-_.loaded)/v,k=g.currentTime,R=(F.BufferHelper.bufferInfo(g,k,T.maxBufferHole).end-k)/c;if(R>=2*E/c||x<=R)return;var U=Number.POSITIVE_INFINITY,N;for(N=s.level-1;N>d;N--){var G=i[N].maxBitrate;if(U=E*G/(8*.8*v),U<R)break}if(U>=x)return;var L=this.bwEstimator.getEstimate();S.logger.warn("Fragment "+s.sn+(e?" part "+e.index:"")+" of level "+s.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+N+`
|
|
Current BW estimate: `+(Object(j.isFiniteNumber)(L)?(L/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+x.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+U.toFixed(3)+` s
|
|
Time to underbuffer: `+R.toFixed(3)+" s"),t.nextLoadLevel=N,this.bwEstimator.sample(b,_.loaded),this.clearTimer(),s.loader&&(this.fragCurrent=this.partCurrent=null,s.loader.abort()),t.trigger(A.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:e,stats:_})},n.onFragLoaded=function(s,e){var t=e.frag,r=e.part;if(t.type===O.PlaylistLevelType.MAIN&&Object(j.isFiniteNumber)(t.sn)){var T=r?r.stats:t.stats,g=r?r.duration:t.duration;if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var _=this.hls.levels[t.level],E=(_.loaded?_.loaded.bytes:0)+T.loaded,b=(_.loaded?_.loaded.duration:0)+g;_.loaded={bytes:E,duration:b},_.realBitrate=Math.round(8*E/b)}if(t.bitrateTest){var c={stats:T,frag:t,part:r,id:t.type};this.onFragBuffered(A.Events.FRAG_BUFFERED,c),t.bitrateTest=!1}}},n.onFragBuffered=function(s,e){var t=e.frag,r=e.part,T=r?r.stats:t.stats;if(T.aborted)return;if(t.type!==O.PlaylistLevelType.MAIN||t.sn==="initSegment")return;var g=T.parsing.end-T.loading.start;this.bwEstimator.sample(g,T.loaded),T.bwEstimate=this.bwEstimator.getEstimate(),t.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},n.onError=function(s,e){switch(e.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},n.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},n.getNextABRAutoLevel=function(){var s=this.fragCurrent,e=this.partCurrent,t=this.hls,r=t.maxAutoLevel,T=t.config,g=t.minAutoLevel,_=t.media,E=e?e.duration:s?s.duration:0,b=_?_.currentTime:0,c=_&&_.playbackRate!==0?Math.abs(_.playbackRate):1,i=this.bwEstimator?this.bwEstimator.getEstimate():T.abrEwmaDefaultEstimate,d=(F.BufferHelper.bufferInfo(_,b,T.maxBufferHole).end-b)/c,h=this.findBestLevel(i,g,r,d,T.abrBandWidthFactor,T.abrBandWidthUpFactor);if(h>=0)return h;S.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var y=E?Math.min(E,T.maxStarvationDelay):T.maxStarvationDelay,v=T.abrBandWidthFactor,x=T.abrBandWidthUpFactor;if(!d){var k=this.bitrateTestDelay;if(k){var R=E?Math.min(E,T.maxLoadingDelay):T.maxLoadingDelay;y=R-k,S.logger.trace("bitrate test took "+Math.round(1e3*k)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*y)+" ms"),v=x=1}}return h=this.findBestLevel(i,g,r,d+y,v,x),Math.max(h,0)},n.findBestLevel=function(s,e,t,r,T,g){for(var _,E=this.fragCurrent,b=this.partCurrent,c=this.lastLoadedFragLevel,i=this.hls.levels,d=i[c],h=!!(d!=null&&(_=d.details)!==null&&_!==void 0&&_.live),y=d==null?void 0:d.codecSet,v=b?b.duration:E?E.duration:0,x=t;x>=e;x--){var k=i[x];if(!k||y&&k.codecSet!==y)continue;var R=k.details,U=(b?R==null?void 0:R.partTarget:R==null?void 0:R.averagetargetduration)||v,N=void 0;x<=c?N=T*s:N=g*s;var G=i[x].maxBitrate,L=G*U/N;if(S.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(N)+"/"+G+"/"+U+"/"+r+"/"+L),N>G&&(!L||h&&!this.bitrateTestDelay||L<r))return x}return-1},p(a,[{key:"nextAutoLevel",get:function(){var s=this._nextAutoLevel,e=this.bwEstimator;if(s!==-1&&(!e||!e.canEstimate()))return s;var t=this.getNextABRAutoLevel();return s!==-1&&(t=Math.min(s,t)),t},set:function(s){this._nextAutoLevel=s}}]),a}();W.default=o},"./src/controller/audio-stream-controller.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/polyfills/number.ts"),I=w("./src/controller/base-stream-controller.ts"),A=w("./src/events.ts"),F=w("./src/utils/buffer-helper.ts"),M=w("./src/controller/fragment-tracker.ts"),O=w("./src/types/level.ts"),S=w("./src/types/loader.ts"),m=w("./src/loader/fragment.ts"),p=w("./src/demux/chunk-cache.ts"),o=w("./src/demux/transmuxer-interface.ts"),a=w("./src/types/transmuxer.ts"),n=w("./src/controller/fragment-finders.ts"),l=w("./src/utils/discontinuities.ts"),s=w("./src/errors.ts"),e=w("./src/utils/logger.ts");function t(){return t=Object.assign||function(E){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var i in c)Object.prototype.hasOwnProperty.call(c,i)&&(E[i]=c[i])}return E},t.apply(this,arguments)}function r(E,b){E.prototype=Object.create(b.prototype),E.prototype.constructor=E,T(E,b)}function T(E,b){return T=Object.setPrototypeOf||function(i,d){return i.__proto__=d,i},T(E,b)}var g=100,_=function(E){r(b,E);function b(i,d){var h;return h=E.call(this,i,d,"[audio-stream-controller]")||this,h.videoBuffer=null,h.videoTrackCC=-1,h.waitingVideoCC=-1,h.audioSwitch=!1,h.trackId=-1,h.waitingData=null,h.mainDetails=null,h.bufferFlushed=!1,h._registerListeners(),h}var c=b.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var d=this.hls;d.on(A.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(A.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(A.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(A.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(A.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(A.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(A.Events.ERROR,this.onError,this),d.on(A.Events.BUFFER_RESET,this.onBufferReset,this),d.on(A.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(A.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(A.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(A.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var d=this.hls;d.off(A.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(A.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(A.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(A.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(A.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(A.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(A.Events.ERROR,this.onError,this),d.off(A.Events.BUFFER_RESET,this.onBufferReset,this),d.off(A.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(A.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(A.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(A.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onInitPtsFound=function(d,h){var y=h.frag,v=h.id,x=h.initPTS;if(v==="main"){var k=y.cc;this.initPTS[y.cc]=x,this.log("InitPTS for cc: "+k+" found from main: "+x),this.videoTrackCC=k,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},c.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=I.State.STOPPED;return}var h=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,h>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},c.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var d,h=this.levels,y=this.trackId,v=h==null||((d=h[y])===null||d===void 0)?void 0:d.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var x,k=performance.now(),R=this.retryDate;(!R||k>=R||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var U=this.waitingData;if(U){var N=U.frag,G=U.part,L=U.cache,H=U.complete;if(this.initPTS[N.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var V=L.flush(),$={frag:N,part:G,payload:V,networkDetails:null};this._handleFragmentLoadProgress($),H&&E.prototype._handleFragmentLoadComplete.call(this,$)}else if(this.videoTrackCC!==this.waitingVideoCC)e.logger.log("Waiting fragment cc ("+N.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var q=this.getLoadPosition(),he=F.BufferHelper.bufferInfo(this.mediaBuffer,q,this.config.maxBufferHole),ae=Object(n.fragmentWithinToleranceTest)(he.end,this.config.maxFragLookUpTolerance,N);ae<0&&(e.logger.log("Waiting fragment cc ("+N.cc+") @ "+N.start+" cancelled because another fragment at "+he.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},c.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},c.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var h=this.mediaBuffer?this.mediaBuffer:d,y=h.buffered;!this.loadedmetadata&&y.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},c.doTickIdle=function(){var d,h,y=this.hls,v=this.levels,x=this.media,k=this.trackId,R=y.config;if(!v||!v[k])return;if(!x&&(this.startFragRequested||!R.startFragPrefetch))return;var U=v[k],N=U.details;if(!N||N.live&&this.levelLastLoaded!==k||this.waitForCdnTuneIn(N)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,m.ElementaryStreamTypes.AUDIO,S.PlaylistLevelType.AUDIO));var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,S.PlaylistLevelType.AUDIO);if(G===null)return;var L=G.len,H=this.getMaxBufferLength(),V=this.audioSwitch;if(L>=H&&!V)return;if(!V&&this._streamEnded(G,N)){y.trigger(A.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var $=N.fragments,q=$[0].start,he=G.end;if(V){var ae=this.getLoadPosition();he=ae,N.PTSKnown&&ae<q&&((G.end>q||G.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=q+.05))}var oe=this.getNextFragment(he,N);if(!oe){this.bufferFlushed=!0;return}((d=oe.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((h=oe.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(oe,N):this.loadFragment(oe,N,he)},c.getMaxBufferLength=function(){var d=E.prototype.getMaxBufferLength.call(this),h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,S.PlaylistLevelType.MAIN);return h===null?d:Math.max(d,h.len)},c.onMediaDetaching=function(){this.videoBuffer=null,E.prototype.onMediaDetaching.call(this)},c.onAudioTracksUpdated=function(d,h){var y=h.audioTracks;this.resetTransmuxer(),this.levels=y.map(function(v){return new O.Level(v)})},c.onAudioTrackSwitching=function(d,h){var y=!!h.url;this.trackId=h.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),y?this.setInterval(g):this.resetTransmuxer(),y?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},c.onLevelLoaded=function(d,h){this.mainDetails=h.details},c.onAudioTrackLoaded=function(d,h){var y,v=this.levels,x=h.details,k=h.id;if(!v){this.warn("Audio tracks were reset while loading level "+k);return}this.log("Track "+k+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var R=v[k],U=0;if(x.live||(y=R.details)!==null&&y!==void 0&&y.live){var N=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!N)return;!R.details&&x.hasProgramDateTime&&N.hasProgramDateTime?(Object(l.alignMediaPlaylistByPDT)(x,N),U=x.fragments[0].start):U=this.alignPlaylists(x,R.details)}R.details=x,this.levelLastLoaded=k,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(R.details,U),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=I.State.IDLE),this.tick()},c._handleFragmentLoadProgress=function(d){var h,y=d.frag,v=d.part,x=d.payload,k=this.config,R=this.trackId,U=this.levels;if(!U){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+y.sn+" of level "+y.level+" will not be buffered");return}var N=U[R];console.assert(N,"Audio track is defined on fragment load progress");var G=N.details;console.assert(G,"Audio track details are defined on fragment load progress");var L=k.defaultAudioCodec||N.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new o.default(this.hls,S.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var V=this.initPTS[y.cc],$=(h=y.initSegment)===null||h===void 0?void 0:h.data;if(V!==void 0){var q=!1,he=v?v.index:-1,ae=he!==-1,oe=new a.ChunkMetadata(y.level,y.sn,y.stats.chunkCount,x.byteLength,he,ae);H.push(x,$,L,"",y,v,G.totalduration,q,oe,V)}else{e.logger.log("Unknown video PTS for cc "+y.cc+", waiting for video PTS before demuxing audio frag "+y.sn+" of ["+G.startSN+" ,"+G.endSN+"],track "+R);var ue=this.waitingData=this.waitingData||{frag:y,part:v,cache:new p.default,complete:!1},de=ue.cache;de.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},c._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}E.prototype._handleFragmentLoadComplete.call(this,d)},c.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},c.onBufferCreated=function(d,h){var y=h.tracks.audio;y&&(this.mediaBuffer=y.buffer),h.tracks.video&&(this.videoBuffer=h.tracks.video.buffer)},c.onFragBuffered=function(d,h){var y=h.frag,v=h.part;if(y.type!==S.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(y)){this.warn("Fragment "+y.sn+(v?" p: "+v.index:"")+" of level "+y.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}y.sn!=="initSegment"&&(this.fragPrevious=y,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(A.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(y,v)},c.onError=function(d,h){switch(h.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.AUDIO,h);break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=h.fatal?I.State.ERROR:I.State.IDLE,this.warn(h.details+" while loading frag, switching to "+this.state+" state"));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var y=!0,v=this.getFwdBufferInfo(this.mediaBuffer,S.PlaylistLevelType.AUDIO);v&&v.len>.5&&(y=!this.reduceMaxBufferLength(v.len)),y&&(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}},c.onBufferFlushed=function(d,h){var y=h.type;y===m.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},c._handleTransmuxComplete=function(d){var h,y="audio",v=this.hls,x=d.remuxResult,k=d.chunkMeta,R=this.getCurrentContext(k);if(!R){this.warn("The loading context changed while buffering fragment "+k.sn+" of level "+k.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(k.level);return}var U=R.frag,N=R.part,G=x.audio,L=x.text,H=x.id3,V=x.initSegment;if(this.fragContextChanged(U))return;if(this.state=I.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),V!=null&&V.tracks&&(this._bufferInitSegment(V.tracks,U,k),v.trigger(A.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:y,tracks:V.tracks})),G){var $=G.startPTS,q=G.endPTS,he=G.startDTS,ae=G.endDTS;N&&(N.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:$,endPTS:q,startDTS:he,endDTS:ae}),U.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,$,q,he,ae),this.bufferFragmentData(G,U,N,k)}if(H!=null&&(h=H.samples)!==null&&h!==void 0&&h.length){var oe=t({frag:U,id:y},H);v.trigger(A.Events.FRAG_PARSING_METADATA,oe)}if(L){var ue=t({frag:U,id:y},L);v.trigger(A.Events.FRAG_PARSING_USERDATA,ue)}},c._bufferInitSegment=function(d,h,y){if(this.state!==I.State.PARSING)return;d.video&&delete d.video;var v=d.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(A.Events.BUFFER_CODECS,d);var x=v.initSegment;if(x!=null&&x.byteLength){var k={type:"audio",frag:h,part:null,chunkMeta:y,parent:h.type,data:x};this.hls.trigger(A.Events.BUFFER_APPENDING,k)}this.tick()},c.loadFragment=function(d,h,y){var v=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||v===M.FragmentState.NOT_LOADED||v===M.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):h.live&&!Object(j.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,E.prototype.loadFragment.call(this,d,h,y)))},c.completeAudioSwitch=function(){var d=this.hls,h=this.media,y=this.trackId;h&&(this.log("Switching audio track : flushing all audio"),E.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(A.Events.AUDIO_TRACK_SWITCHED,{id:y})},b}(I.default);W.default=_},"./src/controller/audio-track-controller.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/events.ts"),I=w("./src/errors.ts"),A=w("./src/controller/base-playlist-controller.ts"),F=w("./src/types/loader.ts");function M(o,a){for(var n=0;n<a.length;n++){var l=a[n];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(o,l.key,l)}}function O(o,a,n){return a&&M(o.prototype,a),n&&M(o,n),o}function S(o,a){o.prototype=Object.create(a.prototype),o.prototype.constructor=o,m(o,a)}function m(o,a){return m=Object.setPrototypeOf||function(l,s){return l.__proto__=s,l},m(o,a)}var p=function(o){S(a,o);function a(l){var s;return s=o.call(this,l,"[audio-track-controller]")||this,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.trackName="",s.selectDefaultTrack=!0,s.registerListeners(),s}var n=a.prototype;return n.registerListeners=function(){var s=this.hls;s.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(j.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(j.Events.ERROR,this.onError,this)},n.unregisterListeners=function(){var s=this.hls;s.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(j.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(j.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(j.Events.ERROR,this.onError,this)},n.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,o.prototype.destroy.call(this)},n.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},n.onManifestParsed=function(s,e){this.tracks=e.audioTracks||[]},n.onAudioTrackLoaded=function(s,e){var t=e.id,r=e.details,T=this.tracksInGroup[t];if(!T){this.warn("Invalid audio track id "+t);return}var g=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,g))},n.onLevelLoading=function(s,e){this.switchLevel(e.level)},n.onLevelSwitching=function(s,e){this.switchLevel(e.level)},n.switchLevel=function(s){var e=this.hls.levels[s];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(g){return!t||g.groupId===t});this.selectDefaultTrack&&!r.some(function(g){return g.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()}},n.onError=function(s,e){if(o.prototype.onError.call(this,s,e),e.fatal||!e.context)return;e.context.type===F.PlaylistContextType.AUDIO_TRACK&&e.context.id===this.trackId&&e.context.groupId===this.groupId&&this.retryLoadingOrFail(e)},n.setAudioTrack=function(s){var e=this.tracksInGroup;if(s<0||s>=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 "+s);var r=e[s],T=r.id,g=r.groupId,_=g===void 0?"":g,E=r.name,b=r.type,c=r.url;if(this.trackId=s,this.trackName=E,this.selectDefaultTrack=!1,this.hls.trigger(j.Events.AUDIO_TRACK_SWITCHING,{id:T,groupId:_,name:E,type:b,url:c}),r.details&&!r.details.live)return;var i=this.switchParams(r.url,t==null?void 0:t.details);this.loadPlaylist(i)},n.selectInitialTrack=function(){var s=this.tracksInGroup;console.assert(s.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:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},n.findTrackId=function(s){for(var e=this.tracksInGroup,t=0;t<e.length;t++){var r=e[t];if((!this.selectDefaultTrack||r.default)&&(!s||s===r.name))return r.id}return-1},n.loadPlaylist=function(s){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var t=e.id,r=e.groupId,T=e.url;if(s)try{T=s.addDirectives(T)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}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:s||null})}},O(a,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1,this.setAudioTrack(s)}}]),a}(A.default);W.default=p},"./src/controller/base-playlist-controller.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return O});var j=w("./src/polyfills/number.ts"),I=w("./src/types/level.ts"),A=w("./src/controller/level-helper.ts"),F=w("./src/utils/logger.ts"),M=w("./src/errors.ts"),O=function(){function S(p,o){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=F.logger.log.bind(F.logger,o+":"),this.warn=F.logger.warn.bind(F.logger,o+":"),this.hls=p}var m=S.prototype;return m.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},m.onError=function(o,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(o,a){var n=a==null?void 0:a.renditionReports;if(n)for(var l=0;l<n.length;l++){var s=n[l],e=""+s.URI;if(e===o.substr(-e.length)){var t=parseInt(s["LAST-MSN"]),r=parseInt(s["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 I.HlsUrlParameters(t,Object(j.isFiniteNumber)(r)?r:void 0,I.HlsSkip.No)}}},m.loadPlaylist=function(o){},m.shouldLoadTrack=function(o){return this.canLoad&&o&&!!o.url&&(!o.details||o.details.live)},m.playlistLoaded=function(o,a,n){var l=this,s=a.details,e=a.stats,t=e.loading.end?Math.max(0,self.performance.now()-e.loading.end):0;if(s.advancedDateTime=Date.now()-t,s.live||n!=null&&n.live){if(s.reloaded(n),n&&this.log("live playlist "+o+" "+(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:"MISSED")),n&&s.fragments.length>0&&Object(A.mergeDetails)(n,s),!this.canLoad||!s.live)return;var r,T=void 0,g=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var _=this.hls.config.lowLatencyMode,E=s.lastPartSn,b=s.endSN,c=s.lastPartIndex,i=c!==-1,d=E===b,h=_?0:c;i?(T=d?b+1:E,g=d?h:c+1):T=b+1;var y=s.age,v=y+s.ageHeader,x=Math.min(v-s.partTarget,s.targetduration*1.5);if(x>0){if(n&&x>n.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+n.tuneInGoal+" to: "+x+" with playlist age: "+s.age),x=0;else{var k=Math.floor(x/s.targetduration);if(T+=k,g!==void 0){var R=Math.round(x%s.targetduration/s.partTarget);g+=R}this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+y.toFixed(2)+"s goal: "+x+" skip sn "+k+" to part "+g)}s.tuneInGoal=x}if(r=this.getDeliveryDirectives(s,a.deliveryDirectives,T,g),_||!d){this.loadPlaylist(r);return}}else r=this.getDeliveryDirectives(s,a.deliveryDirectives,T,g);var U=Object(A.computeReloadInterval)(s,e);T!==void 0&&s.canBlockReload&&(U-=s.partTarget||1),this.log("reload live playlist "+o+" in "+Math.round(U)+" ms"),this.timer=self.setTimeout(function(){return l.loadPlaylist(r)},U)}else this.clearTimer()},m.getDeliveryDirectives=function(o,a,n,l){var s=Object(I.getSkipValue)(o,n);return a!=null&&a.skip&&o.deltaUpdateFailed&&(n=a.msn,l=a.part,s=I.HlsSkip.No),new I.HlsUrlParameters(n,l,s)},m.retryLoadingOrFail=function(o){var a=this,n=this.hls.config,l=this.retryCount<n.levelLoadingMaxRetry;if(l){var s;if(this.retryCount++,o.details.indexOf("LoadTimeOut")>-1&&(s=o.context)!==null&&s!==void 0&&s.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+o.details+'"'),this.loadPlaylist();else{var e=Math.min(Math.pow(2,this.retryCount)*n.levelLoadingRetryDelay,n.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return a.loadPlaylist()},e),this.warn("retry playlist loading #"+this.retryCount+" in "+e+' ms after "'+o.details+'"')}}else this.warn('cannot recover from error "'+o.details+'"'),this.clearTimer(),o.fatal=!0;return l},S}()},"./src/controller/base-stream-controller.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"State",function(){return b}),w.d(W,"default",function(){return c});var j=w("./src/polyfills/number.ts"),I=w("./src/task-loop.ts"),A=w("./src/controller/fragment-tracker.ts"),F=w("./src/utils/buffer-helper.ts"),M=w("./src/utils/logger.ts"),O=w("./src/events.ts"),S=w("./src/errors.ts"),m=w("./src/types/transmuxer.ts"),p=w("./src/utils/mp4-tools.ts"),o=w("./src/utils/discontinuities.ts"),a=w("./src/controller/fragment-finders.ts"),n=w("./src/controller/level-helper.ts"),l=w("./src/loader/fragment-loader.ts"),s=w("./src/crypt/decrypter.ts"),e=w("./src/utils/time-ranges.ts"),t=w("./src/types/loader.ts");function r(i,d){for(var h=0;h<d.length;h++){var y=d[h];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(i,y.key,y)}}function T(i,d,h){return d&&r(i.prototype,d),h&&r(i,h),i}function g(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function _(i,d){i.prototype=Object.create(d.prototype),i.prototype.constructor=i,E(i,d)}function E(i,d){return E=Object.setPrototypeOf||function(y,v){return y.__proto__=v,y},E(i,d)}var b={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"},c=function(i){_(d,i);function d(y,v,x){var k;return k=i.call(this)||this,k.hls=void 0,k.fragPrevious=null,k.fragCurrent=null,k.fragmentTracker=void 0,k.transmuxer=null,k._state=b.STOPPED,k.media=void 0,k.mediaBuffer=void 0,k.config=void 0,k.bitrateTest=!1,k.lastCurrentTime=0,k.nextLoadPosition=0,k.startPosition=0,k.loadedmetadata=!1,k.fragLoadError=0,k.retryDate=0,k.levels=null,k.fragmentLoader=void 0,k.levelLastLoaded=null,k.startFragRequested=!1,k.decrypter=void 0,k.initPTS=[],k.onvseeking=null,k.onvended=null,k.logPrefix="",k.log=void 0,k.warn=void 0,k.logPrefix=x,k.log=M.logger.log.bind(M.logger,x+":"),k.warn=M.logger.warn.bind(M.logger,x+":"),k.hls=y,k.fragmentLoader=new l.default(y.config),k.fragmentTracker=v,k.config=y.config,k.decrypter=new s.default(y,y.config),y.on(O.Events.KEY_LOADED,k.onKeyLoaded,g(k)),k}var h=d.prototype;return h.doTick=function(){this.onTickEnd()},h.onTickEnd=function(){},h.startLoad=function(v){},h.stopLoad=function(){this.fragmentLoader.abort();var v=this.fragCurrent;v&&this.fragmentTracker.removeFragment(v),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},h._streamEnded=function(v,x){var k=this.fragCurrent,R=this.fragmentTracker;if(!x.live&&k&&k.sn===x.endSN&&!v.nextStart){var U=R.getState(k);return U===A.FragmentState.PARTIAL||U===A.FragmentState.OK}return!1},h.onMediaAttached=function(v,x){var k=this.media=this.mediaBuffer=x.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),k.addEventListener("seeking",this.onvseeking),k.addEventListener("ended",this.onvended);var R=this.config;this.levels&&R.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(R.startPosition)},h.onMediaDetaching=function(){var v=this.media;v!=null&&v.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),v&&(v.removeEventListener("seeking",this.onvseeking),v.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},h.onMediaSeeking=function(){var v=this.config,x=this.fragCurrent,k=this.media,R=this.mediaBuffer,U=this.state,N=k?k.currentTime:0,G=F.BufferHelper.bufferInfo(R||k,N,v.maxBufferHole);if(this.log("media seeking to "+(Object(j.isFiniteNumber)(N)?N.toFixed(3):N)+", state: "+U),U===b.ENDED)this.resetLoadingState();else if(x&&!G.len){var L=v.maxFragLookUpTolerance,H=x.start-L,V=x.start+x.duration+L,$=N>V;(N<H||$)&&($&&x.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),x.loader.abort()),this.resetLoadingState())}k&&(this.lastCurrentTime=N),!this.loadedmetadata&&!G.len&&(this.nextLoadPosition=this.startPosition=N),this.tickImmediate()},h.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},h.onKeyLoaded=function(v,x){if(this.state!==b.KEY_LOADING||x.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var k=this.levels[x.frag.level].details;k&&this.loadFragment(x.frag,k,x.frag.start)},h.onHandlerDestroying=function(){this.stopLoad(),i.prototype.onHandlerDestroying.call(this)},h.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(O.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,i.prototype.onHandlerDestroyed.call(this)},h.loadKey=function(v,x){this.log("Loading key for "+v.sn+" of ["+x.startSN+"-"+x.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level),this.state=b.KEY_LOADING,this.fragCurrent=v,this.hls.trigger(O.Events.KEY_LOADING,{frag:v})},h.loadFragment=function(v,x,k){this._loadFragForPlayback(v,x,k)},h._loadFragForPlayback=function(v,x,k){var R=this,U=function(G){if(R.fragContextChanged(v)){R.warn("Fragment "+v.sn+(G.part?" p: "+G.part.index:"")+" of level "+v.level+" was dropped during download."),R.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,R._handleFragmentLoadProgress(G)};this._doFragLoad(v,x,k,U).then(function(N){if(!N)return;R.fragLoadError=0;var G=R.state;if(R.fragContextChanged(v)){(G===b.FRAG_LOADING||G===b.BACKTRACKING||!R.fragCurrent&&G===b.PARSING)&&(R.fragmentTracker.removeFragment(v),R.state=b.IDLE);return}if("payload"in N&&(R.log("Loaded fragment "+v.sn+" of level "+v.level),R.hls.trigger(O.Events.FRAG_LOADED,N),R.state===b.BACKTRACKING)){R.fragmentTracker.backtrack(v,N),R.resetFragmentLoading(v);return}R._handleFragmentLoadComplete(N)}).catch(function(N){R.warn(N),R.resetFragmentLoading(v)})},h.flushMainBuffer=function(v,x,k){if(k===void 0&&(k=null),!(v-x))return;var R={startOffset:v,endOffset:x,type:k};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,R)},h._loadInitSegment=function(v){var x=this;this._doFragLoad(v).then(function(k){if(!k||x.fragContextChanged(v)||!x.levels)throw new Error("init load aborted");return k}).then(function(k){var R=x.hls,U=k.payload,N=v.decryptdata;if(U&&U.byteLength>0&&N&&N.key&&N.iv&&N.method==="AES-128"){var G=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(U),N.key.buffer,N.iv.buffer).then(function(L){var H=self.performance.now();return R.trigger(O.Events.FRAG_DECRYPTED,{frag:v,payload:L,stats:{tstart:G,tdecrypt:H}}),k.payload=L,k})}return k}).then(function(k){var R=x.fragCurrent,U=x.hls,N=x.levels;if(!N)throw new Error("init load aborted, missing levels");var G=N[v.level].details;console.assert(G,"Level details are defined when init segment is loaded");var L=v.stats;x.state=b.IDLE,x.fragLoadError=0,v.data=new Uint8Array(k.payload),L.parsing.start=L.buffering.start=self.performance.now(),L.parsing.end=L.buffering.end=self.performance.now(),k.frag===R&&U.trigger(O.Events.FRAG_BUFFERED,{stats:L,frag:R,part:null,id:v.type}),x.tick()}).catch(function(k){x.warn(k),x.resetFragmentLoading(v)})},h.fragContextChanged=function(v){var x=this.fragCurrent;return!v||!x||v.level!==x.level||v.sn!==x.sn||v.urlId!==x.urlId},h.fragBufferedComplete=function(v,x){var k=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+e.default.toString(F.BufferHelper.getBuffered(k))),this.state=b.IDLE,this.tick()},h._handleFragmentLoadComplete=function(v){var x=this.transmuxer;if(!x)return;var k=v.frag,R=v.part,U=v.partsLoaded,N=!U||U.length===0||U.some(function(L){return!L}),G=new m.ChunkMetadata(k.level,k.sn,k.stats.chunkCount+1,0,R?R.index:-1,!N);x.flush(G)},h._handleFragmentLoadProgress=function(v){},h._doFragLoad=function(v,x,k,R){var U=this;if(k===void 0&&(k=null),!this.levels)throw new Error("frag load aborted, missing levels");if(k=Math.max(v.start,k||0),this.config.lowLatencyMode&&x){var N=x.partList;if(N&&R){k>v.end&&x.fragmentHint&&(v=x.fragmentHint);var G=this.getNextPart(N,v,k);if(G>-1){var L=N[G];return this.log("Loading part sn: "+v.sn+" p: "+L.index+" cc: "+v.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+G+"-"+(N.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(k.toFixed(3))),this.nextLoadPosition=L.start+L.duration,this.state=b.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:v,part:N[G],targetBufferTime:k}),this.doFragPartsLoad(v,N,G,R).catch(function(H){return U.handleFragLoadError(H)})}else if(!v.url||this.loadedEndOfParts(N,k))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(k.toFixed(3))),Object(j.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=b.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:v,targetBufferTime:k}),this.fragmentLoader.load(v,R).catch(function(H){return U.handleFragLoadError(H)})},h.doFragPartsLoad=function(v,x,k,R){var U=this;return new Promise(function(N,G){var L=[],H=function V($){var q=x[$];U.fragmentLoader.loadPart(v,q,R).then(function(he){L[q.index]=he;var ae=he.part;U.hls.trigger(O.Events.FRAG_LOADED,he);var oe=x[$+1];if(oe&&oe.fragment===v)V($+1);else return N({frag:v,part:ae,partsLoaded:L})}).catch(G)};H(k)})},h.handleFragLoadError=function(v){var x=v.data;return x&&x.details===S.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(O.Events.ERROR,x),null},h._handleTransmuxerFlush=function(v){var x=this.getCurrentContext(v);if(!x||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var k=x.frag,R=x.part,U=x.level,N=self.performance.now();k.stats.parsing.end=N,R&&(R.stats.parsing.end=N),this.updateLevelTiming(k,R,U,v.partial)},h.getCurrentContext=function(v){var x=this.levels,k=v.level,R=v.sn,U=v.part;if(!x||!x[k])return this.warn("Levels object was unset while buffering fragment "+R+" of level "+k+". The current chunk will not be buffered."),null;var N=x[k],G=U>-1?Object(n.getPartWith)(N,R,U):null,L=G?G.fragment:Object(n.getFragmentWithSN)(N,R,this.fragCurrent);return L?{frag:L,part:G,level:N}:null},h.bufferFragmentData=function(v,x,k,R){if(!v||this.state!==b.PARSING)return;var U=v.data1,N=v.data2,G=U;if(U&&N&&(G=Object(p.appendUint8Array)(U,N)),!G||!G.length)return;var L={type:v.type,frag:x,part:k,chunkMeta:R,parent:x.type,data:G};this.hls.trigger(O.Events.BUFFER_APPENDING,L),v.dropped&&v.independent&&!k&&this.flushBufferGap(x)},h.flushBufferGap=function(v){var x=this.media;if(!x)return;if(!F.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,v.start);return}var k=x.currentTime,R=F.BufferHelper.bufferInfo(x,k,0),U=v.duration,N=Math.min(this.config.maxFragLookUpTolerance*2,U*.25),G=Math.max(Math.min(v.start-N,R.end-N),k+N);v.start-G>N&&this.flushMainBuffer(G,v.start)},h.getFwdBufferInfo=function(v,x){var k=this.config,R=this.getLoadPosition();if(!Object(j.isFiniteNumber)(R))return null;var U=F.BufferHelper.bufferInfo(v,R,k.maxBufferHole);if(U.len===0&&U.nextStart!==void 0){var N=this.fragmentTracker.getBufferedFrag(R,x);if(N&&U.nextStart<N.end)return F.BufferHelper.bufferInfo(v,R,Math.max(U.nextStart,k.maxBufferHole))}return U},h.getMaxBufferLength=function(v){var x=this.config,k;return v?k=Math.max(8*x.maxBufferSize/v,x.maxBufferLength):k=x.maxBufferLength,Math.min(k,x.maxMaxBufferLength)},h.reduceMaxBufferLength=function(v){var x=this.config,k=v||x.maxBufferLength;return x.maxMaxBufferLength>=k?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},h.getNextFragment=function(v,x){var k,R,U=x.fragments,N=U.length;if(!N)return null;var G=this.config,L=U[0].start,H;if(x.live){var V=G.initialLiveManifestSize;if(N<V)return this.warn("Not enough fragments to start playback (have: "+N+", need: "+V+")"),null;!x.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(x,U),this.startPosition=H?this.hls.liveSyncPosition||H.start:v)}else v<=L&&(H=U[0]);if(!H){var $=G.lowLatencyMode?x.partEnd:x.fragmentEnd;H=this.getFragmentAtPosition(v,$,x)}return(k=H)!==null&&k!==void 0&&k.initSegment&&!((R=H)!==null&&R!==void 0&&R.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},h.getNextPart=function(v,x,k){for(var R=-1,U=!1,N=!0,G=0,L=v.length;G<L;G++){var H=v[G];if(N=N&&!H.independent,R>-1&&k<H.start)break;var V=H.loaded;!V&&(U||H.independent||N)&&H.fragment===x&&(R=G),U=V}return R},h.loadedEndOfParts=function(v,x){var k=v[v.length-1];return k&&x>k.start&&k.loaded},h.getInitialLiveFragment=function(v,x){var k=this.fragPrevious,R=null;if(k){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+k.programDateTime),R=Object(a.findFragmentByPDT)(x,k.endProgramDateTime,this.config.maxFragLookUpTolerance)),!R){var U=k.sn+1;if(U>=v.startSN&&U<=v.endSN){var N=x[U-v.startSN];k.cc===N.cc&&(R=N,this.log("Live playlist, switching playlist, load frag with next SN: "+R.sn))}R||(R=Object(a.findFragWithCC)(x,k.cc),R&&this.log("Live playlist, switching playlist, load frag with same CC: "+R.sn))}}else{var G=this.hls.liveSyncPosition;G!==null&&(R=this.getFragmentAtPosition(G,this.bitrateTest?v.fragmentEnd:v.edge,v))}return R},h.getFragmentAtPosition=function(v,x,k){var R=this.config,U=this.fragPrevious,N=k.fragments,G=k.endSN,L=k.fragmentHint,H=R.maxFragLookUpTolerance,V=!!(R.lowLatencyMode&&k.partList&&L);V&&L&&!this.bitrateTest&&(N=N.concat(L),G=L.sn);var $;if(v<x){var q=v>x-H?0:H;$=Object(a.findFragmentByPTS)(U,N,v,q)}else $=N[N.length-1];if($){var he=$.sn-k.startSN,ae=U&&$.level===U.level,oe=N[he+1],ue=this.fragmentTracker.getState($);if(ue===A.FragmentState.BACKTRACKED){$=null;for(var de=he;N[de]&&this.fragmentTracker.getState(N[de])===A.FragmentState.BACKTRACKED;)U?$=N[de--]:$=N[--de];$||($=oe)}else U&&$.sn===U.sn&&!V&&(ae&&($.sn<G&&this.fragmentTracker.getState(oe)!==A.FragmentState.OK?(this.log("SN "+$.sn+" just loaded, load next one: "+oe.sn),$=oe):$=null))}return $},h.synchronizeToLiveEdge=function(v){var x=this.config,k=this.media;if(!k)return;var R=this.hls.liveSyncPosition,U=k.currentTime,N=v.fragments[0].start,G=v.edge,L=U>=N-x.maxFragLookUpTolerance&&U<=G;if(R!==null&&k.duration>R&&(U<R||!L)){var H=x.liveMaxLatencyDuration!==void 0?x.liveMaxLatencyDuration:x.liveMaxLatencyDurationCount*v.targetduration;(!L&&k.readyState<4||U<G-H)&&(this.loadedmetadata||(this.nextLoadPosition=R),k.readyState&&(this.warn("Playback: "+U.toFixed(3)+" is located too far from the end of live sliding playlist: "+G+", reset currentTime to : "+R.toFixed(3)),k.currentTime=R))}},h.alignPlaylists=function(v,x){var k=this.levels,R=this.levelLastLoaded,U=this.fragPrevious,N=R!==null?k[R]:null,G=v.fragments.length;if(!G)return this.warn("No fragments in live playlist"),0;var L=v.fragments[0].start,H=!x,V=v.alignedSliding&&Object(j.isFiniteNumber)(L);if(H||!V&&!L){Object(o.alignStream)(U,N,v);var $=v.fragments[0].start;return this.log("Live playlist sliding: "+$.toFixed(2)+" start-sn: "+(x?x.startSN:"na")+"->"+v.startSN+" prev-sn: "+(U?U.sn:"na")+" fragments: "+G),$}return L},h.waitForCdnTuneIn=function(v){var x=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*x)},h.setStartPosition=function(v,x){var k=this.startPosition;if(k<x&&(k=-1),k===-1||this.lastCurrentTime===-1){var R=v.startTimeOffset;Object(j.isFiniteNumber)(R)?(k=x+R,R<0&&(k+=v.totalduration),k=Math.min(Math.max(x,k),x+v.totalduration),this.log("Start time offset "+R+" found in playlist, adjust startPosition to "+k),this.startPosition=k):v.live?k=this.hls.liveSyncPosition||x:this.startPosition=k=0,this.lastCurrentTime=k}this.nextLoadPosition=k},h.getLoadPosition=function(){var v=this.media,x=0;return this.loadedmetadata&&v?x=v.currentTime:this.nextLoadPosition&&(x=this.nextLoadPosition),x},h.handleFragLoadAborted=function(v,x){this.transmuxer&&v.sn!=="initSegment"&&v.stats.aborted&&(this.warn("Fragment "+v.sn+(x?" part"+x.index:"")+" of level "+v.level+" was aborted"),this.resetFragmentLoading(v))},h.resetFragmentLoading=function(v){(!this.fragCurrent||!this.fragContextChanged(v))&&(this.state=b.IDLE)},h.onFragmentOrKeyLoadError=function(v,x){if(x.fatal)return;var k=x.frag;if(!k||k.type!==v)return;var R=this.fragCurrent;console.assert(R&&k.sn===R.sn&&k.level===R.level&&k.urlId===R.urlId,"Frag load error must match current frag to retry");var U=this.config;if(this.fragLoadError+1<=U.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(k.level))return;var N=Math.min(Math.pow(2,this.fragLoadError)*U.fragLoadingRetryDelay,U.fragLoadingMaxRetryTimeout);this.warn("Fragment "+k.sn+" of "+v+" "+k.level+" failed to load, retrying in "+N+"ms"),this.retryDate=self.performance.now()+N,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else x.levelRetry?(v===t.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(M.logger.error(x.details+" reaches max retry, redispatch as fatal ..."),x.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},h.afterBufferFlushed=function(v,x,k){if(!v)return;var R=F.BufferHelper.getBuffered(v);this.fragmentTracker.detectEvictedFragments(x,R,k),this.state===b.ENDED&&this.resetLoadingState()},h.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},h.resetLiveStartWhenNotLoaded=function(v){if(!this.loadedmetadata){this.startFragRequested=!1;var x=this.levels?this.levels[v].details:null;if(x!=null&&x.live)return this.startPosition=-1,this.setStartPosition(x,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},h.updateLevelTiming=function(v,x,k,R){var U=this,N=k.details;console.assert(!!N,"level.details must be defined");var G=Object.keys(v.elementaryStreams).reduce(function(L,H){var V=v.elementaryStreams[H];if(V){var $=V.endPTS-V.startPTS;if($<=0)return U.warn("Could not parse fragment "+v.sn+" "+H+" duration reliably ("+$+") resetting transmuxer to fallback to playlist timing"),U.resetTransmuxer(),L||!1;var q=R?0:Object(n.updateFragPTSDTS)(N,v,V.startPTS,V.endPTS,V.startDTS,V.endDTS);return U.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:N,level:k,drift:q,type:H,frag:v,start:V.startPTS,end:V.endPTS}),!0}return L},!1);G?(this.state=b.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:v,part:x})):this.resetLoadingState()},h.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},T(d,[{key:"state",get:function(){return this._state},set:function(v){var x=this._state;x!==v&&(this._state=v,this.log(x+"->"+v))}}]),d}(I.default)},"./src/controller/buffer-controller.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return a});var j=w("./src/polyfills/number.ts"),I=w("./src/events.ts"),A=w("./src/utils/logger.ts"),F=w("./src/errors.ts"),M=w("./src/utils/buffer-helper.ts"),O=w("./src/utils/mediasource-helper.ts"),S=w("./src/loader/fragment.ts"),m=w("./src/controller/buffer-operation-queue.ts"),p=Object(O.getMediaSource)(),o=/([ha]vc.)(?:\.[^.,]+)+/,a=function(){function n(s){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(I.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=s,this._initSourceBuffer(),this.registerListeners()}var l=n.prototype;return l.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},l.destroy=function(){this.unregisterListeners(),this.details=null},l.registerListeners=function(){var e=this.hls;e.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.Events.BUFFER_RESET,this.onBufferReset,this),e.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(I.Events.BUFFER_EOS,this.onBufferEos,this),e.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(I.Events.FRAG_PARSED,this.onFragParsed,this),e.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},l.unregisterListeners=function(){var e=this.hls;e.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.Events.BUFFER_RESET,this.onBufferReset,this),e.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.Events.BUFFER_EOS,this.onBufferEos,this),e.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(I.Events.FRAG_PARSED,this.onFragParsed,this),e.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},l._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new m.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},l.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")},l.onMediaAttaching=function(e,t){var r=this.media=t.media;if(r&&p){var T=this.mediaSource=new p;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}},l.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(I.Events.MEDIA_DETACHED,void 0)},l.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()},l.onBufferCodecs=function(e,t){var r=this,T=this.getSourceBufferTypes().length;if(Object.keys(t).forEach(function(g){if(T){var _=r.tracks[g];if(_&&typeof _.buffer.changeType=="function"){var E=t[g],b=E.codec,c=E.levelCodec,i=E.container,d=(_.levelCodec||_.codec).replace(o,"$1"),h=(c||b).replace(o,"$1");if(d!==h){var y=i+";codecs="+(c||b);r.appendChangeType(g,y)}}}else r.pendingTracks[g]=t[g]}),T)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},l.appendChangeType=function(e,t){var r=this,T=this.operationQueue,g={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(g,e)},l.onBufferAppending=function(e,t){var r=this,T=this.hls,g=this.operationQueue,_=this.tracks,E=t.data,b=t.type,c=t.frag,i=t.part,d=t.chunkMeta,h=d.buffering[b],y=self.performance.now();h.start=y;var v=c.stats.buffering,x=i?i.stats.buffering:null;v.start===0&&(v.start=y),x&&x.start===0&&(x.start=y);var k=_.audio,R=b==="audio"&&d.id===1&&(k==null?void 0:k.container)==="audio/mpeg",U={execute:function(){if(h.executeStart=self.performance.now(),R){var G=r.sourceBuffer[b];if(G){var L=c.start-G.timestampOffset;Math.abs(L)>=.1&&(A.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+c.start+" (delta: "+L+") sn: "+c.sn+")"),G.timestampOffset=c.start)}}r.appendExecutor(E,b)},onStart:function(){},onComplete:function(){var G=self.performance.now();h.executeEnd=h.end=G,v.first===0&&(v.first=G),x&&x.first===0&&(x.first=G);var L=r.sourceBuffer,H={};for(var V in L)H[V]=M.BufferHelper.getBuffered(L[V]);r.appendError=0,r.hls.trigger(I.Events.BUFFER_APPENDED,{type:b,frag:c,part:i,chunkMeta:d,parent:c.type,timeRanges:H})},onError:function(G){A.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",G);var L={type:F.ErrorTypes.MEDIA_ERROR,parent:c.type,details:F.ErrorDetails.BUFFER_APPEND_ERROR,err:G,fatal:!1};G.code===DOMException.QUOTA_EXCEEDED_ERR?L.details=F.ErrorDetails.BUFFER_FULL_ERROR:(r.appendError++,L.details=F.ErrorDetails.BUFFER_APPEND_ERROR,r.appendError>T.config.appendErrorMaxRetry&&(A.logger.error("[buffer-controller]: Failed "+T.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),L.fatal=!0)),T.trigger(I.Events.ERROR,L)}};g.append(U,b)},l.onBufferFlushing=function(e,t){var r=this,T=this.operationQueue,g=function(E){return{execute:r.removeExecutor.bind(r,E,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(I.Events.BUFFER_FLUSHED,{type:E})},onError:function(c){A.logger.warn("[buffer-controller]: Failed to remove from "+E+" SourceBuffer",c)}}};t.type?T.append(g(t.type),t.type):this.getSourceBufferTypes().forEach(function(_){T.append(g(_),_)})},l.onFragParsed=function(e,t){var r=this,T=t.frag,g=t.part,_=[],E=g?g.elementaryStreams:T.elementaryStreams;E[S.ElementaryStreamTypes.AUDIOVIDEO]?_.push("audiovideo"):(E[S.ElementaryStreamTypes.AUDIO]&&_.push("audio"),E[S.ElementaryStreamTypes.VIDEO]&&_.push("video"));var b=function(){var i=self.performance.now();T.stats.buffering.end=i,g&&(g.stats.buffering.end=i);var d=g?g.stats:T.stats;r.hls.trigger(I.Events.FRAG_BUFFERED,{frag:T,part:g,stats:d,id:T.type})};_.length===0&&A.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+T.type+" level: "+T.level+" sn: "+T.sn),this.blockBuffers(b,_)},l.onFragChanged=function(e,t){this.flushBackBuffer()},l.onBufferEos=function(e,t){var r=this,T=this.getSourceBufferTypes().reduce(function(g,_){var E=r.sourceBuffer[_];return(!t.type||t.type===_)&&(E&&!E.ended&&(E.ended=!0,A.logger.log("[buffer-controller]: "+_+" sourceBuffer now EOS"))),g&&!!(!E||E.ended)},!0);T&&this.blockBuffers(function(){var g=r.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},l.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()},l.flushBackBuffer=function(){var e=this.hls,t=this.details,r=this.media,T=this.sourceBuffer;if(!r||t===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var _=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!Object(j.isFiniteNumber)(_)||_<0)return;var E=r.currentTime,b=t.levelTargetDuration,c=Math.max(_,b),i=Math.floor(E/b)*b-c;g.forEach(function(d){var h=T[d];if(h){var y=M.BufferHelper.getBuffered(h);y.length>0&&i>y.start(0)&&(e.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:i}),t.live&&e.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i}),e.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:d}))}})},l.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,g=e.fragments[0].start+e.totalduration,_=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)):(g>E&&g>_||!Object(j.isFiniteNumber)(_))&&(A.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),T.duration=g)},l.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 g=Math.max(0,r[0].start),_=Math.max(g,g+e.totalduration);t.setLiveSeekableRange(g,_)}},l.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 g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(I.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(_){t.executeNext(_)})}},l.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 g in e)if(!t[g]){var _=e[g];if(!_)throw Error("source buffer exists for track "+g+", however track does not");var E=_.levelCodec||_.codec,b=_.container+";codecs="+E;A.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var c=t[g]=r.addSourceBuffer(b),i=g;this.addBufferListener(i,"updatestart",this._onSBUpdateStart),this.addBufferListener(i,"updateend",this._onSBUpdateEnd),this.addBufferListener(i,"error",this._onSBUpdateError),this.tracks[g]={buffer:c,codec:E,container:_.container,levelCodec:_.levelCodec,id:_.id},T++}catch(d){A.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(I.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:b})}}T&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},l._onSBUpdateStart=function(e){var t=this.operationQueue,r=t.current(e);r.onStart()},l._onSBUpdateEnd=function(e){var t=this.operationQueue,r=t.current(e);r.onComplete(),t.shiftAndExecuteNext(e)},l._onSBUpdateError=function(e,t){A.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(I.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var r=this.operationQueue.current(e);r&&r.onError(t)},l.removeExecutor=function(e,t,r){var T=this.media,g=this.mediaSource,_=this.operationQueue,E=this.sourceBuffer,b=E[e];if(!T||!g||!b){A.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),_.shiftAndExecuteNext(e);return}var c=Object(j.isFiniteNumber)(T.duration)?T.duration:Infinity,i=Object(j.isFiniteNumber)(g.duration)?g.duration:Infinity,d=Math.max(0,t),h=Math.min(r,c,i);h>d?(A.logger.log("[buffer-controller]: Removing ["+d+","+h+"] from the "+e+" SourceBuffer"),console.assert(!b.updating,e+" sourceBuffer must not be updating"),b.remove(d,h)):_.shiftAndExecuteNext(e)},l.appendExecutor=function(e,t){var r=this.operationQueue,T=this.sourceBuffer,g=T[t];if(!g){A.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),r.shiftAndExecuteNext(t);return}g.ended=!1,console.assert(!g.updating,t+" sourceBuffer must not be updating"),g.appendBuffer(e)},l.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,g=t.map(function(_){return T.appendBlocker(_)});Promise.all(g).then(function(){e(),t.forEach(function(_){var E=r.sourceBuffer[_];(!E||!E.updating)&&T.shiftAndExecuteNext(_)})})},l.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},l.addBufferListener=function(e,t,r){var T=this.sourceBuffer[e];if(!T)return;var g=r.bind(this,e);this.listeners[e].push({event:t,listener:g}),T.addEventListener(t,g)},l.removeBufferListeners=function(e){var t=this.sourceBuffer[e];if(!t)return;this.listeners[e].forEach(function(r){t.removeEventListener(r.event,r.listener)})},n}()},"./src/controller/buffer-operation-queue.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return I});var j=w("./src/utils/logger.ts"),I=function(){function A(M){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=M}var F=A.prototype;return F.append=function(O,S){var m=this.queues[S];m.push(O),m.length===1&&this.buffers[S]&&this.executeNext(S)},F.insertAbort=function(O,S){var m=this.queues[S];m.unshift(O),this.executeNext(S)},F.appendBlocker=function(O){var S,m=new Promise(function(o){S=o}),p={execute:S,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,O),m},F.executeNext=function(O){var S=this.buffers,m=this.queues,p=S[O],o=m[O];if(o.length){var a=o[0];try{a.execute()}catch(n){j.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),a.onError(n),(!p||!p.updating)&&(o.shift(),this.executeNext(O))}}},F.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},F.current=function(O){return this.queues[O][0]},A}()},"./src/controller/cap-level-controller.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/events.ts");function I(M,O){for(var S=0;S<O.length;S++){var m=O[S];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(M,m.key,m)}}function A(M,O,S){return O&&I(M.prototype,O),S&&I(M,S),M}var F=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 O=M.prototype;return O.setStreamController=function(m){this.streamController=m},O.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},O.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)},O.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)},O.onFpsDropLevelCapping=function(m,p){M.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},O.onMediaAttaching=function(m,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},O.onManifestParsed=function(m,p){var o=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,o.config.capLevelToPlayerSize&&p.video&&this.startCapping()},O.onBufferCodecs=function(m,p){var o=this.hls;o.config.capLevelToPlayerSize&&p.video&&this.startCapping()},O.onMediaDetaching=function(){this.stopCapping()},O.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var m=this.hls.levels;if(m.length){var p=this.hls;p.autoLevelCapping=this.getMaxLevel(m.length-1),p.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=p.autoLevelCapping}}},O.getMaxLevel=function(m){var p=this,o=this.hls.levels;if(!o.length)return-1;var a=o.filter(function(n,l){return M.isLevelAllowed(l,p.restrictedLevels)&&l<=m});return this.clientRect=null,M.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)},O.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()},O.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},O.getDimensions=function(){if(this.clientRect)return this.clientRect;var m=this.media,p={width:0,height:0};if(m){var o=m.getBoundingClientRect();p.width=o.width,p.height=o.height,!p.width&&!p.height&&(p.width=o.right-o.left||m.width||0,p.height=o.bottom-o.top||m.height||0)}return this.clientRect=p,p},M.isLevelAllowed=function(m,p){return p===void 0&&(p=[]),p.indexOf(m)===-1},M.getMaxLevelByMediaSize=function(m,p,o){if(!m||!m.length)return-1;for(var a=function(t,r){return r?t.width!==r.width||t.height!==r.height:!0},n=m.length-1,l=0;l<m.length;l+=1){var s=m[l];if((s.width>=p||s.height>=o)&&a(s,m[l+1])){n=l;break}}return n},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(p){}return m}}]),M}();W.default=F},"./src/controller/cmcd-controller.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return a});var j=w("./src/events.ts"),I=w("./src/types/cmcd.ts"),A=w("./src/utils/buffer-helper.ts"),F=w("./src/utils/logger.ts");function M(n,l){for(var s=0;s<l.length;s++){var e=l[s];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}function O(n,l,s){return l&&M(n.prototype,l),s&&M(n,s),n}function S(n,l){var s=typeof Symbol!="undefined"&&n[Symbol.iterator]||n["@@iterator"];if(s)return(s=s.call(n)).next.bind(s);if(Array.isArray(n)||(s=m(n))||l&&n&&typeof n.length=="number"){s&&(n=s);var e=0;return function(){return e>=n.length?{done:!0}:{done:!1,value:n[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(n,l){if(!n)return;if(typeof n=="string")return p(n,l);var s=Object.prototype.toString.call(n).slice(8,-1);if(s==="Object"&&n.constructor&&(s=n.constructor.name),s==="Map"||s==="Set")return Array.from(n);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return p(n,l)}function p(n,l){(l==null||l>n.length)&&(l=n.length);for(var s=0,e=new Array(l);s<l;s++)e[s]=n[s];return e}function o(){return o=Object.assign||function(n){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var e in s)Object.prototype.hasOwnProperty.call(s,e)&&(n[e]=s[e])}return n},o.apply(this,arguments)}var a=function(){function n(s){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:I.CMCDObjectType.MANIFEST,su:!e.initialized})}catch(g){F.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(T){try{var g=T.frag,_=e.hls.levels[g.level],E=e.getObjectType(g),b={d:g.duration*1e3,ot:E};(E===I.CMCDObjectType.VIDEO||E===I.CMCDObjectType.AUDIO||E==I.CMCDObjectType.MUXED)&&(b.br=_.bitrate/1e3,b.tb=e.getTopBandwidth(E),b.bl=e.getBufferLength(E)),e.apply(T,b)}catch(c){F.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=s;var t=this.config=s.config,r=t.cmcd;r!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||n.uuid(),this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.registerListeners())}var l=n.prototype;return l.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)},l.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()},l.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},l.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},l.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},l.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},l.createData=function(){var e;return{v:I.CMCDVersion,sf:I.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}},l.apply=function(e,t){t===void 0&&(t={}),o(t,this.createData());var r=t.ot===I.CMCDObjectType.INIT||t.ot===I.CMCDObjectType.VIDEO||t.ot===I.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=n.toHeaders(t);if(!Object.keys(T).length)return;e.headers||(e.headers={}),o(e.headers,T)}else{var g=n.toQuery(t);if(!g)return;e.url=n.appendQueryToUri(e.url,g)}},l.getObjectType=function(e){var t=e.type;return t==="subtitle"?I.CMCDObjectType.TIMED_TEXT:e.sn==="initSegment"?I.CMCDObjectType.INIT:t==="audio"?I.CMCDObjectType.AUDIO:t==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},l.getTopBandwidth=function(e){for(var t=0,r=e===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,T=S(r),g;!(g=T()).done;){var _=g.value;_.bitrate>t&&(t=_.bitrate)}return t>0?t:NaN},l.getBufferLength=function(e){var t=this.hls.media,r=e===I.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},l.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,r=e||this.config.loader;return function(){function T(_){this.loader=void 0,this.loader=new r(_)}var g=T.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(E,b,c){t(E),this.loader.load(E,b,c)},O(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},l.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,r=e||this.config.loader;return function(){function T(_){this.loader=void 0,this.loader=new r(_)}var g=T.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(E,b,c){t(E),this.loader.load(E,b,c)},O(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},n.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)},n.serialize=function(e){for(var t=[],r=function(R){return!Number.isNaN(R)&&R!=null&&R!==""&&R!==!1},T=function(R){return Math.round(R)},g=function(R){return T(R/100)*100},_=function(R){return encodeURIComponent(R)},E={br:T,d:T,bl:g,dl:g,mtp:g,nor:_,rtp:g,tb:T},b=Object.keys(e||{}).sort(),c=S(b),i;!(i=c()).done;){var d=i.value,h=e[d];if(!r(h))continue;if(d==="v"&&h===1)continue;if(d=="pr"&&h===1)continue;var y=E[d];y&&(h=y(h));var v=typeof h,x=void 0;d==="ot"||d==="sf"||d==="st"?x=d+"="+h:v==="boolean"?x=d:v==="number"?x=d+"="+h:x=d+"="+JSON.stringify(h),t.push(x)}return t.join(",")},n.toHeaders=function(e){for(var t=Object.keys(e),r={},T=["Object","Request","Session","Status"],g=[{},{},{},{}],_={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,b=t;E<b.length;E++){var c=b[E],i=_[c]!=null?_[c]:1;g[i][c]=e[c]}for(var d=0;d<g.length;d++){var h=n.serialize(g[d]);h&&(r["CMCD-"+T[d]]=h)}return r},n.toQuery=function(e){return"CMCD="+encodeURIComponent(n.serialize(e))},n.appendQueryToUri=function(e,t){if(!t)return e;var r=e.includes("?")?"&":"?";return""+e+r+t},n}()},"./src/controller/eme-controller.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/events.ts"),I=w("./src/errors.ts"),A=w("./src/utils/logger.ts"),F=w("./src/utils/mediakeys-helper.ts");function M(a,n){for(var l=0;l<n.length;l++){var s=n[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(a,s.key,s)}}function O(a,n,l){return n&&M(a.prototype,n),l&&M(a,l),a}var S=3,m=function(n,l,s){var e={audioCapabilities:[],videoCapabilities:[]};return n.forEach(function(t){e.audioCapabilities.push({contentType:'audio/mp4; codecs="'+t+'"',robustness:s.audioRobustness||""})}),l.forEach(function(t){e.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"',robustness:s.videoRobustness||""})}),[e]},p=function(n,l,s,e){switch(n){case F.KeySystems.WIDEVINE:return m(l,s,e);default:throw new Error("Unknown key-system: "+n)}},o=function(){function a(l){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=l,this._config=l.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 n=a.prototype;return n.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},n._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)},n._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)},n.getLicenseServerUrl=function(s){switch(s){case F.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+s+'"')},n._attemptKeySystemAccess=function(s,e,t){var r=this,T=p(s,e,t,this._drmSystemOptions);A.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(s,T);this.mediaKeysPromise=g.then(function(_){return r._onMediaKeySystemAccessObtained(s,_)}),g.catch(function(_){A.logger.error('Failed to obtain key-system "'+s+'" access:',_)})},n._onMediaKeySystemAccessObtained=function(s,e){var t=this;A.logger.log('Access for key-system "'+s+'" obtained');var r={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:s};this._mediaKeysList.push(r);var T=Promise.resolve().then(function(){return e.createMediaKeys()}).then(function(g){return r.mediaKeys=g,A.logger.log('Media-keys created for key-system "'+s+'"'),t._onMediaKeysCreated(),g});return T.catch(function(g){A.logger.error("Failed to create media-keys:",g)}),T},n._onMediaKeysCreated=function(){var s=this;this._mediaKeysList.forEach(function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),s._onNewMediaKeySession(e.mediaKeysSession))})},n._onNewMediaKeySession=function(s){var e=this;A.logger.log("New key-system session "+s.sessionId),s.addEventListener("message",function(t){e._onKeySessionMessage(s,t.message)},!1)},n._onKeySessionMessage=function(s,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"),s.update(t)})},n.onMediaEncrypted=function(s){var e=this;if(A.logger.log('Media is encrypted using "'+s.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:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var t=function(T){if(!e._media)return;e._attemptSetMediaKeys(T),e._generateRequestWithPreferredKeySession(s.initDataType,s.initData)};this.mediaKeysPromise.then(t).catch(t)},n._attemptSetMediaKeys=function(s){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:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}A.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},n._generateRequestWithPreferredKeySession=function(s,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:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.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:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.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:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}A.logger.log('Generating key-session request for "'+s+'" init data type'),r.mediaKeysSessionInitialized=!0,T.generateRequest(s,e).then(function(){A.logger.debug("Key-session generation succeeded")}).catch(function(g){A.logger.error("Error generating key-session request:",g),t.hls.trigger(j.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},n._createLicenseXhr=function(s,e,t){var r=new XMLHttpRequest;r.responseType="arraybuffer",r.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,r,s,e,t);var T=this._licenseXhrSetup;if(T)try{T.call(this.hls,r,s),T=void 0}catch(g){A.logger.error(g)}try{r.readyState||r.open("POST",s,!0),T&&T.call(this.hls,r,s)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return r},n._onLicenseRequestReadyStageChange=function(s,e,t,r){switch(s.readyState){case 4:if(s.status===200){this._requestLicenseFailureCount=0,A.logger.log("License request succeeded");var T=s.response,g=this._licenseResponseCallback;if(g)try{T=g.call(this.hls,s,e)}catch(E){A.logger.error(E)}r(T)}else{if(A.logger.error("License Request XHR failed ("+e+"). Status: "+s.status+" ("+s.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>S){this.hls.trigger(j.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var _=S-this._requestLicenseFailureCount+1;A.logger.warn("Retrying license request, "+_+" attempts left"),this._requestLicense(t,r)}break}},n._generateLicenseRequestChallenge=function(s,e){switch(s.mediaKeySystemDomain){case F.KeySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+s.mediaKeySystemDomain)},n._requestLicense=function(s,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:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var r=this.getLicenseServerUrl(t.mediaKeySystemDomain),T=this._createLicenseXhr(r,s,e);A.logger.log("Sending license request to URL: "+r);var g=this._generateLicenseRequestChallenge(t,s);T.send(g)}catch(_){A.logger.error("Failure requesting DRM license: "+_),this.hls.trigger(j.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},n.onMediaAttached=function(s,e){if(!this._emeEnabled)return;var t=e.media;this._media=t,t.addEventListener("encrypted",this._onMediaEncrypted)},n.onMediaDetached=function(){var s=this._media,e=this._mediaKeysList;if(!s)return;s.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 s.setMediaKeys(null)}).catch(function(){})},n.onManifestParsed=function(s,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(F.KeySystems.WIDEVINE,t,r)},O(a,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),a}();W.default=o},"./src/controller/fps-controller.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/events.ts"),I=w("./src/utils/logger.ts"),A=function(){function F(O){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=O,this.registerListeners()}var M=F.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 p=this.hls.config;if(p.capLevelOnFPSDrop){var o=m.media instanceof self.HTMLVideoElement?m.media:null;this.media=o,o&&typeof o.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),p.fpsDroppedMonitoringPeriod)}},M.checkFPS=function(S,m,p){var o=performance.now();if(m){if(this.lastTime){var a=o-this.lastTime,n=p-this.lastDroppedFrames,l=m-this.lastDecodedFrames,s=1e3*n/a,e=this.hls;if(e.trigger(j.Events.FPS_DROP,{currentDropped:n,currentDecoded:l,totalDroppedFrames:p}),s>0&&n>e.config.fpsDroppedMonitoringThreshold*l){var t=e.currentLevel;I.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=o,this.lastDroppedFrames=p,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)},F}();W.default=A},"./src/controller/fragment-finders.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"findFragmentByPDT",function(){return A}),w.d(W,"findFragmentByPTS",function(){return F}),w.d(W,"fragmentWithinToleranceTest",function(){return M}),w.d(W,"pdtWithinToleranceTest",function(){return O}),w.d(W,"findFragWithCC",function(){return S});var j=w("./src/polyfills/number.ts"),I=w("./src/utils/binary-search.ts");function A(m,p,o){if(p===null||!Array.isArray(m)||!m.length||!Object(j.isFiniteNumber)(p))return null;var a=m[0].programDateTime;if(p<(a||0))return null;var n=m[m.length-1].endProgramDateTime;if(p>=(n||0))return null;o=o||0;for(var l=0;l<m.length;++l){var s=m[l];if(O(p,o,s))return s}return null}function F(m,p,o,a){o===void 0&&(o=0),a===void 0&&(a=0);var n=null;if(m?n=p[m.sn-p[0].sn+1]||null:o===0&&p[0].start===0&&(n=p[0]),n&&M(o,a,n)===0)return n;var l=I.default.search(p,M.bind(null,o,a));return l||n}function M(m,p,o){m===void 0&&(m=0),p===void 0&&(p=0);var a=Math.min(p,o.duration+(o.deltaPTS?o.deltaPTS:0));return o.start+o.duration-a<=m?1:o.start-a>m&&o.start?-1:0}function O(m,p,o){var a=Math.min(p,o.duration+(o.deltaPTS?o.deltaPTS:0))*1e3,n=o.endProgramDateTime||0;return n-a>m}function S(m,p){return I.default.search(m,function(o){return o.cc<p?1:o.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"FragmentState",function(){return A}),w.d(W,"FragmentTracker",function(){return F});var j=w("./src/events.ts"),I=w("./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 F=function(){function S(p){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=p,this._registerListeners()}var m=S.prototype;return m._registerListeners=function(){var o=this.hls;o.on(j.Events.BUFFER_APPENDED,this.onBufferAppended,this),o.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.on(j.Events.FRAG_LOADED,this.onFragLoaded,this)},m._unregisterListeners=function(){var o=this.hls;o.off(j.Events.BUFFER_APPENDED,this.onBufferAppended,this),o.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.off(j.Events.FRAG_LOADED,this.onFragLoaded,this)},m.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},m.getAppendedFrag=function(o,a){if(a===I.PlaylistLevelType.MAIN){var n=this.activeFragment,l=this.activeParts;if(!n)return null;if(l)for(var s=l.length;s--;){var e=l[s],t=e?e.end:n.appendedPTS;if(e.start<=o&&t!==void 0&&o<=t)return s>9&&(this.activeParts=l.slice(s-9)),e}else if(n.start<=o&&n.appendedPTS!==void 0&&o<=n.appendedPTS)return n}return this.getBufferedFrag(o,a)},m.getBufferedFrag=function(o,a){for(var n=this.fragments,l=Object.keys(n),s=l.length;s--;){var e=n[l[s]];if((e==null?void 0:e.body.type)===a&&e.buffered){var t=e.body;if(t.start<=o&&o<=t.end)return t}}return null},m.detectEvictedFragments=function(o,a,n){var l=this;Object.keys(this.fragments).forEach(function(s){var e=l.fragments[s];if(!e)return;if(!e.buffered){e.body.type===n&&l.removeFragment(e.body);return}var t=e.range[o];if(!t)return;t.time.some(function(r){var T=!l.isTimeBuffered(r.startPTS,r.endPTS,a);return T&&l.removeFragment(e.body),T})})},m.detectPartialFragments=function(o){var a=this,n=this.timeRanges,l=o.frag,s=o.part;if(!n||l.sn==="initSegment")return;var e=O(l),t=this.fragments[e];if(!t)return;Object.keys(n).forEach(function(r){var T=l.elementaryStreams[r];if(!T)return;var g=n[r],_=s!==null||T.partial===!0;t.range[r]=a.getBufferedTimes(l,s,_,g)}),t.backtrack=t.loaded=null,Object.keys(t.range).length?t.buffered=!0:this.removeFragment(t.body)},m.fragBuffered=function(o){var a=O(o),n=this.fragments[a];n&&(n.backtrack=n.loaded=null,n.buffered=!0)},m.getBufferedTimes=function(o,a,n,l){for(var s={time:[],partial:n},e=a?a.start:o.start,t=a?a.end:o.end,r=o.minEndPTS||t,T=o.maxStartPTS||e,g=0;g<l.length;g++){var _=l.start(g)-this.bufferPadding,E=l.end(g)+this.bufferPadding;if(T>=_&&r<=E){s.time.push({startPTS:Math.max(e,l.start(g)),endPTS:Math.min(t,l.end(g))});break}else if(e<E&&t>_)s.partial=!0,s.time.push({startPTS:Math.max(e,l.start(g)),endPTS:Math.min(t,l.end(g))});else if(t<=_)break}return s},m.getPartialFragment=function(o){var a=null,n,l,s,e=0,t=this.bufferPadding,r=this.fragments;return Object.keys(r).forEach(function(T){var g=r[T];if(!g)return;M(g)&&(l=g.body.start-t,s=g.body.end+t,o>=l&&o<=s&&(n=Math.min(o-l,s-o),e<=n&&(a=g.body,e=n)))}),a},m.getState=function(o){var a=O(o),n=this.fragments[a];return n?n.buffered?M(n)?A.PARTIAL:A.OK:n.backtrack?A.BACKTRACKED:A.APPENDING:A.NOT_LOADED},m.backtrack=function(o,a){var n=O(o),l=this.fragments[n];if(!l||l.backtrack)return null;var s=l.backtrack=a||l.loaded;return l.loaded=null,s},m.getBacktrackData=function(o){var a=O(o),n=this.fragments[a];if(n){var l,s=n.backtrack;if(s!=null&&(l=s.payload)!==null&&l!==void 0&&l.byteLength)return s;this.removeFragment(o)}return null},m.isTimeBuffered=function(o,a,n){for(var l,s,e=0;e<n.length;e++){if(l=n.start(e)-this.bufferPadding,s=n.end(e)+this.bufferPadding,o>=l&&a<=s)return!0;if(a<=l)return!1}return!1},m.onFragLoaded=function(o,a){var n=a.frag,l=a.part;if(n.sn==="initSegment"||n.bitrateTest||l)return;var s=O(n);this.fragments[s]={body:n,loaded:a,backtrack:null,buffered:!1,range:Object.create(null)}},m.onBufferAppended=function(o,a){var n=this,l=a.frag,s=a.part,e=a.timeRanges;if(l.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=l,s){var t=this.activeParts;t||(this.activeParts=t=[]),t.push(s)}else this.activeParts=null;this.timeRanges=e,Object.keys(e).forEach(function(r){var T=e[r];if(n.detectEvictedFragments(r,T),!s)for(var g=0;g<T.length;g++)l.appendedPTS=Math.max(T.end(g),l.appendedPTS||0)})},m.onFragBuffered=function(o,a){this.detectPartialFragments(a)},m.hasFragment=function(o){var a=O(o);return!!this.fragments[a]},m.removeFragmentsInRange=function(o,a,n){var l=this;Object.keys(this.fragments).forEach(function(s){var e=l.fragments[s];if(!e)return;if(e.buffered){var t=e.body;t.type===n&&t.start<a&&t.end>o&&l.removeFragment(t)}})},m.removeFragment=function(o){var a=O(o);o.stats.loaded=0,o.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,p;return S.buffered&&(((m=S.range.video)===null||m===void 0?void 0:m.partial)||((p=S.range.audio)===null||p===void 0?void 0:p.partial))}function O(S){return S.type+"_"+S.level+"_"+S.urlId+"_"+S.sn}},"./src/controller/gap-controller.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"STALL_MINIMUM_DURATION_MS",function(){return M}),w.d(W,"MAX_START_GAP_JUMP",function(){return O}),w.d(W,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return S}),w.d(W,"SKIP_BUFFER_RANGE_START",function(){return m}),w.d(W,"default",function(){return p});var j=w("./src/utils/buffer-helper.ts"),I=w("./src/errors.ts"),A=w("./src/events.ts"),F=w("./src/utils/logger.ts"),M=250,O=2,S=.1,m=.05,p=function(){function o(n,l,s,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=n,this.media=l,this.fragmentTracker=s,this.hls=e}var a=o.prototype;return a.destroy=function(){this.hls=this.fragmentTracker=this.media=null},a.poll=function(l){var s=this.config,e=this.media,t=this.stalled,r=e.currentTime,T=e.seeking,g=this.seeking&&!T,_=!this.seeking&&T;if(this.seeking=T,r!==l){if(this.moved=!0,t!==null){if(this.stallReported){var E=self.performance.now()-t;F.logger.warn("playback not stuck anymore @"+r+", after "+Math.round(E)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((_||g)&&(this.stalled=null),e.paused||e.ended||e.playbackRate===0||!j.BufferHelper.getBuffered(e).length)return;var b=j.BufferHelper.bufferInfo(e,r,0),c=b.len>0,i=b.nextStart||0;if(!c&&!i)return;if(T){var d=b.len>O,h=!i||i-r>O&&!this.fragmentTracker.getPartialFragment(r);if(d||h)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var y,v=Math.max(i,b.start||0)-r,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,k=x==null||((y=x.details)===null||y===void 0)?void 0:y.live,R=k?x.details.targetduration*2:O;if(v>0&&v<=R){this._trySkipBufferHole(null);return}}var U=self.performance.now();if(t===null){this.stalled=U;return}var N=U-t;!T&&N>=M&&this._reportStall(b.len);var G=j.BufferHelper.bufferInfo(e,r,s.maxBufferHole);this._tryFixBufferStall(G,N)},a._tryFixBufferStall=function(l,s){var e=this.config,t=this.fragmentTracker,r=this.media,T=r.currentTime,g=t.getPartialFragment(T);if(g){var _=this._trySkipBufferHole(g);if(_)return}l.len>e.maxBufferHole&&s>e.highBufferWatchdogPeriod*1e3&&(F.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},a._reportStall=function(l){var s=this.hls,e=this.media,t=this.stallReported;t||(this.stallReported=!0,F.logger.warn("Playback stalling at @"+e.currentTime+" due to low buffer (buffer="+l+")"),s.trigger(A.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:l}))},a._trySkipBufferHole=function(l){for(var s=this.config,e=this.hls,t=this.media,r=t.currentTime,T=0,g=j.BufferHelper.getBuffered(t),_=0;_<g.length;_++){var E=g.start(_);if(r+s.maxBufferHole>=T&&r<E){var b=Math.max(E+m,t.currentTime+S);return F.logger.warn("skipping hole, adjusting currentTime from "+r+" to "+b),this.moved=!0,this.stalled=null,t.currentTime=b,l&&e.trigger(A.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+r+" to "+b,frag:l}),b}T=g.end(_)}return 0},a._tryNudgeBuffer=function(){var l=this.config,s=this.hls,e=this.media,t=e.currentTime,r=(this.nudgeRetry||0)+1;if(this.nudgeRetry=r,r<l.nudgeMaxRetry){var T=t+r*l.nudgeOffset;F.logger.warn("Nudging 'currentTime' from "+t+" to "+T),e.currentTime=T,s.trigger(A.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else F.logger.error("Playhead still not moving while enough data buffered @"+t+" after "+l.nudgeMaxRetry+" nudges"),s.trigger(A.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},o}()},"./src/controller/id3-track-controller.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/events.ts"),I=w("./src/utils/texttrack-utils.ts"),A=w("./src/demux/id3.ts"),F=.25,M=function(){function O(m){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=m,this._registerListeners()}var S=O.prototype;return S.destroy=function(){this._unregisterListeners()},S._registerListeners=function(){var p=this.hls;p.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(j.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var p=this.hls;p.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(j.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.onMediaAttached=function(p,o){this.media=o.media},S.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},S.getID3Track=function(p){if(!this.media)return;for(var o=0;o<p.length;o++){var a=p[o];if(a.kind==="metadata"&&a.label==="id3")return Object(I.sendAddTrackEvent)(a,this.media),a}return this.media.addTextTrack("metadata","id3")},S.onFragParsingMetadata=function(p,o){if(!this.media)return;var a=o.frag,n=o.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var l=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<n.length;s++){var e=A.getID3Frames(n[s].data);if(e){var t=n[s].pts,r=s<n.length-1?n[s+1].pts:a.end,T=r-t;T<=0&&(r=t+F);for(var g=0;g<e.length;g++){var _=e[g];if(!A.isTimeStampFrame(_)){var E=new l(t,r,"");E.value=_,this.id3Track.addCue(E)}}}}},S.onBufferFlushing=function(p,o){var a=o.startOffset,n=o.endOffset,l=o.type;if(!l||l==="audio"){var s=this.id3Track;s&&Object(I.removeCuesInRange)(s,a,n)}},O}();W.default=M},"./src/controller/latency-controller.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return O});var j=w("./src/errors.ts"),I=w("./src/events.ts"),A=w("./src/utils/logger.ts");function F(S,m){for(var p=0;p<m.length;p++){var o=m[p];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(S,o.key,o)}}function M(S,m,p){return m&&F(S.prototype,m),p&&F(S,p),S}var O=function(){function S(p){var o=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 o.timeupdate()},this.hls=p,this.config=p.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(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(I.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(I.Events.ERROR,this.onError)},m.onMediaAttached=function(o,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(o,a){var n=a.details;this.levelDetails=n,n.advanced&&this.timeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},m.onError=function(o,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 o=this.media,a=this.levelDetails;if(!o||!a)return;this.currentTime=o.currentTime;var n=this.computeLatency();if(n===null)return;this._latency=n;var l=this.config,s=l.lowLatencyMode,e=l.maxLiveSyncPlaybackRate;if(!s||e===1)return;var t=this.targetLatency;if(t===null)return;var r=n-t,T=Math.min(this.maxLatency,t+a.targetduration),g=r<T;if(a.live&&g&&r>.05&&this.forwardBufferLength>1){var _=Math.min(2,Math.max(1,e)),E=Math.round(2/(1+Math.exp(-.75*r-this.edgeStalled))*20)/20;o.playbackRate=Math.min(_,Math.max(1,E))}else o.playbackRate!==1&&o.playbackRate!==0&&(o.playbackRate=1)},m.estimateLiveEdge=function(){var o=this.levelDetails;return o===null?null:o.edge+o.age},m.computeLatency=function(){var o=this.estimateLiveEdge();return o===null?null:o-this.currentTime},M(S,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var o=this.config,a=this.levelDetails;return o.liveMaxLatencyDuration!==void 0?o.liveMaxLatencyDuration:a?o.liveMaxLatencyDurationCount*a.targetduration:0}},{key:"targetLatency",get:function(){var o=this.levelDetails;if(o===null)return null;var a=o.holdBack,n=o.partHoldBack,l=o.targetduration,s=this.config,e=s.liveSyncDuration,t=s.liveSyncDurationCount,r=s.lowLatencyMode,T=this.hls.userConfig,g=r&&n||a;(T.liveSyncDuration||T.liveSyncDurationCount||g===0)&&(g=e!==void 0?e:t*l);var _=l,E=1;return g+Math.min(this.stallCount*E,_)}},{key:"liveSyncPosition",get:function(){var o=this.estimateLiveEdge(),a=this.targetLatency,n=this.levelDetails;if(o===null||a===null||n===null)return null;var l=n.edge,s=o-a-this.edgeStalled,e=l-n.totalduration,t=l-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(e,s),t)}},{key:"drift",get:function(){var o=this.levelDetails;return o===null?1:o.drift}},{key:"edgeStalled",get:function(){var o=this.levelDetails;if(o===null)return 0;var a=(this.config.lowLatencyMode&&o.partTarget||o.targetduration)*3;return Math.max(o.age-a,0)}},{key:"forwardBufferLength",get:function(){var o=this.media,a=this.levelDetails;if(!o||!a)return 0;var n=o.buffered.length;return n?o.buffered.end(n-1):a.edge-this.currentTime}}]),S}()},"./src/controller/level-controller.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return s});var j=w("./src/types/level.ts"),I=w("./src/events.ts"),A=w("./src/errors.ts"),F=w("./src/utils/codecs.ts"),M=w("./src/controller/level-helper.ts"),O=w("./src/controller/base-playlist-controller.ts"),S=w("./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 p(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 o(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),e}function a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)}function n(e,t){return n=Object.setPrototypeOf||function(T,g){return T.__proto__=g,T},n(e,t)}var l=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),s=function(e){a(t,e);function t(T){var g;return g=e.call(this,T,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var r=t.prototype;return r._registerListeners=function(){var g=this.hls;g.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(I.Events.ERROR,this.onError,this)},r._unregisterListeners=function(){var g=this.hls;g.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(I.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 g=this._levels;g.forEach(function(_){_.loadError=0}),e.prototype.startLoad.call(this)},r.onManifestLoaded=function(g,_){var E=[],b=[],c=[],i,d={},h,y=!1,v=!1,x=!1;if(_.levels.forEach(function(N){var G=N.attrs;y=y||!!(N.width&&N.height),v=v||!!N.videoCodec,x=x||!!N.audioCodec,l&&N.audioCodec&&N.audioCodec.indexOf("mp4a.40.34")!==-1&&(N.audioCodec=void 0);var L=N.bitrate+"-"+N.attrs.RESOLUTION+"-"+N.attrs.CODECS;h=d[L],h?h.url.push(N.url):(h=new j.Level(N),d[L]=h,E.push(h)),G&&(G.AUDIO&&Object(M.addGroupId)(h,"audio",G.AUDIO),G.SUBTITLES&&Object(M.addGroupId)(h,"text",G.SUBTITLES))}),(y||v)&&x&&(E=E.filter(function(N){var G=N.videoCodec,L=N.width,H=N.height;return!!G||!!(L&&H)})),E=E.filter(function(N){var G=N.audioCodec,L=N.videoCodec;return(!G||Object(F.isCodecSupportedInMp4)(G,"audio"))&&(!L||Object(F.isCodecSupportedInMp4)(L,"video"))}),_.audioTracks&&(b=_.audioTracks.filter(function(N){return!N.audioCodec||Object(F.isCodecSupportedInMp4)(N.audioCodec,"audio")}),Object(M.assignTrackIdsByGroup)(b)),_.subtitles&&(c=_.subtitles,Object(M.assignTrackIdsByGroup)(c)),E.length>0){i=E[0].bitrate,E.sort(function(N,G){return N.bitrate-G.bitrate}),this._levels=E;for(var k=0;k<E.length;k++)if(E[k].bitrate===i){this._firstLevel=k,this.log("manifest loaded, "+E.length+" level(s) found, first bitrate: "+i);break}var R=x&&!v,U={levels:E,audioTracks:b,subtitleTracks:c,firstLevel:this._firstLevel,stats:_.stats,audio:x,video:v,altAudio:!R&&b.some(function(N){return!!N.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,U),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:_.url,reason:"no level with compatible codecs found in manifest"})},r.onError=function(g,_){if(e.prototype.onError.call(this,g,_),_.fatal)return;var E=_.context,b=this._levels[this.currentLevelIndex];if(E&&(E.type===S.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&E.groupId===b.audioGroupIds[b.urlId]||E.type===S.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&E.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var c=!1,i=!0,d;switch(_.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(_.frag){var h=this._levels[_.frag.level];h?(h.fragmentError++,h.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=_.frag.level)):d=_.frag.level}break;case A.ErrorDetails.LEVEL_LOAD_ERROR:case A.ErrorDetails.LEVEL_LOAD_TIMEOUT:E&&(E.deliveryDirectives&&(i=!1),d=E.level),c=!0;break;case A.ErrorDetails.REMUX_ALLOC_ERROR:d=_.level,c=!0;break}d!==void 0&&this.recoverLevel(_,d,c,i)},r.recoverLevel=function(g,_,E,b){var c=g.details,i=this._levels[_];if(i.loadError++,E){var d=this.retryLoadingOrFail(g);if(d)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var h=i.url.length;if(h>1&&i.loadError<h)g.levelRetry=!0,this.redundantFailover(_);else if(this.manualLevelIndex===-1){var y=_===0?this._levels.length-1:_-1;this.currentLevelIndex!==y&&this._levels[y].loadError===0&&(this.warn(c+": switch to "+y),g.levelRetry=!0,this.hls.nextAutoLevel=y)}}},r.redundantFailover=function(g){var _=this._levels[g],E=_.url.length;if(E>1){var b=(_.urlId+1)%E;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(c){c.urlId=b}),this.level=g}},r.onFragLoaded=function(g,_){var E=_.frag;if(E!==void 0&&E.type===S.PlaylistLevelType.MAIN){var b=this._levels[E.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},r.onLevelLoaded=function(g,_){var E,b=_.level,c=_.details,i=this._levels[b];if(!i){var d;this.warn("Invalid level index "+b),(d=_.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(c.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(i.fragmentError===0&&(i.loadError=0,this.retryCount=0),this.playlistLoaded(b,_,i.details)):(E=_.deliveryDirectives)!==null&&E!==void 0&&E.skip&&(c.deltaUpdateFailed=!0)},r.onAudioTrackSwitched=function(g,_){var E=this.hls.levels[this.currentLevelIndex];if(!E)return;if(E.audioGroupIds){for(var b=-1,c=this.hls.audioTracks[_.id].groupId,i=0;i<E.audioGroupIds.length;i++)if(E.audioGroupIds[i]===c){b=i;break}b!==E.urlId&&(E.urlId=b,this.startLoad())}},r.loadPlaylist=function(g){var _=this.currentLevelIndex,E=this._levels[_];if(this.canLoad&&E&&E.url.length>0){var b=E.urlId,c=E.url[b];if(g)try{c=g.addDirectives(c)}catch(i){this.warn("Could not construct new URL with HLS Delivery Directives: "+i)}this.log("Attempt loading level index "+_+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+b+" "+c),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:c,level:_,id:b,deliveryDirectives:g||null})}},r.removeLevel=function(g,_){var E=function(i,d){return d!==_},b=this._levels.filter(function(c,i){return i!==g?!0:c.url.length>1&&_!==void 0?(c.url=c.url.filter(E),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(E)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(E)),c.urlId=0,!0):!1}).map(function(c,i){var d=c.details;return d!=null&&d.fragments&&d.fragments.forEach(function(h){h.level=i}),c});this._levels=b,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:b})},o(t,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var _,E=this._levels;if(E.length===0)return;if(this.currentLevelIndex===g&&(_=E[g])!==null&&_!==void 0&&_.details)return;if(g<0||g>=E.length){var b=g<0;if(this.hls.trigger(I.Events.ERROR,{type:A.ErrorTypes.OTHER_ERROR,details:A.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:b,reason:"invalid level idx"}),b)return;g=Math.min(g,E.length-1)}this.clearTimer();var c=this.currentLevelIndex,i=E[c],d=E[g];this.log("switching to level "+g+" from "+c),this.currentLevelIndex=g;var h=m({},d,{level:g,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete h._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,h);var y=d.details;if(!y||y.live){var v=this.switchParams(d.uri,i==null?void 0:i.details);this.loadPlaylist(v)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),t}(O.default)},"./src/controller/level-helper.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"addGroupId",function(){return A}),w.d(W,"assignTrackIdsByGroup",function(){return F}),w.d(W,"updatePTS",function(){return M}),w.d(W,"updateFragPTSDTS",function(){return S}),w.d(W,"mergeDetails",function(){return m}),w.d(W,"mapPartIntersection",function(){return p}),w.d(W,"mapFragmentIntersection",function(){return o}),w.d(W,"adjustSliding",function(){return a}),w.d(W,"addSliding",function(){return n}),w.d(W,"computeReloadInterval",function(){return l}),w.d(W,"getFragmentWithSN",function(){return s}),w.d(W,"getPartWith",function(){return e});var j=w("./src/polyfills/number.ts"),I=w("./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 F(t){var r={};t.forEach(function(T){var g=T.groupId||"";T.id=r[g]=r[g]||0,r[g]++})}function M(t,r,T){var g=t[r],_=t[T];O(g,_)}function O(t,r){var T=r.startPTS;if(Object(j.isFiniteNumber)(T)){var g=0,_;r.sn>t.sn?(g=T-t.start,_=t):(g=t.start-T,_=r),_.duration!==g&&(_.duration=g)}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,g,_,E){var b=g-T;b<=0&&(I.logger.warn("Fragment should have a positive duration",r),g=T+r.duration,E=_+r.duration);var c=T,i=g,d=r.startPTS,h=r.endPTS;if(Object(j.isFiniteNumber)(d)){var y=Math.abs(d-T);Object(j.isFiniteNumber)(r.deltaPTS)?r.deltaPTS=Math.max(y,r.deltaPTS):r.deltaPTS=y,c=Math.max(T,d),T=Math.min(T,d),_=Math.min(_,r.startDTS),i=Math.min(g,h),g=Math.max(g,h),E=Math.max(E,r.endDTS)}r.duration=g-T;var v=T-r.start;r.appendedPTS=g,r.start=r.startPTS=T,r.maxStartPTS=c,r.startDTS=_,r.endPTS=g,r.minEndPTS=i,r.endDTS=E;var x=r.sn;if(!t||x<t.startSN||x>t.endSN)return 0;var k,R=x-t.startSN,U=t.fragments;for(U[R]=r,k=R;k>0;k--)O(U[k],U[k-1]);for(k=R;k<U.length-1;k++)O(U[k],U[k+1]);return t.fragmentHint&&O(U[U.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,v}function m(t,r){for(var T=null,g=t.fragments,_=g.length-1;_>=0;_--){var E=g[_].initSegment;if(E){T=E;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var b=0,c;if(o(t,r,function(k,R){k.relurl&&(b=k.cc-R.cc),Object(j.isFiniteNumber)(k.startPTS)&&Object(j.isFiniteNumber)(k.endPTS)&&(R.start=R.startPTS=k.startPTS,R.startDTS=k.startDTS,R.appendedPTS=k.appendedPTS,R.maxStartPTS=k.maxStartPTS,R.endPTS=k.endPTS,R.endDTS=k.endDTS,R.minEndPTS=k.minEndPTS,R.duration=k.endPTS-k.startPTS,R.duration&&(c=R),r.PTSKnown=r.alignedSliding=!0),R.elementaryStreams=k.elementaryStreams,R.loader=k.loader,R.stats=k.stats,R.urlId=k.urlId,k.initSegment&&(R.initSegment=k.initSegment,T=k.initSegment)}),T){var i=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments;i.forEach(function(k){var R;(!k.initSegment||k.initSegment.relurl===((R=T)===null||R===void 0?void 0:R.relurl))&&(k.initSegment=T)})}if(r.skippedSegments&&(r.deltaUpdateFailed=r.fragments.some(function(k){return!k}),r.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=r.skippedSegments;d--;)r.fragments.shift();r.startSN=r.fragments[0].sn,r.startCC=r.fragments[0].cc}var h=r.fragments;if(b){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var y=0;y<h.length;y++)h[y].cc+=b}r.skippedSegments&&(r.startCC=r.fragments[0].cc),p(t.partList,r.partList,function(k,R){R.elementaryStreams=k.elementaryStreams,R.stats=k.stats}),c?S(r,c,c.startPTS,c.endPTS,c.startDTS,c.endDTS):a(t,r),h.length&&(r.totalduration=r.edge-h[0].start),r.driftStartTime=t.driftStartTime,r.driftStart=t.driftStart;var v=r.advancedDateTime;if(r.advanced&&v){var x=r.edge;r.driftStart||(r.driftStartTime=v,r.driftStart=x),r.driftEndTime=v,r.driftEnd=x}else r.driftEndTime=t.driftEndTime,r.driftEnd=t.driftEnd,r.advancedDateTime=t.advancedDateTime}function p(t,r,T){if(t&&r)for(var g=0,_=0,E=t.length;_<=E;_++){var b=t[_],c=r[_+g];b&&c&&b.index===c.index&&b.fragment.sn===c.fragment.sn?T(b,c):g--}}function o(t,r,T){for(var g=r.skippedSegments,_=Math.max(t.startSN,r.startSN)-r.startSN,E=(t.fragmentHint?1:0)+(g?r.endSN:Math.min(t.endSN,r.endSN))-r.startSN,b=r.startSN-t.startSN,c=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments,i=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,d=_;d<=E;d++){var h=i[b+d],y=c[d];g&&!y&&d<g&&(y=r.fragments[d]=h),h&&y&&T(h,y)}}function a(t,r){var T=r.startSN+r.skippedSegments-t.startSN,g=t.fragments;if(T<0||T>=g.length)return;n(r,g[T].start)}function n(t,r){if(r){for(var T=t.fragments,g=t.skippedSegments;g<T.length;g++)T[g].start+=r;t.fragmentHint&&(t.fragmentHint.start+=r)}}function l(t,r){var T=1e3*t.levelTargetDuration,g=T/2,_=t.age,E=_>0&&_<T*3,b=r.loading.end-r.loading.start,c,i=t.availabilityDelay;if(t.updated===!1)if(E){var d=333*t.misses;c=Math.max(Math.min(g,b*2),d),t.availabilityDelay=(t.availabilityDelay||0)+c}else c=g;else E?(i=Math.min(i||T/2,_),t.availabilityDelay=i,c=i+T-_):c=T-b;return Math.round(c)}function s(t,r,T){if(!t||!t.details)return null;var g=t.details,_=g.fragments[r-g.startSN];return _||(_=g.fragmentHint,_&&_.sn===r?_:r<g.startSN&&T&&T.sn===r?T:null)}function e(t,r,T){if(!t||!t.details)return null;var g=t.details.partList;if(g)for(var _=g.length;_--;){var E=g[_];if(E.index===T&&E.fragment.sn===r)return E}return null}},"./src/controller/stream-controller.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return g});var j=w("./src/polyfills/number.ts"),I=w("./src/controller/base-stream-controller.ts"),A=w("./src/is-supported.ts"),F=w("./src/events.ts"),M=w("./src/utils/buffer-helper.ts"),O=w("./src/controller/fragment-tracker.ts"),S=w("./src/types/loader.ts"),m=w("./src/loader/fragment.ts"),p=w("./src/demux/transmuxer-interface.ts"),o=w("./src/types/transmuxer.ts"),a=w("./src/controller/gap-controller.ts"),n=w("./src/errors.ts"),l=w("./src/utils/logger.ts");function s(_,E){for(var b=0;b<E.length;b++){var c=E[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(_,c.key,c)}}function e(_,E,b){return E&&s(_.prototype,E),b&&s(_,b),_}function t(_,E){_.prototype=Object.create(E.prototype),_.prototype.constructor=_,r(_,E)}function r(_,E){return r=Object.setPrototypeOf||function(c,i){return c.__proto__=i,c},r(_,E)}var T=100,g=function(_){t(E,_);function E(c,i){var d;return d=_.call(this,c,i,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var b=E.prototype;return b._registerListeners=function(){var i=this.hls;i.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.on(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),i.on(F.Events.ERROR,this.onError,this),i.on(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),i.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),i.on(F.Events.BUFFER_CREATED,this.onBufferCreated,this),i.on(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),i.on(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),i.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var i=this.hls;i.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.off(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),i.off(F.Events.ERROR,this.onError,this),i.off(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),i.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),i.off(F.Events.BUFFER_CREATED,this.onBufferCreated,this),i.off(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),i.off(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),i.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(i){if(this.levels){var d=this.lastCurrentTime,h=this.hls;if(this.stopLoad(),this.setInterval(T),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var y=h.startLevel;y===-1&&(h.config.testBandwidth?(y=0,this.bitrateTest=!0):y=h.nextAutoLevel),this.level=h.nextLoadLevel=y,this.loadedmetadata=!1}d>0&&i===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),i=d),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=i,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,_.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var i,d=this.levels,h=this.level,y=d==null||((i=d[h])===null||i===void 0)?void 0:i.details;if(y&&(!y.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(y))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var v,x=self.performance.now(),k=this.retryDate;(!k||x>=k||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){_.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var i,d,h=this.hls,y=this.levelLastLoaded,v=this.levels,x=this.media,k=h.config,R=h.nextLoadLevel;if(y===null||!x&&(this.startFragRequested||!k.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[R])return;var U=v[R];this.level=h.nextLoadLevel=R;var N=U.details;if(!N||this.state===I.State.WAITING_LEVEL||N.live&&this.levelLastLoaded!==R){this.state=I.State.WAITING_LEVEL;return}var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,S.PlaylistLevelType.MAIN);if(G===null)return;var L=G.len,H=this.getMaxBufferLength(U.maxBitrate);if(L>=H)return;if(this._streamEnded(G,N)){var V={};this.altAudio&&(V.type="video"),this.hls.trigger(F.Events.BUFFER_EOS,V),this.state=I.State.ENDED;return}var $=G.end,q=this.getNextFragment($,N);if(this.couldBacktrack&&!this.fragPrevious&&q&&q.sn!=="initSegment"){var he=q.sn-N.startSN;he>1&&(q=N.fragments[he-1],this.fragmentTracker.removeFragment(q))}if(q&&this.fragmentTracker.getState(q)===O.FragmentState.OK&&this.nextLoadPosition>$){var ae=this.audioOnly&&!this.altAudio?m.ElementaryStreamTypes.AUDIO:m.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,ae,S.PlaylistLevelType.MAIN),q=this.getNextFragment(this.nextLoadPosition,N)}if(!q)return;q.initSegment&&!q.initSegment.data&&!this.bitrateTest&&(q=q.initSegment),((i=q.decryptdata)===null||i===void 0?void 0:i.keyFormat)==="identity"&&!((d=q.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(q,N):this.loadFragment(q,N,$)},b.loadFragment=function(i,d,h){var y,v=this.fragmentTracker.getState(i);if(this.fragCurrent=i,v===O.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(i);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else v=O.FragmentState.NOT_LOADED}v===O.FragmentState.NOT_LOADED||v===O.FragmentState.PARTIAL?i.sn==="initSegment"?this._loadInitSegment(i):this.bitrateTest?(i.bitrateTest=!0,this.log("Fragment "+i.sn+" of level "+i.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(i)):(this.startFragRequested=!0,_.prototype.loadFragment.call(this,i,d,h)):v===O.FragmentState.APPENDING?this.reduceMaxBufferLength(i.duration)&&this.fragmentTracker.removeFragment(i):((y=this.media)===null||y===void 0?void 0:y.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(i){var d=this.fragmentTracker.getAppendedFrag(i,S.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},b.getBufferedFrag=function(i){return this.fragmentTracker.getBufferedFrag(i,S.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(i){return i?this.getBufferedFrag(i.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var i=this.levels,d=this.media;if(d!=null&&d.readyState){var h,y=this.getAppendedFrag(d.currentTime);if(y&&y.start>1&&this.flushMainBuffer(0,y.start-1),!d.paused&&i){var v=this.hls.nextLoadLevel,x=i[v],k=this.fragLastKbps;k&&this.fragCurrent?h=this.fragCurrent.duration*x.maxBitrate/(1e3*k)+1:h=0}else h=0;var R=this.getBufferedFrag(d.currentTime+h);if(R){var U=this.followingBufferedFrag(R);if(U){this.abortCurrentFrag();var N=U.maxStartPTS?U.maxStartPTS:U.start,G=U.duration,L=Math.max(R.end,N+Math.min(Math.max(G-this.config.maxFragLookUpTolerance,G*.5),G*.75));this.flushMainBuffer(L,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var i=this.fragCurrent;this.fragCurrent=null,i!=null&&i.loader&&i.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(i,d){_.prototype.flushMainBuffer.call(this,i,d,this.altAudio?"video":null)},b.onMediaAttached=function(i,d){_.prototype.onMediaAttached.call(this,i,d);var h=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),h.addEventListener("playing",this.onvplaying),h.addEventListener("seeked",this.onvseeked),this.gapController=new a.default(this.config,h,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var i=this.media;i&&(i.removeEventListener("playing",this.onvplaying),i.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),_.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var i=this.media,d=i?i.currentTime:null;Object(j.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(F.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(i,d){var h=!1,y=!1,v;d.levels.forEach(function(x){v=x.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(h=!0),v.indexOf("mp4a.40.5")!==-1&&(y=!0))}),this.audioCodecSwitch=h&&y&&!Object(A.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},b.onLevelLoading=function(i,d){var h=this.levels;if(!h||this.state!==I.State.IDLE)return;var y=h[d.level];(!y.details||y.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(y.details))&&(this.state=I.State.WAITING_LEVEL)},b.onLevelLoaded=function(i,d){var h,y=this.levels,v=d.level,x=d.details,k=x.totalduration;if(!y){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+k);var R=this.fragCurrent;R&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(R.level!==d.level&&R.loader&&(this.state=I.State.IDLE,R.loader.abort()));var U=y[v],N=0;if(x.live||(h=U.details)!==null&&h!==void 0&&h.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;N=this.alignPlaylists(x,U.details)}if(U.details=x,this.levelLastLoaded=v,this.hls.trigger(F.Events.LEVEL_UPDATED,{details:x,level:v}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=I.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,N),this.tick()},b._handleFragmentLoadProgress=function(i){var d,h=i.frag,y=i.part,v=i.payload,x=this.levels;if(!x){this.warn("Levels were reset while fragment load was in progress. Fragment "+h.sn+" of level "+h.level+" will not be buffered");return}var k=x[h.level],R=k.details;if(!R){this.warn("Dropping fragment "+h.sn+" of level "+h.level+" after level details were reset");return}var U=k.videoCodec,N=R.PTSKnown||!R.live,G=(d=h.initSegment)===null||d===void 0?void 0:d.data,L=this._getAudioCodec(k),H=this.transmuxer=this.transmuxer||new p.default(this.hls,S.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),V=y?y.index:-1,$=V!==-1,q=new o.ChunkMetadata(h.level,h.sn,h.stats.chunkCount,v.byteLength,V,$),he=this.initPTS[h.cc];H.push(v,G,L,U,h,y,R.totalduration,N,q,he)},b.onAudioTrackSwitching=function(i,d){var h=this.altAudio,y=!!d.url,v=d.id;if(!y){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var 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 k=this.hls;h&&k.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),k.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:v})}},b.onAudioTrackSwitched=function(i,d){var h=d.id,y=!!this.hls.audioTracks[h].url;if(y){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=y,this.tick()},b.onBufferCreated=function(i,d){var h=d.tracks,y,v,x=!1;for(var k in h){var R=h[k];if(R.id==="main"){if(v=k,y=R,k==="video"){var U=h[k];U&&(this.videoBuffer=U.buffer)}}else x=!0}x&&y?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=y.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(i,d){var h=d.frag,y=d.part;if(h&&h.type!==S.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(h)){this.warn("Fragment "+h.sn+(y?" p: "+y.index:"")+" of level "+h.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var v=y?y.stats:h.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),h.sn!=="initSegment"&&(this.fragPrevious=h),this.fragBufferedComplete(h,y)},b.onError=function(i,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.MAIN,d);break;case n.ErrorDetails.LEVEL_LOAD_ERROR:case n.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=I.State.ERROR):!d.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case n.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var h=!0,y=this.getFwdBufferInfo(this.media,S.PlaylistLevelType.MAIN);y&&y.len>.5&&(h=!this.reduceMaxBufferLength(y.len)),h&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var i=this.media,d=this.gapController;if(!i||!d||!i.readyState)return;var h=M.BufferHelper.getBuffered(i);!this.loadedmetadata&&h.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=i.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(i,d){var h=d.type;if(h!==m.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var y=(h===m.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(y,h,S.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(i,d){this.levels=d.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var i=this.media,d=i.currentTime,h=this.startPosition;if(h>=0&&d<h){if(i.seeking){l.logger.log("could not seek to "+h+", already seeking at "+d);return}var y=M.BufferHelper.getBuffered(i),v=y.length?y.start(0):0,x=v-h;x>0&&(x<this.config.maxBufferHole||x<this.config.maxFragLookUpTolerance)&&(l.logger.log("adjusting start position by "+x+" to match buffer start"),h+=x,this.startPosition=h),this.log("seek to target start position "+h+" from current time "+d),i.currentTime=h}},b._getAudioCodec=function(i){var d=this.config.defaultAudioCodec||i.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},b._loadBitrateTestFrag=function(i){var d=this;this._doFragLoad(i).then(function(h){var y=d.hls;if(!h||y.nextLoadLevel||d.fragContextChanged(i))return;d.fragLoadError=0,d.state=I.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var v=i.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),y.trigger(F.Events.FRAG_LOADED,h)})},b._handleTransmuxComplete=function(i){var d,h="main",y=this.hls,v=i.remuxResult,x=i.chunkMeta,k=this.getCurrentContext(x);if(!k){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 R=k.frag,U=k.part,N=k.level,G=v.video,L=v.text,H=v.id3,V=v.initSegment,$=this.altAudio?void 0:v.audio;if(this.fragContextChanged(R))return;if(this.state=I.State.PARSING,V){V.tracks&&(this._bufferInitSegment(N,V.tracks,R,x),y.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:R,id:h,tracks:V.tracks}));var q=V.initPTS,he=V.timescale;Object(j.isFiniteNumber)(q)&&(this.initPTS[R.cc]=q,y.trigger(F.Events.INIT_PTS_FOUND,{frag:R,id:h,initPTS:q,timescale:he}))}if(G&&v.independent!==!1){if(N.details){var ae=G.startPTS,oe=G.endPTS,ue=G.startDTS,de=G.endDTS;if(U)U.elementaryStreams[G.type]={startPTS:ae,endPTS:oe,startDTS:ue,endDTS:de};else if(G.firstKeyFrame&&G.independent&&(this.couldBacktrack=!0),G.dropped&&G.independent){var ie=this.getLoadPosition()+this.config.maxBufferHole;if(ie<ae){this.backtrack(R);return}R.setElementaryStreamInfo(G.type,R.start,oe,R.start,de,!0)}R.setElementaryStreamInfo(G.type,ae,oe,ue,de),this.bufferFragmentData(G,R,U,x)}}else if(v.independent===!1){this.backtrack(R);return}if($){var X=$.startPTS,Se=$.endPTS,Ie=$.startDTS,Ae=$.endDTS;U&&(U.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:X,endPTS:Se,startDTS:Ie,endDTS:Ae}),R.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,X,Se,Ie,Ae),this.bufferFragmentData($,R,U,x)}if(H!=null&&(d=H.samples)!==null&&d!==void 0&&d.length){var je={frag:R,id:h,samples:H.samples};y.trigger(F.Events.FRAG_PARSING_METADATA,je)}if(L){var He={frag:R,id:h,samples:L.samples};y.trigger(F.Events.FRAG_PARSING_USERDATA,He)}},b._bufferInitSegment=function(i,d,h,y){var v=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var x=d.audio,k=d.video,R=d.audiovideo;if(x){var U=i.audioCodec,N=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(U&&(U.indexOf("mp4a.40.5")!==-1?U="mp4a.40.2":U="mp4a.40.5"),x.metadata.channelCount!==1&&N.indexOf("firefox")===-1&&(U="mp4a.40.5")),N.indexOf("android")!==-1&&x.container!=="audio/mpeg"&&(U="mp4a.40.2",this.log("Android: force audio codec to "+U)),i.audioCodec&&i.audioCodec!==U&&this.log('Swapping manifest audio codec "'+i.audioCodec+'" for "'+U+'"'),x.levelCodec=U,x.id="main",this.log("Init audio buffer, container:"+x.container+", codecs[selected/level/parsed]=["+(U||"")+"/"+(i.audioCodec||"")+"/"+x.codec+"]")}k&&(k.levelCodec=i.videoCodec,k.id="main",this.log("Init video buffer, container:"+k.container+", codecs[level/parsed]=["+(i.videoCodec||"")+"/"+k.codec+"]")),R&&this.log("Init audiovideo buffer, container:"+R.container+", codecs[level/parsed]=["+(i.attrs.CODECS||"")+"/"+R.codec+"]"),this.hls.trigger(F.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(G){var L=d[G],H=L.initSegment;H!=null&&H.byteLength&&v.hls.trigger(F.Events.BUFFER_APPENDING,{type:G,data:H,frag:h,part:null,chunkMeta:y,parent:h.type})}),this.tick()},b.backtrack=function(i){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(i);var d=this.fragmentTracker.backtrack(i);this.fragPrevious=null,this.nextLoadPosition=i.start,d?this.resetFragmentLoading(i):this.state=I.State.BACKTRACKING},b.checkFragmentChanged=function(){var i=this.media,d=null;if(i&&i.readyState>1&&i.seeking===!1){var h=i.currentTime;if(M.BufferHelper.isBuffered(i,h)?d=this.getAppendedFrag(h):M.BufferHelper.isBuffered(i,h+.1)&&(d=this.getAppendedFrag(h+.1)),d){var y=this.fragPlaying,v=d.level;(!y||d.sn!==y.sn||y.level!==v||d.urlId!==y.urlId)&&(this.hls.trigger(F.Events.FRAG_CHANGED,{frag:d}),(!y||y.level!==v)&&this.hls.trigger(F.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=d)}}},e(E,[{key:"nextLevel",get:function(){var i=this.nextBufferedFrag;return i?i.level:-1}},{key:"currentLevel",get:function(){var i=this.media;if(i){var d=this.getAppendedFrag(i.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var i=this.media;if(i){var d=this.getAppendedFrag(i.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),E}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"SubtitleStreamController",function(){return t});var j=w("./src/events.ts"),I=w("./src/utils/logger.ts"),A=w("./src/utils/buffer-helper.ts"),F=w("./src/controller/fragment-finders.ts"),M=w("./src/utils/discontinuities.ts"),O=w("./src/controller/level-helper.ts"),S=w("./src/controller/fragment-tracker.ts"),m=w("./src/controller/base-stream-controller.ts"),p=w("./src/types/loader.ts"),o=w("./src/types/level.ts");function a(r,T){for(var g=0;g<T.length;g++){var _=T[g];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(r,_.key,_)}}function n(r,T,g){return T&&a(r.prototype,T),g&&a(r,g),r}function l(r,T){r.prototype=Object.create(T.prototype),r.prototype.constructor=r,s(r,T)}function s(r,T){return s=Object.setPrototypeOf||function(_,E){return _.__proto__=E,_},s(r,T)}var e=500,t=function(r){l(T,r);function T(_,E){var b;return b=r.call(this,_,E,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var g=T.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._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)},g._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)},g.startLoad=function(){this.stopLoad(),this.state=m.State.IDLE,this.setInterval(e),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(E,b){this.mainDetails=b.details},g.onSubtitleFragProcessed=function(E,b){var c=b.frag,i=b.success;if(this.fragPrevious=c,this.state=m.State.IDLE,!i)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var h,y=c.start,v=0;v<d.length;v++)if(y>=d[v].start&&y<=d[v].end){h=d[v];break}var x=c.start+c.duration;h?h.end=x:(h={start:y,end:x},d.push(h)),this.fragmentTracker.fragBuffered(c)},g.onBufferFlushing=function(E,b){var c=b.startOffset,i=b.endOffset;if(c===0&&i!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,h=this.levels;if(!h.length||!h[d]||!h[d].details)return;var y=h[d].details,v=y.targetduration,x=i-v;if(x<=0)return;b.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(k){for(var R=0;R<k.length;){if(k[R].end<=x){k.shift();continue}else if(k[R].start<x)k[R].start=x;else break;R++}}),this.fragmentTracker.removeFragmentsInRange(c,x,p.PlaylistLevelType.SUBTITLE)}},g.onError=function(E,b){var c,i=b.frag;if(!i||i.type!==p.PlaylistLevelType.SUBTITLE)return;(c=this.fragCurrent)!==null&&c!==void 0&&c.loader&&this.fragCurrent.loader.abort(),this.state=m.State.IDLE},g.onSubtitleTracksUpdated=function(E,b){var c=this,i=b.subtitleTracks;this.tracksBuffered=[],this.levels=i.map(function(d){return new o.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){c.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(E,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var c=this.levels[this.currentTrackId];c!=null&&c.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,c&&this.setInterval(e)},g.onSubtitleTrackLoaded=function(E,b){var c,i=b.details,d=b.id,h=this.currentTrackId,y=this.levels;if(!y.length)return;var v=y[h];if(d>=y.length||d!==h||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,i.live||(c=v.details)!==null&&c!==void 0&&c.live){var x=this.mainDetails;if(i.deltaUpdateFailed||!x)return;var k=x.fragments[0];if(!v.details)i.hasProgramDateTime&&x.hasProgramDateTime?Object(M.alignMediaPlaylistByPDT)(i,x):k&&Object(O.addSliding)(i,k.start);else{var R=this.alignPlaylists(i,v.details);R===0&&k&&Object(O.addSliding)(i,k.start)}}if(v.details=i,this.levelLastLoaded=d,this.tick(),i.live&&!this.fragCurrent&&this.media&&this.state===m.State.IDLE){var U=Object(F.findFragmentByPTS)(null,i.fragments,this.media.currentTime,0);U||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},g._handleFragmentLoadComplete=function(E){var b=E.frag,c=E.payload,i=b.decryptdata,d=this.hls;if(this.fragContextChanged(b))return;if(c&&c.byteLength>0&&i&&i.key&&i.iv&&i.method==="AES-128"){var h=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(c),i.key.buffer,i.iv.buffer).then(function(y){var v=performance.now();d.trigger(j.Events.FRAG_DECRYPTED,{frag:b,payload:y,stats:{tstart:h,tdecrypt:v}})})}},g.doTick=function(){if(!this.media){this.state=m.State.IDLE;return}if(this.state===m.State.IDLE){var E,b=this.currentTrackId,c=this.levels;if(!c.length||!c[b]||!c[b].details)return;var i=c[b].details,d=i.targetduration,h=this.config,y=this.media,v=A.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,y.currentTime-d,h.maxBufferHole),x=v.end,k=v.len,R=this.getMaxBufferLength()+d;if(k>R)return;console.assert(i,"Subtitle track details are defined on idle subtitle stream controller tick");var U=i.fragments,N=U.length,G=i.edge,L,H=this.fragPrevious;if(x<G){var V=h.maxFragLookUpTolerance;H&&i.hasProgramDateTime&&(L=Object(F.findFragmentByPDT)(U,H.endProgramDateTime,V)),L||(L=Object(F.findFragmentByPTS)(H,U,x,V),!L&&H&&H.start<U[0].start&&(L=U[0]))}else L=U[N-1];(E=L)!==null&&E!==void 0&&E.encrypted?(I.logger.log("Loading key for "+L.sn),this.state=m.State.KEY_LOADING,this.hls.trigger(j.Events.KEY_LOADING,{frag:L})):L&&this.fragmentTracker.getState(L)===S.FragmentState.NOT_LOADED&&this.loadFragment(L,i,x)}},g.loadFragment=function(E,b,c){this.fragCurrent=E,r.prototype.loadFragment.call(this,E,b,c)},n(T,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),T}(m.default)},"./src/controller/subtitle-track-controller.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/events.ts"),I=w("./src/utils/texttrack-utils.ts"),A=w("./src/controller/base-playlist-controller.ts"),F=w("./src/types/loader.ts");function M(a,n){for(var l=0;l<n.length;l++){var s=n[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(a,s.key,s)}}function O(a,n,l){return n&&M(a.prototype,n),l&&M(a,l),a}function S(a,n){a.prototype=Object.create(n.prototype),a.prototype.constructor=a,m(a,n)}function m(a,n){return m=Object.setPrototypeOf||function(s,e){return s.__proto__=e,s},m(a,n)}var p=function(a){S(n,a);function n(s){var e;return e=a.call(this,s,"[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 l=n.prototype;return l.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,a.prototype.destroy.call(this)},l.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)},l.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)},l.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)},l.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},l.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=o(this.media.textTracks);e.forEach(function(t){Object(I.clearCurrentCues)(t)}),this.subtitleTrack=-1,this.media=null},l.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},l.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},l.onSubtitleTrackLoaded=function(e,t){var r=t.id,T=t.details,g=this.trackId,_=this.tracksInGroup[g];if(!_){this.warn("Invalid subtitle track id "+r);return}var E=_.details;_.details=t.details,this.log("subtitle track "+r+" loaded ["+T.startSN+"-"+T.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,E))},l.onLevelLoading=function(e,t){this.switchLevel(t.level)},l.onLevelSwitching=function(e,t){this.switchLevel(t.level)},l.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,g=this.tracks.filter(function(b){return!r||b.groupId===r});this.tracksInGroup=g;var _=this.findTrackId(T==null?void 0:T.name)||this.findTrackId();this.groupId=r;var E={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(j.Events.SUBTITLE_TRACKS_UPDATED,E),_!==-1&&this.setSubtitleTrack(_,T)}},l.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},l.onError=function(e,t){if(a.prototype.onError.call(this,e,t),t.fatal||!t.context)return;t.context.type===F.PlaylistContextType.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},l.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var r=t.id,T=t.groupId,g=t.url;if(e)try{g=e.addDirectives(g)}catch(_){this.warn("Could not construct new URL with HLS Delivery Directives: "+_)}this.log("Loading subtitle playlist for id "+r),this.hls.trigger(j.Events.SUBTITLE_TRACK_LOADING,{url:g,id:r,groupId:T,deliveryDirectives:e||null})}},l.toggleTrackModes=function(e){var t=this,r=this.media,T=this.subtitleDisplay,g=this.trackId;if(!r)return;var _=o(r.textTracks),E=_.filter(function(i){return i.groupId===t.groupId});if(e===-1)[].slice.call(_).forEach(function(i){i.mode="disabled"});else{var b=E[g];b&&(b.mode="disabled")}var c=E[e];c&&(c.mode=T?"showing":"hidden")},l.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 g=T[e];if(this.log("Switching to subtitle track "+e),this.trackId=e,g){var _=g.id,E=g.groupId,b=E===void 0?"":E,c=g.name,i=g.type,d=g.url;this.hls.trigger(j.Events.SUBTITLE_TRACK_SWITCH,{id:_,groupId:b,name:c,type:i,url:d});var h=this.switchParams(g.url,t==null?void 0:t.details);this.loadPlaylist(h)}else this.hls.trigger(j.Events.SUBTITLE_TRACK_SWITCH,{id:e})},l.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var e=-1,t=o(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)},O(n,[{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)}}]),n}(A.default);function o(a){for(var n=[],l=0;l<a.length;l++){var s=a[l];s.kind==="subtitles"&&s.label&&n.push(a[l])}return n}W.default=p},"./src/controller/timeline-controller.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"TimelineController",function(){return o});var j=w("./src/polyfills/number.ts"),I=w("./src/events.ts"),A=w("./src/utils/cea-608-parser.ts"),F=w("./src/utils/output-filter.ts"),M=w("./src/utils/webvtt-parser.ts"),O=w("./src/utils/texttrack-utils.ts"),S=w("./src/utils/imsc1-ttml-parser.ts"),m=w("./src/types/loader.ts"),p=w("./src/utils/logger.ts"),o=function(){function s(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=l(),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 F.default(this,"textTrack1"),T=new F.default(this,"textTrack2"),g=new F.default(this,"textTrack3"),_=new F.default(this,"textTrack4");this.cea608Parser1=new A.default(1,r,T),this.cea608Parser2=new A.default(3,g,_)}t.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(I.Events.FRAG_LOADING,this.onFragLoading,this),t.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=s.prototype;return e.destroy=function(){var r=this.hls;r.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),r.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),r.off(I.Events.FRAG_LOADING,this.onFragLoading,this),r.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),r.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),r.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),r.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),r.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),r.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(r,T,g,_,E){for(var b=!1,c=E.length;c--;){var i=E[c],d=n(i[0],i[1],T,g);if(d>=0&&(i[0]=Math.min(i[0],T),i[1]=Math.max(i[1],g),b=!0,d/(g-T)>.5))return}if(b||E.push([T,g]),this.config.renderTextTracksNatively){var h=this.captionsTracks[r];this.Cues.newCue(h,T,g,_)}else{var y=this.Cues.newCue(null,T,g,_);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:y,track:r})}},e.onInitPtsFound=function(r,T){var g=this,_=T.frag,E=T.id,b=T.initPTS,c=T.timescale,i=this.unparsedVttFrags;E==="main"&&(this.initPTS[_.cc]=b,this.timescale[_.cc]=c),i.length&&(this.unparsedVttFrags=[],i.forEach(function(d){g.onFragLoaded(I.Events.FRAG_LOADED,d)}))},e.getExistingTrack=function(r){var T=this.media;if(T)for(var g=0;g<T.textTracks.length;g++){var _=T.textTracks[g];if(_[r])return _}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,g=this.captionsTracks,_=this.media,E=T[r],b=E.label,c=E.languageCode,i=this.getExistingTrack(r);if(i)g[r]=i,Object(O.clearCurrentCues)(g[r]),Object(O.sendAddTrackEvent)(g[r],_);else{var d=this.createTextTrack("captions",b,c);d&&(d[r]=!0,g[r]=d)}},e.createNonNativeTrack=function(r){if(this.nonNativeCaptionsTracks[r])return;var T=this.captionsProperties[r];if(!T)return;var g=T.label,_={_id:r,label:g,kind:"captions",default:T.media?!!T.media.default:!1,closedCaptions:T.media};this.nonNativeCaptionsTracks[r]=_,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[_]})},e.createTextTrack=function(r,T,g){var _=this.media;return _?_.addTextTrack(r,T,g):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(O.clearCurrentCues)(r[T]),delete r[T]}),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=l(),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 g=0;g<T.length;g++)Object(O.clearCurrentCues)(T[g])},e.onSubtitleTracksUpdated=function(r,T){var g=this;this.textTracks=[];var _=T.subtitleTracks||[],E=_.some(function(d){return d.textCodec===S.IMSC1_CODEC});if(this.config.enableWebVTT||E&&this.config.enableIMSC1){var b=this.tracks&&_&&this.tracks.length===_.length;if(this.tracks=_||[],this.config.renderTextTracksNatively){var c=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,h){var y;if(h<c.length){for(var v=null,x=0;x<c.length;x++)if(a(c[x],d)){v=c[x];break}v&&(y=v)}y?Object(O.clearCurrentCues)(y):(y=g.createTextTrack("subtitles",d.name,d.lang),y&&(y.mode="disabled")),y&&(y.groupId=d.groupId,g.textTracks.push(y))})}else if(!b&&this.tracks&&this.tracks.length){var i=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:i})}}},e.onManifestLoaded=function(r,T){var g=this;this.config.enableCEA708Captions&&T.captions&&T.captions.forEach(function(_){var E=/(?:CC|SERVICE)([1-4])/.exec(_.instreamId);if(!E)return;var b="textTrack"+E[1],c=g.captionsProperties[b];if(!c)return;c.label=_.name,_.lang&&(c.languageCode=_.lang),c.media=_})},e.onFragLoading=function(r,T){var g=this.cea608Parser1,_=this.cea608Parser2,E=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(g&&_))return;if(T.frag.type===m.PlaylistLevelType.MAIN){var c,i,d=T.frag.sn,h=(c=T==null||((i=T.part)===null||i===void 0)?void 0:i.index)!=null?c:-1;d===E+1||d===E&&h===b+1||(g.reset(),_.reset()),this.lastSn=d,this.lastPartIndex=h}},e.onFragLoaded=function(r,T){var g=T.frag,_=T.payload,E=this.initPTS,b=this.unparsedVttFrags;if(g.type===m.PlaylistLevelType.SUBTITLE)if(_.byteLength){if(!Object(j.isFiniteNumber)(E[g.cc])){b.push(T),E.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var c=g.decryptdata;if(c==null||c.key==null||c.method!=="AES-128"){var i=this.tracks[g.level],d=this.vttCCs;d[g.cc]||(d[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),i&&i.textCodec===S.IMSC1_CODEC?this._parseIMSC1(g,_):this._parseVTTs(g,_,d)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(r,T){var g=this,_=this.hls;Object(S.parseIMSC1)(T,this.initPTS[r.cc],this.timescale[r.cc],function(E){g._appendCues(E,r.level),_.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},function(E){p.logger.log("Failed to parse IMSC1: "+E),_.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:E})})},e._parseVTTs=function(r,T,g){var _=this,E=this.hls;Object(M.parseWebVTT)(T,this.initPTS[r.cc],this.timescale[r.cc],g,r.cc,r.start,function(b){_._appendCues(b,r.level),E.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},function(b){_._fallbackToIMSC1(r,T),p.logger.log("Failed to parse VTT cue: "+b),E.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:b})})},e._fallbackToIMSC1=function(r,T){var g=this,_=this.tracks[r.level];_.textCodec||Object(S.parseIMSC1)(T,this.initPTS[r.cc],this.timescale[r.cc],function(){_.textCodec=S.IMSC1_CODEC,g._parseIMSC1(r,T)},function(){_.textCodec="wvtt"})},e._appendCues=function(r,T){var g=this.hls;if(this.config.renderTextTracksNatively){var _=this.textTracks[T];if(_.mode==="disabled")return;r.forEach(function(c){return Object(O.addCueToTrack)(_,c)})}else{var E=this.tracks[T],b=E.default?"default":"subtitles"+T;g.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:r,track:b})}},e.onFragDecrypted=function(r,T){var g=T.frag;if(g.type===m.PlaylistLevelType.SUBTITLE){if(!Object(j.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(T);return}this.onFragLoaded(I.Events.FRAG_LOADED,T)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(r,T){var g=this.cea608Parser1,_=this.cea608Parser2;if(!this.enabled||!(g&&_))return;for(var E=0;E<T.samples.length;E++){var b=T.samples[E].bytes;if(b){var c=this.extractCea608Data(b);g.addData(T.samples[E].pts,c[0]),_.addData(T.samples[E].pts,c[1])}}},e.onBufferFlushing=function(r,T){var g=T.startOffset,_=T.endOffset,E=T.endOffsetSubtitles,b=T.type,c=this.media;if(!c||c.currentTime<_)return;if(!b||b==="video"){var i=this.captionsTracks;Object.keys(i).forEach(function(h){return Object(O.removeCuesInRange)(i[h],g,_)})}if(this.config.renderTextTracksNatively&&(g===0&&E!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(h){return Object(O.removeCuesInRange)(d[h],g,E)})}},e.extractCea608Data=function(r){for(var T=r[0]&31,g=2,_=[[],[]],E=0;E<T;E++){var b=r[g++],c=127&r[g++],i=127&r[g++],d=(4&b)!==0,h=3&b;if(c===0&&i===0)continue;d&&((h===0||h===1)&&(_[h].push(c),_[h].push(i)))}return _},s}();function a(s,e){return s&&s.label===e.name&&!(s.textTrack1||s.textTrack2)}function n(s,e,t,r){return Math.min(e,r)-Math.max(s,t)}function l(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return j});var j=function(){function I(F,M){this.subtle=void 0,this.aesIV=void 0,this.subtle=F,this.aesIV=M}var A=I.prototype;return A.decrypt=function(M,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,M)},I}()},"./src/crypt/aes-decryptor.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"removePadding",function(){return I}),w.d(W,"default",function(){return A});var j=w("./src/utils/typed-array.ts");function I(F){var M=F.byteLength,O=M&&new DataView(F.buffer).getUint8(M-1);return O?Object(j.sliceUint8)(F,0,M-O):F}var A=function(){function F(){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=F.prototype;return M.uint8ArrayToUint32Array_=function(S){for(var m=new DataView(S),p=new Uint32Array(4),o=0;o<4;o++)p[o]=m.getUint32(o*4);return p},M.initTable=function(){var S=this.sBox,m=this.invSBox,p=this.subMix,o=p[0],a=p[1],n=p[2],l=p[3],s=this.invSubMix,e=s[0],t=s[1],r=s[2],T=s[3],g=new Uint32Array(256),_=0,E=0,b=0;for(b=0;b<256;b++)b<128?g[b]=b<<1:g[b]=b<<1^283;for(b=0;b<256;b++){var c=E^E<<1^E<<2^E<<3^E<<4;c=c>>>8^c&255^99,S[_]=c,m[c]=_;var i=g[_],d=g[i],h=g[d],y=g[c]*257^c*16843008;o[_]=y<<24|y>>>8,a[_]=y<<16|y>>>16,n[_]=y<<8|y>>>24,l[_]=y,y=h*16843009^d*65537^i*257^_*16843008,e[c]=y<<24|y>>>8,t[c]=y<<16|y>>>16,r[c]=y<<8|y>>>24,T[c]=y,_?(_=i^g[g[g[h^i]]],E^=g[g[E]]):_=E=1}},M.expandKey=function(S){for(var m=this.uint8ArrayToUint32Array_(S),p=!0,o=0;o<m.length&&p;)p=m[o]===this.key[o],o++;if(p)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 n=this.ksRows=(a+6+1)*4,l,s,e=this.keySchedule=new Uint32Array(n),t=this.invKeySchedule=new Uint32Array(n),r=this.sBox,T=this.rcon,g=this.invSubMix,_=g[0],E=g[1],b=g[2],c=g[3],i,d;for(l=0;l<n;l++){if(l<a){i=e[l]=m[l];continue}d=i,l%a===0?(d=d<<8|d>>>24,d=r[d>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[d&255],d^=T[l/a|0]<<24):a>6&&l%a===4&&(d=r[d>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[d&255]),e[l]=i=(e[l-a]^d)>>>0}for(s=0;s<n;s++)l=n-s,s&3?d=e[l]:d=e[l-4],s<4||l<=4?t[s]=d:t[s]=_[r[d>>>24]]^E[r[d>>>16&255]]^b[r[d>>>8&255]]^c[r[d&255]],t[s]=t[s]>>>0},M.networkToHostOrderSwap=function(S){return S<<24|(S&65280)<<8|(S&16711680)>>8|S>>>24},M.decrypt=function(S,m,p){for(var o=this.keySize+6,a=this.invKeySchedule,n=this.invSBox,l=this.invSubMix,s=l[0],e=l[1],t=l[2],r=l[3],T=this.uint8ArrayToUint32Array_(p),g=T[0],_=T[1],E=T[2],b=T[3],c=new Int32Array(S),i=new Int32Array(c.length),d,h,y,v,x,k,R,U,N,G,L,H,V,$,q=this.networkToHostOrderSwap;m<c.length;){for(N=q(c[m]),G=q(c[m+1]),L=q(c[m+2]),H=q(c[m+3]),x=N^a[0],k=H^a[1],R=L^a[2],U=G^a[3],V=4,$=1;$<o;$++)d=s[x>>>24]^e[k>>16&255]^t[R>>8&255]^r[U&255]^a[V],h=s[k>>>24]^e[R>>16&255]^t[U>>8&255]^r[x&255]^a[V+1],y=s[R>>>24]^e[U>>16&255]^t[x>>8&255]^r[k&255]^a[V+2],v=s[U>>>24]^e[x>>16&255]^t[k>>8&255]^r[R&255]^a[V+3],x=d,k=h,R=y,U=v,V=V+4;d=n[x>>>24]<<24^n[k>>16&255]<<16^n[R>>8&255]<<8^n[U&255]^a[V],h=n[k>>>24]<<24^n[R>>16&255]<<16^n[U>>8&255]<<8^n[x&255]^a[V+1],y=n[R>>>24]<<24^n[U>>16&255]<<16^n[x>>8&255]<<8^n[k&255]^a[V+2],v=n[U>>>24]<<24^n[x>>16&255]<<16^n[k>>8&255]<<8^n[R&255]^a[V+3],i[m]=q(d^g),i[m+1]=q(v^_),i[m+2]=q(y^E),i[m+3]=q(h^b),g=N,_=G,E=L,b=H,m=m+4}return i.buffer},F}()},"./src/crypt/decrypter.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return m});var j=w("./src/crypt/aes-crypto.ts"),I=w("./src/crypt/fast-aes-key.ts"),A=w("./src/crypt/aes-decryptor.ts"),F=w("./src/utils/logger.ts"),M=w("./src/utils/mp4-tools.ts"),O=w("./src/utils/typed-array.ts"),S=16,m=function(){function p(a,n,l){var s=l===void 0?{}:l,e=s.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=n,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 o=p.prototype;return o.destroy=function(){this.observer=null},o.isSync=function(){return this.config.enableSoftwareAES},o.flush=function(){var n=this.currentResult;if(!n){this.reset();return}var l=new Uint8Array(n);return this.reset(),this.removePKCS7Padding?Object(A.removePadding)(l):l},o.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},o.decrypt=function(n,l,s,e){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(n),l,s);var t=this.flush();t&&e(t.buffer)}else this.webCryptoDecrypt(new Uint8Array(n),l,s).then(e)},o.softwareDecrypt=function(n,l,s){var e=this.currentIV,t=this.currentResult,r=this.remainderData;this.logOnce("JS AES decrypt"),r&&(n=Object(M.appendUint8Array)(r,n),this.remainderData=null);var T=this.getValidChunk(n);if(!T.length)return null;e&&(s=e);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new A.default),g.expandKey(l);var _=t;return this.currentResult=g.decrypt(T.buffer,0,s),this.currentIV=Object(O.sliceUint8)(T,-16).buffer,_||null},o.webCryptoDecrypt=function(n,l,s){var e=this,t=this.subtle;return(this.key!==l||!this.fastAesKey)&&(this.key=l,this.fastAesKey=new I.default(t,l)),this.fastAesKey.expandKey().then(function(r){if(!t)return Promise.reject(new Error("web crypto not initialized"));var T=new j.default(t,s);return T.decrypt(n.buffer,r)}).catch(function(r){return e.onWebCryptoError(r,n,l,s)})},o.onWebCryptoError=function(n,l,s,e){return F.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",n),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(l,s,e)},o.getValidChunk=function(n){var l=n,s=n.length-n.length%S;return s!==n.length&&(l=Object(O.sliceUint8)(n,0,s),this.remainderData=Object(O.sliceUint8)(n,s)),l},o.logOnce=function(n){if(!this.logEnabled)return;F.logger.log("[decrypter.ts]: "+n),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return j});var j=function(){function I(F,M){this.subtle=void 0,this.key=void 0,this.subtle=F,this.key=M}var A=I.prototype;return A.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/demux/base-audio-demuxer.ts"),I=w("./src/demux/adts.ts"),A=w("./src/utils/logger.ts"),F=w("./src/demux/id3.ts");function M(m,p){m.prototype=Object.create(p.prototype),m.prototype.constructor=m,O(m,p)}function O(m,p){return O=Object.setPrototypeOf||function(a,n){return a.__proto__=n,a},O(m,p)}var S=function(m){M(p,m);function p(a,n){var l;return l=m.call(this)||this,l.observer=void 0,l.config=void 0,l.observer=a,l.config=n,l}var o=p.prototype;return o.resetInitSegment=function(n,l,s){m.prototype.resetInitSegment.call(this,n,l,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}},p.probe=function(n){if(!n)return!1;for(var l=F.getID3Data(n,0)||[],s=l.length,e=n.length;s<e;s++)if(I.probe(n,s))return A.logger.log("ADTS sync word found !"),!0;return!1},o.canParse=function(n,l){return I.canParse(n,l)},o.appendFrame=function(n,l,s){I.initTrackConfig(n,this.observer,l,s,n.manifestCodec);var e=I.appendFrame(n,l,s,this.initPTS,this.frameIndex);if(e&&e.missing===0)return e},p}(j.default);S.minProbeByteLength=9,W.default=S},"./src/demux/adts.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"getAudioConfig",function(){return F}),w.d(W,"isHeaderPattern",function(){return M}),w.d(W,"getHeaderLength",function(){return O}),w.d(W,"getFullFrameLength",function(){return S}),w.d(W,"canGetFrameLength",function(){return m}),w.d(W,"isHeader",function(){return p}),w.d(W,"canParse",function(){return o}),w.d(W,"probe",function(){return a}),w.d(W,"initTrackConfig",function(){return n}),w.d(W,"getFrameDuration",function(){return l}),w.d(W,"parseFrameHeader",function(){return s}),w.d(W,"appendFrame",function(){return e});var j=w("./src/utils/logger.ts"),I=w("./src/errors.ts"),A=w("./src/events.ts");function F(t,r,T,g){var _,E,b,c,i=navigator.userAgent.toLowerCase(),d=g,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];_=((r[T+2]&192)>>>6)+1;var y=(r[T+2]&60)>>>2;if(y>h.length-1){t.trigger(A.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+y});return}return b=(r[T+2]&1)<<2,b|=(r[T+3]&192)>>>6,j.logger.log("manifest codec:"+g+", ADTS type:"+_+", samplingIndex:"+y),/firefox/i.test(i)?y>=6?(_=5,c=new Array(4),E=y-3):(_=2,c=new Array(2),E=y):i.indexOf("android")!==-1?(_=2,c=new Array(2),E=y):(_=5,c=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&y>=6?E=y-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(y>=6&&b===1||/vivaldi/i.test(i))||!g&&b===1)&&(_=2,c=new Array(2)),E=y)),c[0]=_<<3,c[0]|=(y&14)>>1,c[1]|=(y&1)<<7,c[1]|=b<<3,_===5&&(c[1]|=(E&14)>>1,c[2]=(E&1)<<7,c[2]|=2<<2,c[3]=0),{config:c,samplerate:h[y],channelCount:b,codec:"mp4a.40."+_,manifestCodec:d}}function M(t,r){return t[r]===255&&(t[r+1]&246)===240}function O(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 p(t,r){return r+1<t.length&&M(t,r)}function o(t,r){return m(t,r)&&M(t,r)&&S(t,r)<=t.length-r}function a(t,r){if(p(t,r)){var T=O(t,r);if(r+T>=t.length)return!1;var g=S(t,r);if(g<=T)return!1;var _=r+g;return _===t.length||p(t,_)}return!1}function n(t,r,T,g,_){if(!t.samplerate){var E=F(r,T,g,_);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 l(t){return 1024*9e4/t}function s(t,r,T,g,_){var E=O(t,r),b=S(t,r);if(b-=E,b>0){var c=T+g*_;return{headerLength:E,frameLength:b,stamp:c}}}function e(t,r,T,g,_){var E=l(t.samplerate),b=s(r,T,g,_,E);if(b){var c=b.frameLength,i=b.headerLength,d=b.stamp,h=i+c,y=Math.max(0,T+h-r.length),v;y?(v=new Uint8Array(h-i),v.set(r.subarray(T+i,r.length),0)):v=r.subarray(T+i,T+h);var x={unit:v,pts:d};return y||t.samples.push(x),{sample:x,length:h,missing:y}}}},"./src/demux/base-audio-demuxer.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"initPTSFn",function(){return S});var j=w("./src/polyfills/number.ts"),I=w("./src/demux/id3.ts"),A=w("./src/demux/dummy-demuxed-track.ts"),F=w("./src/utils/mp4-tools.ts"),M=w("./src/utils/typed-array.ts"),O=function(){function m(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var p=m.prototype;return p.resetInitSegment=function(a,n,l){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(a,n){return!1},p.appendFrame=function(a,n,l){},p.demux=function(a,n){this.cachedData&&(a=Object(F.appendUint8Array)(this.cachedData,a),this.cachedData=null);var l=I.getID3Data(a,0),s=l?l.length:0,e,t,r=this._audioTrack,T=this._id3Track,g=l?I.getTimeStamp(l):void 0,_=a.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=S(g,n)),l&&l.length>0&&T.samples.push({pts:this.initPTS,dts:this.initPTS,data:l}),t=this.initPTS;s<_;){if(this.canParse(a,s)){var E=this.appendFrame(r,a,s);E?(this.frameIndex++,t=E.sample.pts,s+=E.length,e=s):s=_}else I.canParse(a,s)?(l=I.getID3Data(a,s),T.samples.push({pts:t,dts:t,data:l}),s+=l.length,e=s):s++;if(s===_&&e!==_){var b=Object(M.sliceUint8)(a,e);this.cachedData?this.cachedData=Object(F.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:r,avcTrack:Object(A.dummyTrack)(),id3Track:T,textTrack:Object(A.dummyTrack)()}},p.demuxSampleAes=function(a,n,l){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(a){var n=this.cachedData;return n&&(this.cachedData=null,this.demux(n,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(A.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(A.dummyTrack)()}},p.destroy=function(){},m}(),S=function(p,o){return Object(j.isFiniteNumber)(p)?p*90:o*9e4};W.default=O},"./src/demux/chunk-cache.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return j});var j=function(){function A(){this.chunks=[],this.dataLength=0}var F=A.prototype;return F.push=function(O){this.chunks.push(O),this.dataLength+=O.length},F.flush=function(){var O=this.chunks,S=this.dataLength,m;if(O.length)O.length===1?m=O[0]:m=I(O,S);else return new Uint8Array(0);return this.reset(),m},F.reset=function(){this.chunks.length=0,this.dataLength=0},A}();function I(A,F){for(var M=new Uint8Array(F),O=0,S=0;S<A.length;S++){var m=A[S];M.set(m,O),O+=m.length}return M}},"./src/demux/dummy-demuxed-track.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"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(ce,W,w){"use strict";w.r(W);var j=w("./src/utils/logger.ts"),I=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 F=A.prototype;return F.loadWord=function(){var O=this.data,S=this.bytesAvailable,m=O.byteLength-S,p=new Uint8Array(4),o=Math.min(4,S);if(o===0)throw new Error("no bytes available");p.set(O.subarray(m,m+o)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=o*8,this.bytesAvailable-=o},F.skipBits=function(O){var S;this.bitsAvailable>O?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,S=O>>3,O-=S>>3,this.bytesAvailable-=S,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},F.readBits=function(O){var S=Math.min(this.bitsAvailable,O),m=this.word>>>32-S;return O>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=O-S,S>0&&this.bitsAvailable?m<<S|this.readBits(S):m},F.skipLZ=function(){var O;for(O=0;O<this.bitsAvailable;++O)if((this.word&2147483648>>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},F.skipUEG=function(){this.skipBits(1+this.skipLZ())},F.skipEG=function(){this.skipBits(1+this.skipLZ())},F.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},F.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},F.readBoolean=function(){return this.readBits(1)===1},F.readUByte=function(){return this.readBits(8)},F.readUShort=function(){return this.readBits(16)},F.readUInt=function(){return this.readBits(32)},F.skipScalingList=function(O){for(var S=8,m=8,p,o=0;o<O;o++)m!==0&&(p=this.readEG(),m=(S+p+256)%256),S=m===0?S:m},F.readSPS=function(){var O=0,S=0,m=0,p=0,o,a,n,l=this.readUByte.bind(this),s=this.readBits.bind(this),e=this.readUEG.bind(this),t=this.readBoolean.bind(this),r=this.skipBits.bind(this),T=this.skipEG.bind(this),g=this.skipUEG.bind(this),_=this.skipScalingList.bind(this);l();var E=l();if(s(5),r(3),l(),g(),E===100||E===110||E===122||E===244||E===44||E===83||E===86||E===118||E===128){var b=e();if(b===3&&r(1),g(),g(),r(1),t())for(a=b!==3?8:12,n=0;n<a;n++)t()&&(n<6?_(16):_(64))}g();var c=e();if(c===0)e();else if(c===1)for(r(1),T(),T(),o=e(),n=0;n<o;n++)T();g(),r(1);var i=e(),d=e(),h=s(1);h===0&&r(1),r(1),t()&&(O=e(),S=e(),m=e(),p=e());var y=[1,1];if(t()&&t()){var v=l();switch(v){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:{y=[l()<<8|l(),l()<<8|l()];break}}}return{width:Math.ceil((i+1)*16-O*2-S*2),height:(2-h)*(d+1)*16-(h?2:4)*(m+p),pixelRatio:y}},F.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},A}();W.default=I},"./src/demux/id3.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"isHeader",function(){return j}),w.d(W,"isFooter",function(){return I}),w.d(W,"getID3Data",function(){return A}),w.d(W,"canParse",function(){return M}),w.d(W,"getTimeStamp",function(){return O}),w.d(W,"isTimeStampFrame",function(){return S}),w.d(W,"getID3Frames",function(){return p}),w.d(W,"decodeFrame",function(){return o}),w.d(W,"utf8ArrayToStr",function(){return e}),w.d(W,"testables",function(){return t});var j=function(_,E){return E+10<=_.length&&(_[E]===73&&_[E+1]===68&&_[E+2]===51&&(_[E+3]<255&&_[E+4]<255&&(_[E+6]<128&&_[E+7]<128&&_[E+8]<128&&_[E+9]<128)))},I=function(_,E){return E+10<=_.length&&(_[E]===51&&_[E+1]===68&&_[E+2]===73&&(_[E+3]<255&&_[E+4]<255&&(_[E+6]<128&&_[E+7]<128&&_[E+8]<128&&_[E+9]<128)))},A=function(_,E){for(var b=E,c=0;j(_,E);){c+=10;var i=F(_,E+6);c+=i,I(_,E+10)&&(c+=10),E+=c}return c>0?_.subarray(b,b+c):void 0},F=function(_,E){var b=0;return b=(_[E]&127)<<21,b|=(_[E+1]&127)<<14,b|=(_[E+2]&127)<<7,b|=_[E+3]&127,b},M=function(_,E){return j(_,E)&&F(_,E+6)+10<=_.length-E},O=function(_){for(var E=p(_),b=0;b<E.length;b++){var c=E[b];if(S(c))return s(c)}return},S=function(_){return _&&_.key==="PRIV"&&_.info==="com.apple.streaming.transportStreamTimestamp"},m=function(_){var E=String.fromCharCode(_[0],_[1],_[2],_[3]),b=F(_,4),c=10;return{type:E,size:b,data:_.subarray(c,c+b)}},p=function(_){for(var E=0,b=[];j(_,E);){var c=F(_,E+6);E+=10;for(var i=E+c;E+8<i;){var d=m(_.subarray(E)),h=o(d);h&&b.push(h),E+=d.size+10}I(_,E)&&(E+=10)}return b},o=function(_){return _.type==="PRIV"?a(_):_.type[0]==="W"?l(_):n(_)},a=function(_){if(_.size<2)return;var E=e(_.data,!0),b=new Uint8Array(_.data.subarray(E.length+1));return{key:_.type,info:E,data:b.buffer}},n=function(_){if(_.size<2)return;if(_.type==="TXXX"){var E=1,b=e(_.data.subarray(E),!0);E+=b.length+1;var c=e(_.data.subarray(E));return{key:_.type,info:b,data:c}}var i=e(_.data.subarray(1));return{key:_.type,data:i}},l=function(_){if(_.type==="WXXX"){if(_.size<2)return;var E=1,b=e(_.data.subarray(E),!0);E+=b.length+1;var c=e(_.data.subarray(E));return{key:_.type,info:b,data:c}}var i=e(_.data);return{key:_.type,data:i}},s=function(_){if(_.data.byteLength===8){var E=new Uint8Array(_.data),b=E[3]&1,c=(E[4]<<23)+(E[5]<<15)+(E[6]<<7)+E[7];return c/=45,b&&(c+=4772185884e-2),Math.round(c)}return},e=function(_,E){E===void 0&&(E=!1);var b=T();if(b){var c=b.decode(_);if(E){var i=c.indexOf("\0");return i!==-1?c.substring(0,i):c}return c.replace(/\0/g,"")}for(var d=_.length,h,y,v,x="",k=0;k<d;){if(h=_[k++],h===0&&E)return x;if(h===0||h===3)continue;switch(h>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:x+=String.fromCharCode(h);break;case 12:case 13:y=_[k++],x+=String.fromCharCode((h&31)<<6|y&63);break;case 14:y=_[k++],v=_[k++],x+=String.fromCharCode((h&15)<<12|(y&63)<<6|(v&63)<<0);break;default:}}return x},t={decodeTextFrame:n},r;function T(){return!r&&typeof self.TextDecoder!="undefined"&&(r=new self.TextDecoder("utf-8")),r}},"./src/demux/mp3demuxer.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/demux/base-audio-demuxer.ts"),I=w("./src/demux/id3.ts"),A=w("./src/utils/logger.ts"),F=w("./src/demux/mpegaudio.ts");function M(m,p){m.prototype=Object.create(p.prototype),m.prototype.constructor=m,O(m,p)}function O(m,p){return O=Object.setPrototypeOf||function(a,n){return a.__proto__=n,a},O(m,p)}var S=function(m){M(p,m);function p(){return m.apply(this,arguments)||this}var o=p.prototype;return o.resetInitSegment=function(n,l,s){m.prototype.resetInitSegment.call(this,n,l,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}},p.probe=function(n){if(!n)return!1;for(var l=I.getID3Data(n,0)||[],s=l.length,e=n.length;s<e;s++)if(F.probe(n,s))return A.logger.log("MPEG Audio sync word found !"),!0;return!1},o.canParse=function(n,l){return F.canParse(n,l)},o.appendFrame=function(n,l,s){return this.initPTS===null?void 0:F.appendFrame(n,l,s,this.initPTS,this.frameIndex)},p}(j.default);S.minProbeByteLength=4,W.default=S},"./src/demux/mp4demuxer.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/utils/mp4-tools.ts"),I=w("./src/demux/dummy-demuxed-track.ts"),A=function(){function F(O,S){this.remainderData=null,this.config=void 0,this.config=S}var M=F.prototype;return M.resetTimeStamp=function(){},M.resetInitSegment=function(){},M.resetContiguity=function(){},F.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,p=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(m=Object(j.appendUint8Array)(this.remainderData,S));var o=Object(j.segmentValidRange)(m);this.remainderData=o.remainder,p.samples=o.valid||new Uint8Array}else p.samples=m;return{audioTrack:Object(I.dummyTrack)(),avcTrack:p,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},M.flush=function(){var S=Object(I.dummyTrack)();return S.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:S,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},M.demuxSampleAes=function(S,m,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},M.destroy=function(){},F}();A.minProbeByteLength=1024,W.default=A},"./src/demux/mpegaudio.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"appendFrame",function(){return O}),w.d(W,"parseHeader",function(){return S}),w.d(W,"isHeaderPattern",function(){return m}),w.d(W,"isHeader",function(){return p}),w.d(W,"canParse",function(){return o}),w.d(W,"probe",function(){return a});var j=null,I=[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],F=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],M=[0,1,1,4];function O(n,l,s,e,t){if(s+24>l.length)return;var r=S(l,s);if(r&&s+r.frameLength<=l.length){var T=r.samplesPerFrame*9e4/r.sampleRate,g=e+t*T,_={unit:l.subarray(s,s+r.frameLength),pts:g,dts:g};return n.config=[],n.channelCount=r.channelCount,n.samplerate=r.sampleRate,n.samples.push(_),{sample:_,length:r.frameLength,missing:0}}}function S(n,l){var s=n[l+1]>>3&3,e=n[l+1]>>1&3,t=n[l+2]>>4&15,r=n[l+2]>>2&3;if(s!==1&&t!==0&&t!==15&&r!==3){var T=n[l+2]>>1&1,g=n[l+3]>>6,_=s===3?3-e:e===3?3:4,E=I[_*14+t-1]*1e3,b=s===3?0:s===2?1:2,c=A[b*3+r],i=g===3?1:2,d=F[s][e],h=M[e],y=d*8*h,v=Math.floor(d*E/c+T)*h;if(j===null){var x=navigator.userAgent||"",k=x.match(/Chrome\/(\d+)/i);j=k?parseInt(k[1]):0}var R=!!j&&j<=87;return R&&e===2&&E>=224e3&&g===0&&(n[l+3]=n[l+3]|128),{sampleRate:c,channelCount:i,frameLength:v,samplesPerFrame:y}}}function m(n,l){return n[l]===255&&(n[l+1]&224)===224&&(n[l+1]&6)!==0}function p(n,l){return l+1<n.length&&m(n,l)}function o(n,l){var s=4;return m(n,l)&&s<=n.length-l}function a(n,l){if(l+1<n.length&&m(n,l)){var s=4,e=S(n,l),t=s;e!=null&&e.frameLength&&(t=e.frameLength);var r=l+t;return r===n.length||p(n,r)}return!1}},"./src/demux/sample-aes.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/crypt/decrypter.ts"),I=w("./src/demux/tsdemuxer.ts"),A=function(){function F(O,S,m){this.keyData=void 0,this.decrypter=void 0,this.keyData=m,this.decrypter=new j.default(O,S,{removePKCS7Padding:!1})}var M=F.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,p,o){var a=S[m].unit,n=a.subarray(16,a.length-a.length%16),l=n.buffer.slice(n.byteOffset,n.byteOffset+n.length),s=this;this.decryptBuffer(l,function(e){var t=new Uint8Array(e);a.set(t,16),o||s.decryptAacSamples(S,m+1,p)})},M.decryptAacSamples=function(S,m,p){for(;;m++){if(m>=S.length){p();return}if(S[m].unit.length<32)continue;var o=this.decrypter.isSync();if(this.decryptAacSample(S,m,p,o),!o)return}},M.getAvcEncryptedData=function(S){for(var m=Math.floor((S.length-48)/160)*16+16,p=new Int8Array(m),o=0,a=32;a<=S.length-16;a+=160,o+=16)p.set(S.subarray(a,a+16),o);return p},M.getAvcDecryptedUnit=function(S,m){for(var p=new Uint8Array(m),o=0,a=32;a<=S.length-16;a+=160,o+=16)S.set(p.subarray(o,o+16),a);return S},M.decryptAvcSample=function(S,m,p,o,a,n){var l=Object(I.discardEPB)(a.data),s=this.getAvcEncryptedData(l),e=this;this.decryptBuffer(s.buffer,function(t){a.data=e.getAvcDecryptedUnit(l,t),n||e.decryptAvcSamples(S,m,p+1,o)})},M.decryptAvcSamples=function(S,m,p,o){if(S instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;m++,p=0){if(m>=S.length){o();return}for(var a=S[m].units;!(p>=a.length);p++){var n=a[p];if(n.data.length<=48||n.type!==1&&n.type!==5)continue;var l=this.decrypter.isSync();if(this.decryptAvcSample(S,m,p,o,n,l),!l)return}}},F}();W.default=A},"./src/demux/transmuxer-interface.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return a});var j=w("./node_modules/webworkify-webpack/index.js"),I=w.n(j),A=w("./src/events.ts"),F=w("./src/demux/transmuxer.ts"),M=w("./src/utils/logger.ts"),O=w("./src/errors.ts"),S=w("./src/utils/mediasource-helper.ts"),m=w("./node_modules/eventemitter3/index.js"),p=w.n(m),o=Object(S.getMediaSource)()||{isTypeSupported:function(){return!1}},a=function(){function n(s,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=s,this.id=e,this.onTransmuxComplete=t,this.onFlush=r;var g=s.config,_=function(d,h){h=h||{},h.frag=T.frag,h.id=T.id,s.trigger(d,h)};this.observer=new m.EventEmitter,this.observer.on(A.Events.FRAG_DECRYPTED,_),this.observer.on(A.Events.ERROR,_);var E={mp4:o.isTypeSupported("video/mp4"),mpeg:o.isTypeSupported("audio/mpeg"),mp3:o.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){M.logger.log("demuxing in webworker");var c;try{c=this.worker=j("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(i){s.trigger(A.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(i.message+" ("+i.filename+":"+i.lineno+")")})},c.postMessage({cmd:"init",typeSupported:E,vendor:b,id:e,config:JSON.stringify(g)})}catch(i){M.logger.warn("Error in worker:",i),M.logger.error("Error while initializing DemuxerWorker, fallback to inline"),c&&self.URL.revokeObjectURL(c.objectURL),this.transmuxer=new F.default(this.observer,E,g,b,e),this.worker=null}}else this.transmuxer=new F.default(this.observer,E,g,b,e)}var l=n.prototype;return l.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},l.push=function(e,t,r,T,g,_,E,b,c,i){var d=this;c.transmuxing.start=self.performance.now();var h=this.transmuxer,y=this.worker,v=_?_.start:g.start,x=g.decryptdata,k=this.frag,R=!(k&&g.cc===k.cc),U=!(k&&c.level===k.level),N=k?c.sn-k.sn:-1,G=this.part?c.part-this.part.index:1,L=!U&&(N===1||N===0&&G===1),H=self.performance.now();(U||N||g.stats.parsing.start===0)&&(g.stats.parsing.start=H),_&&(G||!L)&&(_.stats.parsing.start=H);var V=new F.TransmuxState(R,L,b,U,v);if(!L||R){M.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+`
|
|
discontinuity: `+R+`
|
|
trackSwitch: `+U+`
|
|
contiguous: `+L+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+v);var $=new F.TransmuxConfig(r,T,t,E,i);this.configureTransmuxer($)}if(this.frag=g,this.part=_,y)y.postMessage({cmd:"demux",data:e,decryptdata:x,chunkMeta:c,state:V},e instanceof ArrayBuffer?[e]:[]);else if(h){var q=h.push(e,x,c,V);Object(F.isPromise)(q)?q.then(function(he){d.handleTransmuxComplete(he)}):this.handleTransmuxComplete(q)}},l.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 g=r.flush(e);Object(F.isPromise)(g)?g.then(function(_){t.handleFlushResult(_,e)}):this.handleFlushResult(g,e)}},l.handleFlushResult=function(e,t){var r=this;e.forEach(function(T){r.handleTransmuxComplete(T)}),this.onFlush(t)},l.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}}},l.configureTransmuxer=function(e){var t=this.worker,r=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):r&&r.configure(e)},l.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},n}()},"./src/demux/transmuxer-worker.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return O});var j=w("./src/demux/transmuxer.ts"),I=w("./src/events.ts"),A=w("./src/utils/logger.ts"),F=w("./node_modules/eventemitter3/index.js"),M=w.n(F);function O(a){var n=new F.EventEmitter,l=function(e,t){a.postMessage({event:e,data:t})};n.on(I.Events.FRAG_DECRYPTED,l),n.on(I.Events.ERROR,l),a.addEventListener("message",function(s){var e=s.data;switch(e.cmd){case"init":{var t=JSON.parse(e.config);a.transmuxer=new j.default(n,e.typeSupported,t,e.vendor,e.id),Object(A.enableLogs)(t.debug),l("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(_){S(a,_)}):S(a,r);break}case"flush":{var T=e.chunkMeta,g=a.transmuxer.flush(T);Object(j.isPromise)(g)?g.then(function(_){p(a,_,T)}):p(a,g,T);break}default:break}})}function S(a,n){if(o(n.remuxResult))return;var l=[],s=n.remuxResult,e=s.audio,t=s.video;e&&m(l,e),t&&m(l,t),a.postMessage({event:"transmuxComplete",data:n},l)}function m(a,n){n.data1&&a.push(n.data1.buffer),n.data2&&a.push(n.data2.buffer)}function p(a,n,l){n.forEach(function(s){S(a,s)}),a.postMessage({event:"flush",data:l})}function o(a){return!a.audio&&!a.video&&!a.text&&!a.id3&&!a.initSegment}},"./src/demux/transmuxer.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return t}),w.d(W,"isPromise",function(){return g}),w.d(W,"TransmuxConfig",function(){return _}),w.d(W,"TransmuxState",function(){return E});var j=w("./src/events.ts"),I=w("./src/errors.ts"),A=w("./src/crypt/decrypter.ts"),F=w("./src/demux/aacdemuxer.ts"),M=w("./src/demux/mp4demuxer.ts"),O=w("./src/demux/tsdemuxer.ts"),S=w("./src/demux/mp3demuxer.ts"),m=w("./src/remux/mp4-remuxer.ts"),p=w("./src/remux/passthrough-remuxer.ts"),o=w("./src/demux/chunk-cache.ts"),a=w("./src/utils/mp4-tools.ts"),n=w("./src/utils/logger.ts"),l;try{l=self.performance.now.bind(self.performance)}catch(b){n.logger.debug("Unable to use Performance API on this environment"),l=self.Date.now}var s=[{demux:O.default,remux:m.default},{demux:M.default,remux:p.default},{demux:F.default,remux:m.default},{demux:S.default,remux:m.default}],e=1024;s.forEach(function(b){var c=b.demux;e=Math.max(e,c.minProbeByteLength)});var t=function(){function b(i,d,h,y,v){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 o.default,this.observer=i,this.typeSupported=d,this.config=h,this.vendor=y,this.id=v}var c=b.prototype;return c.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},c.push=function(d,h,y,v){var x=this,k=y.transmuxing;k.executeStart=l();var R=new Uint8Array(d),U=this.cache,N=this.config,G=this.currentTransmuxState,L=this.transmuxConfig;v&&(this.currentTransmuxState=v);var H=r(R,h);if(H&&H.method==="AES-128"){var V=this.getDecrypter();if(N.enableSoftwareAES){var $=V.softwareDecrypt(R,H.key.buffer,H.iv.buffer);if(!$)return k.executeEnd=l(),T(y);R=new Uint8Array($)}else return this.decryptionPromise=V.webCryptoDecrypt(R,H.key.buffer,H.iv.buffer).then(function(we){var Ee=x.push(we,null,y);return x.decryptionPromise=null,Ee}),this.decryptionPromise}var q=v||G,he=q.contiguous,ae=q.discontinuity,oe=q.trackSwitch,ue=q.accurateTimeOffset,de=q.timeOffset,ie=L.audioCodec,X=L.videoCodec,Se=L.defaultInitPts,Ie=L.duration,Ae=L.initSegmentData;if((ae||oe)&&this.resetInitSegment(Ae,ie,X,Ie),ae&&this.resetInitialTimestamp(Se),he||this.resetContiguity(),this.needsProbing(R,ae,oe)){if(U.dataLength){var je=U.flush();R=Object(a.appendUint8Array)(je,R)}this.configureTransmuxer(R,L)}var He=this.transmux(R,H,de,ue,y),pe=this.currentTransmuxState;return pe.contiguous=!0,pe.discontinuity=!1,pe.trackSwitch=!1,k.executeEnd=l(),He},c.flush=function(d){var h=this,y=d.transmuxing;y.executeStart=l();var v=this.decrypter,x=this.cache,k=this.currentTransmuxState,R=this.decryptionPromise;if(R)return R.then(function(){return h.flush(d)});var U=[],N=k.timeOffset;if(v){var G=v.flush();G&&U.push(this.push(G,null,d))}var L=x.dataLength;x.reset();var H=this.demuxer,V=this.remuxer;if(!H||!V)return L>=e&&this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),y.executeEnd=l(),[T(d)];var $=H.flush(N);return g($)?$.then(function(q){return h.flushRemux(U,q,d),U}):(this.flushRemux(U,$,d),U)},c.flushRemux=function(d,h,y){var v=h.audioTrack,x=h.avcTrack,k=h.id3Track,R=h.textTrack,U=this.currentTransmuxState,N=U.accurateTimeOffset,G=U.timeOffset;n.logger.log("[transmuxer.ts]: Flushed fragment "+y.sn+(y.part>-1?" p: "+y.part:"")+" of level "+y.level);var L=this.remuxer.remux(v,x,k,R,G,N,!0,this.id);d.push({remuxResult:L,chunkMeta:y}),y.transmuxing.executeEnd=l()},c.resetInitialTimestamp=function(d){var h=this.demuxer,y=this.remuxer;if(!h||!y)return;h.resetTimeStamp(d),y.resetTimeStamp(d)},c.resetContiguity=function(){var d=this.demuxer,h=this.remuxer;if(!d||!h)return;d.resetContiguity(),h.resetNextTimestamp()},c.resetInitSegment=function(d,h,y,v){var x=this.demuxer,k=this.remuxer;if(!x||!k)return;x.resetInitSegment(h,y,v),k.resetInitSegment(d,h,y)},c.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},c.transmux=function(d,h,y,v,x){var k;return h&&h.method==="SAMPLE-AES"?k=this.transmuxSampleAes(d,h,y,v,x):k=this.transmuxUnencrypted(d,y,v,x),k},c.transmuxUnencrypted=function(d,h,y,v){var x=this.demuxer.demux(d,h,!1,!this.config.progressive),k=x.audioTrack,R=x.avcTrack,U=x.id3Track,N=x.textTrack,G=this.remuxer.remux(k,R,U,N,h,y,!1,this.id);return{remuxResult:G,chunkMeta:v}},c.transmuxSampleAes=function(d,h,y,v,x){var k=this;return this.demuxer.demuxSampleAes(d,h,y).then(function(R){var U=k.remuxer.remux(R.audioTrack,R.avcTrack,R.id3Track,R.textTrack,y,v,!1,k.id);return{remuxResult:U,chunkMeta:x}})},c.configureTransmuxer=function(d,h){for(var y=this.config,v=this.observer,x=this.typeSupported,k=this.vendor,R=h.audioCodec,U=h.defaultInitPts,N=h.duration,G=h.initSegmentData,L=h.videoCodec,H,V=0,$=s.length;V<$;V++)if(s[V].demux.probe(d)){H=s[V];break}H||(n.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:M.default,remux:p.default});var q=this.demuxer,he=this.remuxer,ae=H.remux,oe=H.demux;(!he||!(he instanceof ae))&&(this.remuxer=new ae(v,y,x,k)),(!q||!(q instanceof oe))&&(this.demuxer=new oe(v,y,x),this.probe=oe.probe),this.resetInitSegment(G,R,L,N),this.resetInitialTimestamp(U)},c.needsProbing=function(d,h,y){return!this.demuxer||!this.remuxer||h||y},c.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new A.default(this.observer,this.config)),d},b}();function r(b,c){var i=null;return b.byteLength>0&&c!=null&&c.key!=null&&c.iv!==null&&c.method!=null&&(i=c),i}var T=function(c){return{remuxResult:{},chunkMeta:c}};function g(b){return"then"in b&&b.then instanceof Function}var _=function(c,i,d,h,y){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=c,this.videoCodec=i,this.initSegmentData=d,this.duration=h,this.defaultInitPts=y},E=function(c,i,d,h,y){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=c,this.contiguous=i,this.accurateTimeOffset=d,this.trackSwitch=h,this.timeOffset=y}},"./src/demux/tsdemuxer.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"discardEPB",function(){return T});var j=w("./src/demux/adts.ts"),I=w("./src/demux/mpegaudio.ts"),A=w("./src/demux/exp-golomb.ts"),F=w("./src/demux/id3.ts"),M=w("./src/demux/sample-aes.ts"),O=w("./src/events.ts"),S=w("./src/utils/mp4-tools.ts"),m=w("./src/utils/logger.ts"),p=w("./src/errors.ts"),o={video:1,audio:2,id3:3,text:4},a=function(){function g(E,b,c){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=b,this.typeSupported=c}g.probe=function(b){var c=g.syncOffset(b);return c<0?!1:(c&&m.logger.warn("MPEG2-TS detected but first sync word found @ offset "+c+", junk ahead ?"),!0)},g.syncOffset=function(b){for(var c=Math.min(1e3,b.length-3*188),i=0;i<c;){if(b[i]===71&&b[i+188]===71&&b[i+2*188]===71)return i;i++}return-1},g.createTrack=function(b,c){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:o[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?c:void 0}};var _=g.prototype;return _.resetInitSegment=function(b,c,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",i),this._audioTrack=g.createTrack("audio",i),this._id3Track=g.createTrack("id3",i),this._txtTrack=g.createTrack("text",i),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=c,this._duration=i},_.resetTimeStamp=function(){},_.resetContiguity=function(){var b=this._audioTrack,c=this._avcTrack,i=this._id3Track;b&&(b.pesData=null),c&&(c.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},_.demux=function(b,c,i,d){i===void 0&&(i=!1),d===void 0&&(d=!1),i||(this.sampleAes=null);var h,y=this._avcTrack,v=this._audioTrack,x=this._id3Track,k=y.pid,R=y.pesData,U=v.pid,N=x.pid,G=v.pesData,L=x.pesData,H=!1,V=this.pmtParsed,$=this._pmtId,q=b.length;if(this.remainderData&&(b=Object(S.appendUint8Array)(this.remainderData,b),q=b.length,this.remainderData=null),q<188&&!d)return this.remainderData=b,{audioTrack:v,avcTrack:y,id3Track:x,textTrack:this._txtTrack};var he=Math.max(0,g.syncOffset(b));q-=(q+he)%188,q<b.byteLength&&!d&&(this.remainderData=new Uint8Array(b.buffer,q,b.buffer.byteLength-q));for(var ae=he;ae<q;ae+=188)if(b[ae]===71){var oe=!!(b[ae+1]&64),ue=((b[ae+1]&31)<<8)+b[ae+2],de=(b[ae+3]&48)>>4,ie=void 0;if(de>1){if(ie=ae+5+b[ae+4],ie===ae+188)continue}else ie=ae+4;switch(ue){case k:oe&&(R&&(h=e(R))&&this.parseAVCPES(h,!1),R={data:[],size:0}),R&&(R.data.push(b.subarray(ie,ae+188)),R.size+=ae+188-ie);break;case U:oe&&(G&&(h=e(G))&&(v.isAAC?this.parseAACPES(h):this.parseMPEGPES(h)),G={data:[],size:0}),G&&(G.data.push(b.subarray(ie,ae+188)),G.size+=ae+188-ie);break;case N:oe&&(L&&(h=e(L))&&this.parseID3PES(h),L={data:[],size:0}),L&&(L.data.push(b.subarray(ie,ae+188)),L.size+=ae+188-ie);break;case 0:oe&&(ie+=b[ie]+1),$=this._pmtId=l(b,ie);break;case $:{oe&&(ie+=b[ie]+1);var X=s(b,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,i);k=X.avc,k>0&&(y.pid=k),U=X.audio,U>0&&(v.pid=U,v.isAAC=X.isAAC),N=X.id3,N>0&&(x.pid=N),H&&!V&&(m.logger.log("reparse from beginning"),H=!1,ae=he-188),V=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});y.pesData=R,v.pesData=G,x.pesData=L;var Se={audioTrack:v,avcTrack:y,id3Track:x,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(Se),Se},_.flush=function(){var b=this.remainderData;this.remainderData=null;var c;return b?c=this.demux(b,-1,!1,!0):c={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},_.extractRemainingSamples=function(b){var c=b.audioTrack,i=b.avcTrack,d=b.id3Track,h=i.pesData,y=c.pesData,v=d.pesData,x;h&&(x=e(h))?(this.parseAVCPES(x,!0),i.pesData=null):i.pesData=h,y&&(x=e(y))?(c.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),c.pesData=null):(y!=null&&y.size&&m.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=y),v&&(x=e(v))?(this.parseID3PES(x),d.pesData=null):d.pesData=v},_.demuxSampleAes=function(b,c,i){var d=this.demux(b,i,!0,!this.config.progressive),h=this.sampleAes=new M.default(this.observer,this.config,c);return this.decrypt(d,h)},_.decrypt=function(b,c){return new Promise(function(i){var d=b.audioTrack,h=b.avcTrack;d.samples&&d.isAAC?c.decryptAacSamples(d.samples,0,function(){h.samples?c.decryptAvcSamples(h.samples,0,0,function(){i(b)}):i(b)}):h.samples&&c.decryptAvcSamples(h.samples,0,0,function(){i(b)})})},_.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},_.parseAVCPES=function(b,c){var i=this,d=this._avcTrack,h=this.parseAVCNALu(b.data),y=!1,v=this.avcSample,x,k=!1;b.data=null,v&&h.length&&!d.audFound&&(t(v,d),v=this.avcSample=n(!1,b.pts,b.dts,"")),h.forEach(function(R){switch(R.type){case 1:{x=!0,v||(v=i.avcSample=n(!0,b.pts,b.dts,"")),y&&(v.debug+="NDR "),v.frame=!0;var U=R.data;if(k&&U.length>4){var N=new A.default(U).readSliceType();(N===2||N===4||N===7||N===9)&&(v.key=!0)}break}case 5:x=!0,v||(v=i.avcSample=n(!0,b.pts,b.dts,"")),y&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{x=!0,y&&v&&(v.debug+="SEI ");var G=new A.default(T(R.data));G.readUByte();for(var L=0,H=0,V=!1,$=0;!V&&G.bytesAvailable>1;){L=0;do $=G.readUByte(),L+=$;while($===255);H=0;do $=G.readUByte(),H+=$;while($===255);if(L===4&&G.bytesAvailable!==0){V=!0;var q=G.readUByte();if(q===181){var he=G.readUShort();if(he===49){var ae=G.readUInt();if(ae===1195456820){var oe=G.readUByte();if(oe===3){for(var ue=G.readUByte(),de=G.readUByte(),ie=31&ue,X=[ue,de],Se=0;Se<ie;Se++)X.push(G.readUByte()),X.push(G.readUByte()),X.push(G.readUByte());r(i._txtTrack.samples,{type:3,pts:b.pts,bytes:X})}}}}}else if(L===5&&G.bytesAvailable!==0){if(V=!0,H>16){for(var Ie=[],Ae=0;Ae<16;Ae++)Ie.push(G.readUByte().toString(16)),(Ae===3||Ae===5||Ae===7||Ae===9)&&Ie.push("-");for(var je=H-16,He=new Uint8Array(je),pe=0;pe<je;pe++)He[pe]=G.readUByte();r(i._txtTrack.samples,{pts:b.pts,payloadType:L,uuid:Ie.join(""),userData:Object(F.utf8ArrayToStr)(He),userDataBytes:He})}}else if(H<G.bytesAvailable)for(var we=0;we<H;we++)G.readUByte()}break}case 7:if(x=!0,k=!0,y&&v&&(v.debug+="SPS "),!d.sps){var Ee=new A.default(R.data),me=Ee.readSPS();d.width=me.width,d.height=me.height,d.pixelRatio=me.pixelRatio,d.sps=[R.data],d.duration=i._duration;for(var ye=R.data.subarray(1,4),ve="avc1.",be=0;be<3;be++){var Ke=ye[be].toString(16);Ke.length<2&&(Ke="0"+Ke),ve+=Ke}d.codec=ve}break;case 8:x=!0,y&&v&&(v.debug+="PPS "),d.pps||(d.pps=[R.data]);break;case 9:x=!1,d.audFound=!0,v&&t(v,d),v=i.avcSample=n(!1,b.pts,b.dts,y?"AUD ":"");break;case 12:x=!1;break;default:x=!1,v&&(v.debug+="unknown NAL "+R.type+" ");break}if(v&&x){var De=v.units;De.push(R)}}),c&&v&&(t(v,d),this.avcSample=null)},_.getLastNalUnit=function(){var b,c=this.avcSample,i;if(!c||c.units.length===0){var d=this._avcTrack.samples;c=d[d.length-1]}if((b=c)!==null&&b!==void 0&&b.units){var h=c.units;i=h[h.length-1]}return i},_.parseAVCNALu=function(b){var c=b.byteLength,i=this._avcTrack,d=i.naluState||0,h=d,y=[],v=0,x,k,R,U=-1,N=0;for(d===-1&&(U=0,N=b[0]&31,d=0,v=1);v<c;){if(x=b[v++],!d){d=x?0:1;continue}if(d===1){d=x?0:2;continue}if(!x)d=3;else if(x===1){if(U>=0){var G={data:b.subarray(U,v-d-1),type:N};y.push(G)}else{var L=this.getLastNalUnit();if(L&&(h&&v<=4-h&&(L.state&&(L.data=L.data.subarray(0,L.data.byteLength-h))),k=v-d-1,k>0)){var H=new Uint8Array(L.data.byteLength+k);H.set(L.data,0),H.set(b.subarray(0,k),L.data.byteLength),L.data=H,L.state=0}}v<c?(R=b[v]&31,U=v,N=R,d=0):d=-1}else d=0}if(U>=0&&d>=0){var V={data:b.subarray(U,c),type:N,state:d};y.push(V)}if(y.length===0){var $=this.getLastNalUnit();if($){var q=new Uint8Array($.data.byteLength+b.byteLength);q.set($.data,0),q.set(b,$.data.byteLength),$.data=q}}return i.naluState=d,y},_.parseAACPES=function(b){var c=0,i=this._audioTrack,d=this.aacOverFlow,h=b.data;if(d){this.aacOverFlow=null;var y=d.sample.unit.byteLength,v=Math.min(d.missing,y),x=y-v;d.sample.unit.set(h.subarray(0,v),x),i.samples.push(d.sample),c=d.missing}var k,R;for(k=c,R=h.length;k<R-1&&!j.isHeader(h,k);k++);if(k!==c){var U,N;if(k<R-1?(U="AAC PES did not start with ADTS header,offset:"+k,N=!1):(U="no ADTS header found in AAC PES",N=!0),m.logger.warn("parsing error:"+U),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:N,reason:U}),N)return}j.initTrackConfig(i,this.observer,h,k,this.audioCodec);var G;if(b.pts!==void 0)G=b.pts;else if(d){var L=j.getFrameDuration(i.samplerate);G=d.sample.pts+L}else{m.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;k<R;)if(j.isHeader(h,k)){if(k+5<R){var V=j.appendFrame(i,h,k,G,H);if(V)if(V.missing)this.aacOverFlow=V;else{k+=V.length,H++;continue}}break}else k++},_.parseMPEGPES=function(b){var c=b.data,i=c.length,d=0,h=0,y=b.pts;if(y===void 0){m.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;h<i;)if(I.isHeader(c,h)){var v=I.appendFrame(this._audioTrack,c,h,y,d);if(v)h+=v.length,d++;else break}else h++},_.parseID3PES=function(b){if(b.pts===void 0){m.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},g}();a.minProbeByteLength=188;function n(g,_,E,b){return{key:g,frame:!1,pts:_,dts:E,units:[],debug:b,length:0}}function l(g,_){return(g[_+10]&31)<<8|g[_+11]}function s(g,_,E,b){var c={audio:-1,avc:-1,id3:-1,isAAC:!0},i=(g[_+1]&15)<<8|g[_+2],d=_+3+i-4,h=(g[_+10]&15)<<8|g[_+11];for(_+=12+h;_<d;){var y=(g[_+1]&31)<<8|g[_+2];switch(g[_]){case 207:if(!b){m.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=y);break;case 21:c.id3===-1&&(c.id3=y);break;case 219:if(!b){m.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=y);break;case 3:case 4:E?c.audio===-1&&(c.audio=y,c.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}_+=((g[_+3]&15)<<8|g[_+4])+5}return c}function e(g){var _=0,E,b,c,i,d,h=g.data;if(!g||g.size===0)return null;for(;h[0].length<19&&h.length>1;){var y=new Uint8Array(h[0].length+h[1].length);y.set(h[0]),y.set(h[1],h[0].length),h[0]=y,h.splice(1,1)}E=h[0];var v=(E[0]<<16)+(E[1]<<8)+E[2];if(v===1){if(b=(E[4]<<8)+E[5],b&&b>g.size-6)return null;var x=E[7];x&192&&(i=(E[9]&14)*536870912+(E[10]&255)*4194304+(E[11]&254)*16384+(E[12]&255)*128+(E[13]&254)/2,x&64?(d=(E[14]&14)*536870912+(E[15]&255)*4194304+(E[16]&254)*16384+(E[17]&255)*128+(E[18]&254)/2,i-d>60*9e4&&(m.logger.warn(Math.round((i-d)/9e4)+"s delta between PTS and DTS, align them"),i=d)):d=i),c=E[8];var k=c+9;if(g.size<=k)return null;g.size-=k;for(var R=new Uint8Array(g.size),U=0,N=h.length;U<N;U++){E=h[U];var G=E.byteLength;if(k)if(k>G){k-=G;continue}else E=E.subarray(k),G-=k,k=0;R.set(E,_),_+=G}return b&&(b-=c+3),{data:R,pts:i,dts:d,len:b}}return null}function t(g,_){if(g.units.length&&g.frame){if(g.pts===void 0){var E=_.samples,b=E.length;if(b){var c=E[b-1];g.pts=c.pts,g.dts=c.dts}else{_.dropped++;return}}_.samples.push(g)}g.debug.length&&m.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function r(g,_){var E=g.length;if(E>0){if(_.pts>=g[E-1].pts)g.push(_);else for(var b=E-1;b>=0;b--)if(_.pts<g[b].pts){g.splice(b,0,_);break}}else g.push(_)}function T(g){for(var _=g.byteLength,E=[],b=1;b<_-2;)g[b]===0&&g[b+1]===0&&g[b+2]===3?(E.push(b+2),b+=2):b++;if(E.length===0)return g;var c=_-E.length,i=new Uint8Array(c),d=0;for(b=0;b<c;d++,b++)d===E[0]&&(d++,E.shift()),i[b]=g[d];return i}W.default=a},"./src/errors.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"ErrorTypes",function(){return j}),w.d(W,"ErrorDetails",function(){return I});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 I;(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"})(I||(I={}))},"./src/events.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"Events",function(){return j});var j;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(j||(j={}))},"./src/hls.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return g});var j=w("./node_modules/url-toolkit/src/url-toolkit.js"),I=w.n(j),A=w("./src/loader/playlist-loader.ts"),F=w("./src/loader/key-loader.ts"),M=w("./src/controller/id3-track-controller.ts"),O=w("./src/controller/latency-controller.ts"),S=w("./src/controller/level-controller.ts"),m=w("./src/controller/fragment-tracker.ts"),p=w("./src/controller/stream-controller.ts"),o=w("./src/is-supported.ts"),a=w("./src/utils/logger.ts"),n=w("./src/config.ts"),l=w("./node_modules/eventemitter3/index.js"),s=w.n(l),e=w("./src/events.ts"),t=w("./src/errors.ts");function r(_,E){for(var b=0;b<E.length;b++){var c=E[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(_,c.key,c)}}function T(_,E,b){return E&&r(_.prototype,E),b&&r(_,b),_}var g=function(){_.isSupported=function(){return Object(o.isSupported)()};function _(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new l.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 c=this.config=Object(n.mergeConfig)(_.DefaultConfig,b);this.userConfig=b,Object(a.enableLogs)(c.debug),this._autoLevelCapping=-1,c.progressive&&Object(n.enableStreamingMode)(c);var i=c.abrController,d=c.bufferController,h=c.capLevelController,y=c.fpsController,v=this.abrController=new i(this),x=this.bufferController=new d(this),k=this.capLevelController=new h(this),R=new y(this),U=new A.default(this),N=new F.default(this),G=new M.default(this),L=this.levelController=new S.default(this),H=new m.FragmentTracker(this),V=this.streamController=new p.default(this,H);k.setStreamController(V),R.setStreamController(V);var $=[L,V];this.networkControllers=$;var q=[U,N,v,x,k,R,G,H];this.audioTrackController=this.createController(c.audioTrackController,null,$),this.createController(c.audioStreamController,H,$),this.subtitleTrackController=this.createController(c.subtitleTrackController,null,$),this.createController(c.subtitleStreamController,H,$),this.createController(c.timelineController,null,q),this.emeController=this.createController(c.emeController,null,q),this.cmcdController=this.createController(c.cmcdController,null,q),this.latencyController=this.createController(O.default,null,q),this.coreComponents=q}var E=_.prototype;return E.createController=function(c,i,d){if(c){var h=i?new c(this,i):new c(this);return d&&d.push(h),h}return null},E.on=function(c,i,d){d===void 0&&(d=this),this._emitter.on(c,i,d)},E.once=function(c,i,d){d===void 0&&(d=this),this._emitter.once(c,i,d)},E.removeAllListeners=function(c){this._emitter.removeAllListeners(c)},E.off=function(c,i,d,h){d===void 0&&(d=this),this._emitter.off(c,i,d,h)},E.listeners=function(c){return this._emitter.listeners(c)},E.emit=function(c,i,d){return this._emitter.emit(c,i,d)},E.trigger=function(c,i){if(this.config.debug)return this.emit(c,c,i);try{return this.emit(c,c,i)}catch(d){a.logger.error("An internal error happened while handling event "+c+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(e.Events.ERROR,{type:t.ErrorTypes.OTHER_ERROR,details:t.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:c,error:d})}return!1},E.listenerCount=function(c){return this._emitter.listenerCount(c)},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(c){return c.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(c){return c.destroy()}),this.coreComponents.length=0},E.attachMedia=function(c){a.logger.log("attachMedia"),this._media=c,this.trigger(e.Events.MEDIA_ATTACHING,{media:c})},E.detachMedia=function(){a.logger.log("detachMedia"),this.trigger(e.Events.MEDIA_DETACHING,void 0),this._media=null},E.loadSource=function(c){this.stopLoad();var i=this.media,d=this.url,h=this.url=j.buildAbsoluteURL(self.location.href,c,{alwaysNormalize:!0});a.logger.log("loadSource:"+h),i&&d&&d!==h&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(i)),this.trigger(e.Events.MANIFEST_LOADING,{url:c})},E.startLoad=function(c){c===void 0&&(c=-1),a.logger.log("startLoad("+c+")"),this.networkControllers.forEach(function(i){i.startLoad(c)})},E.stopLoad=function(){a.logger.log("stopLoad"),this.networkControllers.forEach(function(c){c.stopLoad()})},E.swapAudioCodec=function(){a.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},E.recoverMediaError=function(){a.logger.log("recoverMediaError");var c=this._media;this.detachMedia(),c&&this.attachMedia(c)},E.removeLevel=function(c,i){i===void 0&&(i=0),this.levelController.removeLevel(c,i)},T(_,[{key:"levels",get:function(){var c=this.levelController.levels;return c||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(c){a.logger.log("set currentLevel:"+c),this.loadLevel=c,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(c){a.logger.log("set nextLevel:"+c),this.levelController.manualLevel=c,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(c){a.logger.log("set loadLevel:"+c),this.levelController.manualLevel=c}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(c){this.levelController.nextLoadLevel=c}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(c){a.logger.log("set firstLevel:"+c),this.levelController.firstLevel=c}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(c){a.logger.log("set startLevel:"+c),c!==-1&&(c=Math.max(c,this.minAutoLevel)),this.levelController.startLevel=c}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(c){var i=!!c;i!==this.config.capLevelToPlayerSize&&(i?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=i)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(c){this._autoLevelCapping!==c&&(a.logger.log("set autoLevelCapping:"+c),this._autoLevelCapping=c)}},{key:"bandwidthEstimate",get:function(){var c=this.abrController.bwEstimator;return c?c.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var c=this.levels,i=this.config.minAutoBitrate;if(!c)return 0;for(var d=c.length,h=0;h<d;h++)if(c[h].maxBitrate>i)return h;return 0}},{key:"maxAutoLevel",get:function(){var c=this.levels,i=this.autoLevelCapping,d;return i===-1&&c&&c.length?d=c.length-1:d=i,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(c){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,c)}},{key:"audioTracks",get:function(){var c=this.audioTrackController;return c?c.audioTracks:[]}},{key:"audioTrack",get:function(){var c=this.audioTrackController;return c?c.audioTrack:-1},set:function(c){var i=this.audioTrackController;i&&(i.audioTrack=c)}},{key:"subtitleTracks",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTrack:-1},set:function(c){var i=this.subtitleTrackController;i&&(i.subtitleTrack=c)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var c=this.subtitleTrackController;return c?c.subtitleDisplay:!1},set:function(c){var i=this.subtitleTrackController;i&&(i.subtitleDisplay=c)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(c){this.config.lowLatencyMode=c}},{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 _.defaultConfig?_.defaultConfig:n.hlsDefaultConfig},set:function(c){_.defaultConfig=c}}]),_}();g.defaultConfig=void 0},"./src/is-supported.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"isSupported",function(){return A}),w.d(W,"changeTypeSupported",function(){return F});var j=w("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function A(){var M=Object(j.getMediaSource)();if(!M)return!1;var O=I(),S=M&&typeof M.isTypeSupported=="function"&&M.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),m=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!S&&!!m}function F(){var M,O=I();return typeof(O==null||((M=O.prototype)===null||M===void 0)?void 0:M.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return a}),w.d(W,"LoadError",function(){return l});var j=w("./src/polyfills/number.ts"),I=w("./src/errors.ts");function A(s,e){s.prototype=Object.create(e.prototype),s.prototype.constructor=s,m(s,e)}function F(s){var e=typeof Map=="function"?new Map:void 0;return F=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,p(this).constructor)}return T.prototype=Object.create(r.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),m(T,r)},F(s)}function M(s,e,t){return O()?M=Reflect.construct:M=function(T,g,_){var E=[null];E.push.apply(E,g);var b=Function.bind.apply(T,E),c=new b;return _&&m(c,_.prototype),c},M.apply(null,arguments)}function O(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(s){return!1}}function S(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function m(s,e){return m=Object.setPrototypeOf||function(r,T){return r.__proto__=T,r},m(s,e)}function p(s){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},p(s)}var o=Math.pow(2,17),a=function(){function s(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}var e=s.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 g=this,_=r.url;if(!_)return Promise.reject(new l({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:r,networkDetails:null},"Fragment does not have a "+(_?"part list":"url")));this.abort();var E=this.config,b=E.fLoader,c=E.loader;return new Promise(function(i,d){g.loader&&g.loader.destroy();var h=g.loader=r.loader=b?new b(E):new c(E),y=n(r),v={timeout:E.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:E.fragLoadingMaxRetryTimeout,highWaterMark:o};r.stats=h.stats,h.load(y,v,{onSuccess:function(k,R,U,N){g.resetLoader(r,h),i({frag:r,part:null,payload:k.data,networkDetails:N})},onError:function(k,R,U){g.resetLoader(r,h),d(new l({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:r,response:k,networkDetails:U}))},onAbort:function(k,R,U){g.resetLoader(r,h),d(new l({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:r,networkDetails:U}))},onTimeout:function(k,R,U){g.resetLoader(r,h),d(new l({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:r,networkDetails:U}))},onProgress:function(k,R,U,N){T&&T({frag:r,part:null,payload:U,networkDetails:N})}})})},e.loadPart=function(r,T,g){var _=this;this.abort();var E=this.config,b=E.fLoader,c=E.loader;return new Promise(function(i,d){_.loader&&_.loader.destroy();var h=_.loader=r.loader=b?new b(E):new c(E),y=n(r,T),v={timeout:E.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:E.fragLoadingMaxRetryTimeout,highWaterMark:o};T.stats=h.stats,h.load(y,v,{onSuccess:function(k,R,U,N){_.resetLoader(r,h),_.updateStatsFromPart(r,T);var G={frag:r,part:T,payload:k.data,networkDetails:N};g(G),i(G)},onError:function(k,R,U){_.resetLoader(r,h),d(new l({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:r,part:T,response:k,networkDetails:U}))},onAbort:function(k,R,U){r.stats.aborted=T.stats.aborted,_.resetLoader(r,h),d(new l({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:r,part:T,networkDetails:U}))},onTimeout:function(k,R,U){_.resetLoader(r,h),d(new l({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:r,part:T,networkDetails:U}))}})})},e.updateStatsFromPart=function(r,T){var g=r.stats,_=T.stats,E=_.total;if(g.loaded+=_.loaded,E){var b=Math.round(r.duration/T.duration),c=Math.min(Math.round(g.loaded/E),b),i=b-c,d=i*Math.round(g.loaded/c);g.total=g.loaded+d}else g.total=Math.max(g.loaded,g.total);var h=g.loading,y=_.loading;h.start?h.first+=y.first-y.start:(h.start=y.start,h.first=y.first),h.end=y.end},e.resetLoader=function(r,T){r.loader=null,this.loader===T&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),T.destroy()},s}();function n(s,e){e===void 0&&(e=null);var t=e||s,r={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},T=t.byteRangeStartOffset,g=t.byteRangeEndOffset;return Object(j.isFiniteNumber)(T)&&Object(j.isFiniteNumber)(g)&&(r.rangeStart=T,r.rangeEnd=g),r}var l=function(s){A(e,s);function e(t){for(var r,T=arguments.length,g=new Array(T>1?T-1:0),_=1;_<T;_++)g[_-1]=arguments[_];return r=s.call.apply(s,[this].concat(g))||this,r.data=void 0,r.data=t,r}return e}(F(Error))},"./src/loader/fragment.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"ElementaryStreamTypes",function(){return a}),w.d(W,"BaseSegment",function(){return n}),w.d(W,"Fragment",function(){return l}),w.d(W,"Part",function(){return s});var j=w("./src/polyfills/number.ts"),I=w("./node_modules/url-toolkit/src/url-toolkit.js"),A=w.n(I),F=w("./src/utils/logger.ts"),M=w("./src/loader/level-key.ts"),O=w("./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,g){return T.__proto__=g,T},m(e,t)}function p(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 o(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),e}var a;(function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"})(a||(a={}));var n=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,g){var _=T.split("@",2),E=[];_.length===1?E[0]=g?g.byteRangeEndOffset:0:E[0]=parseInt(_[1]),E[1]=parseInt(_[0])+E[0],this._byteRange=E},o(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(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(T){this._url=T}}]),e}(),l=function(e){S(t,e);function t(T,g){var _;return _=e.call(this,g)||this,_._decryptdata=null,_.rawProgramDateTime=null,_.programDateTime=null,_.tagList=[],_.duration=0,_.sn=0,_.levelkey=void 0,_.type=void 0,_.loader=null,_.level=-1,_.cc=0,_.startPTS=void 0,_.endPTS=void 0,_.appendedPTS=void 0,_.startDTS=void 0,_.endDTS=void 0,_.start=0,_.deltaPTS=void 0,_.maxStartPTS=void 0,_.minEndPTS=void 0,_.stats=new O.LoadStats,_.urlId=0,_.data=void 0,_.bitrateTest=!1,_.title=null,_.initSegment=null,_.type=T,_}var r=t.prototype;return r.createInitializationVector=function(g){for(var _=new Uint8Array(16),E=12;E<16;E++)_[E]=g>>8*(15-E)&255;return _},r.setDecryptDataFromLevelKey=function(g,_){var E=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(E=M.LevelKey.fromURI(g.uri),E.method=g.method,E.iv=this.createInitializationVector(_),E.keyFormat="identity"),E},r.setElementaryStreamInfo=function(g,_,E,b,c,i){i===void 0&&(i=!1);var d=this.elementaryStreams,h=d[g];if(!h){d[g]={startPTS:_,endPTS:E,startDTS:b,endDTS:c,partial:i};return}h.startPTS=Math.min(h.startPTS,_),h.endPTS=Math.max(h.endPTS,E),h.startDTS=Math.min(h.startDTS,b),h.endDTS=Math.max(h.endDTS,c)},r.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[a.AUDIO]=null,g[a.VIDEO]=null,g[a.AUDIOVIDEO]=null},o(t,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&F.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}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 g=Object(j.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),t}(n),s=function(e){S(t,e);function t(r,T,g,_,E){var b;b=e.call(this,g)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new O.LoadStats,b.duration=r.decimalFloatingPoint("DURATION"),b.gap=r.bool("GAP"),b.independent=r.bool("INDEPENDENT"),b.relurl=r.enumeratedString("URI"),b.fragment=T,b.index=_;var c=r.enumeratedString("BYTERANGE");return c&&b.setByteRange(c,E),E&&(b.fragOffset=E.fragOffset+E.duration),b}return o(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}(n)},"./src/loader/key-loader.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return F});var j=w("./src/events.ts"),I=w("./src/errors.ts"),A=w("./src/utils/logger.ts"),F=function(){function M(S){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=S,this._registerListeners()}var O=M.prototype;return O._registerListeners=function(){this.hls.on(j.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(j.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var m in this.loaders){var p=this.loaders[m];p&&p.destroy()}this.loaders={}},O.onKeyLoading=function(m,p){var o=p.frag,a=o.type,n=this.loaders[a];if(!o.decryptdata){A.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var l=o.decryptdata.uri;if(l!==this.decrypturl||this.decryptkey===null){var s=this.hls.config;if(n&&(A.logger.warn("abort previous key loader for type:"+a),n.abort()),!l){A.logger.warn("key uri is falsy");return}var e=s.loader,t=o.loader=this.loaders[a]=new e(s);this.decrypturl=l,this.decryptkey=null;var r={url:l,frag:o,responseType:"arraybuffer"},T={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};t.load(r,T,g)}else this.decryptkey&&(o.decryptdata.key=this.decryptkey,this.hls.trigger(j.Events.KEY_LOADED,{frag:o}))},O.loadsuccess=function(m,p,o){var a=o.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})},O.loaderror=function(m,p){var o=p.frag,a=o.loader;a&&a.abort(),delete this.loaders[o.type],this.hls.trigger(j.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:o,response:m})},O.loadtimeout=function(m,p){var o=p.frag,a=o.loader;a&&a.abort(),delete this.loaders[o.type],this.hls.trigger(j.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:o})},M}()},"./src/loader/level-details.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"LevelDetails",function(){return M});var j=w("./src/polyfills/number.ts");function I(O,S){for(var m=0;m<S.length;m++){var p=S[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(O,p.key,p)}}function A(O,S,m){return S&&I(O.prototype,S),m&&I(O,m),O}var F=10,M=function(){function O(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=O.prototype;return S.reloaded=function(p){if(!p){this.advanced=!0,this.updated=!0;return}var o=this.lastPartSn-p.lastPartSn,a=this.lastPartIndex-p.lastPartIndex;this.updated=this.endSN!==p.endSN||!!a||!!o,this.advanced=this.endSN>p.endSN||o>0||o===0&&a>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},A(O,[{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||F}},{key:"drift",get:function(){var p=this.driftEndTime-this.driftStartTime;if(p>0){var o=this.driftEnd-this.driftStart;return o*1e3/p}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var p;return(p=this.fragments)!==null&&p!==void 0&&p.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"LevelKey",function(){return M});var j=w("./node_modules/url-toolkit/src/url-toolkit.js"),I=w.n(j);function A(O,S){for(var m=0;m<S.length;m++){var p=S[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(O,p.key,p)}}function F(O,S,m){return S&&A(O.prototype,S),m&&A(O,m),O}var M=function(){O.fromURL=function(m,p){return new O(m,p)},O.fromURI=function(m){return new O(m)};function O(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 F(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"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(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return t});var j=w("./src/polyfills/number.ts"),I=w("./node_modules/url-toolkit/src/url-toolkit.js"),A=w.n(I),F=w("./src/loader/fragment.ts"),M=w("./src/loader/level-details.ts"),O=w("./src/loader/level-key.ts"),S=w("./src/utils/attr-list.ts"),m=w("./src/utils/logger.ts"),p=w("./src/utils/codecs.ts"),o=/#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,n=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),l=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),s=/\.(mp4|m4s|m4v|m4a)$/i;function e(E){var b,c;return s.test((b=(c=I.parseURL(E))===null||c===void 0?void 0:c.path)!=null?b:"")}var t=function(){function E(){}return E.findGroup=function(c,i){for(var d=0;d<c.length;d++){var h=c[d];if(h.id===i)return h}},E.convertAVC1ToAVCOTI=function(c){var i=c.split(".");if(i.length>2){var d=i.shift()+".";return d+=parseInt(i.shift()).toString(16),d+=("000"+parseInt(i.shift()).toString(16)).substr(-4),d}return c},E.resolve=function(c,i){return I.buildAbsoluteURL(i,c,{alwaysNormalize:!0})},E.parseMasterPlaylist=function(c,i){var d=[],h={},y=!1;o.lastIndex=0;for(var v;(v=o.exec(c))!=null;)if(v[1]){var x=new S.AttrList(v[1]),k={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:E.resolve(v[2],i)},R=x.decimalResolution("RESOLUTION");R&&(k.width=R.width,k.height=R.height),r((x.CODECS||"").split(/[ ,]+/).filter(function(N){return N}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=E.convertAVC1ToAVCOTI(k.videoCodec)),d.push(k)}else if(v[3]){var U=new S.AttrList(v[3]);U["DATA-ID"]&&(y=!0,h[U["DATA-ID"]]=U)}return{levels:d,sessionData:y?h:null}},E.parseMasterPlaylistMedia=function(c,i,d,h){h===void 0&&(h=[]);var y,v=[],x=0;for(a.lastIndex=0;(y=a.exec(c))!==null;){var k=new S.AttrList(y[1]);if(k.TYPE===d){var R={attrs:k,bitrate:0,id:x++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:d,default:k.bool("DEFAULT"),autoselect:k.bool("AUTOSELECT"),forced:k.bool("FORCED"),lang:k.LANGUAGE,url:k.URI?E.resolve(k.URI,i):""};if(h.length){var U=E.findGroup(h,R.groupId)||h[0];T(R,U,"audioCodec"),T(R,U,"textCodec")}v.push(R)}}return v},E.parseLevelPlaylist=function(c,i,d,h,y){var v=new M.LevelDetails(i),x=v.fragments,k=null,R=0,U=0,N=0,G=0,L=null,H=new F.Fragment(h,i),V,$,q,he=-1,ae=!1;for(n.lastIndex=0,v.m3u8=c;(V=n.exec(c))!==null;){ae&&(ae=!1,H=new F.Fragment(h,i),H.start=N,H.sn=R,H.cc=G,H.level=d,k&&(H.initSegment=k,H.rawProgramDateTime=k.rawProgramDateTime));var oe=V[1];if(oe){H.duration=parseFloat(oe);var ue=(" "+V[2]).slice(1);H.title=ue||null,H.tagList.push(ue?["INF",oe,ue]:["INF",oe])}else if(V[3])Object(j.isFiniteNumber)(H.duration)&&(H.start=N,q&&(H.levelkey=q),H.sn=R,H.level=d,H.cc=G,H.urlId=y,x.push(H),H.relurl=(" "+V[3]).slice(1),_(H,L),L=H,N+=H.duration,R++,U=0,ae=!0);else if(V[4]){var de=(" "+V[4]).slice(1);L?H.setByteRange(de,L):H.setByteRange(de)}else if(V[5])H.rawProgramDateTime=(" "+V[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),he===-1&&(he=x.length);else{if(V=V[0].match(l),!V){m.logger.warn("No matches on slow regex match for level playlist!");continue}for($=1;$<V.length&&!(typeof V[$]!="undefined");$++);var ie=(" "+V[$]).slice(1),X=(" "+V[$+1]).slice(1),Se=V[$+2]?(" "+V[$+2]).slice(1):"";switch(ie){case"PLAYLIST-TYPE":v.type=X.toUpperCase();break;case"MEDIA-SEQUENCE":R=v.startSN=parseInt(X);break;case"SKIP":{var Ie=new S.AttrList(X),Ae=Ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(j.isFiniteNumber)(Ae)){v.skippedSegments=Ae;for(var je=Ae;je--;)x.unshift(null);R+=Ae}var He=Ie.enumeratedString("RECENTLY-REMOVED-DATERANGES");He&&(v.recentlyRemovedDateranges=He.split(" "));break}case"TARGETDURATION":v.targetduration=parseFloat(X);break;case"VERSION":v.version=parseInt(X);break;case"EXTM3U":break;case"ENDLIST":v.live=!1;break;case"#":(X||Se)&&H.tagList.push(Se?[X,Se]:[X]);break;case"DIS":G++;case"GAP":H.tagList.push([ie]);break;case"BITRATE":H.tagList.push([ie,X]);break;case"DISCONTINUITY-SEQ":G=parseInt(X);break;case"KEY":{var pe,we=new S.AttrList(X),Ee=we.enumeratedString("METHOD"),me=we.URI,ye=we.hexadecimalInteger("IV"),ve=we.enumeratedString("KEYFORMATVERSIONS"),be=we.enumeratedString("KEYID"),Ke=(pe=we.enumeratedString("KEYFORMAT"))!=null?pe:"identity",De=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(De.indexOf(Ke)>-1){m.logger.warn("Keyformat "+Ke+" is not supported from the manifest");continue}else if(Ke!=="identity")continue;Ee&&(q=O.LevelKey.fromURL(i,me),me&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ee)>=0&&(q.method=Ee,q.keyFormat=Ke,be&&(q.keyID=be),ve&&(q.keyFormatVersions=ve),q.iv=ye));break}case"START":{var ke=new S.AttrList(X),Fe=ke.decimalFloatingPoint("TIME-OFFSET");Object(j.isFiniteNumber)(Fe)&&(v.startTimeOffset=Fe);break}case"MAP":{var re=new S.AttrList(X);H.relurl=re.URI,re.BYTERANGE&&H.setByteRange(re.BYTERANGE),H.level=d,H.sn="initSegment",q&&(H.levelkey=q),H.initSegment=null,k=H,ae=!0;break}case"SERVER-CONTROL":{var Be=new S.AttrList(X);v.canBlockReload=Be.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=Be.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&Be.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=Be.optionalFloat("PART-HOLD-BACK",0),v.holdBack=Be.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Oe=new S.AttrList(X);v.partTarget=Oe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Re=v.partList;Re||(Re=v.partList=[]);var Ge=U>0?Re[Re.length-1]:void 0,Le=U++,le=new F.Part(new S.AttrList(X),H,i,Le,Ge);Re.push(le),H.duration+=le.duration;break}case"PRELOAD-HINT":{var Te=new S.AttrList(X);v.preloadHint=Te;break}case"RENDITION-REPORT":{var te=new S.AttrList(X);v.renditionReports=v.renditionReports||[],v.renditionReports.push(te);break}default:m.logger.warn("line parsed but not handled: "+V);break}}}L&&!L.relurl?(x.pop(),N-=L.duration,v.partList&&(v.fragmentHint=L)):v.partList&&(_(H,L),H.cc=G,v.fragmentHint=H);var J=x.length,ee=x[0],K=x[J-1];if(N+=v.skippedSegments*v.targetduration,N>0&&J&&K){v.averagetargetduration=N/J;var z=K.sn;v.endSN=z!=="initSegment"?z:0,ee&&(v.startCC=ee.cc,ee.initSegment||v.fragments.every(function(Y){return Y.relurl&&e(Y.relurl)})&&(m.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new F.Fragment(h,i),H.relurl=K.relurl,H.level=d,H.sn="initSegment",ee.initSegment=H,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(N+=v.fragmentHint.duration),v.totalduration=N,v.endCC=G,he>0&&g(x,he),v},E}();function r(E,b){["video","audio","text"].forEach(function(c){var i=E.filter(function(h){return Object(p.isCodecType)(h,c)});if(i.length){var d=i.filter(function(h){return h.lastIndexOf("avc1",0)===0||h.lastIndexOf("mp4a",0)===0});b[c+"Codec"]=d.length>0?d[0]:i[0],E=E.filter(function(h){return i.indexOf(h)===-1})}}),b.unknownCodecs=E}function T(E,b,c){var i=b[c];i&&(E[c]=i)}function g(E,b){for(var c=E[b],i=b;i--;){var d=E[i];if(!d)return;d.programDateTime=c.programDateTime-d.duration*1e3,c=d}}function _(E,b){E.rawProgramDateTime?E.programDateTime=Date.parse(E.rawProgramDateTime):b!=null&&b.programDateTime&&(E.programDateTime=b.endProgramDateTime),Object(j.isFiniteNumber)(E.programDateTime)||(E.programDateTime=null,E.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/polyfills/number.ts"),I=w("./src/events.ts"),A=w("./src/errors.ts"),F=w("./src/utils/logger.ts"),M=w("./src/utils/mp4-tools.ts"),O=w("./src/loader/m3u8-parser.ts"),S=w("./src/types/loader.ts"),m=w("./src/utils/attr-list.ts");function p(n){var l=n.type;switch(l){case S.PlaylistContextType.AUDIO_TRACK:return S.PlaylistLevelType.AUDIO;case S.PlaylistContextType.SUBTITLE_TRACK:return S.PlaylistLevelType.SUBTITLE;default:return S.PlaylistLevelType.MAIN}}function o(n,l){var s=n.url;return(s===void 0||s.indexOf("data:")===0)&&(s=l.url),s}var a=function(){function n(s){this.hls=void 0,this.loaders=Object.create(null),this.hls=s,this.registerListeners()}var l=n.prototype;return l.registerListeners=function(){var e=this.hls;e.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},l.unregisterListeners=function(){var e=this.hls;e.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},l.createInternalLoader=function(e){var t=this.hls.config,r=t.pLoader,T=t.loader,g=r||T,_=new g(t);return e.loader=_,this.loaders[e.type]=_,_},l.getInternalLoader=function(e){return this.loaders[e.type]},l.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},l.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},l.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},l.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})},l.onLevelLoading=function(e,t){var r=t.id,T=t.level,g=t.url,_=t.deliveryDirectives;this.load({id:r,groupId:null,level:T,responseType:"text",type:S.PlaylistContextType.LEVEL,url:g,deliveryDirectives:_})},l.onAudioTrackLoading=function(e,t){var r=t.id,T=t.groupId,g=t.url,_=t.deliveryDirectives;this.load({id:r,groupId:T,level:null,responseType:"text",type:S.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:_})},l.onSubtitleTrackLoading=function(e,t){var r=t.id,T=t.groupId,g=t.url,_=t.deliveryDirectives;this.load({id:r,groupId:T,level:null,responseType:"text",type:S.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:_})},l.load=function(e){var t,r=this.hls.config,T=this.getInternalLoader(e);if(T){var g=T.context;if(g&&g.url===e.url){F.logger.trace("[playlist-loader]: playlist request ongoing");return}F.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),T.abort()}var _,E,b,c;switch(e.type){case S.PlaylistContextType.MANIFEST:_=r.manifestLoadingMaxRetry,E=r.manifestLoadingTimeOut,b=r.manifestLoadingRetryDelay,c=r.manifestLoadingMaxRetryTimeout;break;case S.PlaylistContextType.LEVEL:case S.PlaylistContextType.AUDIO_TRACK:case S.PlaylistContextType.SUBTITLE_TRACK:_=0,E=r.levelLoadingTimeOut;break;default:_=r.levelLoadingMaxRetry,E=r.levelLoadingTimeOut,b=r.levelLoadingRetryDelay,c=r.levelLoadingMaxRetryTimeout;break}if(T=this.createInternalLoader(e),(t=e.deliveryDirectives)!==null&&t!==void 0&&t.part){var i;if(e.type===S.PlaylistContextType.LEVEL&&e.level!==null?i=this.hls.levels[e.level].details:e.type===S.PlaylistContextType.AUDIO_TRACK&&e.id!==null?i=this.hls.audioTracks[e.id].details:e.type===S.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(i=this.hls.subtitleTracks[e.id].details),i){var d=i.partTarget,h=i.targetduration;d&&h&&(E=Math.min(Math.max(d*3,h*.8)*1e3,E))}}var y={timeout:E,maxRetry:_,retryDelay:b,maxRetryDelay:c,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};T.load(e,y,v)},l.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 g=e.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(e,r,"no EXTM3U delimiter",T);return}t.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,r,T):this.handleMasterPlaylist(e,t,r,T)},l.loaderror=function(e,t,r){r===void 0&&(r=null),this.handleNetworkError(t,r,!1,e)},l.loadtimeout=function(e,t,r){r===void 0&&(r=null),this.handleNetworkError(t,r,!0)},l.handleMasterPlaylist=function(e,t,r,T){var g=this.hls,_=e.data,E=o(e,r),b=O.default.parseMasterPlaylist(_,E),c=b.levels,i=b.sessionData;if(!c.length){this.handleManifestParsingError(e,r,"no level found in manifest",T);return}var d=c.map(function(R){return{id:R.attrs.AUDIO,audioCodec:R.audioCodec}}),h=c.map(function(R){return{id:R.attrs.SUBTITLES,textCodec:R.textCodec}}),y=O.default.parseMasterPlaylistMedia(_,E,"AUDIO",d),v=O.default.parseMasterPlaylistMedia(_,E,"SUBTITLES",h),x=O.default.parseMasterPlaylistMedia(_,E,"CLOSED-CAPTIONS");if(y.length){var k=y.some(function(R){return!R.url});!k&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(F.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new m.AttrList({}),bitrate:0,url:""}))}g.trigger(I.Events.MANIFEST_LOADED,{levels:c,audioTracks:y,subtitles:v,captions:x,url:E,stats:t,networkDetails:T,sessionData:i})},l.handleTrackOrLevelPlaylist=function(e,t,r,T){var g=this.hls,_=r.id,E=r.level,b=r.type,c=o(e,r),i=Object(j.isFiniteNumber)(_)?_:0,d=Object(j.isFiniteNumber)(E)?E:i,h=p(r),y=O.default.parseLevelPlaylist(e.data,c,d,h,i);if(!y.fragments.length){g.trigger(I.Events.ERROR,{type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:c,reason:"no fragments found in level",level:typeof r.level=="number"?r.level:void 0});return}if(b===S.PlaylistContextType.MANIFEST){var v={attrs:new m.AttrList({}),bitrate:0,details:y,name:"",url:c};g.trigger(I.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:c,stats:t,networkDetails:T,sessionData:null})}if(t.parsing.end=performance.now(),y.needSidxRanges){var x,k=(x=y.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:k,isSidxRequest:!0,type:b,level:E,levelDetails:y,id:_,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}r.levelDetails=y,this.handlePlaylistLoaded(e,t,r,T)},l.handleSidxRequest=function(e,t){var r=Object(M.parseSegmentIndex)(new Uint8Array(e.data));if(!r)return;var T=r.references,g=t.levelDetails;T.forEach(function(_,E){var b=_.info,c=g.fragments[E];c.byteRange.length===0&&c.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),c.initSegment&&c.initSegment.setByteRange(String(r.moovEndOffset)+"@0")})},l.handleManifestParsingError=function(e,t,r,T){this.hls.trigger(I.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})},l.handleNetworkError=function(e,t,r,T){r===void 0&&(r=!1),F.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 g=A.ErrorDetails.UNKNOWN,_=!1,E=this.getInternalLoader(e);switch(e.type){case S.PlaylistContextType.MANIFEST:g=r?A.ErrorDetails.MANIFEST_LOAD_TIMEOUT:A.ErrorDetails.MANIFEST_LOAD_ERROR,_=!0;break;case S.PlaylistContextType.LEVEL:g=r?A.ErrorDetails.LEVEL_LOAD_TIMEOUT:A.ErrorDetails.LEVEL_LOAD_ERROR,_=!1;break;case S.PlaylistContextType.AUDIO_TRACK:g=r?A.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:A.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,_=!1;break;case S.PlaylistContextType.SUBTITLE_TRACK:g=r?A.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:A.ErrorDetails.SUBTITLE_LOAD_ERROR,_=!1;break}E&&this.resetInternalLoader(e.type);var b={type:A.ErrorTypes.NETWORK_ERROR,details:g,fatal:_,url:e.url,loader:E,context:e,networkDetails:t};T&&(b.response=T),this.hls.trigger(I.Events.ERROR,b)},l.handlePlaylistLoaded=function(e,t,r,T){var g=r.type,_=r.level,E=r.id,b=r.groupId,c=r.loader,i=r.levelDetails,d=r.deliveryDirectives;if(!(i!=null&&i.targetduration)){this.handleManifestParsingError(e,r,"invalid target duration",T);return}if(!c)return;i.live&&(c.getCacheAge&&(i.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(i.ageHeader))&&(i.ageHeader=0));switch(g){case S.PlaylistContextType.MANIFEST:case S.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:i,level:_||0,id:E||0,stats:t,networkDetails:T,deliveryDirectives:d});break;case S.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:i,id:E||0,groupId:b||"",stats:t,networkDetails:T,deliveryDirectives:d});break;case S.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:i,id:E||0,groupId:b||"",stats:t,networkDetails:T,deliveryDirectives:d});break}},n}();W.default=a},"./src/polyfills/number.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"isFiniteNumber",function(){return j}),w.d(W,"MAX_SAFE_INTEGER",function(){return I});var j=Number.isFinite||function(A){return typeof A=="number"&&isFinite(A)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ce,W,w){"use strict";w.r(W);var j=function(){function I(){}return I.getSilentFrame=function(F,M){switch(F){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},I}();W.default=j},"./src/remux/mp4-generator.ts":function(ce,W,w){"use strict";w.r(W);var j=Math.pow(2,32)-1,I=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 O=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:O,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]),p=new Uint8Array([0,0,0,0,0,0,0,0]);A.STTS=A.STSC=A.STCO=p,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 o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),n=new Uint8Array([0,0,0,1]);A.FTYP=A.box(A.types.ftyp,o,n,o,a),A.DINF=A.box(A.types.dinf,A.box(A.types.dref,m))},A.box=function(M){for(var O=8,S=arguments.length,m=new Array(S>1?S-1:0),p=1;p<S;p++)m[p-1]=arguments[p];for(var o=m.length,a=o;o--;)O+=m[o].byteLength;var n=new Uint8Array(O);for(n[0]=O>>24&255,n[1]=O>>16&255,n[2]=O>>8&255,n[3]=O&255,n.set(M,4),o=0,O=8;o<a;o++)n.set(m[o],O),O+=m[o].byteLength;return n},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,O){O*=M;var S=Math.floor(O/(j+1)),m=Math.floor(O%(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,O,S){return A.box(A.types.moof,A.mfhd(M),A.traf(S,O))},A.moov=function(M){for(var O=M.length,S=[];O--;)S[O]=A.trak(M[O]);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 O=M.length,S=[];O--;)S[O]=A.trex(M[O]);return A.box.apply(null,[A.types.mvex].concat(S))},A.mvhd=function(M,O){O*=M;var S=Math.floor(O/(j+1)),m=Math.floor(O%(j+1)),p=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,p)},A.sdtp=function(M){var O=M.samples||[],S=new Uint8Array(4+O.length),m,p;for(m=0;m<O.length;m++)p=O[m].flags,S[m+4]=p.dependsOn<<4|p.isDependedOn<<2|p.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 O=[],S=[],m,p,o;for(m=0;m<M.sps.length;m++)p=M.sps[m],o=p.byteLength,O.push(o>>>8&255),O.push(o&255),O=O.concat(Array.prototype.slice.call(p));for(m=0;m<M.pps.length;m++)p=M.pps[m],o=p.byteLength,S.push(o>>>8&255),S.push(o&255),S=S.concat(Array.prototype.slice.call(p));var a=A.box(A.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|M.sps.length].concat(O).concat([M.pps.length]).concat(S))),n=M.width,l=M.height,s=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,n>>8&255,n&255,l>>8&255,l&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([s>>24,s>>16&255,s>>8&255,s&255,e>>24,e>>16&255,e>>8&255,e&255])))},A.esds=function(M){var O=M.config.length;return new Uint8Array([0,0,0,0,3,23+O,0,1,0,4,15+O,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([O]).concat(M.config).concat([6,1,2]))},A.mp4a=function(M){var O=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,O>>8&255,O&255,0,0]),A.box(A.types.esds,A.esds(M)))},A.mp3=function(M){var O=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,O>>8&255,O&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 O=M.id,S=M.duration*M.timescale,m=M.width,p=M.height,o=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,O>>24&255,O>>16&255,O>>8&255,O&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&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,p>>8&255,p&255,0,0]))},A.traf=function(M,O){var S=A.sdtp(M),m=M.id,p=Math.floor(O/(j+1)),o=Math.floor(O%(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,p>>24,p>>16&255,p>>8&255,p&255,o>>24,o>>16&255,o>>8&255,o&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 O=M.id;return A.box(A.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},A.trun=function(M,O){var S=M.samples||[],m=S.length,p=12+16*m,o=new Uint8Array(p),a,n,l,s,e,t;for(O+=8+p,o.set([0,0,15,1,m>>>24&255,m>>>16&255,m>>>8&255,m&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),a=0;a<m;a++)n=S[a],l=n.duration,s=n.size,e=n.flags,t=n.cts,o.set([l>>>24&255,l>>>16&255,l>>>8&255,l&255,s>>>24&255,s>>>16&255,s>>>8&255,s&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,o)},A.initSegment=function(M){A.types||A.init();var O=A.moov(M),S=new Uint8Array(A.FTYP.byteLength+O.byteLength);return S.set(A.FTYP),S.set(O,A.FTYP.byteLength),S},A}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,W.default=I},"./src/remux/mp4-remuxer.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return t}),w.d(W,"normalizePts",function(){return r});var j=w("./src/polyfills/number.ts"),I=w("./src/remux/aac-helper.ts"),A=w("./src/remux/mp4-generator.ts"),F=w("./src/events.ts"),M=w("./src/errors.ts"),O=w("./src/utils/logger.ts"),S=w("./src/types/loader.ts"),m=w("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(E){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var i in c)Object.prototype.hasOwnProperty.call(c,i)&&(E[i]=c[i])}return E},p.apply(this,arguments)}var o=10*1e3,a=1024,n=1152,l=null,s=null,e=!1,t=function(){function E(c,i,d,h){if(h===void 0&&(h=""),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=c,this.config=i,this.typeSupported=d,this.ISGenerated=!1,l===null){var y=navigator.userAgent||"",v=y.match(/Chrome\/(\d+)/i);l=v?parseInt(v[1]):0}if(s===null){var x=navigator.userAgent.match(/Safari\/(\d+)/i);s=x?parseInt(x[1]):0}e=!!l&&l<75||!!s&&s<600}var b=E.prototype;return b.destroy=function(){},b.resetTimeStamp=function(i){O.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=i},b.resetNextTimestamp=function(){O.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){O.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(i){var d=!1,h=i.reduce(function(y,v){var x=v.pts-y;return x<-4294967296?(d=!0,r(y,v.pts)):x>0?y:v.pts},i[0].pts);return d&&O.logger.debug("PTS rollover detected"),h},b.remux=function(i,d,h,y,v,x,k,R){var U,N,G,L,H,V,$=v,q=v,he=i.pid>-1,ae=d.pid>-1,oe=d.samples.length,ue=i.samples.length>0,de=oe>1,ie=(!he||ue)&&(!ae||de)||this.ISGenerated||k;if(ie){this.ISGenerated||(G=this.generateIS(i,d,v));var X=this.isVideoContiguous,Se=-1;if(de&&(Se=T(d.samples),!X&&this.config.forceKeyFrameOnDiscontinuity))if(V=!0,Se>0){O.logger.warn("[mp4-remuxer]: Dropped "+Se+" out of "+oe+" video samples due to a missing keyframe");var Ie=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(Se),d.dropped+=Se,q+=(d.samples[0].pts-Ie)/(d.timescale||9e4)}else Se===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+oe+" video samples"),V=!1);if(this.ISGenerated){if(ue&&de){var Ae=this.getVideoStartPts(d.samples),je=r(i.samples[0].pts,Ae)-Ae,He=je/d.inputTimeScale;$+=Math.max(0,He),q+=Math.max(0,-He)}if(ue){if(i.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),G=this.generateIS(i,d,v)),N=this.remuxAudio(i,$,this.isAudioContiguous,x,ae||de||R===S.PlaylistLevelType.AUDIO?q:void 0),de){var pe=N?N.endPTS-N.startPTS:0;d.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),G=this.generateIS(i,d,v)),U=this.remuxVideo(d,q,X,pe)}}else de&&(U=this.remuxVideo(d,q,X,0));U&&(U.firstKeyFrame=Se,U.independent=Se!==-1)}}return this.ISGenerated&&(h.samples.length&&(H=this.remuxID3(h,v)),y.samples.length&&(L=this.remuxText(y,v))),{audio:N,video:U,initSegment:G,independent:V,text:L,id3:H}},b.generateIS=function(i,d,h){var y=i.samples,v=d.samples,x=this.typeSupported,k={},R=!Object(j.isFiniteNumber)(this._initPTS),U="audio/mp4",N,G,L;if(R&&(N=G=Infinity),i.config&&y.length&&(i.timescale=i.samplerate,i.isAAC||(x.mpeg?(U="audio/mpeg",i.codec=""):x.mp3&&(i.codec="mp3")),k.audio={id:"audio",container:U,codec:i.codec,initSegment:!i.isAAC&&x.mpeg?new Uint8Array(0):A.default.initSegment([i]),metadata:{channelCount:i.channelCount}},R&&(L=i.inputTimeScale,N=G=y[0].pts-Math.round(L*h))),d.sps&&d.pps&&v.length&&(d.timescale=d.inputTimeScale,k.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:A.default.initSegment([d]),metadata:{width:d.width,height:d.height}},R)){L=d.inputTimeScale;var H=this.getVideoStartPts(v),V=Math.round(L*h);G=Math.min(G,r(v[0].dts,H)-V),N=Math.min(N,H-V)}if(Object.keys(k).length)return this.ISGenerated=!0,R&&(this._initPTS=N,this._initDTS=G),{tracks:k,initPTS:N,timescale:L}},b.remuxVideo=function(i,d,h,y){var v=i.inputTimeScale,x=i.samples,k=[],R=x.length,U=this._initPTS,N=this.nextAvcDts,G=8,L,H,V,$=Number.POSITIVE_INFINITY,q=Number.NEGATIVE_INFINITY,he=0,ae=!1;if(!h||N===null){var oe=d*v,ue=x[0].pts-r(x[0].dts,x[0].pts);N=oe-ue}for(var de=0;de<R;de++){var ie=x[de];if(ie.pts=r(ie.pts-U,N),ie.dts=r(ie.dts-U,N),ie.dts>ie.pts){var X=9e4*.2;he=Math.max(Math.min(he,ie.pts-ie.dts),-1*X)}ie.dts<x[de>0?de-1:de].dts&&(ae=!0)}ae&&x.sort(function(Ye,Qe){var We=Ye.dts-Qe.dts,Je=Ye.pts-Qe.pts;return We||Je}),H=x[0].dts,V=x[x.length-1].dts;var Se=Math.round((V-H)/(R-1));if(he<0){if(he<Se*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(m.toMsFromMpegTsClock)(-Se,!0)+" ms");for(var Ie=he,Ae=0;Ae<R;Ae++)x[Ae].dts=Ie=Math.max(Ie,x[Ae].pts-Se),x[Ae].pts=Math.max(Ie,x[Ae].pts)}else{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(m.toMsFromMpegTsClock)(he,!0)+" ms to overcome this issue");for(var je=0;je<R;je++)x[je].dts=x[je].dts+he}H=x[0].dts}if(h){var He=H-N,pe=He>Se,we=He<-1;if(pe||we){pe?O.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(He,!0)+" ms ("+He+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(-He,!0)+" ms ("+He+"dts) overlapping between fragments detected"),H=N;var Ee=x[0].pts-He;x[0].dts=H,x[0].pts=Ee,O.logger.log("Video: First PTS/DTS adjusted: "+Object(m.toMsFromMpegTsClock)(Ee,!0)+"/"+Object(m.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(m.toMsFromMpegTsClock)(He,!0)+" ms")}}e&&(H=Math.max(0,H));for(var me=0,ye=0,ve=0;ve<R;ve++){for(var be=x[ve],Ke=be.units,De=Ke.length,ke=0,Fe=0;Fe<De;Fe++)ke+=Ke[Fe].data.length;ye+=ke,me+=De,be.length=ke,be.dts=Math.max(be.dts,H),be.pts=Math.max(be.pts,be.dts,0),$=Math.min(be.pts,$),q=Math.max(be.pts,q)}V=x[R-1].dts;var re=ye+4*me+8,Be;try{Be=new Uint8Array(re)}catch(Ye){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:re,reason:"fail allocating video mdat "+re});return}var Oe=new DataView(Be.buffer);Oe.setUint32(0,re),Be.set(A.default.types.mdat,4);for(var Re=0;Re<R;Re++){for(var Ge=x[Re],Le=Ge.units,le=0,Te=0,te=Le.length;Te<te;Te++){var J=Le[Te],ee=J.data,K=J.data.byteLength;Oe.setUint32(G,K),G+=4,Be.set(ee,G),G+=K,le+=4+K}if(Re<R-1)L=x[Re+1].dts-Ge.dts;else{var z=this.config,Y=Ge.dts-x[Re>0?Re-1:Re].dts;if(z.stretchShortVideoTrack&&this.nextAudioPts!==null){var Q=Math.floor(z.maxBufferHole*v),se=(y?$+y*v:this.nextAudioPts)-Ge.pts;se>Q?(L=se-Y,L<0&&(L=Y),O.logger.log("[mp4-remuxer]: It is approximately "+se/90+" ms to the next segment; using duration "+L/90+" ms for the last video frame.")):L=Y}else L=Y}var fe=Math.round(Ge.pts-Ge.dts);k.push(new g(Ge.key,L,le,fe))}if(k.length&&l&&l<70){var xe=k[0].flags;xe.dependsOn=2,xe.isNonSync=0}console.assert(L!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=N=V+L,this.isVideoContiguous=!0;var Pe=A.default.moof(i.sequenceNumber++,H,p({},i,{samples:k})),Ue="video",Me={data1:Pe,data2:Be,startPTS:$/v,endPTS:(q+L)/v,startDTS:H/v,endDTS:N/v,type:Ue,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:i.dropped};return i.samples=[],i.dropped=0,console.assert(Be.length,"MDAT length must not be zero"),Me},b.remuxAudio=function(i,d,h,y,v){var x=i.inputTimeScale,k=i.samplerate?i.samplerate:x,R=x/k,U=i.isAAC?a:n,N=U*R,G=this._initPTS,L=!i.isAAC&&this.typeSupported.mpeg,H=[],V=i.samples,$=L?0:8,q=this.nextAudioPts||-1,he=d*x;if(this.isAudioContiguous=h=h||V.length&&q>0&&(y&&Math.abs(he-q)<9e3||Math.abs(r(V[0].pts-G,he)-q)<20*N),V.forEach(function(ee){ee.pts=r(ee.pts-G,he)}),!h||q<0){if(V=V.filter(function(ee){return ee.pts>=0}),!V.length)return;v===0?q=0:y?q=Math.max(0,he):q=V[0].pts}if(i.isAAC)for(var ae=v!==void 0,oe=this.config.maxAudioFramesDrift,ue=0,de=q;ue<V.length;ue++){var ie=V[ue],X=ie.pts,Se=X-de,Ie=Math.abs(1e3*Se/x);if(Se<=-oe*N&&ae)ue===0&&(O.logger.warn("Audio frame @ "+(X/x).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Se/x)+" ms."),this.nextAudioPts=q=de=X);else if(Se>=oe*N&&Ie<o&&ae){var Ae=Math.round(Se/N);de=X-Ae*N,de<0&&(Ae--,de+=N),ue===0&&(this.nextAudioPts=q=de),O.logger.warn("[mp4-remuxer]: Injecting "+Ae+" audio frame @ "+(de/x).toFixed(3)+"s due to "+Math.round(1e3*Se/x)+" ms gap.");for(var je=0;je<Ae;je++){var He=Math.max(de,0),pe=I.default.getSilentFrame(i.manifestCodec||i.codec,i.channelCount);pe||(O.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),pe=ie.unit.subarray()),V.splice(ue,0,{unit:pe,pts:He}),de+=N,ue++}}ie.pts=de,de+=N}for(var we=null,Ee=null,me,ye=0,ve=V.length;ve--;)ye+=V[ve].unit.byteLength;for(var be=0,Ke=V.length;be<Ke;be++){var De=V[be],ke=De.unit,Fe=De.pts;if(Ee!==null){var re=H[be-1];re.duration=Math.round((Fe-Ee)/R)}else if(h&&i.isAAC&&(Fe=q),we=Fe,ye>0){ye+=$;try{me=new Uint8Array(ye)}catch(ee){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ye,reason:"fail allocating audio mdat "+ye});return}if(!L){var Be=new DataView(me.buffer);Be.setUint32(0,ye),me.set(A.default.types.mdat,4)}}else return;me.set(ke,$);var Oe=ke.byteLength;$+=Oe,H.push(new g(!0,U,Oe,0)),Ee=Fe}var Re=H.length;if(!Re)return;var Ge=H[H.length-1];this.nextAudioPts=q=Ee+R*Ge.duration;var Le=L?new Uint8Array(0):A.default.moof(i.sequenceNumber++,we/R,p({},i,{samples:H}));i.samples=[];var le=we/x,Te=q/x,te="audio",J={data1:Le,data2:me,startPTS:le,endPTS:Te,startDTS:le,endDTS:Te,type:te,hasAudio:!0,hasVideo:!1,nb:Re};return this.isAudioContiguous=!0,console.assert(me.length,"MDAT length must not be zero"),J},b.remuxEmptyAudio=function(i,d,h,y){var v=i.inputTimeScale,x=i.samplerate?i.samplerate:v,k=v/x,R=this.nextAudioPts,U=(R!==null?R:y.startDTS*v)+this._initDTS,N=y.endDTS*v+this._initDTS,G=k*a,L=Math.ceil((N-U)/G),H=I.default.getSilentFrame(i.manifestCodec||i.codec,i.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var V=[],$=0;$<L;$++){var q=U+$*G;V.push({unit:H,pts:q,dts:q})}return i.samples=V,this.remuxAudio(i,d,h,!1)},b.remuxID3=function(i,d){var h=i.samples.length;if(!h)return;for(var y=i.inputTimeScale,v=this._initPTS,x=this._initDTS,k=0;k<h;k++){var R=i.samples[k];R.pts=r(R.pts-v,d*y)/y,R.dts=r(R.dts-x,d*y)/y}var U=i.samples;return i.samples=[],{samples:U}},b.remuxText=function(i,d){var h=i.samples.length;if(!h)return;for(var y=i.inputTimeScale,v=this._initPTS,x=0;x<h;x++){var k=i.samples[x];k.pts=r(k.pts-v,d*y)/y}i.samples.sort(function(U,N){return U.pts-N.pts});var R=i.samples;return i.samples=[],{samples:R}},E}();function r(E,b){var c;if(b===null)return E;for(b<E?c=-8589934592:c=8589934592;Math.abs(E-b)>4294967296;)E+=c;return E}function T(E){for(var b=0;b<E.length;b++)if(E[b].key)return b;return-1}var g=function(b,c,i,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=c,this.size=i,this.cts=d,this.flags=new _(b)},_=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/polyfills/number.ts"),I=w("./src/utils/mp4-tools.ts"),A=w("./src/loader/fragment.ts"),F=w("./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 p=m.prototype;return p.destroy=function(){},p.resetTimeStamp=function(a){this.initPTS=a,this.lastEndDTS=null},p.resetNextTimestamp=function(){this.lastEndDTS=null},p.resetInitSegment=function(a,n,l){this.audioCodec=n,this.videoCodec=l,this.generateInitSegment(a),this.emitInitSegment=!0},p.generateInitSegment=function(a){var n=this.audioCodec,l=this.videoCodec;if(!a||!a.byteLength){this.initTracks=void 0,this.initData=void 0;return}var s=this.initData=Object(I.parseInitSegment)(a);n||(n=S(s.audio,A.ElementaryStreamTypes.AUDIO)),l||(l=S(s.video,A.ElementaryStreamTypes.VIDEO));var e={};s.audio&&s.video?e.audiovideo={container:"video/mp4",codec:n+","+l,initSegment:a,id:"main"}:s.audio?e.audio={container:"audio/mp4",codec:n,initSegment:a,id:"audio"}:s.video?e.video={container:"video/mp4",codec:l,initSegment:a,id:"main"}:F.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=e},p.remux=function(a,n,l,s,e){var t=this.initPTS,r=this.lastEndDTS,T={audio:void 0,video:void 0,text:s,id3:l,initSegment:void 0};Object(j.isFiniteNumber)(r)||(r=this.lastEndDTS=e||0);var g=n.samples;if(!g||!g.length)return T;var _={initPTS:void 0,timescale:1},E=this.initData;if((!E||!E.length)&&(this.generateInitSegment(g),E=this.initData),!E||!E.length)return F.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),T;this.emitInitSegment&&(_.tracks=this.initTracks,this.emitInitSegment=!1),Object(j.isFiniteNumber)(t)||(this.initPTS=_.initPTS=t=O(E,g,r));var b=Object(I.getDuration)(g,E),c=r,i=b+c;Object(I.offsetStartDTS)(E,g,t),b>0?this.lastEndDTS=i:(F.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!E.audio,h=!!E.video,y="";d&&(y+="audio"),h&&(y+="video");var v={data1:g,startPTS:c,startDTS:c,endPTS:i,endDTS:i,type:y,hasAudio:d,hasVideo:h,nb:1,dropped:0};return T.audio=v.type==="audio"?v:void 0,T.video=v.type!=="audio"?v:void 0,T.text=s,T.id3=l,T.initSegment=_,T},m}(),O=function(p,o,a){return Object(I.getStartDTS)(p,o)-a};function S(m,p){var o=m==null?void 0:m.codec;return o&&o.length>4?o:o==="hvc1"?"hvc1.1.c.L120.90":o==="av01"?"av01.0.04M.08":o==="avc1"||p===A.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}W.default=M},"./src/task-loop.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return j});var j=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var A=I.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(){},I}()},"./src/types/cmcd.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"CMCDVersion",function(){return j}),w.d(W,"CMCDObjectType",function(){return I}),w.d(W,"CMCDStreamingFormat",function(){return A}),w.d(W,"CMCDStreamType",function(){return F});var j=1,I;(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"})(I||(I={}));var A;(function(M){M.DASH="d",M.HLS="h",M.SMOOTH="s",M.OTHER="o"})(A||(A={}));var F;(function(M){M.VOD="v",M.LIVE="l"})(F||(F={}))},"./src/types/level.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"HlsSkip",function(){return A}),w.d(W,"getSkipValue",function(){return F}),w.d(W,"HlsUrlParameters",function(){return M}),w.d(W,"Level",function(){return O});function j(S,m){for(var p=0;p<m.length;p++){var o=m[p];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(S,o.key,o)}}function I(S,m,p){return m&&j(S.prototype,m),p&&j(S,p),S}var A;(function(S){S.No="",S.Yes="YES",S.v2="v2"})(A||(A={}));function F(S,m){var p=S.canSkipUntil,o=S.canSkipDateRanges,a=S.endSN,n=m!==void 0?m-a:0;return p&&n<p?o?A.v2:A.Yes:A.No}var M=function(){function S(p,o,a){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=p,this.part=o,this.skip=a}var m=S.prototype;return m.addDirectives=function(o){var a=new self.URL(o);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}(),O=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(p){return p}).join(",").replace(/\.[^.,]+/g,"")}return I(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(p){var o=p%this.url.length;this._urlId!==o&&(this.details=void 0,this._urlId=o)}}]),S}()},"./src/types/loader.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"PlaylistContextType",function(){return j}),w.d(W,"PlaylistLevelType",function(){return I});var j;(function(A){A.MANIFEST="manifest",A.LEVEL="level",A.AUDIO_TRACK="audioTrack",A.SUBTITLE_TRACK="subtitleTrack"})(j||(j={}));var I;(function(A){A.MAIN="main",A.AUDIO="audio",A.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"ChunkMetadata",function(){return j});var j=function(F,M,O,S,m,p){S===void 0&&(S=0),m===void 0&&(m=-1),p===void 0&&(p=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=F,this.sn=M,this.id=O,this.size=S,this.part=m,this.partial=p};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"AttrList",function(){return A});var j=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,A=function(){function F(O){typeof O=="string"&&(O=F.parseAttrList(O));for(var S in O)O.hasOwnProperty(S)&&(this[S]=O[S])}var M=F.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 p=new Uint8Array(m.length/2),o=0;o<m.length/2;o++)p[o]=parseInt(m.slice(o*2,o*2+2),16);return p}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 p=this[S];return p?parseFloat(p):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)}},F.parseAttrList=function(S){var m,p={},o='"';for(I.lastIndex=0;(m=I.exec(S))!==null;){var a=m[2];a.indexOf(o)===0&&a.lastIndexOf(o)===a.length-1&&(a=a.slice(1,-1)),p[m[1]]=a}return p},F}()},"./src/utils/binary-search.ts":function(ce,W,w){"use strict";w.r(W);var j={search:function(A,F){for(var M=0,O=A.length-1,S=null,m=null;M<=O;){S=(M+O)/2|0,m=A[S];var p=F(m);if(p>0)M=S+1;else if(p<0)O=S-1;else return m}return null}};W.default=j},"./src/utils/buffer-helper.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"BufferHelper",function(){return A});var j=w("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},A=function(){function F(){}return F.isBuffered=function(O,S){try{if(O){for(var m=F.getBuffered(O),p=0;p<m.length;p++)if(S>=m.start(p)&&S<=m.end(p))return!0}}catch(o){}return!1},F.bufferInfo=function(O,S,m){try{if(O){var p=F.getBuffered(O),o=[],a;for(a=0;a<p.length;a++)o.push({start:p.start(a),end:p.end(a)});return this.bufferedInfo(o,S,m)}}catch(n){}return{len:0,start:S,end:S,nextStart:void 0}},F.bufferedInfo=function(O,S,m){S=Math.max(0,S),O.sort(function(_,E){var b=_.start-E.start;return b||E.end-_.end});var p=[];if(m)for(var o=0;o<O.length;o++){var a=p.length;if(a){var n=p[a-1].end;O[o].start-n<m?O[o].end>n&&(p[a-1].end=O[o].end):p.push(O[o])}else p.push(O[o])}else p=O;for(var l=0,s,e=S,t=S,r=0;r<p.length;r++){var T=p[r].start,g=p[r].end;if(S+m>=T&&S<g)e=T,t=g,l=t-S;else if(S+m<T){s=T;break}}return{len:l,start:e||0,end:t||0,nextStart:s}},F.getBuffered=function(O){try{return O.buffered}catch(S){return j.logger.log("failed to get media.buffered",S),I}},F}()},"./src/utils/cea-608-parser.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"Row",function(){return t}),w.d(W,"CaptionScreen",function(){return r});var j=w("./src/utils/logger.ts"),I={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(i){var d=i;return I.hasOwnProperty(i)&&(d=I[i]),String.fromCharCode(d)},F=15,M=100,O={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},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},o=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],a;(function(c){c[c.ERROR=0]="ERROR",c[c.TEXT=1]="TEXT",c[c.WARNING=2]="WARNING",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c[c.DATA=3]="DATA"})(a||(a={}));var n=function(){function c(){this.time=null,this.verboseLevel=a.ERROR}var i=c.prototype;return i.log=function(h,y){this.verboseLevel>=h&&j.logger.log(this.time+" ["+h+"] "+y)},c}(),l=function(i){for(var d=[],h=0;h<i.length;h++)d.push(i[h].toString(16));return d},s=function(){function c(d,h,y,v,x){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=h||!1,this.italics=y||!1,this.background=v||"black",this.flash=x||!1}var i=c.prototype;return i.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},i.setStyles=function(h){for(var y=["foreground","underline","italics","background","flash"],v=0;v<y.length;v++){var x=y[v];h.hasOwnProperty(x)&&(this[x]=h[x])}},i.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},i.equals=function(h){return this.foreground===h.foreground&&this.underline===h.underline&&this.italics===h.italics&&this.background===h.background&&this.flash===h.flash},i.copy=function(h){this.foreground=h.foreground,this.underline=h.underline,this.italics=h.italics,this.background=h.background,this.flash=h.flash},i.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},c}(),e=function(){function c(d,h,y,v,x,k){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new s(h,y,v,x,k)}var i=c.prototype;return i.reset=function(){this.uchar=" ",this.penState.reset()},i.setChar=function(h,y){this.uchar=h,this.penState.copy(y)},i.setPenState=function(h){this.penState.copy(h)},i.equals=function(h){return this.uchar===h.uchar&&this.penState.equals(h.penState)},i.copy=function(h){this.uchar=h.uchar,this.penState.copy(h.penState)},i.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},c}(),t=function(){function c(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var h=0;h<M;h++)this.chars.push(new e);this.logger=d,this.pos=0,this.currPenState=new s}var i=c.prototype;return i.equals=function(h){for(var y=!0,v=0;v<M;v++)if(!this.chars[v].equals(h.chars[v])){y=!1;break}return y},i.copy=function(h){for(var y=0;y<M;y++)this.chars[y].copy(h.chars[y])},i.isEmpty=function(){for(var h=!0,y=0;y<M;y++)if(!this.chars[y].isEmpty()){h=!1;break}return h},i.setCursor=function(h){this.pos!==h&&(this.pos=h),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)},i.moveCursor=function(h){var y=this.pos+h;if(h>1)for(var v=this.pos+1;v<y+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(y)},i.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},i.insertChar=function(h){h>=144&&this.backSpace();var y=A(h);if(this.pos>=M){this.logger.log(a.ERROR,"Cannot insert "+h.toString(16)+" ("+y+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(y,this.currPenState),this.moveCursor(1)},i.clearFromPos=function(h){var y;for(y=h;y<M;y++)this.chars[y].reset()},i.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},i.clearToEndOfRow=function(){this.clearFromPos(this.pos)},i.getTextString=function(){for(var h=[],y=!0,v=0;v<M;v++){var x=this.chars[v].uchar;x!==" "&&(y=!1),h.push(x)}return y?"":h.join("")},i.setPenStyles=function(h){this.currPenState.setStyles(h);var y=this.chars[this.pos];y.setPenState(this.currPenState)},c}(),r=function(){function c(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var h=0;h<F;h++)this.rows.push(new t(d));this.logger=d,this.currRow=F-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var i=c.prototype;return i.reset=function(){for(var h=0;h<F;h++)this.rows[h].clear();this.currRow=F-1},i.equals=function(h){for(var y=!0,v=0;v<F;v++)if(!this.rows[v].equals(h.rows[v])){y=!1;break}return y},i.copy=function(h){for(var y=0;y<F;y++)this.rows[y].copy(h.rows[y])},i.isEmpty=function(){for(var h=!0,y=0;y<F;y++)if(!this.rows[y].isEmpty()){h=!1;break}return h},i.backSpace=function(){var h=this.rows[this.currRow];h.backSpace()},i.clearToEndOfRow=function(){var h=this.rows[this.currRow];h.clearToEndOfRow()},i.insertChar=function(h){var y=this.rows[this.currRow];y.insertChar(h)},i.setPen=function(h){var y=this.rows[this.currRow];y.setPenStyles(h)},i.moveCursor=function(h){var y=this.rows[this.currRow];y.moveCursor(h)},i.setCursor=function(h){this.logger.log(a.INFO,"setCursor: "+h);var y=this.rows[this.currRow];y.setCursor(h)},i.setPAC=function(h){this.logger.log(a.INFO,"pacData = "+JSON.stringify(h));var y=h.row-1;if(this.nrRollUpRows&&y<this.nrRollUpRows-1&&(y=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==y){for(var v=0;v<F;v++)this.rows[v].clear();var x=this.currRow+1-this.nrRollUpRows,k=this.lastOutputScreen;if(k){var R=k.rows[x].cueStartTime,U=this.logger.time;if(R&&U!==null&&R<U)for(var N=0;N<this.nrRollUpRows;N++)this.rows[y-this.nrRollUpRows+N+1].copy(k.rows[x+N])}}this.currRow=y;var G=this.rows[this.currRow];if(h.indent!==null){var L=h.indent,H=Math.max(L-1,0);G.setCursor(h.indent),h.color=G.chars[H].penState.foreground}var V={foreground:h.color,underline:h.underline,italics:h.italics,background:"black",flash:!1};this.setPen(V)},i.setBkgData=function(h){this.logger.log(a.INFO,"bkgData = "+JSON.stringify(h)),this.backSpace(),this.setPen(h),this.insertChar(32)},i.setRollUpRows=function(h){this.nrRollUpRows=h},i.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 h=this.currRow+1-this.nrRollUpRows,y=this.rows.splice(h,1)[0];y.clear(),this.rows.splice(this.currRow,0,y),this.logger.log(a.INFO,"Rolling up")},i.getDisplayText=function(h){h=h||!1;for(var y=[],v="",x=-1,k=0;k<F;k++){var R=this.rows[k].getTextString();R&&(x=k+1,h?y.push("Row "+x+": '"+R+"'"):y.push(R.trim()))}return y.length>0&&(h?v="["+y.join(" | ")+"]":v=y.join(`
|
|
`)),v},i.getTextAndFormat=function(){return this.rows},c}(),T=function(){function c(d,h,y){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=d,this.outputFilter=h,this.mode=null,this.verbose=0,this.displayedMemory=new r(y),this.nonDisplayedMemory=new r(y),this.lastOutputScreen=new r(y),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=y}var i=c.prototype;return i.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},i.getHandler=function(){return this.outputFilter},i.setHandler=function(h){this.outputFilter=h},i.setPAC=function(h){this.writeScreen.setPAC(h)},i.setBkgData=function(h){this.writeScreen.setBkgData(h)},i.setMode=function(h){if(h===this.mode)return;this.mode=h,this.logger.log(a.INFO,"MODE="+h),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=h},i.insertChars=function(h){for(var y=0;y<h.length;y++)this.writeScreen.insertChar(h[y]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(a.INFO,v+": "+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())},i.ccRCL=function(){this.logger.log(a.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},i.ccBS=function(){if(this.logger.log(a.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},i.ccAOF=function(){},i.ccAON=function(){},i.ccDER=function(){this.logger.log(a.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},i.ccRU=function(h){this.logger.log(a.INFO,"RU("+h+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(h)},i.ccFON=function(){this.logger.log(a.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},i.ccRDC=function(){this.logger.log(a.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},i.ccTR=function(){this.logger.log(a.INFO,"TR"),this.setMode("MODE_TEXT")},i.ccRTD=function(){this.logger.log(a.INFO,"RTD"),this.setMode("MODE_TEXT")},i.ccEDM=function(){this.logger.log(a.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},i.ccCR=function(){this.logger.log(a.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},i.ccENM=function(){this.logger.log(a.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},i.ccEOC=function(){if(this.logger.log(a.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var h=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=h,this.writeScreen=this.nonDisplayedMemory,this.logger.log(a.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},i.ccTO=function(h){this.logger.log(a.INFO,"TO("+h+") - Tab Offset"),this.writeScreen.moveCursor(h)},i.ccMIDROW=function(h){var y={flash:!1};if(y.underline=h%2===1,y.italics=h>=46,y.italics)y.foreground="white";else{var v=Math.floor(h/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];y.foreground=x[v]}this.logger.log(a.INFO,"MIDROW: "+JSON.stringify(y)),this.writeScreen.setPen(y)},i.outputDataUpdate=function(h){h===void 0&&(h=!1);var y=this.logger.time;if(y===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=y:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,y,this.lastOutputScreen),h&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:y),this.lastOutputScreen.copy(this.displayedMemory))},i.cueSplitAtTime=function(h){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,h,this.displayedMemory),this.cueStartTime=h))},c}(),g=function(){function c(d,h,y){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new n;this.channels=[null,new T(d,h,v),new T(d+1,y,v)],this.cmdHistory=b(),this.logger=v}var i=c.prototype;return i.getHandler=function(h){return this.channels[h].getHandler()},i.setHandler=function(h,y){this.channels[h].setHandler(y)},i.addData=function(h,y){var v,x,k,R=!1;this.logger.time=h;for(var U=0;U<y.length;U+=2){if(x=y[U]&127,k=y[U+1]&127,x===0&&k===0)continue;if(this.logger.log(a.DATA,"["+l([y[U],y[U+1]])+"] -> ("+l([x,k])+")"),v=this.parseCmd(x,k),v||(v=this.parseMidrow(x,k)),v||(v=this.parsePAC(x,k)),v||(v=this.parseBackgroundAttributes(x,k)),!v&&(R=this.parseChars(x,k),R)){var N=this.currentChannel;if(N&&N>0){var G=this.channels[N];G.insertChars(R)}else this.logger.log(a.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!R&&this.logger.log(a.WARNING,"Couldn't parse cleaned data "+l([x,k])+" orig: "+l([y[U],y[U+1]]))}},i.parseCmd=function(h,y){var v=this.cmdHistory,x=(h===20||h===28||h===21||h===29)&&y>=32&&y<=47,k=(h===23||h===31)&&y>=33&&y<=35;if(!(x||k))return!1;if(E(h,y,v))return _(null,null,v),this.logger.log(a.DEBUG,"Repeated command ("+l([h,y])+") is dropped"),!0;var R=h===20||h===21||h===23?1:2,U=this.channels[R];return h===20||h===21||h===28||h===29?y===32?U.ccRCL():y===33?U.ccBS():y===34?U.ccAOF():y===35?U.ccAON():y===36?U.ccDER():y===37?U.ccRU(2):y===38?U.ccRU(3):y===39?U.ccRU(4):y===40?U.ccFON():y===41?U.ccRDC():y===42?U.ccTR():y===43?U.ccRTD():y===44?U.ccEDM():y===45?U.ccCR():y===46?U.ccENM():y===47&&U.ccEOC():U.ccTO(y-32),_(h,y,v),this.currentChannel=R,!0},i.parseMidrow=function(h,y){var v=0;if((h===17||h===25)&&y>=32&&y<=47){if(h===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(a.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[v];return x?(x.ccMIDROW(y),this.logger.log(a.DEBUG,"MIDROW ("+l([h,y])+")"),!0):!1}return!1},i.parsePAC=function(h,y){var v,x=this.cmdHistory,k=(h>=17&&h<=23||h>=25&&h<=31)&&y>=64&&y<=127,R=(h===16||h===24)&&y>=64&&y<=95;if(!(k||R))return!1;if(E(h,y,x))return _(null,null,x),!0;var U=h<=23?1:2;y>=64&&y<=95?v=U===1?O[h]:m[h]:v=U===1?S[h]:p[h];var N=this.channels[U];return N?(N.setPAC(this.interpretPAC(v,y)),_(h,y,x),this.currentChannel=U,!0):!1},i.interpretPAC=function(h,y){var v,x={color:null,italics:!1,indent:null,underline:!1,row:h};return y>95?v=y-96:v=y-64,x.underline=(v&1)===1,v<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((v-16)/2)*4,x},i.parseChars=function(h,y){var v,x=null,k=null;if(h>=25?(v=2,k=h-8):(v=1,k=h),k>=17&&k<=19){var R;k===17?R=y+80:k===18?R=y+112:R=y+144,this.logger.log(a.INFO,"Special char '"+A(R)+"' in channel "+v),x=[R]}else h>=32&&h<=127&&(x=y===0?[h]:[h,y]);if(x){var U=l(x);this.logger.log(a.DEBUG,"Char codes = "+U.join(",")),_(h,y,this.cmdHistory)}return x},i.parseBackgroundAttributes=function(h,y){var v=(h===16||h===24)&&y>=32&&y<=47,x=(h===23||h===31)&&y>=45&&y<=47;if(!(v||x))return!1;var k,R={};h===16||h===24?(k=Math.floor((y-32)/2),R.background=o[k],y%2===1&&(R.background=R.background+"_semi")):y===45?R.background="transparent":(R.foreground="black",y===47&&(R.underline=!0));var U=h<=23?1:2,N=this.channels[U];return N.setBkgData(R),_(h,y,this.cmdHistory),!0},i.reset=function(){for(var h=0;h<Object.keys(this.channels).length;h++){var y=this.channels[h];y&&y.reset()}this.cmdHistory=b()},i.cueSplitAtTime=function(h){for(var y=0;y<this.channels.length;y++){var v=this.channels[y];v&&v.cueSplitAtTime(h)}},c}();function _(c,i,d){d.a=c,d.b=i}function E(c,i,d){return d.a===c&&d.b===i}function b(){return{a:null,b:null}}W.default=g},"./src/utils/codecs.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"isCodecType",function(){return I}),w.d(W,"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 I(F,M){var O=j[M];return!!O&&O[F.slice(0,4)]===!0}function A(F,M){return MediaSource.isTypeSupported((M||"video")+'/mp4;codecs="'+F+'"')}},"./src/utils/cues.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/utils/vttparser.ts"),I=w("./src/utils/webvtt-parser.ts"),A=w("./src/utils/texttrack-utils.ts"),F=/\s/,M={newCue:function(S,m,p,o){for(var a=[],n,l,s,e,t,r=self.VTTCue||self.TextTrackCue,T=0;T<o.rows.length;T++)if(n=o.rows[T],s=!0,e=0,t="",!n.isEmpty()){for(var g=0;g<n.chars.length;g++)F.test(n.chars[g].uchar)&&s?e++:(t+=n.chars[g].uchar,s=!1);n.cueStartTime=m,m===p&&(p+=1e-4),e>=16?e--:e++;var _=Object(j.fixLineBreaks)(t.trim()),E=Object(I.generateCueId)(m,p,_);(!S||!S.cues||!S.cues.getCueById(E))&&(l=new r(m,p,_),l.id=E,l.line=T+1,l.align="left",l.position=10+Math.min(80,Math.floor(e*8/32)*10),a.push(l))}return S&&a.length&&(a.sort(function(b,c){return b.line==="auto"||c.line==="auto"?0:b.line>8&&c.line>8?c.line-b.line:b.line-c.line}),a.forEach(function(b){return Object(A.addCueToTrack)(S,b)})),a}};W.default=M},"./src/utils/discontinuities.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"findFirstFragWithCC",function(){return F}),w.d(W,"shouldAlignOnDiscontinuities",function(){return M}),w.d(W,"findDiscontinuousReferenceFrag",function(){return O}),w.d(W,"adjustSlidingStart",function(){return m}),w.d(W,"alignStream",function(){return p}),w.d(W,"alignPDT",function(){return a}),w.d(W,"alignFragmentByPDTDelta",function(){return n}),w.d(W,"alignMediaPlaylistByPDT",function(){return l});var j=w("./src/polyfills/number.ts"),I=w("./src/utils/logger.ts"),A=w("./src/controller/level-helper.ts");function F(s,e){for(var t=null,r=0,T=s.length;r<T;r++){var g=s[r];if(g&&g.cc===e){t=g;break}}return t}function M(s,e,t){return!!(e.details&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function O(s,e){var t=s.fragments,r=e.fragments;if(!r.length||!t.length){I.logger.log("No fragments to align");return}var T=F(t,r[0].cc);if(!T||T&&!T.startPTS){I.logger.log("No frag in previous level to align on");return}return T}function S(s,e){if(s){var t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function m(s,e){for(var t=e.fragments,r=0,T=t.length;r<T;r++)S(t[r],s);e.fragmentHint&&S(e.fragmentHint,s),e.alignedSliding=!0}function p(s,e,t){if(!e)return;o(s,t,e),!t.alignedSliding&&e.details&&a(t,e.details),!t.alignedSliding&&e.details&&!t.skippedSegments&&Object(A.adjustSliding)(e.details,t)}function o(s,e,t){if(M(s,t,e)){var r=O(t.details,e);r&&Object(j.isFiniteNumber)(r.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),m(r.start,e))}}function a(s,e){if(!e.fragments.length||!s.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,r=s.fragments[0].programDateTime,T=(r-t)/1e3+e.fragments[0].start;T&&Object(j.isFiniteNumber)(T)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(r-t)+"ms, sliding:"+T.toFixed(3)+" "+s.url+" "),m(T,s))}function n(s,e){var t=s.programDateTime;if(!t)return;var r=(t-e)/1e3;s.start=s.startPTS=r,s.endPTS=r+s.duration}function l(s,e){if(!e.fragments.length||!s.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,r=e.fragments[0].start,T=t-r*1e3;s.fragments.forEach(function(g){n(g,T)}),s.fragmentHint&&n(s.fragmentHint,T),s.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/utils/ewma.ts"),I=function(){function A(M,O,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(O)}var F=A.prototype;return F.update=function(O,S){var m=this.slow_,p=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new j.default(O,m.getEstimate(),m.getTotalWeight())),this.fast_.halfLife!==S&&(this.fast_=new j.default(S,p.getEstimate(),p.getTotalWeight()))},F.sample=function(O,S){O=Math.max(O,this.minDelayMs_);var m=8*S,p=O/1e3,o=m/p;this.fast_.sample(p,o),this.slow_.sample(p,o)},F.canEstimate=function(){var O=this.fast_;return O&&O.getTotalWeight()>=this.minWeight_},F.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},F.destroy=function(){},A}();W.default=I},"./src/utils/ewma.ts":function(ce,W,w){"use strict";w.r(W);var j=function(){function I(F,M,O){M===void 0&&(M=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=F,this.alpha_=F?Math.exp(Math.log(.5)/F):0,this.estimate_=M,this.totalWeight_=O}var A=I.prototype;return A.sample=function(M,O){var S=Math.pow(this.alpha_,M);this.estimate_=O*(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_},I}();W.default=j},"./src/utils/fetch-loader.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"fetchSupported",function(){return n});var j=w("./src/polyfills/number.ts"),I=w("./src/loader/load-stats.ts"),A=w("./src/demux/chunk-cache.ts");function F(r,T){r.prototype=Object.create(T.prototype),r.prototype.constructor=r,p(r,T)}function M(r){var T=typeof Map=="function"?new Map:void 0;return M=function(_){if(_===null||!m(_))return _;if(typeof _!="function")throw new TypeError("Super expression must either be null or a function");if(typeof T!="undefined"){if(T.has(_))return T.get(_);T.set(_,E)}function E(){return O(_,arguments,o(this).constructor)}return E.prototype=Object.create(_.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),p(E,_)},M(r)}function O(r,T,g){return S()?O=Reflect.construct:O=function(E,b,c){var i=[null];i.push.apply(i,b);var d=Function.bind.apply(E,i),h=new d;return c&&p(h,c.prototype),h},O.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 p(r,T){return p=Object.setPrototypeOf||function(_,E){return _.__proto__=E,_},p(r,T)}function o(r){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},o(r)}function a(){return a=Object.assign||function(r){for(var T=1;T<arguments.length;T++){var g=arguments[T];for(var _ in g)Object.prototype.hasOwnProperty.call(g,_)&&(r[_]=g[_])}return r},a.apply(this,arguments)}function n(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(r){}return!1}var l=function(){function r(g){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=g.fetchSetup||e,this.controller=new self.AbortController,this.stats=new I.LoadStats}var T=r.prototype;return T.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},T.abortInternal=function(){var _=this.response;(!_||!_.ok)&&(this.stats.aborted=!0,this.controller.abort())},T.abort=function(){var _;this.abortInternal(),(_=this.callbacks)!==null&&_!==void 0&&_.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},T.load=function(_,E,b){var c=this,i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();var d=s(_,this.controller.signal),h=b.onProgress,y=_.responseType==="arraybuffer",v=y?"byteLength":"length";this.context=_,this.config=E,this.callbacks=b,this.request=this.fetchSetup(_,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){c.abortInternal(),b.onTimeout(i,_,c.response)},E.timeout),self.fetch(this.request).then(function(x){if(c.response=c.loader=x,!x.ok){var k=x.status,R=x.statusText;throw new t(R||"fetch, bad network response",k,x)}return i.loading.first=Math.max(self.performance.now(),i.loading.start),i.total=parseInt(x.headers.get("Content-Length")||"0"),h&&Object(j.isFiniteNumber)(E.highWaterMark)?c.loadProgressively(x,i,_,E.highWaterMark,h):y?x.arrayBuffer():x.text()}).then(function(x){var k=c.response;self.clearTimeout(c.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first),i.loaded=i.total=x[v];var R={url:k.url,data:x};h&&!Object(j.isFiniteNumber)(E.highWaterMark)&&h(i,_,x,k),b.onSuccess(R,i,_,k)}).catch(function(x){if(self.clearTimeout(c.requestTimeout),i.aborted)return;var k=x.code||0;b.onError({code:k,text:x.message},_,x.details)})},T.getCacheAge=function(){var _=null;if(this.response){var E=this.response.headers.get("age");_=E?parseFloat(E):null}return _},T.loadProgressively=function(_,E,b,c,i){c===void 0&&(c=0);var d=new A.default,h=_.body.getReader(),y=function v(){return h.read().then(function(x){if(x.done)return d.dataLength&&i(E,b,d.flush(),_),Promise.resolve(new ArrayBuffer(0));var k=x.value,R=k.length;return E.loaded+=R,R<c||d.dataLength?(d.push(k),d.dataLength>=c&&i(E,b,d.flush(),_)):i(E,b,k,_),v()}).catch(function(){return Promise.reject()})};return y()},r}();function s(r,T){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:T,headers:new self.Headers(a({},r.headers))};return r.rangeEnd&&g.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),g}function e(r,T){return new self.Request(r.url,T)}var t=function(r){F(T,r);function T(g,_,E){var b;return b=r.call(this,g)||this,b.code=void 0,b.details=void 0,b.code=_,b.details=E,b}return T}(M(Error));W.default=l},"./src/utils/imsc1-ttml-parser.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"IMSC1_CODEC",function(){return m}),w.d(W,"parseIMSC1",function(){return n});var j=w("./src/utils/mp4-tools.ts"),I=w("./src/utils/vttparser.ts"),A=w("./src/utils/vttcue.ts"),F=w("./src/demux/id3.ts"),M=w("./src/utils/timescale-conversion.ts"),O=w("./src/utils/webvtt-parser.ts");function S(){return S=Object.assign||function(c){for(var i=1;i<arguments.length;i++){var d=arguments[i];for(var h in d)Object.prototype.hasOwnProperty.call(d,h)&&(c[h]=d[h])}return c},S.apply(this,arguments)}var m="stpp.ttml.im1t",p=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,o=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,a={left:"start",center:"center",right:"end",start:"start",end:"end"};function n(c,i,d,h,y){var v=Object(j.findBox)(new Uint8Array(c),["mdat"]);if(v.length===0){y(new Error("Could not parse IMSC1 mdat"));return}var x=v[0],k=Object(F.utf8ArrayToStr)(new Uint8Array(c,x.start,x.end-x.start)),R=Object(M.toTimescaleFromScale)(i,1,d);try{h(l(k,R))}catch(U){y(U)}}function l(c,i){var d=new DOMParser,h=d.parseFromString(c,"text/xml"),y=h.getElementsByTagName("tt")[0];if(!y)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},x=Object.keys(v).reduce(function(G,L){return G[L]=y.getAttribute("ttp:"+L)||v[L],G},{}),k=y.getAttribute("xml:space")!=="preserve",R=e(s(y,"styling","style")),U=e(s(y,"layout","region")),N=s(y,"body","[begin]");return[].map.call(N,function(G){var L=t(G,k);if(!L||!G.hasAttribute("begin"))return null;var H=_(G.getAttribute("begin"),x),V=_(G.getAttribute("dur"),x),$=_(G.getAttribute("end"),x);if(H===null)throw g(G);if($===null){if(V===null)throw g(G);$=H+V}var q=new A.default(H-i,$-i,L);q.id=Object(O.generateCueId)(q.startTime,q.endTime,q.text);var he=U[G.getAttribute("region")],ae=R[G.getAttribute("style")];q.position=10,q.size=80;var oe=r(he,ae),ue=oe.textAlign;if(ue){var de=a[ue];de&&(q.lineAlign=de),q.align=ue}return S(q,oe),q}).filter(function(G){return G!==null})}function s(c,i,d){var h=c.getElementsByTagName(i)[0];return h?[].slice.call(h.querySelectorAll(d)):[]}function e(c){return c.reduce(function(i,d){var h=d.getAttribute("xml:id");return h&&(i[h]=d),i},{})}function t(c,i){return[].slice.call(c.childNodes).reduce(function(d,h,y){var v;return h.nodeName==="br"&&y?d+`
|
|
`:(v=h.childNodes)!==null&&v!==void 0&&v.length?t(h,i):i?d+h.textContent.trim().replace(/\s+/g," "):d+h.textContent},"")}function r(c,i){var d="http://www.w3.org/ns/ttml#styling",h=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return h.reduce(function(y,v){var x=T(i,d,v)||T(c,d,v);return x&&(y[v]=x),y},{})}function T(c,i,d){return c.hasAttributeNS(i,d)?c.getAttributeNS(i,d):null}function g(c){return new Error("Could not parse ttml timestamp "+c)}function _(c,i){if(!c)return null;var d=Object(I.parseTimeStamp)(c);return d===null&&(p.test(c)?d=E(c,i):o.test(c)&&(d=b(c,i))),d}function E(c,i){var d=p.exec(c),h=(d[4]|0)+(d[5]|0)/i.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+h/i.frameRate}function b(c,i){var d=o.exec(c),h=Number(d[1]),y=d[2];switch(y){case"h":return h*3600;case"m":return h*60;case"ms":return h*1e3;case"f":return h/i.frameRate;case"t":return h/i.tickRate}return h}},"./src/utils/logger.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"enableLogs",function(){return O}),w.d(W,"logger",function(){return S});var j=function(){},I={trace:j,debug:j,log:j,warn:j,info:j,error:j},A=I;function F(m){var p=self.console[m];return p?p.bind(self.console,"["+m+"] >"):j}function M(m){for(var p=arguments.length,o=new Array(p>1?p-1:0),a=1;a<p;a++)o[a-1]=arguments[a];o.forEach(function(n){A[n]=m[n]?m[n].bind(m):F(n)})}function O(m){if(self.console&&m===!0||typeof m=="object"){M(m,"debug","log","info","warn","error");try{A.log()}catch(p){A=I}}else A=I}var S=A},"./src/utils/mediakeys-helper.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"KeySystems",function(){return j}),w.d(W,"requestMediaKeySystemAccess",function(){return I});var j;(function(A){A.WIDEVINE="com.widevine.alpha",A.PLAYREADY="com.microsoft.playready"})(j||(j={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"getMediaSource",function(){return j});function j(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"bin2str",function(){return M}),w.d(W,"readUint16",function(){return O}),w.d(W,"readUint32",function(){return S}),w.d(W,"writeUint32",function(){return m}),w.d(W,"findBox",function(){return p}),w.d(W,"parseSegmentIndex",function(){return o}),w.d(W,"parseInitSegment",function(){return a}),w.d(W,"getStartDTS",function(){return n}),w.d(W,"getDuration",function(){return l}),w.d(W,"computeRawDurationFromSamples",function(){return s}),w.d(W,"offsetStartDTS",function(){return e}),w.d(W,"segmentValidRange",function(){return t}),w.d(W,"appendUint8Array",function(){return r});var j=w("./src/utils/typed-array.ts"),I=w("./src/loader/fragment.ts"),A=Math.pow(2,32)-1,F=[].push;function M(T){return String.fromCharCode.apply(null,T)}function O(T,g){"data"in T&&(g+=T.start,T=T.data);var _=T[g]<<8|T[g+1];return _<0?65536+_:_}function S(T,g){"data"in T&&(g+=T.start,T=T.data);var _=T[g]<<24|T[g+1]<<16|T[g+2]<<8|T[g+3];return _<0?4294967296+_:_}function m(T,g,_){"data"in T&&(g+=T.start,T=T.data),T[g]=_>>24,T[g+1]=_>>16&255,T[g+2]=_>>8&255,T[g+3]=_&255}function p(T,g){var _=[];if(!g.length)return _;var E,b,c;"data"in T?(E=T.data,b=T.start,c=T.end):(E=T,b=0,c=E.byteLength);for(var i=b;i<c;){var d=S(E,i),h=M(E.subarray(i+4,i+8)),y=d>1?i+d:c;if(h===g[0])if(g.length===1)_.push({data:E,start:i+8,end:y});else{var v=p({data:E,start:i+8,end:y},g.slice(1));v.length&&F.apply(_,v)}i=y}return _}function o(T){var g=p(T,["moov"]),_=g[0],E=_?_.end:null,b=p(T,["sidx"]);if(!b||!b[0])return null;var c=[],i=b[0],d=i.data[0],h=d===0?8:16,y=S(i,h);h+=4;var v=0,x=0;d===0?h+=8:h+=16,h+=2;var k=i.end+x,R=O(i,h);h+=2;for(var U=0;U<R;U++){var N=h,G=S(i,N);N+=4;var L=G&2147483647,H=(G&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var V=S(i,N);N+=4,c.push({referenceSize:L,subsegmentDuration:V,info:{duration:V/y,start:k,end:k+L-1}}),k+=L,N+=4,h=N}return{earliestPresentationTime:v,timescale:y,version:d,referencesCount:R,references:c,moovEndOffset:E}}function a(T){for(var g=[],_=p(T,["moov","trak"]),E=0;E<_.length;E++){var b=_[E],c=p(b,["tkhd"])[0];if(c){var i=c.data[c.start],d=i===0?12:20,h=S(c,d),y=p(b,["mdia","mdhd"])[0];if(y){i=y.data[y.start],d=i===0?12:20;var v=S(y,d),x=p(b,["mdia","hdlr"])[0];if(x){var k=M(x.data.subarray(x.start+8,x.start+12)),R={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[k];if(R){var U=p(b,["mdia","minf","stbl","stsd"])[0],N=void 0;U&&(N=M(U.data.subarray(U.start+12,U.start+16))),g[h]={timescale:v,type:R},g[R]={timescale:v,id:h,codec:N}}}}}}var G=p(T,["moov","mvex","trex"]);return G.forEach(function(L){var H=S(L,4),V=g[H];V&&(V.default={duration:S(L,12),flags:S(L,20)})}),g}function n(T,g){return p(g,["moof","traf"]).reduce(function(_,E){var b=p(E,["tfdt"])[0],c=b.data[b.start],i=p(E,["tfhd"]).reduce(function(d,h){var y=S(h,4),v=T[y];if(v){var x=S(b,4);c===1&&(x*=Math.pow(2,32),x+=S(b,8));var k=v.timescale||9e4,R=x/k;if(isFinite(R)&&(d===null||R<d))return R}return d},null);return i!==null&&isFinite(i)&&(_===null||i<_)?i:_},null)||0}function l(T,g){for(var _=0,E=0,b=0,c=p(T,["moof","traf"]),i=0;i<c.length;i++){var d=c[i],h=p(d,["tfhd"])[0],y=S(h,4),v=g[y];if(!v)continue;var x=v.default,k=S(h,0)|(x==null?void 0:x.flags),R=x==null?void 0:x.duration;k&8&&(k&2?R=S(h,12):R=S(h,8));for(var U=v.timescale||9e4,N=p(d,["trun"]),G=0;G<N.length;G++){if(R){var L=S(N[G],4);_=R*L}else _=s(N[G]);v.type===I.ElementaryStreamTypes.VIDEO?E+=_/U:v.type===I.ElementaryStreamTypes.AUDIO&&(b+=_/U)}}if(E===0&&b===0){var H=o(T);if(H!=null&&H.references)return H.references.reduce(function(V,$){return V+$.info.duration||0},0)}return E||b}function s(T){var g=S(T,0),_=8;g&1&&(_+=4),g&4&&(_+=4);for(var E=0,b=S(T,4),c=0;c<b;c++){if(g&256){var i=S(T,_);E+=i,_+=4}g&512&&(_+=4),g&1024&&(_+=4),g&2048&&(_+=4)}return E}function e(T,g,_){p(g,["moof","traf"]).forEach(function(E){p(E,["tfhd"]).forEach(function(b){var c=S(b,4),i=T[c];if(!i)return;var d=i.timescale||9e4;p(E,["tfdt"]).forEach(function(h){var y=h.data[h.start],v=S(h,4);if(y===0)m(h,4,v-_*d);else{v*=Math.pow(2,32),v+=S(h,8),v-=_*d,v=Math.max(v,0);var x=Math.floor(v/(A+1)),k=Math.floor(v%(A+1));m(h,4,x),m(h,8,k)}})})})}function t(T){var g={valid:null,remainder:null},_=p(T,["moof"]);if(_){if(_.length<2)return g.remainder=T,g}else return g;var E=_[_.length-1];return g.valid=Object(j.sliceUint8)(T,0,E.start-8),g.remainder=Object(j.sliceUint8)(T,E.start-8),g}function r(T,g){var _=new Uint8Array(T.length+g.length);return _.set(T),_.set(g,T.length),_}},"./src/utils/output-filter.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"default",function(){return j});var j=function(){function I(F,M){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=F,this.trackName=M}var A=I.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,O,S){(this.startTime===null||this.startTime>M)&&(this.startTime=M),this.endTime=O,this.screen=S,this.timelineController.createCaptionsTrack(this.trackName)},A.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"sendAddTrackEvent",function(){return I}),w.d(W,"addCueToTrack",function(){return A}),w.d(W,"clearCurrentCues",function(){return F}),w.d(W,"removeCuesInRange",function(){return M}),w.d(W,"getCuesInRange",function(){return S});var j=w("./src/utils/logger.ts");function I(m,p){var o;try{o=new Event("addtrack")}catch(a){o=document.createEvent("Event"),o.initEvent("addtrack",!1,!1)}o.track=m,p.dispatchEvent(o)}function A(m,p){var o=m.mode;if(o==="disabled"&&(m.mode="hidden"),m.cues&&!m.cues.getCueById(p.id))try{if(m.addCue(p),!m.cues.getCueById(p.id))throw new Error("addCue is failed for: "+p)}catch(n){j.logger.debug("[texttrack-utils]: "+n);var a=new self.TextTrackCue(p.startTime,p.endTime,p.text);a.id=p.id,m.addCue(a)}o==="disabled"&&(m.mode=o)}function F(m){var p=m.mode;if(p==="disabled"&&(m.mode="hidden"),m.cues)for(var o=m.cues.length;o--;)m.removeCue(m.cues[o]);p==="disabled"&&(m.mode=p)}function M(m,p,o){var a=m.mode;if(a==="disabled"&&(m.mode="hidden"),m.cues&&m.cues.length>0)for(var n=S(m.cues,p,o),l=0;l<n.length;l++)m.removeCue(n[l]);a==="disabled"&&(m.mode=a)}function O(m,p){if(p<m[0].startTime)return 0;var o=m.length-1;if(p>m[o].endTime)return-1;for(var a=0,n=o;a<=n;){var l=Math.floor((n+a)/2);if(p<m[l].startTime)n=l-1;else if(p>m[l].startTime&&a<o)a=l+1;else return l}return m[a].startTime-p<p-m[n].startTime?a:n}function S(m,p,o){var a=[],n=O(m,p);if(n>-1)for(var l=n,s=m.length;l<s;l++){var e=m[l];if(e.startTime>=p&&e.endTime<=o)a.push(e);else if(e.startTime>o)return a}return a}},"./src/utils/time-ranges.ts":function(ce,W,w){"use strict";w.r(W);var j={toString:function(A){for(var F="",M=A.length,O=0;O<M;O++)F+="["+A.start(O).toFixed(3)+","+A.end(O).toFixed(3)+"]";return F}};W.default=j},"./src/utils/timescale-conversion.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"toTimescaleFromBase",function(){return I}),w.d(W,"toTimescaleFromScale",function(){return A}),w.d(W,"toMsFromMpegTsClock",function(){return F}),w.d(W,"toMpegTsClockFromTimescale",function(){return M});var j=9e4;function I(O,S,m,p){m===void 0&&(m=1),p===void 0&&(p=!1);var o=O*S*m;return p?Math.round(o):o}function A(O,S,m,p){return m===void 0&&(m=1),p===void 0&&(p=!1),I(O,S,1/m,p)}function F(O,S){return S===void 0&&(S=!1),I(O,1e3,1/j,S)}function M(O,S){return S===void 0&&(S=1),I(O,j,1/S)}},"./src/utils/typed-array.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"sliceUint8",function(){return j});function j(I,A,F){return Uint8Array.prototype.slice?I.slice(A,F):new Uint8Array(Array.prototype.slice.call(I,A,F))}},"./src/utils/vttcue.ts":function(ce,W,w){"use strict";w.r(W),W.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var j=["","lr","rl"],I=["start","middle","end","left","right"];function A(m,p){if(typeof p!="string")return!1;if(!Array.isArray(m))return!1;var o=p.toLowerCase();return~m.indexOf(o)?o:!1}function F(m){return A(j,m)}function M(m){return A(I,m)}function O(m){for(var p=arguments.length,o=new Array(p>1?p-1:0),a=1;a<p;a++)o[a-1]=arguments[a];for(var n=1;n<arguments.length;n++){var l=arguments[n];for(var s in l)m[s]=l[s]}return m}function S(m,p,o){var a=this,n={enumerable:!0};a.hasBeenReset=!1;var l="",s=!1,e=m,t=p,r=o,T=null,g="",_=!0,E="auto",b="start",c=50,i="middle",d=50,h="middle";Object.defineProperty(a,"id",O({},n,{get:function(){return l},set:function(v){l=""+v}})),Object.defineProperty(a,"pauseOnExit",O({},n,{get:function(){return s},set:function(v){s=!!v}})),Object.defineProperty(a,"startTime",O({},n,{get:function(){return e},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");e=v,this.hasBeenReset=!0}})),Object.defineProperty(a,"endTime",O({},n,{get:function(){return t},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");t=v,this.hasBeenReset=!0}})),Object.defineProperty(a,"text",O({},n,{get:function(){return r},set:function(v){r=""+v,this.hasBeenReset=!0}})),Object.defineProperty(a,"region",O({},n,{get:function(){return T},set:function(v){T=v,this.hasBeenReset=!0}})),Object.defineProperty(a,"vertical",O({},n,{get:function(){return g},set:function(v){var x=F(v);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=x,this.hasBeenReset=!0}})),Object.defineProperty(a,"snapToLines",O({},n,{get:function(){return _},set:function(v){_=!!v,this.hasBeenReset=!0}})),Object.defineProperty(a,"line",O({},n,{get:function(){return E},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");E=v,this.hasBeenReset=!0}})),Object.defineProperty(a,"lineAlign",O({},n,{get:function(){return b},set:function(v){var x=M(v);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");b=x,this.hasBeenReset=!0}})),Object.defineProperty(a,"position",O({},n,{get:function(){return c},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(a,"positionAlign",O({},n,{get:function(){return i},set:function(v){var x=M(v);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");i=x,this.hasBeenReset=!0}})),Object.defineProperty(a,"size",O({},n,{get:function(){return d},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");d=v,this.hasBeenReset=!0}})),Object.defineProperty(a,"align",O({},n,{get:function(){return h},set:function(v){var x=M(v);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");h=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(ce,W,w){"use strict";w.r(W),w.d(W,"parseTimeStamp",function(){return A}),w.d(W,"fixLineBreaks",function(){return p}),w.d(W,"VTTParser",function(){return o});var j=w("./src/utils/vttcue.ts"),I=function(){function a(){}var n=a.prototype;return n.decode=function(s,e){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},a}();function A(a){function n(s,e,t,r){return(s|0)*3600+(e|0)*60+(t|0)+parseFloat(r||0)}var l=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return l?parseFloat(l[2])>59?n(l[2],l[3],0,l[4]):n(l[1],l[2],l[3],l[4]):null}var F=function(){function a(){this.values=Object.create(null)}var n=a.prototype;return n.set=function(s,e){!this.get(s)&&e!==""&&(this.values[s]=e)},n.get=function(s,e,t){return t?this.has(s)?this.values[s]:e[t]:this.has(s)?this.values[s]:e},n.has=function(s){return s in this.values},n.alt=function(s,e,t){for(var r=0;r<t.length;++r)if(e===t[r]){this.set(s,e);break}},n.integer=function(s,e){/^-?\d+$/.test(e)&&this.set(s,parseInt(e,10))},n.percent=function(s,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var t=parseFloat(e);if(t>=0&&t<=100)return this.set(s,t),!0}return!1},a}();function M(a,n,l,s){var e=s?a.split(s):[a];for(var t in e){if(typeof e[t]!="string")continue;var r=e[t].split(l);if(r.length!==2)continue;var T=r[0],g=r[1];n(T,g)}}var O=new j.default(0,0,""),S=O.align==="middle"?"middle":"center";function m(a,n,l){var s=a;function e(){var T=A(a);if(T===null)throw new Error("Malformed timestamp: "+s);return a=a.replace(/^[^\sa-zA-Z-]+/,""),T}function t(T,g){var _=new F;M(T,function(c,i){var d;switch(c){case"region":for(var h=l.length-1;h>=0;h--)if(l[h].id===i){_.set(c,l[h].region);break}break;case"vertical":_.alt(c,i,["rl","lr"]);break;case"line":d=i.split(","),_.integer(c,d[0]),_.percent(c,d[0])&&_.set("snapToLines",!1),_.alt(c,d[0],["auto"]),d.length===2&&_.alt("lineAlign",d[1],["start",S,"end"]);break;case"position":d=i.split(","),_.percent(c,d[0]),d.length===2&&_.alt("positionAlign",d[1],["start",S,"end","line-left","line-right","auto"]);break;case"size":_.percent(c,i);break;case"align":_.alt(c,i,["start",S,"end","left","right"]);break}},/:/,/\s/),g.region=_.get("region",null),g.vertical=_.get("vertical","");var E=_.get("line","auto");E==="auto"&&O.line===-1&&(E=-1),g.line=E,g.lineAlign=_.get("lineAlign","start"),g.snapToLines=_.get("snapToLines",!0),g.size=_.get("size",100),g.align=_.get("align",S);var b=_.get("position","auto");b==="auto"&&O.position===50&&(b=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=b}function r(){a=a.replace(/^\s+/,"")}if(r(),n.startTime=e(),r(),a.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);a=a.substr(3),r(),n.endTime=e(),r(),t(a,n)}function p(a){return a.replace(/<br(?: \/)?>/gi,`
|
|
`)}var o=function(){function a(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var n=a.prototype;return n.parse=function(s){var e=this;s&&(e.buffer+=e.decoder.decode(s,{stream:!0}));function t(){var b=e.buffer,c=0;for(b=p(b);c<b.length&&b[c]!=="\r"&&b[c]!==`
|
|
`;)++c;var i=b.substr(0,c);return b[c]==="\r"&&++c,b[c]===`
|
|
`&&++c,e.buffer=b.substr(c),i}function r(b){M(b,function(c,i){},/:/)}try{var T="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;T=t();var g=T.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var _=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;_?_=!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(b){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var E=T.indexOf("-->")!==-1;if(!T||E&&(_=!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(b){e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},n.flush=function(){var s=this;try{if((s.cue||s.state==="HEADER")&&(s.buffer+=`
|
|
|
|
`,s.parse()),s.state==="INITIAL"||s.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(e){s.onparsingerror&&s.onparsingerror(e)}return s.onflush&&s.onflush(),this},a}()},"./src/utils/webvtt-parser.ts":function(ce,W,w){"use strict";w.r(W),w.d(W,"generateCueId",function(){return o}),w.d(W,"parseWebVTT",function(){return n});var j=w("./src/polyfills/number.ts"),I=w("./src/utils/vttparser.ts"),A=w("./src/demux/id3.ts"),F=w("./src/utils/timescale-conversion.ts"),M=w("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,S=function(s,e,t){return t===void 0&&(t=0),s.substr(t,e.length)===e},m=function(s){var e=parseInt(s.substr(-3)),t=parseInt(s.substr(-6,2)),r=parseInt(s.substr(-9,2)),T=s.length>9?parseInt(s.substr(0,s.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:"+s);return e+=1e3*t,e+=60*1e3*r,e+=60*60*1e3*T,e},p=function(s){for(var e=5381,t=s.length;t;)e=e*33^s.charCodeAt(--t);return(e>>>0).toString()};function o(l,s,e){return p(l.toString())+p(s.toString())+p(e)}var a=function(s,e,t){var r=s[e],T=s[r.prevCC];if(!T||!T.new&&r.new){s.ccOffset=s.presentationOffset=r.start,r.new=!1;return}for(;(g=T)!==null&&g!==void 0&&g.new;){var g;s.ccOffset+=r.start-T.start,r.new=!1,r=T,T=s[r.prevCC]}s.presentationOffset=t};function n(l,s,e,t,r,T,g,_){var E=new I.VTTParser,b=Object(A.utf8ArrayToStr)(new Uint8Array(l)).trim().replace(O,`
|
|
`).split(`
|
|
`),c=[],i=Object(F.toMpegTsClockFromTimescale)(s,e),d="00:00.000",h=0,y=0,v,x=!0,k=!1;E.oncue=function(R){var U=t[r],N=t.ccOffset,G=(h-i)/9e4;if(U!=null&&U.new&&(y!==void 0?N=t.ccOffset=U.start:a(t,r,G)),G&&(N=G-t.presentationOffset),k){var L=R.endTime-R.startTime,H=Object(M.normalizePts)((R.startTime+N-y)*9e4,T*9e4)/9e4;R.startTime=H,R.endTime=H+L}var V=R.text.trim();R.text=decodeURIComponent(encodeURIComponent(V)),R.id||(R.id=o(R.startTime,R.endTime,V)),R.endTime>0&&c.push(R)},E.onparsingerror=function(R){v=R},E.onflush=function(){if(v){_(v);return}g(c)},b.forEach(function(R){if(x)if(S(R,"X-TIMESTAMP-MAP=")){x=!1,k=!0,R.substr(16).split(",").forEach(function(U){S(U,"LOCAL:")?d=U.substr(6):S(U,"MPEGTS:")&&(h=parseInt(U.substr(7)))});try{y=m(d)/1e3}catch(U){k=!1,v=U}return}else R===""&&(x=!1);E.parse(R+`
|
|
`)}),E.flush()}},"./src/utils/xhr-loader.ts":function(ce,W,w){"use strict";w.r(W);var j=w("./src/utils/logger.ts"),I=w("./src/loader/load-stats.ts"),A=/^age:\s*[\d.]+\s*$/m,F=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 I.LoadStats,this.retryDelay=0}var O=M.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.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()))},O.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(m,p,o){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=p,this.callbacks=o,this.retryDelay=p.retryDelay,this.loadInternal()},O.loadInternal=function(){var m=this.config,p=this.context;if(!m)return;var o=this.loader=new self.XMLHttpRequest,a=this.stats;a.loading.first=0,a.loaded=0;var n=this.xhrSetup;try{if(n)try{n(o,p.url)}catch(e){o.open("GET",p.url,!0),n(o,p.url)}o.readyState||o.open("GET",p.url,!0);var l=this.context.headers;if(l)for(var s in l)o.setRequestHeader(s,l[s])}catch(e){this.callbacks.onError({code:o.status,text:e.message},p,o);return}p.rangeEnd&&o.setRequestHeader("Range","bytes="+p.rangeStart+"-"+(p.rangeEnd-1)),o.onreadystatechange=this.readystatechange.bind(this),o.onprogress=this.loadprogress.bind(this),o.responseType=p.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout),o.send()},O.readystatechange=function(){var m=this.context,p=this.loader,o=this.stats;if(!m||!p)return;var a=p.readyState,n=this.config;if(o.aborted)return;if(a>=2)if(self.clearTimeout(this.requestTimeout),o.loading.first===0&&(o.loading.first=Math.max(self.performance.now(),o.loading.start)),a===4){p.onreadystatechange=null,p.onprogress=null;var l=p.status;if(l>=200&&l<300){o.loading.end=Math.max(self.performance.now(),o.loading.first);var s,e;if(m.responseType==="arraybuffer"?(s=p.response,e=s.byteLength):(s=p.responseText,e=s.length),o.loaded=o.total=e,!this.callbacks)return;var t=this.callbacks.onProgress;if(t&&t(o,m,s,p),!this.callbacks)return;var r={url:p.responseURL,data:s};this.callbacks.onSuccess(r,o,m,p)}else o.retry>=n.maxRetry||l>=400&&l<499?(j.logger.error(l+" while loading "+m.url),this.callbacks.onError({code:l,text:p.statusText},m,p)):(j.logger.warn(l+" 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,n.maxRetryDelay),o.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout)},O.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))},O.loadprogress=function(m){var p=this.stats;p.loaded=m.loaded,m.lengthComputable&&(p.total=m.total)},O.getCacheAge=function(){var m=null;if(this.loader&&A.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");m=p?parseFloat(p):null}return m},M}();W.default=F}}).default})},vHTk:function(ut,tt,ne){ut.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|