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.
393 lines
965 KiB
393 lines
965 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[102,4,7,8,15],{"+ua5":function(Ye,ye,$){},"/cxE":function(Ye,ye,$){"use strict";$.d(ye,"f",function(){return O}),$.d(ye,"g",function(){return k}),$.d(ye,"h",function(){return w}),$.d(ye,"e",function(){return H}),$.d(ye,"b",function(){return U}),$.d(ye,"c",function(){return e}),$.d(ye,"d",function(){return S}),$.d(ye,"a",function(){return d});class ae{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(h){setTimeout(()=>{throw h.stack?new Error(h.message+`
|
|
|
|
`+h.stack):h},0)}}emit(h){this.listeners.forEach(o=>{o(h)})}onUnexpectedError(h){this.unexpectedErrorHandler(h),this.emit(h)}onUnexpectedExternalError(h){this.unexpectedErrorHandler(h)}}const B=new ae;function O(h){H(h)||B.onUnexpectedError(h);return}function k(h){H(h)||B.onUnexpectedExternalError(h);return}function w(h){if(h instanceof Error){let{name:o,message:a}=h;const r=h.stacktrace||h.stack;return{$isError:!0,name:o,message:a,stack:r}}return h}const R="Canceled";function H(h){return h instanceof Error&&h.name===R&&h.message===R}function U(){const h=new Error(R);return h.name=h.message,h}function e(h){return h?new Error(`Illegal argument: ${h}`):new Error("Illegal argument")}function S(h){return h?new Error(`Illegal state: ${h}`):new Error("Illegal state")}class d extends Error{constructor(h){super("NotSupported");h&&(this.message=h)}}},"24hK":function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return B});class ae{constructor(O){this.element=O,this.next=ae.Undefined,this.prev=ae.Undefined}}ae.Undefined=new ae(void 0);class B{constructor(){this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ae.Undefined}clear(){let O=this._first;for(;O!==ae.Undefined;){const k=O.next;O.prev=ae.Undefined,O.next=ae.Undefined,O=k}this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}unshift(O){return this._insert(O,!1)}push(O){return this._insert(O,!0)}_insert(O,k){const w=new ae(O);if(this._first===ae.Undefined)this._first=w,this._last=w;else if(k){const H=this._last;this._last=w,w.prev=H,H.next=w}else{const H=this._first;this._first=w,w.next=H,H.prev=w}this._size+=1;let R=!1;return()=>{R||(R=!0,this._remove(w))}}shift(){if(this._first===ae.Undefined)return;{const O=this._first.element;return this._remove(this._first),O}}pop(){if(this._last===ae.Undefined)return;{const O=this._last.element;return this._remove(this._last),O}}_remove(O){if(O.prev!==ae.Undefined&&O.next!==ae.Undefined){const k=O.prev;k.next=O.next,O.next.prev=k}else O.prev===ae.Undefined&&O.next===ae.Undefined?(this._first=ae.Undefined,this._last=ae.Undefined):O.next===ae.Undefined?(this._last=this._last.prev,this._last.next=ae.Undefined):O.prev===ae.Undefined&&(this._first=this._first.next,this._first.prev=ae.Undefined);this._size-=1}*[Symbol.iterator](){let O=this._first;for(;O!==ae.Undefined;)yield O.element,O=O.next}}},"3/fG":function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return B});function ae(O,k){let w;return k.length===0?w=O:w=O.replace(/\{(\d+)\}/g,function(R,H){const U=H[0];return typeof k[U]!="undefined"?k[U]:R}),w}function B(O,k,...w){return ae(k,w)}},"479L":function(Ye,ye){Ye.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAWCAYAAAAvg9c4AAAAAXNSR0IArs4c6QAABPdJREFUSEullWloHGUYx//vzO7sHDuzm93sZpM2l/SgRyK7xSYxrfYgbdUq6JcixXqAUrxItGAVMT1A+kH7Re1WWppa6afiAYJIi7ZB07vkIARzVJqYbJMmu90zszOzM6/MVEXQotR3mPky8/7e//N7ZuYl+J+jt7fX7/f7i/X19cU/UORemZRSZnBwsKNQKLztdrtHOI57sqGhYcbm3ROUUsoOD4++Mz9f2CtJItE0DaVSqTMWi+27Jyil1DM0NLTfsmgHpZbLhthQSmlfTU3NmkgkUvjPSSmlZGRkZI2maZ2mWdpAGBehpgnd0KBpOkzTLPn9/gei0Wjfv0JHR0cXGpq2xTDNHZTSJsu0OJNaIIRFUc07KXXdgGVZCAQCL7e0tMT/Br3ja3iRaZptlmU9YVHayhBGoAApGTpKhgHCsFCLRaRvp+yEtk9QaiEYDHy0cWPb639CbdjAwADP8/zRkmk9BYADIU4nLUqdycX5Agxdh4cXkLh5E8m5WTD2A4SAZVmEwxVnNm3a9AiJx+MrdSI8nslm25YtqlMaVi6LWab1+2IUFIB9NXQDuUwapmFAUnwYHBhAOp0Ex3nAcRx4QUA4FL62ecuWVnL01Om8V1YkXdewpMoLn6zYC4NhGLhcLng4t4OdnEognUqCIQSSJOPipYvI5gsQBBGyV4KiyAgFgz83NDauImevDtFUJo+ZqXGsW7UcvjK/zQDDEBBCHF+pZBKTU1NOl1mWgYfnMTNzy1FTWbUA6UzWuVce9N2QRKmRfP3d9zSRLOBS9xlsbVsLv893p2TLcjzqhgGtqEEvGWAI47izyx27ft2ppq6uHpIoIFcowqfIkz7Fu4LEjxyhVUtX4cuTn2FxdQiiKILYKe3DbpTtwu4Fw4Bzu8F5PGAZFqnbKWdhRVEQDkegm5YNnVhYFVlJ9uzbb2x++iXXxwf2o0Jxg+N5J4ENs/0RlgVLCFwuNyRJhCAITgX+sgCyubzjXZK88Hq9ttuRMr8SI2d+OHdCqFz8zMkjh1SeqqXy8qBsGIbj0rQs56UGpXCxLCRZhiLLmFdVyF4FmmFAUXzw+RRIogSvV+xdUFX5ILl07drBIh/quHD2bNeK+vLLum7ENXUe+Xweqqo6p6brMEsleDweJ1Eul0MgWA7Too6uYCAAryxDEvlzzU1NbeTClSsHDTHScaG7+/D6pmU9k2nt8/TU+NUl91UP53K5dblcrjKfzzOFQsFpmu01k8mgrCwAC4yjygZXVkYgy9LR1paWF0n3jz0fMMGaN8+f6z68oXnp+V/T1omRgd7ju9t3Pp9IJMTZ2dmHMpnMtnQ6/Wg2mw2pqkqy2SzcbjdcnAiOczuJIxUhVIRCu5qbV39Ivj19+oBSvfytyz/1HG5trLs4NU+O3xge6npj53Mv/PUHPj09HR4bG9s+NzfXnkymatSiCoEX4C8rA+fh4eE4GioPrI1Goz3k1Fdf7KlcEuvsu3z1mN9jjY3fSr/vgX5oV/trr/zTrtDf379wYmIinkqlHrMsi8iyDFnxQRCFsdrq6tW1tbW3yXt79z77y42J44KL5FPJOeJiXUb0/oYdu9/t/OZuW42tpa+v75iqqtvy+RwqwiEIvPjJw+vXv+q8011dXXx/f/9WWZaVQCBwE0Bfe3v7NCHE/rDuOmzw+Pj4p4lEYruLZWeqa2o2xmKxIXvCb487Tm3fsdeDAAAAAElFTkSuQmCC"},"55Ip":function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return i});var ae=$("Ty5D"),B=$("dI71"),O=$("q1tI"),k=$.n(O),w=$("YS25"),R=$("17x9"),H=$.n(R),U=$("wx14"),e=$("zLVn"),S=$("9R94"),d=function(c){Object(B.a)(m,c);function m(){for(var _,y=arguments.length,T=new Array(y),M=0;M<y;M++)T[M]=arguments[M];return _=c.call.apply(c,[this].concat(T))||this,_.history=Object(w.a)(_.props),_}var u=m.prototype;return u.render=function(){return k.a.createElement(ae.c,{history:this.history,children:this.props.children})},m}(k.a.Component),h=function(c){Object(B.a)(m,c);function m(){for(var _,y=arguments.length,T=new Array(y),M=0;M<y;M++)T[M]=arguments[M];return _=c.call.apply(c,[this].concat(T))||this,_.history=Object(w.b)(_.props),_}var u=m.prototype;return u.render=function(){return k.a.createElement(ae.c,{history:this.history,children:this.props.children})},m}(k.a.Component),o=function(m,u){return typeof m=="function"?m(u):m},a=function(m,u){return typeof m=="string"?Object(w.c)(m,null,null,u):m},r=function(m){return m},l=k.a.forwardRef;typeof l=="undefined"&&(l=r);function s(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var n=l(function(c,m){var u=c.innerRef,_=c.navigate,y=c.onClick,T=Object(e.a)(c,["innerRef","navigate","onClick"]),M=T.target,L=Object(U.a)({},T,{onClick:function(D){try{y&&y(D)}catch(j){throw D.preventDefault(),j}!D.defaultPrevented&&D.button===0&&(!M||M==="_self")&&!s(D)&&(D.preventDefault(),_())}});return r!==l?L.ref=m||u:L.ref=u,k.a.createElement("a",L)}),i=l(function(c,m){var u=c.component,_=u===void 0?n:u,y=c.replace,T=c.to,M=c.innerRef,L=Object(e.a)(c,["component","replace","to","innerRef"]);return k.a.createElement(ae.e.Consumer,null,function(x){x||Object(S.a)(!1);var D=x.history,j=a(o(T,x.location),x.location),I=j?D.createHref(j):"",W=Object(U.a)({},L,{href:I,navigate:function(){var fe=o(T,x.location),de=y?D.replace:D.push;de(fe)}});return r!==l?W.ref=m||M:W.innerRef=M,k.a.createElement(_,W)})});if(!1)var t,v;var f=function(m){return m},p=k.a.forwardRef;typeof p=="undefined"&&(p=f);function E(){for(var c=arguments.length,m=new Array(c),u=0;u<c;u++)m[u]=arguments[u];return m.filter(function(_){return _}).join(" ")}var b=p(function(c,m){var u=c["aria-current"],_=u===void 0?"page":u,y=c.activeClassName,T=y===void 0?"active":y,M=c.activeStyle,L=c.className,x=c.exact,D=c.isActive,j=c.location,I=c.sensitive,W=c.strict,Q=c.style,fe=c.to,de=c.innerRef,Oe=Object(e.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return k.a.createElement(ae.e.Consumer,null,function(Se){Se||Object(S.a)(!1);var Ie=j||Se.location,Le=a(o(fe,Ie),Ie),Ne=Le.pathname,be=Ne&&Ne.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),N=be?Object(ae.f)(Ie.pathname,{path:be,exact:x,sensitive:I,strict:W}):null,A=!!(D?D(N,Ie):N),C=A?E(L,T):L,F=A?Object(U.a)({},Q,{},M):Q,G=Object(U.a)({"aria-current":A&&_||null,className:C,style:F,to:Le},Oe);return f!==p?G.ref=m||de:G.innerRef=de,k.a.createElement(i,G)})});if(!1)var g},"5VLF":function(Ye,ye,$){"use strict";var ae,B;function O(k,w,R){var H=function(U,e){return k.js_beautify(U,e)};return H.js=k.js_beautify,H.css=w.css_beautify,H.html=R.html_beautify,H.js_beautify=k.js_beautify,H.css_beautify=w.css_beautify,H.html_beautify=R.html_beautify,H}!(ae=[$("6UM0"),$("TXwP"),$("psGv")],B=function(k,w,R){return O(k,w,R)}.apply(ye,ae),B!==void 0&&(Ye.exports=B))},"5Y4S":function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return O});var ae=$("MNsG");const B=ae.b.performance&&typeof ae.b.performance.now=="function";class O{constructor(k){this._highResolution=B&&k,this._startTime=this._now(),this._stopTime=-1}static create(k=!0){return new O(k)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?ae.b.performance.now():Date.now()}}},"6UM0":function(Ye,ye,$){var ae,B;(function(){var O;(function(){"use strict";var w=[function(e,S,d){var h=d(1).Beautifier,o=d(5).Options;function a(r,l){var s=new h(r,l);return s.beautify()}e.exports=a,e.exports.defaultOptions=function(){return new o}},function(e,S,d){var h=d(2).Output,o=d(3).Token,a=d(4),r=d(5).Options,l=d(7).Tokenizer,s=d(7).line_starters,n=d(7).positionable_operators,i=d(7).TOKEN;function t(I,W){return W.indexOf(I)!==-1}function v(I){return I.replace(/^\s+/g,"")}function f(I){for(var W={},Q=0;Q<I.length;Q++)W[I[Q].replace(/-/g,"_")]=I[Q];return W}function p(I,W){return I&&I.type===i.RESERVED&&I.text===W}function E(I,W){return I&&I.type===i.RESERVED&&t(I.text,W)}var b=["case","return","do","if","throw","else","await","break","continue","async"],g=["before-newline","after-newline","preserve-newline"],c=f(g),m=[c.before_newline,c.preserve_newline],u={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function _(I,W){if(W.multiline_frame||W.mode===u.ForInitializer||W.mode===u.Conditional)return;I.remove_indent(W.start_line_index)}function y(I){I=I.replace(a.allLineBreaks,`
|
|
`);for(var W=[],Q=I.indexOf(`
|
|
`);Q!==-1;)W.push(I.substring(0,Q)),I=I.substring(Q+1),Q=I.indexOf(`
|
|
`);return I.length&&W.push(I),W}function T(I){return I===u.ArrayLiteral}function M(I){return t(I,[u.Expression,u.ForInitializer,u.Conditional])}function L(I,W){for(var Q=0;Q<I.length;Q++){var fe=I[Q].trim();if(fe.charAt(0)!==W)return!1}return!0}function x(I,W){for(var Q=0,fe=I.length,de;Q<fe;Q++)if(de=I[Q],de&&de.indexOf(W)!==0)return!1;return!0}function D(I,W){W=W||{},this._source_text=I||"",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 r(W)}D.prototype.create_flags=function(I,W){var Q=0;I&&(Q=I.indentation_level,!this._output.just_added_newline()&&I.line_indent_level>Q&&(Q=I.line_indent_level));var fe={mode:W,parent:I,last_token:I?I.last_token:new o(i.START_BLOCK,""),last_word:I?I.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:Q,alignment:0,line_indent_level:I?I.line_indent_level:Q,start_line_index:this._output.get_line_number(),ternary_depth:0};return fe},D.prototype._reset=function(I){var W=I.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new h(this._options,W),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(u.BlockStatement);var Q=new l(I,this._options);return this._tokens=Q.tokenize(),I},D.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var I,W=this._reset(this._source_text),Q=this._options.eol;this._options.eol==="auto"&&(Q=`
|
|
`,W&&a.lineBreak.test(W||"")&&(Q=W.match(a.lineBreak)[0]));for(var fe=this._tokens.next();fe;)this.handle_token(fe),this._last_last_text=this._flags.last_token.text,this._flags.last_token=fe,fe=this._tokens.next();return I=this._output.get_code(Q),I},D.prototype.handle_token=function(I,W){I.type===i.START_EXPR?this.handle_start_expr(I):I.type===i.END_EXPR?this.handle_end_expr(I):I.type===i.START_BLOCK?this.handle_start_block(I):I.type===i.END_BLOCK?this.handle_end_block(I):I.type===i.WORD?this.handle_word(I):I.type===i.RESERVED?this.handle_word(I):I.type===i.SEMICOLON?this.handle_semicolon(I):I.type===i.STRING?this.handle_string(I):I.type===i.EQUALS?this.handle_equals(I):I.type===i.OPERATOR?this.handle_operator(I):I.type===i.COMMA?this.handle_comma(I):I.type===i.BLOCK_COMMENT?this.handle_block_comment(I,W):I.type===i.COMMENT?this.handle_comment(I,W):I.type===i.DOT?this.handle_dot(I):I.type===i.EOF?this.handle_eof(I):I.type===i.UNKNOWN?this.handle_unknown(I,W):this.handle_unknown(I,W)},D.prototype.handle_whitespace_and_comments=function(I,W){var Q=I.newlines,fe=this._options.keep_array_indentation&&T(this._flags.mode);if(I.comments_before)for(var de=I.comments_before.next();de;)this.handle_whitespace_and_comments(de,W),this.handle_token(de,W),de=I.comments_before.next();if(fe)for(var Oe=0;Oe<Q;Oe+=1)this.print_newline(Oe>0,W);else if(this._options.max_preserve_newlines&&Q>this._options.max_preserve_newlines&&(Q=this._options.max_preserve_newlines),this._options.preserve_newlines&&Q>1){this.print_newline(!1,W);for(var Se=1;Se<Q;Se+=1)this.print_newline(!0,W)}};var j=["async","break","continue","return","throw","yield"];D.prototype.allow_wrap_or_preserved_newline=function(I,W){if(W=W===void 0?!1:W,this._output.just_added_newline())return;var Q=this._options.preserve_newlines&&I.newlines||W,fe=t(this._flags.last_token.text,n)||t(I.text,n);if(fe){var de=t(this._flags.last_token.text,n)&&t(this._options.operator_position,m)||t(I.text,n);Q=Q&&de}if(Q)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(E(this._flags.last_token,j))return;this._output.set_wrap_point()}},D.prototype.print_newline=function(I,W){if(!W&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==i.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var Q=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&p(Q,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(I)&&(this._flags.multiline_frame=!0)},D.prototype.print_token_line_indentation=function(I){this._output.just_added_newline()&&(this._options.keep_array_indentation&&I.newlines&&(I.text==="["||T(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(I.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))},D.prototype.print_token=function(I){if(this._output.raw){this._output.add_raw_token(I);return}if(this._options.comma_first&&I.previous&&I.previous.type===i.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var W=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(W),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(I),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(I),this._output.non_breaking_space=!0,this._output.add_token(I.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},D.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},D.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))},D.prototype.set_mode=function(I){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,I),this._flags=this.create_flags(this._previous_flags,I),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},D.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===u.Statement&&_(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},D.prototype.start_of_object_property=function(){return this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||E(this._flags.last_token,["get","set"]))},D.prototype.start_of_statement=function(I){var W=!1;return W=W||E(this._flags.last_token,["var","let","const"])&&I.type===i.WORD,W=W||p(this._flags.last_token,"do"),W=W||!(this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement)&&E(this._flags.last_token,j)&&!I.newlines,W=W||p(this._flags.last_token,"else")&&!(p(I,"if")&&!I.comments_before),W=W||this._flags.last_token.type===i.END_EXPR&&(this._previous_flags.mode===u.ForInitializer||this._previous_flags.mode===u.Conditional),W=W||this._flags.last_token.type===i.WORD&&this._flags.mode===u.BlockStatement&&!this._flags.in_case&&!(I.text==="--"||I.text==="++")&&this._last_last_text!=="function"&&I.type!==i.WORD&&I.type!==i.RESERVED,W=W||this._flags.mode===u.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||E(this._flags.last_token,["get","set"])),W?(this.set_mode(u.Statement),this.indent(),this.handle_whitespace_and_comments(I,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(I,E(I,["do","for","if","while"])),!0):!1},D.prototype.handle_start_expr=function(I){this.start_of_statement(I)||this.handle_whitespace_and_comments(I);var W=u.Expression;if(I.text==="["){if(this._flags.last_token.type===i.WORD||this._flags.last_token.text===")"){E(this._flags.last_token,s)&&(this._output.space_before_token=!0),this.print_token(I),this.set_mode(W),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}W=u.ArrayLiteral,T(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())),t(this._flags.last_token.type,[i.START_EXPR,i.END_EXPR,i.WORD,i.OPERATOR,i.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===i.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,W=u.ForInitializer):t(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,W=u.Conditional):t(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&I.whitespace_before===""?this._output.space_before_token=!1:(t(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===i.EQUALS||this._flags.last_token.type===i.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(I);else if(this._flags.last_token.type===i.WORD){this._output.space_before_token=!1;var Q=this._tokens.peek(-3);if(this._options.space_after_named_function&&Q){var fe=this._tokens.peek(-4);E(Q,["async","function"])||Q.text==="*"&&E(fe,["async","function"])?this._output.space_before_token=!0:this._flags.mode===u.ObjectLiteral?(Q.text==="{"||Q.text===","||Q.text==="*"&&(fe.text==="{"||fe.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(I);(this._flags.last_token.type===i.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(t(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&t(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===i.START_BLOCK?this.print_newline():(this._flags.last_token.type===i.END_EXPR||this._flags.last_token.type===i.START_EXPR||this._flags.last_token.type===i.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===i.COMMA)&&this.allow_wrap_or_preserved_newline(I,I.newlines),this.print_token(I),this.set_mode(W),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},D.prototype.handle_end_expr=function(I){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(I),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(I,I.text==="]"&&T(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===i.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(I),this.restore_mode(),_(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===u.Conditional&&(this._previous_flags.mode=u.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},D.prototype.handle_start_block=function(I){this.handle_whitespace_and_comments(I);var W=this._tokens.peek(),Q=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===i.END_EXPR?(this.set_mode(u.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(u.BlockStatement):Q&&(t(Q.text,[":",","])&&t(W.type,[i.STRING,i.WORD,i.RESERVED])||t(W.text,["get","set","..."])&&t(Q.type,[i.WORD,i.RESERVED]))?t(this._last_last_text,["class","interface"])&&!t(Q.text,[":",","])?this.set_mode(u.BlockStatement):this.set_mode(u.ObjectLiteral):this._flags.last_token.type===i.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(u.BlockStatement):t(this._flags.last_token.type,[i.EQUALS,i.START_EXPR,i.COMMA,i.OPERATOR])||E(this._flags.last_token,["return","throw","import","default"])?this.set_mode(u.ObjectLiteral):this.set_mode(u.BlockStatement),this._flags.last_token&&(E(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var fe=!W.comments_before&&W.text==="}",de=fe&&this._flags.last_word==="function"&&this._flags.last_token.type===i.END_EXPR;if(this._options.brace_preserve_inline){var Oe=0,Se=null;this._flags.inline_frame=!0;do if(Oe+=1,Se=this._tokens.peek(Oe-1),Se.newlines){this._flags.inline_frame=!1;break}while(Se.type!==i.EOF&&!(Se.type===i.END_BLOCK&&Se.opened===I))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&I.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==i.OPERATOR&&(de||this._flags.last_token.type===i.EQUALS||E(this._flags.last_token,b)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(T(this._previous_flags.mode)&&(this._flags.last_token.type===i.START_EXPR||this._flags.last_token.type===i.COMMA)&&((this._flags.last_token.type===i.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===i.COMMA||this._flags.last_token.type===i.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(I),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==i.OPERATOR&&this._flags.last_token.type!==i.START_EXPR&&(this._flags.last_token.type===i.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(I),this.indent(),!fe&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},D.prototype.handle_end_block=function(I){for(this.handle_whitespace_and_comments(I);this._flags.mode===u.Statement;)this.restore_mode();var W=this._flags.last_token.type===i.START_BLOCK;this._flags.inline_frame&&!W?this._output.space_before_token=!0:this._options.brace_style==="expand"?W||this.print_newline():W||(T(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(I)},D.prototype.handle_word=function(I){if(I.type===i.RESERVED){if(t(I.text,["set","get"])&&this._flags.mode!==u.ObjectLiteral)I.type=i.WORD;else if(I.text==="import"&&t(this._tokens.peek().text,["(","."]))I.type=i.WORD;else if(t(I.text,["as","from"])&&!this._flags.import_block)I.type=i.WORD;else if(this._flags.mode===u.ObjectLiteral){var W=this._tokens.peek();W.text===":"&&(I.type=i.WORD)}}if(this.start_of_statement(I)?E(this._flags.last_token,["var","let","const"])&&I.type===i.WORD&&(this._flags.declaration_statement=!0):I.newlines&&!M(this._flags.mode)&&(this._flags.last_token.type!==i.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==i.EQUALS&&(this._options.preserve_newlines||!E(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(I),this.print_newline()):this.handle_whitespace_and_comments(I),this._flags.do_block&&!this._flags.do_while)if(p(I,"while")){this._output.space_before_token=!0,this.print_token(I),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&&p(I,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===u.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&E(I,["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(I),this._flags.in_case=!0;return}if((this._flags.last_token.type===i.COMMA||this._flags.last_token.type===i.START_EXPR||this._flags.last_token.type===i.EQUALS||this._flags.last_token.type===i.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(I)),p(I,"function")){(t(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(t(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===i.OPERATOR))&&(!this._output.just_added_blankline()&&!I.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===i.RESERVED||this._flags.last_token.type===i.WORD?E(this._flags.last_token,["get","set","new","export"])||E(this._flags.last_token,j)?this._output.space_before_token=!0:p(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===i.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(M(this._flags.mode)||T(this._flags.mode))||this.print_newline(),this.print_token(I),this._flags.last_word=I.text;return}var Q="NONE";if(this._flags.last_token.type===i.END_BLOCK?this._previous_flags.inline_frame?Q="SPACE":E(I,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&I.newlines?Q="NEWLINE":(Q="SPACE",this._output.space_before_token=!0):Q="NEWLINE":this._flags.last_token.type===i.SEMICOLON&&this._flags.mode===u.BlockStatement?Q="NEWLINE":this._flags.last_token.type===i.SEMICOLON&&M(this._flags.mode)?Q="SPACE":this._flags.last_token.type===i.STRING?Q="NEWLINE":this._flags.last_token.type===i.RESERVED||this._flags.last_token.type===i.WORD||this._flags.last_token.text==="*"&&(t(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&t(this._last_last_text,["{",","]))?Q="SPACE":this._flags.last_token.type===i.START_BLOCK?this._flags.inline_frame?Q="SPACE":Q="NEWLINE":this._flags.last_token.type===i.END_EXPR&&(this._output.space_before_token=!0,Q="NEWLINE"),E(I,s)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Q="SPACE":Q="NEWLINE"),E(I,["else","catch","finally"]))if((!(this._flags.last_token.type===i.END_BLOCK&&this._previous_flags.mode===u.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&I.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var fe=this._output.current_line;fe.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else Q==="NEWLINE"?E(this._flags.last_token,b)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&E(I,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==i.END_EXPR?(this._flags.last_token.type!==i.START_EXPR||!E(I,["var","let","const"]))&&this._flags.last_token.text!==":"&&(p(I,"if")&&p(I.previous,"else")?this._output.space_before_token=!0:this.print_newline()):E(I,s)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&T(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():Q==="SPACE"&&(this._output.space_before_token=!0);I.previous&&(I.previous.type===i.WORD||I.previous.type===i.RESERVED)&&(this._output.space_before_token=!0),this.print_token(I),this._flags.last_word=I.text,I.type===i.RESERVED&&(I.text==="do"?this._flags.do_block=!0:I.text==="if"?this._flags.if_block=!0:I.text==="import"?this._flags.import_block=!0:this._flags.import_block&&p(I,"from")&&(this._flags.import_block=!1))},D.prototype.handle_semicolon=function(I){this.start_of_statement(I)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(I);for(var W=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&p(W,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(I)},D.prototype.handle_string=function(I){I.text.startsWith("`")&&I.newlines===0&&I.whitespace_before===""&&(I.previous.text===")"||this._flags.last_token.type===i.WORD)||(this.start_of_statement(I)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(I),this._flags.last_token.type===i.RESERVED||this._flags.last_token.type===i.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===i.COMMA||this._flags.last_token.type===i.START_EXPR||this._flags.last_token.type===i.EQUALS||this._flags.last_token.type===i.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(I):I.text.startsWith("`")&&this._flags.last_token.type===i.END_EXPR&&(I.previous.text==="]"||I.previous.text===")")&&I.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(I)},D.prototype.handle_equals=function(I){this.start_of_statement(I)||this.handle_whitespace_and_comments(I),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(I),this._output.space_before_token=!0},D.prototype.handle_comma=function(I){this.handle_whitespace_and_comments(I,!0),this.print_token(I),this._output.space_before_token=!0,this._flags.declaration_statement?(M(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(I)):this._flags.mode===u.ObjectLiteral||this._flags.mode===u.Statement&&this._flags.parent.mode===u.ObjectLiteral?(this._flags.mode===u.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(I)},D.prototype.handle_operator=function(I){var W=I.text==="*"&&(E(this._flags.last_token,["function","yield"])||t(this._flags.last_token.type,[i.START_BLOCK,i.COMMA,i.END_BLOCK,i.SEMICOLON])),Q=t(I.text,["-","+"])&&(t(this._flags.last_token.type,[i.START_BLOCK,i.START_EXPR,i.EQUALS,i.OPERATOR])||t(this._flags.last_token.text,s)||this._flags.last_token.text===",");if(!this.start_of_statement(I)){var fe=!W;this.handle_whitespace_and_comments(I,fe)}if(I.text==="*"&&this._flags.last_token.type===i.DOT){this.print_token(I);return}if(I.text==="::"){this.print_token(I);return}if(this._flags.last_token.type===i.OPERATOR&&t(this._options.operator_position,m)&&this.allow_wrap_or_preserved_newline(I),I.text===":"&&this._flags.in_case){this.print_token(I),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==i.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 de=!0,Oe=!0,Se=!1;if(I.text===":"?this._flags.ternary_depth===0?de=!1:(this._flags.ternary_depth-=1,Se=!0):I.text==="?"&&(this._flags.ternary_depth+=1),!Q&&!W&&this._options.preserve_newlines&&t(I.text,n)){var Ie=I.text===":",Le=Ie&&Se,Ne=Ie&&!Se;switch(this._options.operator_position){case c.before_newline:this._output.space_before_token=!Ne,this.print_token(I),(!Ie||Le)&&this.allow_wrap_or_preserved_newline(I),this._output.space_before_token=!0;return;case c.after_newline:this._output.space_before_token=!0,!Ie||Le?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(I):this._output.space_before_token=!1,this.print_token(I),this._output.space_before_token=!0;return;case c.preserve_newline:Ne||this.allow_wrap_or_preserved_newline(I),de=!(this._output.just_added_newline()||Ne),this._output.space_before_token=de,this.print_token(I),this._output.space_before_token=!0;return}}if(W){this.allow_wrap_or_preserved_newline(I),de=!1;var be=this._tokens.peek();Oe=be&&t(be.type,[i.WORD,i.RESERVED])}else if(I.text==="...")this.allow_wrap_or_preserved_newline(I),de=this._flags.last_token.type===i.START_BLOCK,Oe=!1;else if(t(I.text,["--","++","!","~"])||Q){if((this._flags.last_token.type===i.COMMA||this._flags.last_token.type===i.START_EXPR)&&this.allow_wrap_or_preserved_newline(I),de=!1,Oe=!1,I.newlines&&(I.text==="--"||I.text==="++"||I.text==="~")){var N=E(this._flags.last_token,b)&&I.newlines;N&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(N,!0)}this._flags.last_token.text===";"&&M(this._flags.mode)&&(de=!0),this._flags.last_token.type===i.RESERVED?de=!0:this._flags.last_token.type===i.END_EXPR?de=!(this._flags.last_token.text==="]"&&(I.text==="--"||I.text==="++")):this._flags.last_token.type===i.OPERATOR&&(de=t(I.text,["--","-","++","+"])&&t(this._flags.last_token.text,["--","-","++","+"]),t(I.text,["+","-"])&&t(this._flags.last_token.text,["--","++"])&&(Oe=!0)),(this._flags.mode===u.BlockStatement&&!this._flags.inline_frame||this._flags.mode===u.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||de,this.print_token(I),this._output.space_before_token=Oe},D.prototype.handle_block_comment=function(I,W){if(this._output.raw){this._output.add_raw_token(I),I.directives&&I.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(I.directives){this.print_newline(!1,W),this.print_token(I),I.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!a.newline.test(I.text)&&!I.newlines){this._output.space_before_token=!0,this.print_token(I),this._output.space_before_token=!0;return}else this.print_block_commment(I,W)},D.prototype.print_block_commment=function(I,W){var Q=y(I.text),fe,de=!1,Oe=!1,Se=I.whitespace_before,Ie=Se.length;if(this.print_newline(!1,W),this.print_token_line_indentation(I),this._output.add_token(Q[0]),this.print_newline(!1,W),Q.length>1){for(Q=Q.slice(1),de=L(Q,"*"),Oe=x(Q,Se),de&&(this._flags.alignment=1),fe=0;fe<Q.length;fe++)de?(this.print_token_line_indentation(I),this._output.add_token(v(Q[fe]))):Oe&&Q[fe]?(this.print_token_line_indentation(I),this._output.add_token(Q[fe].substring(Ie))):(this._output.current_line.set_indent(-1),this._output.add_token(Q[fe])),this.print_newline(!1,W);this._flags.alignment=0}},D.prototype.handle_comment=function(I,W){I.newlines?this.print_newline(!1,W):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(I),this.print_newline(!1,W)},D.prototype.handle_dot=function(I){this.start_of_statement(I)||this.handle_whitespace_and_comments(I,!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(I,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(I)},D.prototype.handle_unknown=function(I,W){this.print_token(I),I.text[I.text.length-1]===`
|
|
`&&this.print_newline(!1,W)},D.prototype.handle_eof=function(I){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(I)},e.exports.Beautifier=D},function(e){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 d(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}d.prototype.get_indent_size=function(o,a){var r=this.__base_string_length;return a=a||0,o<0&&(r=0),r+=o*this.__indent_size,r+=a,r},d.prototype.get_indent_string=function(o,a){var r=this.__base_string;return a=a||0,o<0&&(o=0,r=""),a+=o*this.__indent_size,this.__ensure_cache(a),r+=this.__cache[a],r},d.prototype.__ensure_cache=function(o){for(;o>=this.__cache.length;)this.__add_column()},d.prototype.__add_column=function(){var o=this.__cache.length,a=0,r="";this.__indent_size&&o>=this.__indent_size&&(a=Math.floor(o/this.__indent_size),o-=a*this.__indent_size,r=new Array(a+1).join(this.__indent_string)),o&&(r+=new Array(o+1).join(" ")),this.__cache.push(r)};function h(o,a){this.__indent_cache=new d(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()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(o,a){return this.__indent_cache.get_indent_string(o,a)},h.prototype.get_indent_size=function(o,a){return this.__indent_cache.get_indent_size(o,a)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(o){return this.is_empty()||!o&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(o){this.trim(!0);var 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 r=this.__lines.join(`
|
|
`);return o!==`
|
|
`&&(r=r.replace(/[\n]/g,o)),r},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.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)},h.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},h.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()},h.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(" "))},h.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()},h.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},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(o,a){for(var r=this.__lines.length-2;r>=0;){var l=this.__lines[r];if(l.is_empty())break;if(l.item(0).indexOf(o)!==0&&l.item(-1)!==a){this.__lines.splice(r+1,0,new S(this)),this.previous_line=this.__lines[this.__lines.length-2];break}r--}},e.exports.Output=h},function(e){function S(d,h,o,a){this.type=d,this.text=h,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}e.exports.Token=S},function(e,S){var d="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",h="\\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",r="(?:\\\\u[0-9a-fA-F]{4}|["+d+o+"])",l="(?:\\\\u[0-9a-fA-F]{4}|["+h+o+a+"])*";S.identifier=new RegExp(r+l,"g"),S.identifierStart=new RegExp(r),S.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+h+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(e,S,d){var h=d(6).Options,o=["before-newline","after-newline","preserve-newline"];function a(r){h.call(this,r,"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 n=0;n<s.length;n++)s[n]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=s[n];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 h,e.exports.Options=a},function(e){function S(o,a){this.raw_options=d(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 r=this.raw_options[o],l=a||[];return typeof r=="object"?r!==null&&typeof r.concat=="function"&&(l=r.concat()):typeof r=="string"&&(l=r.split(/[^a-zA-Z0-9_\/\-]+/)),l},S.prototype._get_boolean=function(o,a){var r=this.raw_options[o],l=r===void 0?!!a:!!r;return l},S.prototype._get_characters=function(o,a){var r=this.raw_options[o],l=a||"";return typeof r=="string"&&(l=r.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),l},S.prototype._get_number=function(o,a){var r=this.raw_options[o];a=parseInt(a,10),isNaN(a)&&(a=0);var l=parseInt(r,10);return isNaN(l)&&(l=a),l},S.prototype._get_selection=function(o,a,r){var l=this._get_selection_list(o,a,r);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,r){if(!a||a.length===0)throw new Error("Selection list cannot be empty.");if(r=r||[a[0]],!this._is_valid_selection(r,a))throw new Error("Invalid Default Value!");var l=this._get_array(o,r);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(r){return a.indexOf(r)===-1})};function d(o,a){var r={};o=h(o);var l;for(l in o)l!==a&&(r[l]=o[l]);if(a&&o[a])for(l in o[a])r[l]=o[a][l];return r}function h(o){var a={},r;for(r in o){var l=r.replace(/-/g,"_");a[l]=o[r]}return a}e.exports.Options=S,e.exports.normalizeOpts=h,e.exports.mergeOpts=d},function(e,S,d){var h=d(8).InputScanner,o=d(9).Tokenizer,a=d(9).TOKEN,r=d(13).Directives,l=d(4),s=d(12).Pattern,n=d(14).TemplatablePattern;function i(L,x){return x.indexOf(L)!==-1}var t={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},v=new r(/\/\*/,/\*\//),f=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,p=/[0-9]/,E=/[^\d\.]/,b=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),g=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";g=g.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),g="\\?\\.(?!\\d) "+g,g=g.replace(/ /g,"|");var c=new RegExp(g),m="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),u=m.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),_=new RegExp("^(?:"+u.join("|")+")$"),y,T=function(L,x){o.call(this,L,x),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var D=new s(this._input),j=new n(this._input).read_options(this._options);this.__patterns={template:j,identifier:j.starting_with(l.identifier).matching(l.identifierMatch),number:D.matching(f),punct:D.matching(c),comment:D.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:D.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:D.matching(/<!--/),html_comment_end:D.matching(/-->/),include:D.starting_with(/#include/).until_after(l.lineBreak),shebang:D.starting_with(/#!/).until_after(l.lineBreak),xml:D.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:j.until(/['\\\n\r\u2028\u2029]/),double_quote:j.until(/["\\\n\r\u2028\u2029]/),template_text:j.until(/[`\\$]/),template_expression:j.until(/[`}\\]/)}};T.prototype=new o,T.prototype._is_comment=function(L){return L.type===t.COMMENT||L.type===t.BLOCK_COMMENT||L.type===t.UNKNOWN},T.prototype._is_opening=function(L){return L.type===t.START_BLOCK||L.type===t.START_EXPR},T.prototype._is_closing=function(L,x){return(L.type===t.END_BLOCK||L.type===t.END_EXPR)&&x&&(L.text==="]"&&x.text==="["||L.text===")"&&x.text==="("||L.text==="}"&&x.text==="{")},T.prototype._reset=function(){y=!1},T.prototype._get_next_token=function(L,x){var D=null;this._readWhitespace();var j=this._input.peek();return j===null?this._create_token(t.EOF,""):(D=D||this._read_non_javascript(j),D=D||this._read_string(j),D=D||this._read_word(L),D=D||this._read_singles(j),D=D||this._read_comment(j),D=D||this._read_regexp(j,L),D=D||this._read_xml(j,L),D=D||this._read_punctuation(),D=D||this._create_token(t.UNKNOWN,this._input.next()),D)},T.prototype._read_word=function(L){var x;if(x=this.__patterns.identifier.read(),x!=="")return x=x.replace(l.allLineBreaks,`
|
|
`),!(L.type===t.DOT||L.type===t.RESERVED&&(L.text==="set"||L.text==="get"))&&_.test(x)?(x==="in"||x==="of")&&(L.type===t.WORD||L.type===t.STRING)?this._create_token(t.OPERATOR,x):this._create_token(t.RESERVED,x):this._create_token(t.WORD,x);if(x=this.__patterns.number.read(),x!=="")return this._create_token(t.WORD,x)},T.prototype._read_singles=function(L){var x=null;return L==="("||L==="["?x=this._create_token(t.START_EXPR,L):L===")"||L==="]"?x=this._create_token(t.END_EXPR,L):L==="{"?x=this._create_token(t.START_BLOCK,L):L==="}"?x=this._create_token(t.END_BLOCK,L):L===";"?x=this._create_token(t.SEMICOLON,L):L==="."&&E.test(this._input.peek(1))?x=this._create_token(t.DOT,L):L===","&&(x=this._create_token(t.COMMA,L)),x&&this._input.next(),x},T.prototype._read_punctuation=function(){var L=this.__patterns.punct.read();if(L!=="")return L==="="?this._create_token(t.EQUALS,L):L==="?."?this._create_token(t.DOT,L):this._create_token(t.OPERATOR,L)},T.prototype._read_non_javascript=function(L){var x="";if(L==="#"){if(this._is_first_token()&&(x=this.__patterns.shebang.read(),x))return this._create_token(t.UNKNOWN,x.trim()+`
|
|
`);if(x=this.__patterns.include.read(),x)return this._create_token(t.UNKNOWN,x.trim()+`
|
|
`);L=this._input.next();var D="#";if(this._input.hasNext()&&this._input.testChar(p)){do L=this._input.next(),D+=L;while(this._input.hasNext()&&L!=="#"&&L!=="=");return L==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(D+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(D+="{}",this._input.next(),this._input.next())),this._create_token(t.WORD,D)}this._input.back()}else if(L==="<"&&this._is_first_token()){if(x=this.__patterns.html_comment_start.read(),x){for(;this._input.hasNext()&&!this._input.testChar(l.newline);)x+=this._input.next();return y=!0,this._create_token(t.COMMENT,x)}}else if(y&&L==="-"&&(x=this.__patterns.html_comment_end.read(),x))return y=!1,this._create_token(t.COMMENT,x);return null},T.prototype._read_comment=function(L){var x=null;if(L==="/"){var D="";if(this._input.peek(1)==="*"){D=this.__patterns.block_comment.read();var j=v.get_directives(D);j&&j.ignore==="start"&&(D+=v.readIgnored(this._input)),D=D.replace(l.allLineBreaks,`
|
|
`),x=this._create_token(t.BLOCK_COMMENT,D),x.directives=j}else this._input.peek(1)==="/"&&(D=this.__patterns.comment.read(),x=this._create_token(t.COMMENT,D))}return x},T.prototype._read_string=function(L){if(L==="`"||L==="'"||L==='"'){var x=this._input.next();return this.has_char_escapes=!1,L==="`"?x+=this._read_string_recursive("`",!0,"${"):x+=this._read_string_recursive(L),this.has_char_escapes&&this._options.unescape_strings&&(x=M(x)),this._input.peek()===L&&(x+=this._input.next()),x=x.replace(l.allLineBreaks,`
|
|
`),this._create_token(t.STRING,x)}return null},T.prototype._allow_regexp_or_xml=function(L){return L.type===t.RESERVED&&i(L.text,["return","case","throw","else","do","typeof","yield"])||L.type===t.END_EXPR&&L.text===")"&&L.opened.previous.type===t.RESERVED&&i(L.opened.previous.text,["if","while","for"])||i(L.type,[t.COMMENT,t.START_EXPR,t.START_BLOCK,t.START,t.END_BLOCK,t.OPERATOR,t.EQUALS,t.EOF,t.SEMICOLON,t.COMMA])},T.prototype._read_regexp=function(L,x){if(L==="/"&&this._allow_regexp_or_xml(x)){for(var D=this._input.next(),j=!1,I=!1;this._input.hasNext()&&(j||I||this._input.peek()!==L)&&!this._input.testChar(l.newline);)D+=this._input.peek(),j?j=!1:(j=this._input.peek()==="\\",this._input.peek()==="["?I=!0:this._input.peek()==="]"&&(I=!1)),this._input.next();return this._input.peek()===L&&(D+=this._input.next(),D+=this._input.read(l.identifier)),this._create_token(t.STRING,D)}return null},T.prototype._read_xml=function(L,x){if(this._options.e4x&&L==="<"&&this._allow_regexp_or_xml(x)){var D="",j=this.__patterns.xml.read_match();if(j){for(var I=j[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),W=I.indexOf("{")===0,Q=0;j;){var fe=!!j[1],de=j[2],Oe=!!j[j.length-1]||de.slice(0,8)==="![CDATA[";if(!Oe&&(de===I||W&&de.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(fe?--Q:++Q),D+=j[0],Q<=0)break;j=this.__patterns.xml.read_match()}return j||(D+=this._input.match(/[\s\S]*/g)[0]),D=D.replace(l.allLineBreaks,`
|
|
`),this._create_token(t.STRING,D)}}return null};function M(L){for(var x="",D=0,j=new h(L),I=null;j.hasNext();)if(I=j.match(/([\s]|[^\\]|\\\\)+/g),I&&(x+=I[0]),j.peek()==="\\"){if(j.next(),j.peek()==="x")I=j.match(/x([0-9A-Fa-f]{2})/g);else if(j.peek()==="u")I=j.match(/u([0-9A-Fa-f]{4})/g);else{x+="\\",j.hasNext()&&(x+=j.next());continue}if(!I)return L;if(D=parseInt(I[1],16),D>126&&D<=255&&I[0].indexOf("x")===0)return L;if(D>=0&&D<32){x+="\\"+I[0];continue}else D===34||D===39||D===92?x+="\\"+String.fromCharCode(D):x+=String.fromCharCode(D)}return x}T.prototype._read_string_recursive=function(L,x,D){var j,I;L==="'"?I=this.__patterns.single_quote:L==='"'?I=this.__patterns.double_quote:L==="`"?I=this.__patterns.template_text:L==="}"&&(I=this.__patterns.template_expression);for(var W=I.read(),Q="";this._input.hasNext();){if(Q=this._input.next(),Q===L||!x&&l.newline.test(Q)){this._input.back();break}else Q==="\\"&&this._input.hasNext()?(j=this._input.peek(),j==="x"||j==="u"?this.has_char_escapes=!0:j==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),Q+=this._input.next()):D&&(D==="${"&&Q==="$"&&this._input.peek()==="{"&&(Q+=this._input.next()),D===Q&&(L==="`"?Q+=this._read_string_recursive("}",x,"`"):Q+=this._read_string_recursive("`",x,"${"),this._input.hasNext()&&(Q+=this._input.next())));Q+=I.read(),W+=Q}return W},e.exports.Tokenizer=T,e.exports.TOKEN=t,e.exports.positionable_operators=b.slice(),e.exports.line_starters=m.slice()},function(e){var S=RegExp.prototype.hasOwnProperty("sticky");function d(h){this.__input=h||"",this.__input_length=this.__input.length,this.__position=0}d.prototype.restart=function(){this.__position=0},d.prototype.back=function(){this.__position>0&&(this.__position-=1)},d.prototype.hasNext=function(){return this.__position<this.__input_length},d.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__input.charAt(this.__position),this.__position+=1),h},d.prototype.peek=function(h){var o=null;return h=h||0,h+=this.__position,h>=0&&h<this.__input_length&&(o=this.__input.charAt(h)),o},d.prototype.__match=function(h,o){h.lastIndex=o;var a=h.exec(this.__input);return a&&!(S&&h.sticky)&&(a.index!==o&&(a=null)),a},d.prototype.test=function(h,o){return o=o||0,o+=this.__position,o>=0&&o<this.__input_length?!!this.__match(h,o):!1},d.prototype.testChar=function(h,o){var a=this.peek(o);return h.lastIndex=0,a!==null&&h.test(a)},d.prototype.match=function(h){var o=this.__match(h,this.__position);return o?this.__position+=o[0].length:o=null,o},d.prototype.read=function(h,o,a){var r="",l;return h&&(l=this.match(h),l&&(r+=l[0])),o&&(l||!h)&&(r+=this.readUntil(o,a)),r},d.prototype.readUntil=function(h,o){var a="",r=this.__position;h.lastIndex=this.__position;var l=h.exec(this.__input);return l?(r=l.index,o&&(r+=l[0].length)):r=this.__input_length,a=this.__input.substring(this.__position,r),this.__position=r,a},d.prototype.readUntilAfter=function(h){return this.readUntil(h,!0)},d.prototype.get_regexp=function(h,o){var a=null,r="g";return o&&S&&(r="y"),typeof h=="string"&&h!==""?a=new RegExp(h,r):h&&(a=new RegExp(h.source,r)),a},d.prototype.get_literal_regexp=function(h){return RegExp(h.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},d.prototype.peekUntilAfter=function(h){var o=this.__position,a=this.readUntilAfter(h);return this.__position=o,a},d.prototype.lookBack=function(h){var o=this.__position-1;return o>=h.length&&this.__input.substring(o-h.length,o).toLowerCase()===h},e.exports.InputScanner=d},function(e,S,d){var h=d(8).InputScanner,o=d(3).Token,a=d(10).TokenStream,r=d(11).WhitespacePattern,l={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},s=function(n,i){this._input=new h(n),this._options=i||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new r(this._input)};s.prototype.tokenize=function(){this._input.restart(),this.__tokens=new a,this._reset();for(var n,i=new o(l.START,""),t=null,v=[],f=new a;i.type!==l.EOF;){for(n=this._get_next_token(i,t);this._is_comment(n);)f.add(n),n=this._get_next_token(i,t);f.isEmpty()||(n.comments_before=f,f=new a),n.parent=t,this._is_opening(n)?(v.push(t),t=n):t&&this._is_closing(n,t)&&(n.opened=t,t.closed=n,t=v.pop(),n.parent=t),n.previous=i,i.next=n,this.__tokens.add(n),i=n}return this.__tokens},s.prototype._is_first_token=function(){return this.__tokens.isEmpty()},s.prototype._reset=function(){},s.prototype._get_next_token=function(n,i){this._readWhitespace();var t=this._input.read(/.+/g);return t?this._create_token(l.RAW,t):this._create_token(l.EOF,"")},s.prototype._is_comment=function(n){return!1},s.prototype._is_opening=function(n){return!1},s.prototype._is_closing=function(n,i){return!1},s.prototype._create_token=function(n,i){var t=new o(n,i,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return t},s.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},e.exports.Tokenizer=s,e.exports.TOKEN=l},function(e){function S(d){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=d}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 d=null;return this.hasNext()&&(d=this.__tokens[this.__position],this.__position+=1),d},S.prototype.peek=function(d){var h=null;return d=d||0,d+=this.__position,d>=0&&d<this.__tokens_length&&(h=this.__tokens[d]),h},S.prototype.add=function(d){this.__parent_token&&(d.parent=this.__parent_token),this.__tokens.push(d),this.__tokens_length+=1},e.exports.TokenStream=S},function(e,S,d){var h=d(12).Pattern;function o(a,r){h.call(this,a,r),r?this._line_regexp=this._input.get_regexp(r._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}o.prototype=new h,o.prototype.__set_whitespace_patterns=function(a,r){a+="\\t ",r+="\\n\\r",this._match_pattern=this._input.get_regexp("["+a+r+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+r+"]")},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 r=this.__split(this._newline_regexp,a);this.newline_count=r.length-1,this.whitespace_before_token=r[this.newline_count]}return a},o.prototype.matching=function(a,r){var l=this._create();return l.__set_whitespace_patterns(a,r),l._update(),l},o.prototype._create=function(){return new o(this._input,this)},o.prototype.__split=function(a,r){a.lastIndex=0;for(var l=0,s=[],n=a.exec(r);n;)s.push(r.substring(l,n.index)),l=n.index+n[0].length,n=a.exec(r);return l<r.length?s.push(r.substring(l,r.length)):s.push(""),s},e.exports.WhitespacePattern=o},function(e){function S(d,h){this._input=d,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,h&&(this._starting_pattern=this._input.get_regexp(h._starting_pattern,!0),this._match_pattern=this._input.get_regexp(h._match_pattern,!0),this._until_pattern=this._input.get_regexp(h._until_pattern),this._until_after=h._until_after)}S.prototype.read=function(){var d=this._input.read(this._starting_pattern);return(!this._starting_pattern||d)&&(d+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),d},S.prototype.read_match=function(){return this._input.match(this._match_pattern)},S.prototype.until_after=function(d){var h=this._create();return h._until_after=!0,h._until_pattern=this._input.get_regexp(d),h._update(),h},S.prototype.until=function(d){var h=this._create();return h._until_after=!1,h._until_pattern=this._input.get_regexp(d),h._update(),h},S.prototype.starting_with=function(d){var h=this._create();return h._starting_pattern=this._input.get_regexp(d,!0),h._update(),h},S.prototype.matching=function(d){var h=this._create();return h._match_pattern=this._input.get_regexp(d,!0),h._update(),h},S.prototype._create=function(){return new S(this._input,this)},S.prototype._update=function(){},e.exports.Pattern=S},function(e){function S(d,h){d=typeof d=="string"?d:d.source,h=typeof h=="string"?h:h.source,this.__directives_block_pattern=new RegExp(d+/ beautify( \w+[:]\w+)+ /.source+h,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(d+/\sbeautify\signore:end\s/.source+h,"g")}S.prototype.get_directives=function(d){if(!d.match(this.__directives_block_pattern))return null;var h={};this.__directive_pattern.lastIndex=0;for(var o=this.__directive_pattern.exec(d);o;)h[o[1]]=o[2],o=this.__directive_pattern.exec(d);return h},S.prototype.readIgnored=function(d){return d.readUntilAfter(this.__directives_end_ignore_pattern)},e.exports.Directives=S},function(e,S,d){var h=d(12).Pattern,o={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function a(r,l){h.call(this,r,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 h(r);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 h,a.prototype._create=function(){return new a(this._input,this)},a.prototype._update=function(){this.__set_templated_pattern()},a.prototype.disable=function(r){var l=this._create();return l._disabled[r]=!0,l._update(),l},a.prototype.read_options=function(r){var l=this._create();for(var s in o)l._disabled[s]=r.templating.indexOf(s)===-1;return l._update(),l},a.prototype.exclude=function(r){var l=this._create();return l._excluded[r]=!0,l._update(),l},a.prototype.read=function(){var r="";this._match_pattern?r=this._input.read(this._starting_pattern):r=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),r+=l,l=this._read_template();return this._until_after&&(r+=this._input.readUntilAfter(this._until_pattern)),r},a.prototype.__set_templated_pattern=function(){var r=[];this._disabled.php||r.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||r.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||r.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(r.push(this.__patterns.django._starting_pattern.source),r.push(this.__patterns.django_value._starting_pattern.source),r.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||r.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&r.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+r.join("|")+")")},a.prototype._read_template=function(){var r="",l=this._input.peek();if(l==="<"){var s=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&s==="?"&&(r=r||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&s==="%"&&(r=r||this.__patterns.erb.read())}else l==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(r=r||this.__patterns.handlebars_comment.read(),r=r||this.__patterns.handlebars_unescaped.read(),r=r||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(r=r||this.__patterns.django_value.read()),this._excluded.django||(r=r||this.__patterns.django_comment.read(),r=r||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(r=r||this.__patterns.smarty_comment.read(),r=r||this.__patterns.smarty_literal.read(),r=r||this.__patterns.smarty.read()));return r},e.exports.TemplatablePattern=a}],R={};function H(e){var S=R[e];if(S!==void 0)return S.exports;var d=R[e]={exports:{}};return w[e](d,d.exports,H),d.exports}var U=H(0);O=U})();var k=O;!(ae=[],B=function(){return{js_beautify:k}}.apply(ye,ae),B!==void 0&&(Ye.exports=B))})()},"746U":function(Ye,ye,$){"use strict";$.d(ye,"f",function(){return ae}),$.d(ye,"l",function(){return B}),$.d(ye,"k",function(){return O}),$.d(ye,"j",function(){return k}),$.d(ye,"g",function(){return w}),$.d(ye,"m",function(){return R}),$.d(ye,"h",function(){return H}),$.d(ye,"n",function(){return U}),$.d(ye,"c",function(){return e}),$.d(ye,"a",function(){return S}),$.d(ye,"i",function(){return d}),$.d(ye,"o",function(){return h}),$.d(ye,"e",function(){return r}),$.d(ye,"d",function(){return l}),$.d(ye,"p",function(){return s}),$.d(ye,"b",function(){return n});function ae(i){return Array.isArray(i)}function B(i){return typeof i=="string"}function O(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&!(i instanceof RegExp)&&!(i instanceof Date)}function k(i){return typeof i=="number"&&!isNaN(i)}function w(i){return i===!0||i===!1}function R(i){return typeof i=="undefined"}function H(i){return!U(i)}function U(i){return R(i)||i===null}function e(i,t){if(!i)throw new Error(t?`Unexpected type, expected '${t}'`:"Unexpected type")}function S(i){if(U(i))throw new Error("Assertion Failed: argument is undefined or null");return i}function d(i){return typeof i=="function"}function h(i,t){const v=Math.min(i.length,t.length);for(let f=0;f<v;f++)o(i[f],t[f])}function o(i,t){if(B(t)){if(typeof i!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(d(t)){try{if(i instanceof t)return}catch(v){}if(!U(i)&&i.constructor===t)return;if(t.length===1&&t.call(void 0,i)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function a(i){let t=[],v=Object.getPrototypeOf(i);for(;Object.prototype!==v;)t=t.concat(Object.getOwnPropertyNames(v)),v=Object.getPrototypeOf(v);return t}function r(i){const t=[];for(const v of a(i))typeof i[v]=="function"&&t.push(v);return t}function l(i,t){const v=p=>function(){const E=Array.prototype.slice.call(arguments,0);return t(p,E)};let f={};for(const p of i)f[p]=v(p);return f}function s(i){return i===null?void 0:i}function n(i,t="Unreachable"){throw new Error(t)}},"8HAY":function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return w}),$.d(ye,"b",function(){return R}),$.d(ye,"d",function(){return H}),$.d(ye,"e",function(){return U}),$.d(ye,"c",function(){return e});var ae=$("MI8n"),B=$("pmY6"),O=$("3/fG"),k=function(S,d,h,o){function a(r){return r instanceof h?r:new h(function(l){l(r)})}return new(h||(h=Promise))(function(r,l){function s(t){try{i(o.next(t))}catch(v){l(v)}}function n(t){try{i(o.throw(t))}catch(v){l(v)}}function i(t){t.done?r(t.value):a(t.value).then(s,n)}i((o=o.apply(S,d||[])).next())})};class w extends B.a{constructor(S,d="",h="",o=!0,a){super();this._onDidChange=this._register(new ae.b),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=S,this._label=d,this._cssClass=h,this._enabled=o,this._actionCallback=a}get id(){return this._id}get label(){return this._label}set label(S){this._setLabel(S)}_setLabel(S){this._label!==S&&(this._label=S,this._onDidChange.fire({label:S}))}get tooltip(){return this._tooltip||""}set tooltip(S){this._setTooltip(S)}_setTooltip(S){this._tooltip!==S&&(this._tooltip=S,this._onDidChange.fire({tooltip:S}))}get class(){return this._cssClass}set class(S){this._setClass(S)}_setClass(S){this._cssClass!==S&&(this._cssClass=S,this._onDidChange.fire({class:S}))}get enabled(){return this._enabled}set enabled(S){this._setEnabled(S)}_setEnabled(S){this._enabled!==S&&(this._enabled=S,this._onDidChange.fire({enabled:S}))}get checked(){return this._checked}set checked(S){this._setChecked(S)}_setChecked(S){this._checked!==S&&(this._checked=S,this._onDidChange.fire({checked:S}))}run(S,d){return k(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(S))})}}class R extends B.a{constructor(){super(...arguments);this._onBeforeRun=this._register(new ae.b),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new ae.b),this.onDidRun=this._onDidRun.event}run(S,d){return k(this,void 0,void 0,function*(){if(!S.enabled)return;this._onBeforeRun.fire({action:S});let h;try{yield this.runAction(S,d)}catch(o){h=o}this._onDidRun.fire({action:S,error:h})})}runAction(S,d){return k(this,void 0,void 0,function*(){yield S.run(d)})}}class H extends w{constructor(S){super(H.ID,S,S?"separator text":"separator");this.checked=!1,this.enabled=!1}}H.ID="vs.actions.separator";class U{constructor(S,d,h,o){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=S,this.label=d,this.class=o,this._actions=h}get actions(){return this._actions}dispose(){}run(){return k(this,void 0,void 0,function*(){})}}class e extends w{constructor(){super(e.ID,O.a("submenu.empty","(empty)"),void 0,!1)}}e.ID="vs.actions.empty"},"8hTe":function(Ye,ye,$){Ye.exports={button:"button___1wy9m"}},"9Bee":function(Ye,ye,$){"use strict";var ae=$("DYRE"),B=$("zeV3"),O=$("+L6B"),k=$("2/Rp"),w=$("k1fw"),R=$("9og8"),H=$("tJVT"),U=$("WmNS"),e=$.n(U),S=$("q1tI"),d=$.n(S),h=$("vg9a"),o=$("DlQD"),a=$.n(o),r=$("rUJ1");function l(q,K){var V=q.match(/^(\s+)(?:```)/);if(V===null)return K;var Z=V[1];return K.split(`
|
|
`).map(function(ie){var Y=ie.match(/^\s+/);if(Y===null)return ie;var J=Object(H.a)(Y,1),ne=J[0];return ne.length>=Z.length?ie.slice(Z.length):ie}).join(`
|
|
`)}var s=[],n=["<ul>"],i=new a.a.Renderer,t=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function v(){s.length=0,n=["<ul>"]}var f={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(q,K,V,Z){if(K>=q.length||q[K].level<=V)return K;var ie=q[K];Z.push("<li><a href='#"+ie.anchor+"'>"+ie.text+"</a>"),K++;var Y=[];return K=p(q,K,ie.level,Y),Y.length>0&&(Z.push("<ul>"),Y.forEach(function(J){Z.push(J)}),Z.push("</ul>")),Z.push("</li>"),K=p(q,K,V,Z),K}function E(){return p(s,0,0,n),n.push("</ul>"),n.join("")}var b={heading:function(K){var V=t.exec(K);if(V)return{type:"heading",raw:V[0],depth:V[1].length,text:V[2]}},fences:function(K){var V=this.rules.block.fences.exec(K);if(V){var Z=V[0],ie=l(Z,V[3]||""),Y=V[2]?V[2].trim():V[2];if(["latex","katex","math"].indexOf(Y)>=0){var J=m(),ne=ie;ie=J,u[J]={type:"block",expression:ne}}return{type:"code",raw:Z,lang:Y,text:ie}}}},g=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,m=function(){return"__special_katext_id_".concat(c++,"__")},u={};function _(){return u}function y(){c=0,u={}}function T(q){return q=q.replace(g,function(K,V){var Z=m();return u[Z]={type:"inline",expression:V},Z}),q}var M=i.listitem;i.listitem=function(q){return M(T(q))};var L=i.paragraph;i.paragraph=function(q){return L(T(q))};var x=i.tablecell;i.tablecell=function(q,K){return x(T(q),K)},i.code=function(q,K,V){var Z=(K||"").match(/\S*/)[0];return Z?["latex","katex","math"].indexOf(Z)>=0?"<p class='editormd-tex'>".concat(q,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(K,'">').concat(V?q:Object(r.escape)(q,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(V?q:Object(r.escape)(q,!0))+"</code></pre>"},i.heading=function(q,K,V){var Z=this.options.headerPrefix+V.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return s.push({anchor:Z,level:K,text:q}),"<h"+K+' id="'+Z+'">'+q+"</h"+K+">"},a.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),a.a.use({tokenizer:b,renderer:i});var D=a.a,j=$("SJMd"),I=$("ulZh"),W=$.n(I),Q=$("m3rI"),fe=$("Oy/b"),de=$("p5ED"),Oe=$("ErOA"),Se=$("STEk");/* **********************************
|
|
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 Ie=function(q,K){return(Ie=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(V,Z){V.__proto__=Z}||function(V,Z){for(var ie in Z)Object.prototype.hasOwnProperty.call(Z,ie)&&(V[ie]=Z[ie])})(q,K)};function Le(q,K){if(typeof K!="function"&&K!==null)throw new TypeError("Class extends value "+String(K)+" is not a constructor or null");function V(){this.constructor=q}Ie(q,K),q.prototype=K===null?Object.create(K):(V.prototype=K.prototype,new V)}function Ne(q,K,V,Z){return new(V||(V=Promise))(function(ie,Y){function J(Te){try{se(Z.next(Te))}catch(_e){Y(_e)}}function ne(Te){try{se(Z.throw(Te))}catch(_e){Y(_e)}}function se(Te){var _e;Te.done?ie(Te.value):(_e=Te.value,_e instanceof V?_e:new V(function(De){De(_e)})).then(J,ne)}se((Z=Z.apply(q,K||[])).next())})}function be(q,K){var V,Z,ie,Y,J={label:0,sent:function(){if(1&ie[0])throw ie[1];return ie[1]},trys:[],ops:[]};return Y={next:ne(0),throw:ne(1),return:ne(2)},typeof Symbol=="function"&&(Y[Symbol.iterator]=function(){return this}),Y;function ne(se){return function(Te){return function(_e){if(V)throw new TypeError("Generator is already executing.");for(;J;)try{if(V=1,Z&&(ie=2&_e[0]?Z.return:_e[0]?Z.throw||((ie=Z.return)&&ie.call(Z),0):Z.next)&&!(ie=ie.call(Z,_e[1])).done)return ie;switch(Z=0,ie&&(_e=[2&_e[0],ie.value]),_e[0]){case 0:case 1:ie=_e;break;case 4:return J.label++,{value:_e[1],done:!1};case 5:J.label++,Z=_e[1],_e=[0];continue;case 7:_e=J.ops.pop(),J.trys.pop();continue;default:if(!(ie=J.trys,(ie=ie.length>0&&ie[ie.length-1])||_e[0]!==6&&_e[0]!==2)){J=0;continue}if(_e[0]===3&&(!ie||_e[1]>ie[0]&&_e[1]<ie[3])){J.label=_e[1];break}if(_e[0]===6&&J.label<ie[1]){J.label=ie[1],ie=_e;break}if(ie&&J.label<ie[2]){J.label=ie[2],J.ops.push(_e);break}ie[2]&&J.ops.pop(),J.trys.pop();continue}_e=K.call(q,J)}catch(De){_e=[6,De],Z=0}finally{V=ie=0}if(5&_e[0])throw _e[1];return{value:_e[0]?_e[1]:void 0,done:!0}}([se,Te])}}}var N=function(){function q(){}return q.addKey=function(K){q.key=K},Object.defineProperty(q,"isLicensed",{get:function(){return!!q.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(q.key)},enumerable:!1,configurable:!0}),q}(),A=function(){function q(){}return q.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},q.setAttributes=function(K,V){for(var Z=0,ie=V;Z<ie.length;Z++){var Y=ie[Z],J=Y[0],ne=Y[1];K.setAttribute(J,ne)}},q.createRect=function(K,V,Z){var ie=document.createElementNS("http://www.w3.org/2000/svg","rect");return ie.setAttribute("width",K.toString()),ie.setAttribute("height",V.toString()),Z&&q.setAttributes(ie,Z),ie},q.createLine=function(K,V,Z,ie,Y){var J=document.createElementNS("http://www.w3.org/2000/svg","line");return J.setAttribute("x1",K.toString()),J.setAttribute("y1",V.toString()),J.setAttribute("x2",Z.toString()),J.setAttribute("y2",ie.toString()),Y&&q.setAttributes(J,Y),J},q.createPolygon=function(K,V){var Z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return Z.setAttribute("points",K),V&&q.setAttributes(Z,V),Z},q.createCircle=function(K,V){var Z=document.createElementNS("http://www.w3.org/2000/svg","circle");return Z.setAttribute("cx",(K/2).toString()),Z.setAttribute("cy",(K/2).toString()),Z.setAttribute("r",K.toString()),V&&q.setAttributes(Z,V),Z},q.createEllipse=function(K,V,Z){var ie=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return ie.setAttribute("cx",(K/2).toString()),ie.setAttribute("cy",(V/2).toString()),ie.setAttribute("rx",(K/2).toString()),ie.setAttribute("ry",(V/2).toString()),Z&&q.setAttributes(ie,Z),ie},q.createGroup=function(K){var V=document.createElementNS("http://www.w3.org/2000/svg","g");return K&&q.setAttributes(V,K),V},q.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},q.createMarker=function(K,V,Z,ie,Y,J,ne){var se=document.createElementNS("http://www.w3.org/2000/svg","marker");return q.setAttributes(se,[["id",K],["orient",V],["markerWidth",Z.toString()],["markerHeight",ie.toString()],["refX",Y.toString()],["refY",J.toString()]]),se.appendChild(ne),se},q.createText=function(K){var V=document.createElementNS("http://www.w3.org/2000/svg","text");return V.setAttribute("x","0"),V.setAttribute("y","0"),K&&q.setAttributes(V,K),V},q.createTSpan=function(K,V){var Z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return Z.textContent=K,V&&q.setAttributes(Z,V),Z},q.createImage=function(K){var V=document.createElementNS("http://www.w3.org/2000/svg","image");return K&&q.setAttributes(V,K),V},q.createPoint=function(K,V){var Z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return Z.x=K,Z.y=V,Z},q.createPath=function(K,V){var Z=document.createElementNS("http://www.w3.org/2000/svg","path");return Z.setAttribute("d",K),V&&q.setAttributes(Z,V),Z},q.createElement=function(K,V){var Z=document.createElementNS("http://www.w3.org/2000/svg",K);return V&&q.setAttributes(Z,V),Z},q.getHollowRectanglePath=function(K,V,Z,ie,Y,J,ne,se){return"M"+K+","+V+"V"+(V+ie)+"H"+(K+Z)+"V"+V+"H"+Y+"V"+J+"H"+(Y+ne)+"V"+(J+se)+"H"+Y+"V"+V+"Z"},q}(),C=function(){function q(K){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+K+"_"}return Object.defineProperty(q.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(q.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(q.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),q.prototype.addClass=function(K){return this.styleSheet===void 0&&this.addStyleSheet(),K.name=""+this.classNamePrefix+K.localName,this.classes.push(K),this.styleSheet.sheet.insertRule("."+K.name+" {"+K.style+"}",this.styleSheet.sheet.cssRules.length),K},q.prototype.addRule=function(K){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(K),this.styleSheet.sheet.insertRule(K.selector+" {"+K.style+"}",this.styleSheet.sheet.cssRules.length)},q.prototype.addStyleSheet=function(){var K;this.styleSheet=document.createElement("style"),((K=this.styleSheetRoot)!==null&&K!==void 0?K:document.head).appendChild(this.styleSheet),this.addRule(new F("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new F("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new F("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new G("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new G("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},q.prototype.removeStyleSheet=function(){var K;this.styleSheet&&(((K=this.styleSheetRoot)!==null&&K!==void 0?K:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},q}(),F=function(q,K){this.selector=q,this.style=K},G=function(q,K){this.localName=q,this.style=K},P=function(){function q(){this.blocks=[],this.display=""}return q.prototype.addButtonBlock=function(K){K.className=this.blockClassName,K.buttonClassName=this.buttonClassName,K.buttonColorsClassName=this.buttonColorsClassName,K.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(K)},q.prototype.addElementBlock=function(K){K.className===void 0&&(K.className=this.blockClassName),this.blocks.push(K)},q.prototype.getUI=function(){var K=document.createElement("div");return K.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,K.style.display=this.display,this.blocks.forEach(function(V){return K.appendChild(V.getUI())}),K},q}(),oe=function(){function q(){}return q.prototype.getUI=function(){var K=document.createElement("div");if(K.className=this.className,this.minWidth!==void 0&&(K.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":K.style.justifyContent="flex-start";break;case"center":K.style.justifyContent="center";break;case"end":K.style.justifyContent="flex-end"}return K.style.whiteSpace="nowrap",K},q}(),we=function(q){function K(){var V=q!==null&&q.apply(this,arguments)||this;return V.buttons=[],V}return Le(K,q),K.prototype.addButton=function(V){V.className=this.buttonClassName,V.colorsClassName=this.buttonColorsClassName,V.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(V)},K.prototype.getUI=function(){var V=q.prototype.getUI.call(this);return this.buttons.forEach(function(Z){return V.appendChild(Z.getUI())}),V},K}(oe),Re=function(){function q(K,V){this._isActive=!1,this._isHidden=!1,this._icon=K,this.title=V,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(q.prototype,"icon",{get:function(){return this._icon},set:function(K){this._icon=K,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isActive",{get:function(){return this._isActive},set:function(K){this._isActive=K,this.adjustClassName()},enumerable:!1,configurable:!0}),q.prototype.getUI=function(){var K=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 K.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},q.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,"")))},q.prototype.hide=function(){this._isHidden=!0},q}(),ee=function(q){function K(){var V=q!==null&&q.apply(this,arguments)||this;return V.elements=[],V}return Le(K,q),K.prototype.addElement=function(V){this.elements.push(V)},K.prototype.getUI=function(){var V=q.prototype.getUI.call(this);return this.elements.forEach(function(Z){return V.appendChild(Z)}),V},K}(oe),ce=function(){function q(K,V){this.horizontal=K,this.vertical=V}return Object.defineProperty(q.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),q.prototype.getVerticalLength=function(K){return K/this.ratio},q.prototype.getHorizontalLength=function(K){return K*this.ratio},q}(),Ee=function(){function q(){}return q.getIcon=function(K,V){if(K>0&&V>0){var Z=new ce(K,V),ie=Z.ratio>=1?20:Z.getHorizontalLength(20),Y=Z.ratio<1?20:Z.getVerticalLength(20),J=document.createElementNS("http://www.w3.org/2000/svg","svg");J.setAttribute("xmlns","http://www.w3.org/2000/svg"),J.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(J);var ne=A.createDefs();J.appendChild(ne);var se=A.createElement("clipPath",[["id","text-bg-clip"]]);ne.appendChild(se);var Te=A.createPath(A.getHollowRectanglePath((24-ie)/2,(24-Y)/2,ie,Y,(24-ie)/2+2,(24-Y)/2+2,ie-4,Y-4));J.appendChild(Te);var _e=A.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);_e.appendChild(A.createTSpan(K+":"+V)),J.appendChild(_e);var De=_e.getBBox();A.setAttributes(_e,[["x",((24-De.width)/2).toString()],["y",((24-De.height)/2-De.y).toString()]]);var We=A.createPath(A.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(De.width))/2,(24-Math.ceil(De.height))/2,Math.ceil(De.width),Math.ceil(De.height)));return se.appendChild(We),A.setAttributes(Te,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(J),J.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>'},q}(),Ae=function(q){function K(V,Z,ie){var Y=q.call(this,V,Z)||this;return Y.isDropdownOpen=!1,Y.onClick=Y.dropdownButtonClicked,Y.dropdownButtons=ie,Y}return Le(K,q),K.prototype.setupDropdown=function(){var V=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(Z){Z.className=V.className,Z.colorsClassName=V.colorsClassName,V.dropdownBlock.appendChild(Z.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},K.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},K.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},K.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},K.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},K.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},K}(Re),Me=function(){function q(K,V){this.GRIP_SIZE=10,this.color=K,this.fillColor=V,this.visual=A.createGroup(),this.visual.appendChild(A.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(A.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return q.prototype.ownsTarget=function(K){return K===this.visual||K===this.visual.childNodes[0]||K===this.visual.childNodes[1]},q.prototype.setCenter=function(K,V){this.visual.childNodes.forEach(function(Z){return A.setAttributes(Z,[["cx",K.toString()],["cy",V.toString()]])})},q}(),Be=function(){function q(K,V,Z,ie){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=K,this.canvasHeight=V,this.margin=Z,this.container=ie,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(q.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(K){this._aspectRatio=K,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(K){this._isGridVisible=K,this.gridContainer&&A.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(K){this._zoomFactor=K,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),q.prototype.open=function(){var K=this;this.cropShadeElement=A.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=A.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var V=0;V<this.numberOfGridLines;V++)this.horizontalGridLines.push(A.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(A.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(Z){return K.gridContainer.appendChild(Z)}),this.verticalGridLines.forEach(function(Z){return K.gridContainer.appendChild(Z)}),this.cropRectElement=A.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Me(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Me(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Me(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Me(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},q.prototype.setCropRectangle=function(K){this.cropRect=K;var V=Object.assign({},this.cropRect);this.zoomFactor!==1&&(V.width=this.cropRect.width*this.zoomFactor,V.height=this.cropRect.height*this.zoomFactor,V.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-V.width/2,V.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-V.height/2),A.setAttributes(this.cropRectElement,[["x",V.x.toString()],["y",V.y.toString()],["width",V.width.toString()],["height",V.height.toString()]]);var Z=V.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(Y,J){var ne=V.y+Z*(J+1);A.setAttributes(Y,[["x1",""+V.x],["y1",""+ne],["x2",""+(V.x+V.width)],["y2",""+ne]])});var ie=V.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(Y,J){var ne=V.x+ie*(J+1);A.setAttributes(Y,[["x1",""+ne],["y1",""+V.y],["x2",""+ne],["y2",""+(V.y+V.height)]])}),A.setAttributes(this.cropShadeElement,[["d",A.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,V.x,V.y,V.width,V.height)]]),this.topLeftGrip.setCenter(V.x,V.y),this.topRightGrip.setCenter(V.x+V.width,V.y),this.bottomLeftGrip.setCenter(V.x,V.y+V.height),this.bottomRightGrip.setCenter(V.x+V.width,V.y+V.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},q.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)},q.prototype.clientToLocalCoordinates=function(K,V){var Z=this.container.getBoundingClientRect();return{x:K-Z.left+this.margin,y:V-Z.top+this.margin}},q.prototype.onPointerDown=function(K){this.container.setPointerCapture(K.pointerId),this.previousPoint=this.clientToLocalCoordinates(K.clientX,K.clientY),this.cropRectElement===K.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(K.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(K.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(K.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(K.target)&&(this.activeGrip=this.bottomRightGrip)},q.prototype.onPointerMove=function(K){if(this.isMoving)this.move(this.clientToLocalCoordinates(K.clientX,K.clientY));else if(this.activeGrip){var V=this.clientToLocalCoordinates(K.clientX,K.clientY);this.resize(V)}K.preventDefault()},q.prototype.onPointerUp=function(K){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(K.pointerId)},q.prototype.move=function(K){var V=K.x-this.previousPoint.x,Z=K.y-this.previousPoint.y;this.zoomFactor!==1&&(V=-V/this.zoomFactor,Z=-Z/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+V),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+Z),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=K},q.prototype.resize=function(K){var V=Object.assign({},this.cropRect),Z=K.x-this.previousPoint.x,ie=K.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:V.x+Z<this.margin&&(Z=this.margin-V.x),V.x+=Z,V.width=this.cropRect.x+this.cropRect.width-V.x;break;case this.bottomRightGrip:case this.topRightGrip:V.width+Z>this.canvasWidth*this.zoomFactor&&(Z=this.canvasWidth*this.zoomFactor-V.width),V.width+=Z}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(V.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(Z),V.height=this.aspectRatio.getVerticalLength(V.width)):(V.y+=ie,V.height=this.cropRect.y+this.cropRect.height-V.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?V.height=this.aspectRatio.getVerticalLength(V.width):V.height+=ie}V.width<10&&(V.x=this.cropRect.x,V.width=10),V.height<10&&(V.y=this.cropRect.y,V.height=10),this.previousPoint=K,V.x>=this.margin&&V.y>=this.margin&&V.x-this.margin+V.width<=this.canvasWidth&&V.y-this.margin+V.height<=this.canvasHeight&&(this.cropRect=V,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},q.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var K=this.cropRect.x+this.cropRect.width/2,V=this.cropRect.y+this.cropRect.height/2,Z=this.aspectRatio.getHorizontalLength(this.cropRect.height),ie=this.aspectRatio.getVerticalLength(this.cropRect.width);Z/this.canvasWidth<ie/this.canvasHeight?this.cropRect.width=Z:this.cropRect.height=ie,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=K-this.cropRect.width/2,this.cropRect.y=V-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)}},q.prototype.getRescaledRect=function(K,V,Z,ie,Y,J){var ne=Z/K,se=ie/V;return{x:(Y.x-J)*ne+J,y:(Y.y-J)*se+J,width:Y.width*ne,height:Y.height*se}},q.prototype.scaleCanvas=function(K,V){var Z=this.getRescaledRect(this.canvasWidth,this.canvasHeight,K,V,this.cropRect,this.margin);this.canvasWidth=K,this.canvasHeight=V,this.onCropChange&&this.onCropChange(Z),this.setCropRectangle(Z)},q}(),He=function(){function q(K){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=K,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(q.prototype,"angle",{get:function(){return this._angle},set:function(K){this._angle=K,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),q.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},q.prototype.onPointerDown=function(K){this.controlContainer.setPointerCapture(K.pointerId),this.isDragging=!0,this.previousPoint={x:K.clientX,y:K.clientY}},q.prototype.onPointerMove=function(K){this.isDragging&&(this.onAngleChange&&this.onAngleChange((K.clientX-this.previousPoint.x)/5),this.previousPoint.x=K.clientX)},q.prototype.onPointerUp=function(K){this.isDragging&&this.onAngleChange&&this.onAngleChange((K.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(K.pointerId)},q.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var K=this.angleLabelText.getBBox();A.setAttributes(this.angleLabelElement,[["x",((this.width-K.width)/2).toString()],["y",(this.height/2).toString()]])}},q.prototype.positionScaleShape=function(){if(this.scaleShape){var K=this.scaleShape.transform.baseVal.getItem(0);K.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(K,0)}},q.prototype.getVisual=function(){var K=document.createElementNS("http://www.w3.org/2000/svg","svg");K.setAttribute("xmlns","http://www.w3.org/2000/svg"),K.setAttribute("width",this.width+"px"),K.setAttribute("height",this.height+"px"),K.setAttribute("viewBox","0 0 "+this.width+" "+this.height),K.style.flexShrink="0",document.body.appendChild(K);for(var V="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,Z=1;Z<=this.width/5+10;Z++){var ie=Z%5==0?this.height/3:this.height/6;V+="h4v"+-ie+"h1v"+ie}V+="v1H0Z",this.scaleShape=A.createPath(V);var Y=A.createTransform();this.scaleShape.transform.baseVal.appendItem(Y),K.appendChild(this.scaleShape),this.angleLabelElement=A.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=A.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var J=A.createTSpan("");return J.innerHTML="°",this.angleLabelElement.appendChild(J),K.appendChild(this.angleLabelElement),document.body.removeChild(K),K},q}(),Fe=function(){function q(){this.naturalSize=!1,this.imageType="image/png"}return q.prototype.rasterize=function(K,V,Z,ie,Y,J,ne){var se=this;return new Promise(function(Te){var _e=document.createElement("canvas");_e.width=K.width.baseVal.value-2*ie,_e.height=K.height.baseVal.value-2*ie;var De=1,We=1;se.naturalSize===!0?(De=V.naturalWidth/(K.width.baseVal.value-2*ie)/J,We=V.naturalHeight/(K.height.baseVal.value-2*ie)/ne,_e.width=V.naturalWidth/J,_e.height=V.naturalHeight/ne):se.width!==void 0&&se.height!==void 0&&(De=se.width/Z.width,We=se.height/Z.height,_e.width*=De,_e.height*=We);var $e=_e.getContext("2d");$e.translate(_e.width/2,_e.height/2),$e.rotate(Y*Math.PI/180),$e.scale(J,ne),$e.translate(-_e.width/2,-_e.height/2),$e.drawImage(V,0,0,_e.width,_e.height);var Xe=document.createElement("canvas");Xe.width=Z.width*De,Xe.height=Z.height*We,Xe.getContext("2d").putImageData($e.getImageData((Z.x-ie)*De,(Z.y-ie)*We,Z.width*De,Z.height*We),0,0),Te(Xe.toDataURL(se.imageType,se.imageQuality))})},q}(),Ve=function(){function q(K){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=q.instanceCounter++,this.styles=new C(this.instanceNo),this.target=K,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(q.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(K){this._zoomToCropEnabled=K,K?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(K){this._isGridVisible=K,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"gridLines",{get:function(){return this._gridLines},set:function(K){this._gridLines=K,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(K){this._rotationAngle=K,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"aspectRatio",{get:function(){var K;return(K=this._aspectRatio)!==null&&K!==void 0?K:this.aspectRatios[0]},set:function(K){this._aspectRatio=K},enumerable:!1,configurable:!0}),q.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},q.prototype.show=function(){this.showUI(),this.open()},q.prototype.close=function(K){K===void 0&&(K=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),K||this.closeEventListeners.forEach(function(V){return V()}),this._isOpen=!1)},q.prototype.addRenderEventListener=function(K){this.renderEventListeners.push(K)},q.prototype.removeRenderEventListener=function(K){this.renderEventListeners.indexOf(K)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(K),1)},q.prototype.addCloseEventListener=function(K){this.closeEventListeners.push(K)},q.prototype.removeCloseEventListener=function(K){this.closeEventListeners.indexOf(K)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(K),1)},q.prototype.setupResizeObserver=function(){var K=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){K.resize(K.target.clientWidth,K.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))},q.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var K=1*this.target.clientWidth/this.target.clientHeight,V=this.contentDiv.clientWidth/K>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*K:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,Z=V+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/K;this.resize(V,Z)}},q.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},q.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",A.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},q.prototype.resize=function(K,V){this.imageWidth=Math.round(K),this.imageHeight=Math.round(V),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()},q.prototype.setEditingTarget=function(){var K=document.createElement("canvas");K.width=this.target.naturalWidth,K.height=this.target.naturalHeight,K.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var V=K.toDataURL();A.setAttributes(this.editingTarget,[["href",V]]),this.setEditingTargetSize()},q.prototype.setTopLeft=function(){var K=this.target.getBoundingClientRect(),V=this.editorCanvas.getBoundingClientRect();this.left=K.left-V.left-this.CANVAS_MARGIN,this.top=K.top-V.top-this.CANVAS_MARGIN},q.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=A.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=A.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=A.createGroup(),this.editingTargetRotationScaleContainer=A.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var K=A.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(K);var V=A.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(V),this.editingTargetContainer=A.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)},q.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},q.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=A.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Be(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()},q.prototype.zoomToCrop=function(){if(this.cropRect){var K=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,V=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=K+"px "+V+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-K+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-V+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},q.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)},q.prototype.cropRectChanged=function(K){this.cropRect=K,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},q.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},q.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"},q.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},q.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 K=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,V=this.target.offsetTop>K+this.CANVAS_MARGIN?this.target.offsetTop-(K+this.CANVAS_MARGIN):0;this.coverDiv.style.top=V+"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},q.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},q.prototype.addTopToolbar=function(){var K=this;this.topToolbar=new P,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 V=new we;V.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(V);var Z=[];this.aspectRatios.forEach(function(We){var $e=new Re(Ee.getIcon(We.horizontal,We.vertical),We.horizontal===0&&We.vertical===0?"FREE":We.horizontal+":"+We.vertical);$e.onClick=function(){return K.ratioButtonClicked(We)},Z.push($e)}),this.aspectRatioButton=new Ae(Ee.getIcon(0,0),"Aspect ratio",Z),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,V.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var ie=new Re('<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");ie.isActive=this.isGridVisible,ie.onClick=function(){K.isGridVisible=!K.isGridVisible,ie.isActive=K.isGridVisible},V.addButton(ie);var Y=new Re('<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(Y.isActive=this.zoomToCropEnabled,Y.onClick=function(){K.zoomToCropEnabled=!K.zoomToCropEnabled,Y.isActive=K.zoomToCropEnabled},V.addButton(Y),!N.isLicensed){var J=new ee;this.topToolbar.addElementBlock(J);var ne=document.createElement("div");ne.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var se=document.createElement("a");se.style.color="currentColor",se.href="https://markerjs.com/products/cropro",se.target="_blank",se.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>',ne.appendChild(se),J.addElement(ne)}var Te=new we;Te.minWidth=3*this.toolbarHeight+"px",Te.contentAlign="end",this.topToolbar.addButtonBlock(Te);var _e=new Re('<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,Te.addButton(_e),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(_e.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var De=new Re('<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");De.onClick=this.close,Te.addButton(De),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(De.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},q.prototype.addBottomToolbar=function(){var K=this;this.bottomToolbar=new P,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 V=new we;V.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(V);var Z=new Re('<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");Z.onClick=this.rotateLeftButtonClicked,V.addButton(Z);var ie=new Re('<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");ie.onClick=this.rotateRightButtonClicked,V.addButton(ie);var Y=new ee;Y.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(Y),this.straightener=new He("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(Te){K.rotateBy(Te),K.straightener.angle=K.rotationAngle},Y.addElement(this.straightener.getUI());var J=new we;J.minWidth=2*this.toolbarHeight+"px",J.contentAlign="end",this.bottomToolbar.addButtonBlock(J);var ne=new Re('<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");ne.onClick=this.flipHorizontallyButtonClicked,J.addButton(ne);var se=new Re('<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");se.onClick=this.flipVerticallyButtonClicked,J.addButton(se)},q.prototype.ratioButtonClicked=function(K){this.aspectRatio=K,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},q.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Ee.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},q.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new ce(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},q.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},q.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},q.prototype.restoreState=function(K){if(K){var V=this.cropLayer.getRescaledRect(K.width,K.height,this.imageWidth,this.imageHeight,K.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(V),this.cropRectChanged(V),this.flippedHorizontally=K.flippedHorizontally,this.flippedVertically=K.flippedVertically,this.applyFlip(),this.rotationAngle=K.rotationAngle,this.applyRotation()}},q.prototype.clientToLocalCoordinates=function(K,V){var Z=this.cropImage.getBoundingClientRect();return{x:K-Z.left,y:V-Z.top}},q.prototype.onWindowResize=function(){this.positionUI()},q.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var K=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=K+"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()},q.prototype.rotateLeftButtonClicked=function(){var K=this.rotationAngle-90;this.rotationAngle%90!=0&&(K+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(K)},q.prototype.rotateRightButtonClicked=function(){var K=this.rotationAngle+90;this.rotationAngle%90!=0&&(K-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(K)},q.prototype.rotateTo=function(K){K=(K=K>180?K-360:K)<=-180?K+360:K,this.rotationAngle=K,this.applyRotation()},q.prototype.rotateBy=function(K){this.rotateTo((this.rotationAngle+K)%360)},q.prototype.applyRotation=function(){var K=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var V=this.editingTargetRotationContainer.transform.baseVal.getItem(0);V.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(V,0);var Z=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/Z.width,this.imageHeight/Z.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=K},q.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},q.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},q.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},q.prototype.startRenderAndClose=function(){return Ne(this,void 0,void 0,function(){var K,V;return be(this,function(Z){switch(Z.label){case 0:return[4,this.render()];case 1:return K=Z.sent(),V=this.getState(),this.renderEventListeners.forEach(function(ie){return ie(K,V)}),this.close(!0),[2]}})})},q.prototype.render=function(){return Ne(this,void 0,void 0,function(){var K;return be(this,function(V){switch(V.label){case 0:return(K=new Fe).naturalSize=this.renderAtNaturalSize,K.imageType=this.renderImageType,K.imageQuality=this.renderImageQuality,K.width=this.renderWidth,K.height=this.renderHeight,this.unzoomFromCrop(),A.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,K.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 V.sent(),[4,K.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,V.sent()]}})})},q.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new G("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 G("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new G("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var K=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new G("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*K)+`px;
|
|
height: `+(this.toolbarHeight-2*K)+`px;
|
|
padding: `+K+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new G("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new G("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new F("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new F("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new G("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 G("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new G("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 G("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*K)+`px;
|
|
padding: `+K+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new G("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},q.instanceCounter=0,q}(),Ke=$("8hTe"),Ge=$.n(Ke),Ue=/<pre[^>]*>/g;function qe(q){var K=document.createElement("div");return K.innerHTML=q,K.childNodes.length===0?"":K.childNodes[0].nodeValue}var et=ye.a=function(q){var K=q.value,V=K===void 0?"":K,Z=q.edit,ie=Z===void 0?!1:Z,Y=q.className,J=q.showTextOnly,ne=q.showLines,se=q.replaces,Te=q.zoomImg,_e=q.hasMask,De=q.style,We=De===void 0?{}:De,$e=q.stylesPrev,Xe=$e===void 0?{}:$e,_t=String(V),at=Object(S.useRef)(),Qe=Object(S.useRef)(),kt=Object(S.useState)(""),St=Object(H.a)(kt,2),Bt=St[0],jt=St[1],lt=Object(S.useState)("office"),Kt=Object(H.a)(lt,2),Zt=Kt[0],Gt=Kt[1],ai=function(){var xt=new Ve(Qe.current);xt.displayMode="popup",xt.addRenderEventListener(function(){var Tt=Object(R.a)(e.a.mark(function ut(zt){var At;return e.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return at.current.style.display="none",Ut.next=3,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:zt}});case 3:At=Ut.sent,At!=null&&At.id&&se(Qe.current.getAttribute("src").replace(Q.a.API_SERVER,""),"/api/attachments/".concat(At==null?void 0:At.id,"?type=").concat(At.content_type));case 5:case"end":return Ut.stop()}},ut)}));return function(ut){return Tt.apply(this,arguments)}}()),xt.show()},it=function(){var xt=new Se.a(Qe.current);xt.settings.displayMode="popup",xt.addEventListener("render",function(){var Tt=Object(R.a)(e.a.mark(function ut(zt){var At;return e.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(at.current.style.display="none",!Qe.current){Ut.next=6;break}return Ut.next=4,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:zt.dataUrl}});case 4:At=Ut.sent,At!=null&&At.id&&se(Qe.current.getAttribute("src").replace(Q.a.API_SERVER,""),"/api/attachments/".concat(At==null?void 0:At.id,"?type=").concat(At.content_type));case 6:case"end":return Ut.stop()}},ut)}));return function(ut){return Tt.apply(this,arguments)}}()),xt.show(),window.markerArea=xt},nt=Object(S.useMemo)(function(){at.current&&(at.current.style.zIndex=-1);try{var Wt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,xt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Tt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;_t=_t.replace(Wt,"("+Q.a.API_SERVER+"/api/attachments/").replace(xt,'"'+Q.a.API_SERVER+"/api/attachments/").replace(Tt,'"'+Q.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(oi){}var ut=D(_t),zt=_();if(_t.match(/\[TOC\]/)&&(ut=ut.replace("<p>[TOC]</p>",E()),v()),ut=ut.replace(/(__special_katext_id_\d+__)/g,function(oi,Ut){var ui=zt[Ut],_i=ui.type,Ei=ui.expression;return Object(fe.renderToString)(qe(Ei)||"",{displayMode:_i==="block",throwOnError:!1,output:"html"})}),ut=ut.replace(/▁/g,"\u2581\u2581\u2581"),y(),J){var At=document.createElement("div");return At.innerHTML=ut,At.innerText}return setTimeout(function(){return qt()},500),ut},[_t]),Et=Object(S.useRef)();f.WebkitLineClamp=ne,ne&&(We=Object(w.a)(Object(w.a)({},We),f));function Nt(Wt){var xt=Wt.target;if(xt.tagName.toUpperCase()==="IMG"){if(Te){var Tt=xt.getAttribute("src");jt(Tt),Gt("image")}}else if(xt.tagName.toUpperCase()==="A"){var ut=xt.getAttribute("href");if(ut.indexOf("office")>-1)Wt.preventDefault(),jt(ut),Gt("office");else if(ut.indexOf("application/pdf")>-1)Wt.preventDefault(),jt(ut),Gt("pdf");else if(ut.indexOf("text/html")>-1)Wt.preventDefault(),jt(ut),Gt("html");else if(ut.startsWith("#")){Wt.preventDefault();var zt=document.getElementById(ut.replace("#",""));zt&&zt.scrollIntoView(!0)}}}var qt=function(){var xt,Tt=(xt=Et.current)===null||xt===void 0?void 0:xt.querySelectorAll("video");Tt==null||Tt.forEach(function(ut){if(ut.oncontextmenu=function(){return!1},ut.src.indexOf(".m3u8")>-1&&!ut.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var zt=new W.a;zt.loadSource(ut.src),zt.attachMedia(ut)}}})};Object(S.useEffect)(function(){if(Et.current&&nt&&(nt.match(Ue)&&window.PR.prettyPrint()),Et.current)return Et.current.addEventListener("click",Nt),function(){Et.current.removeEventListener("click",Nt),y(),v()}},[nt,Et.current,Nt]);var pi=function(xt){if(!ie)return;xt.target.nodeName==="IMG"?(at.current.style.zIndex=1,at.current.style.display="flex",at.current.style.width=xt.target.clientWidth+"px",at.current.style.height=xt.target.clientHeight+"px",at.current.style.top=xt.target.offsetTop+"px",at.current.style.left=xt.target.offsetLeft+"px",Qe.current.src=xt.target.getAttribute("src")):at.current.style.display="none"};return d.a.createElement("div",{style:{position:"relative"}},d.a.createElement("div",{ref:Et,style:Object(w.a)({},We),className:"".concat(Y||""," markdown-body ").concat(Ge.a.mdBody),onMouseOver:pi,dangerouslySetInnerHTML:{__html:nt}}),d.a.createElement("div",{ref:at,className:Ge.a.button},d.a.createElement(B.a,null,d.a.createElement(k.a,{onClick:function(){return ai()}},"\u88C1\u526A"),d.a.createElement(k.a,{onClick:function(){return it()}},"\u7F16\u8F91"))),d.a.createElement("img",{ref:Qe,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),d.a.createElement(de.a,{close:!0,data:Bt,type:Bt!=null&&Bt.length?Zt:"",style:Object(w.a)({},Xe),onClose:function(){return jt("")}}))}},BU3w:function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return R});var ae=$("MNnm"),B="rc-util-key";function O(H){if(H.attachTo)return H.attachTo;var U=document.querySelector("head");return U||document.body}function k(H){var U,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ae.a)())return null;var S=document.createElement("style");if((U=e.csp)===null||U===void 0?void 0:U.nonce){var d;S.nonce=(d=e.csp)===null||d===void 0?void 0:d.nonce}S.innerHTML=H;var h=O(e),o=h.firstChild;return e.prepend&&h.prepend?h.prepend(S):e.prepend&&o?h.insertBefore(S,o):h.appendChild(S),S}var w=new Map;function R(H,U){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=O(e);if(!w.has(S)){var d=k("",e),h=d.parentNode;w.set(S,h),h.removeChild(d)}var o=Array.from(w.get(S).children).find(function(n){return n.tagName==="STYLE"&&n[B]===U});if(o){var a,r;if(((a=e.csp)===null||a===void 0?void 0:a.nonce)&&o.nonce!==((r=e.csp)===null||r===void 0?void 0:r.nonce)){var l;o.nonce=(l=e.csp)===null||l===void 0?void 0:l.nonce}return o.innerHTML!==H&&(o.innerHTML=H),o}var s=k(H,e);return s[B]=U,s}},BdwD:function(Ye,ye,$){"use strict";var ae=$("+L6B"),B=$("2/Rp"),O=$("0Owb"),k=$("k1fw"),w=$("q1tI"),R=$.n(w),H=$("FOrL"),U=$.n(H),e=function(d){var h=d.buttonProps,o=h===void 0?{}:h,a=d.styles,r=a===void 0?{}:a,l=d.imgStyles,s=l===void 0?{}:l,n=d.customText,i=d.ButtonText,t=d.ButtonClick,v=d.Buttonclass,f=d.ButtonTwo;return R.a.createElement("section",{className:"tc animated fadeIn",style:Object(k.a)(Object(k.a)({},{color:"#999",margin:"0 auto",padding:"100px 0"}),r)},R.a.createElement("img",{src:U.a,style:Object(k.a)(Object(k.a)({},{width:"200px",height:"150px"}),s)}),R.a.createElement("p",{className:"mt10 font14"},n||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),i&&R.a.createElement(B.a,Object(O.a)({className:v,onClick:t},o),i),f&&f)};ye.a=e},"C/vA":function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return ae});function ae(B){const O=this;let k=!1,w;return function(){return k||(k=!0,w=B.apply(O,arguments)),w}}},"Cg/j":function(Ye,ye,$){"use strict";$.d(ye,"b",function(){return ae}),$.d(ye,"a",function(){return B}),$.d(ye,"c",function(){return k}),$.d(ye,"d",function(){return w});var ae;(function(R){R.serviceIds=new Map,R.DI_TARGET="$di$target",R.DI_DEPENDENCIES="$di$dependencies";function H(U){return U[R.DI_DEPENDENCIES]||[]}R.getServiceDependencies=H})(ae||(ae={}));const B=k("instantiationService");function O(R,H,U,e){H[ae.DI_TARGET]===H?H[ae.DI_DEPENDENCIES].push({id:R,index:U,optional:e}):(H[ae.DI_DEPENDENCIES]=[{id:R,index:U,optional:e}],H[ae.DI_TARGET]=H)}function k(R){if(ae.serviceIds.has(R))return ae.serviceIds.get(R);const H=function(U,e,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");O(H,U,S,!1)};return H.toString=()=>R,ae.serviceIds.set(R,H),H}function w(R){return function(H,U,e){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");O(R,H,e,!0)}}},DlQD:function(Ye,ye,$){(function(ae,B){Ye.exports=B()})(this,function(){"use strict";function ae(V,Z){for(var ie=0;ie<Z.length;ie++){var Y=Z[ie];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(V,Y.key,Y)}}function B(V,Z,ie){return Z&&ae(V.prototype,Z),ie&&ae(V,ie),V}function O(V,Z){if(!V)return;if(typeof V=="string")return k(V,Z);var ie=Object.prototype.toString.call(V).slice(8,-1);if(ie==="Object"&&V.constructor&&(ie=V.constructor.name),ie==="Map"||ie==="Set")return Array.from(V);if(ie==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ie))return k(V,Z)}function k(V,Z){(Z==null||Z>V.length)&&(Z=V.length);for(var ie=0,Y=new Array(Z);ie<Z;ie++)Y[ie]=V[ie];return Y}function w(V,Z){var ie;if(typeof Symbol=="undefined"||V[Symbol.iterator]==null){if(Array.isArray(V)||(ie=O(V))||Z&&V&&typeof V.length=="number"){ie&&(V=ie);var Y=0;return function(){return Y>=V.length?{done:!0}:{done:!1,value:V[Y++]}}}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 ie=V[Symbol.iterator](),ie.next.bind(ie)}function R(V,Z){return Z={exports:{}},V(Z,Z.exports),Z.exports}var H=R(function(V){function Z(){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 ie(Y){V.exports.defaults=Y}V.exports={defaults:Z(),getDefaults:Z,changeDefaults:ie}}),U=H.defaults,e=H.getDefaults,S=H.changeDefaults,d=/[&<>"']/,h=/[&<>"']/g,o=/[<>"']|&(?!#?\w+;)/,a=/[<>"']|&(?!#?\w+;)/g,r={"&":"&","<":"<",">":">",'"':""","'":"'"},l=function(Z){return r[Z]};function s(V,Z){if(Z){if(d.test(V))return V.replace(h,l)}else if(o.test(V))return V.replace(a,l);return V}var n=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function i(V){return V.replace(n,function(Z,ie){return ie=ie.toLowerCase(),ie==="colon"?":":ie.charAt(0)==="#"?ie.charAt(1)==="x"?String.fromCharCode(parseInt(ie.substring(2),16)):String.fromCharCode(+ie.substring(1)):""})}var t=/(^|[^\[])\^/g;function v(V,Z){V=V.source||V,Z=Z||"";var ie={replace:function(J,ne){return ne=ne.source||ne,ne=ne.replace(t,"$1"),V=V.replace(J,ne),ie},getRegex:function(){return new RegExp(V,Z)}};return ie}var f=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function E(V,Z,ie){if(V){var Y;try{Y=decodeURIComponent(i(ie)).replace(f,"").toLowerCase()}catch(J){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}Z&&!p.test(ie)&&(ie=u(Z,ie));try{ie=encodeURI(ie).replace(/%25/g,"%")}catch(J){return null}return ie}var b={},g=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,m=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(V,Z){b[" "+V]||(g.test(V)?b[" "+V]=V+"/":b[" "+V]=M(V,"/",!0)),V=b[" "+V];var ie=V.indexOf(":")===-1;return Z.substring(0,2)==="//"?ie?Z:V.replace(c,"$1")+Z:Z.charAt(0)==="/"?ie?Z:V.replace(m,"$1")+Z:V+Z}var _={exec:function(){}};function y(V){for(var Z=1,ie,Y;Z<arguments.length;Z++){ie=arguments[Z];for(Y in ie)Object.prototype.hasOwnProperty.call(ie,Y)&&(V[Y]=ie[Y])}return V}function T(V,Z){var ie=V.replace(/\|/g,function(ne,se,Te){for(var _e=!1,De=se;--De>=0&&Te[De]==="\\";)_e=!_e;return _e?"|":" |"}),Y=ie.split(/ \|/),J=0;if(Y.length>Z)Y.splice(Z);else for(;Y.length<Z;)Y.push("");for(;J<Y.length;J++)Y[J]=Y[J].trim().replace(/\\\|/g,"|");return Y}function M(V,Z,ie){var Y=V.length;if(Y===0)return"";for(var J=0;J<Y;){var ne=V.charAt(Y-J-1);if(ne===Z&&!ie)J++;else if(ne!==Z&&ie)J++;else break}return V.substr(0,Y-J)}function L(V,Z){if(V.indexOf(Z[1])===-1)return-1;for(var ie=V.length,Y=0,J=0;J<ie;J++)if(V[J]==="\\")J++;else if(V[J]===Z[0])Y++;else if(V[J]===Z[1]&&(Y--,Y<0))return J;return-1}function x(V){V&&V.sanitize&&!V.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 D={escape:s,unescape:i,edit:v,cleanUrl:E,resolveUrl:u,noopTest:_,merge:y,splitCells:T,rtrim:M,findClosingBracket:L,checkSanitizeDeprecation:x},j=H.defaults,I=D.rtrim,W=D.splitCells,Q=D.escape,fe=D.findClosingBracket;function de(V,Z,ie){var Y=Z.href,J=Z.title?Q(Z.title):null,ne=V[1].replace(/\\([\[\]])/g,"$1");return V[0].charAt(0)!=="!"?{type:"link",raw:ie,href:Y,title:J,text:ne}:{type:"image",raw:ie,href:Y,title:J,text:Q(ne)}}function Oe(V,Z){var ie=V.match(/^(\s+)(?:```)/);if(ie===null)return Z;var Y=ie[1];return Z.split(`
|
|
`).map(function(J){var ne=J.match(/^\s+/);if(ne===null)return J;var se=ne[0];return se.length>=Y.length?J.slice(Y.length):J}).join(`
|
|
`)}var Se=function(){function V(ie){this.options=ie||j}var Z=V.prototype;return Z.space=function(Y){var J=this.rules.block.newline.exec(Y);if(J)return J[0].length>1?{type:"space",raw:J[0]}:{raw:`
|
|
`}},Z.code=function(Y,J){var ne=this.rules.block.code.exec(Y);if(ne){var se=J[J.length-1];if(se&&se.type==="paragraph")return{raw:ne[0],text:ne[0].trimRight()};var Te=ne[0].replace(/^ {4}/gm,"");return{type:"code",raw:ne[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:I(Te,`
|
|
`)}}},Z.fences=function(Y){var J=this.rules.block.fences.exec(Y);if(J){var ne=J[0],se=Oe(ne,J[3]||"");return{type:"code",raw:ne,lang:J[2]?J[2].trim():J[2],text:se}}},Z.heading=function(Y){var J=this.rules.block.heading.exec(Y);if(J)return{type:"heading",raw:J[0],depth:J[1].length,text:J[2]}},Z.nptable=function(Y){var J=this.rules.block.nptable.exec(Y);if(J){var ne={type:"table",header:W(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[],raw:J[0]};if(ne.header.length===ne.align.length){var se=ne.align.length,Te;for(Te=0;Te<se;Te++)/^ *-+: *$/.test(ne.align[Te])?ne.align[Te]="right":/^ *:-+: *$/.test(ne.align[Te])?ne.align[Te]="center":/^ *:-+ *$/.test(ne.align[Te])?ne.align[Te]="left":ne.align[Te]=null;for(se=ne.cells.length,Te=0;Te<se;Te++)ne.cells[Te]=W(ne.cells[Te],ne.header.length);return ne}}},Z.hr=function(Y){var J=this.rules.block.hr.exec(Y);if(J)return{type:"hr",raw:J[0]}},Z.blockquote=function(Y){var J=this.rules.block.blockquote.exec(Y);if(J){var ne=J[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:J[0],text:ne}}},Z.list=function(Y){var J=this.rules.block.list.exec(Y);if(J){for(var ne=J[0],se=J[2],Te=se.length>1,_e=se[se.length-1]===")",De={type:"list",raw:ne,ordered:Te,start:Te?+se.slice(0,-1):"",loose:!1,items:[]},We=J[0].match(this.rules.block.item),$e=!1,Xe,_t,at,Qe,kt,St,Bt,jt=We.length,lt=0;lt<jt;lt++)Xe=We[lt],ne=Xe,_t=Xe.length,Xe=Xe.replace(/^ *([*+-]|\d+[.)]) */,""),~Xe.indexOf(`
|
|
`)&&(_t-=Xe.length,Xe=this.options.pedantic?Xe.replace(/^ {1,4}/gm,""):Xe.replace(new RegExp("^ {1,"+_t+"}","gm"),"")),lt!==jt-1&&(at=this.rules.block.bullet.exec(We[lt+1])[0],(Te?at.length===1||!_e&&at[at.length-1]===")":at.length>1||this.options.smartLists&&at!==se)&&(Qe=We.slice(lt+1).join(`
|
|
`),De.raw=De.raw.substring(0,De.raw.length-Qe.length),lt=jt-1)),kt=$e||/\n\n(?!\s*$)/.test(Xe),lt!==jt-1&&($e=Xe.charAt(Xe.length-1)===`
|
|
`,kt||(kt=$e)),kt&&(De.loose=!0),St=/^\[[ xX]\] /.test(Xe),Bt=void 0,St&&(Bt=Xe[1]!==" ",Xe=Xe.replace(/^\[[ xX]\] +/,"")),De.items.push({type:"list_item",raw:ne,task:St,checked:Bt,loose:kt,text:Xe});return De}},Z.html=function(Y){var J=this.rules.block.html.exec(Y);if(J)return{type:this.options.sanitize?"paragraph":"html",raw:J[0],pre:!this.options.sanitizer&&(J[1]==="pre"||J[1]==="script"||J[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(J[0]):Q(J[0]):J[0]}},Z.def=function(Y){var J=this.rules.block.def.exec(Y);if(J){J[3]&&(J[3]=J[3].substring(1,J[3].length-1));var ne=J[1].toLowerCase().replace(/\s+/g," ");return{tag:ne,raw:J[0],href:J[2],title:J[3]}}},Z.table=function(Y){var J=this.rules.block.table.exec(Y);if(J){var ne={type:"table",header:W(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ne.header.length===ne.align.length){ne.raw=J[0];var se=ne.align.length,Te;for(Te=0;Te<se;Te++)/^ *-+: *$/.test(ne.align[Te])?ne.align[Te]="right":/^ *:-+: *$/.test(ne.align[Te])?ne.align[Te]="center":/^ *:-+ *$/.test(ne.align[Te])?ne.align[Te]="left":ne.align[Te]=null;for(se=ne.cells.length,Te=0;Te<se;Te++)ne.cells[Te]=W(ne.cells[Te].replace(/^ *\| *| *\| *$/g,""),ne.header.length);return ne}}},Z.lheading=function(Y){var J=this.rules.block.lheading.exec(Y);if(J)return{type:"heading",raw:J[0],depth:J[2].charAt(0)==="="?1:2,text:J[1]}},Z.paragraph=function(Y){var J=this.rules.block.paragraph.exec(Y);if(J)return{type:"paragraph",raw:J[0],text:J[1].charAt(J[1].length-1)===`
|
|
`?J[1].slice(0,-1):J[1]}},Z.text=function(Y,J){var ne=this.rules.block.text.exec(Y);if(ne){var se=J[J.length-1];return se&&se.type==="text"?{raw:ne[0],text:ne[0]}:{type:"text",raw:ne[0],text:ne[0]}}},Z.escape=function(Y){var J=this.rules.inline.escape.exec(Y);if(J)return{type:"escape",raw:J[0],text:Q(J[1])}},Z.tag=function(Y,J,ne){var se=this.rules.inline.tag.exec(Y);if(se)return!J&&/^<a /i.test(se[0])?J=!0:J&&/^<\/a>/i.test(se[0])&&(J=!1),!ne&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?ne=!0:ne&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(ne=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:J,inRawBlock:ne,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Q(se[0]):se[0]}},Z.link=function(Y){var J=this.rules.inline.link.exec(Y);if(J){var ne=fe(J[2],"()");if(ne>-1){var se=J[0].indexOf("!")===0?5:4,Te=se+J[1].length+ne;J[2]=J[2].substring(0,ne),J[0]=J[0].substring(0,Te).trim(),J[3]=""}var _e=J[2],De="";if(this.options.pedantic){var We=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(_e);We?(_e=We[1],De=We[3]):De=""}else De=J[3]?J[3].slice(1,-1):"";_e=_e.trim().replace(/^<([\s\S]*)>$/,"$1");var $e=de(J,{href:_e&&_e.replace(this.rules.inline._escapes,"$1"),title:De&&De.replace(this.rules.inline._escapes,"$1")},J[0]);return $e}},Z.reflink=function(Y,J){var ne;if((ne=this.rules.inline.reflink.exec(Y))||(ne=this.rules.inline.nolink.exec(Y))){var se=(ne[2]||ne[1]).replace(/\s+/g," ");if(se=J[se.toLowerCase()],!se||!se.href){var Te=ne[0].charAt(0);return{type:"text",raw:Te,text:Te}}var _e=de(ne,se,ne[0]);return _e}},Z.strong=function(Y,J,ne){ne===void 0&&(ne="");var se=this.rules.inline.strong.start.exec(Y);if(se&&(!se[1]||se[1]&&(ne===""||this.rules.inline.punctuation.exec(ne)))){J=J.slice(-1*Y.length);var Te=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var _e;(se=Te.exec(J))!=null;)if(_e=this.rules.inline.strong.middle.exec(J.slice(0,se.index+3)),_e)return{type:"strong",raw:Y.slice(0,_e[0].length),text:Y.slice(2,_e[0].length-2)}}},Z.em=function(Y,J,ne){ne===void 0&&(ne="");var se=this.rules.inline.em.start.exec(Y);if(se&&(!se[1]||se[1]&&(ne===""||this.rules.inline.punctuation.exec(ne)))){J=J.slice(-1*Y.length);var Te=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var _e;(se=Te.exec(J))!=null;)if(_e=this.rules.inline.em.middle.exec(J.slice(0,se.index+2)),_e)return{type:"em",raw:Y.slice(0,_e[0].length),text:Y.slice(1,_e[0].length-1)}}},Z.codespan=function(Y){var J=this.rules.inline.code.exec(Y);if(J){var ne=J[2].replace(/\n/g," "),se=/[^ ]/.test(ne),Te=ne.startsWith(" ")&&ne.endsWith(" ");return se&&Te&&(ne=ne.substring(1,ne.length-1)),ne=Q(ne,!0),{type:"codespan",raw:J[0],text:ne}}},Z.br=function(Y){var J=this.rules.inline.br.exec(Y);if(J)return{type:"br",raw:J[0]}},Z.del=function(Y){var J=this.rules.inline.del.exec(Y);if(J)return{type:"del",raw:J[0],text:J[1]}},Z.autolink=function(Y,J){var ne=this.rules.inline.autolink.exec(Y);if(ne){var se,Te;return ne[2]==="@"?(se=Q(this.options.mangle?J(ne[1]):ne[1]),Te="mailto:"+se):(se=Q(ne[1]),Te=se),{type:"link",raw:ne[0],text:se,href:Te,tokens:[{type:"text",raw:se,text:se}]}}},Z.url=function(Y,J){var ne;if(ne=this.rules.inline.url.exec(Y)){var se,Te;if(ne[2]==="@")se=Q(this.options.mangle?J(ne[0]):ne[0]),Te="mailto:"+se;else{var _e;do _e=ne[0],ne[0]=this.rules.inline._backpedal.exec(ne[0])[0];while(_e!==ne[0]);se=Q(ne[0]),ne[1]==="www."?Te="http://"+se:Te=se}return{type:"link",raw:ne[0],text:se,href:Te,tokens:[{type:"text",raw:se,text:se}]}}},Z.inlineText=function(Y,J,ne){var se=this.rules.inline.text.exec(Y);if(se){var Te;return J?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Q(se[0]):se[0]:Te=Q(this.options.smartypants?ne(se[0]):se[0]),{type:"text",raw:se[0],text:Te}}},V}(),Ie=D.noopTest,Le=D.edit,Ne=D.merge,be={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:Ie,table:Ie,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};be._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,be._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,be.def=Le(be.def).replace("label",be._label).replace("title",be._title).getRegex(),be.bullet=/(?:[*+-]|\d{1,9}[.)])/,be.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,be.item=Le(be.item,"gm").replace(/bull/g,be.bullet).getRegex(),be.list=Le(be.list).replace(/bull/g,be.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+be.def.source+")").getRegex(),be._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",be._comment=/<!--(?!-?>)[\s\S]*?-->/,be.html=Le(be.html,"i").replace("comment",be._comment).replace("tag",be._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),be.paragraph=Le(be._paragraph).replace("hr",be.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",be._tag).getRegex(),be.blockquote=Le(be.blockquote).replace("paragraph",be.paragraph).getRegex(),be.normal=Ne({},be),be.gfm=Ne({},be.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*|$)"}),be.gfm.nptable=Le(be.gfm.nptable).replace("hr",be.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",be._tag).getRegex(),be.gfm.table=Le(be.gfm.table).replace("hr",be.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",be._tag).getRegex(),be.pedantic=Ne({},be.normal,{html:Le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",be._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:Ie,paragraph:Le(be.normal._paragraph).replace("hr",be.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",be.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var N={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ie,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:Ie,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};N._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",N.punctuation=Le(N.punctuation).replace(/punctuation/g,N._punctuation).getRegex(),N._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",N._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",N.em.start=Le(N.em.start).replace(/punctuation/g,N._punctuation).getRegex(),N.em.middle=Le(N.em.middle).replace(/punctuation/g,N._punctuation).replace(/overlapSkip/g,N._overlapSkip).getRegex(),N.em.endAst=Le(N.em.endAst,"g").replace(/punctuation/g,N._punctuation).getRegex(),N.em.endUnd=Le(N.em.endUnd,"g").replace(/punctuation/g,N._punctuation).getRegex(),N.strong.start=Le(N.strong.start).replace(/punctuation/g,N._punctuation).getRegex(),N.strong.middle=Le(N.strong.middle).replace(/punctuation/g,N._punctuation).replace(/blockSkip/g,N._blockSkip).getRegex(),N.strong.endAst=Le(N.strong.endAst,"g").replace(/punctuation/g,N._punctuation).getRegex(),N.strong.endUnd=Le(N.strong.endUnd,"g").replace(/punctuation/g,N._punctuation).getRegex(),N.blockSkip=Le(N._blockSkip,"g").getRegex(),N.overlapSkip=Le(N._overlapSkip,"g").getRegex(),N._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,N._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,N._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])?)+(?![-_])/,N.autolink=Le(N.autolink).replace("scheme",N._scheme).replace("email",N._email).getRegex(),N._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,N.tag=Le(N.tag).replace("comment",be._comment).replace("attribute",N._attribute).getRegex(),N._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,N._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,N._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,N.link=Le(N.link).replace("label",N._label).replace("href",N._href).replace("title",N._title).getRegex(),N.reflink=Le(N.reflink).replace("label",N._label).getRegex(),N.reflinkSearch=Le(N.reflinkSearch,"g").replace("reflink",N.reflink).replace("nolink",N.nolink).getRegex(),N.normal=Ne({},N),N.pedantic=Ne({},N.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:Le(/^!?\[(label)\]\((.*?)\)/).replace("label",N._label).getRegex(),reflink:Le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",N._label).getRegex()}),N.gfm=Ne({},N.normal,{escape:Le(N.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),N.gfm.url=Le(N.gfm.url,"i").replace("email",N.gfm._extended_email).getRegex(),N.breaks=Ne({},N.gfm,{br:Le(N.br).replace("{2,}","*").getRegex(),text:Le(N.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var A={block:be,inline:N},C=H.defaults,F=A.block,G=A.inline;function P(V){return V.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 oe(V){var Z="",ie,Y,J=V.length;for(ie=0;ie<J;ie++)Y=V.charCodeAt(ie),Math.random()>.5&&(Y="x"+Y.toString(16)),Z+="&#"+Y+";";return Z}var we=function(){function V(ie){this.tokens=[],this.tokens.links=Object.create(null),this.options=ie||C,this.options.tokenizer=this.options.tokenizer||new Se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:F.normal,inline:G.normal};this.options.pedantic?(Y.block=F.pedantic,Y.inline=G.pedantic):this.options.gfm&&(Y.block=F.gfm,this.options.breaks?Y.inline=G.breaks:Y.inline=G.gfm),this.tokenizer.rules=Y}V.lex=function(Y,J){var ne=new V(J);return ne.lex(Y)};var Z=V.prototype;return Z.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},Z.blockTokens=function(Y,J,ne){J===void 0&&(J=[]),ne===void 0&&(ne=!0),Y=Y.replace(/^ +$/gm,"");for(var se,Te,_e,De;Y;){if(se=this.tokenizer.space(Y)){Y=Y.substring(se.raw.length),se.type&&J.push(se);continue}if(se=this.tokenizer.code(Y,J)){Y=Y.substring(se.raw.length),se.type?J.push(se):(De=J[J.length-1],De.raw+=`
|
|
`+se.raw,De.text+=`
|
|
`+se.text);continue}if(se=this.tokenizer.fences(Y)){Y=Y.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.heading(Y)){Y=Y.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.nptable(Y)){Y=Y.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.hr(Y)){Y=Y.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.blockquote(Y)){Y=Y.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],ne),J.push(se);continue}if(se=this.tokenizer.list(Y)){for(Y=Y.substring(se.raw.length),_e=se.items.length,Te=0;Te<_e;Te++)se.items[Te].tokens=this.blockTokens(se.items[Te].text,[],!1);J.push(se);continue}if(se=this.tokenizer.html(Y)){Y=Y.substring(se.raw.length),J.push(se);continue}if(ne&&(se=this.tokenizer.def(Y))){Y=Y.substring(se.raw.length),this.tokens.links[se.tag]||(this.tokens.links[se.tag]={href:se.href,title:se.title});continue}if(se=this.tokenizer.table(Y)){Y=Y.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.lheading(Y)){Y=Y.substring(se.raw.length),J.push(se);continue}if(ne&&(se=this.tokenizer.paragraph(Y))){Y=Y.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.text(Y,J)){Y=Y.substring(se.raw.length),se.type?J.push(se):(De=J[J.length-1],De.raw+=`
|
|
`+se.raw,De.text+=`
|
|
`+se.text);continue}if(Y){var We="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(We);break}else throw new Error(We)}}return J},Z.inline=function(Y){var J,ne,se,Te,_e,De,We=Y.length;for(J=0;J<We;J++){De=Y[J];switch(De.type){case"paragraph":case"text":case"heading":{De.tokens=[],this.inlineTokens(De.text,De.tokens);break}case"table":{for(De.tokens={header:[],cells:[]},Te=De.header.length,ne=0;ne<Te;ne++)De.tokens.header[ne]=[],this.inlineTokens(De.header[ne],De.tokens.header[ne]);for(Te=De.cells.length,ne=0;ne<Te;ne++)for(_e=De.cells[ne],De.tokens.cells[ne]=[],se=0;se<_e.length;se++)De.tokens.cells[ne][se]=[],this.inlineTokens(_e[se],De.tokens.cells[ne][se]);break}case"blockquote":{this.inline(De.tokens);break}case"list":{for(Te=De.items.length,ne=0;ne<Te;ne++)this.inline(De.items[ne].tokens);break}}}return Y},Z.inlineTokens=function(Y,J,ne,se,Te){J===void 0&&(J=[]),ne===void 0&&(ne=!1),se===void 0&&(se=!1),Te===void 0&&(Te="");var _e,De=Y,We;if(this.tokens.links){var $e=Object.keys(this.tokens.links);if($e.length>0)for(;(We=this.tokenizer.rules.inline.reflinkSearch.exec(De))!=null;)$e.includes(We[0].slice(We[0].lastIndexOf("[")+1,-1))&&(De=De.slice(0,We.index)+"["+"a".repeat(We[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(We=this.tokenizer.rules.inline.blockSkip.exec(De))!=null;)De=De.slice(0,We.index)+"["+"a".repeat(We[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(_e=this.tokenizer.escape(Y)){Y=Y.substring(_e.raw.length),J.push(_e);continue}if(_e=this.tokenizer.tag(Y,ne,se)){Y=Y.substring(_e.raw.length),ne=_e.inLink,se=_e.inRawBlock,J.push(_e);continue}if(_e=this.tokenizer.link(Y)){Y=Y.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,se)),J.push(_e);continue}if(_e=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,se)),J.push(_e);continue}if(_e=this.tokenizer.strong(Y,De,Te)){Y=Y.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],ne,se),J.push(_e);continue}if(_e=this.tokenizer.em(Y,De,Te)){Y=Y.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],ne,se),J.push(_e);continue}if(_e=this.tokenizer.codespan(Y)){Y=Y.substring(_e.raw.length),J.push(_e);continue}if(_e=this.tokenizer.br(Y)){Y=Y.substring(_e.raw.length),J.push(_e);continue}if(_e=this.tokenizer.del(Y)){Y=Y.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],ne,se),J.push(_e);continue}if(_e=this.tokenizer.autolink(Y,oe)){Y=Y.substring(_e.raw.length),J.push(_e);continue}if(!ne&&(_e=this.tokenizer.url(Y,oe))){Y=Y.substring(_e.raw.length),J.push(_e);continue}if(_e=this.tokenizer.inlineText(Y,se,P)){Y=Y.substring(_e.raw.length),Te=_e.raw.slice(-1),J.push(_e);continue}if(Y){var Xe="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(Xe);break}else throw new Error(Xe)}}return J},B(V,null,[{key:"rules",get:function(){return{block:F,inline:G}}}]),V}(),Re=H.defaults,ee=D.cleanUrl,ce=D.escape,Ee=function(){function V(ie){this.options=ie||Re}var Z=V.prototype;return Z.code=function(Y,J,ne){var se=(J||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(Y,se);Te!=null&&Te!==Y&&(ne=!0,Y=Te)}return se?'<pre><code class="'+this.options.langPrefix+ce(se,!0)+'">'+(ne?Y:ce(Y,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ne?Y:ce(Y,!0))+`</code></pre>
|
|
`},Z.blockquote=function(Y){return`<blockquote>
|
|
`+Y+`</blockquote>
|
|
`},Z.html=function(Y){return Y},Z.heading=function(Y,J,ne,se){return this.options.headerIds?"<h"+J+' id="'+this.options.headerPrefix+se.slug(ne)+'">'+Y+"</h"+J+`>
|
|
`:"<h"+J+">"+Y+"</h"+J+`>
|
|
`},Z.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},Z.list=function(Y,J,ne){var se=J?"ol":"ul",Te=J&&ne!==1?' start="'+ne+'"':"";return"<"+se+Te+`>
|
|
`+Y+"</"+se+`>
|
|
`},Z.listitem=function(Y){return"<li>"+Y+`</li>
|
|
`},Z.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},Z.paragraph=function(Y){return"<p>"+Y+`</p>
|
|
`},Z.table=function(Y,J){return J&&(J="<tbody>"+J+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Y+`</thead>
|
|
`+J+`</table>
|
|
`},Z.tablerow=function(Y){return`<tr>
|
|
`+Y+`</tr>
|
|
`},Z.tablecell=function(Y,J){var ne=J.header?"th":"td",se=J.align?"<"+ne+' align="'+J.align+'">':"<"+ne+">";return se+Y+"</"+ne+`>
|
|
`},Z.strong=function(Y){return"<strong>"+Y+"</strong>"},Z.em=function(Y){return"<em>"+Y+"</em>"},Z.codespan=function(Y){return"<code>"+Y+"</code>"},Z.br=function(){return this.options.xhtml?"<br/>":"<br>"},Z.del=function(Y){return"<del>"+Y+"</del>"},Z.link=function(Y,J,ne){if(Y=ee(this.options.sanitize,this.options.baseUrl,Y),Y===null)return ne;var se='<a href="'+ce(Y)+'"';return J&&(se+=' title="'+J+'"'),se+=">"+ne+"</a>",se},Z.image=function(Y,J,ne){if(Y=ee(this.options.sanitize,this.options.baseUrl,Y),Y===null)return ne;var se='<img src="'+Y+'" alt="'+ne+'"';return J&&(se+=' title="'+J+'"'),se+=this.options.xhtml?"/>":">",se},Z.text=function(Y){return Y},V}(),Ae=function(){function V(){}var Z=V.prototype;return Z.strong=function(Y){return Y},Z.em=function(Y){return Y},Z.codespan=function(Y){return Y},Z.del=function(Y){return Y},Z.html=function(Y){return Y},Z.text=function(Y){return Y},Z.link=function(Y,J,ne){return""+ne},Z.image=function(Y,J,ne){return""+ne},Z.br=function(){return""},V}(),Me=function(){function V(){this.seen={}}var Z=V.prototype;return Z.slug=function(Y){var J=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(J)){var ne=J;do this.seen[ne]++,J=ne+"-"+this.seen[ne];while(this.seen.hasOwnProperty(J))}return this.seen[J]=0,J},V}(),Be=H.defaults,He=D.unescape,Fe=function(){function V(ie){this.options=ie||Be,this.options.renderer=this.options.renderer||new Ee,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ae,this.slugger=new Me}V.parse=function(Y,J){var ne=new V(J);return ne.parse(Y)};var Z=V.prototype;return Z.parse=function(Y,J){J===void 0&&(J=!0);var ne="",se,Te,_e,De,We,$e,Xe,_t,at,Qe,kt,St,Bt,jt,lt,Kt,Zt,Gt,ai=Y.length;for(se=0;se<ai;se++){Qe=Y[se];switch(Qe.type){case"space":continue;case"hr":{ne+=this.renderer.hr();continue}case"heading":{ne+=this.renderer.heading(this.parseInline(Qe.tokens),Qe.depth,He(this.parseInline(Qe.tokens,this.textRenderer)),this.slugger);continue}case"code":{ne+=this.renderer.code(Qe.text,Qe.lang,Qe.escaped);continue}case"table":{for(_t="",Xe="",De=Qe.header.length,Te=0;Te<De;Te++)Xe+=this.renderer.tablecell(this.parseInline(Qe.tokens.header[Te]),{header:!0,align:Qe.align[Te]});for(_t+=this.renderer.tablerow(Xe),at="",De=Qe.cells.length,Te=0;Te<De;Te++){for($e=Qe.tokens.cells[Te],Xe="",We=$e.length,_e=0;_e<We;_e++)Xe+=this.renderer.tablecell(this.parseInline($e[_e]),{header:!1,align:Qe.align[_e]});at+=this.renderer.tablerow(Xe)}ne+=this.renderer.table(_t,at);continue}case"blockquote":{at=this.parse(Qe.tokens),ne+=this.renderer.blockquote(at);continue}case"list":{for(kt=Qe.ordered,St=Qe.start,Bt=Qe.loose,De=Qe.items.length,at="",Te=0;Te<De;Te++)lt=Qe.items[Te],Kt=lt.checked,Zt=lt.task,jt="",lt.task&&(Gt=this.renderer.checkbox(Kt),Bt?lt.tokens.length>0&<.tokens[0].type==="text"?(lt.tokens[0].text=Gt+" "+lt.tokens[0].text,lt.tokens[0].tokens&<.tokens[0].tokens.length>0&<.tokens[0].tokens[0].type==="text"&&(lt.tokens[0].tokens[0].text=Gt+" "+lt.tokens[0].tokens[0].text)):lt.tokens.unshift({type:"text",text:Gt}):jt+=Gt),jt+=this.parse(lt.tokens,Bt),at+=this.renderer.listitem(jt,Zt,Kt);ne+=this.renderer.list(at,kt,St);continue}case"html":{ne+=this.renderer.html(Qe.text);continue}case"paragraph":{ne+=this.renderer.paragraph(this.parseInline(Qe.tokens));continue}case"text":{for(at=Qe.tokens?this.parseInline(Qe.tokens):Qe.text;se+1<ai&&Y[se+1].type==="text";)Qe=Y[++se],at+=`
|
|
`+(Qe.tokens?this.parseInline(Qe.tokens):Qe.text);ne+=J?this.renderer.paragraph(at):at;continue}default:{var it='Token with "'+Qe.type+'" type was not found.';if(this.options.silent){console.error(it);return}else throw new Error(it)}}}return ne},Z.parseInline=function(Y,J){J=J||this.renderer;var ne="",se,Te,_e=Y.length;for(se=0;se<_e;se++){Te=Y[se];switch(Te.type){case"escape":{ne+=J.text(Te.text);break}case"html":{ne+=J.html(Te.text);break}case"link":{ne+=J.link(Te.href,Te.title,this.parseInline(Te.tokens,J));break}case"image":{ne+=J.image(Te.href,Te.title,Te.text);break}case"strong":{ne+=J.strong(this.parseInline(Te.tokens,J));break}case"em":{ne+=J.em(this.parseInline(Te.tokens,J));break}case"codespan":{ne+=J.codespan(Te.text);break}case"br":{ne+=J.br();break}case"del":{ne+=J.del(this.parseInline(Te.tokens,J));break}case"text":{ne+=J.text(Te.text);break}default:{var De='Token with "'+Te.type+'" type was not found.';if(this.options.silent){console.error(De);return}else throw new Error(De)}}}return ne},V}(),Ve=D.merge,Ke=D.checkSanitizeDeprecation,Ge=D.escape,Ue=H.getDefaults,qe=H.changeDefaults,et=H.defaults;function q(V,Z,ie){if(typeof V=="undefined"||V===null)throw new Error("marked(): input parameter is undefined or null");if(typeof V!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(V)+", string expected");if(typeof Z=="function"&&(ie=Z,Z=null),Z=Ve({},q.defaults,Z||{}),Ke(Z),ie){var Y=Z.highlight,J;try{J=we.lex(V,Z)}catch(_e){return ie(_e)}var ne=function(De){var We;if(!De)try{We=Fe.parse(J,Z)}catch($e){De=$e}return Z.highlight=Y,De?ie(De):ie(null,We)};if(!Y||Y.length<3)return ne();if(delete Z.highlight,!J.length)return ne();var se=0;q.walkTokens(J,function(_e){_e.type==="code"&&(se++,setTimeout(function(){Y(_e.text,_e.lang,function(De,We){if(De)return ne(De);We!=null&&We!==_e.text&&(_e.text=We,_e.escaped=!0),se--,se===0&&ne()})},0))}),se===0&&ne();return}try{var Te=we.lex(V,Z);return Z.walkTokens&&q.walkTokens(Te,Z.walkTokens),Fe.parse(Te,Z)}catch(_e){if(_e.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,Z.silent)return"<p>An error occurred:</p><pre>"+Ge(_e.message+"",!0)+"</pre>";throw _e}}q.options=q.setOptions=function(V){return Ve(q.defaults,V),qe(q.defaults),q},q.getDefaults=Ue,q.defaults=et,q.use=function(V){var Z=Ve({},V);if(V.renderer&&function(){var Y=q.defaults.renderer||new Ee,J=function(Te){var _e=Y[Te];Y[Te]=function(){for(var De=arguments.length,We=new Array(De),$e=0;$e<De;$e++)We[$e]=arguments[$e];var Xe=V.renderer[Te].apply(Y,We);return Xe===!1&&(Xe=_e.apply(Y,We)),Xe}};for(var ne in V.renderer)J(ne);Z.renderer=Y}(),V.tokenizer&&function(){var Y=q.defaults.tokenizer||new Se,J=function(Te){var _e=Y[Te];Y[Te]=function(){for(var De=arguments.length,We=new Array(De),$e=0;$e<De;$e++)We[$e]=arguments[$e];var Xe=V.tokenizer[Te].apply(Y,We);return Xe===!1&&(Xe=_e.apply(Y,We)),Xe}};for(var ne in V.tokenizer)J(ne);Z.tokenizer=Y}(),V.walkTokens){var ie=q.defaults.walkTokens;Z.walkTokens=function(Y){V.walkTokens(Y),ie&&ie(Y)}}q.setOptions(Z)},q.walkTokens=function(V,Z){for(var ie=w(V),Y;!(Y=ie()).done;){var J=Y.value;Z(J);switch(J.type){case"table":{for(var ne=w(J.tokens.header),se;!(se=ne()).done;){var Te=se.value;q.walkTokens(Te,Z)}for(var _e=w(J.tokens.cells),De;!(De=_e()).done;)for(var We=De.value,$e=w(We),Xe;!(Xe=$e()).done;){var _t=Xe.value;q.walkTokens(_t,Z)}break}case"list":{q.walkTokens(J.items,Z);break}default:J.tokens&&q.walkTokens(J.tokens,Z)}}},q.Parser=Fe,q.parser=Fe.parse,q.Renderer=Ee,q.TextRenderer=Ae,q.Lexer=we,q.lexer=we.lex,q.Tokenizer=Se,q.Slugger=Me,q.parse=q;var K=q;return K})},FOrL:function(Ye,ye,$){Ye.exports=$.p+"static/nodata.a6b3f948.png"},FWmy:function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return ae});function ae(B,O){if(!B)throw new Error(O?`Assertion failed (${O})`:"Assertion Failed")}},INg4:function(Ye,ye,$){Ye.exports={flex_box_center:"flex_box_center___2rJad",flex_space_between:"flex_space_between___3xFPg",flex_box_vertical_center:"flex_box_vertical_center___3_RIS",flex_box_center_end:"flex_box_center_end___h0Di5",flex_box_column:"flex_box_column___Q5LEA",right:"right___1Gnba",title:"title___2HvSR",titles:"titles___2UU6k",tips:"tips___1iWOB"}},JYp7:function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return ae});var ae;(function(B){function O(t){return t&&typeof t=="object"&&typeof t[Symbol.iterator]=="function"}B.is=O;const k=Object.freeze([]);function w(){return k}B.empty=w;function*R(t){yield t}B.single=R;function H(t){return t||k}B.from=H;function U(t){return!t||t[Symbol.iterator]().next().done===!0}B.isEmpty=U;function e(t){return t[Symbol.iterator]().next().value}B.first=e;function S(t,v){for(const f of t)if(v(f))return!0;return!1}B.some=S;function d(t,v){for(const f of t)if(v(f))return f;return}B.find=d;function*h(t,v){for(const f of t)v(f)&&(yield f)}B.filter=h;function*o(t,v){let f=0;for(const p of t)yield v(p,f++)}B.map=o;function*a(...t){for(const v of t)for(const f of v)yield f}B.concat=a;function*r(t){for(const v of t)for(const f of v)yield f}B.concatNested=r;function l(t,v,f){let p=f;for(const E of t)p=v(p,E);return p}B.reduce=l;function*s(t,v,f=t.length){for(v<0&&(v+=t.length),f<0?f+=t.length:f>t.length&&(f=t.length);v<f;v++)yield t[v]}B.slice=s;function n(t,v=Number.POSITIVE_INFINITY){const f=[];if(v===0)return[f,t];const p=t[Symbol.iterator]();for(let E=0;E<v;E++){const b=p.next();if(b.done)return[f,B.empty()];f.push(b.value)}return[f,{[Symbol.iterator](){return p}}]}B.consume=n;function i(t,v,f=(p,E)=>p===E){const p=t[Symbol.iterator](),E=v[Symbol.iterator]();for(;;){const b=p.next(),g=E.next();if(b.done!==g.done)return!1;if(b.done)return!0;if(!f(b.value,g.value))return!1}}B.equals=i})(ae||(ae={}))},MI8n:function(Ye,ye,$){"use strict";$.d(ye,"c",function(){return w}),$.d(ye,"b",function(){return e}),$.d(ye,"e",function(){return S}),$.d(ye,"a",function(){return d}),$.d(ye,"d",function(){return h}),$.d(ye,"f",function(){return o});var ae=$("/cxE"),B=$("pmY6"),O=$("24hK"),k=$("5Y4S"),w;(function(a){a.None=()=>B.a.None;function r(T){return(M,L=null,x)=>{let D=!1,j;return j=T(I=>D?void 0:(j?j.dispose():D=!0,M.call(L,I)),null,x),D&&j.dispose(),j}}a.once=r;function l(T,M){return f((L,x=null,D)=>T(j=>L.call(x,M(j)),null,D))}a.map=l;function s(T,M){return f((L,x=null,D)=>T(j=>{M(j),L.call(x,j)},null,D))}a.forEach=s;function n(T,M){return f((L,x=null,D)=>T(j=>M(j)&&L.call(x,j),null,D))}a.filter=n;function i(T){return T}a.signal=i;function t(...T){return(M,L=null,x)=>Object(B.e)(...T.map(D=>D(j=>M.call(L,j),null,x)))}a.any=t;function v(T,M,L){let x=L;return l(T,D=>(x=M(x,D),x))}a.reduce=v;function f(T){let M;const L=new e({onFirstListenerAdd(){M=T(L.fire,L)},onLastListenerRemove(){M.dispose()}});return L.event}function p(T,M,L=100,x=!1,D){let j,I,W,Q=0;const fe=new e({leakWarningThreshold:D,onFirstListenerAdd(){j=T(de=>{Q++,I=M(I,de),x&&!W&&(fe.fire(I),I=void 0),clearTimeout(W),W=setTimeout(()=>{const Oe=I;I=void 0,W=void 0,(!x||Q>1)&&fe.fire(Oe),Q=0},L)})},onLastListenerRemove(){j.dispose()}});return fe.event}a.debounce=p;function E(T,M=(L,x)=>L===x){let L=!0,x;return n(T,D=>{const j=L||!M(D,x);return L=!1,x=D,j})}a.latch=E;function b(T,M){return[a.filter(T,M),a.filter(T,L=>!M(L))]}a.split=b;function g(T,M=!1,L=[]){let x=L.slice(),D=T(W=>{x?x.push(W):I.fire(W)});const j=()=>{x&&x.forEach(W=>I.fire(W)),x=null},I=new e({onFirstListenerAdd(){D||(D=T(W=>I.fire(W)))},onFirstListenerDidAdd(){x&&(M?setTimeout(j):j())},onLastListenerRemove(){D&&D.dispose(),D=null}});return I.event}a.buffer=g;class c{constructor(T){this.event=T}map(T){return new c(l(this.event,T))}forEach(T){return new c(s(this.event,T))}filter(T){return new c(n(this.event,T))}reduce(T,M){return new c(v(this.event,T,M))}latch(){return new c(E(this.event))}debounce(T,M=100,L=!1,x){return new c(p(this.event,T,M,L,x))}on(T,M,L){return this.event(T,M,L)}once(T,M,L){return r(this.event)(T,M,L)}}function m(T){return new c(T)}a.chain=m;function u(T,M,L=x=>x){const x=(...W)=>I.fire(L(...W)),D=()=>T.on(M,x),j=()=>T.removeListener(M,x),I=new e({onFirstListenerAdd:D,onLastListenerRemove:j});return I.event}a.fromNodeEventEmitter=u;function _(T,M,L=x=>x){const x=(...W)=>I.fire(L(...W)),D=()=>T.addEventListener(M,x),j=()=>T.removeEventListener(M,x),I=new e({onFirstListenerAdd:D,onLastListenerRemove:j});return I.event}a.fromDOMEventEmitter=_;function y(T){return new Promise(M=>r(T)(M))}a.toPromise=y})(w||(w={}));class R{constructor(a){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${a}_${R._idPool++}`}start(a){this._stopWatch=new k.a(!0),this._listenerCount=a}stop(){if(this._stopWatch){const a=this._stopWatch.elapsed();this._elapsedOverall+=a,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${a.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}R._idPool=0;let H=-1;class U{constructor(a,r=Math.random().toString(18).slice(2,5)){this.customThreshold=a,this.name=r,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(a){let r=H;if(typeof this.customThreshold=="number"&&(r=this.customThreshold),r<=0||a<r)return;this._stacks||(this._stacks=new Map);const l=new Error().stack.split(`
|
|
`).slice(3).join(`
|
|
`),s=this._stacks.get(l)||0;if(this._stacks.set(l,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let n,i=0;for(const[t,v]of this._stacks)(!n||i<v)&&(n=t,i=v);console.warn(`[${this.name}] potential listener LEAK detected, having ${a} listeners already. MOST frequent listener (${i}):`),console.warn(n)}return()=>{const n=this._stacks.get(l)||0;this._stacks.set(l,n-1)}}}class e{constructor(a){var r;this._disposed=!1,this._options=a,this._leakageMon=H>0?new U(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=((r=this._options)===null||r===void 0?void 0:r._profName)?new R(this._options._profName):void 0}get event(){return this._event||(this._event=(a,r,l)=>{var s;this._listeners||(this._listeners=new O.a);const n=this._listeners.isEmpty();n&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const i=this._listeners.push(r?[a,r]:a);n&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,a,r);const t=(s=this._leakageMon)===null||s===void 0?void 0:s.check(this._listeners.size),v=Object(B.i)(()=>{if(t&&t(),!this._disposed&&(i(),this._options&&this._options.onLastListenerRemove)){const f=this._listeners&&!this._listeners.isEmpty();f||this._options.onLastListenerRemove(this)}});return l instanceof B.b?l.add(v):Array.isArray(l)&&l.push(v),v}),this._event}fire(a){var r,l;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new O.a);for(let s of this._listeners)this._deliveryQueue.push([s,a]);for((r=this._perfMon)===null||r===void 0||r.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[s,n]=this._deliveryQueue.shift();try{typeof s=="function"?s.call(void 0,n):s[0].call(s[1],n)}catch(i){Object(ae.f)(i)}}(l=this._perfMon)===null||l===void 0||l.stop()}}dispose(){var a,r,l,s,n;this._disposed||(this._disposed=!0,(a=this._listeners)===null||a===void 0||a.clear(),(r=this._deliveryQueue)===null||r===void 0||r.clear(),(s=(l=this._options)===null||l===void 0?void 0:l.onLastListenerRemove)===null||s===void 0||s.call(l),(n=this._leakageMon)===null||n===void 0||n.dispose())}}class S extends e{constructor(a){super(a);this._isPaused=0,this._eventQueue=new O.a,this._mergeFn=a==null?void 0:a.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const a=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(a))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(a){this._listeners&&(this._isPaused!==0?this._eventQueue.push(a):super.fire(a))}}class d extends S{constructor(a){var r;super(a);this._delay=(r=a.delay)!==null&&r!==void 0?r:100}fire(a){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(a)}}class h{constructor(){this.buffers=[]}wrapEvent(a){return(r,l,s)=>a(n=>{const i=this.buffers[this.buffers.length-1];i?i.push(()=>r.call(l,n)):r.call(l,n)},void 0,s)}bufferEvents(a){const r=[];this.buffers.push(r);const l=a();return this.buffers.pop(),r.forEach(s=>s()),l}}class o{constructor(){this.listening=!1,this.inputEvent=w.None,this.inputEventListener=B.a.None,this.emitter=new e({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(a){this.inputEvent=a,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=a(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},MNsG:function(Ye,ye,$){"use strict";(function(ae,B){$.d(ye,"b",function(){return l}),$.d(ye,"i",function(){return t}),$.d(ye,"f",function(){return v}),$.d(ye,"d",function(){return f}),$.d(ye,"g",function(){return p}),$.d(ye,"h",function(){return E}),$.d(ye,"c",function(){return b}),$.d(ye,"k",function(){return g}),$.d(ye,"j",function(){return c}),$.d(ye,"a",function(){return m}),$.d(ye,"e",function(){return y});var O;const k="en";let w=!1,R=!1,H=!1,U=!1,e=!1,S=!1,d=!1,h,o=k,a,r;const l=typeof self=="object"?self:typeof ae=="object"?ae:{};let s;typeof l.vscode!="undefined"&&typeof l.vscode.process!="undefined"?s=l.vscode.process:typeof B!="undefined"&&(s=B);const n=typeof((O=s==null?void 0:s.versions)===null||O===void 0?void 0:O.electron)=="string"&&s.type==="renderer";if(typeof navigator=="object"&&!n)r=navigator.userAgent,w=r.indexOf("Windows")>=0,R=r.indexOf("Macintosh")>=0,d=(r.indexOf("Macintosh")>=0||r.indexOf("iPad")>=0||r.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,H=r.indexOf("Linux")>=0,S=!0,h=navigator.language,o=h;else if(typeof s=="object"){w=s.platform==="win32",R=s.platform==="darwin",H=s.platform==="linux",U=H&&!!s.env.SNAP&&!!s.env.SNAP_REVISION,h=k,o=k;const T=s.env.VSCODE_NLS_CONFIG;if(T)try{const M=JSON.parse(T),L=M.availableLanguages["*"];h=M.locale,o=L||k,a=M._translationsConfigFile}catch(M){}e=!0}else console.error("Unable to resolve platform.");let i=0;R?i=1:w?i=3:H&&(i=2);const t=w,v=R,f=H,p=e,E=S,b=d,g=r,c=function(){if(l.setImmediate)return l.setImmediate.bind(l);if(typeof l.postMessage=="function"&&!l.importScripts){let L=[];l.addEventListener("message",D=>{if(D.data&&D.data.vscodeSetImmediateId)for(let j=0,I=L.length;j<I;j++){const W=L[j];if(W.id===D.data.vscodeSetImmediateId){L.splice(j,1),W.callback();return}}});let x=0;return D=>{const j=++x;L.push({id:j,callback:D}),l.postMessage({vscodeSetImmediateId:j},"*")}}if(typeof(s==null?void 0:s.nextTick)=="function")return s.nextTick.bind(s);const M=Promise.resolve();return L=>M.then(L)}(),m=R||d?2:w?1:3;let u=!0,_=!1;function y(){if(!_){_=!0;const T=new Uint8Array(2);T[0]=1,T[1]=2;const M=new Uint16Array(T.buffer);u=M[0]===(2<<8)+1}return u}}).call(this,$("IyRk"),$("Q2Ig"))},N0LK:function(Ye,ye,$){"use strict";$.d(ye,"C",function(){return ae}),$.d(ye,"v",function(){return O}),$.d(ye,"s",function(){return k}),$.d(ye,"t",function(){return w}),$.d(ye,"U",function(){return R}),$.d(ye,"J",function(){return H}),$.d(ye,"O",function(){return U}),$.d(ye,"p",function(){return e}),$.d(ye,"T",function(){return S}),$.d(ye,"q",function(){return d}),$.d(ye,"N",function(){return h}),$.d(ye,"M",function(){return o}),$.d(ye,"Q",function(){return a}),$.d(ye,"u",function(){return r}),$.d(ye,"x",function(){return l}),$.d(ye,"I",function(){return s}),$.d(ye,"f",function(){return n}),$.d(ye,"h",function(){return i}),$.d(ye,"g",function(){return t}),$.d(ye,"i",function(){return v}),$.d(ye,"G",function(){return f}),$.d(ye,"H",function(){return p}),$.d(ye,"r",function(){return E}),$.d(ye,"R",function(){return b}),$.d(ye,"d",function(){return g}),$.d(ye,"e",function(){return c}),$.d(ye,"E",function(){return m}),$.d(ye,"F",function(){return u}),$.d(ye,"j",function(){return _}),$.d(ye,"z",function(){return y}),$.d(ye,"K",function(){return M}),$.d(ye,"L",function(){return L}),$.d(ye,"m",function(){return D}),$.d(ye,"k",function(){return I}),$.d(ye,"A",function(){return Q}),$.d(ye,"a",function(){return fe}),$.d(ye,"n",function(){return de}),$.d(ye,"l",function(){return Oe}),$.d(ye,"D",function(){return Se}),$.d(ye,"B",function(){return Ie}),$.d(ye,"b",function(){return Le}),$.d(ye,"S",function(){return Ne}),$.d(ye,"o",function(){return be}),$.d(ye,"P",function(){return N}),$.d(ye,"w",function(){return A}),$.d(ye,"c",function(){return C}),$.d(ye,"y",function(){return P});function ae(ee){return!ee||typeof ee!="string"?!0:ee.trim().length===0}const B=/{(\d+)}/g;function O(ee,...ce){return ce.length===0?ee:ee.replace(B,function(Ee,Ae){const Me=parseInt(Ae,10);return isNaN(Me)||Me<0||Me>=ce.length?Ee:ce[Me]})}function k(ee){return ee.replace(/[<>&]/g,function(ce){switch(ce){case"<":return"<";case">":return">";case"&":return"&";default:return ce}})}function w(ee){return ee.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function R(ee,ce=" "){const Ee=H(ee,ce);return U(Ee,ce)}function H(ee,ce){if(!ee||!ce)return ee;const Ee=ce.length;if(Ee===0||ee.length===0)return ee;let Ae=0;for(;ee.indexOf(ce,Ae)===Ae;)Ae=Ae+Ee;return ee.substring(Ae)}function U(ee,ce){if(!ee||!ce)return ee;const Ee=ce.length,Ae=ee.length;if(Ee===0||Ae===0)return ee;let Me=Ae,Be=-1;for(;!(Be=ee.lastIndexOf(ce,Me-1),Be===-1||Be+Ee!==Me);){if(Be===0)return"";Me=Be}return ee.substring(0,Me)}function e(ee){return ee.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function S(ee){return ee.replace(/\*/g,"")}function d(ee,ce,Ee={}){if(!ee)throw new Error("Cannot create regex from empty string");ce||(ee=w(ee)),Ee.wholeWord&&(/\B/.test(ee.charAt(0))||(ee="\\b"+ee),/\B/.test(ee.charAt(ee.length-1))||(ee=ee+"\\b"));let Ae="";return Ee.global&&(Ae+="g"),Ee.matchCase||(Ae+="i"),Ee.multiline&&(Ae+="m"),Ee.unicode&&(Ae+="u"),new RegExp(ee,Ae)}function h(ee){if(ee.source==="^"||ee.source==="^$"||ee.source==="$"||ee.source==="^\\s*$")return!1;const ce=ee.exec("");return!!(ce&&ee.lastIndex===0)}function o(ee){return(ee.global?"g":"")+(ee.ignoreCase?"i":"")+(ee.multiline?"m":"")+(ee.unicode?"u":"")}function a(ee){return ee.split(/\r\n|\r|\n/)}function r(ee){for(let ce=0,Ee=ee.length;ce<Ee;ce++){const Ae=ee.charCodeAt(ce);if(Ae!==32&&Ae!==9)return ce}return-1}function l(ee,ce=0,Ee=ee.length){for(let Ae=ce;Ae<Ee;Ae++){const Me=ee.charCodeAt(Ae);if(Me!==32&&Me!==9)return ee.substring(ce,Ae)}return ee.substring(ce,Ee)}function s(ee,ce=ee.length-1){for(let Ee=ce;Ee>=0;Ee--){const Ae=ee.charCodeAt(Ee);if(Ae!==32&&Ae!==9)return Ee}return-1}function n(ee,ce){return ee<ce?-1:ee>ce?1:0}function i(ee,ce,Ee=0,Ae=ee.length,Me=0,Be=ce.length){for(;Ee<Ae&&Me<Be;Ee++,Me++){let Ve=ee.charCodeAt(Ee),Ke=ce.charCodeAt(Me);if(Ve<Ke)return-1;if(Ve>Ke)return 1}const He=Ae-Ee,Fe=Be-Me;return He<Fe?-1:He>Fe?1:0}function t(ee,ce){return v(ee,ce,0,ee.length,0,ce.length)}function v(ee,ce,Ee=0,Ae=ee.length,Me=0,Be=ce.length){for(;Ee<Ae&&Me<Be;Ee++,Me++){let Ve=ee.charCodeAt(Ee),Ke=ce.charCodeAt(Me);if(Ve===Ke)continue;if(Ve>=128||Ke>=128)return i(ee.toLowerCase(),ce.toLowerCase(),Ee,Ae,Me,Be);f(Ve)&&(Ve-=32),f(Ke)&&(Ke-=32);const Ge=Ve-Ke;if(Ge===0)continue;return Ge}const He=Ae-Ee,Fe=Be-Me;return He<Fe?-1:He>Fe?1:0}function f(ee){return ee>=97&&ee<=122}function p(ee){return ee>=65&&ee<=90}function E(ee,ce){return ee.length===ce.length&&v(ee,ce)===0}function b(ee,ce){const Ee=ce.length;return ce.length>ee.length?!1:v(ee,ce,0,Ee)===0}function g(ee,ce){let Ee,Ae=Math.min(ee.length,ce.length);for(Ee=0;Ee<Ae;Ee++)if(ee.charCodeAt(Ee)!==ce.charCodeAt(Ee))return Ee;return Ae}function c(ee,ce){let Ee,Ae=Math.min(ee.length,ce.length);const Me=ee.length-1,Be=ce.length-1;for(Ee=0;Ee<Ae;Ee++)if(ee.charCodeAt(Me-Ee)!==ce.charCodeAt(Be-Ee))return Ee;return Ae}function m(ee){return 55296<=ee&&ee<=56319}function u(ee){return 56320<=ee&&ee<=57343}function _(ee,ce){return(ee-55296<<10)+(ce-56320)+65536}function y(ee,ce,Ee){const Ae=ee.charCodeAt(Ee);if(m(Ae)&&Ee+1<ce){const Me=ee.charCodeAt(Ee+1);if(u(Me))return _(Ae,Me)}return Ae}function T(ee,ce){const Ee=ee.charCodeAt(ce-1);if(u(Ee)&&ce>1){const Ae=ee.charCodeAt(ce-2);if(m(Ae))return _(Ae,Ee)}return Ee}function M(ee,ce){const Ee=F.getInstance(),Ae=ce,Me=ee.length,Be=y(ee,Me,ce);ce+=Be>=65536?2:1;let He=Ee.getGraphemeBreakType(Be);for(;ce<Me;){const Fe=y(ee,Me,ce),Ve=Ee.getGraphemeBreakType(Fe);if(C(He,Ve))break;ce+=Fe>=65536?2:1,He=Ve}return ce-Ae}function L(ee,ce){const Ee=F.getInstance(),Ae=ce,Me=T(ee,ce);ce-=Me>=65536?2:1;let Be=Ee.getGraphemeBreakType(Me);for(;ce>0;){const He=T(ee,ce),Fe=Ee.getGraphemeBreakType(He);if(C(Fe,Be))break;ce-=He>=65536?2:1,Be=Fe}return Ae-ce}const x=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function D(ee){return x.test(ee)}const j=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;function I(ee){return j.test(ee)}const W=/^[\t\n\r\x20-\x7E]*$/;function Q(ee){return W.test(ee)}const fe=/[\u2028\u2029]/;function de(ee){return fe.test(ee)}function Oe(ee){for(let ce=0,Ee=ee.length;ce<Ee;ce++)if(Se(ee.charCodeAt(ce)))return!0;return!1}function Se(ee){return ee=+ee,ee>=11904&&ee<=55215||ee>=63744&&ee<=64255||ee>=65281&&ee<=65374}function Ie(ee){return ee>=127462&&ee<=127487||ee===8986||ee===8987||ee===9200||ee===9203||ee>=9728&&ee<=10175||ee===11088||ee===11093||ee>=127744&&ee<=128591||ee>=128640&&ee<=128764||ee>=128992&&ee<=129003||ee>=129280&&ee<=129535||ee>=129648&&ee<=129750}const Le=String.fromCharCode(65279);function Ne(ee){return!!(ee&&ee.length>0&&ee.charCodeAt(0)===65279)}function be(ee,ce=!1){return ee?(ce&&(ee=ee.replace(/\\./g,"")),ee.toLowerCase()!==ee):!1}function N(ee){const ce=90-65+1;return ee=ee%(2*ce),ee<ce?String.fromCharCode(97+ee):String.fromCharCode(65+ee-ce)}function A(ee){const ce=F.getInstance();return ce.getGraphemeBreakType(ee)}function C(ee,ce){return ee===0?ce!==5&&ce!==7:ee===2&&ce===3?!1:ee===4||ee===2||ee===3||(ce===4||ce===2||ce===3)?!0:ee===8&&(ce===8||ce===9||ce===11||ce===12)||((ee===11||ee===9)&&(ce===9||ce===10)||((ee===12||ee===10)&&ce===10||(ce===5||ce===13||(ce===7||(ee===1||ee===13&&ce===14)))))?!1:!(ee===6&&ce===6)}class F{constructor(){this._data=G()}static getInstance(){return F._INSTANCE||(F._INSTANCE=new F),F._INSTANCE}getGraphemeBreakType(ee){if(ee<32)return ee===10?3:ee===13?2:4;if(ee<127)return 0;const ce=this._data,Ee=ce.length/3;let Ae=1;for(;Ae<=Ee;)if(ee<ce[3*Ae])Ae=2*Ae;else if(ee>ce[3*Ae+1])Ae=2*Ae+1;else return ce[3*Ae+2];return 0}}F._INSTANCE=null;function G(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}function P(ee,ce){if(ee===0)return 0;const Ee=oe(ee,ce);if(Ee!==void 0)return Ee;const Ae=T(ce,ee);return ee-=we(Ae),ee}function oe(ee,ce){let Ee=T(ce,ee);for(ee-=we(Ee);Re(Ee)||Ee===65039||Ee===8419;){if(ee===0)return;Ee=T(ce,ee),ee-=we(Ee)}if(!Ie(Ee))return;if(ee>=0){const Ae=T(ce,ee);Ae===8205&&(ee-=we(Ae))}return ee}function we(ee){return ee>=65536?2:1}function Re(ee){return 127995<=ee&&ee<=127999}},SJMd:function(Ye,ye){/**
|
|
* @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 $,ae,B,O=!1,k,w;window.PR_SHOULD_USE_CONTINUATION=!0;var R,H;(function(){var U=window,e=["break,continue,do,else,for,if,return,while"],S=[e,"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"],d=[S,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],h=[d,"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=[d,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],a=[d,"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"],r="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=[d,"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",n=[e,"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"],i=[e,"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"],t=[e,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],v=[h,a,o,l,s,n,i,t],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",E="kwd",b="com",g="typ",c="lit",m="pun",u="pln",_="tag",y="dec",T="src",M="atn",L="atv",x="nocode",D="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function j(oe){for(var we=0,Re=!1,ee=!1,ce=0,Ee=oe.length;ce<Ee;++ce){var Ae=oe[ce];if(Ae.ignoreCase)ee=!0;else if(/[a-z]/i.test(Ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,ee=!1;break}}var Me={b:8,t:9,n:10,v:11,f:12,r:13};function Be(Ge){var Ue=Ge.charCodeAt(0);if(Ue!==92)return Ue;var qe=Ge.charAt(1);return Ue=Me[qe],Ue||("0"<=qe&&qe<="7"?parseInt(Ge.substring(1),8):qe==="u"||qe==="x"?parseInt(Ge.substring(2),16):Ge.charCodeAt(1))}function He(Ge){if(Ge<32)return(Ge<16?"\\x0":"\\x")+Ge.toString(16);var Ue=String.fromCharCode(Ge);return Ue==="\\"||Ue==="-"||Ue==="]"||Ue==="^"?"\\"+Ue:Ue}function Fe(Ge){var Ue=Ge.substring(1,Ge.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),qe=[],et=Ue[0]==="^",q=["["];et&&q.push("^");for(var K=et?1:0,V=Ue.length;K<V;++K){var Z=Ue[K];if(/\\[bdsw]/i.test(Z))q.push(Z);else{var ie=Be(Z),Y;K+2<V&&Ue[K+1]==="-"?(Y=Be(Ue[K+2]),K+=2):Y=ie,qe.push([ie,Y]),Y<65||ie>122||(Y<65||ie>90||qe.push([Math.max(65,ie)|32,Math.min(Y,90)|32]),Y<97||ie>122||qe.push([Math.max(97,ie)&~32,Math.min(Y,122)&~32]))}}qe.sort(function(Te,_e){return Te[0]-_e[0]||_e[1]-Te[1]});for(var J=[],ne=[],K=0;K<qe.length;++K){var se=qe[K];se[0]<=ne[1]+1?ne[1]=Math.max(ne[1],se[1]):J.push(ne=se)}for(var K=0;K<J.length;++K){var se=J[K];q.push(He(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&q.push("-"),q.push(He(se[1])))}return q.push("]"),q.join("")}function Ve(Ge){for(var Ue=Ge.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),qe=Ue.length,et=[],q=0,K=0;q<qe;++q){var V=Ue[q];if(V==="(")++K;else if(V.charAt(0)==="\\"){var Z=+V.substring(1);Z&&(Z<=K?et[Z]=-1:Ue[q]=He(Z))}}for(var q=1;q<et.length;++q)et[q]===-1&&(et[q]=++we);for(var q=0,K=0;q<qe;++q){var V=Ue[q];if(V==="(")++K,et[K]||(Ue[q]="(?:");else if(V.charAt(0)==="\\"){var Z=+V.substring(1);Z&&Z<=K&&(Ue[q]="\\"+et[Z])}}for(var q=0;q<qe;++q)Ue[q]==="^"&&Ue[q+1]!=="^"&&(Ue[q]="");if(Ge.ignoreCase&&Re)for(var q=0;q<qe;++q){var V=Ue[q],ie=V.charAt(0);V.length>=2&&ie==="["?Ue[q]=Fe(V):ie!=="\\"&&(Ue[q]=V.replace(/[a-zA-Z]/g,function(ne){var se=ne.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return Ue.join("")}for(var Ke=[],ce=0,Ee=oe.length;ce<Ee;++ce){var Ae=oe[ce];if(Ae.global||Ae.multiline)throw new Error(""+Ae);Ke.push("(?:"+Ve(Ae)+")")}return new RegExp(Ke.join("|"),ee?"gi":"g")}function I(oe,we){var Re=/(?:^|\s)nocode(?:\s|$)/,ee=[],ce=0,Ee=[],Ae=0;function Me(Be){var He=Be.nodeType;if(He==1){if(Re.test(Be.className))return;for(var Fe=Be.firstChild;Fe;Fe=Fe.nextSibling)Me(Fe);var Ve=Be.nodeName.toLowerCase();(Ve==="br"||Ve==="li")&&(ee[Ae]=`
|
|
`,Ee[Ae<<1]=ce++,Ee[Ae++<<1|1]=Be)}else if(He==3||He==4){var Ke=Be.nodeValue;Ke.length&&(we?Ke=Ke.replace(/\r\n?/g,`
|
|
`):Ke=Ke.replace(/[ \t\r\n]+/g," "),ee[Ae]=Ke,Ee[Ae<<1]=ce,ce+=Ke.length,Ee[Ae++<<1|1]=Be)}}return Me(oe),{sourceCode:ee.join("").replace(/\n$/,""),spans:Ee}}function W(oe,we,Re,ee,ce){if(!Re)return;var Ee={sourceNode:oe,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:we,decorations:null};ee(Ee),ce.push.apply(ce,Ee.decorations)}var Q=/\S/;function fe(oe){for(var we=void 0,Re=oe.firstChild;Re;Re=Re.nextSibling){var ee=Re.nodeType;we=ee===1?we?oe:Re:ee===3&&Q.test(Re.nodeValue)?oe:we}return we===oe?void 0:we}function de(oe,we){var Re={},ee;(function(){for(var Ae=oe.concat(we),Me=[],Be={},He=0,Fe=Ae.length;He<Fe;++He){var Ve=Ae[He],Ke=Ve[3];if(Ke)for(var Ge=Ke.length;--Ge>=0;)Re[Ke.charAt(Ge)]=Ve;var Ue=Ve[1],qe=""+Ue;Be.hasOwnProperty(qe)||(Me.push(Ue),Be[qe]=null)}Me.push(/[\0-\uffff]/),ee=j(Me)})();var ce=we.length,Ee=function(Ae){for(var Me=Ae.sourceCode,Be=Ae.basePos,He=Ae.sourceNode,Fe=[Be,u],Ve=0,Ke=Me.match(ee)||[],Ge={},Ue=0,qe=Ke.length;Ue<qe;++Ue){var et=Ke[Ue],q=Ge[et],K=void 0,V;if(typeof q=="string")V=!1;else{var Z=Re[et.charAt(0)];if(Z)K=et.match(Z[1]),q=Z[0];else{for(var ie=0;ie<ce;++ie)if(Z=we[ie],K=et.match(Z[1]),K){q=Z[0];break}K||(q=u)}V=q.length>=5&&q.substring(0,5)==="lang-",V&&!(K&&typeof K[1]=="string")&&(V=!1,q=T),V||(Ge[et]=q)}var Y=Ve;if(Ve+=et.length,!V)Fe.push(Be+Y,q);else{var J=K[1],ne=et.indexOf(J),se=ne+J.length;K[2]&&(se=et.length-K[2].length,ne=se-J.length);var Te=q.substring(5);W(He,Be+Y,et.substring(0,ne),Ee,Fe),W(He,Be+Y+ne,J,N(Te,J),Fe),W(He,Be+Y+se,et.substring(se),Ee,Fe)}}Ae.decorations=Fe};return Ee}function Oe(oe){var we=[],Re=[];oe.tripleQuotedStrings?we.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):oe.multiLineStrings?we.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),oe.verbatimStrings&&Re.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ee=oe.hashComments;ee&&(oe.cStyleComments?(ee>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,"#"]),Re.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([b,/^#[^\r\n]*/,null,"#"])),oe.cStyleComments&&(Re.push([b,/^\/\/[^\r\n]*/,null]),Re.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ce=oe.regexLiterals;if(ce){var Ee=ce>1?"":`
|
|
\r`,Ae=Ee?".":"[\\S\\s]",Me="/(?=[^/*"+Ee+"])(?:[^/\\x5B\\x5C"+Ee+"]|\\x5C"+Ae+"|\\x5B(?:[^\\x5C\\x5D"+Ee+"]|\\x5C"+Ae+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+D+"("+Me+")")])}var Be=oe.types;Be&&Re.push([g,Be]);var He=(""+oe.keywords).replace(/^ | $/g,"");He.length&&Re.push([E,new RegExp("^(?:"+He.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([u,/^\s+/,null,` \r
|
|
\xA0`]);var Fe="^.[^\\s\\w.$@'\"`/\\\\]*";return oe.regexLiterals&&(Fe+="(?!s*/)"),Re.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[g,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[m,new RegExp(Fe),null]),de(we,Re)}var Se=Oe({keywords:v,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ie(oe,we,Re){for(var ee=/(?:^|\s)nocode(?:\s|$)/,ce=/\r\n?|\n/,Ee=oe.ownerDocument,Ae=Ee.createElement("li");oe.firstChild;)Ae.appendChild(oe.firstChild);var Me=[Ae];function Be(Ue){var qe=Ue.nodeType;if(qe==1&&!ee.test(Ue.className))if(Ue.nodeName==="br")He(Ue),Ue.parentNode&&Ue.parentNode.removeChild(Ue);else for(var et=Ue.firstChild;et;et=et.nextSibling)Be(et);else if((qe==3||qe==4)&&Re){var q=Ue.nodeValue,K=q.match(ce);if(K){var V=q.substring(0,K.index);Ue.nodeValue=V;var Z=q.substring(K.index+K[0].length);if(Z){var ie=Ue.parentNode;ie.insertBefore(Ee.createTextNode(Z),Ue.nextSibling)}He(Ue),V||Ue.parentNode.removeChild(Ue)}}}function He(Ue){for(;!Ue.nextSibling;)if(Ue=Ue.parentNode,!Ue)return;function qe(K,V){var Z=V?K.cloneNode(!1):K,ie=K.parentNode;if(ie){var Y=qe(ie,1),J=K.nextSibling;Y.appendChild(Z);for(var ne=J;ne;ne=J)J=ne.nextSibling,Y.appendChild(ne)}return Z}for(var et=qe(Ue.nextSibling,0),q;(q=et.parentNode)&&q.nodeType===1;)et=q;Me.push(et)}for(var Fe=0;Fe<Me.length;++Fe)Be(Me[Fe]);we===(we|0)&&Me[0].setAttribute("value",we);var Ve=Ee.createElement("ol");Ve.className="linenums";for(var Ke=Math.max(0,we-1|0)||0,Fe=0,Ge=Me.length;Fe<Ge;++Fe)Ae=Me[Fe],Ae.className="L"+(Fe+Ke)%10,Ae.firstChild||Ae.appendChild(Ee.createTextNode("\xA0")),Ve.appendChild(Ae);oe.appendChild(Ve)}function Le(oe){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var Re=/\n/g,ee=oe.sourceCode,ce=ee.length,Ee=0,Ae=oe.spans,Me=Ae.length,Be=0,He=oe.decorations,Fe=He.length,Ve=0;He[Fe]=ce;var Ke,Ge;for(Ge=Ke=0;Ge<Fe;)He[Ge]!==He[Ge+2]?(He[Ke++]=He[Ge++],He[Ke++]=He[Ge++]):Ge+=2;for(Fe=Ke,Ge=Ke=0;Ge<Fe;){for(var Ue=He[Ge],qe=He[Ge+1],et=Ge+2;et+2<=Fe&&He[et+1]===qe;)et+=2;He[Ke++]=Ue,He[Ke++]=qe,Ge=et}Fe=He.length=Ke;var q=oe.sourceNode,K="";q&&(K=q.style.display,q.style.display="none");try{for(var V=null;Be<Me;){var Z=Ae[Be],ie=Ae[Be+2]||ce,Y=He[Ve+2]||ce,et=Math.min(ie,Y),J=Ae[Be+1],ne;if(J.nodeType!==1&&(ne=ee.substring(Ee,et))){we&&(ne=ne.replace(Re,"\r")),J.nodeValue=ne;var se=J.ownerDocument,Te=se.createElement("span");Te.className=He[Ve+1];var _e=J.parentNode;_e.replaceChild(Te,J),Te.appendChild(J),Ee<ie&&(Ae[Be+1]=J=se.createTextNode(ee.substring(et,ie)),_e.insertBefore(J,Te.nextSibling))}Ee=et,Ee>=ie&&(Be+=2),Ee>=Y&&(Ve+=2)}}finally{q&&(q.style.display=K)}}var Ne={};function be(oe,we){for(var Re=we.length;--Re>=0;){var ee=we[Re];Ne.hasOwnProperty(ee)?U.console&&console.warn("cannot override language handler %s",ee):Ne[ee]=oe}}function N(oe,we){return oe&&Ne.hasOwnProperty(oe)||(oe=/^\s*</.test(we)?"default-markup":"default-code"),Ne[oe]}be(Se,["default-code"]),be(de([],[[u,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[m,/^(?:<[%?]|[%?]>)/],["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"]),be(de([[u,/^[\s]+/,null,` \r
|
|
`],[L,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[_,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[m,/^[=<>\/]+/],["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"]),be(de([],[[L,/^[\s\S]+/]]),["uq.val"]),be(Oe({keywords:h,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),be(Oe({keywords:"null,true,false"}),["json"]),be(Oe({keywords:a,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),be(Oe({keywords:o,cStyleComments:!0}),["java"]),be(Oe({keywords:t,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),be(Oe({keywords:n,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),be(Oe({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),be(Oe({keywords:i,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),be(Oe({keywords:l,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),be(Oe({keywords:r,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),be(de([],[[p,/^[\s\S]+/]]),["regex"]);function A(oe){var we=oe.langExtension;try{var Re=I(oe.sourceNode,oe.pre),ee=Re.sourceCode;oe.sourceCode=ee,oe.spans=Re.spans,oe.basePos=0,N(we,ee)(oe),Le(oe)}catch(ce){U.console&&console.log(ce&&ce.stack||ce)}}function C(oe,we,Re){var ee=Re||!1,ce=we||null,Ee=document.createElement("div");Ee.innerHTML="<pre>"+oe+"</pre>",Ee=Ee.firstChild,ee&&Ie(Ee,ee,!0);var Ae={langExtension:ce,numberLines:ee,sourceNode:Ee,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return A(Ae),Ee.innerHTML}function F(oe,we){var Re=we||document.body,ee=Re.ownerDocument||document;function ce(Z){return Re.getElementsByTagName(Z)}for(var Ee=[ce("pre"),ce("code"),ce("xmp")],Ae=[],Me=0;Me<Ee.length;++Me)for(var Be=0,He=Ee[Me].length;Be<He;++Be)Ae.push(Ee[Me][Be]);Ee=null;var Fe=Date;Fe.now||(Fe={now:function(){return+new Date}});var Ve=0,Ke=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ge=/\bprettyprint\b/,Ue=/\bprettyprinted\b/,qe=/pre|xmp/i,et=/^code$/i,q=/^(?:pre|code|xmp)$/i,K={};function V(){for(var Z=U.PR_SHOULD_USE_CONTINUATION?Fe.now()+250:Infinity;Ve<Ae.length&&Fe.now()<Z;Ve++){for(var ie=Ae[Ve],Y=K,J=ie;J=J.previousSibling;){var ne=J.nodeType,se=(ne===7||ne===8)&&J.nodeValue;if(se?!/^\??prettify\b/.test(se):ne!==3||/\S/.test(J.nodeValue))break;if(se){Y={},se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(jt,lt,Kt){Y[lt]=Kt});break}}var Te=ie.className;if((Y!==K||Ge.test(Te))&&!Ue.test(Te)){for(var _e=!1,De=ie.parentNode;De;De=De.parentNode){var We=De.tagName;if(q.test(We)&&De.className&&Ge.test(De.className)){_e=!0;break}}if(!_e){ie.className+=" prettyprinted";var $e=Y.lang;if(!$e){$e=Te.match(Ke);var Xe;!$e&&(Xe=fe(ie))&&et.test(Xe.tagName)&&($e=Xe.className.match(Ke)),$e&&($e=$e[1])}var _t;if(qe.test(ie.tagName))_t=1;else{var at=ie.currentStyle,Qe=ee.defaultView,kt=at?at.whiteSpace:Qe&&Qe.getComputedStyle?Qe.getComputedStyle(ie,null).getPropertyValue("white-space"):0;_t=kt&&kt.substring(0,3)==="pre"}var St=Y.linenums;(St=St==="true"||+St)||(St=Te.match(/\blinenums\b(?::(\d+))?/),St=St?St[1]&&St[1].length?+St[1]:!0:!1),St&&Ie(ie,St,_t);var Bt={langExtension:$e,sourceNode:ie,numberLines:St,pre:_t,sourceCode:null,basePos:null,spans:null,decorations:null};A(Bt)}}}Ve<Ae.length?U.setTimeout(V,250):typeof oe=="function"&&oe()}V()}var G=U.PR={createSimpleLexer:de,registerLangHandler:be,sourceDecorator:Oe,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:L,PR_COMMENT:b,PR_DECLARATION:y,PR_KEYWORD:E,PR_LITERAL:c,PR_NOCODE:x,PR_PLAIN:u,PR_PUNCTUATION:m,PR_SOURCE:T,PR_STRING:p,PR_TAG:_,PR_TYPE:g,prettyPrintOne:O?U.prettyPrintOne=C:R=C,prettyPrint:H=O?U.prettyPrint=F:H=F},P=U.define;typeof P=="function"&&P.amd&&P("google-code-prettify",[],function(){return G})})()},STEk:function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return be});/*! *****************************************************************************
|
|
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(N,A){return(ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,F){C.__proto__=F}||function(C,F){for(var G in F)Object.prototype.hasOwnProperty.call(F,G)&&(C[G]=F[G])})(N,A)};function B(N,A){function C(){this.constructor=N}ae(N,A),N.prototype=A===null?Object.create(A):(C.prototype=A.prototype,new C)}function O(N,A,C,F){return new(C||(C=Promise))(function(G,P){function oe(ee){try{Re(F.next(ee))}catch(ce){P(ce)}}function we(ee){try{Re(F.throw(ee))}catch(ce){P(ce)}}function Re(ee){var ce;ee.done?G(ee.value):(ce=ee.value,ce instanceof C?ce:new C(function(Ee){Ee(ce)})).then(oe,we)}Re((F=F.apply(N,A||[])).next())})}function k(N,A){var C,F,G,P,oe={label:0,sent:function(){if(1&G[0])throw G[1];return G[1]},trys:[],ops:[]};return P={next:we(0),throw:we(1),return:we(2)},typeof Symbol=="function"&&(P[Symbol.iterator]=function(){return this}),P;function we(Re){return function(ee){return function(ce){if(C)throw new TypeError("Generator is already executing.");for(;oe;)try{if(C=1,F&&(G=2&ce[0]?F.return:ce[0]?F.throw||((G=F.return)&&G.call(F),0):F.next)&&!(G=G.call(F,ce[1])).done)return G;switch(F=0,G&&(ce=[2&ce[0],G.value]),ce[0]){case 0:case 1:G=ce;break;case 4:return oe.label++,{value:ce[1],done:!1};case 5:oe.label++,F=ce[1],ce=[0];continue;case 7:ce=oe.ops.pop(),oe.trys.pop();continue;default:if(!(G=oe.trys,(G=G.length>0&&G[G.length-1])||ce[0]!==6&&ce[0]!==2)){oe=0;continue}if(ce[0]===3&&(!G||ce[1]>G[0]&&ce[1]<G[3])){oe.label=ce[1];break}if(ce[0]===6&&oe.label<G[1]){oe.label=G[1],G=ce;break}if(G&&oe.label<G[2]){oe.label=G[2],oe.ops.push(ce);break}G[2]&&oe.ops.pop(),oe.trys.pop();continue}ce=A.call(N,oe)}catch(Ee){ce=[6,Ee],F=0}finally{C=G=0}if(5&ce[0])throw ce[1];return{value:ce[0]?ce[1]:void 0,done:!0}}([Re,ee])}}}function w(){for(var N=0,A=0,C=arguments.length;A<C;A++)N+=arguments[A].length;var F=Array(N),G=0;for(A=0;A<C;A++)for(var P=arguments[A],oe=0,we=P.length;oe<we;oe++,G++)F[G]=P[oe];return F}var R=function(){function N(){}return N.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},N.setAttributes=function(A,C){for(var F=0,G=C;F<G.length;F++){var P=G[F],oe=P[0],we=P[1];A.setAttribute(oe,we)}},N.createRect=function(A,C,F){var G=document.createElementNS("http://www.w3.org/2000/svg","rect");return G.setAttribute("width",A.toString()),G.setAttribute("height",C.toString()),F&&N.setAttributes(G,F),G},N.createLine=function(A,C,F,G,P){var oe=document.createElementNS("http://www.w3.org/2000/svg","line");return oe.setAttribute("x1",A.toString()),oe.setAttribute("y1",C.toString()),oe.setAttribute("x2",F.toString()),oe.setAttribute("y2",G.toString()),P&&N.setAttributes(oe,P),oe},N.createPolygon=function(A,C){var F=document.createElementNS("http://www.w3.org/2000/svg","polygon");return F.setAttribute("points",A),C&&N.setAttributes(F,C),F},N.createCircle=function(A,C){var F=document.createElementNS("http://www.w3.org/2000/svg","circle");return F.setAttribute("cx",(A/2).toString()),F.setAttribute("cy",(A/2).toString()),F.setAttribute("r",A.toString()),C&&N.setAttributes(F,C),F},N.createEllipse=function(A,C,F){var G=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return G.setAttribute("cx",(A/2).toString()),G.setAttribute("cy",(C/2).toString()),G.setAttribute("rx",(A/2).toString()),G.setAttribute("ry",(C/2).toString()),F&&N.setAttributes(G,F),G},N.createGroup=function(A){var C=document.createElementNS("http://www.w3.org/2000/svg","g");return A&&N.setAttributes(C,A),C},N.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},N.createMarker=function(A,C,F,G,P,oe,we){var Re=document.createElementNS("http://www.w3.org/2000/svg","marker");return N.setAttributes(Re,[["id",A],["orient",C],["markerWidth",F.toString()],["markerHeight",G.toString()],["refX",P.toString()],["refY",oe.toString()]]),Re.appendChild(we),Re},N.createText=function(A){var C=document.createElementNS("http://www.w3.org/2000/svg","text");return C.setAttribute("x","0"),C.setAttribute("y","0"),A&&N.setAttributes(C,A),C},N.createTSpan=function(A,C){var F=document.createElementNS("http://www.w3.org/2000/svg","tspan");return F.textContent=A,C&&N.setAttributes(F,C),F},N.createImage=function(A){var C=document.createElementNS("http://www.w3.org/2000/svg","image");return A&&N.setAttributes(C,A),C},N.createPoint=function(A,C){var F=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return F.x=A,F.y=C,F},N.createPath=function(A,C){var F=document.createElementNS("http://www.w3.org/2000/svg","path");return F.setAttribute("d",A),C&&N.setAttributes(F,C),F},N}(),H=function(){function N(){}return N.addKey=function(A){N.key=A},Object.defineProperty(N,"isLicensed",{get:function(){return!!N.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(N.key)},enumerable:!1,configurable:!0}),N}(),U=function(){function N(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return N.prototype.rasterize=function(A,C,F){var G=this;return new Promise(function(P){var oe=F!==void 0?F:document.createElement("canvas");A===null&&(G.markersOnly=!0,G.naturalSize=!1);var we=document.createElementNS("http://www.w3.org/2000/svg","svg");we.setAttribute("xmlns","http://www.w3.org/2000/svg"),we.setAttribute("width",C.width.baseVal.valueAsString),we.setAttribute("height",C.height.baseVal.valueAsString),we.setAttribute("viewBox","0 0 "+C.viewBox.baseVal.width.toString()+" "+C.viewBox.baseVal.height.toString()),we.innerHTML=C.innerHTML,G.naturalSize===!0?(we.width.baseVal.value=A.naturalWidth,we.height.baseVal.value=A.naturalHeight):G.width!==void 0&&G.height!==void 0&&(we.width.baseVal.value=G.width,we.height.baseVal.value=G.height),oe.width=we.width.baseVal.value,oe.height=we.height.baseVal.value;var Re=we.outerHTML,ee=oe.getContext("2d");G.markersOnly!==!0&&ee.drawImage(A,0,0,oe.width,oe.height);var ce=window.URL,Ee=new Image(oe.width,oe.height);Ee.setAttribute("crossOrigin","anonymous");var Ae=new Blob([Re],{type:"image/svg+xml"}),Me=ce.createObjectURL(Ae);Ee.onload=function(){ee.drawImage(Ee,0,0),ce.revokeObjectURL(Me);var Be=oe.toDataURL(G.imageType,G.imageQuality);P(Be)},Ee.src=Me})},N}(),e=function(){},S=function(){function N(A){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+A+"_"}return Object.defineProperty(N.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(N.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(N.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),N.prototype.addClass=function(A){return this.styleSheet===void 0&&this.addStyleSheet(),A.name=""+this.classNamePrefix+A.localName,this.classes.push(A),this.styleSheet.sheet.insertRule("."+A.name+" {"+A.style+"}",this.styleSheet.sheet.cssRules.length),A},N.prototype.addRule=function(A){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(A),this.styleSheet.sheet.insertRule(A.selector+" {"+A.style+"}",this.styleSheet.sheet.cssRules.length)},N.prototype.addStyleSheet=function(){var A;this.styleSheet=document.createElement("style"),((A=this.styleSheetRoot)!==null&&A!==void 0?A:document.head).appendChild(this.styleSheet),this.addRule(new d("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new d("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new d("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new h("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new h("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},N.prototype.removeStyleSheet=function(){var A;this.styleSheet&&(((A=this.styleSheetRoot)!==null&&A!==void 0?A:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},N}(),d=function(N,A){this.selector=N,this.style=A},h=function(N,A){this.localName=N,this.style=A},o=function(){function N(A,C,F,G,P){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=A,this.displayMode=C,this.markerItems=F,this.uiStyleSettings=G,this.styles=P,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return N.prototype.show=function(A){var C=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=A,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var F=document.createElement("div");F.className=this.toolbarBlockStyleClass.name,F.style.whiteSpace="nowrap",this.uiContainer.appendChild(F),this.addActionButton(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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 oe=document.createElement("div");oe.className=""+C.toolbarButtonStyleClass.name,oe.setAttribute("data-type-name",P.typeName),oe.innerHTML=P.icon,oe.addEventListener("click",function(){C.markerToolbarButtonClicked(oe,P)}),C.buttons.push(oe),C.markerButtons.push(oe)}),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 G=document.createElement("div");G.className=this.toolbarBlockStyleClass.name,G.style.whiteSpace="nowrap",G.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(G),this.addActionButton(G,'<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(G,'<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()},N.prototype.addButtonClickListener=function(A){this.buttonClickListeners.push(A)},N.prototype.removeButtonClickListener=function(A){this.buttonClickListeners.indexOf(A)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(A),1)},N.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},N.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var A=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var C=0;C<this.markerButtons.length;C++)C<A||C===A&&this.markerButtons.length-1===A?this.markerButtonBlock.appendChild(this.markerButtons[C]):(C===A&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[C]))}},N.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")},N.prototype.resetButtonStyles=function(){var A=this;this.buttons.forEach(function(C){C.className=C.className.replace(A.uiStyleSettings.toolbarButtonStyleColorsClassName?A.uiStyleSettings.toolbarButtonStyleColorsClassName:A.toolbarButtonStyleColorsClass.name,"").trim(),C.className=C.className.replace(A.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?A.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:A.toolbarActiveButtonStyleColorsClass.name,"").trim(),C.className+=" "+(A.uiStyleSettings.toolbarButtonStyleColorsClassName?A.uiStyleSettings.toolbarButtonStyleColorsClassName:A.toolbarButtonStyleColorsClass.name)})},N.prototype.addActionButton=function(A,C,F){var G=this,P=document.createElement("div");switch(P.className=""+this.toolbarButtonStyleClass.name,P.innerHTML=C,P.setAttribute("data-action",F),P.addEventListener("click",function(){G.actionToolbarButtonClicked(P,F)}),F){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}A.appendChild(P),this.buttons.push(P)},N.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new h("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 h("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new h("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new h("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 h("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var A=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new h("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
|
|
padding: `+A+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new h("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new h("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new d("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new d("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},N.prototype.markerToolbarButtonClicked=function(A,C){this.setActiveButton(A),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(F){return F("marker",C)}),this.markerButtonOverflowBlock.style.display="none"},N.prototype.actionToolbarButtonClicked=function(A,C){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(F){return F("action",C)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},N.prototype.setActiveButton=function(A){this.resetButtonStyles(),A.className=A.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),A.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},N.prototype.setActiveMarkerButton=function(A){var C=this.markerButtons.find(function(F){return F.getAttribute("data-type-name")===A});C&&this.setActiveButton(C)},N.prototype.setCurrentMarker=function(A){var C=this;this.currentMarker=A,this.buttons.filter(function(F){return/delete|notes/.test(F.getAttribute("data-action"))}).forEach(function(F){C.currentMarker===void 0?(F.style.fillOpacity="0.4",F.style.pointerEvents="none"):(F.style.fillOpacity="1",F.style.pointerEvents="all")})},N}(),a=function(){function N(A,C,F,G){this.panels=[],this.panelButtons=[],this.markerjsContainer=A,this.displayMode=C,this.uiStyleSettings=F,this.styles=G,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return N.prototype.addStyles=function(){var A;this.toolboxStyleClass=this.styles.addClass(new h("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 h("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var C=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new h("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new h("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new h("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 h("toolbox-panel-row_colors",`
|
|
background-color: `+((A=this.uiStyleSettings.toolboxBackgroundColor)!==null&&A!==void 0?A:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new h("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px;
|
|
padding: `+C+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new h("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new h("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new d("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new d("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},N.prototype.show=function(A){var C;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=A,this.uiContainer.className=this.toolboxStyleClass.name+" "+((C=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&C!==void 0?C:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},N.prototype.setPanelButtons=function(A){var C,F,G=this;this.panels=A,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((C=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&C!==void 0?C:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((F=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&F!==void 0?F:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(P){var oe;P.uiStyleSettings=G.uiStyleSettings;var we=document.createElement("div");we.className=G.toolboxButtonStyleClass.name+" "+((oe=G.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&oe!==void 0?oe:G.toolboxButtonStyleColorsClass.name),we.innerHTML=P.icon,we.title=P.title,we.addEventListener("click",function(){G.panelButtonClick(P)}),G.panelButtons.push(we),G.buttonRow.appendChild(we)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},N.prototype.panelButtonClick=function(A){var C=this,F=-1;if(A!==this.activePanel){F=this.panels.indexOf(A),this.panelRow.innerHTML="";var G=A.getUi();G.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(G),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=A}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){C.displayMode==="inline"?C.panelRow.style.display="none":C.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(P,oe){var we,Re;P.className=C.toolboxButtonStyleClass.name+" "+(oe===F?""+((we=C.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&we!==void 0?we:C.toolboxActiveButtonStyleColorsClass.name):""+((Re=C.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Re!==void 0?Re:C.toolboxButtonStyleColorsClass.name))})},N}(),r=function(N,A){this.title=N,this.icon=A},l=function(N){function A(C,F,G,P){var oe=N.call(this,C,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 oe.colors=[],oe.addTransparent=!1,oe.colorBoxes=[],oe.colors=F,oe.currentColor=G,oe.setCurrentColor=oe.setCurrentColor.bind(oe),oe.getColorBox=oe.getColorBox.bind(oe),oe}return B(A,N),A.prototype.getUi=function(){var C=this,F=document.createElement("div");return F.style.overflow="hidden",F.style.whiteSpace="nowrap",this.colors.forEach(function(G){var P=C.getColorBox(G);F.appendChild(P),C.colorBoxes.push(P)}),F},A.prototype.getColorBox=function(C){var F=this,G=this.uiStyleSettings.toolbarHeight/4,P=this.uiStyleSettings.toolbarHeight-G,oe=document.createElement("div");oe.style.display="inline-block",oe.style.boxSizing="content-box",oe.style.width=P-2+"px",oe.style.height=P-2+"px",oe.style.padding="1px",oe.style.marginRight="2px",oe.style.marginBottom="2px",oe.style.borderWidth="2px",oe.style.borderStyle="solid",oe.style.borderRadius=(P+2)/2+"px",oe.style.borderColor=C===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",oe.addEventListener("click",function(){F.setCurrentColor(C,oe)});var we=document.createElement("div");return we.style.display="inline-block",we.style.width=P-2+"px",we.style.height=P-2+"px",we.style.backgroundColor=C,we.style.borderRadius=P/2+"px",C==="transparent"&&(we.style.fill=this.uiStyleSettings.toolboxAccentColor,we.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>`),oe.appendChild(we),oe},A.prototype.setCurrentColor=function(C,F){var G=this;this.currentColor=C,this.colorBoxes.forEach(function(P){P.style.borderColor=P===F?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(C)},A}(r),s=function(){function N(A,C,F){this._state="new",this._isSelected=!1,this._container=A,this._overlayContainer=C,this.globalSettings=F,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(N.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),N.prototype.ownsTarget=function(A){return!1},Object.defineProperty(N.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),N.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},N.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},N.prototype.pointerDown=function(A,C){},N.prototype.dblClick=function(A,C){},N.prototype.manipulate=function(A){},N.prototype.pointerUp=function(A){this.stateChanged()},N.prototype.dispose=function(){},N.prototype.addMarkerVisualToContainer=function(A){this.container.childNodes.length>0?this.container.insertBefore(A,this.container.childNodes[0]):this.container.appendChild(A)},N.prototype.getState=function(){return{typeName:N.typeName,state:this.state,notes:this.notes}},N.prototype.restoreState=function(A){this._state=A.state,this.notes=A.notes},N.prototype.scale=function(A,C){},N.prototype.colorChanged=function(A){this.onColorChanged&&this.onColorChanged(A),this.stateChanged()},N.prototype.fillColorChanged=function(A){this.onFillColorChanged&&this.onFillColorChanged(A),this.stateChanged()},N.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var A=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),A.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(A)&&this.onStateChanged(this)}},N.typeName="MarkerBase",N}(),n=function(){function N(){this.findGripByVisual=this.findGripByVisual.bind(this)}return N.prototype.findGripByVisual=function(A){return this.topLeft.ownsTarget(A)?this.topLeft:this.topCenter.ownsTarget(A)?this.topCenter:this.topRight.ownsTarget(A)?this.topRight:this.centerLeft.ownsTarget(A)?this.centerLeft:this.centerRight.ownsTarget(A)?this.centerRight:this.bottomLeft.ownsTarget(A)?this.bottomLeft:this.bottomCenter.ownsTarget(A)?this.bottomCenter:this.bottomRight.ownsTarget(A)?this.bottomRight:void 0},N}(),i=function(){function N(){this.GRIP_SIZE=10,this.visual=R.createGroup(),this.visual.appendChild(R.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(R.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return N.prototype.ownsTarget=function(A){return A===this.visual||A===this.visual.childNodes[0]||A===this.visual.childNodes[1]},N}(),t=function(){function N(){}return N.toITransformMatrix=function(A){return{a:A.a,b:A.b,c:A.c,d:A.d,e:A.e,f:A.f}},N.toSVGMatrix=function(A,C){return A.a=C.a,A.b=C.b,A.c=C.c,A.d=C.d,A.e=C.e,A.f=C.f,A},N}(),v=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||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(R.createTransform()),P.setupControlBox(),P}return B(A,N),Object.defineProperty(A.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"visual",{get:function(){return this._visual},set:function(C){this._visual=C;var F=R.createTransform();this._visual.transform.baseVal.appendItem(F)},enumerable:!1,configurable:!0}),A.prototype.ownsTarget=function(C){return!!N.prototype.ownsTarget.call(this,C)||!!(this.controlGrips.findGripByVisual(C)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(C))},A.prototype.pointerDown=function(C,F){N.prototype.pointerDown.call(this,C,F),this.state==="new"&&(this.left=C.x,this.top=C.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var G=this.unrotatePoint(C);if(this.manipulationStartX=G.x,this.manipulationStartY=G.y,this.offsetX=G.x-this.left,this.offsetY=G.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(F),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(F)){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 oe=this.container.transform.baseVal.getItem(0);oe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(oe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},A.prototype.pointerUp=function(C){var F=this.state;N.prototype.pointerUp.call(this,C),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(C),this._state="select",F==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},A.prototype.moveVisual=function(C){this.visual.style.transform="translate("+C.x+"px, "+C.y+"px)"},A.prototype.manipulate=function(C){var F=this.unrotatePoint(C);this.state==="creating"?this.resize(C):this.state==="move"?(this.left=this.manipulationStartLeft+(F.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(F.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(F):this.state==="rotate"&&this.rotate(C)},A.prototype.resize=function(C){var F=this.manipulationStartLeft,G=this.manipulationStartWidth,P=this.manipulationStartTop,oe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:F=this.manipulationStartLeft+C.x-this.manipulationStartX,G=this.manipulationStartWidth+this.manipulationStartLeft-F;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:G=this.manipulationStartWidth+C.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:P=this.manipulationStartTop+C.y-this.manipulationStartY,oe=this.manipulationStartHeight+this.manipulationStartTop-P;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:oe=this.manipulationStartHeight+C.y-this.manipulationStartY}G>=0?(this.left=F,this.width=G):(this.left=F+G,this.width=-G),oe>=0?(this.top=P,this.height=oe):(this.top=P+oe,this.height=-oe),this.setSize()},A.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},A.prototype.rotate=function(C){if(Math.abs(C.x-this.centerX)>.1){var F=Math.sign(C.x-this.centerX);this.rotationAngle=180*Math.atan((C.y-this.centerY)/(C.x-this.centerX))/Math.PI+90*F,this.applyRotation()}},A.prototype.applyRotation=function(){var C=this.container.transform.baseVal.getItem(0);C.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(C,0)},A.prototype.rotatePoint=function(C){if(this.rotationAngle===0)return C;var F=this.container.getCTM(),G=R.createPoint(C.x,C.y);return{x:(G=G.matrixTransform(F)).x,y:G.y}},A.prototype.unrotatePoint=function(C){if(this.rotationAngle===0)return C;var F=this.container.getCTM();F=F.inverse();var G=R.createPoint(C.x,C.y);return{x:(G=G.matrixTransform(F)).x,y:G.y}},A.prototype.select=function(){N.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},A.prototype.deselect=function(){N.prototype.deselect.call(this),this.controlBox.style.display="none"},A.prototype.setupControlBox=function(){this.controlBox=R.createGroup();var C=R.createTransform();C.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(C),this.container.appendChild(this.controlBox),this.controlRect=R.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=R.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 n,this.addControlGrips(),this.controlBox.style.display="none"},A.prototype.adjustControlBox=function(){var C=this.controlBox.transform.baseVal.getItem(0);C.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(C,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},A.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()},A.prototype.createGrip=function(){var C=new i;return C.visual.transform.baseVal.appendItem(R.createTransform()),this.controlBox.appendChild(C.visual),C},A.prototype.positionGrips=function(){var C=this.controlGrips.topLeft.GRIP_SIZE,F=-C/2,G=F,P=(this.width+this.CB_DISTANCE)/2-C/2,oe=(this.height+this.CB_DISTANCE)/2-C/2,we=this.height+this.CB_DISTANCE-C/2,Re=this.width+this.CB_DISTANCE-C/2;this.positionGrip(this.controlGrips.topLeft.visual,F,G),this.positionGrip(this.controlGrips.topCenter.visual,P,G),this.positionGrip(this.controlGrips.topRight.visual,Re,G),this.positionGrip(this.controlGrips.centerLeft.visual,F,oe),this.positionGrip(this.controlGrips.centerRight.visual,Re,oe),this.positionGrip(this.controlGrips.bottomLeft.visual,F,we),this.positionGrip(this.controlGrips.bottomCenter.visual,P,we),this.positionGrip(this.controlGrips.bottomRight.visual,Re,we),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,P,G-3*this.CB_DISTANCE)},A.prototype.positionGrip=function(C,F,G){var P=C.transform.baseVal.getItem(0);P.setTranslate(F,G),C.transform.baseVal.replaceItem(P,0)},A.prototype.hideControlBox=function(){this.controlBox.style.display="none"},A.prototype.showControlBox=function(){this.controlBox.style.display=""},A.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:t.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:t.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},N.prototype.getState.call(this))},A.prototype.restoreState=function(C){N.prototype.restoreState.call(this,C);var F=C;this.left=F.left,this.top=F.top,this.width=F.width,this.height=F.height,this.rotationAngle=F.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(t.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,F.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(t.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,F.containerTransformMatrix))},A.prototype.scale=function(C,F){N.prototype.scale.call(this,C,F);var G=this.rotatePoint({x:this.left,y:this.top}),P=this.unrotatePoint({x:G.x*C,y:G.y*F});this.left=P.x,this.top=P.y,this.width=this.width*C,this.height=this.height*F,this.adjustControlBox()},A}(s),f=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||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 B(A,N),A.prototype.ownsTarget=function(C){return!(!N.prototype.ownsTarget.call(this,C)&&C!==this.visual)},A.prototype.createVisual=function(){this.visual=R.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)},A.prototype.pointerDown=function(C,F){N.prototype.pointerDown.call(this,C,F),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},A.prototype.manipulate=function(C){N.prototype.manipulate.call(this,C)},A.prototype.resize=function(C){N.prototype.resize.call(this,C),this.setSize()},A.prototype.setSize=function(){N.prototype.setSize.call(this),R.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},A.prototype.pointerUp=function(C){N.prototype.pointerUp.call(this,C),this.setSize()},A.prototype.setStrokeColor=function(C){this.strokeColor=C,this.visual&&R.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(C),this.stateChanged()},A.prototype.setFillColor=function(C){this.fillColor=C,this.visual&&R.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},A.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.visual&&R.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},A.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.visual&&R.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},A.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},N.prototype.getState.call(this))},A.prototype.restoreState=function(C){var F=C;this.fillColor=F.fillColor,this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.opacity=F.opacity,this.createVisual(),N.prototype.restoreState.call(this,C),this.setSize()},A.prototype.scale=function(C,F){N.prototype.scale.call(this,C,F),this.setSize()},A.title="Rectangle marker",A}(v),p=function(N){function A(C,F,G,P){var oe=N.call(this,C,P||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return oe.widths=[],oe.widthBoxes=[],oe.widths=F,oe.currentWidth=G,oe.setCurrentWidth=oe.setCurrentWidth.bind(oe),oe}return B(A,N),A.prototype.getUi=function(){var C=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",this.widths.forEach(function(G){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=G===C.currentWidth?C.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){C.setCurrentWidth(G,P)}),F.appendChild(P);var oe=document.createElement("div");oe.innerText=G.toString(),oe.style.marginRight="5px",P.appendChild(oe);var we=document.createElement("div");we.style.minHeight="20px",we.style.flexGrow="2",we.style.display="flex",we.style.alignItems="center";var Re=document.createElement("hr");Re.style.minWidth="20px",Re.style.border="0px",Re.style.borderTop=G+"px solid "+C.uiStyleSettings.toolboxColor,Re.style.flexGrow="2",we.appendChild(Re),P.appendChild(we),C.widthBoxes.push(P)}),F},A.prototype.setCurrentWidth=function(C,F){var G=this;this.currentWidth=C,this.widthBoxes.forEach(function(P){P.style.borderColor=P===F?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},A}(r),E=function(N){function A(C,F,G,P){var oe=N.call(this,C,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 oe.styles=[],oe.styleBoxes=[],oe.styles=F,oe.currentStyle=G,oe.setCurrentStyle=oe.setCurrentStyle.bind(oe),oe}return B(A,N),A.prototype.getUi=function(){var C=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",this.styles.forEach(function(G){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/C.styles.length-5+"%",P.style.borderColor=G===C.currentStyle?C.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){C.setCurrentStyle(G,P)}),F.appendChild(P);var oe=document.createElement("div");oe.style.minHeight="20px",oe.style.flexGrow="2",oe.style.overflow="hidden";var we=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+C.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(G!==""?'stroke-dasharray="'+G+'"':"")+` />
|
|
</svg>`;oe.innerHTML=we,P.appendChild(oe),C.styleBoxes.push(P)}),F},A.prototype.setCurrentStyle=function(C,F){var G=this;this.currentStyle=C,this.styleBoxes.forEach(function(P){P.style.borderColor=P===F?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},A}(r),b=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||this;return P.strokeColor=G.defaultColor,P.strokeWidth=G.defaultStrokeWidth,P.strokeDasharray=G.defaultStrokeDasharray,P.strokePanel=new l("Line color",G.defaultColorSet,G.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new p("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new E("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return B(A,N),Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var C=N.prototype.getState.call(this);return C.typeName=A.typeName,C},A.typeName="FrameMarker",A.title="Frame marker",A.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',A}(f),g=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},c=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||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 B(A,N),A.prototype.ownsTarget=function(C){return!!N.prototype.ownsTarget.call(this,C)||!(!this.grip1.ownsTarget(C)&&!this.grip2.ownsTarget(C))},A.prototype.pointerDown=function(C,F){N.prototype.pointerDown.call(this,C,F),this.manipulationStartX=C.x,this.manipulationStartY=C.y,this.state==="new"&&(this.x1=C.x,this.y1=C.y,this.x2=C.x,this.y2=C.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(F)?this.activeGrip=this.grip1:this.grip2.ownsTarget(F)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},A.prototype.pointerUp=function(C){var F=this.state;N.prototype.pointerUp.call(this,C),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(C),this._state="select",F==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},A.prototype.adjustVisual=function(){},A.prototype.manipulate=function(C){this.state==="creating"?this.resize(C):this.state==="move"?(this.x1=this.manipulationStartX1+C.x-this.manipulationStartX,this.y1=this.manipulationStartY1+C.y-this.manipulationStartY,this.x2=this.manipulationStartX2+C.x-this.manipulationStartX,this.y2=this.manipulationStartY2+C.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(C)},A.prototype.resize=function(C){switch(this.activeGrip){case this.grip1:this.x1=C.x,this.y1=C.y;break;case this.grip2:case void 0:this.x2=C.x,this.y2=C.y}this.adjustVisual(),this.adjustControlBox()},A.prototype.select=function(){N.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},A.prototype.deselect=function(){N.prototype.deselect.call(this),this.controlBox.style.display="none"},A.prototype.setupControlBox=function(){this.controlBox=R.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},A.prototype.adjustControlBox=function(){this.positionGrips()},A.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},A.prototype.createGrip=function(){var C=new i;return C.visual.transform.baseVal.appendItem(R.createTransform()),this.controlBox.appendChild(C.visual),C},A.prototype.positionGrips=function(){var C=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-C/2,this.y1-C/2),this.positionGrip(this.grip2.visual,this.x2-C/2,this.y2-C/2)},A.prototype.positionGrip=function(C,F,G){var P=C.transform.baseVal.getItem(0);P.setTranslate(F,G),C.transform.baseVal.replaceItem(P,0)},A.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},N.prototype.getState.call(this))},A.prototype.restoreState=function(C){N.prototype.restoreState.call(this,C);var F=C;this.x1=F.x1,this.y1=F.y1,this.x2=F.x2,this.y2=F.y2},A.prototype.scale=function(C,F){N.prototype.scale.call(this,C,F),this.x1=this.x1*C,this.y1=this.y1*F,this.x2=this.x2*C,this.y2=this.y2*F,this.adjustVisual(),this.adjustControlBox()},A}(s),m=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||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=G.defaultColor,P.strokeWidth=G.defaultStrokeWidth,P.strokeDasharray=G.defaultStrokeDasharray,P.strokePanel=new l("Line color",G.defaultColorSet,G.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new p("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new E("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return B(A,N),A.prototype.ownsTarget=function(C){return!(!N.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorLine&&C!==this.visibleLine)},A.prototype.createVisual=function(){this.visual=R.createGroup(),this.selectorLine=R.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=R.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)},A.prototype.pointerDown=function(C,F){N.prototype.pointerDown.call(this,C,F),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},A.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()),R.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),R.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),R.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},A.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},A.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},A.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var C=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},N.prototype.getState.call(this));return C.typeName=A.typeName,C},A.prototype.restoreState=function(C){N.prototype.restoreState.call(this,C);var F=C;this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.createVisual(),this.adjustVisual()},A.typeName="LineMarker",A.title="Line marker",A.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',A}(c),u=function(N){function A(C,F,G,P){var oe=N.call(this,C,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 oe.fonts=[],oe.fontBoxes=[],oe.fonts=F,oe.currentFont=G,oe.setCurrentFont=oe.setCurrentFont.bind(oe),oe}return B(A,N),A.prototype.getUi=function(){var C=this,F=document.createElement("div");return F.style.overflow="hidden",F.style.flexGrow="2",this.fonts.forEach(function(G){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/C.fonts.length-5+"%",P.style.borderColor=G===C.currentFont?C.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){C.setCurrentFont(G,P)}),F.appendChild(P);var oe=document.createElement("div");oe.style.display="flex",oe.style.minHeight="20px",oe.style.flexGrow="2",oe.style.fontFamily=G,oe.style.overflow="hidden";var we=document.createElement("div");we.style.whiteSpace="nowrap",we.style.overflow="hidden",we.style.textOverflow="ellipsis",we.innerHTML="The quick brown fox jumps over the lazy dog",oe.appendChild(we),P.appendChild(oe),C.fontBoxes.push(P)}),F},A.prototype.setCurrentFont=function(C,F){var G=this;this.currentFont=C,this.fontBoxes.forEach(function(P){P.style.borderColor=P===F?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},A}(r),_=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||this;return P.color="transparent",P.padding=5,P.DEFAULT_TEXT="your text here",P.text=P.DEFAULT_TEXT,P.isMoved=!1,P.color=G.defaultColor,P.fontFamily=G.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 l("Color",G.defaultColorSet,G.defaultColor),P.colorPanel.onColorChanged=P.setColor,P.fontFamilyPanel=new u("Font",G.defaultFontFamilies,G.defaultFontFamily),P.fontFamilyPanel.onFontChanged=P.setFont,P}return B(A,N),A.prototype.ownsTarget=function(C){if(N.prototype.ownsTarget.call(this,C)||C===this.visual||C===this.textElement||C===this.bgRectangle)return!0;var F=!1;return this.textElement.childNodes.forEach(function(G){G===C&&(F=!0)}),F},A.prototype.createVisual=function(){this.visual=R.createGroup(),this.bgRectangle=R.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=R.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(R.createTransform()),this.textElement.transform.baseVal.appendItem(R.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},A.prototype.pointerDown=function(C,F){N.prototype.pointerDown.call(this,C,F),this.isMoved=!1,this.pointerDownPoint=C,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},A.prototype.renderText=function(){var C=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(F){C.textElement.appendChild(R.createTSpan(F.trim()===""?" ":F.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},A.prototype.getTextScale=function(){var C=this.textElement.getBBox(),F=1;if(C.width>0&&C.height>0){var G=(1*this.width-this.width*this.padding*2/100)/C.width,P=(1*this.height-this.height*this.padding*2/100)/C.height;F=Math.min(G,P)}return F},A.prototype.getTextPosition=function(C){var F=this.textElement.getBBox(),G=0,P=0;return F.width>0&&F.height>0&&(G=(this.width-F.width*C)/2,P=this.height/2-F.height*C/2),{x:G,y:P}},A.prototype.sizeText=function(){var C=this.textElement.getBBox(),F=this.getTextScale(),G=this.getTextPosition(F);G.y-=C.y*F,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+G.x+"px, "+G.y+"px) scale("+F+", "+F+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(G.x,G.y),this.textElement.transform.baseVal.getItem(1).setScale(F,F))},A.prototype.manipulate=function(C){N.prototype.manipulate.call(this,C),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(C.x-this.pointerDownPoint.x)>5||Math.abs(C.y-this.pointerDownPoint.y)>5)},A.prototype.resize=function(C){N.prototype.resize.call(this,C),this.isMoved=!0,this.setSize(),this.sizeText()},A.prototype.setSize=function(){N.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(R.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),R.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},A.prototype.pointerUp=function(C){var F=this.state;F==="creating"&&(this._suppressMarkerCreateEvent=!0),N.prototype.pointerUp.call(this,C),this.setSize(),(F==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},A.prototype.showTextEditor=function(){var C=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(F){F.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var F=Number.parseFloat(C.textEditor.style.fontSize);C.textEditor.clientWidth>=Number.parseInt(C.textEditor.style.maxWidth)&&F>.9;)F-=.1,C.textEditor.style.fontSize=Math.max(F,.9)+"em"}),this.textEditor.addEventListener("keyup",function(F){F.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(F){if(F.clipboardData){var G=F.clipboardData.getData("text"),P=window.getSelection();if(!P.rangeCount)return!1;P.deleteFromDocument(),P.getRangeAt(0).insertNode(document.createTextNode(G)),F.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){C.textEditDivClicked(C.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},A.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var C=this.getTextScale(),F=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),G=this.textElement.getBBox(),P={x:G.width*C,y:G.height*C};F.x-=P.x/2,F.y-=P.y/2,this.textEditor.style.top=F.y+"px",this.textEditor.style.left=F.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-F.x+"px",this.textEditor.style.fontSize=Math.max(16*C,12)+"px",this.textElement.style.display="none"}},A.prototype.textEditDivClicked=function(C){this.text=C.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},A.prototype.select=function(){N.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},A.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),N.prototype.deselect.call(this)},A.prototype.dblClick=function(C,F){N.prototype.dblClick.call(this,C,F),this.showTextEditor()},A.prototype.setColor=function(C){this.textElement&&R.setAttributes(this.textElement,[["fill",C]]),this.color=C,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(C)},A.prototype.setFont=function(C){this.textElement&&R.setAttributes(this.textElement,[["font-family",C]]),this.fontFamily=C,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},A.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},A.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var C=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},N.prototype.getState.call(this));return C.typeName=A.typeName,C},A.prototype.restoreState=function(C){var F=C;this.color=F.color,this.fontFamily=F.fontFamily,this.padding=F.padding,this.text=F.text,this.createVisual(),N.prototype.restoreState.call(this,C),this.setSize()},A.prototype.scale=function(C,F){N.prototype.scale.call(this,C,F),this.setSize(),this.sizeText(),this.positionTextEditor()},A.typeName="TextMarker",A.title="Text marker",A.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>',A}(v),y=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||this;return P.color="transparent",P.lineWidth=3,P.drawing=!1,P.pixelRatio=1,P.color=G.defaultColor,P.lineWidth=G.defaultStrokeWidth,P.pixelRatio=G.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 l("Color",G.defaultColorSet,G.defaultColor),P.colorPanel.onColorChanged=P.setColor,P.lineWidthPanel=new p("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),P.lineWidthPanel.onWidthChanged=P.setLineWidth,P}return B(A,N),A.prototype.ownsTarget=function(C){return!(!N.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.drawingImage)},A.prototype.createVisual=function(){this.visual=R.createGroup(),this.drawingImage=R.createImage(),this.visual.appendChild(this.drawingImage);var C=R.createTransform();this.visual.transform.baseVal.appendItem(C),this.addMarkerVisualToContainer(this.visual)},A.prototype.pointerDown=function(C,F){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(C.x,C.y),this.drawing=!0):N.prototype.pointerDown.call(this,C,F)},A.prototype.manipulate=function(C){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(C.x,C.y),this.canvasContext.stroke()):N.prototype.manipulate.call(this,C)},A.prototype.resize=function(C){N.prototype.resize.call(this,C),R.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),R.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},A.prototype.pointerUp=function(C){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):N.prototype.pointerUp.call(this,C)},A.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)},A.prototype.select=function(){this.state==="creating"&&this.finishCreation(),N.prototype.select.call(this)},A.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),N.prototype.deselect.call(this)},A.prototype.finishCreation=function(){for(var C=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),F=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],G=F[0],P=F[1],oe=F[2],we=F[3],Re=!1,ee=0;ee<this.canvasElement.height;ee++)for(var ce=0;ce<this.canvasElement.width;ce++)C.data[ee*this.canvasElement.width*4+4*ce+3]>0&&(Re=!0,ee<P&&(P=ee),ce<G&&(G=ce),ee>we&&(we=ee),ce>oe&&(oe=ce));if(Re){this.left=G/this.pixelRatio,this.top=P/this.pixelRatio,this.width=(oe-G)/this.pixelRatio,this.height=(we-P)/this.pixelRatio;var Ee=document.createElement("canvas");Ee.width=oe-G,Ee.height=we-P,Ee.getContext("2d").putImageData(this.canvasContext.getImageData(G,P,oe-G,we-P),0,0),this.drawingImgUrl=Ee.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},A.prototype.setDrawingImage=function(){R.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),R.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},A.prototype.setColor=function(C){this.color=C,this.colorChanged(C)},A.prototype.setLineWidth=function(C){this.lineWidth=C},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var C=Object.assign({drawingImgUrl:this.drawingImgUrl},N.prototype.getState.call(this));return C.typeName=A.typeName,C},A.prototype.restoreState=function(C){this.createVisual(),N.prototype.restoreState.call(this,C),this.drawingImgUrl=C.drawingImgUrl,this.setDrawingImage()},A.prototype.scale=function(C,F){N.prototype.scale.call(this,C,F),this.setDrawingImage()},A.typeName="FreehandMarker",A.title="Freehand marker",A.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>',A}(v),T=function(N){function A(C,F,G){var P=N.call(this,C,G||'<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=F,P.setCurrentType=P.setCurrentType.bind(P),P}return B(A,N),A.prototype.getUi=function(){var C=this,F=document.createElement("div");F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2";for(var G=function(we){var Re="both";switch(we){case 0:Re="both";break;case 1:Re="start";break;case 2:Re="end";break;case 3:Re="none"}var ee=document.createElement("div");if(ee.style.display="flex",ee.style.flexGrow="2",ee.style.alignItems="center",ee.style.justifyContent="space-between",ee.style.padding="5px",ee.style.borderWidth="2px",ee.style.borderStyle="solid",ee.style.borderColor=Re===P.currentType?P.uiStyleSettings.toolboxAccentColor:"transparent",ee.addEventListener("click",function(){C.setCurrentType(Re,ee)}),F.appendChild(ee),Re==="both"||Re==="start"){var ce=document.createElement("div");ce.style.display="flex",ce.style.alignItems="center",ce.style.minHeight="20px",ce.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(P.uiStyleSettings!==void 0?P.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,ce.style.marginLeft="5px",ee.appendChild(ce)}var Ee=document.createElement("div");Ee.style.display="flex",Ee.style.alignItems="center",Ee.style.minHeight="20px",Ee.style.flexGrow="2";var Ae=document.createElement("hr");if(Ae.style.minWidth="20px",Ae.style.border="0px",Ae.style.borderTop="3px solid "+(P.uiStyleSettings!==void 0?P.uiStyleSettings.toolboxColor:"#eeeeee"),Ae.style.flexGrow="2",Ee.appendChild(Ae),ee.appendChild(Ee),Re==="both"||Re==="end"){var Me=document.createElement("div");Me.style.display="flex",Me.style.alignItems="center",Me.style.minHeight="20px",Me.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>`,Me.style.marginRight="5px",ee.appendChild(Me)}P.typeBoxes.push(ee)},P=this,oe=0;oe<4;oe++)G(oe);return F},A.prototype.setCurrentType=function(C,F){var G=this;this.currentType=C,this.typeBoxes.forEach(function(P){P.style.borderColor=P===F?G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},A}(r),M=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||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 T("Arrow type","end"),P.arrowTypePanel.onArrowTypeChanged=P.setArrowType,P}return B(A,N),A.prototype.ownsTarget=function(C){return!(!N.prototype.ownsTarget.call(this,C)&&C!==this.arrow1&&C!==this.arrow2)},A.prototype.getArrowPoints=function(C,F){var G=this.arrowBaseWidth+2*this.strokeWidth,P=this.arrowBaseHeight+2*this.strokeWidth;return C-G/2+","+(F+P/2)+" "+C+","+(F-P/2)+" "+(C+G/2)+","+(F+P/2)},A.prototype.createTips=function(){this.arrow1=R.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(R.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=R.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(R.createTransform()),this.visual.appendChild(this.arrow2)},A.prototype.pointerDown=function(C,F){N.prototype.pointerDown.call(this,C,F),this.state==="creating"&&this.createTips()},A.prototype.adjustVisual=function(){if(N.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",R.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),R.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var C=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),F=this.arrow1.transform.baseVal.getItem(0);F.setRotate(C,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(F,0);var G=this.arrow2.transform.baseVal.getItem(0);G.setRotate(C+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(G,0)}},A.prototype.setArrowType=function(C){this.arrowType=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var C=Object.assign({arrowType:this.arrowType},N.prototype.getState.call(this));return C.typeName=A.typeName,C},A.prototype.restoreState=function(C){N.prototype.restoreState.call(this,C);var F=C;this.arrowType=F.arrowType,this.createTips(),this.adjustVisual()},A.typeName="ArrowMarker",A.title="Arrow marker",A.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',A}(m),L=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||this;return P.fillColor=G.defaultFillColor,P.strokeWidth=0,P.fillPanel=new l("Color",G.defaultColorSet,G.defaultFillColor),P.fillPanel.onColorChanged=P.setFillColor,P}return B(A,N),Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var C=N.prototype.getState.call(this);return C.typeName=A.typeName,C},A.typeName="CoverMarker",A.title="Cover marker",A.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',A}(f),x=function(N){function A(C,F,G,P){var oe=N.call(this,C,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 oe.opacities=[],oe.opacityBoxes=[],oe.opacities=F,oe.currentOpacity=G,oe.setCurrentOpacity=oe.setCurrentOpacity.bind(oe),oe}return B(A,N),A.prototype.getUi=function(){var C=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",F.style.justifyContent="space-between",this.opacities.forEach(function(G){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=G===C.currentOpacity?C.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){C.setCurrentOpacity(G,P)}),F.appendChild(P);var oe=document.createElement("div");oe.innerText=100*G+"%",P.appendChild(oe),C.opacityBoxes.push(P)}),F},A.prototype.setCurrentOpacity=function(C,F){var G=this;this.currentOpacity=C,this.opacityBoxes.forEach(function(P){P.style.borderColor=P===F?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},A}(r),D=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||this;return P.setOpacity=P.setOpacity.bind(P),P.fillColor=G.defaultHighlightColor,P.strokeWidth=0,P.opacity=G.defaultHighlightOpacity,P.fillPanel=new l("Color",G.defaultColorSet,P.fillColor),P.fillPanel.onColorChanged=P.setFillColor,P.opacityPanel=new x("Opacity",G.defaultOpacitySteps,P.opacity),P.opacityPanel.onOpacityChanged=P.setOpacity,P}return B(A,N),A.prototype.setOpacity=function(C){this.opacity=C,this.visual&&R.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var C=N.prototype.getState.call(this);return C.typeName=A.typeName,C},A.typeName="HighlightMarker",A.title="Highlight marker",A.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>',A}(L),j='<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>',I=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||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=G.defaultStrokeColor,P.bgColor=G.defaultFillColor,P.fontFamily=G.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 l("Text color",G.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 l("Fill color",G.defaultColorSet,P.bgColor,j),P.bgColorPanel.onColorChanged=P.setBgColor,P.fontFamilyPanel=new u("Font",G.defaultFontFamilies,G.defaultFontFamily),P.fontFamilyPanel.onFontChanged=P.setFont,P.tipGrip=new i,P.tipGrip.visual.transform.baseVal.appendItem(R.createTransform()),P.controlBox.appendChild(P.tipGrip.visual),P}return B(A,N),A.prototype.ownsTarget=function(C){return N.prototype.ownsTarget.call(this,C)||this.tipGrip.ownsTarget(C)||this.tip===C},A.prototype.createTip=function(){R.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=R.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},A.prototype.pointerDown=function(C,F){this.state==="new"&&N.prototype.pointerDown.call(this,C,F),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(F)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):N.prototype.pointerDown.call(this,C,F)},A.prototype.pointerUp=function(C){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,N.prototype.pointerUp.call(this,C);else{var F=this.state==="creating";N.prototype.pointerUp.call(this,C),this.setTipPoints(F),this.positionTip()}},A.prototype.manipulate=function(C){if(this.tipMoving){var F=this.unrotatePoint(C);this.tipPosition={x:F.x-this.manipulationStartLeft,y:F.y-this.manipulationStartTop},this.positionTip()}else N.prototype.manipulate.call(this,C)},A.prototype.setBgColor=function(C){this.bgRectangle&&this.tip&&(R.setAttributes(this.bgRectangle,[["fill",C]]),R.setAttributes(this.tip,[["fill",C]])),this.bgColor=C,this.fillColorChanged(C)},A.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},A.prototype.setTipPoints=function(C){C===void 0&&(C=!1);var F=Math.min(this.height/2,15),G=this.height/5;C&&(this.tipPosition={x:F+G/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))?(G=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:F,y:0},this.tipBase2Position={x:F+G,y:0}):(this.tipBase1Position={x:0,y:F},this.tipBase2Position={x:0,y:F+G}):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))?(G=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-F-G,y:0},this.tipBase2Position={x:this.width-F,y:0}):(this.tipBase1Position={x:this.width,y:F},this.tipBase2Position={x:this.width,y:F+G}):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))?(G=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-F-G,y:this.height},this.tipBase2Position={x:this.width-F,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-F-G},this.tipBase2Position={x:this.width,y:this.height-F}):P<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(G=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:F,y:this.height},this.tipBase2Position={x:F+G,y:this.height}):(this.tipBase1Position={x:0,y:this.height-F},this.tipBase2Position={x:0,y:this.height-F-G})},A.prototype.resize=function(C){N.prototype.resize.call(this,C),this.positionTip()},A.prototype.positionTip=function(){R.setAttributes(this.tip,[["points",this.getTipPoints()]]);var C=this.tipGrip.visual.transform.baseVal.getItem(0);C.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(C,0)},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),A.prototype.select=function(){this.positionTip(),N.prototype.select.call(this)},A.prototype.getState=function(){var C=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},N.prototype.getState.call(this));return C.typeName=A.typeName,C},A.prototype.restoreState=function(C){var F=C;this.bgColor=F.bgColor,this.tipPosition=F.tipPosition,N.prototype.restoreState.call(this,C),this.createTip(),this.setTipPoints()},A.prototype.scale=function(C,F){N.prototype.scale.call(this,C,F),this.tipPosition={x:this.tipPosition.x*C,y:this.tipPosition.y*F},this.positionTip()},A.typeName="CalloutMarker",A.title="Callout marker",A.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>',A}(_),W=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||this;return P.fillColor="transparent",P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.opacity=1,P.strokeColor=G.defaultColor,P.strokeWidth=G.defaultStrokeWidth,P.strokeDasharray=G.defaultStrokeDasharray,P.fillColor=G.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 l("Line color",w(G.defaultColorSet,["transparent"]),G.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.fillPanel=new l("Fill color",w(G.defaultColorSet,["transparent"]),P.fillColor,j),P.fillPanel.onColorChanged=P.setFillColor,P.strokeWidthPanel=new p("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new E("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P.opacityPanel=new x("Opacity",G.defaultOpacitySteps,P.opacity),P.opacityPanel.onOpacityChanged=P.setOpacity,P}return B(A,N),A.prototype.ownsTarget=function(C){return!(!N.prototype.ownsTarget.call(this,C)&&C!==this.visual)},A.prototype.createVisual=function(){this.visual=R.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)},A.prototype.pointerDown=function(C,F){N.prototype.pointerDown.call(this,C,F),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},A.prototype.manipulate=function(C){N.prototype.manipulate.call(this,C)},A.prototype.resize=function(C){N.prototype.resize.call(this,C),this.setSize()},A.prototype.setSize=function(){N.prototype.setSize.call(this),R.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},A.prototype.pointerUp=function(C){N.prototype.pointerUp.call(this,C),this.setSize()},A.prototype.setStrokeColor=function(C){this.strokeColor=C,this.visual&&R.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(C),this.stateChanged()},A.prototype.setFillColor=function(C){this.fillColor=C,this.visual&&R.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(C),this.stateChanged()},A.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.visual&&R.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},A.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.visual&&R.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},A.prototype.setOpacity=function(C){this.opacity=C,this.visual&&R.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var C=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},N.prototype.getState.call(this));return C.typeName=A.typeName,C},A.prototype.restoreState=function(C){var F=C;this.fillColor=F.fillColor,this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.opacity=F.opacity,this.createVisual(),N.prototype.restoreState.call(this,C),this.setSize()},A.prototype.scale=function(C,F){N.prototype.scale.call(this,C,F),this.setSize()},A.typeName="EllipseMarker",A.title="Ellipse marker",A.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>',A}(v),Q=function(N){function A(C,F,G){return N.call(this,C,F,G)||this}return B(A,N),Object.defineProperty(A.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),A.prototype.ownsTarget=function(C){return!(!N.prototype.ownsTarget.call(this,C)&&C!==this.tip1&&C!==this.tip2)},A.prototype.createTips=function(){this.tip1=R.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(R.createTransform()),this.visual.appendChild(this.tip1),this.tip2=R.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(R.createTransform()),this.visual.appendChild(this.tip2)},A.prototype.pointerDown=function(C,F){N.prototype.pointerDown.call(this,C,F),this.state==="creating"&&this.createTips()},A.prototype.adjustVisual=function(){if(N.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(R.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()]]),R.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 C=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),F=this.tip1.transform.baseVal.getItem(0);F.setRotate(C,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(F,0);var G=this.tip2.transform.baseVal.getItem(0);G.setRotate(C+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(G,0)}},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var C=N.prototype.getState.call(this);return C.typeName=A.typeName,C},A.prototype.restoreState=function(C){N.prototype.restoreState.call(this,C),this.createTips(),this.adjustVisual()},A.typeName="MeasurementMarker",A.title="Measurement marker",A.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>',A}(m),fe=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||this;return P.strokePanel.colors=G.defaultColorSet,P.fillColor="transparent",P}return B(A,N),Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var C=N.prototype.getState.call(this);return C.typeName=A.typeName,C},A.typeName="EllipseFrameMarker",A.title="Ellipse frame marker",A.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>',A}(W),de=function(){function N(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(N.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),N.prototype.addUndoStep=function(A){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(A)||(this.undoStack.push(A),JSON.stringify(this.lastRedoStep)!==JSON.stringify(A)&&this.redoStack.splice(0,this.redoStack.length))},N.prototype.replaceLastUndoStep=function(A){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=A)},N.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},N.prototype.undo=function(){if(this.undoStack.length>1){var A=this.undoStack.pop();return A!==void 0&&this.redoStack.push(A),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},N.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},N}(),Oe=function(N){function A(C,F,G){var P=N.call(this,C,F,G)||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=G.defaultColor,P.strokeWidth=G.defaultStrokeWidth,P.strokeDasharray=G.defaultStrokeDasharray,P.strokePanel=new l("Line color",G.defaultColorSet,G.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new p("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new E("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return B(A,N),A.prototype.ownsTarget=function(C){return!(!N.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorCurve&&C!==this.visibleCurve&&!this.curveGrip.ownsTarget(C))},A.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},A.prototype.createVisual=function(){this.visual=R.createGroup(),this.selectorCurve=R.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=R.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)},A.prototype.pointerDown=function(C,F){N.prototype.pointerDown.call(this,C,F),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=C.x,this.curveY=C.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(F)&&(this.activeGrip=this.curveGrip,this._state="resize")},A.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),R.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),R.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),R.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},A.prototype.setupControlBox=function(){N.prototype.setupControlBox.call(this),this.curveControlLine1=R.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=R.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)},A.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,N.prototype.addControlGrips.call(this)},A.prototype.positionGrips=function(){N.prototype.positionGrips.call(this);var C=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-C/2,this.curveY-C/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},A.prototype.manipulate=function(C){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+C.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+C.y-this.manipulationStartY),N.prototype.manipulate.call(this,C)},A.prototype.resize=function(C){this.activeGrip===this.curveGrip&&(this.curveX=C.x,this.curveY=C.y),N.prototype.resize.call(this,C),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},A.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},A.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},A.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual()},A.prototype.scale=function(C,F){this.curveX=this.curveX*C,this.curveY=this.curveY*F,N.prototype.scale.call(this,C,F)},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var C=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},N.prototype.getState.call(this));return C.typeName=A.typeName,C},A.prototype.restoreState=function(C){N.prototype.restoreState.call(this,C);var F=C;this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.curveX=F.curveX,this.curveY=F.curveY,this.createVisual(),this.adjustVisual()},A.typeName="CurveMarker",A.title="Curve marker",A.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>',A}(c),Se=function(){function N(A,C){C===void 0&&(C=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=A,this.cancelable=C}return Object.defineProperty(N.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),N.prototype.preventDefault=function(){this._defaultPrevented=!0},N}(),Ie=function(N){function A(C,F,G){var P=N.call(this,C,!1)||this;return P.dataUrl=F,P.state=G,P}return B(A,N),A}(Se),Le=function(N){function A(C,F,G){G===void 0&&(G=!1);var P=N.call(this,C,G)||this;return P.marker=F,P}return B(A,N),A}(Se),Ne=function(){function N(){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 N.prototype.addEventListener=function(A,C){this[A].push(C)},N.prototype.removeEventListener=function(A,C){var F=this[A].indexOf(C);F>-1&&this[A].splice(F,1)},N}(),be=function(){function N(A){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new g,this._isOpen=!1,this.undoRedoManager=new de,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 Ne,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=N.instanceCounter++,this.styles=new S(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=A,this.targetRoot=document.body,this.width=A.clientWidth,this.height=A.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(N.prototype,"ALL_MARKER_TYPES",{get:function(){return[b,y,M,_,fe,W,D,I,Q,L,m,Oe]},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[b,y,M,_,W,D,I]},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"BASIC_MARKER_TYPES",{get:function(){return[b,y,M,_,D]},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(A){var C=this;this._availableMarkerTypes.splice(0),A.forEach(function(F){if(typeof F=="string"){var G=C.ALL_MARKER_TYPES.find(function(P){return P.typeName===F});G!==void 0&&C._availableMarkerTypes.push(G)}else C._availableMarkerTypes.push(F)})},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(A){this._zoomLevel=A,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(N.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),N.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),H.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},N.prototype.show=function(){var A=this;this.styles.styleSheetRoot===void 0&&e.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=e.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(C){return C(new Se(A))})},N.prototype.render=function(){return O(this,void 0,void 0,function(){var A;return k(this,function(C){switch(C.label){case 0:return this.setCurrentMarker(),(A=new U).naturalSize=this.renderAtNaturalSize,A.imageType=this.renderImageType,A.imageQuality=this.renderImageQuality,A.markersOnly=this.renderMarkersOnly,A.width=this.renderWidth,A.height=this.renderHeight,[4,A.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return C.sent(),[4,A.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,C.sent()]}})})},N.prototype.close=function(A){var C=this;if(A===void 0&&(A=!1),this.isOpen){var F=!1;A||this.eventListeners.beforeclose.forEach(function(G){var P=new Se(C,!0);G(P),P.defaultPrevented&&(F=!0)}),F||(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(G){return G(new Se(C))}),this.detachEvents(),this._isOpen=!1)}},N.prototype.addMarkersToToolbar=function(){for(var A,C=[],F=0;F<arguments.length;F++)C[F]=arguments[F];(A=this._availableMarkerTypes).push.apply(A,C)},N.prototype.addRenderEventListener=function(A){this.addEventListener("render",function(C){A(C.dataUrl,C.state)})},N.prototype.removeRenderEventListener=function(A){},N.prototype.addCloseEventListener=function(A){this.addEventListener("close",function(){A()})},N.prototype.removeCloseEventListener=function(A){},N.prototype.setupResizeObserver=function(){var A=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){A.resize(A.target.clientWidth,A.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return A.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},N.prototype.onPopupTargetResize=function(){var A=1*this.target.clientWidth/this.target.clientHeight,C=this.editorCanvas.clientWidth/A>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*A:this.editorCanvas.clientWidth,F=C<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/A;this.resize(C,F)},N.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},N.prototype.resize=function(A,C){this._isResizing=!0;var F=A/this.imageWidth,G=C/this.imageHeight;this.imageWidth=Math.round(A),this.imageHeight=Math.round(C),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(F,G),this._isResizing=!1},N.prototype.scaleMarkers=function(A,C){var F,G=this;this._currentMarker&&this._currentMarker instanceof _?this._currentMarker.scale(A,C):(F=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(P){P!==G._currentMarker&&P.scale(A,C)}),F!==void 0&&this.setCurrentMarker(F)},N.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"},N.prototype.setTopLeft=function(){var A=this.editingTarget.getBoundingClientRect(),C=this.editorCanvas.getBoundingClientRect();this.left=A.left-C.left,this.top=A.top-C.top},N.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)},N.prototype.addDefs=function(){for(var A,C=[],F=0;F<arguments.length;F++)C[F]=arguments[F];this.defs=R.createDefs(),this.addDefsToImage(),(A=this.defs).append.apply(A,C)},N.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},N.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)},N.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},N.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},N.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)},N.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},N.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)},N.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 A=document.createElement("a");A.href="https://markerjs.com/",A.target="_blank",A.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>',A.title="Powered by marker.js",A.style.display="grid",A.style.alignItems="center",A.style.justifyItems="center",A.style.padding="3px",A.style.width="20px",A.style.height="20px",this.logoUI.appendChild(A),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},N.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")},N.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"},N.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},N.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 A=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=A+"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 o(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 a(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},N.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},N.prototype.removeMarker=function(A){this.markerImage.removeChild(A.container),this.markers.indexOf(A)>-1&&this.markers.splice(this.markers.indexOf(A),1),A.dispose()},N.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())},N.prototype.toolbarButtonClicked=function(A,C){if(A==="marker"&&C!==void 0)this.createNewMarker(C);else if(A==="action")switch(C){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},N.prototype.deleteSelectedMarker=function(){var A=this;if(this._currentMarker!==void 0){var C=!1;if(this.eventListeners.markerbeforedelete.forEach(function(G){var P=new Le(A,A._currentMarker,!0);G(P),P.defaultPrevented&&(C=!0)}),!C){var F=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(G){return G(new Le(A,F))})}}},N.prototype.clear=function(){var A=this,C=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(oe){var we=new Le(A,void 0,!0);oe(we),we.defaultPrevented&&(C=!0)}),!C)){this.setCurrentMarker();for(var F=function(oe){var we=G.markers[oe];G.setCurrentMarker(G.markers[oe]),G._currentMarker.dispose(),G.markerImage.removeChild(G._currentMarker.container),G.markers.splice(G.markers.indexOf(G._currentMarker),1),G.eventListeners.markerdelete.forEach(function(Re){return Re(new Le(A,we))})},G=this,P=this.markers.length-1;P>=0;P--)F(P);this.addUndoStep()}},Object.defineProperty(N.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),N.prototype.showNotesEditor=function(){var A;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=(A=this._currentMarker.notes)!==null&&A!==void 0?A:"",this.overlayContainer.appendChild(this.notesArea))},N.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)},N.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},N.prototype.addUndoStep=function(){var A=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var C=this.getState(),F=this.undoRedoManager.getLastUndoStep();if(!F||F.width===C.width&&F.height===C.height){var G=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(C),G<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(P){return P(new Se(A))})}else this.undoRedoManager.replaceLastUndoStep(C),this.eventListeners.statechange.forEach(function(P){return P(new Se(A))})}},N.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},N.prototype.undoStep=function(){var A=this,C=this.undoRedoManager.undo();C!==void 0&&(this.restoreState(C),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(F){return F(new Se(A))}))},N.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},N.prototype.redoStep=function(){var A=this,C=this.undoRedoManager.redo();C!==void 0&&(this.restoreState(C),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(F){return F(new Se(A))}))},N.prototype.stepZoom=function(){var A=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=A<this.zoomSteps.length-1?this.zoomSteps[A+1]:this.zoomSteps[0]},N.prototype.panTo=function(A){this.contentDiv.scrollBy({left:this.prevPanPoint.x-A.x,top:this.prevPanPoint.y-A.y}),this.prevPanPoint=A},N.prototype.startRenderAndClose=function(){return O(this,void 0,void 0,function(){var A,C,F=this;return k(this,function(G){switch(G.label){case 0:return[4,this.render()];case 1:return A=G.sent(),C=this.getState(),this.eventListeners.render.forEach(function(P){return P(new Ie(F,A,C))}),this.close(!0),[2]}})})},N.prototype.getState=function(A){A===!0&&this.setCurrentMarker();var C={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(F){return C.markers.push(F.getState())}),C},N.prototype.restoreState=function(A){var C=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);A.markers.forEach(function(F){var G=C._availableMarkerTypes.find(function(oe){return oe.typeName===F.typeName});if(G!==void 0){var P=C.addNewMarker(G);P.restoreState(F),C.markers.push(P)}}),A.width&&A.height&&(A.width!==this.imageWidth||A.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/A.width,this.imageHeight/A.height),this.eventListeners.restorestate.forEach(function(F){return F(new Se(C))})},N.prototype.addNewMarker=function(A){var C=R.createGroup();return this.markerImage.appendChild(C),new A(C,this.overlayContainer,this.settings)},N.prototype.createNewMarker=function(A){var C,F=this;(C=typeof A=="string"?this._availableMarkerTypes.find(function(G){return G.typeName===A}):A)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(C),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(C.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(G){return G(new Le(F,F._currentMarker))}))},N.prototype.markerCreated=function(A){var C=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(A),this.setCurrentMarker(A),A instanceof y&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(y):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(F){return F(new Le(C,C._currentMarker))})},N.prototype.colorChanged=function(A){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=A,this.settings.defaultStrokeColor=A)},N.prototype.fillColorChanged=function(A){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=A)},N.prototype.markerStateChanged=function(A){var C=this;this.eventListeners.markerchange.forEach(function(F){return F(new Le(C,A))})},N.prototype.setCurrentMarker=function(A){var C=this;this._currentMarker!==A&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(F){return F(new Le(C,C._currentMarker))})),this._currentMarker=A,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(F){return F(new Le(C,C._currentMarker))}))},N.prototype.onPointerDown=function(A){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||A.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var C=this.markers.find(function(F){return F.ownsTarget(A.target)});C!==void 0?(this.setCurrentMarker(C),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(A.clientX,A.clientY),A.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:A.clientX,y:A.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(A.clientX,A.clientY))},N.prototype.onDblClick=function(A){if(this._isFocused||this.focus(),this.mode==="select"){var C=this.markers.find(function(F){return F.ownsTarget(A.target)});C!==void 0&&C!==this._currentMarker&&this.setCurrentMarker(C),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(A.clientX,A.clientY),A.target):this.setCurrentMarker()}},N.prototype.onPointerMove=function(A){this.touchPoints!==1&&A.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||A.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(A.clientX,A.clientY)):this.zoomLevel>1&&this.panTo({x:A.clientX,y:A.clientY}))},N.prototype.onPointerUp=function(A){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(A.clientX,A.clientY)),this.isDragging=!1,this.addUndoStep()},N.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},N.prototype.onKeyUp=function(A){this._currentMarker===void 0||this.notesArea!==void 0||A.key!=="Delete"&&A.key!=="Backspace"||this.deleteSelectedMarker()},N.prototype.clientToLocalCoordinates=function(A,C){var F=this.markerImage.getBoundingClientRect();return{x:(A-F.left)/this.zoomLevel,y:(C-F.top)/this.zoomLevel}},N.prototype.onWindowResize=function(){this.positionUI()},N.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var A=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=A+"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()},N.prototype.addLicenseKey=function(A){H.addKey(A)},N.prototype.addEventListener=function(A,C){this.eventListeners.addEventListener(A,C)},N.prototype.removeEventListener=function(A,C){this.eventListeners.removeEventListener(A,C)},N.prototype.renderState=function(A){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(A),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(N.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),N.prototype.focus=function(){var A=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(C){return C(new Se(A))}))},N.prototype.blur=function(){var A=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(C){return C(new Se(A))}))},N.instanceCounter=0,N}()},T8No:function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return H}),$.d(ye,"e",function(){return U}),$.d(ye,"c",function(){return m}),$.d(ye,"b",function(){return u}),$.d(ye,"d",function(){return _}),$.d(ye,"f",function(){return M});var ae=$("MNsG"),B=$("N0LK"),O=$("Cg/j");let k=ae.k||"";const w=new Map;w.set("false",!1),w.set("true",!0),w.set("isMac",ae.f),w.set("isLinux",ae.d),w.set("isWindows",ae.i),w.set("isWeb",ae.h),w.set("isMacNative",ae.f&&!ae.h),w.set("isEdge",k.indexOf("Edg/")>=0),w.set("isFirefox",k.indexOf("Firefox")>=0),w.set("isChrome",k.indexOf("Chrome")>=0),w.set("isSafari",k.indexOf("Safari")>=0);const R=Object.prototype.hasOwnProperty;class H{static has(x){return h.create(x)}static equals(x,D){return o.create(x,D)}static regex(x,D){return p.create(x,D)}static not(x){return s.create(x)}static and(...x){return g.create(x,null)}static or(...x){return c.create(x,null,!0)}static deserialize(x,D=!1){return x?this._deserializeOrExpression(x,D):void 0}static _deserializeOrExpression(x,D){let j=x.split("||");return c.create(j.map(I=>this._deserializeAndExpression(I,D)),null,!0)}static _deserializeAndExpression(x,D){let j=x.split("&&");return g.create(j.map(I=>this._deserializeOne(I,D)),null)}static _deserializeOne(x,D){if(x=x.trim(),x.indexOf("!=")>=0){let j=x.split("!=");return l.create(j[0].trim(),this._deserializeValue(j[1],D))}if(x.indexOf("==")>=0){let j=x.split("==");return o.create(j[0].trim(),this._deserializeValue(j[1],D))}if(x.indexOf("=~")>=0){let j=x.split("=~");return p.create(j[0].trim(),this._deserializeRegexValue(j[1],D))}if(x.indexOf(" in ")>=0){let j=x.split(" in ");return a.create(j[0].trim(),j[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(x)){const j=x.split(">=");return t.create(j[0].trim(),j[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(x)){const j=x.split(">");return i.create(j[0].trim(),j[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(x)){const j=x.split("<=");return f.create(j[0].trim(),j[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(x)){const j=x.split("<");return v.create(j[0].trim(),j[1].trim())}return/^\!\s*/.test(x)?s.create(x.substr(1).trim()):h.create(x)}static _deserializeValue(x,D){if(x=x.trim(),x==="true")return!0;if(x==="false")return!1;let j=/^'([^']*)'$/.exec(x);return j?j[1].trim():x}static _deserializeRegexValue(x,D){if(Object(B.C)(x)){if(D)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let j=x.indexOf("/"),I=x.lastIndexOf("/");if(j===I||j<0){if(D)throw new Error(`bad regexp-value '${x}', missing /-enclosure`);return console.warn(`bad regexp-value '${x}', missing /-enclosure`),null}let W=x.slice(j+1,I),Q=x[I+1]==="i"?"i":"";try{return new RegExp(W,Q)}catch(fe){if(D)throw new Error(`bad regexp-value '${x}', parse error: ${fe}`);return console.warn(`bad regexp-value '${x}', parse error: ${fe}`),null}}}function U(x,D){const j=x?x.substituteConstants():void 0,I=D?D.substituteConstants():void 0;return!j&&!I?!0:!j||!I?!1:j.equals(I)}function e(x,D){return x.cmp(D)}class S{constructor(){this.type=0}cmp(x){return this.type-x.type}equals(x){return x.type===this.type}substituteConstants(){return this}evaluate(x){return!1}serialize(){return"false"}keys(){return[]}negate(){return d.INSTANCE}}S.INSTANCE=new S;class d{constructor(){this.type=1}cmp(x){return this.type-x.type}equals(x){return x.type===this.type}substituteConstants(){return this}evaluate(x){return!0}serialize(){return"true"}keys(){return[]}negate(){return S.INSTANCE}}d.INSTANCE=new d;class h{constructor(x,D){this.key=x,this.negated=D,this.type=2}static create(x,D=null){const j=w.get(x);return typeof j=="boolean"?j?d.INSTANCE:S.INSTANCE:new h(x,D)}cmp(x){return x.type!==this.type?this.type-x.type:y(this.key,x.key)}equals(x){return x.type===this.type?this.key===x.key:!1}substituteConstants(){const x=w.get(this.key);return typeof x=="boolean"?x?d.INSTANCE:S.INSTANCE:this}evaluate(x){return!!x.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=s.create(this.key,this)),this.negated}}class o{constructor(x,D,j){this.key=x,this.value=D,this.negated=j,this.type=4}static create(x,D,j=null){if(typeof D=="boolean")return D?h.create(x,j):s.create(x,j);const I=w.get(x);if(typeof I=="boolean"){const W=I?"true":"false";return D===W?d.INSTANCE:S.INSTANCE}return new o(x,D,j)}cmp(x){return x.type!==this.type?this.type-x.type:T(this.key,this.value,x.key,x.value)}equals(x){return x.type===this.type?this.key===x.key&&this.value===x.value:!1}substituteConstants(){const x=w.get(this.key);if(typeof x=="boolean"){const D=x?"true":"false";return this.value===D?d.INSTANCE:S.INSTANCE}return this}evaluate(x){return x.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=l.create(this.key,this.value,this)),this.negated}}class a{constructor(x,D){this.key=x,this.valueKey=D,this.type=10,this.negated=null}static create(x,D){return new a(x,D)}cmp(x){return x.type!==this.type?this.type-x.type:T(this.key,this.valueKey,x.key,x.valueKey)}equals(x){return x.type===this.type?this.key===x.key&&this.valueKey===x.valueKey:!1}substituteConstants(){return this}evaluate(x){const D=x.getValue(this.valueKey),j=x.getValue(this.key);return Array.isArray(D)?D.indexOf(j)>=0:typeof j=="string"&&typeof D=="object"&&D!==null?R.call(D,j):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=r.create(this)),this.negated}}class r{constructor(x){this._actual=x,this.type=11}static create(x){return new r(x)}cmp(x){return x.type!==this.type?this.type-x.type:this._actual.cmp(x._actual)}equals(x){return x.type===this.type?this._actual.equals(x._actual):!1}substituteConstants(){return this}evaluate(x){return!this._actual.evaluate(x)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class l{constructor(x,D,j){this.key=x,this.value=D,this.negated=j,this.type=5}static create(x,D,j=null){if(typeof D=="boolean")return D?s.create(x,j):h.create(x,j);const I=w.get(x);if(typeof I=="boolean"){const W=I?"true":"false";return D===W?S.INSTANCE:d.INSTANCE}return new l(x,D,j)}cmp(x){return x.type!==this.type?this.type-x.type:T(this.key,this.value,x.key,x.value)}equals(x){return x.type===this.type?this.key===x.key&&this.value===x.value:!1}substituteConstants(){const x=w.get(this.key);if(typeof x=="boolean"){const D=x?"true":"false";return this.value===D?S.INSTANCE:d.INSTANCE}return this}evaluate(x){return x.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=o.create(this.key,this.value,this)),this.negated}}class s{constructor(x,D){this.key=x,this.negated=D,this.type=3}static create(x,D=null){const j=w.get(x);return typeof j=="boolean"?j?S.INSTANCE:d.INSTANCE:new s(x,D)}cmp(x){return x.type!==this.type?this.type-x.type:y(this.key,x.key)}equals(x){return x.type===this.type?this.key===x.key:!1}substituteConstants(){const x=w.get(this.key);return typeof x=="boolean"?x?S.INSTANCE:d.INSTANCE:this}evaluate(x){return!x.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=h.create(this.key,this)),this.negated}}function n(x,D){if(typeof x=="string"){const j=parseFloat(x);isNaN(j)||(x=j)}return typeof x=="string"||typeof x=="number"?D(x):S.INSTANCE}class i{constructor(x,D,j){this.key=x,this.value=D,this.negated=j,this.type=12}static create(x,D,j=null){return n(D,I=>new i(x,I,j))}cmp(x){return x.type!==this.type?this.type-x.type:T(this.key,this.value,x.key,x.value)}equals(x){return x.type===this.type?this.key===x.key&&this.value===x.value:!1}substituteConstants(){return this}evaluate(x){return typeof this.value=="string"?!1:parseFloat(x.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=f.create(this.key,this.value,this)),this.negated}}class t{constructor(x,D,j){this.key=x,this.value=D,this.negated=j,this.type=13}static create(x,D,j=null){return n(D,I=>new t(x,I,j))}cmp(x){return x.type!==this.type?this.type-x.type:T(this.key,this.value,x.key,x.value)}equals(x){return x.type===this.type?this.key===x.key&&this.value===x.value:!1}substituteConstants(){return this}evaluate(x){return typeof this.value=="string"?!1:parseFloat(x.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=v.create(this.key,this.value,this)),this.negated}}class v{constructor(x,D,j){this.key=x,this.value=D,this.negated=j,this.type=14}static create(x,D,j=null){return n(D,I=>new v(x,I,j))}cmp(x){return x.type!==this.type?this.type-x.type:T(this.key,this.value,x.key,x.value)}equals(x){return x.type===this.type?this.key===x.key&&this.value===x.value:!1}substituteConstants(){return this}evaluate(x){return typeof this.value=="string"?!1:parseFloat(x.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=t.create(this.key,this.value,this)),this.negated}}class f{constructor(x,D,j){this.key=x,this.value=D,this.negated=j,this.type=15}static create(x,D,j=null){return n(D,I=>new f(x,I,j))}cmp(x){return x.type!==this.type?this.type-x.type:T(this.key,this.value,x.key,x.value)}equals(x){return x.type===this.type?this.key===x.key&&this.value===x.value:!1}substituteConstants(){return this}evaluate(x){return typeof this.value=="string"?!1:parseFloat(x.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=i.create(this.key,this.value,this)),this.negated}}class p{constructor(x,D){this.key=x,this.regexp=D,this.type=7,this.negated=null}static create(x,D){return new p(x,D)}cmp(x){if(x.type!==this.type)return this.type-x.type;if(this.key<x.key)return-1;if(this.key>x.key)return 1;const D=this.regexp?this.regexp.source:"",j=x.regexp?x.regexp.source:"";return D<j?-1:D>j?1:0}equals(x){if(x.type===this.type){const D=this.regexp?this.regexp.source:"",j=x.regexp?x.regexp.source:"";return this.key===x.key&&D===j}return!1}substituteConstants(){return this}evaluate(x){let D=x.getValue(this.key);return this.regexp?this.regexp.test(D):!1}serialize(){const x=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${x}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=E.create(this)),this.negated}}class E{constructor(x){this._actual=x,this.type=8}static create(x){return new E(x)}cmp(x){return x.type!==this.type?this.type-x.type:this._actual.cmp(x._actual)}equals(x){return x.type===this.type?this._actual.equals(x._actual):!1}substituteConstants(){return this}evaluate(x){return!this._actual.evaluate(x)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function b(x){let D=null;for(let j=0,I=x.length;j<I;j++){const W=x[j].substituteConstants();if(x[j]!==W&&D===null){D=[];for(let Q=0;Q<j;Q++)D[Q]=x[Q]}D!==null&&(D[j]=W)}return D===null?x:D}class g{constructor(x,D){this.expr=x,this.negated=D,this.type=6}static create(x,D){return g._normalizeArr(x,D)}cmp(x){if(x.type!==this.type)return this.type-x.type;if(this.expr.length<x.expr.length)return-1;if(this.expr.length>x.expr.length)return 1;for(let D=0,j=this.expr.length;D<j;D++){const I=e(this.expr[D],x.expr[D]);if(I!==0)return I}return 0}equals(x){if(x.type===this.type){if(this.expr.length!==x.expr.length)return!1;for(let D=0,j=this.expr.length;D<j;D++)if(!this.expr[D].equals(x.expr[D]))return!1;return!0}return!1}substituteConstants(){const x=b(this.expr);return x===this.expr?this:g.create(x,this.negated)}evaluate(x){for(let D=0,j=this.expr.length;D<j;D++)if(!this.expr[D].evaluate(x))return!1;return!0}static _normalizeArr(x,D){const j=[];let I=!1;for(const W of x){if(!W)continue;if(W.type===1){I=!0;continue}if(W.type===0)return S.INSTANCE;if(W.type===6){j.push(...W.expr);continue}j.push(W)}if(j.length===0&&I)return d.INSTANCE;if(j.length===0)return;if(j.length===1)return j[0];j.sort(e);for(let W=1;W<j.length;W++)j[W-1].equals(j[W])&&(j.splice(W,1),W--);if(j.length===1)return j[0];for(;j.length>1;){const W=j[j.length-1];if(W.type!==9)break;j.pop();const Q=j.pop(),fe=j.length===0,de=c.create(W.expr.map(Oe=>g.create([Oe,Q],null)),null,fe);de&&(j.push(de),j.sort(e))}return j.length===1?j[0]:new g(j,D)}serialize(){return this.expr.map(x=>x.serialize()).join(" && ")}keys(){const x=[];for(let D of this.expr)x.push(...D.keys());return x}negate(){if(!this.negated){const x=[];for(let D of this.expr)x.push(D.negate());this.negated=c.create(x,this,!0)}return this.negated}}class c{constructor(x,D){this.expr=x,this.negated=D,this.type=9}static create(x,D,j){return c._normalizeArr(x,D,j)}cmp(x){if(x.type!==this.type)return this.type-x.type;if(this.expr.length<x.expr.length)return-1;if(this.expr.length>x.expr.length)return 1;for(let D=0,j=this.expr.length;D<j;D++){const I=e(this.expr[D],x.expr[D]);if(I!==0)return I}return 0}equals(x){if(x.type===this.type){if(this.expr.length!==x.expr.length)return!1;for(let D=0,j=this.expr.length;D<j;D++)if(!this.expr[D].equals(x.expr[D]))return!1;return!0}return!1}substituteConstants(){const x=b(this.expr);return x===this.expr?this:c.create(x,this.negated,!1)}evaluate(x){for(let D=0,j=this.expr.length;D<j;D++)if(this.expr[D].evaluate(x))return!0;return!1}static _normalizeArr(x,D,j){let I=[],W=!1;if(x){for(let Q=0,fe=x.length;Q<fe;Q++){const de=x[Q];if(!de)continue;if(de.type===0){W=!0;continue}if(de.type===1)return d.INSTANCE;if(de.type===9){I=I.concat(de.expr);continue}I.push(de)}if(I.length===0&&W)return S.INSTANCE;I.sort(e)}if(I.length===0)return;if(I.length===1)return I[0];for(let Q=1;Q<I.length;Q++)I[Q-1].equals(I[Q])&&(I.splice(Q,1),Q--);if(I.length===1)return I[0];if(j){for(let Q=0;Q<I.length;Q++)for(let fe=Q+1;fe<I.length;fe++)M(I[Q],I[fe])&&(I.splice(fe,1),fe--);if(I.length===1)return I[0]}return new c(I,D)}serialize(){return this.expr.map(x=>x.serialize()).join(" || ")}keys(){const x=[];for(let D of this.expr)x.push(...D.keys());return x}negate(){if(!this.negated){let x=[];for(let D of this.expr)x.push(D.negate());for(;x.length>1;){const D=x.shift(),j=x.shift(),I=[];for(const Q of L(D))for(const fe of L(j))I.push(g.create([Q,fe],null));const W=x.length===0;x.unshift(c.create(I,null,W))}this.negated=x[0]}return this.negated}}class m extends h{constructor(x,D,j){super(x,null);this._defaultValue=D,typeof j=="object"?m._info.push(Object.assign(Object.assign({},j),{key:x})):j!==!0&&m._info.push({key:x,description:j,type:D!=null?typeof D:void 0})}static all(){return m._info.values()}bindTo(x){return x.createKey(this.key,this._defaultValue)}getValue(x){return x.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(x){return o.create(this.key,x)}}m._info=[];const u=Object(O.c)("contextKeyService"),_="setContext";function y(x,D){return x<D?-1:x>D?1:0}function T(x,D,j,I){return x<j?-1:x>j?1:D<I?-1:D>I?1:0}function M(x,D){if(D.type===6&&x.type!==9&&x.type!==6){for(const W of D.expr)if(x.equals(W))return!0}const j=x.negate(),I=L(j).concat(L(D));I.sort(e);for(let W=0;W<I.length;W++){const Q=I[W],fe=Q.negate();for(let de=W+1;de<I.length;de++){const Oe=I[de];if(fe.equals(Oe))return!0}}return!1}function L(x){return x.type===9?x.expr:[x]}},TXwP:function(Ye,ye,$){var ae,B;(function(){var O;(function(){"use strict";var w=[,,function(e){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 d(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}d.prototype.get_indent_size=function(o,a){var r=this.__base_string_length;return a=a||0,o<0&&(r=0),r+=o*this.__indent_size,r+=a,r},d.prototype.get_indent_string=function(o,a){var r=this.__base_string;return a=a||0,o<0&&(o=0,r=""),a+=o*this.__indent_size,this.__ensure_cache(a),r+=this.__cache[a],r},d.prototype.__ensure_cache=function(o){for(;o>=this.__cache.length;)this.__add_column()},d.prototype.__add_column=function(){var o=this.__cache.length,a=0,r="";this.__indent_size&&o>=this.__indent_size&&(a=Math.floor(o/this.__indent_size),o-=a*this.__indent_size,r=new Array(a+1).join(this.__indent_string)),o&&(r+=new Array(o+1).join(" ")),this.__cache.push(r)};function h(o,a){this.__indent_cache=new d(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()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(o,a){return this.__indent_cache.get_indent_string(o,a)},h.prototype.get_indent_size=function(o,a){return this.__indent_cache.get_indent_size(o,a)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(o){return this.is_empty()||!o&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(o){this.trim(!0);var 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 r=this.__lines.join(`
|
|
`);return o!==`
|
|
`&&(r=r.replace(/[\n]/g,o)),r},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.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)},h.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},h.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()},h.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(" "))},h.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()},h.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},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(o,a){for(var r=this.__lines.length-2;r>=0;){var l=this.__lines[r];if(l.is_empty())break;if(l.item(0).indexOf(o)!==0&&l.item(-1)!==a){this.__lines.splice(r+1,0,new S(this)),this.previous_line=this.__lines[this.__lines.length-2];break}r--}},e.exports.Output=h},,,,function(e){function S(o,a){this.raw_options=d(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 r=this.raw_options[o],l=a||[];return typeof r=="object"?r!==null&&typeof r.concat=="function"&&(l=r.concat()):typeof r=="string"&&(l=r.split(/[^a-zA-Z0-9_\/\-]+/)),l},S.prototype._get_boolean=function(o,a){var r=this.raw_options[o],l=r===void 0?!!a:!!r;return l},S.prototype._get_characters=function(o,a){var r=this.raw_options[o],l=a||"";return typeof r=="string"&&(l=r.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),l},S.prototype._get_number=function(o,a){var r=this.raw_options[o];a=parseInt(a,10),isNaN(a)&&(a=0);var l=parseInt(r,10);return isNaN(l)&&(l=a),l},S.prototype._get_selection=function(o,a,r){var l=this._get_selection_list(o,a,r);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,r){if(!a||a.length===0)throw new Error("Selection list cannot be empty.");if(r=r||[a[0]],!this._is_valid_selection(r,a))throw new Error("Invalid Default Value!");var l=this._get_array(o,r);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(r){return a.indexOf(r)===-1})};function d(o,a){var r={};o=h(o);var l;for(l in o)l!==a&&(r[l]=o[l]);if(a&&o[a])for(l in o[a])r[l]=o[a][l];return r}function h(o){var a={},r;for(r in o){var l=r.replace(/-/g,"_");a[l]=o[r]}return a}e.exports.Options=S,e.exports.normalizeOpts=h,e.exports.mergeOpts=d},,function(e){var S=RegExp.prototype.hasOwnProperty("sticky");function d(h){this.__input=h||"",this.__input_length=this.__input.length,this.__position=0}d.prototype.restart=function(){this.__position=0},d.prototype.back=function(){this.__position>0&&(this.__position-=1)},d.prototype.hasNext=function(){return this.__position<this.__input_length},d.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__input.charAt(this.__position),this.__position+=1),h},d.prototype.peek=function(h){var o=null;return h=h||0,h+=this.__position,h>=0&&h<this.__input_length&&(o=this.__input.charAt(h)),o},d.prototype.__match=function(h,o){h.lastIndex=o;var a=h.exec(this.__input);return a&&!(S&&h.sticky)&&(a.index!==o&&(a=null)),a},d.prototype.test=function(h,o){return o=o||0,o+=this.__position,o>=0&&o<this.__input_length?!!this.__match(h,o):!1},d.prototype.testChar=function(h,o){var a=this.peek(o);return h.lastIndex=0,a!==null&&h.test(a)},d.prototype.match=function(h){var o=this.__match(h,this.__position);return o?this.__position+=o[0].length:o=null,o},d.prototype.read=function(h,o,a){var r="",l;return h&&(l=this.match(h),l&&(r+=l[0])),o&&(l||!h)&&(r+=this.readUntil(o,a)),r},d.prototype.readUntil=function(h,o){var a="",r=this.__position;h.lastIndex=this.__position;var l=h.exec(this.__input);return l?(r=l.index,o&&(r+=l[0].length)):r=this.__input_length,a=this.__input.substring(this.__position,r),this.__position=r,a},d.prototype.readUntilAfter=function(h){return this.readUntil(h,!0)},d.prototype.get_regexp=function(h,o){var a=null,r="g";return o&&S&&(r="y"),typeof h=="string"&&h!==""?a=new RegExp(h,r):h&&(a=new RegExp(h.source,r)),a},d.prototype.get_literal_regexp=function(h){return RegExp(h.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},d.prototype.peekUntilAfter=function(h){var o=this.__position,a=this.readUntilAfter(h);return this.__position=o,a},d.prototype.lookBack=function(h){var o=this.__position-1;return o>=h.length&&this.__input.substring(o-h.length,o).toLowerCase()===h},e.exports.InputScanner=d},,,,,function(e){function S(d,h){d=typeof d=="string"?d:d.source,h=typeof h=="string"?h:h.source,this.__directives_block_pattern=new RegExp(d+/ beautify( \w+[:]\w+)+ /.source+h,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(d+/\sbeautify\signore:end\s/.source+h,"g")}S.prototype.get_directives=function(d){if(!d.match(this.__directives_block_pattern))return null;var h={};this.__directive_pattern.lastIndex=0;for(var o=this.__directive_pattern.exec(d);o;)h[o[1]]=o[2],o=this.__directive_pattern.exec(d);return h},S.prototype.readIgnored=function(d){return d.readUntilAfter(this.__directives_end_ignore_pattern)},e.exports.Directives=S},,function(e,S,d){var h=d(16).Beautifier,o=d(17).Options;function a(r,l){var s=new h(r,l);return s.beautify()}e.exports=a,e.exports.defaultOptions=function(){return new o}},function(e,S,d){var h=d(17).Options,o=d(2).Output,a=d(8).InputScanner,r=d(13).Directives,l=new r(/\/\*/,/\*\//),s=/\r\n|[\r\n]/,n=/\r\n|[\r\n]/g,i=/\s/,t=/(?:\s|\n)+/g,v=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,f=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function p(E,b){this._source_text=E||"",this._options=new h(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"]}p.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},p.prototype.eatWhitespace=function(E){for(var b=i.test(this._input.peek()),g=0;i.test(this._input.peek());)this._ch=this._input.next(),E&&this._ch===`
|
|
`&&((g===0||g<this._options.max_preserve_newlines)&&(g++,this._output.add_new_line(!0)));return b},p.prototype.foundNestedPseudoClass=function(){for(var E=0,b=1,g=this._input.peek(b);g;){if(g==="{")return!0;if(g==="(")E+=1;else if(g===")"){if(E===0)return!1;E-=1}else if(g===";"||g==="}")return!1;b++,g=this._input.peek(b)}return!1},p.prototype.print_string=function(E){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(E)},p.prototype.preserveSingleSpace=function(E){E&&(this._output.space_before_token=!0)},p.prototype.indent=function(){this._indentLevel++},p.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},p.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(n,`
|
|
`);var g=E.match(/^[\t ]*/)[0];this._output=new o(this._options,g),this._input=new a(E),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var c=0,m=!1,u=!1,_=!1,y=!1,T=!1,M=!1,L=this._ch,x=!1,D,j,I;D=this._input.read(t),j=D!=="",I=L,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),L=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var W=this._input.read(v),Q=l.get_directives(W);Q&&Q.ignore==="start"&&(W+=l.readIgnored(this._input)),this.print_string(W),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(f)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(j),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var fe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);fe.match(/[ :]$/)&&(fe=this.eatString(": ").replace(/\s$/,""),this.print_string(fe),this._output.space_before_token=!0),fe=fe.replace(/\s$/,""),fe==="extend"?y=!0:fe==="import"&&(T=!0),fe in this.NESTED_AT_RULE?(this._nestedLevel+=1,fe in this.CONDITIONAL_GROUP_RULE&&(_=!0)):!m&&c===0&&fe.indexOf(":")!==-1&&(u=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(j),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")u&&(u=!1,this.outdent()),_?(_=!1,m=this._indentLevel>=this._nestedLevel):m=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&m&&(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)):(I==="("?this._output.space_before_token=!1:I!==","&&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(),I==="{"&&this._output.trim(!0),T=!1,y=!1,u&&(this.outdent(),u=!1),this.print_string(this._ch),m=!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 de=0;de<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;de++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[de])){x=!0;break}(m||_)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!y&&c===0?(this.print_string(":"),u||(u=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Oe=I==='"'||I==="'";this.preserveSingleSpace(Oe||j),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")x=!1,c===0?(u&&(this.outdent(),u=!1),y=!1,T=!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(),c++,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(")")),c&&(c--,this.outdent()));else{var Se=!1;this._input.lookBack("with")&&(Se=!0),this.preserveSingleSpace(j||Se),this.print_string(this._ch),u&&I==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),M=!0):(this.eatWhitespace(),c++,this.indent())}else if(this._ch===")")c&&(c--,this.outdent()),M&&this._input.peek()===";"&&this._options.selector_separator_newline&&(M=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!u||M)&&c===0&&!T&&!y?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!u&&c===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&&i.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(j),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),i.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 Ie=I==='"'||I==="'";this.preserveSingleSpace(Ie||j),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&x&&this._output.add_new_line()}var Le=this._output.get_code(b);return Le},e.exports.Beautifier=p},function(e,S,d){var h=d(6).Options;function o(a){h.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 r=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||r;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 h,e.exports.Options=o}],R={};function H(e){var S=R[e];if(S!==void 0)return S.exports;var d=R[e]={exports:{}};return w[e](d,d.exports,H),d.exports}var U=H(15);O=U})();var k=O;!(ae=[],B=function(){return{css_beautify:k}}.apply(ye,ae),B!==void 0&&(Ye.exports=B))})()},Vhoy:function(Ye,ye,$){"use strict";$.d(ye,"d",function(){return k}),$.d(ye,"e",function(){return w}),$.d(ye,"c",function(){return R}),$.d(ye,"b",function(){return H}),$.d(ye,"a",function(){return U});var ae=$("MI8n");class B{constructor(){this._icons=new Map,this._onDidRegister=new ae.b}add(e){const S=this._icons.get(e.id);S?e.description?S.description=e.description:console.error(`Duplicate registration of codicon ${e.id}`):(this._icons.set(e.id,e),this._onDidRegister.fire(e))}get(e){return this._icons.get(e)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const O=new B,k=O;function w(e,S){return new H(e,S)}function R(e){return e?e.replace(/\$\((.*?)\)/g,(S,d)=>` ${d} `).trim():""}class H{constructor(e,S,d){this.id=e,this.definition=S,this.description=d,O.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var U;(function(e){e.iconNameSegment="[A-Za-z0-9]+",e.iconNameExpression="[A-Za-z0-9\\-]+",e.iconModifierExpression="~[A-Za-z]+";const S=new RegExp(`^(${e.iconNameExpression})(${e.iconModifierExpression})?$`);function d(a){if(a instanceof H)return["codicon","codicon-"+a.id];const r=S.exec(a.id);if(!r)return d(H.error);let[,l,s]=r;const n=["codicon","codicon-"+l];return s&&n.push("codicon-modifier-"+s.substr(1)),n}e.asClassNameArray=d;function h(a){return d(a).join(" ")}e.asClassName=h;function o(a){return"."+d(a).join(".")}e.asCSSSelector=o})(U||(U={})),function(e){e.add=new e("add",{fontCharacter:"\\ea60"}),e.plus=new e("plus",e.add.definition),e.gistNew=new e("gist-new",e.add.definition),e.repoCreate=new e("repo-create",e.add.definition),e.lightbulb=new e("lightbulb",{fontCharacter:"\\ea61"}),e.lightBulb=new e("light-bulb",{fontCharacter:"\\ea61"}),e.repo=new e("repo",{fontCharacter:"\\ea62"}),e.repoDelete=new e("repo-delete",{fontCharacter:"\\ea62"}),e.gistFork=new e("gist-fork",{fontCharacter:"\\ea63"}),e.repoForked=new e("repo-forked",{fontCharacter:"\\ea63"}),e.gitPullRequest=new e("git-pull-request",{fontCharacter:"\\ea64"}),e.gitPullRequestAbandoned=new e("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),e.recordKeys=new e("record-keys",{fontCharacter:"\\ea65"}),e.keyboard=new e("keyboard",{fontCharacter:"\\ea65"}),e.tag=new e("tag",{fontCharacter:"\\ea66"}),e.tagAdd=new e("tag-add",{fontCharacter:"\\ea66"}),e.tagRemove=new e("tag-remove",{fontCharacter:"\\ea66"}),e.person=new e("person",{fontCharacter:"\\ea67"}),e.personFollow=new e("person-follow",{fontCharacter:"\\ea67"}),e.personOutline=new e("person-outline",{fontCharacter:"\\ea67"}),e.personFilled=new e("person-filled",{fontCharacter:"\\ea67"}),e.gitBranch=new e("git-branch",{fontCharacter:"\\ea68"}),e.gitBranchCreate=new e("git-branch-create",{fontCharacter:"\\ea68"}),e.gitBranchDelete=new e("git-branch-delete",{fontCharacter:"\\ea68"}),e.sourceControl=new e("source-control",{fontCharacter:"\\ea68"}),e.mirror=new e("mirror",{fontCharacter:"\\ea69"}),e.mirrorPublic=new e("mirror-public",{fontCharacter:"\\ea69"}),e.star=new e("star",{fontCharacter:"\\ea6a"}),e.starAdd=new e("star-add",{fontCharacter:"\\ea6a"}),e.starDelete=new e("star-delete",{fontCharacter:"\\ea6a"}),e.starEmpty=new e("star-empty",{fontCharacter:"\\ea6a"}),e.comment=new e("comment",{fontCharacter:"\\ea6b"}),e.commentAdd=new e("comment-add",{fontCharacter:"\\ea6b"}),e.alert=new e("alert",{fontCharacter:"\\ea6c"}),e.warning=new e("warning",{fontCharacter:"\\ea6c"}),e.search=new e("search",{fontCharacter:"\\ea6d"}),e.searchSave=new e("search-save",{fontCharacter:"\\ea6d"}),e.logOut=new e("log-out",{fontCharacter:"\\ea6e"}),e.signOut=new e("sign-out",{fontCharacter:"\\ea6e"}),e.logIn=new e("log-in",{fontCharacter:"\\ea6f"}),e.signIn=new e("sign-in",{fontCharacter:"\\ea6f"}),e.eye=new e("eye",{fontCharacter:"\\ea70"}),e.eyeUnwatch=new e("eye-unwatch",{fontCharacter:"\\ea70"}),e.eyeWatch=new e("eye-watch",{fontCharacter:"\\ea70"}),e.circleFilled=new e("circle-filled",{fontCharacter:"\\ea71"}),e.primitiveDot=new e("primitive-dot",{fontCharacter:"\\ea71"}),e.closeDirty=new e("close-dirty",{fontCharacter:"\\ea71"}),e.debugBreakpoint=new e("debug-breakpoint",{fontCharacter:"\\ea71"}),e.debugBreakpointDisabled=new e("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),e.debugHint=new e("debug-hint",{fontCharacter:"\\ea71"}),e.primitiveSquare=new e("primitive-square",{fontCharacter:"\\ea72"}),e.edit=new e("edit",{fontCharacter:"\\ea73"}),e.pencil=new e("pencil",{fontCharacter:"\\ea73"}),e.info=new e("info",{fontCharacter:"\\ea74"}),e.issueOpened=new e("issue-opened",{fontCharacter:"\\ea74"}),e.gistPrivate=new e("gist-private",{fontCharacter:"\\ea75"}),e.gitForkPrivate=new e("git-fork-private",{fontCharacter:"\\ea75"}),e.lock=new e("lock",{fontCharacter:"\\ea75"}),e.mirrorPrivate=new e("mirror-private",{fontCharacter:"\\ea75"}),e.close=new e("close",{fontCharacter:"\\ea76"}),e.removeClose=new e("remove-close",{fontCharacter:"\\ea76"}),e.x=new e("x",{fontCharacter:"\\ea76"}),e.repoSync=new e("repo-sync",{fontCharacter:"\\ea77"}),e.sync=new e("sync",{fontCharacter:"\\ea77"}),e.clone=new e("clone",{fontCharacter:"\\ea78"}),e.desktopDownload=new e("desktop-download",{fontCharacter:"\\ea78"}),e.beaker=new e("beaker",{fontCharacter:"\\ea79"}),e.microscope=new e("microscope",{fontCharacter:"\\ea79"}),e.vm=new e("vm",{fontCharacter:"\\ea7a"}),e.deviceDesktop=new e("device-desktop",{fontCharacter:"\\ea7a"}),e.file=new e("file",{fontCharacter:"\\ea7b"}),e.fileText=new e("file-text",{fontCharacter:"\\ea7b"}),e.more=new e("more",{fontCharacter:"\\ea7c"}),e.ellipsis=new e("ellipsis",{fontCharacter:"\\ea7c"}),e.kebabHorizontal=new e("kebab-horizontal",{fontCharacter:"\\ea7c"}),e.mailReply=new e("mail-reply",{fontCharacter:"\\ea7d"}),e.reply=new e("reply",{fontCharacter:"\\ea7d"}),e.organization=new e("organization",{fontCharacter:"\\ea7e"}),e.organizationFilled=new e("organization-filled",{fontCharacter:"\\ea7e"}),e.organizationOutline=new e("organization-outline",{fontCharacter:"\\ea7e"}),e.newFile=new e("new-file",{fontCharacter:"\\ea7f"}),e.fileAdd=new e("file-add",{fontCharacter:"\\ea7f"}),e.newFolder=new e("new-folder",{fontCharacter:"\\ea80"}),e.fileDirectoryCreate=new e("file-directory-create",{fontCharacter:"\\ea80"}),e.trash=new e("trash",{fontCharacter:"\\ea81"}),e.trashcan=new e("trashcan",{fontCharacter:"\\ea81"}),e.history=new e("history",{fontCharacter:"\\ea82"}),e.clock=new e("clock",{fontCharacter:"\\ea82"}),e.folder=new e("folder",{fontCharacter:"\\ea83"}),e.fileDirectory=new e("file-directory",{fontCharacter:"\\ea83"}),e.symbolFolder=new e("symbol-folder",{fontCharacter:"\\ea83"}),e.logoGithub=new e("logo-github",{fontCharacter:"\\ea84"}),e.markGithub=new e("mark-github",{fontCharacter:"\\ea84"}),e.github=new e("github",{fontCharacter:"\\ea84"}),e.terminal=new e("terminal",{fontCharacter:"\\ea85"}),e.console=new e("console",{fontCharacter:"\\ea85"}),e.repl=new e("repl",{fontCharacter:"\\ea85"}),e.zap=new e("zap",{fontCharacter:"\\ea86"}),e.symbolEvent=new e("symbol-event",{fontCharacter:"\\ea86"}),e.error=new e("error",{fontCharacter:"\\ea87"}),e.stop=new e("stop",{fontCharacter:"\\ea87"}),e.variable=new e("variable",{fontCharacter:"\\ea88"}),e.symbolVariable=new e("symbol-variable",{fontCharacter:"\\ea88"}),e.array=new e("array",{fontCharacter:"\\ea8a"}),e.symbolArray=new e("symbol-array",{fontCharacter:"\\ea8a"}),e.symbolModule=new e("symbol-module",{fontCharacter:"\\ea8b"}),e.symbolPackage=new e("symbol-package",{fontCharacter:"\\ea8b"}),e.symbolNamespace=new e("symbol-namespace",{fontCharacter:"\\ea8b"}),e.symbolObject=new e("symbol-object",{fontCharacter:"\\ea8b"}),e.symbolMethod=new e("symbol-method",{fontCharacter:"\\ea8c"}),e.symbolFunction=new e("symbol-function",{fontCharacter:"\\ea8c"}),e.symbolConstructor=new e("symbol-constructor",{fontCharacter:"\\ea8c"}),e.symbolBoolean=new e("symbol-boolean",{fontCharacter:"\\ea8f"}),e.symbolNull=new e("symbol-null",{fontCharacter:"\\ea8f"}),e.symbolNumeric=new e("symbol-numeric",{fontCharacter:"\\ea90"}),e.symbolNumber=new e("symbol-number",{fontCharacter:"\\ea90"}),e.symbolStructure=new e("symbol-structure",{fontCharacter:"\\ea91"}),e.symbolStruct=new e("symbol-struct",{fontCharacter:"\\ea91"}),e.symbolParameter=new e("symbol-parameter",{fontCharacter:"\\ea92"}),e.symbolTypeParameter=new e("symbol-type-parameter",{fontCharacter:"\\ea92"}),e.symbolKey=new e("symbol-key",{fontCharacter:"\\ea93"}),e.symbolText=new e("symbol-text",{fontCharacter:"\\ea93"}),e.symbolReference=new e("symbol-reference",{fontCharacter:"\\ea94"}),e.goToFile=new e("go-to-file",{fontCharacter:"\\ea94"}),e.symbolEnum=new e("symbol-enum",{fontCharacter:"\\ea95"}),e.symbolValue=new e("symbol-value",{fontCharacter:"\\ea95"}),e.symbolRuler=new e("symbol-ruler",{fontCharacter:"\\ea96"}),e.symbolUnit=new e("symbol-unit",{fontCharacter:"\\ea96"}),e.activateBreakpoints=new e("activate-breakpoints",{fontCharacter:"\\ea97"}),e.archive=new e("archive",{fontCharacter:"\\ea98"}),e.arrowBoth=new e("arrow-both",{fontCharacter:"\\ea99"}),e.arrowDown=new e("arrow-down",{fontCharacter:"\\ea9a"}),e.arrowLeft=new e("arrow-left",{fontCharacter:"\\ea9b"}),e.arrowRight=new e("arrow-right",{fontCharacter:"\\ea9c"}),e.arrowSmallDown=new e("arrow-small-down",{fontCharacter:"\\ea9d"}),e.arrowSmallLeft=new e("arrow-small-left",{fontCharacter:"\\ea9e"}),e.arrowSmallRight=new e("arrow-small-right",{fontCharacter:"\\ea9f"}),e.arrowSmallUp=new e("arrow-small-up",{fontCharacter:"\\eaa0"}),e.arrowUp=new e("arrow-up",{fontCharacter:"\\eaa1"}),e.bell=new e("bell",{fontCharacter:"\\eaa2"}),e.bold=new e("bold",{fontCharacter:"\\eaa3"}),e.book=new e("book",{fontCharacter:"\\eaa4"}),e.bookmark=new e("bookmark",{fontCharacter:"\\eaa5"}),e.debugBreakpointConditionalUnverified=new e("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),e.debugBreakpointConditional=new e("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),e.debugBreakpointConditionalDisabled=new e("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),e.debugBreakpointDataUnverified=new e("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),e.debugBreakpointData=new e("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),e.debugBreakpointDataDisabled=new e("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),e.debugBreakpointLogUnverified=new e("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),e.debugBreakpointLog=new e("debug-breakpoint-log",{fontCharacter:"\\eaab"}),e.debugBreakpointLogDisabled=new e("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),e.briefcase=new e("briefcase",{fontCharacter:"\\eaac"}),e.broadcast=new e("broadcast",{fontCharacter:"\\eaad"}),e.browser=new e("browser",{fontCharacter:"\\eaae"}),e.bug=new e("bug",{fontCharacter:"\\eaaf"}),e.calendar=new e("calendar",{fontCharacter:"\\eab0"}),e.caseSensitive=new e("case-sensitive",{fontCharacter:"\\eab1"}),e.check=new e("check",{fontCharacter:"\\eab2"}),e.checklist=new e("checklist",{fontCharacter:"\\eab3"}),e.chevronDown=new e("chevron-down",{fontCharacter:"\\eab4"}),e.dropDownButton=new e("drop-down-button",e.chevronDown.definition),e.chevronLeft=new e("chevron-left",{fontCharacter:"\\eab5"}),e.chevronRight=new e("chevron-right",{fontCharacter:"\\eab6"}),e.chevronUp=new e("chevron-up",{fontCharacter:"\\eab7"}),e.chromeClose=new e("chrome-close",{fontCharacter:"\\eab8"}),e.chromeMaximize=new e("chrome-maximize",{fontCharacter:"\\eab9"}),e.chromeMinimize=new e("chrome-minimize",{fontCharacter:"\\eaba"}),e.chromeRestore=new e("chrome-restore",{fontCharacter:"\\eabb"}),e.circleOutline=new e("circle-outline",{fontCharacter:"\\eabc"}),e.debugBreakpointUnverified=new e("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),e.circleSlash=new e("circle-slash",{fontCharacter:"\\eabd"}),e.circuitBoard=new e("circuit-board",{fontCharacter:"\\eabe"}),e.clearAll=new e("clear-all",{fontCharacter:"\\eabf"}),e.clippy=new e("clippy",{fontCharacter:"\\eac0"}),e.closeAll=new e("close-all",{fontCharacter:"\\eac1"}),e.cloudDownload=new e("cloud-download",{fontCharacter:"\\eac2"}),e.cloudUpload=new e("cloud-upload",{fontCharacter:"\\eac3"}),e.code=new e("code",{fontCharacter:"\\eac4"}),e.collapseAll=new e("collapse-all",{fontCharacter:"\\eac5"}),e.colorMode=new e("color-mode",{fontCharacter:"\\eac6"}),e.commentDiscussion=new e("comment-discussion",{fontCharacter:"\\eac7"}),e.compareChanges=new e("compare-changes",{fontCharacter:"\\eafd"}),e.creditCard=new e("credit-card",{fontCharacter:"\\eac9"}),e.dash=new e("dash",{fontCharacter:"\\eacc"}),e.dashboard=new e("dashboard",{fontCharacter:"\\eacd"}),e.database=new e("database",{fontCharacter:"\\eace"}),e.debugContinue=new e("debug-continue",{fontCharacter:"\\eacf"}),e.debugDisconnect=new e("debug-disconnect",{fontCharacter:"\\ead0"}),e.debugPause=new e("debug-pause",{fontCharacter:"\\ead1"}),e.debugRestart=new e("debug-restart",{fontCharacter:"\\ead2"}),e.debugStart=new e("debug-start",{fontCharacter:"\\ead3"}),e.debugStepInto=new e("debug-step-into",{fontCharacter:"\\ead4"}),e.debugStepOut=new e("debug-step-out",{fontCharacter:"\\ead5"}),e.debugStepOver=new e("debug-step-over",{fontCharacter:"\\ead6"}),e.debugStop=new e("debug-stop",{fontCharacter:"\\ead7"}),e.debug=new e("debug",{fontCharacter:"\\ead8"}),e.deviceCameraVideo=new e("device-camera-video",{fontCharacter:"\\ead9"}),e.deviceCamera=new e("device-camera",{fontCharacter:"\\eada"}),e.deviceMobile=new e("device-mobile",{fontCharacter:"\\eadb"}),e.diffAdded=new e("diff-added",{fontCharacter:"\\eadc"}),e.diffIgnored=new e("diff-ignored",{fontCharacter:"\\eadd"}),e.diffModified=new e("diff-modified",{fontCharacter:"\\eade"}),e.diffRemoved=new e("diff-removed",{fontCharacter:"\\eadf"}),e.diffRenamed=new e("diff-renamed",{fontCharacter:"\\eae0"}),e.diff=new e("diff",{fontCharacter:"\\eae1"}),e.discard=new e("discard",{fontCharacter:"\\eae2"}),e.editorLayout=new e("editor-layout",{fontCharacter:"\\eae3"}),e.emptyWindow=new e("empty-window",{fontCharacter:"\\eae4"}),e.exclude=new e("exclude",{fontCharacter:"\\eae5"}),e.extensions=new e("extensions",{fontCharacter:"\\eae6"}),e.eyeClosed=new e("eye-closed",{fontCharacter:"\\eae7"}),e.fileBinary=new e("file-binary",{fontCharacter:"\\eae8"}),e.fileCode=new e("file-code",{fontCharacter:"\\eae9"}),e.fileMedia=new e("file-media",{fontCharacter:"\\eaea"}),e.filePdf=new e("file-pdf",{fontCharacter:"\\eaeb"}),e.fileSubmodule=new e("file-submodule",{fontCharacter:"\\eaec"}),e.fileSymlinkDirectory=new e("file-symlink-directory",{fontCharacter:"\\eaed"}),e.fileSymlinkFile=new e("file-symlink-file",{fontCharacter:"\\eaee"}),e.fileZip=new e("file-zip",{fontCharacter:"\\eaef"}),e.files=new e("files",{fontCharacter:"\\eaf0"}),e.filter=new e("filter",{fontCharacter:"\\eaf1"}),e.flame=new e("flame",{fontCharacter:"\\eaf2"}),e.foldDown=new e("fold-down",{fontCharacter:"\\eaf3"}),e.foldUp=new e("fold-up",{fontCharacter:"\\eaf4"}),e.fold=new e("fold",{fontCharacter:"\\eaf5"}),e.folderActive=new e("folder-active",{fontCharacter:"\\eaf6"}),e.folderOpened=new e("folder-opened",{fontCharacter:"\\eaf7"}),e.gear=new e("gear",{fontCharacter:"\\eaf8"}),e.gift=new e("gift",{fontCharacter:"\\eaf9"}),e.gistSecret=new e("gist-secret",{fontCharacter:"\\eafa"}),e.gist=new e("gist",{fontCharacter:"\\eafb"}),e.gitCommit=new e("git-commit",{fontCharacter:"\\eafc"}),e.gitCompare=new e("git-compare",{fontCharacter:"\\eafd"}),e.gitMerge=new e("git-merge",{fontCharacter:"\\eafe"}),e.githubAction=new e("github-action",{fontCharacter:"\\eaff"}),e.githubAlt=new e("github-alt",{fontCharacter:"\\eb00"}),e.globe=new e("globe",{fontCharacter:"\\eb01"}),e.grabber=new e("grabber",{fontCharacter:"\\eb02"}),e.graph=new e("graph",{fontCharacter:"\\eb03"}),e.gripper=new e("gripper",{fontCharacter:"\\eb04"}),e.heart=new e("heart",{fontCharacter:"\\eb05"}),e.home=new e("home",{fontCharacter:"\\eb06"}),e.horizontalRule=new e("horizontal-rule",{fontCharacter:"\\eb07"}),e.hubot=new e("hubot",{fontCharacter:"\\eb08"}),e.inbox=new e("inbox",{fontCharacter:"\\eb09"}),e.issueClosed=new e("issue-closed",{fontCharacter:"\\eba4"}),e.issueReopened=new e("issue-reopened",{fontCharacter:"\\eb0b"}),e.issues=new e("issues",{fontCharacter:"\\eb0c"}),e.italic=new e("italic",{fontCharacter:"\\eb0d"}),e.jersey=new e("jersey",{fontCharacter:"\\eb0e"}),e.json=new e("json",{fontCharacter:"\\eb0f"}),e.kebabVertical=new e("kebab-vertical",{fontCharacter:"\\eb10"}),e.key=new e("key",{fontCharacter:"\\eb11"}),e.law=new e("law",{fontCharacter:"\\eb12"}),e.lightbulbAutofix=new e("lightbulb-autofix",{fontCharacter:"\\eb13"}),e.linkExternal=new e("link-external",{fontCharacter:"\\eb14"}),e.link=new e("link",{fontCharacter:"\\eb15"}),e.listOrdered=new e("list-ordered",{fontCharacter:"\\eb16"}),e.listUnordered=new e("list-unordered",{fontCharacter:"\\eb17"}),e.liveShare=new e("live-share",{fontCharacter:"\\eb18"}),e.loading=new e("loading",{fontCharacter:"\\eb19"}),e.location=new e("location",{fontCharacter:"\\eb1a"}),e.mailRead=new e("mail-read",{fontCharacter:"\\eb1b"}),e.mail=new e("mail",{fontCharacter:"\\eb1c"}),e.markdown=new e("markdown",{fontCharacter:"\\eb1d"}),e.megaphone=new e("megaphone",{fontCharacter:"\\eb1e"}),e.mention=new e("mention",{fontCharacter:"\\eb1f"}),e.milestone=new e("milestone",{fontCharacter:"\\eb20"}),e.mortarBoard=new e("mortar-board",{fontCharacter:"\\eb21"}),e.move=new e("move",{fontCharacter:"\\eb22"}),e.multipleWindows=new e("multiple-windows",{fontCharacter:"\\eb23"}),e.mute=new e("mute",{fontCharacter:"\\eb24"}),e.noNewline=new e("no-newline",{fontCharacter:"\\eb25"}),e.note=new e("note",{fontCharacter:"\\eb26"}),e.octoface=new e("octoface",{fontCharacter:"\\eb27"}),e.openPreview=new e("open-preview",{fontCharacter:"\\eb28"}),e.package_=new e("package",{fontCharacter:"\\eb29"}),e.paintcan=new e("paintcan",{fontCharacter:"\\eb2a"}),e.pin=new e("pin",{fontCharacter:"\\eb2b"}),e.play=new e("play",{fontCharacter:"\\eb2c"}),e.run=new e("run",{fontCharacter:"\\eb2c"}),e.plug=new e("plug",{fontCharacter:"\\eb2d"}),e.preserveCase=new e("preserve-case",{fontCharacter:"\\eb2e"}),e.preview=new e("preview",{fontCharacter:"\\eb2f"}),e.project=new e("project",{fontCharacter:"\\eb30"}),e.pulse=new e("pulse",{fontCharacter:"\\eb31"}),e.question=new e("question",{fontCharacter:"\\eb32"}),e.quote=new e("quote",{fontCharacter:"\\eb33"}),e.radioTower=new e("radio-tower",{fontCharacter:"\\eb34"}),e.reactions=new e("reactions",{fontCharacter:"\\eb35"}),e.references=new e("references",{fontCharacter:"\\eb36"}),e.refresh=new e("refresh",{fontCharacter:"\\eb37"}),e.regex=new e("regex",{fontCharacter:"\\eb38"}),e.remoteExplorer=new e("remote-explorer",{fontCharacter:"\\eb39"}),e.remote=new e("remote",{fontCharacter:"\\eb3a"}),e.remove=new e("remove",{fontCharacter:"\\eb3b"}),e.replaceAll=new e("replace-all",{fontCharacter:"\\eb3c"}),e.replace=new e("replace",{fontCharacter:"\\eb3d"}),e.repoClone=new e("repo-clone",{fontCharacter:"\\eb3e"}),e.repoForcePush=new e("repo-force-push",{fontCharacter:"\\eb3f"}),e.repoPull=new e("repo-pull",{fontCharacter:"\\eb40"}),e.repoPush=new e("repo-push",{fontCharacter:"\\eb41"}),e.report=new e("report",{fontCharacter:"\\eb42"}),e.requestChanges=new e("request-changes",{fontCharacter:"\\eb43"}),e.rocket=new e("rocket",{fontCharacter:"\\eb44"}),e.rootFolderOpened=new e("root-folder-opened",{fontCharacter:"\\eb45"}),e.rootFolder=new e("root-folder",{fontCharacter:"\\eb46"}),e.rss=new e("rss",{fontCharacter:"\\eb47"}),e.ruby=new e("ruby",{fontCharacter:"\\eb48"}),e.saveAll=new e("save-all",{fontCharacter:"\\eb49"}),e.saveAs=new e("save-as",{fontCharacter:"\\eb4a"}),e.save=new e("save",{fontCharacter:"\\eb4b"}),e.screenFull=new e("screen-full",{fontCharacter:"\\eb4c"}),e.screenNormal=new e("screen-normal",{fontCharacter:"\\eb4d"}),e.searchStop=new e("search-stop",{fontCharacter:"\\eb4e"}),e.server=new e("server",{fontCharacter:"\\eb50"}),e.settingsGear=new e("settings-gear",{fontCharacter:"\\eb51"}),e.settings=new e("settings",{fontCharacter:"\\eb52"}),e.shield=new e("shield",{fontCharacter:"\\eb53"}),e.smiley=new e("smiley",{fontCharacter:"\\eb54"}),e.sortPrecedence=new e("sort-precedence",{fontCharacter:"\\eb55"}),e.splitHorizontal=new e("split-horizontal",{fontCharacter:"\\eb56"}),e.splitVertical=new e("split-vertical",{fontCharacter:"\\eb57"}),e.squirrel=new e("squirrel",{fontCharacter:"\\eb58"}),e.starFull=new e("star-full",{fontCharacter:"\\eb59"}),e.starHalf=new e("star-half",{fontCharacter:"\\eb5a"}),e.symbolClass=new e("symbol-class",{fontCharacter:"\\eb5b"}),e.symbolColor=new e("symbol-color",{fontCharacter:"\\eb5c"}),e.symbolConstant=new e("symbol-constant",{fontCharacter:"\\eb5d"}),e.symbolEnumMember=new e("symbol-enum-member",{fontCharacter:"\\eb5e"}),e.symbolField=new e("symbol-field",{fontCharacter:"\\eb5f"}),e.symbolFile=new e("symbol-file",{fontCharacter:"\\eb60"}),e.symbolInterface=new e("symbol-interface",{fontCharacter:"\\eb61"}),e.symbolKeyword=new e("symbol-keyword",{fontCharacter:"\\eb62"}),e.symbolMisc=new e("symbol-misc",{fontCharacter:"\\eb63"}),e.symbolOperator=new e("symbol-operator",{fontCharacter:"\\eb64"}),e.symbolProperty=new e("symbol-property",{fontCharacter:"\\eb65"}),e.wrench=new e("wrench",{fontCharacter:"\\eb65"}),e.wrenchSubaction=new e("wrench-subaction",{fontCharacter:"\\eb65"}),e.symbolSnippet=new e("symbol-snippet",{fontCharacter:"\\eb66"}),e.tasklist=new e("tasklist",{fontCharacter:"\\eb67"}),e.telescope=new e("telescope",{fontCharacter:"\\eb68"}),e.textSize=new e("text-size",{fontCharacter:"\\eb69"}),e.threeBars=new e("three-bars",{fontCharacter:"\\eb6a"}),e.thumbsdown=new e("thumbsdown",{fontCharacter:"\\eb6b"}),e.thumbsup=new e("thumbsup",{fontCharacter:"\\eb6c"}),e.tools=new e("tools",{fontCharacter:"\\eb6d"}),e.triangleDown=new e("triangle-down",{fontCharacter:"\\eb6e"}),e.triangleLeft=new e("triangle-left",{fontCharacter:"\\eb6f"}),e.triangleRight=new e("triangle-right",{fontCharacter:"\\eb70"}),e.triangleUp=new e("triangle-up",{fontCharacter:"\\eb71"}),e.twitter=new e("twitter",{fontCharacter:"\\eb72"}),e.unfold=new e("unfold",{fontCharacter:"\\eb73"}),e.unlock=new e("unlock",{fontCharacter:"\\eb74"}),e.unmute=new e("unmute",{fontCharacter:"\\eb75"}),e.unverified=new e("unverified",{fontCharacter:"\\eb76"}),e.verified=new e("verified",{fontCharacter:"\\eb77"}),e.versions=new e("versions",{fontCharacter:"\\eb78"}),e.vmActive=new e("vm-active",{fontCharacter:"\\eb79"}),e.vmOutline=new e("vm-outline",{fontCharacter:"\\eb7a"}),e.vmRunning=new e("vm-running",{fontCharacter:"\\eb7b"}),e.watch=new e("watch",{fontCharacter:"\\eb7c"}),e.whitespace=new e("whitespace",{fontCharacter:"\\eb7d"}),e.wholeWord=new e("whole-word",{fontCharacter:"\\eb7e"}),e.window=new e("window",{fontCharacter:"\\eb7f"}),e.wordWrap=new e("word-wrap",{fontCharacter:"\\eb80"}),e.zoomIn=new e("zoom-in",{fontCharacter:"\\eb81"}),e.zoomOut=new e("zoom-out",{fontCharacter:"\\eb82"}),e.listFilter=new e("list-filter",{fontCharacter:"\\eb83"}),e.listFlat=new e("list-flat",{fontCharacter:"\\eb84"}),e.listSelection=new e("list-selection",{fontCharacter:"\\eb85"}),e.selection=new e("selection",{fontCharacter:"\\eb85"}),e.listTree=new e("list-tree",{fontCharacter:"\\eb86"}),e.debugBreakpointFunctionUnverified=new e("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),e.debugBreakpointFunction=new e("debug-breakpoint-function",{fontCharacter:"\\eb88"}),e.debugBreakpointFunctionDisabled=new e("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),e.debugStackframeActive=new e("debug-stackframe-active",{fontCharacter:"\\eb89"}),e.debugStackframeDot=new e("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),e.debugStackframe=new e("debug-stackframe",{fontCharacter:"\\eb8b"}),e.debugStackframeFocused=new e("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),e.debugBreakpointUnsupported=new e("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),e.symbolString=new e("symbol-string",{fontCharacter:"\\eb8d"}),e.debugReverseContinue=new e("debug-reverse-continue",{fontCharacter:"\\eb8e"}),e.debugStepBack=new e("debug-step-back",{fontCharacter:"\\eb8f"}),e.debugRestartFrame=new e("debug-restart-frame",{fontCharacter:"\\eb90"}),e.callIncoming=new e("call-incoming",{fontCharacter:"\\eb92"}),e.callOutgoing=new e("call-outgoing",{fontCharacter:"\\eb93"}),e.menu=new e("menu",{fontCharacter:"\\eb94"}),e.expandAll=new e("expand-all",{fontCharacter:"\\eb95"}),e.feedback=new e("feedback",{fontCharacter:"\\eb96"}),e.groupByRefType=new e("group-by-ref-type",{fontCharacter:"\\eb97"}),e.ungroupByRefType=new e("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),e.account=new e("account",{fontCharacter:"\\eb99"}),e.bellDot=new e("bell-dot",{fontCharacter:"\\eb9a"}),e.debugConsole=new e("debug-console",{fontCharacter:"\\eb9b"}),e.library=new e("library",{fontCharacter:"\\eb9c"}),e.output=new e("output",{fontCharacter:"\\eb9d"}),e.runAll=new e("run-all",{fontCharacter:"\\eb9e"}),e.syncIgnored=new e("sync-ignored",{fontCharacter:"\\eb9f"}),e.pinned=new e("pinned",{fontCharacter:"\\eba0"}),e.githubInverted=new e("github-inverted",{fontCharacter:"\\eba1"}),e.debugAlt=new e("debug-alt",{fontCharacter:"\\eb91"}),e.serverProcess=new e("server-process",{fontCharacter:"\\eba2"}),e.serverEnvironment=new e("server-environment",{fontCharacter:"\\eba3"}),e.pass=new e("pass",{fontCharacter:"\\eba4"}),e.stopCircle=new e("stop-circle",{fontCharacter:"\\eba5"}),e.playCircle=new e("play-circle",{fontCharacter:"\\eba6"}),e.record=new e("record",{fontCharacter:"\\eba7"}),e.debugAltSmall=new e("debug-alt-small",{fontCharacter:"\\eba8"}),e.vmConnect=new e("vm-connect",{fontCharacter:"\\eba9"}),e.cloud=new e("cloud",{fontCharacter:"\\ebaa"}),e.merge=new e("merge",{fontCharacter:"\\ebab"}),e.exportIcon=new e("export",{fontCharacter:"\\ebac"}),e.graphLeft=new e("graph-left",{fontCharacter:"\\ebad"}),e.magnet=new e("magnet",{fontCharacter:"\\ebae"}),e.notebook=new e("notebook",{fontCharacter:"\\ebaf"}),e.redo=new e("redo",{fontCharacter:"\\ebb0"}),e.checkAll=new e("check-all",{fontCharacter:"\\ebb1"}),e.pinnedDirty=new e("pinned-dirty",{fontCharacter:"\\ebb2"}),e.passFilled=new e("pass-filled",{fontCharacter:"\\ebb3"}),e.circleLargeFilled=new e("circle-large-filled",{fontCharacter:"\\ebb4"}),e.circleLargeOutline=new e("circle-large-outline",{fontCharacter:"\\ebb5"}),e.combine=new e("combine",{fontCharacter:"\\ebb6"}),e.gather=new e("gather",{fontCharacter:"\\ebb6"}),e.table=new e("table",{fontCharacter:"\\ebb7"}),e.variableGroup=new e("variable-group",{fontCharacter:"\\ebb8"}),e.typeHierarchy=new e("type-hierarchy",{fontCharacter:"\\ebb9"}),e.typeHierarchySub=new e("type-hierarchy-sub",{fontCharacter:"\\ebba"}),e.typeHierarchySuper=new e("type-hierarchy-super",{fontCharacter:"\\ebbb"}),e.gitPullRequestCreate=new e("git-pull-request-create",{fontCharacter:"\\ebbc"}),e.runAbove=new e("run-above",{fontCharacter:"\\ebbd"}),e.runBelow=new e("run-below",{fontCharacter:"\\ebbe"}),e.notebookTemplate=new e("notebook-template",{fontCharacter:"\\ebbf"}),e.debugRerun=new e("debug-rerun",{fontCharacter:"\\ebc0"}),e.workspaceTrusted=new e("workspace-trusted",{fontCharacter:"\\ebc1"}),e.workspaceUntrusted=new e("workspace-untrusted",{fontCharacter:"\\ebc2"}),e.workspaceUnspecified=new e("workspace-unspecified",{fontCharacter:"\\ebc3"}),e.terminalCmd=new e("terminal-cmd",{fontCharacter:"\\ebc4"}),e.terminalDebian=new e("terminal-debian",{fontCharacter:"\\ebc5"}),e.terminalLinux=new e("terminal-linux",{fontCharacter:"\\ebc6"}),e.terminalPowershell=new e("terminal-powershell",{fontCharacter:"\\ebc7"}),e.terminalTmux=new e("terminal-tmux",{fontCharacter:"\\ebc8"}),e.terminalUbuntu=new e("terminal-ubuntu",{fontCharacter:"\\ebc9"}),e.terminalBash=new e("terminal-bash",{fontCharacter:"\\ebca"}),e.arrowSwap=new e("arrow-swap",{fontCharacter:"\\ebcb"}),e.copy=new e("copy",{fontCharacter:"\\ebcc"}),e.personAdd=new e("person-add",{fontCharacter:"\\ebcd"}),e.filterFilled=new e("filter-filled",{fontCharacter:"\\ebce"}),e.wand=new e("wand",{fontCharacter:"\\ebcf"}),e.debugLineByLine=new e("debug-line-by-line",{fontCharacter:"\\ebd0"}),e.inspect=new e("inspect",{fontCharacter:"\\ebd1"}),e.layers=new e("layers",{fontCharacter:"\\ebd2"}),e.layersDot=new e("layers-dot",{fontCharacter:"\\ebd3"}),e.layersActive=new e("layers-active",{fontCharacter:"\\ebd4"}),e.compass=new e("compass",{fontCharacter:"\\ebd5"}),e.compassDot=new e("compass-dot",{fontCharacter:"\\ebd6"}),e.compassActive=new e("compass-active",{fontCharacter:"\\ebd7"}),e.azure=new e("azure",{fontCharacter:"\\ebd8"}),e.issueDraft=new e("issue-draft",{fontCharacter:"\\ebd9"}),e.gitPullRequestClosed=new e("git-pull-request-closed",{fontCharacter:"\\ebda"}),e.gitPullRequestDraft=new e("git-pull-request-draft",{fontCharacter:"\\ebdb"}),e.debugAll=new e("debug-all",{fontCharacter:"\\ebdc"}),e.debugCoverage=new e("debug-coverage",{fontCharacter:"\\ebdd"}),e.runErrors=new e("run-errors",{fontCharacter:"\\ebde"}),e.folderLibrary=new e("folder-library",{fontCharacter:"\\ebdf"}),e.debugContinueSmall=new e("debug-continue-small",{fontCharacter:"\\ebe0"}),e.beakerStop=new e("beaker-stop",{fontCharacter:"\\ebe1"}),e.graphLine=new e("graph-line",{fontCharacter:"\\ebe2"}),e.graphScatter=new e("graph-scatter",{fontCharacter:"\\ebe3"}),e.pieChart=new e("pie-chart",{fontCharacter:"\\ebe4"}),e.bracket=new e("bracket",e.json.definition),e.bracketDot=new e("bracket-dot",{fontCharacter:"\\ebe5"}),e.bracketError=new e("bracket-error",{fontCharacter:"\\ebe6"}),e.lockSmall=new e("lock-small",{fontCharacter:"\\ebe7"}),e.azureDevops=new e("azure-devops",{fontCharacter:"\\ebe8"}),e.verifiedFilled=new e("verified-filled",{fontCharacter:"\\ebe9"})}(H||(H={}))},ZW9T:function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return j});var ae=$("k1fw"),B=$("oBTY"),O=$("miYZ"),k=$("tsqr"),w=$("rAM+"),R=$("tJVT"),H=$("PpiC"),U=$("q1tI"),e=$.n(U),S=$("bdgK"),d=$("9og8"),h=$("WmNS"),o=$.n(h),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"]},r={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","friend","gcnew","generic","goto","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:"system",content:'system("$0")'},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"if",content:["if () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for(int j=0 ; j<10; j++){"," $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 <cstdio>",content:["#include <cstdio>"].join(`
|
|
`)},{label:"include <cstring>",content:["#include <cstring>"].join(`
|
|
`)},{label:"include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"include <fstream>",content:["#include <fstream>"].join(`
|
|
`)},{label:"include <map>",content:["#include <map>"].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(`
|
|
`)}]},n=$("5VLF"),i=$.n(n),t={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"]}},v=function(W,Q){return Q.map(function(fe){return{label:fe,kind:W.languages.CompletionItemKind.Keyword,insertText:fe}})},f=function(W){return Object.keys(t.tables).map(function(Q){return{label:Q,kind:W.languages.CompletionItemKind.Variable,insertText:Q}})},p=function(W,Q){var fe=t.tables[W];return fe?fe.map(function(de){return{label:de,kind:Q.languages.CompletionItemKind.Field,insertText:de}}):[]};function E(I,W,Q,fe,de){var Oe=W.getWordUntilPosition(Q),Se={startLineNumber:Q.lineNumber,endLineNumber:Q.lineNumber,startColumn:Oe.startColumn,endColumn:Oe.endColumn},Ie=fe.map(function(Le){return{label:Le,kind:I.languages.CompletionItemKind.Keyword,insertText:Le,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Se}});return de.map(function(Le){Ie.push(Object(ae.a)(Object(ae.a)({},Le),{},{range:Se}))}),Ie}var b=function(I){t.languages.map(function(de){return I.languages.registerDocumentFormattingEditProvider(de,{provideDocumentFormattingEdits:function(Se,Ie,Le){return Object(d.a)(o.a.mark(function Ne(){var be;return o.a.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return be=i()(Se.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}),A.abrupt("return",[{range:Se.getFullModelRange(),text:be}]);case 2:case"end":return A.stop()}},Ne)}))()}}),de});var W=l.quickKey.map(function(de){return{label:de.label,kind:I.languages.CompletionItemKind.Method,insertText:de.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),Q=s.quickKey.map(function(de){return{label:de.label,kind:I.languages.CompletionItemKind.Method,insertText:de.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),fe=r.quickKey.map(function(de){return{label:de.label,kind:I.languages.CompletionItemKind.Method,insertText:de.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}});I.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(Oe,Se){var Ie=Oe.getWordUntilPosition(Se),Le={startLineNumber:Se.lineNumber,endLineNumber:Se.lineNumber,startColumn:Ie.startColumn,endColumn:Ie.endColumn},Ne=Oe.getLineContent(Se.lineNumber).substring(Ie.startColumn-2,Ie.endColumn);return{suggestions:[].concat(Object(B.a)(l.keywords.map(function(be){return{label:be,kind:I.languages.CompletionItemKind.Function,documentation:be,insertText:be,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Le}})),Object(B.a)(l.quickKey.map(function(be){return{label:be.label,kind:I.languages.CompletionItemKind.Function,documentation:be.content,insertText:Ne.startsWith("#")?be.content.replace(/#/,""):be.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Le}})))}}}),I.languages.registerCompletionItemProvider("c",{provideCompletionItems:function(Oe,Se){var Ie=Oe.getWordUntilPosition(Se),Le={startLineNumber:Se.lineNumber,endLineNumber:Se.lineNumber,startColumn:Ie.startColumn,endColumn:Ie.endColumn};return{suggestions:Object(B.a)(a.keywords.map(function(Ne){return{label:Ne,kind:I.languages.CompletionItemKind.Function,documentation:Ne,insertText:Ne,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Le}}))}}}),I.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(Oe,Se){var Ie=Oe.getWordUntilPosition(Se),Le={startLineNumber:Se.lineNumber,endLineNumber:Se.lineNumber,startColumn:Ie.startColumn,endColumn:Ie.endColumn},Ne=Oe.getLineContent(Se.lineNumber).substring(Ie.startColumn-2,Ie.endColumn);return{suggestions:[].concat(Object(B.a)(r.keywords.map(function(be){return{label:be,kind:I.languages.CompletionItemKind.Function,documentation:be,insertText:be,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Le}})),Object(B.a)(r.quickKey.map(function(be){return{label:be.label,kind:I.languages.CompletionItemKind.Function,documentation:be.content,insertText:Ne.startsWith("#")?be.content.replace(/#/,""):be.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Le}})))}}}),I.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(Oe,Se){var Ie=Oe.getWordUntilPosition(Se),Le={startLineNumber:Se.lineNumber,endLineNumber:Se.lineNumber,startColumn:Ie.startColumn,endColumn:Ie.endColumn},Ne=Oe.getLineContent(Se.lineNumber).substring(Ie.startColumn-2,Ie.endColumn);return{suggestions:[].concat(Object(B.a)(s.keywords.map(function(be){return{label:be,kind:I.languages.CompletionItemKind.Function,documentation:be,insertText:be,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Le}})),Object(B.a)(s.quickKey.map(function(be){return{label:be.label,kind:I.languages.CompletionItemKind.Function,documentation:be.content,insertText:Ne.startsWith("#")?be.content.replace(/#/,""):be.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Le}})))}}})},g="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",c=$("fjLI"),m=$("LvDl"),u=$("+ua5");function _(I){return/^\d+$/.test(I)?"".concat(I,"px"):I}function y(){}var T=!1,M={"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 L(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],W=I;if(Array.isArray(I)){for(var Q=0;Q<I.length;Q++){var fe=M[I[Q]];if(fe)return fe}return W[0]}return M[W]||W}var x=null,D=ye.b=function(I){var W=I.width,Q=W===void 0?"100%":W,fe=I.height,de=fe===void 0?"100%":fe,Oe=I.value,Se=I.language,Ie=Se===void 0?"javascript":Se,Le=I.style,Ne=Le===void 0?{}:Le,be=I.options,N=be===void 0?{}:be,A=I.overrideServices,C=A===void 0?{}:A,F=I.theme,G=F===void 0?"vs-dark":F,P=I.onEditBlur,oe=I.onSave,we=I.autoHeight,Re=we===void 0?!1:we,ee=I.forbidCopy,ce=ee===void 0?!1:ee,Ee=I.onChange,Ae=Ee===void 0?y:Ee,Me=I.editorDidMount,Be=Me===void 0?y:Me,He=I.onFocus,Fe=He===void 0?y:He,Ve=I.filename,Ke=Ve===void 0?"educoder.txt":Ve,Ge=I.errorLine,Ue=I.errorContent,qe=Ue===void 0?"":Ue,et=Object(H.a)(I,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),q=Object(U.useRef)(),K=Object(U.useRef)({}),V=Object(U.useRef)(),Z=Object(U.useRef)(),ie=Object(U.useRef)(!1),Y=Object(U.useRef)(),J=Object(U.useState)(!1),ne=Object(R.a)(J,2),se=ne[0],Te=ne[1];function _e(){var it;return q.current&&(it=new S.default(function(nt){var Et=Object(w.a)(nt),Nt;try{for(Et.s();!(Nt=Et.n()).done;){var qt=Nt.value;(qt.target.offsetHeight>0||qt.target.offsetWidth>0)&&K.current.instance.layout()}}catch(pi){Et.e(pi)}finally{Et.f()}}),it.observe(q.current)),it}function De(){k.b.warn(decodeURIComponent(g))}var We=function(){var nt=K.current.instance;if(Oe!=null&&nt&&se){var Et=nt.getModel();Et&&Oe!==Et.getValue()&&(T=!0,Et.setValue(Oe),nt.layout(),T=!1)}};Object(U.useEffect)(function(){Z.current&&clearTimeout(Z.current),Z.current=setTimeout(function(){We()},500)},[Oe,se,K.current]),Object(U.useEffect)(function(){if(Ge&&K.current&&K.current.instance){var it=K.current.instance;it.changeViewZones(function(Et){var Nt=document.createElement("div");Nt.style.padding="10px 20px",Nt.style.width="calc(100% - 20px)",Nt.className="my-error-line-wrp",Nt.innerHTML=qe,Et.addZone({afterLineNumber:Ge||11,heightInLines:3,domNode:Nt})});var nt={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}};it.addOverlayWidget(nt),it.revealPositionInCenter({lineNumber:20,column:1})}},[Ge,K.current,se]);function $e(){var it=K.current.instance;if(it){var nt=it.getSelection(),Et=K.current.pastePos||{},Nt=new x.Range(Et.startLineNumber||nt.endLineNumber,Et.startColumn||nt.endColumn,Et.endLineNumber||nt.endLineNumber,Et.endColumn||nt.endColumn);setTimeout(function(){it.executeEdits("",[{range:Nt,text:""}])},300)}}function Xe(it){(window.navigator.platform.match("Mac")?it.metaKey:it.ctrlKey)&&it.keyCode==83&&(it.preventDefault(),oe())}var _t=function(){if(Re&&K.current.instance){var nt=K.current.instance.getContentHeight();Gt(nt<de?de:nt)}else Gt(de)};function at(it){var nt=document.createEvent("MouseEvents");nt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),it.dispatchEvent(nt)}function Qe(it,nt){var Et=window.URL||window.webkitURL||window,Nt=new Blob([nt]),qt=document.createElementNS("http://www.w3.org/1999/xhtml","a");qt.href=Et.createObjectURL(Nt),qt.download=it,at(qt)}Object(U.useEffect)(function(){_t()},[_t]),Object(U.useEffect)(function(){q.current&&!se&&Promise.all([$.e(17),$.e(29)]).then($.t.bind(null,"M/lh",7)).then(function(it){try{x=it,K.current.instance=x.editor.create(q.current,{value:Oe,language:L(Ie),theme:G,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},C);var nt=K.current.instance,Et=c.d._menuItems,Nt=Object(B.a)(Et).find(function(Tt){return Tt[0]._debugName=="EditorContext"}),qt=Nt[1],pi=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],Wt=function(ut,zt){var At=ut._first;do{var oi,Ut,ui=zt.includes((oi=At.element)===null||oi===void 0||((Ut=oi.command)===null||Ut===void 0)?void 0:Ut.id);ui&&ut._remove(At)}while(At=At.next)};if(Be(nt,x),setTimeout(function(){_t(),K.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Qe(Ke||"educoder.txt",nt.getValue())}}),nt.getDomNode().addEventListener("input",function(){V.current.autoFormat&&nt.getAction("editor.action.formatDocument").run()})},500),K.current.subscription=nt.onDidChangeModelContent(function(Tt){ie.current?clearTimeout(Y.current):(_t(),Ae(nt.getValue(),Tt)),Y.current=setTimeout(function(){ie.current=!1},500)}),window.Monaco||b(x,L(Ie)),ce&&(Wt(qt,pi),q.current.classList.add("noCopyPaste"),nt.onKeyDown(function(Tt){var ut=Tt.keyCode,zt=Tt.ctrlKey,At=Tt.metaKey;(ut===33||ut===52)&&(At||zt)&&(De(),Tt.preventDefault())})),window.Monaco=x,P&&nt.onDidBlurEditorWidget(function(){P(nt.getValue())}),Fe&&nt.onDidFocusEditorText(function(){Fe(nt.getValue())}),ce){nt.addCommand(x.KeyMod.CtrlCmd|x.KeyCode.KEY_V,function(){return De(),null}),nt.onDidPaste(function(Tt){K.current.pastePos=Tt});try{window.addEventListener("paste",$e)}catch(Tt){}}var xt=_e();return Te(!0),function(){var Tt=K.current.instance;Tt.dispose();var ut=Tt.getModel();ut&&ut.dispose(),K.current.subscription&&K.current.subscription.dispose(),ce&&window.removeEventListener("paste",$e),xt.unobserve(q.current)}}catch(Tt){}})},[]),Object(U.useEffect)(function(){var it=K.current.instance;if(it&&se)return document.addEventListener("keydown",Xe,!1),function(){document.removeEventListener("keydown",Xe)}},[oe,se]),Object(U.useEffect)(function(){var it=K.current.instance;if(it&&se){var nt=L(Ie);x.editor.setModelLanguage(it.getModel(),nt),console.log("language:",Ie,it.getModel(),nt)}},[Ie,se]),Object(U.useEffect)(function(){var it=K.current.instance;it&&se&&x.editor.setTheme(G)},[G,se]),Object(U.useEffect)(function(){var it=K.current.instance;V.current=N,it&&se&&(it.updateOptions(Object(ae.a)({},N)),setTimeout(function(){it.getModel().updateOptions(Object(ae.a)({},N))},200))},[JSON.stringify(N),se]),Object(U.useEffect)(function(){var it=K.current.instance;it&&se&&it.layout()},[Q,de,se]);var kt=Object(U.useState)(_(Q)),St=Object(R.a)(kt,2),Bt=St[0],jt=St[1],lt=Object(U.useState)(_(de)),Kt=Object(R.a)(lt,2),Zt=Kt[0],Gt=Kt[1],ai=Object(ae.a)(Object(ae.a)({},Ne),{},{width:Bt,height:Zt});return e.a.createElement("div",{className:"my-monaco-editor",ref:q,style:ai})};function j(I){var W=I.width,Q=W===void 0?"100%":W,fe=I.height,de=fe===void 0?"100%":fe,Oe=I.original,Se=I.modified,Ie=I.language,Le=I.options,Ne=Le===void 0?{}:Le,be=Object(U.useRef)(),N=Object(U.useState)(null),A=Object(R.a)(N,2),C=A[0],F=A[1];function G(Re){var ee;return be.current&&(ee=new S.default(function(ce){var Ee=Object(w.a)(ce),Ae;try{for(Ee.s();!(Ae=Ee.n()).done;){var Me=Ae.value;(Me.target.offsetHeight>0||Me.target.offsetWidth>0)&&Re.layout()}}catch(Be){Ee.e(Be)}finally{Ee.f()}}),ee.observe(be.current)),ee}Object(U.useEffect)(function(){be.current&&Promise.all([$.e(17),$.e(29)]).then($.t.bind(null,"M/lh",7)).then(function(Re){x=Re;var ee=x.editor.createDiffEditor(be.current,Object(ae.a)(Object(ae.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},Ne),{},{wordWrap:!0}));F(ee);var ce=G(ee);return function(){ee.dispose();var Ee=ee.getModel();Ee&&Ee.dispose(),ce.unobserve(be.current)}})},[]),Object(U.useEffect)(function(){C&&C.setModel({original:x.editor.createModel(Oe,Ie),modified:x.editor.createModel(Se,Ie)})},[Oe,Se,Ie,C]);var P=_(Q),oe=_(de),we={width:P,height:oe};return e.a.createElement("div",{className:"my-diff-editor",ref:be,style:we})}},bT9E:function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return B});var ae=$("VTBJ");function B(O,k){var w=Object(ae.a)({},O);return Array.isArray(k)&&k.forEach(function(R){delete w[R]}),w}},fjLI:function(Ye,ye,$){"use strict";$.d(ye,"f",function(){return o}),$.d(ye,"b",function(){return a}),$.d(ye,"a",function(){return r}),$.d(ye,"d",function(){return l}),$.d(ye,"e",function(){return s}),$.d(ye,"c",function(){return n});var ae=$("8HAY"),B=$("Vhoy"),O=$("MI8n"),k=$("JYp7"),w=$("pmY6"),R=$("24hK"),H=$("nnTU"),U=$("T8No"),e=$("Cg/j"),S=$("t9D7"),d=function(i,t,v,f){var p=arguments.length,E=p<3?t:f===null?f=Object.getOwnPropertyDescriptor(t,v):f,b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(i,t,v,f);else for(var g=i.length-1;g>=0;g--)(b=i[g])&&(E=(p<3?b(E):p>3?b(t,v,E):b(t,v))||E);return p>3&&E&&Object.defineProperty(t,v,E),E},h=function(i,t){return function(v,f){t(v,f,i)}};function o(i){return i.command!==void 0}class a{constructor(i){this.id=a._idPool++,this._debugName=i}}a._idPool=0,a.CommandPalette=new a("CommandPalette"),a.EditorContext=new a("EditorContext"),a.SimpleEditorContext=new a("SimpleEditorContext"),a.EditorContextCopy=new a("EditorContextCopy"),a.EditorContextPeek=new a("EditorContextPeek"),a.MenubarEditMenu=new a("MenubarEditMenu"),a.MenubarCopy=new a("MenubarCopy"),a.MenubarGoMenu=new a("MenubarGoMenu"),a.MenubarSelectionMenu=new a("MenubarSelectionMenu"),a.InlineCompletionsActions=new a("InlineCompletionsActions");const r=Object(e.c)("menuService"),l=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new O.b,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:i=>i===a.CommandPalette}}addCommand(i){return this.addCommands(k.a.single(i))}addCommands(i){for(const t of i)this._commands.set(t.id,t);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),Object(w.i)(()=>{let t=!1;for(const v of i)t=this._commands.delete(v.id)||t;t&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(i){return this._commands.get(i)}getCommands(){const i=new Map;return this._commands.forEach((t,v)=>i.set(v,t)),i}appendMenuItem(i,t){return this.appendMenuItems(k.a.single({id:i,item:t}))}appendMenuItems(i){const t=new Set,v=new R.a;for(const{id:f,item:p}of i){let E=this._menuItems.get(f);E||(E=new R.a,this._menuItems.set(f,E)),v.push(E.push(p)),t.add(f)}return this._onDidChangeMenu.fire(t),Object(w.i)(()=>{if(v.size>0){for(let f of v)f();this._onDidChangeMenu.fire(t),v.clear()}})}getMenuItems(i){let t;return this._menuItems.has(i)?t=[...this._menuItems.get(i)]:t=[],i===a.CommandPalette&&this._appendImplicitItems(t),t}_appendImplicitItems(i){const t=new Set;for(const v of i)o(v)&&(t.add(v.command.id),v.alt&&t.add(v.alt.id));this._commands.forEach((v,f)=>{t.has(f)||i.push({command:v})})}};class s extends ae.e{constructor(i,t,v,f){super(`submenuitem.${i.submenu.id}`,typeof i.title=="string"?i.title:i.title.value,[],"submenu");this.item=i,this._menuService=t,this._contextKeyService=v,this._options=f}get actions(){const i=[],t=this._menuService.createMenu(this.item.submenu,this._contextKeyService),v=t.getActions(this._options);t.dispose();for(const[,f]of v)f.length>0&&(i.push(...f),i.push(new ae.d));return i.length&&i.pop(),i}}let n=class i{constructor(t,v,f,p,E){var b,g;if(this._commandService=E,this.id=t.id,this.label=(f==null?void 0:f.renderShortTitle)&&t.shortTitle?typeof t.shortTitle=="string"?t.shortTitle:t.shortTitle.value:typeof t.title=="string"?t.title:t.title.value,this.tooltip=(g=typeof t.tooltip=="string"?t.tooltip:(b=t.tooltip)===null||b===void 0?void 0:b.value)!==null&&g!==void 0?g:"",this.enabled=!t.precondition||p.contextMatchesRules(t.precondition),this.checked=void 0,t.toggled){const c=t.toggled.condition?t.toggled:{condition:t.toggled};this.checked=p.contextMatchesRules(c.condition),this.checked&&c.tooltip&&(this.tooltip=typeof c.tooltip=="string"?c.tooltip:c.tooltip.value),c.title&&(this.label=typeof c.title=="string"?c.title:c.title.value)}this.item=t,this.alt=v?new i(v,void 0,f,p,E):void 0,this._options=f,S.d.isThemeIcon(t.icon)&&(this.class=B.a.asClassName(t.icon))}dispose(){}run(...t){var v,f;let p=[];return((v=this._options)===null||v===void 0?void 0:v.arg)&&(p=[...p,this._options.arg]),((f=this._options)===null||f===void 0?void 0:f.shouldForwardArgs)&&(p=[...p,...t]),this._commandService.executeCommand(this.id,...p)}};n=d([h(3,U.b),h(4,H.b)],n)},ic2d:function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return k});var ae=$("FWmy"),B=$("746U");class O{constructor(){this.data=new Map}add(w,R){ae.a(B.l(w)),ae.a(B.k(R)),ae.a(!this.data.has(w),"There is already an extension with this id"),this.data.set(w,R)}as(w){return this.data.get(w)||null}}const k=new O},k3GJ:function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return En});var ae=$("rePB"),B=$("ODXe"),O=$("Ff2n"),k=$("VTBJ"),w=$("q1tI"),R=$("TSYQ"),H=$.n(R),U=$("Zm9Q"),e=$("6cGi"),S=$("KQm4"),d=$("xEkU"),h=$.n(d),o=$("t23M");function a(re){var pe=Object(w.useRef)(),ge=Object(w.useRef)(!1);function ue(){for(var z=arguments.length,te=new Array(z),X=0;X<z;X++)te[X]=arguments[X];ge.current||(h.a.cancel(pe.current),pe.current=h()(function(){re.apply(void 0,te)}))}return Object(w.useEffect)(function(){return function(){ge.current=!0,h.a.cancel(pe.current)}},[]),ue}function r(re){var pe=Object(w.useRef)([]),ge=Object(w.useState)({}),ue=Object(B.a)(ge,2),z=ue[1],te=Object(w.useRef)(typeof re=="function"?re():re),X=a(function(){var he=te.current;pe.current.forEach(function(ve){he=ve(he)}),pe.current=[],te.current=he,z({})});function le(he){pe.current.push(he),X()}return[te.current,le]}var l=$("4IlW");function s(re,pe){var ge,ue=re.prefixCls,z=re.id,te=re.active,X=re.rtl,le=re.tab,he=le.key,ve=le.tab,me=le.disabled,xe=le.closeIcon,Ce=re.tabBarGutter,ke=re.tabPosition,Pe=re.closable,je=re.renderWrapper,tt=re.removeAriaLabel,ht=re.editable,rt=re.onClick,ct=re.onRemove,dt=re.onFocus,st="".concat(ue,"-tab");w.useEffect(function(){return ct},[]);var ot={};ke==="top"||ke==="bottom"?ot[X?"marginLeft":"marginRight"]=Ce:ot.marginBottom=Ce;var vt=ht&&Pe!==!1&&!me;function ft(Ze){if(me)return;rt(Ze)}function Pt(Ze){Ze.preventDefault(),Ze.stopPropagation(),ht.onEdit("remove",{key:he,event:Ze})}var Ot=w.createElement("div",{key:he,ref:pe,className:H()(st,(ge={},Object(ae.a)(ge,"".concat(st,"-with-remove"),vt),Object(ae.a)(ge,"".concat(st,"-active"),te),Object(ae.a)(ge,"".concat(st,"-disabled"),me),ge)),style:ot,onClick:ft},w.createElement("div",{role:"tab","aria-selected":te,id:z&&"".concat(z,"-tab-").concat(he),className:"".concat(st,"-btn"),"aria-controls":z&&"".concat(z,"-panel-").concat(he),"aria-disabled":me,tabIndex:me?null:0,onClick:function(Je){Je.stopPropagation(),ft(Je)},onKeyDown:function(Je){[l.a.SPACE,l.a.ENTER].includes(Je.which)&&(Je.preventDefault(),ft(Je))},onFocus:dt},ve),vt&&w.createElement("button",{type:"button","aria-label":tt||"remove",tabIndex:0,className:"".concat(st,"-remove"),onClick:function(Je){Je.stopPropagation(),Pt(Je)}},xe||ht.removeIcon||"\xD7"));return je&&(Ot=je(Ot)),Ot}var n=w.forwardRef(s),i={width:0,height:0,left:0,top:0};function t(re,pe,ge){return Object(w.useMemo)(function(){for(var ue,z=new Map,te=pe.get((ue=re[0])===null||ue===void 0?void 0:ue.key)||i,X=te.left+te.width,le=0;le<re.length;le+=1){var he=re[le].key,ve=pe.get(he);if(!ve){var me;ve=pe.get((me=re[le-1])===null||me===void 0?void 0:me.key)||i}var xe=z.get(he)||Object(k.a)({},ve);xe.right=X-xe.left-xe.width,z.set(he,xe)}return z},[re.map(function(ue){return ue.key}).join("_"),pe,ge])}var v={width:0,height:0,left:0,top:0,right:0};function f(re,pe,ge,ue,z){var te=z.tabs,X=z.tabPosition,le=z.rtl,he,ve,me;["top","bottom"].includes(X)?(he="width",ve=le?"right":"left",me=Math.abs(pe.left)):(he="height",ve="top",me=-pe.top);var xe=pe[he],Ce=ge[he],ke=ue[he],Pe=xe;return Ce+ke>xe&&(Pe=xe-ke),Object(w.useMemo)(function(){if(!te.length)return[0,0];for(var je=te.length,tt=je,ht=0;ht<je;ht+=1){var rt=re.get(te[ht].key)||v;if(rt[ve]+rt[he]>me+Pe){tt=ht-1;break}}for(var ct=0,dt=je-1;dt>=0;dt-=1){var st=re.get(te[dt].key)||v;if(st[ve]<me){ct=dt+1;break}}return[ct,tt]},[re,me,Pe,X,te.map(function(je){return je.key}).join("_"),le])}var p=$("wx14"),E=$("1OyB"),b=$("vuIU"),g=$("JX7q"),c=$("Ji7U"),m=$("LK+K"),u=$("I8Z2"),_=$("bT9E"),y=$("2GS6"),T=$("Gytx"),M=$.n(T),L=$("U8pU"),x=/iPhone/i,D=/iPod/i,j=/iPad/i,I=/\bAndroid(?:.+)Mobile\b/i,W=/Android/i,Q=/\bAndroid(?:.+)SD4930UR\b/i,fe=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,de=/Windows Phone/i,Oe=/\bWindows(?:.+)ARM\b/i,Se=/BlackBerry/i,Ie=/BB10/i,Le=/Opera Mini/i,Ne=/\b(CriOS|Chrome)(?:.+)Mobile/i,be=/Mobile(?:.+)Firefox\b/i;function N(re,pe){return re.test(pe)}function A(re){var pe=re||(typeof navigator!="undefined"?navigator.userAgent:""),ge=(pe||"").split("[FBAN");if(typeof ge[1]!="undefined"){var ue=ge,z=Object(B.a)(ue,1);pe=z[0]}if(ge=pe.split("Twitter"),typeof ge[1]!="undefined"){var te=ge,X=Object(B.a)(te,1);pe=X[0]}var le={apple:{phone:N(x,pe)&&!N(de,pe),ipod:N(D,pe),tablet:!N(x,pe)&&N(j,pe)&&!N(de,pe),device:(N(x,pe)||N(D,pe)||N(j,pe))&&!N(de,pe)},amazon:{phone:N(Q,pe),tablet:!N(Q,pe)&&N(fe,pe),device:N(Q,pe)||N(fe,pe)},android:{phone:!N(de,pe)&&N(Q,pe)||!N(de,pe)&&N(I,pe),tablet:!N(de,pe)&&!N(Q,pe)&&!N(I,pe)&&(N(fe,pe)||N(W,pe)),device:!N(de,pe)&&(N(Q,pe)||N(fe,pe)||N(I,pe)||N(W,pe))||N(/\bokhttp\b/i,pe)},windows:{phone:N(de,pe),tablet:N(Oe,pe),device:N(de,pe)||N(Oe,pe)},other:{blackberry:N(Se,pe),blackberry10:N(Ie,pe),opera:N(Le,pe),firefox:N(be,pe),chrome:N(Ne,pe),device:N(Se,pe)||N(Ie,pe)||N(Le,pe)||N(be,pe)||N(Ne,pe)},any:null,phone:null,tablet:null};return le.any=le.apple.device||le.android.device||le.windows.device||le.other.device,le.phone=le.apple.phone||le.android.phone||le.windows.phone,le.tablet=le.apple.tablet||le.android.tablet||le.windows.tablet,le}var C=Object(k.a)(Object(k.a)({},A()),{},{isMobile:A}),F=C;function G(){}function P(re,pe,ge){var ue=pe||"";return re.key||"".concat(ue,"item_").concat(ge)}function oe(re){return"".concat(re,"-menu-")}function we(re,pe){var ge=-1;w.Children.forEach(re,function(ue){ge+=1,ue&&ue.type&&ue.type.isMenuItemGroup?w.Children.forEach(ue.props.children,function(z){ge+=1,pe(z,ge)}):pe(ue,ge)})}function Re(re,pe,ge){if(!re||ge.find)return;w.Children.forEach(re,function(ue){if(ue){var z=ue.type;if(!z||!(z.isSubMenu||z.isMenuItem||z.isMenuItemGroup))return;pe.indexOf(ue.key)!==-1?ge.find=!0:ue.props.children&&Re(ue.props.children,pe,ge)}})}var ee=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],ce=function(pe){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ue=pe&&typeof pe.getBoundingClientRect=="function"&&pe.getBoundingClientRect().width;if(ue){if(ge){var z=getComputedStyle(pe),te=z.marginLeft,X=z.marginRight;ue+=+te.replace("px","")+ +X.replace("px","")}ue=+ue.toFixed(6)}return ue||0},Ee=function(pe,ge,ue){pe&&Object(L.a)(pe.style)==="object"&&(pe.style[ge]=ue)},Ae=function(){return F.any},Me=$("bdgK"),Be=$("i8i4"),He=$.n(Be),Fe=$("wgJM"),Ve=$("l4aY"),Ke=$("m+aA"),Ge=$("c+Xe"),Ue=$("zT1h"),qe=$("QC+M");function et(re,pe,ge){return ge?re[0]===pe[0]:re[0]===pe[0]&&re[1]===pe[1]}function q(re,pe,ge){var ue=re[pe]||{};return Object(k.a)(Object(k.a)({},ue),ge)}function K(re,pe,ge,ue){for(var z=ge.points,te=Object.keys(re),X=0;X<te.length;X+=1){var le=te[X];if(et(re[le].points,z,ue))return"".concat(pe,"-placement-").concat(le)}return""}var V=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var re=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(re)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(re==null?void 0:re.substr(0,4)))},Z=$("MNnm");function ie(re,pe){var ge={};return ge[re.toLowerCase()]=pe.toLowerCase(),ge["Webkit".concat(re)]="webkit".concat(pe),ge["Moz".concat(re)]="moz".concat(pe),ge["ms".concat(re)]="MS".concat(pe),ge["O".concat(re)]="o".concat(pe.toLowerCase()),ge}function Y(re,pe){var ge={animationend:ie("Animation","AnimationEnd"),transitionend:ie("Transition","TransitionEnd")};return re&&("AnimationEvent"in pe||delete ge.animationend.animation,"TransitionEvent"in pe||delete ge.transitionend.transition),ge}var J=Y(Object(Z.a)(),typeof window!="undefined"?window:{}),ne={};if(Object(Z.a)()){var se=document.createElement("div");ne=se.style}var Te={};function _e(re){if(Te[re])return Te[re];var pe=J[re];if(pe)for(var ge=Object.keys(pe),ue=ge.length,z=0;z<ue;z+=1){var te=ge[z];if(Object.prototype.hasOwnProperty.call(pe,te)&&te in ne)return Te[re]=pe[te],Te[re]}return""}var De=_e("animationend"),We=_e("transitionend"),$e=!!(De&&We),Xe=De||"animationend",_t=We||"transitionend";function at(re,pe){if(!re)return null;if(Object(L.a)(re)==="object"){var ge=pe.replace(/-\w/g,function(ue){return ue[1].toUpperCase()});return re[ge]}return"".concat(re,"-").concat(pe)}var Qe="none",kt="appear",St="enter",Bt="leave",jt="none",lt="prepare",Kt="start",Zt="active",Gt="end";function ai(re){var pe=Object(w.useRef)(!1),ge=Object(w.useState)(re),ue=Object(B.a)(ge,2),z=ue[0],te=ue[1];function X(le){pe.current||te(le)}return Object(w.useEffect)(function(){return function(){pe.current=!0}},[]),[z,X]}var it=Object(Z.a)()?w.useLayoutEffect:w.useEffect,nt=it,Et=function(){var re=w.useRef(null);function pe(){Fe.a.cancel(re.current)}function ge(ue){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;pe();var te=Object(Fe.a)(function(){z<=1?ue({isCanceled:function(){return te!==re.current}}):ge(ue,z-1)});re.current=te}return w.useEffect(function(){return function(){pe()}},[]),[ge,pe]},Nt=[lt,Kt,Zt,Gt],qt=!1,pi=!0;function Wt(re){return re===Zt||re===Gt}var xt=function(re,pe){var ge=w.useState(jt),ue=Object(B.a)(ge,2),z=ue[0],te=ue[1],X=Et(),le=Object(B.a)(X,2),he=le[0],ve=le[1];function me(){te(lt)}return nt(function(){if(z!==jt&&z!==Gt){var xe=Nt.indexOf(z),Ce=Nt[xe+1],ke=pe(z);ke===qt?te(Ce):he(function(Pe){function je(){if(Pe.isCanceled())return;te(Ce)}ke===!0?je():Promise.resolve(ke).then(je)})}},[re,z]),w.useEffect(function(){return function(){ve()}},[]),[me,z]},Tt=function(re){var pe=Object(w.useRef)(),ge=Object(w.useRef)(re);ge.current=re;var ue=w.useCallback(function(X){ge.current(X)},[]);function z(X){X&&(X.removeEventListener(_t,ue),X.removeEventListener(Xe,ue))}function te(X){pe.current&&pe.current!==X&&z(pe.current),X&&X!==pe.current&&(X.addEventListener(_t,ue),X.addEventListener(Xe,ue),pe.current=X)}return w.useEffect(function(){return function(){z(pe.current)}},[]),[te,z]};function ut(re,pe,ge,ue){var z=ue.motionEnter,te=z===void 0?!0:z,X=ue.motionAppear,le=X===void 0?!0:X,he=ue.motionLeave,ve=he===void 0?!0:he,me=ue.motionDeadline,xe=ue.motionLeaveImmediately,Ce=ue.onAppearPrepare,ke=ue.onEnterPrepare,Pe=ue.onLeavePrepare,je=ue.onAppearStart,tt=ue.onEnterStart,ht=ue.onLeaveStart,rt=ue.onAppearActive,ct=ue.onEnterActive,dt=ue.onLeaveActive,st=ue.onAppearEnd,ot=ue.onEnterEnd,vt=ue.onLeaveEnd,ft=ue.onVisibleChanged,Pt=ai(),Ot=Object(B.a)(Pt,2),Ze=Ot[0],Je=Ot[1],pt=ai(Qe),gt=Object(B.a)(pt,2),ze=gt[0],yt=gt[1],Lt=ai(null),bt=Object(B.a)(Lt,2),Rt=bt[0],Mt=bt[1],Xt=Object(w.useRef)(!1),ei=Object(w.useRef)(null),Ft=Object(w.useRef)(!1),ti=Object(w.useRef)(null);function si(){var Dt=ge();return Dt||ti.current}var ii=Object(w.useRef)(!1);function ni(Dt){var wt=si();if(Dt&&!Dt.deadline&&Dt.target!==wt)return;var Jt;ze===kt&&ii.current?Jt=st==null?void 0:st(wt,Dt):ze===St&&ii.current?Jt=ot==null?void 0:ot(wt,Dt):ze===Bt&&ii.current&&(Jt=vt==null?void 0:vt(wt,Dt)),Jt!==!1&&!Ft.current&&(yt(Qe),Mt(null))}var Ht=Tt(ni),Qt=Object(B.a)(Ht,1),$t=Qt[0],Vt=w.useMemo(function(){var Dt,wt,Jt;switch(ze){case"appear":return Dt={},Object(ae.a)(Dt,lt,Ce),Object(ae.a)(Dt,Kt,je),Object(ae.a)(Dt,Zt,rt),Dt;case"enter":return wt={},Object(ae.a)(wt,lt,ke),Object(ae.a)(wt,Kt,tt),Object(ae.a)(wt,Zt,ct),wt;case"leave":return Jt={},Object(ae.a)(Jt,lt,Pe),Object(ae.a)(Jt,Kt,ht),Object(ae.a)(Jt,Zt,dt),Jt;default:return{}}},[ze]),di=xt(ze,function(Dt){if(Dt===lt){var wt=Vt[lt];return wt?wt(si()):qt}if(It in Vt){var Jt;Mt(((Jt=Vt[It])===null||Jt===void 0?void 0:Jt.call(Vt,si(),null))||null)}return It===Zt&&($t(si()),me>0&&(clearTimeout(ei.current),ei.current=setTimeout(function(){ni({deadline:!0})},me))),pi}),ci=Object(B.a)(di,2),mi=ci[0],It=ci[1],li=Wt(It);ii.current=li,nt(function(){Je(pe);var Dt=Xt.current;if(Xt.current=!0,!re)return;var wt;!Dt&&pe&&le&&(wt=kt),Dt&&pe&&te&&(wt=St),(Dt&&!pe&&ve||!Dt&&xe&&!pe&&ve)&&(wt=Bt),wt&&(yt(wt),mi())},[pe]),Object(w.useEffect)(function(){(ze===kt&&!le||ze===St&&!te||ze===Bt&&!ve)&&yt(Qe)},[le,te,ve]),Object(w.useEffect)(function(){return function(){clearTimeout(ei.current),Ft.current=!0}},[]),Object(w.useEffect)(function(){Ze!==void 0&&ze===Qe&&(ft==null||ft(Ze))},[Ze,ze]);var gi=Rt;return Vt[lt]&&It===Kt&&(gi=Object(k.a)({transition:"none"},gi)),[ze,It,gi,Ze!=null?Ze:pe]}var zt=function(re){Object(c.a)(ge,re);var pe=Object(m.a)(ge);function ge(){return Object(E.a)(this,ge),pe.apply(this,arguments)}return Object(b.a)(ge,[{key:"render",value:function(){return this.props.children}}]),ge}(w.Component),At=zt;function oi(re){var pe=re;Object(L.a)(re)==="object"&&(pe=re.transitionSupport);function ge(z){return!!(z.motionName&&pe)}var ue=w.forwardRef(function(z,te){var X=z.visible,le=X===void 0?!0:X,he=z.removeOnLeave,ve=he===void 0?!0:he,me=z.forceRender,xe=z.children,Ce=z.motionName,ke=z.leavedClassName,Pe=z.eventProps,je=ge(z),tt=Object(w.useRef)(),ht=Object(w.useRef)();function rt(){try{return Object(Ke.a)(tt.current||ht.current)}catch(yt){return null}}var ct=ut(je,le,rt,z),dt=Object(B.a)(ct,4),st=dt[0],ot=dt[1],vt=dt[2],ft=dt[3],Pt=w.useRef(ft);ft&&(Pt.current=!0);var Ot=Object(w.useRef)(te);Ot.current=te;var Ze=w.useCallback(function(yt){tt.current=yt,Object(Ge.b)(Ot.current,yt)},[]),Je,pt=Object(k.a)(Object(k.a)({},Pe),{},{visible:le});if(!xe)Je=null;else if(st===Qe||!ge(z))ft?Je=xe(Object(k.a)({},pt),Ze):!ve&&Pt.current?Je=xe(Object(k.a)(Object(k.a)({},pt),{},{className:ke}),Ze):me?Je=xe(Object(k.a)(Object(k.a)({},pt),{},{style:{display:"none"}}),Ze):Je=null;else{var gt,ze;ot===lt?ze="prepare":Wt(ot)?ze="active":ot===Kt&&(ze="start"),Je=xe(Object(k.a)(Object(k.a)({},pt),{},{className:H()(at(Ce,st),(gt={},Object(ae.a)(gt,at(Ce,"".concat(st,"-").concat(ze)),ze),Object(ae.a)(gt,Ce,typeof Ce=="string"),gt)),style:vt}),Ze)}return w.createElement(At,{ref:ht},Je)});return ue.displayName="CSSMotion",ue}var Ut=oi($e),ui="add",_i="keep",Ei="remove",Ji="removed";function Xn(re){var pe;return re&&Object(L.a)(re)==="object"&&"key"in re?pe=re:pe={key:re},Object(k.a)(Object(k.a)({},pe),{},{key:String(pe.key)})}function Ni(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return re.map(Xn)}function $n(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ge=[],ue=0,z=pe.length,te=Ni(re),X=Ni(pe);te.forEach(function(ve){for(var me=!1,xe=ue;xe<z;xe+=1){var Ce=X[xe];if(Ce.key===ve.key){ue<xe&&(ge=ge.concat(X.slice(ue,xe).map(function(ke){return Object(k.a)(Object(k.a)({},ke),{},{status:ui})})),ue=xe),ge.push(Object(k.a)(Object(k.a)({},Ce),{},{status:_i})),ue+=1,me=!0;break}}me||ge.push(Object(k.a)(Object(k.a)({},ve),{},{status:Ei}))}),ue<z&&(ge=ge.concat(X.slice(ue).map(function(ve){return Object(k.a)(Object(k.a)({},ve),{},{status:ui})})));var le={};ge.forEach(function(ve){var me=ve.key;le[me]=(le[me]||0)+1});var he=Object.keys(le).filter(function(ve){return le[ve]>1});return he.forEach(function(ve){ge=ge.filter(function(me){var xe=me.key,Ce=me.status;return xe!==ve||Ce!==Ei}),ge.forEach(function(me){me.key===ve&&(me.status=_i)})}),ge}var Jn=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function Qn(re){var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ut,ge=function(ue){Object(c.a)(te,ue);var z=Object(m.a)(te);function te(){var X;return Object(E.a)(this,te),X=z.apply(this,arguments),X.state={keyEntities:[]},X.removeKey=function(le){X.setState(function(he){var ve=he.keyEntities;return{keyEntities:ve.map(function(me){return me.key!==le?me:Object(k.a)(Object(k.a)({},me),{},{status:Ji})})}})},X}return Object(b.a)(te,[{key:"render",value:function(){var le=this,he=this.state.keyEntities,ve=this.props,me=ve.component,xe=ve.children,Ce=ve.onVisibleChanged,ke=Object(O.a)(ve,["component","children","onVisibleChanged"]),Pe=me||w.Fragment,je={};return Jn.forEach(function(tt){je[tt]=ke[tt],delete ke[tt]}),delete ke.keys,w.createElement(Pe,ke,he.map(function(tt){var ht=tt.status,rt=Object(O.a)(tt,["status"]),ct=ht===ui||ht===_i;return w.createElement(pe,Object(p.a)({},je,{key:rt.key,visible:ct,eventProps:rt,onVisibleChanged:function(st){Ce==null||Ce(st,{key:rt.key}),st||le.removeKey(rt.key)}}),xe)}))}}],[{key:"getDerivedStateFromProps",value:function(le,he){var ve=le.keys,me=he.keyEntities,xe=Ni(ve),Ce=$n(me,xe);return{keyEntities:Ce.filter(function(ke){var Pe=me.find(function(je){var tt=je.key;return ke.key===tt});return!(Pe&&Pe.status===Ji&&ke.status===Ei)})}}}]),te}(w.Component);return ge.defaultProps={component:"div"},ge}var da=Qn($e),Li=Ut;function Qi(re){var pe=re.prefixCls,ge=re.motion,ue=re.animation,z=re.transitionName;return ge||(ue?{motionName:"".concat(pe,"-").concat(ue)}:z?{motionName:z}:null)}function Zn(re){var pe=re.prefixCls,ge=re.visible,ue=re.zIndex,z=re.mask,te=re.maskMotion,X=re.maskAnimation,le=re.maskTransitionName;if(!z)return null;var he={};return(te||le||X)&&(he=Object(k.a)({motionAppear:!0},Qi({motion:te,prefixCls:pe,transitionName:le,animation:X}))),w.createElement(Li,Object(p.a)({},he,{visible:ge,removeOnLeave:!0}),function(ve){var me=ve.className;return w.createElement("div",{style:{zIndex:ue},className:H()("".concat(pe,"-mask"),me)})})}var qn=$("9mu1"),er=$("o0o1"),Zi=$.n(er),tr=$("HaE+"),qi=["measure","align",null,"motion"],ir=function(re,pe){var ge=Object(w.useState)(null),ue=Object(B.a)(ge,2),z=ue[0],te=ue[1],X=Object(w.useRef)(),le=Object(w.useRef)(!1);function he(xe){le.current||te(xe)}function ve(){Fe.a.cancel(X.current)}function me(xe){ve(),X.current=Object(Fe.a)(function(){he(function(Ce){switch(z){case"align":return"motion";case"motion":return"stable";default:}return Ce}),xe==null||xe()})}return Object(w.useEffect)(function(){he("measure")},[re]),Object(w.useEffect)(function(){switch(z){case"measure":pe();break;default:}z&&(X.current=Object(Fe.a)(Object(tr.a)(Zi.a.mark(function xe(){var Ce,ke;return Zi.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:Ce=qi.indexOf(z),ke=qi[Ce+1],ke&&Ce!==-1&&he(ke);case 3:case"end":return je.stop()}},xe)}))))},[z]),Object(w.useEffect)(function(){return function(){le.current=!0,ve()}},[]),[z,me]},nr=function(re){var pe=w.useState({width:0,height:0}),ge=Object(B.a)(pe,2),ue=ge[0],z=ge[1];function te(le){z({width:le.offsetWidth,height:le.offsetHeight})}var X=w.useMemo(function(){var le={};if(re){var he=ue.width,ve=ue.height;re.indexOf("height")!==-1&&ve?le.height=ve:re.indexOf("minHeight")!==-1&&ve&&(le.minHeight=ve),re.indexOf("width")!==-1&&he?le.width=he:re.indexOf("minWidth")!==-1&&he&&(le.minWidth=he)}return le},[re,ue]);return[X,te]},en=w.forwardRef(function(re,pe){var ge=re.visible,ue=re.prefixCls,z=re.className,te=re.style,X=re.children,le=re.zIndex,he=re.stretch,ve=re.destroyPopupOnHide,me=re.forceRender,xe=re.align,Ce=re.point,ke=re.getRootDomNode,Pe=re.getClassNameFromAlign,je=re.onAlign,tt=re.onMouseEnter,ht=re.onMouseLeave,rt=re.onMouseDown,ct=re.onTouchStart,dt=Object(w.useRef)(),st=Object(w.useRef)(),ot=Object(w.useState)(),vt=Object(B.a)(ot,2),ft=vt[0],Pt=vt[1],Ot=nr(he),Ze=Object(B.a)(Ot,2),Je=Ze[0],pt=Ze[1];function gt(){he&&pt(ke())}var ze=ir(ge,gt),yt=Object(B.a)(ze,2),Lt=yt[0],bt=yt[1],Rt=Object(w.useRef)();function Mt(){return Ce||ke}function Xt(){var Ht;(Ht=dt.current)===null||Ht===void 0||Ht.forceAlign()}function ei(Ht,Qt){var $t=Pe(Qt);ft!==$t&&Pt($t),Lt==="align"&&(ft!==$t?Promise.resolve().then(function(){Xt()}):bt(function(){var Vt;(Vt=Rt.current)===null||Vt===void 0||Vt.call(Rt)}),je==null||je(Ht,Qt))}var Ft=Object(k.a)({},Qi(re));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(Ht){var Qt=Ft[Ht];Ft[Ht]=function($t,Vt){return bt(),Qt==null?void 0:Qt($t,Vt)}});function ti(){return new Promise(function(Ht){Rt.current=Ht})}w.useEffect(function(){!Ft.motionName&&Lt==="motion"&&bt()},[Ft.motionName,Lt]),w.useImperativeHandle(pe,function(){return{forceAlign:Xt,getElement:function(){return st.current}}});var si=Object(k.a)(Object(k.a)({},Je),{},{zIndex:le,opacity:Lt==="motion"||Lt==="stable"||!ge?void 0:0,pointerEvents:Lt==="stable"?void 0:"none"},te),ii=!0;(xe==null?void 0:xe.points)&&(Lt==="align"||Lt==="stable")&&(ii=!1);var ni=X;return w.Children.count(X)>1&&(ni=w.createElement("div",{className:"".concat(ue,"-content")},X)),w.createElement(Li,Object(p.a)({visible:ge,ref:st,leavedClassName:"".concat(ue,"-hidden")},Ft,{onAppearPrepare:ti,onEnterPrepare:ti,removeOnLeave:ve,forceRender:me}),function(Ht,Qt){var $t=Ht.className,Vt=Ht.style,di=H()(ue,z,ft,$t);return w.createElement(qn.a,{target:Mt(),key:"popup",ref:dt,monitorWindowResize:!0,disabled:ii,align:xe,onAlign:ei},w.createElement("div",{ref:Qt,className:di,onMouseEnter:tt,onMouseLeave:ht,onMouseDownCapture:rt,onTouchStartCapture:ct,style:Object(k.a)(Object(k.a)({},Vt),si)},ni))})});en.displayName="PopupInner";var rr=en,tn=w.forwardRef(function(re,pe){var ge=re.prefixCls,ue=re.visible,z=re.zIndex,te=re.children,X=re.mobile;X=X===void 0?{}:X;var le=X.popupClassName,he=X.popupStyle,ve=X.popupMotion,me=ve===void 0?{}:ve,xe=X.popupRender,Ce=w.useRef();w.useImperativeHandle(pe,function(){return{forceAlign:function(){},getElement:function(){return Ce.current}}});var ke=Object(k.a)({zIndex:z},he),Pe=te;return w.Children.count(te)>1&&(Pe=w.createElement("div",{className:"".concat(ge,"-content")},te)),xe&&(Pe=xe(Pe)),w.createElement(Li,Object(p.a)({visible:ue,ref:Ce,removeOnLeave:!0},me),function(je,tt){var ht=je.className,rt=je.style,ct=H()(ge,le,ht);return w.createElement("div",{ref:tt,className:ct,style:Object(k.a)(Object(k.a)({},rt),ke)},Pe)})});tn.displayName="MobilePopupInner";var ar=tn,sr=["visible","mobile"],nn=w.forwardRef(function(re,pe){var ge=re.visible,ue=re.mobile,z=Object(O.a)(re,sr),te=Object(w.useState)(ge),X=Object(B.a)(te,2),le=X[0],he=X[1],ve=Object(w.useState)(!1),me=Object(B.a)(ve,2),xe=me[0],Ce=me[1],ke=Object(k.a)(Object(k.a)({},z),{},{visible:le});Object(w.useEffect)(function(){he(ge),ge&&ue&&Ce(V())},[ge,ue]);var Pe=xe?w.createElement(ar,Object(p.a)({},ke,{mobile:ue,ref:pe})):w.createElement(rr,Object(p.a)({},ke,{ref:pe}));return w.createElement("div",null,w.createElement(Zn,ke),Pe)});nn.displayName="Popup";var or=nn,lr=w.createContext(null),rn=lr;function Ui(){}function ur(){return""}function hr(re){return re?re.ownerDocument:window.document}var dr=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function cr(re){var pe=function(ge){Object(c.a)(z,ge);var ue=Object(m.a)(z);function z(te){var X;Object(E.a)(this,z),X=ue.call(this,te),X.popupRef=w.createRef(),X.triggerRef=w.createRef(),X.attachId=void 0,X.clickOutsideHandler=void 0,X.touchOutsideHandler=void 0,X.contextMenuOutsideHandler1=void 0,X.contextMenuOutsideHandler2=void 0,X.mouseDownTimeout=void 0,X.focusTime=void 0,X.preClickTime=void 0,X.preTouchTime=void 0,X.delayTimer=void 0,X.hasPopupMouseDown=void 0,X.onMouseEnter=function(he){var ve=X.props.mouseEnterDelay;X.fireEvents("onMouseEnter",he),X.delaySetPopupVisible(!0,ve,ve?null:he)},X.onMouseMove=function(he){X.fireEvents("onMouseMove",he),X.setPoint(he)},X.onMouseLeave=function(he){X.fireEvents("onMouseLeave",he),X.delaySetPopupVisible(!1,X.props.mouseLeaveDelay)},X.onPopupMouseEnter=function(){X.clearDelayTimer()},X.onPopupMouseLeave=function(he){var ve;if(he.relatedTarget&&!he.relatedTarget.setTimeout&&Object(Ve.a)((ve=X.popupRef.current)===null||ve===void 0?void 0:ve.getElement(),he.relatedTarget))return;X.delaySetPopupVisible(!1,X.props.mouseLeaveDelay)},X.onFocus=function(he){X.fireEvents("onFocus",he),X.clearDelayTimer(),X.isFocusToShow()&&(X.focusTime=Date.now(),X.delaySetPopupVisible(!0,X.props.focusDelay))},X.onMouseDown=function(he){X.fireEvents("onMouseDown",he),X.preClickTime=Date.now()},X.onTouchStart=function(he){X.fireEvents("onTouchStart",he),X.preTouchTime=Date.now()},X.onBlur=function(he){X.fireEvents("onBlur",he),X.clearDelayTimer(),X.isBlurToHide()&&X.delaySetPopupVisible(!1,X.props.blurDelay)},X.onContextMenu=function(he){he.preventDefault(),X.fireEvents("onContextMenu",he),X.setPopupVisible(!0,he)},X.onContextMenuClose=function(){X.isContextMenuToShow()&&X.close()},X.onClick=function(he){if(X.fireEvents("onClick",he),X.focusTime){var ve;if(X.preClickTime&&X.preTouchTime?ve=Math.min(X.preClickTime,X.preTouchTime):X.preClickTime?ve=X.preClickTime:X.preTouchTime&&(ve=X.preTouchTime),Math.abs(ve-X.focusTime)<20)return;X.focusTime=0}X.preClickTime=0,X.preTouchTime=0,X.isClickToShow()&&(X.isClickToHide()||X.isBlurToHide())&&he&&he.preventDefault&&he.preventDefault();var me=!X.state.popupVisible;(X.isClickToHide()&&!me||me&&X.isClickToShow())&&X.setPopupVisible(!X.state.popupVisible,he)},X.onPopupMouseDown=function(){if(X.hasPopupMouseDown=!0,clearTimeout(X.mouseDownTimeout),X.mouseDownTimeout=window.setTimeout(function(){X.hasPopupMouseDown=!1},0),X.context){var he;(he=X.context).onPopupMouseDown.apply(he,arguments)}},X.onDocumentClick=function(he){if(X.props.mask&&!X.props.maskClosable)return;var ve=he.target,me=X.getRootDomNode(),xe=X.getPopupDomNode();(!Object(Ve.a)(me,ve)||X.isContextMenuOnly())&&!Object(Ve.a)(xe,ve)&&!X.hasPopupMouseDown&&X.close()},X.getRootDomNode=function(){var he=X.props.getTriggerDOMNode;if(he)return he(X.triggerRef.current);try{var ve=Object(Ke.a)(X.triggerRef.current);if(ve)return ve}catch(me){}return He.a.findDOMNode(Object(g.a)(X))},X.getPopupClassNameFromAlign=function(he){var ve=[],me=X.props,xe=me.popupPlacement,Ce=me.builtinPlacements,ke=me.prefixCls,Pe=me.alignPoint,je=me.getPopupClassNameFromAlign;return xe&&Ce&&ve.push(K(Ce,ke,he,Pe)),je&&ve.push(je(he)),ve.join(" ")},X.getComponent=function(){var he=X.props,ve=he.prefixCls,me=he.destroyPopupOnHide,xe=he.popupClassName,Ce=he.onPopupAlign,ke=he.popupMotion,Pe=he.popupAnimation,je=he.popupTransitionName,tt=he.popupStyle,ht=he.mask,rt=he.maskAnimation,ct=he.maskTransitionName,dt=he.maskMotion,st=he.zIndex,ot=he.popup,vt=he.stretch,ft=he.alignPoint,Pt=he.mobile,Ot=he.forceRender,Ze=X.state,Je=Ze.popupVisible,pt=Ze.point,gt=X.getPopupAlign(),ze={};return X.isMouseEnterToShow()&&(ze.onMouseEnter=X.onPopupMouseEnter),X.isMouseLeaveToHide()&&(ze.onMouseLeave=X.onPopupMouseLeave),ze.onMouseDown=X.onPopupMouseDown,ze.onTouchStart=X.onPopupMouseDown,w.createElement(or,Object(p.a)({prefixCls:ve,destroyPopupOnHide:me,visible:Je,point:ft&&pt,className:xe,align:gt,onAlign:Ce,animation:Pe,getClassNameFromAlign:X.getPopupClassNameFromAlign},ze,{stretch:vt,getRootDomNode:X.getRootDomNode,style:tt,mask:ht,zIndex:st,transitionName:je,maskAnimation:rt,maskTransitionName:ct,maskMotion:dt,ref:X.popupRef,motion:ke,mobile:Pt,forceRender:Ot}),typeof ot=="function"?ot():ot)},X.attachParent=function(he){Fe.a.cancel(X.attachId);var ve=X.props,me=ve.getPopupContainer,xe=ve.getDocument,Ce=X.getRootDomNode(),ke;me?(Ce||me.length===0)&&(ke=me(Ce)):ke=xe(X.getRootDomNode()).body,ke?ke.appendChild(he):X.attachId=Object(Fe.a)(function(){X.attachParent(he)})},X.getContainer=function(){var he=X.props.getDocument,ve=he(X.getRootDomNode()).createElement("div");return ve.style.position="absolute",ve.style.top="0",ve.style.left="0",ve.style.width="100%",X.attachParent(ve),ve},X.setPoint=function(he){var ve=X.props.alignPoint;if(!ve||!he)return;X.setState({point:{pageX:he.pageX,pageY:he.pageY}})},X.handlePortalUpdate=function(){X.state.prevPopupVisible!==X.state.popupVisible&&X.props.afterPopupVisibleChange(X.state.popupVisible)},X.triggerContextValue={onPopupMouseDown:X.onPopupMouseDown};var le;return"popupVisible"in te?le=!!te.popupVisible:le=!!te.defaultPopupVisible,X.state={prevPopupVisible:le,popupVisible:le},dr.forEach(function(he){X["fire".concat(he)]=function(ve){X.fireEvents(he,ve)}}),X}return Object(b.a)(z,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var X=this.props,le=this.state;if(le.popupVisible){var he;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(he=X.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(Ue.a)(he,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(he=he||X.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(Ue.a)(he,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(he=he||X.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(Ue.a)(he,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(Ue.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),Fe.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var X;return((X=this.popupRef.current)===null||X===void 0?void 0:X.getElement())||null}},{key:"getPopupAlign",value:function(){var X=this.props,le=X.popupPlacement,he=X.popupAlign,ve=X.builtinPlacements;return le&&ve?q(ve,le,he):he}},{key:"setPopupVisible",value:function(X,le){var he=this.props.alignPoint,ve=this.state.popupVisible;this.clearDelayTimer(),ve!==X&&("popupVisible"in this.props||this.setState({popupVisible:X,prevPopupVisible:ve}),this.props.onPopupVisibleChange(X)),he&&le&&X&&this.setPoint(le)}},{key:"delaySetPopupVisible",value:function(X,le,he){var ve=this,me=le*1e3;if(this.clearDelayTimer(),me){var xe=he?{pageX:he.pageX,pageY:he.pageY}:null;this.delayTimer=window.setTimeout(function(){ve.setPopupVisible(X,xe),ve.clearDelayTimer()},me)}else this.setPopupVisible(X,he)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(X){var le=this.props.children.props,he=this.props;return le[X]&&he[X]?this["fire".concat(X)]:le[X]||he[X]}},{key:"isClickToShow",value:function(){var X=this.props,le=X.action,he=X.showAction;return le.indexOf("click")!==-1||he.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var X=this.props.action;return X==="contextMenu"||X.length===1&&X[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var X=this.props,le=X.action,he=X.showAction;return le.indexOf("contextMenu")!==-1||he.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var X=this.props,le=X.action,he=X.hideAction;return le.indexOf("click")!==-1||he.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var X=this.props,le=X.action,he=X.showAction;return le.indexOf("hover")!==-1||he.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var X=this.props,le=X.action,he=X.hideAction;return le.indexOf("hover")!==-1||he.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var X=this.props,le=X.action,he=X.showAction;return le.indexOf("focus")!==-1||he.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var X=this.props,le=X.action,he=X.hideAction;return le.indexOf("focus")!==-1||he.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var X;(X=this.popupRef.current)===null||X===void 0||X.forceAlign()}}},{key:"fireEvents",value:function(X,le){var he=this.props.children.props[X];he&&he(le);var ve=this.props[X];ve&&ve(le)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var X=this.state.popupVisible,le=this.props,he=le.children,ve=le.forceRender,me=le.alignPoint,xe=le.className,Ce=le.autoDestroy,ke=w.Children.only(he),Pe={key:"trigger"};this.isContextMenuToShow()?Pe.onContextMenu=this.onContextMenu:Pe.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(Pe.onClick=this.onClick,Pe.onMouseDown=this.onMouseDown,Pe.onTouchStart=this.onTouchStart):(Pe.onClick=this.createTwoChains("onClick"),Pe.onMouseDown=this.createTwoChains("onMouseDown"),Pe.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(Pe.onMouseEnter=this.onMouseEnter,me&&(Pe.onMouseMove=this.onMouseMove)):Pe.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?Pe.onMouseLeave=this.onMouseLeave:Pe.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(Pe.onFocus=this.onFocus,Pe.onBlur=this.onBlur):(Pe.onFocus=this.createTwoChains("onFocus"),Pe.onBlur=this.createTwoChains("onBlur"));var je=H()(ke&&ke.props&&ke.props.className,xe);je&&(Pe.className=je);var tt=Object(k.a)({},Pe);Object(Ge.c)(ke)&&(tt.ref=Object(Ge.a)(this.triggerRef,ke.ref));var ht=w.cloneElement(ke,tt),rt;return(X||this.popupRef.current||ve)&&(rt=w.createElement(re,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!X&&Ce&&(rt=null),w.createElement(rn.Provider,{value:this.triggerContextValue},ht,rt)}}],[{key:"getDerivedStateFromProps",value:function(X,le){var he=X.popupVisible,ve={};return he!==void 0&&le.popupVisible!==he&&(ve.popupVisible=he,ve.prevPopupVisible=le.popupVisible),ve}}]),z}(w.Component);return pe.contextType=rn,pe.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:ur,getDocument:hr,onPopupVisibleChange:Ui,afterPopupVisibleChange:Ui,onPopupAlign:Ui,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},pe}var fr=cr(qe.a),hi={adjustX:1,adjustY:1},an={topLeft:{points:["bl","tl"],overflow:hi,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:hi,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:hi,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:hi,offset:[4,0]}},pr={topLeft:{points:["bl","tl"],overflow:hi,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:hi,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:hi,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:hi,offset:[4,0]}},ca=an,sn=0,mr={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},Ti=function(pe,ge,ue){var z=oe(ge),te=pe.getState();pe.setState({defaultActiveFirst:Object(k.a)(Object(k.a)({},te.defaultActiveFirst),{},Object(ae.a)({},z,ue))})},on=function(re){Object(c.a)(ge,re);var pe=Object(m.a)(ge);function ge(ue){var z;Object(E.a)(this,ge),z=pe.call(this,ue),z.onDestroy=function(me){z.props.onDestroy(me)},z.onKeyDown=function(me){var xe=me.keyCode,Ce=z.menuInstance,ke=z.props.store,Pe=z.getVisible();if(xe===l.a.ENTER)return z.onTitleClick(me),Ti(ke,z.props.eventKey,!0),!0;if(xe===l.a.RIGHT)return Pe?Ce.onKeyDown(me):(z.triggerOpenChange(!0),Ti(ke,z.props.eventKey,!0)),!0;if(xe===l.a.LEFT){var je;if(Pe)je=Ce.onKeyDown(me);else return;return je||(z.triggerOpenChange(!1),je=!0),je}return Pe&&(xe===l.a.UP||xe===l.a.DOWN)?Ce.onKeyDown(me):void 0},z.onOpenChange=function(me){z.props.onOpenChange(me)},z.onPopupVisibleChange=function(me){z.triggerOpenChange(me,me?"mouseenter":"mouseleave")},z.onMouseEnter=function(me){var xe=z.props,Ce=xe.eventKey,ke=xe.onMouseEnter,Pe=xe.store;Ti(Pe,z.props.eventKey,!1),ke({key:Ce,domEvent:me})},z.onMouseLeave=function(me){var xe=z.props,Ce=xe.parentMenu,ke=xe.eventKey,Pe=xe.onMouseLeave;Ce.subMenuInstance=Object(g.a)(z),Pe({key:ke,domEvent:me})},z.onTitleMouseEnter=function(me){var xe=z.props,Ce=xe.eventKey,ke=xe.onItemHover,Pe=xe.onTitleMouseEnter;ke({key:Ce,hover:!0}),Pe({key:Ce,domEvent:me})},z.onTitleMouseLeave=function(me){var xe=z.props,Ce=xe.parentMenu,ke=xe.eventKey,Pe=xe.onItemHover,je=xe.onTitleMouseLeave;Ce.subMenuInstance=Object(g.a)(z),Pe({key:ke,hover:!1}),je({key:ke,domEvent:me})},z.onTitleClick=function(me){var xe=Object(g.a)(z),Ce=xe.props;if(Ce.onTitleClick({key:Ce.eventKey,domEvent:me}),Ce.triggerSubMenuAction==="hover")return;z.triggerOpenChange(!z.getVisible(),"click"),Ti(Ce.store,z.props.eventKey,!1)},z.onSubMenuClick=function(me){typeof z.props.onClick=="function"&&z.props.onClick(z.addKeyPath(me))},z.onSelect=function(me){z.props.onSelect(me)},z.onDeselect=function(me){z.props.onDeselect(me)},z.getPrefixCls=function(){return"".concat(z.props.rootPrefixCls,"-submenu")},z.getActiveClassName=function(){return"".concat(z.getPrefixCls(),"-active")},z.getDisabledClassName=function(){return"".concat(z.getPrefixCls(),"-disabled")},z.getSelectedClassName=function(){return"".concat(z.getPrefixCls(),"-selected")},z.getOpenClassName=function(){return"".concat(z.props.rootPrefixCls,"-submenu-open")},z.getVisible=function(){return z.state.isOpen},z.getMode=function(){return z.state.mode},z.saveMenuInstance=function(me){z.menuInstance=me},z.addKeyPath=function(me){return Object(k.a)(Object(k.a)({},me),{},{keyPath:(me.keyPath||[]).concat(z.props.eventKey)})},z.triggerOpenChange=function(me,xe){var Ce=z.props.eventKey,ke=function(){z.onOpenChange({key:Ce,item:Object(g.a)(z),trigger:xe,open:me})};xe==="mouseenter"?z.mouseenterTimeout=setTimeout(function(){ke()},0):ke()},z.isChildrenSelected=function(){var me={find:!1};return Re(z.props.children,z.props.selectedKeys,me),me.find},z.isInlineMode=function(){return z.getMode()==="inline"},z.adjustWidth=function(){if(!z.subMenuTitle||!z.menuInstance)return;var me=Be.findDOMNode(z.menuInstance);if(me.offsetWidth>=z.subMenuTitle.offsetWidth)return;me.style.minWidth="".concat(z.subMenuTitle.offsetWidth,"px")},z.saveSubMenuTitle=function(me){z.subMenuTitle=me},z.getBaseProps=function(){var me=Object(g.a)(z),xe=me.props,Ce=z.getMode();return{mode:Ce==="horizontal"?"vertical":Ce,visible:z.getVisible(),level:xe.level+1,inlineIndent:xe.inlineIndent,focusable:!1,onClick:z.onSubMenuClick,onSelect:z.onSelect,onDeselect:z.onDeselect,onDestroy:z.onDestroy,selectedKeys:xe.selectedKeys,eventKey:"".concat(xe.eventKey,"-menu-"),openKeys:xe.openKeys,motion:xe.motion,onOpenChange:z.onOpenChange,subMenuOpenDelay:xe.subMenuOpenDelay,parentMenu:Object(g.a)(z),subMenuCloseDelay:xe.subMenuCloseDelay,forceSubMenuRender:xe.forceSubMenuRender,triggerSubMenuAction:xe.triggerSubMenuAction,builtinPlacements:xe.builtinPlacements,defaultActiveFirst:xe.store.getState().defaultActiveFirst[oe(xe.eventKey)],multiple:xe.multiple,prefixCls:xe.rootPrefixCls,id:z.internalMenuId,manualRef:z.saveMenuInstance,itemIcon:xe.itemIcon,expandIcon:xe.expandIcon,direction:xe.direction}},z.getMotion=function(me,xe){var Ce=Object(g.a)(z),ke=Ce.haveRendered,Pe=z.props,je=Pe.motion,tt=Pe.rootPrefixCls,ht=Object(k.a)(Object(k.a)({},je),{},{leavedClassName:"".concat(tt,"-hidden"),removeOnLeave:!1,motionAppear:ke||!xe||me!=="inline"});return ht};var te=ue.store,X=ue.eventKey,le=te.getState(),he=le.defaultActiveFirst;z.isRootMenu=!1;var ve=!1;return he&&(ve=he[X]),Ti(te,X,ve),z.state={mode:ue.mode,isOpen:ue.isOpen},z}return Object(b.a)(ge,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var z=this,te=this.props,X=te.mode,le=te.parentMenu,he=te.manualRef,ve=te.isOpen,me=function(){z.setState({mode:X,isOpen:ve})},xe=ve!==this.state.isOpen,Ce=X!==this.state.mode;if((Ce||xe)&&(Fe.a.cancel(this.updateStateRaf),Ce?this.updateStateRaf=Object(Fe.a)(me):me()),he&&he(this),X!=="horizontal"||!(le==null?void 0:le.isRootMenu)||!ve)return;this.minWidthTimeout=setTimeout(function(){return z.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var z=this.props,te=z.onDestroy,X=z.eventKey;te&&te(X),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),Fe.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(z,te){var X=this.getBaseProps();return w.createElement(cn,Object(p.a)({},X,{id:this.internalMenuId,className:z,style:te}),this.props.children)}},{key:"renderChildren",value:function(){var z=this,te=this.getBaseProps(),X=te.mode,le=te.visible,he=te.forceSubMenuRender,ve=te.direction,me=this.getMotion(X,le);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||le||he,!this.haveOpened)return w.createElement("div",null);var xe=H()("".concat(te.prefixCls,"-sub"),Object(ae.a)({},"".concat(te.prefixCls,"-rtl"),ve==="rtl"));return this.isInlineMode()?w.createElement(Li,Object(p.a)({visible:te.visible,forceRender:he},me),function(Ce){var ke=Ce.className,Pe=Ce.style,je=H()(xe,ke);return z.renderPopupMenu(je,Pe)}):this.renderPopupMenu(xe)}},{key:"render",value:function(){var z,te,X,le=Object(k.a)({},this.props),he=this.getVisible(),ve=this.getPrefixCls(),me=this.isInlineMode(),xe=this.getMode(),Ce=H()(ve,"".concat(ve,"-").concat(xe),(z={},Object(ae.a)(z,le.className,!!le.className),Object(ae.a)(z,this.getOpenClassName(),he),Object(ae.a)(z,this.getActiveClassName(),le.active||he&&!me),Object(ae.a)(z,this.getDisabledClassName(),le.disabled),Object(ae.a)(z,this.getSelectedClassName(),this.isChildrenSelected()),z));this.internalMenuId||(le.eventKey?this.internalMenuId="".concat(le.eventKey,"$Menu"):(sn+=1,this.internalMenuId="$__$".concat(sn,"$Menu")));var ke={},Pe={},je={};le.disabled||(ke={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},Pe={onClick:this.onTitleClick},je={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var tt={},ht=le.direction,rt=ht==="rtl";me&&(rt?tt.paddingRight=le.inlineIndent*le.level:tt.paddingLeft=le.inlineIndent*le.level);var ct={};this.getVisible()&&(ct={"aria-owns":this.internalMenuId});var dt=null;xe!=="horizontal"&&(dt=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(dt=w.createElement(this.props.expandIcon,Object(k.a)({},this.props))));var st=w.createElement("div",Object(p.a)({ref:this.saveSubMenuTitle,style:tt,className:"".concat(ve,"-title"),role:"button"},je,Pe,{"aria-expanded":he},ct,{"aria-haspopup":"true",title:typeof le.title=="string"?le.title:void 0}),le.title,dt||w.createElement("i",{className:"".concat(ve,"-arrow")})),ot=this.renderChildren(),vt=((te=le.parentMenu)===null||te===void 0?void 0:te.isRootMenu)?le.parentMenu.props.getPopupContainer:function(Mt){return Mt.parentNode},ft=mr[xe],Pt=le.popupOffset?{offset:le.popupOffset}:{},Ot=H()((X={},Object(ae.a)(X,le.popupClassName,le.popupClassName&&!me),Object(ae.a)(X,"".concat(ve,"-rtl"),rt),X)),Ze=le.disabled,Je=le.triggerSubMenuAction,pt=le.subMenuOpenDelay,gt=le.forceSubMenuRender,ze=le.subMenuCloseDelay,yt=le.builtinPlacements;ee.forEach(function(Mt){return delete le[Mt]}),delete le.onClick;var Lt=rt?Object(k.a)(Object(k.a)({},pr),yt):Object(k.a)(Object(k.a)({},an),yt);delete le.direction;var bt=this.getBaseProps(),Rt=me?null:this.getMotion(bt.mode,bt.visible);return w.createElement("li",Object(p.a)({},le,ke,{className:Ce,role:"menuitem"}),w.createElement(fr,{prefixCls:ve,popupClassName:H()("".concat(ve,"-popup"),Ot),getPopupContainer:vt,builtinPlacements:Lt,popupPlacement:ft,popupVisible:me?!1:he,popupAlign:Pt,popup:me?null:ot,action:Ze||me?[]:[Je],mouseEnterDelay:pt,mouseLeaveDelay:ze,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:gt,popupMotion:Rt},st),me?ot:null)}}]),ge}(w.Component);on.defaultProps={onMouseEnter:G,onMouseLeave:G,onTitleMouseEnter:G,onTitleMouseLeave:G,onTitleClick:G,manualRef:G,mode:"vertical",title:""};var ln=Object(u.b)(function(re,pe){var ge=re.openKeys,ue=re.activeKey,z=re.selectedKeys,te=pe.eventKey,X=pe.subMenuKey;return{isOpen:ge.indexOf(te)>-1,active:ue[X]===te,selectedKeys:z}})(on);ln.isSubMenu=!0;var gr=ln,un="menuitem-overflowed",vr=.5,hn=function(re){Object(c.a)(ge,re);var pe=Object(m.a)(ge);function ge(){var ue;return Object(E.a)(this,ge),ue=pe.apply(this,arguments),ue.resizeObserver=null,ue.mutationObserver=null,ue.originalTotalWidth=0,ue.overflowedItems=[],ue.menuItemSizes=[],ue.cancelFrameId=null,ue.state={lastVisibleIndex:void 0},ue.childRef=w.createRef(),ue.getMenuItemNodes=function(){var z=ue.props.prefixCls,te=ue.childRef.current;return te?[].slice.call(te.children).filter(function(X){return X.className.split(" ").indexOf("".concat(z,"-overflowed-submenu"))<0}):[]},ue.getOverflowedSubMenuItem=function(z,te,X){var le=ue.props,he=le.overflowedIndicator,ve=le.level,me=le.mode,xe=le.prefixCls,Ce=le.theme;if(ve!==1||me!=="horizontal")return null;var ke=ue.props.children[0],Pe=ke.props,je=Pe.children,tt=Pe.title,ht=Pe.style,rt=Object(O.a)(Pe,["children","title","style"]),ct=Object(k.a)({},ht),dt="".concat(z,"-overflowed-indicator"),st="".concat(z,"-overflowed-indicator");te.length===0&&X!==!0?ct=Object(k.a)(Object(k.a)({},ct),{},{display:"none"}):X&&(ct=Object(k.a)(Object(k.a)({},ct),{},{visibility:"hidden",position:"absolute"}),dt="".concat(dt,"-placeholder"),st="".concat(st,"-placeholder"));var ot=Ce?"".concat(xe,"-").concat(Ce):"",vt={};return ee.forEach(function(ft){rt[ft]!==void 0&&(vt[ft]=rt[ft])}),w.createElement(gr,Object(p.a)({title:he,className:"".concat(xe,"-overflowed-submenu"),popupClassName:ot},vt,{key:dt,eventKey:st,disabled:!1,style:ct}),te)},ue.setChildrenWidthAndResize=function(){if(ue.props.mode!=="horizontal")return;var z=ue.childRef.current;if(!z)return;var te=z.children;if(!te||te.length===0)return;var X=z.children[te.length-1];Ee(X,"display","inline-block");var le=ue.getMenuItemNodes(),he=le.filter(function(ve){return ve.className.split(" ").indexOf(un)>=0});he.forEach(function(ve){Ee(ve,"display","inline-block")}),ue.menuItemSizes=le.map(function(ve){return ce(ve,!0)}),he.forEach(function(ve){Ee(ve,"display","none")}),ue.overflowedIndicatorWidth=ce(z.children[z.children.length-1],!0),ue.originalTotalWidth=ue.menuItemSizes.reduce(function(ve,me){return ve+me},0),ue.handleResize(),Ee(X,"display","none")},ue.handleResize=function(){if(ue.props.mode!=="horizontal")return;var z=ue.childRef.current;if(!z)return;var te=ce(z);ue.overflowedItems=[];var X=0,le;ue.originalTotalWidth>te+vr&&(le=-1,ue.menuItemSizes.forEach(function(he){X+=he,X+ue.overflowedIndicatorWidth<=te&&(le+=1)})),ue.setState({lastVisibleIndex:le})},ue}return Object(b.a)(ge,[{key:"componentDidMount",value:function(){var z=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var te=this.childRef.current;if(!te)return;this.resizeObserver=new Me.default(function(X){X.forEach(function(){var le=z.cancelFrameId;cancelAnimationFrame(le),z.cancelFrameId=requestAnimationFrame(z.setChildrenWidthAndResize)})}),[].slice.call(te.children).concat(te).forEach(function(X){z.resizeObserver.observe(X)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){z.resizeObserver.disconnect(),[].slice.call(te.children).concat(te).forEach(function(X){z.resizeObserver.observe(X)}),z.setChildrenWidthAndResize()}),this.mutationObserver.observe(te,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(z){var te=this,X=this.state.lastVisibleIndex;return(z||[]).reduce(function(le,he,ve){var me=he;if(te.props.mode==="horizontal"){var xe=te.getOverflowedSubMenuItem(he.props.eventKey,[]);X!==void 0&&te.props.className.indexOf("".concat(te.props.prefixCls,"-root"))!==-1&&(ve>X&&(me=w.cloneElement(he,{style:{display:"none"},eventKey:"".concat(he.props.eventKey,"-hidden"),className:"".concat(un)})),ve===X+1&&(te.overflowedItems=z.slice(X+1).map(function(ke){return w.cloneElement(ke,{key:ke.props.eventKey,mode:"vertical-left"})}),xe=te.getOverflowedSubMenuItem(he.props.eventKey,te.overflowedItems)));var Ce=[].concat(Object(S.a)(le),[xe,me]);return ve===z.length-1&&Ce.push(te.getOverflowedSubMenuItem(he.props.eventKey,[],!0)),Ce}return[].concat(Object(S.a)(le),[me])},[])}},{key:"render",value:function(){var z=this.props,te=z.visible,X=z.prefixCls,le=z.overflowedIndicator,he=z.mode,ve=z.level,me=z.tag,xe=z.children,Ce=z.theme,ke=Object(O.a)(z,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),Pe=me;return w.createElement(Pe,Object(p.a)({ref:this.childRef},ke),this.renderChildren(xe))}}]),ge}(w.Component);hn.defaultProps={tag:"div",className:""};var yr=hn;function br(re){return re.length?re.every(function(pe){return!!pe.props.disabled}):!0}function Di(re,pe,ge){var ue=re.getState();re.setState({activeKey:Object(k.a)(Object(k.a)({},ue.activeKey),{},Object(ae.a)({},pe,ge))})}function vi(re){return re.eventKey||"0-menu-"}function Mi(re,pe){var ge=pe,ue=re.children,z=re.eventKey;if(ge){var te;if(we(ue,function(X,le){X&&X.props&&!X.props.disabled&&ge===P(X,z,le)&&(te=!0)}),te)return ge}return ge=null,re.defaultActiveFirst&&we(ue,function(X,le){!ge&&X&&!X.props.disabled&&(ge=P(X,z,le))}),ge}function _r(re){if(!re)return;var pe=this.instanceArray.indexOf(re);pe!==-1?this.instanceArray[pe]=re:this.instanceArray.push(re)}var dn=function(re){Object(c.a)(ge,re);var pe=Object(m.a)(ge);function ge(ue){var z;return Object(E.a)(this,ge),z=pe.call(this,ue),z.onKeyDown=function(te,X){var le=te.keyCode,he;if(z.getFlatInstanceArray().forEach(function(me){me&&me.props.active&&me.onKeyDown&&(he=me.onKeyDown(te))}),he)return 1;var ve=null;return(le===l.a.UP||le===l.a.DOWN)&&(ve=z.step(le===l.a.UP?-1:1)),ve?(te.preventDefault(),Di(z.props.store,vi(z.props),ve.props.eventKey),typeof X=="function"&&X(ve),1):void 0},z.onItemHover=function(te){var X=te.key,le=te.hover;Di(z.props.store,vi(z.props),le?X:null)},z.onDeselect=function(te){z.props.onDeselect(te)},z.onSelect=function(te){z.props.onSelect(te)},z.onClick=function(te){z.props.onClick(te)},z.onOpenChange=function(te){z.props.onOpenChange(te)},z.onDestroy=function(te){z.props.onDestroy(te)},z.getFlatInstanceArray=function(){return z.instanceArray},z.step=function(te){var X=z.getFlatInstanceArray(),le=z.props.store.getState().activeKey[vi(z.props)],he=X.length;if(!he)return null;te<0&&(X=X.concat().reverse());var ve=-1;if(X.every(function(ke,Pe){return ke&&ke.props.eventKey===le?(ve=Pe,!1):!0}),!z.props.defaultActiveFirst&&ve!==-1&&br(X.slice(ve,he-1)))return;var me=(ve+1)%he,xe=me;do{var Ce=X[xe];if(!Ce||Ce.props.disabled)xe=(xe+1)%he;else return Ce}while(xe!==me);return null},z.renderCommonMenuItem=function(te,X,le){var he=z.props.store.getState(),ve=Object(g.a)(z),me=ve.props,xe=P(te,me.eventKey,X),Ce=te.props;if(!Ce||typeof te.type=="string")return te;var ke=xe===he.activeKey,Pe=Object(k.a)(Object(k.a)({mode:Ce.mode||me.mode,level:me.level,inlineIndent:me.inlineIndent,renderMenuItem:z.renderMenuItem,rootPrefixCls:me.prefixCls,index:X,parentMenu:me.parentMenu,manualRef:Ce.disabled?void 0:Object(y.a)(te.ref,_r.bind(Object(g.a)(z))),eventKey:xe,active:!Ce.disabled&&ke,multiple:me.multiple,onClick:function(tt){(Ce.onClick||G)(tt),z.onClick(tt)},onItemHover:z.onItemHover,motion:me.motion,subMenuOpenDelay:me.subMenuOpenDelay,subMenuCloseDelay:me.subMenuCloseDelay,forceSubMenuRender:me.forceSubMenuRender,onOpenChange:z.onOpenChange,onDeselect:z.onDeselect,onSelect:z.onSelect,builtinPlacements:me.builtinPlacements,itemIcon:Ce.itemIcon||z.props.itemIcon,expandIcon:Ce.expandIcon||z.props.expandIcon},le),{},{direction:me.direction});return(me.mode==="inline"||Ae())&&(Pe.triggerSubMenuAction="click"),w.cloneElement(te,Object(k.a)(Object(k.a)({},Pe),{},{key:xe||X}))},z.renderMenuItem=function(te,X,le){if(!te)return null;var he=z.props.store.getState(),ve={openKeys:he.openKeys,selectedKeys:he.selectedKeys,triggerSubMenuAction:z.props.triggerSubMenuAction,subMenuKey:le};return z.renderCommonMenuItem(te,X,ve)},ue.store.setState({activeKey:Object(k.a)(Object(k.a)({},ue.store.getState().activeKey),{},Object(ae.a)({},ue.eventKey,Mi(ue,ue.activeKey)))}),z.instanceArray=[],z}return Object(b.a)(ge,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(z){return this.props.visible||z.visible||this.props.className!==z.className||!M()(this.props.style,z.style)}},{key:"componentDidUpdate",value:function(z){var te=this.props,X="activeKey"in te?te.activeKey:te.store.getState().activeKey[vi(te)],le=Mi(te,X);if(le!==X)Di(te.store,vi(te),le);else if("activeKey"in z){var he=Mi(z,z.activeKey);le!==he&&Di(te.store,vi(te),le)}}},{key:"render",value:function(){var z=this,te=Object(p.a)({},this.props);this.instanceArray=[];var X=H()(te.prefixCls,te.className,"".concat(te.prefixCls,"-").concat(te.mode)),le={className:X,role:te.role||"menu"};te.id&&(le.id=te.id),te.focusable&&(le.tabIndex=0,le.onKeyDown=this.onKeyDown);var he=te.prefixCls,ve=te.eventKey,me=te.visible,xe=te.level,Ce=te.mode,ke=te.overflowedIndicator,Pe=te.theme;return ee.forEach(function(je){return delete te[je]}),delete te.onClick,w.createElement(yr,Object(p.a)({},te,{prefixCls:he,mode:Ce,tag:"ul",level:xe,theme:Pe,visible:me,overflowedIndicator:ke},le),Object(U.a)(te.children).map(function(je,tt){return z.renderMenuItem(je,tt,ve||"0-menu-")}))}}]),ge}(w.Component);dn.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:G};var Er=Object(u.b)()(dn),cn=Er,Tr=$("Kwbf");function xr(re,pe,ge){var ue=re.prefixCls,z=re.motion,te=re.defaultMotions,X=te===void 0?{}:te,le=re.openAnimation,he=re.openTransitionName,ve=pe.switchingModeFromInline;if(z)return z;if(Object(L.a)(le)==="object"&&le)Object(Tr.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof le=="string")return{motionName:"".concat(ue,"-open-").concat(le)};if(he)return{motionName:he};var me=X[ge];return me||(ve?null:X.other)}var fn=function(re){Object(c.a)(ge,re);var pe=Object(m.a)(ge);function ge(ue){var z;Object(E.a)(this,ge),z=pe.call(this,ue),z.onSelect=function(le){var he=Object(g.a)(z),ve=he.props;if(ve.selectable){var me=z.store.getState(),xe=me.selectedKeys,Ce=le.key;ve.multiple?xe=xe.concat([Ce]):xe=[Ce],"selectedKeys"in ve||z.store.setState({selectedKeys:xe}),ve.onSelect(Object(k.a)(Object(k.a)({},le),{},{selectedKeys:xe}))}},z.onClick=function(le){var he=z.getRealMenuMode(),ve=Object(g.a)(z),me=ve.store,xe=ve.props.onOpenChange;he!=="inline"&&!("openKeys"in z.props)&&(me.setState({openKeys:[]}),xe([])),z.props.onClick(le)},z.onKeyDown=function(le,he){z.innerMenu.getWrappedInstance().onKeyDown(le,he)},z.onOpenChange=function(le){var he=Object(g.a)(z),ve=he.props,me=z.store.getState().openKeys.concat(),xe=!1,Ce=function(Pe){var je=!1;if(Pe.open)je=me.indexOf(Pe.key)===-1,je&&me.push(Pe.key);else{var tt=me.indexOf(Pe.key);je=tt!==-1,je&&me.splice(tt,1)}xe=xe||je};Array.isArray(le)?le.forEach(Ce):Ce(le),xe&&("openKeys"in z.props||z.store.setState({openKeys:me}),ve.onOpenChange(me))},z.onDeselect=function(le){var he=Object(g.a)(z),ve=he.props;if(ve.selectable){var me=z.store.getState().selectedKeys.concat(),xe=le.key,Ce=me.indexOf(xe);Ce!==-1&&me.splice(Ce,1),"selectedKeys"in ve||z.store.setState({selectedKeys:me}),ve.onDeselect(Object(k.a)(Object(k.a)({},le),{},{selectedKeys:me}))}},z.onMouseEnter=function(le){z.restoreModeVerticalFromInline();var he=z.props.onMouseEnter;he&&he(le)},z.onTransitionEnd=function(le){var he=le.propertyName==="width"&&le.target===le.currentTarget,ve=le.target.className,me=Object.prototype.toString.call(ve)==="[object SVGAnimatedString]"?ve.animVal:ve,xe=le.propertyName==="font-size"&&me.indexOf("anticon")>=0;(he||xe)&&z.restoreModeVerticalFromInline()},z.setInnerMenu=function(le){z.innerMenu=le},z.isRootMenu=!0;var te=ue.defaultSelectedKeys,X=ue.defaultOpenKeys;return"selectedKeys"in ue&&(te=ue.selectedKeys||[]),"openKeys"in ue&&(X=ue.openKeys||[]),z.store=Object(u.c)({selectedKeys:te,openKeys:X,activeKey:{"0-menu-":Mi(ue,ue.activeKey)}}),z.state={switchingModeFromInline:!1,prevProps:ue,inlineOpenKeys:[],store:z.store},z}return Object(b.a)(ge,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(z){var te=this.props,X=te.siderCollapsed,le=te.inlineCollapsed,he=te.onOpenChange;(!z.inlineCollapsed&&le||!z.siderCollapsed&&X)&&he([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var z=this.props.collapsedWidth,te=this.store,X=this.prevOpenKeys,le=this.getInlineCollapsed()&&(z===0||z==="0"||z==="0px");le?(this.prevOpenKeys=te.getState().openKeys.concat(),this.store.setState({openKeys:[]})):X&&(this.store.setState({openKeys:X}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var z=this.props.mode,te=this.state.switchingModeFromInline,X=this.getInlineCollapsed();return te&&X?"inline":X?"vertical":z}},{key:"getInlineCollapsed",value:function(){var z=this.props,te=z.inlineCollapsed,X=z.siderCollapsed;return X!==void 0?X:te}},{key:"restoreModeVerticalFromInline",value:function(){var z=this.state.switchingModeFromInline;z&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var z=Object(k.a)({},Object(_.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),te=this.getRealMenuMode();return z.className+=" ".concat(z.prefixCls,"-root"),z.direction==="rtl"&&(z.className+=" ".concat(z.prefixCls,"-rtl")),z=Object(k.a)(Object(k.a)({},z),{},{mode:te,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:xr(this.props,this.state,te)}),delete z.openAnimation,delete z.openTransitionName,w.createElement(u.a,{store:this.store},w.createElement(cn,Object(p.a)({},z,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(z,te){var X=te.prevProps,le=te.store,he=le.getState(),ve={},me={prevProps:z};return X.mode==="inline"&&z.mode!=="inline"&&(me.switchingModeFromInline=!0),"openKeys"in z?ve.openKeys=z.openKeys||[]:((z.inlineCollapsed&&!X.inlineCollapsed||z.siderCollapsed&&!X.siderCollapsed)&&(me.switchingModeFromInline=!0,me.inlineOpenKeys=he.openKeys,ve.openKeys=[]),(!z.inlineCollapsed&&X.inlineCollapsed||!z.siderCollapsed&&X.siderCollapsed)&&(ve.openKeys=te.inlineOpenKeys,me.inlineOpenKeys=[])),Object.keys(ve).length&&le.setState(ve),me}}]),ge}(w.Component);fn.defaultProps={selectable:!0,onClick:G,onSelect:G,onOpenChange:G,onDeselect:G,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:w.createElement("span",null,"\xB7\xB7\xB7")};var wr=fn,Fi=function(re){Object(c.a)(ge,re);var pe=Object(m.a)(ge);function ge(){var ue;return Object(E.a)(this,ge),ue=pe.apply(this,arguments),ue.onKeyDown=function(z){var te=z.keyCode;return te===l.a.ENTER?(ue.onClick(z),!0):void 0},ue.onMouseLeave=function(z){var te=ue.props,X=te.eventKey,le=te.onItemHover,he=te.onMouseLeave;le({key:X,hover:!1}),he({key:X,domEvent:z})},ue.onMouseEnter=function(z){var te=ue.props,X=te.eventKey,le=te.onItemHover,he=te.onMouseEnter;le({key:X,hover:!0}),he({key:X,domEvent:z})},ue.onClick=function(z){var te=ue.props,X=te.eventKey,le=te.multiple,he=te.onClick,ve=te.onSelect,me=te.onDeselect,xe=te.isSelected,Ce={key:X,keyPath:[X],item:Object(g.a)(ue),domEvent:z};he(Ce),le?xe?me(Ce):ve(Ce):xe||ve(Ce)},ue.saveNode=function(z){ue.node=z},ue}return Object(b.a)(ge,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var z=this.props;z.onDestroy&&z.onDestroy(z.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var z,te=Object(k.a)({},this.props),X=H()(this.getPrefixCls(),te.className,(z={},Object(ae.a)(z,this.getActiveClassName(),!te.disabled&&te.active),Object(ae.a)(z,this.getSelectedClassName(),te.isSelected),Object(ae.a)(z,this.getDisabledClassName(),te.disabled),z)),le=Object(k.a)(Object(k.a)({},te.attribute),{},{title:typeof te.title=="string"?te.title:void 0,className:X,role:te.role||"menuitem","aria-disabled":te.disabled});te.role==="option"?le=Object(k.a)(Object(k.a)({},le),{},{role:"option","aria-selected":te.isSelected}):(te.role===null||te.role==="none")&&(le.role="none");var he={onClick:te.disabled?null:this.onClick,onMouseLeave:te.disabled?null:this.onMouseLeave,onMouseEnter:te.disabled?null:this.onMouseEnter},ve=Object(k.a)({},te.style);te.mode==="inline"&&(te.direction==="rtl"?ve.paddingRight=te.inlineIndent*te.level:ve.paddingLeft=te.inlineIndent*te.level),ee.forEach(function(xe){return delete te[xe]}),delete te.direction;var me=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(me=w.createElement(this.props.itemIcon,this.props)),w.createElement("li",Object(p.a)({},Object(_.a)(te,["onClick","onMouseEnter","onMouseLeave","onSelect"]),le,he,{style:ve,ref:this.saveNode}),te.children,me)}}]),ge}(w.Component);Fi.isMenuItem=!0,Fi.defaultProps={onSelect:G,onMouseEnter:G,onMouseLeave:G,manualRef:G};var Sr=Object(u.b)(function(re,pe){var ge=re.activeKey,ue=re.selectedKeys,z=pe.eventKey,te=pe.subMenuKey;return{active:ge[te]===z,isSelected:Array.isArray(ue)?ue.indexOf(z)!==-1:ue===z}})(Fi),Ar=Sr,Bi=function(re){Object(c.a)(ge,re);var pe=Object(m.a)(ge);function ge(){var ue;return Object(E.a)(this,ge),ue=pe.apply(this,arguments),ue.renderInnerMenuItem=function(z){var te=ue.props,X=te.renderMenuItem,le=te.index;return X(z,le,ue.props.subMenuKey)},ue}return Object(b.a)(ge,[{key:"render",value:function(){var z=Object(p.a)({},this.props),te=z.className,X=te===void 0?"":te,le=z.rootPrefixCls,he="".concat(le,"-item-group-title"),ve="".concat(le,"-item-group-list"),me=z.title,xe=z.children;return ee.forEach(function(Ce){return delete z[Ce]}),delete z.direction,w.createElement("li",Object(p.a)({},z,{onClick:function(ke){return ke.stopPropagation()},className:"".concat(X," ").concat(le,"-item-group")}),w.createElement("div",{className:he,title:typeof me=="string"?me:void 0},me),w.createElement("ul",{className:ve},w.Children.map(xe,this.renderInnerMenuItem)))}}]),ge}(w.Component);Bi.isMenuItemGroup=!0,Bi.defaultProps={disabled:!0};var fa=Bi,pn=function(pe){var ge=pe.className,ue=pe.rootPrefixCls,z=pe.style;return w.createElement("li",{className:"".concat(ge," ").concat(ue,"-item-divider"),style:z})};pn.defaultProps={disabled:!0,className:"",style:{}};var pa=pn,Or=wr,Cr=$("eDIo");function Rr(re,pe){var ge=re.prefixCls,ue=re.editable,z=re.locale,te=re.style;return!ue||ue.showAdd===!1?null:w.createElement("button",{ref:pe,type:"button",className:"".concat(ge,"-nav-add"),style:te,"aria-label":(z==null?void 0:z.addAriaLabel)||"Add tab",onClick:function(le){ue.onEdit("add",{event:le})}},ue.addIcon||"+")}var mn=w.forwardRef(Rr);function Ir(re,pe){var ge=re.prefixCls,ue=re.id,z=re.tabs,te=re.locale,X=re.mobile,le=re.moreIcon,he=le===void 0?"More":le,ve=re.moreTransitionName,me=re.style,xe=re.className,Ce=re.editable,ke=re.tabBarGutter,Pe=re.rtl,je=re.onTabClick,tt=Object(w.useState)(!1),ht=Object(B.a)(tt,2),rt=ht[0],ct=ht[1],dt=Object(w.useState)(null),st=Object(B.a)(dt,2),ot=st[0],vt=st[1],ft="".concat(ue,"-more-popup"),Pt="".concat(ge,"-dropdown"),Ot=ot!==null?"".concat(ft,"-").concat(ot):null,Ze=te==null?void 0:te.dropdownAriaLabel,Je=w.createElement(Or,{onClick:function(Rt){var Mt=Rt.key,Xt=Rt.domEvent;je(Mt,Xt),ct(!1)},id:ft,tabIndex:-1,role:"listbox","aria-activedescendant":Ot,selectedKeys:[ot],"aria-label":Ze!==void 0?Ze:"expanded dropdown"},z.map(function(bt){return w.createElement(Ar,{key:bt.key,id:"".concat(ft,"-").concat(bt.key),role:"option","aria-controls":ue&&"".concat(ue,"-panel-").concat(bt.key),disabled:bt.disabled},bt.tab)}));function pt(bt){for(var Rt=z.filter(function(ti){return!ti.disabled}),Mt=Rt.findIndex(function(ti){return ti.key===ot})||0,Xt=Rt.length,ei=0;ei<Xt;ei+=1){Mt=(Mt+bt+Xt)%Xt;var Ft=Rt[Mt];if(!Ft.disabled){vt(Ft.key);return}}}function gt(bt){var Rt=bt.which;if(!rt){[l.a.DOWN,l.a.SPACE,l.a.ENTER].includes(Rt)&&(ct(!0),bt.preventDefault());return}switch(Rt){case l.a.UP:pt(-1),bt.preventDefault();break;case l.a.DOWN:pt(1),bt.preventDefault();break;case l.a.ESC:ct(!1);break;case l.a.SPACE:case l.a.ENTER:ot!==null&&je(ot,bt);break}}Object(w.useEffect)(function(){var bt=document.getElementById(Ot);bt&&bt.scrollIntoView&&bt.scrollIntoView(!1)},[ot]),Object(w.useEffect)(function(){rt||vt(null)},[rt]);var ze=Object(ae.a)({},Pe?"marginLeft":"marginRight",ke);z.length||(ze.visibility="hidden",ze.order=1);var yt=H()(Object(ae.a)({},"".concat(Pt,"-rtl"),Pe)),Lt=X?null:w.createElement(Cr.a,{prefixCls:Pt,overlay:Je,trigger:["hover"],visible:rt,transitionName:ve,onVisibleChange:ct,overlayClassName:yt,mouseEnterDelay:.1,mouseLeaveDelay:.1},w.createElement("button",{type:"button",className:"".concat(ge,"-nav-more"),style:ze,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":ft,id:"".concat(ue,"-more"),"aria-expanded":rt,onKeyDown:gt},he));return w.createElement("div",{className:H()("".concat(ge,"-nav-operations"),xe),style:me,ref:pe},Lt,w.createElement(mn,{prefixCls:ge,locale:te,editable:Ce}))}var Lr=w.forwardRef(Ir),ji=Object(w.createContext)(null),Dr=.1,gn=.01,Pi=20,vn=Math.pow(.995,Pi);function Mr(){var re=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(re)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(re.substr(0,4)))}function Pr(re,pe){var ge=Object(w.useState)(),ue=Object(B.a)(ge,2),z=ue[0],te=ue[1],X=Object(w.useState)(0),le=Object(B.a)(X,2),he=le[0],ve=le[1],me=Object(w.useState)(0),xe=Object(B.a)(me,2),Ce=xe[0],ke=xe[1],Pe=Object(w.useState)(),je=Object(B.a)(Pe,2),tt=je[0],ht=je[1],rt=Object(w.useRef)();function ct(Ze){var Je=Ze.touches[0],pt=Je.screenX,gt=Je.screenY;te({x:pt,y:gt}),window.clearInterval(rt.current)}function dt(Ze){if(!z)return;Ze.preventDefault();var Je=Ze.touches[0],pt=Je.screenX,gt=Je.screenY;te({x:pt,y:gt});var ze=pt-z.x,yt=gt-z.y;pe(ze,yt);var Lt=Date.now();ve(Lt),ke(Lt-he),ht({x:ze,y:yt})}function st(){if(!z)return;if(te(null),ht(null),tt){var Ze=tt.x/Ce,Je=tt.y/Ce,pt=Math.abs(Ze),gt=Math.abs(Je);if(Math.max(pt,gt)<Dr)return;var ze=Ze,yt=Je;rt.current=window.setInterval(function(){if(Math.abs(ze)<gn&&Math.abs(yt)<gn){window.clearInterval(rt.current);return}ze*=vn,yt*=vn,pe(ze*Pi,yt*Pi)},Pi)}}var ot=Object(w.useRef)(0),vt=Object(w.useRef)(!1),ft=Object(w.useRef)();function Pt(Ze){var Je=Ze.deltaX,pt=Ze.deltaY,gt=0,ze=Math.abs(Je),yt=Math.abs(pt);ze===yt?gt=ft.current==="x"?Je:pt:ze>yt?(gt=Je,ft.current="x"):(gt=pt,ft.current="y");var Lt=Date.now();Lt-ot.current>100&&(vt.current=!1),(pe(-gt,-gt)||vt.current)&&(Ze.preventDefault(),vt.current=!0),ot.current=Lt}var Ot=Object(w.useRef)(null);Ot.current={onTouchStart:ct,onTouchMove:dt,onTouchEnd:st,onWheel:Pt},w.useEffect(function(){function Ze(ze){Ot.current.onTouchStart(ze)}function Je(ze){Ot.current.onTouchMove(ze)}function pt(ze){Ot.current.onTouchEnd(ze)}function gt(ze){Ot.current.onWheel(ze)}return document.addEventListener("touchmove",Je,{passive:!1}),document.addEventListener("touchend",pt,{passive:!1}),re.current.addEventListener("touchstart",Ze,{passive:!1}),re.current.addEventListener("wheel",gt),function(){document.removeEventListener("touchmove",Je),document.removeEventListener("touchend",pt)}},[])}function kr(){var re=Object(w.useRef)(new Map);function pe(ue){return re.current.has(ue)||re.current.set(ue,w.createRef()),re.current.get(ue)}function ge(ue){re.current.delete(ue)}return[pe,ge]}function yn(re,pe){var ge=w.useRef(re),ue=w.useState({}),z=Object(B.a)(ue,2),te=z[1];function X(le){var he=typeof le=="function"?le(ge.current):le;he!==ge.current&&pe(he,ge.current),ge.current=he,te({})}return[ge.current,X]}var bn=function(pe){var ge=pe.position,ue=pe.prefixCls,z=pe.extra;if(!z)return null;var te,X=z;return ge==="right"&&(te=X.right||!X.left&&X||null),ge==="left"&&(te=X.left||null),te?w.createElement("div",{className:"".concat(ue,"-extra-content")},te):null};function Nr(re,pe){var ge,ue=w.useContext(ji),z=ue.prefixCls,te=ue.tabs,X=re.className,le=re.style,he=re.id,ve=re.animated,me=re.activeKey,xe=re.rtl,Ce=re.extra,ke=re.editable,Pe=re.locale,je=re.tabPosition,tt=re.tabBarGutter,ht=re.children,rt=re.onTabClick,ct=re.onTabScroll,dt=Object(w.useRef)(),st=Object(w.useRef)(),ot=Object(w.useRef)(),vt=Object(w.useRef)(),ft=kr(),Pt=Object(B.a)(ft,2),Ot=Pt[0],Ze=Pt[1],Je=je==="top"||je==="bottom",pt=yn(0,function(Ct,mt){Je&&ct&&ct({direction:Ct>mt?"left":"right"})}),gt=Object(B.a)(pt,2),ze=gt[0],yt=gt[1],Lt=yn(0,function(Ct,mt){!Je&&ct&&ct({direction:Ct>mt?"top":"bottom"})}),bt=Object(B.a)(Lt,2),Rt=bt[0],Mt=bt[1],Xt=Object(w.useState)(0),ei=Object(B.a)(Xt,2),Ft=ei[0],ti=ei[1],si=Object(w.useState)(0),ii=Object(B.a)(si,2),ni=ii[0],Ht=ii[1],Qt=Object(w.useState)(0),$t=Object(B.a)(Qt,2),Vt=$t[0],di=$t[1],ci=Object(w.useState)(0),mi=Object(B.a)(ci,2),It=mi[0],li=mi[1],gi=Object(w.useState)(null),Dt=Object(B.a)(gi,2),wt=Dt[0],Jt=Dt[1],Hr=Object(w.useState)(null),wn=Object(B.a)(Hr,2),yi=wn[0],Wr=wn[1],Kr=Object(w.useState)(0),Sn=Object(B.a)(Kr,2),Gr=Sn[0],zr=Sn[1],Vr=Object(w.useState)(0),An=Object(B.a)(Vr,2),Yr=An[0],Xr=An[1],$r=r(new Map),On=Object(B.a)($r,2),Jr=On[0],Qr=On[1],ki=t(te,Jr,Ft),Cn="".concat(z,"-nav-operations-hidden"),xi=0,wi=0;Je?xe?(xi=0,wi=Math.max(0,Ft-wt)):(xi=Math.min(0,wt-Ft),wi=0):(xi=Math.min(0,yi-ni),wi=0);function Hi(Ct){return Ct<xi?[xi,!1]:Ct>wi?[wi,!1]:[Ct,!0]}var Rn=Object(w.useRef)(),Zr=Object(w.useState)(),In=Object(B.a)(Zr,2),Wi=In[0],Ln=In[1];function Ki(){Ln(Date.now())}function Gi(){window.clearTimeout(Rn.current)}Pr(dt,function(Ct,mt){var Yt=!1;function ri(Ai,Oi){Ai(function(Ci){var Ri=Hi(Ci+Oi),bi=Object(B.a)(Ri,2),Xi=bi[0],$i=bi[1];return Yt=$i,Xi})}if(Je){if(wt>=Ft)return Yt;ri(yt,Ct)}else{if(yi>=ni)return Yt;ri(Mt,mt)}return Gi(),Ki(),Yt}),Object(w.useEffect)(function(){return Gi(),Wi&&(Rn.current=window.setTimeout(function(){Ln(0)},100)),Gi},[Wi]);function Dn(){var Ct=arguments.length>0&&arguments[0]!==void 0?arguments[0]:me,mt=ki.get(Ct);if(!mt)return;if(Je){var Yt=ze;xe?mt.right<ze?Yt=mt.right:mt.right+mt.width>ze+wt&&(Yt=mt.right+mt.width-wt):mt.left<-ze?Yt=-mt.left:mt.left+mt.width>-ze+wt&&(Yt=-(mt.left+mt.width-wt)),Mt(0),yt(Hi(Yt)[0])}else{var ri=Rt;mt.top<-Rt?ri=-mt.top:mt.top+mt.height>-Rt+yi&&(ri=-(mt.top+mt.height-yi)),yt(0),Mt(Hi(ri)[0])}}var qr=f(ki,{width:wt,height:yi,left:ze,top:Rt},{width:Vt,height:It},{width:Gr,height:Yr},Object(k.a)(Object(k.a)({},re),{},{tabs:te})),Mn=Object(B.a)(qr,2),ea=Mn[0],ta=Mn[1],ia=te.map(function(Ct){var mt=Ct.key;return w.createElement(n,{id:he,prefixCls:z,key:mt,rtl:xe,tab:Ct,closable:Ct.closable,editable:ke,active:mt===me,tabPosition:je,tabBarGutter:tt,renderWrapper:ht,removeAriaLabel:Pe==null?void 0:Pe.removeAriaLabel,ref:Ot(mt),onClick:function(ri){rt(mt,ri)},onRemove:function(){Ze(mt)},onFocus:function(){Dn(mt),Ki(),xe||(dt.current.scrollLeft=0),dt.current.scrollTop=0}})}),zi=a(function(){var Ct,mt,Yt,ri,Ai,Oi,Ci,Ri,bi,Xi=((Ct=dt.current)===null||Ct===void 0?void 0:Ct.offsetWidth)||0,$i=((mt=dt.current)===null||mt===void 0?void 0:mt.offsetHeight)||0,Hn=((Yt=vt.current)===null||Yt===void 0?void 0:Yt.offsetWidth)||0,Wn=((ri=vt.current)===null||ri===void 0?void 0:ri.offsetHeight)||0,la=((Ai=ot.current)===null||Ai===void 0?void 0:Ai.offsetWidth)||0,ua=((Oi=ot.current)===null||Oi===void 0?void 0:Oi.offsetHeight)||0;Jt(Xi),Wr($i),zr(Hn),Xr(Wn);var Kn=(((Ci=st.current)===null||Ci===void 0?void 0:Ci.offsetWidth)||0)-Hn,Gn=(((Ri=st.current)===null||Ri===void 0?void 0:Ri.offsetHeight)||0)-Wn;ti(Kn),Ht(Gn);var zn=(bi=ot.current)===null||bi===void 0?void 0:bi.className.includes(Cn);di(Kn-(zn?0:la)),li(Gn-(zn?0:ua)),Qr(function(){var Vn=new Map;return te.forEach(function(ha){var Yn=ha.key,Ii=Ot(Yn).current;Ii&&Vn.set(Yn,{width:Ii.offsetWidth,height:Ii.offsetHeight,left:Ii.offsetLeft,top:Ii.offsetTop})}),Vn})}),na=te.slice(0,ea),ra=te.slice(ta+1),Pn=[].concat(Object(S.a)(na),Object(S.a)(ra)),aa=Object(w.useState)(),kn=Object(B.a)(aa,2),sa=kn[0],oa=kn[1],fi=ki.get(me),Nn=Object(w.useRef)();function Un(){h.a.cancel(Nn.current)}Object(w.useEffect)(function(){var Ct={};return fi&&(Je?(xe?Ct.right=fi.right:Ct.left=fi.left,Ct.width=fi.width):(Ct.top=fi.top,Ct.height=fi.height)),Un(),Nn.current=h()(function(){oa(Ct)}),Un},[fi,Je,xe]),Object(w.useEffect)(function(){Dn()},[me,fi,ki,Je]),Object(w.useEffect)(function(){zi()},[xe,tt,me,te.map(function(Ct){return Ct.key}).join("_")]);var Fn=!!Pn.length,Si="".concat(z,"-nav-wrap"),Vi,Yi,Bn,jn;return Je?xe?(Yi=ze>0,Vi=ze+wt<Ft):(Vi=ze<0,Yi=-ze+wt<Ft):(Bn=Rt<0,jn=-Rt+yi<ni),w.createElement("div",{ref:pe,role:"tablist",className:H()("".concat(z,"-nav"),X),style:le,onKeyDown:function(){Ki()}},w.createElement(bn,{position:"left",extra:Ce,prefixCls:z}),w.createElement(o.a,{onResize:zi},w.createElement("div",{className:H()(Si,(ge={},Object(ae.a)(ge,"".concat(Si,"-ping-left"),Vi),Object(ae.a)(ge,"".concat(Si,"-ping-right"),Yi),Object(ae.a)(ge,"".concat(Si,"-ping-top"),Bn),Object(ae.a)(ge,"".concat(Si,"-ping-bottom"),jn),ge)),ref:dt},w.createElement(o.a,{onResize:zi},w.createElement("div",{ref:st,className:"".concat(z,"-nav-list"),style:{transform:"translate(".concat(ze,"px, ").concat(Rt,"px)"),transition:Wi?"none":void 0}},ia,w.createElement(mn,{ref:vt,prefixCls:z,locale:Pe,editable:ke,style:{visibility:Fn?"hidden":null}}),w.createElement("div",{className:H()("".concat(z,"-ink-bar"),Object(ae.a)({},"".concat(z,"-ink-bar-animated"),ve.inkBar)),style:sa}))))),w.createElement(Lr,Object.assign({},re,{ref:ot,prefixCls:z,tabs:Pn,className:!Fn&&Cn})),w.createElement(bn,{position:"right",extra:Ce,prefixCls:z}))}var _n=w.forwardRef(Nr);function Ur(re){var pe=re.id,ge=re.activeKey,ue=re.animated,z=re.tabPosition,te=re.rtl,X=re.destroyInactiveTabPane,le=w.useContext(ji),he=le.prefixCls,ve=le.tabs,me=ue.tabPane,xe=ve.findIndex(function(Ce){return Ce.key===ge});return w.createElement("div",{className:H()("".concat(he,"-content-holder"))},w.createElement("div",{className:H()("".concat(he,"-content"),"".concat(he,"-content-").concat(z),Object(ae.a)({},"".concat(he,"-content-animated"),me)),style:xe&&me?Object(ae.a)({},te?"marginRight":"marginLeft","-".concat(xe,"00%")):null},ve.map(function(Ce){return w.cloneElement(Ce.node,{key:Ce.key,prefixCls:he,tabKey:Ce.key,id:pe,animated:me,active:Ce.key===ge,destroyInactiveTabPane:X})})))}function En(re){var pe=re.prefixCls,ge=re.forceRender,ue=re.className,z=re.style,te=re.id,X=re.active,le=re.animated,he=re.destroyInactiveTabPane,ve=re.tabKey,me=re.children,xe=w.useState(ge),Ce=Object(B.a)(xe,2),ke=Ce[0],Pe=Ce[1];w.useEffect(function(){X?Pe(!0):he&&Pe(!1)},[X,he]);var je={};return X||(le?(je.visibility="hidden",je.height=0,je.overflowY="hidden"):je.display="none"),w.createElement("div",{id:te&&"".concat(te,"-panel-").concat(ve),role:"tabpanel",tabIndex:X?0:-1,"aria-labelledby":te&&"".concat(te,"-tab-").concat(ve),"aria-hidden":!X,style:Object(k.a)(Object(k.a)({},je),z),className:H()("".concat(pe,"-tabpane"),X&&"".concat(pe,"-tabpane-active"),ue)},(X||ke||ge)&&me)}var Tn=0;function Fr(re){return Object(U.a)(re).map(function(pe){if(w.isValidElement(pe)){var ge=pe.key!==void 0?String(pe.key):void 0;return Object(k.a)(Object(k.a)({key:ge},pe.props),{},{node:pe})}return null}).filter(function(pe){return pe})}function Br(re,pe){var ge,ue=re.id,z=re.prefixCls,te=z===void 0?"rc-tabs":z,X=re.className,le=re.children,he=re.direction,ve=re.activeKey,me=re.defaultActiveKey,xe=re.editable,Ce=re.animated,ke=re.tabPosition,Pe=ke===void 0?"top":ke,je=re.tabBarGutter,tt=re.tabBarStyle,ht=re.tabBarExtraContent,rt=re.locale,ct=re.moreIcon,dt=re.moreTransitionName,st=re.destroyInactiveTabPane,ot=re.renderTabBar,vt=re.onChange,ft=re.onTabClick,Pt=re.onTabScroll,Ot=Object(O.a)(re,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),Ze=Fr(le),Je=he==="rtl",pt;Ce===!1?pt={inkBar:!1,tabPane:!1}:pt=Object(k.a)({inkBar:!0,tabPane:!1},Ce!==!0?Ce:null);var gt=Object(w.useState)(!1),ze=Object(B.a)(gt,2),yt=ze[0],Lt=ze[1];Object(w.useEffect)(function(){Lt(Mr())},[]);var bt=Object(e.a)(function(){var It;return(It=Ze[0])===null||It===void 0?void 0:It.key},{value:ve,defaultValue:me}),Rt=Object(B.a)(bt,2),Mt=Rt[0],Xt=Rt[1],ei=Object(w.useState)(function(){return Ze.findIndex(function(It){return It.key===Mt})}),Ft=Object(B.a)(ei,2),ti=Ft[0],si=Ft[1];Object(w.useEffect)(function(){var It=Ze.findIndex(function(gi){return gi.key===Mt});if(It===-1){var li;It=Math.max(0,Math.min(ti,Ze.length-1)),Xt((li=Ze[It])===null||li===void 0?void 0:li.key)}si(It)},[Ze.map(function(It){return It.key}).join("_"),Mt,ti]);var ii=Object(e.a)(null,{value:ue}),ni=Object(B.a)(ii,2),Ht=ni[0],Qt=ni[1],$t=Pe;yt&&!["left","right"].includes(Pe)&&($t="top"),Object(w.useEffect)(function(){ue||(Qt("rc-tabs-".concat(Tn)),Tn+=1)},[]);function Vt(It,li){ft==null||ft(It,li),Xt(It),vt==null||vt(It)}var di={id:Ht,activeKey:Mt,animated:pt,tabPosition:$t,rtl:Je,mobile:yt},ci,mi=Object(k.a)(Object(k.a)({},di),{},{editable:xe,locale:rt,moreIcon:ct,moreTransitionName:dt,tabBarGutter:je,onTabClick:Vt,onTabScroll:Pt,extra:ht,style:tt,panes:le});return ot?ci=ot(mi,_n):ci=w.createElement(_n,Object.assign({},mi)),w.createElement(ji.Provider,{value:{tabs:Ze,prefixCls:te}},w.createElement("div",Object.assign({ref:pe,id:ue,className:H()(te,"".concat(te,"-").concat($t),(ge={},Object(ae.a)(ge,"".concat(te,"-mobile"),yt),Object(ae.a)(ge,"".concat(te,"-editable"),xe),Object(ae.a)(ge,"".concat(te,"-rtl"),Je),ge),X)},Ot),ci,w.createElement(Ur,Object.assign({destroyInactiveTabPane:st},di,{animated:pt}))))}var xn=w.forwardRef(Br);xn.TabPane=En;var jr=xn,ma=ye.b=jr},kUb9:function(Ye,ye,$){"use strict";$.r(ye);var ae=$("DjyN"),B=$("NUBc"),O=$("Znn+"),k=$("ZTPi"),w=$("+L6B"),R=$("2/Rp"),H=$("sPJy"),U=$("bE4q"),e=$("9og8"),S=$("k1fw"),d=$("tJVT"),h=$("WmNS"),o=$.n(h),a=$("q1tI"),r=$.n(a),l=$("Ty5D"),s=$("55Ip"),n=$("9kvl"),i=$("xKgJ"),t=$("ErOA"),v=$("BdwD"),f=$("INg4"),p=$.n(f),E=$("479L"),b=$.n(E),g=$("/zsF"),c=$("PArb"),m=$("rAM+"),u=$("9Bee"),_=$("m3rI"),y=function(D){var j,I=D.user,W=D.item,Q=D.getdata,fe=D.params,de=Object(a.useRef)(),Oe=Object(a.useState)(),Se=Object(d.a)(Oe,2),Ie=Se[0],Le=Se[1],Ne=Object(a.useState)(!0),be=Object(d.a)(Ne,2),N=be[0],A=be[1];return Object(a.useEffect)(function(){if(!de.current)return;function C(){var G,P=new ResizeObserver(function(oe){var we=Object(m.a)(oe),Re;try{for(we.s();!(Re=we.n()).done;){var ee=Re.value;console.log("----",ee,oe),Le(ee.target.offsetHeight>=52)}}catch(ce){we.e(ce)}finally{we.f()}});return P.observe((G=de.current)===null||G===void 0?void 0:G.firstElementChild),P}var F=C();return function(){var G,P;((G=de.current)===null||G===void 0?void 0:G.firstElementChild)&&F.unobserve((P=de.current)===null||P===void 0?void 0:P.firstElementChild)}},[de.current]),r.a.createElement("div",{onClick:function(){n.d.push("/classrooms/".concat(fe.coursesId,"/program_homework/").concat(fe.categoryId,"/answer/").concat(W.id,"/detail"))},style:{marginTop:30,padding:"0px 20px",cursor:"pointer"}},r.a.createElement("div",{className:p.a.titles,style:{fontWeight:600,fontSize:18,color:"#000000"}},W.name),r.a.createElement("div",{style:{display:"flex",marginTop:10}},r.a.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",color:"#5F6368"}},r.a.createElement("img",{style:{width:24,borderRadius:50},src:"".concat(_.a.IMG_SERVER,"/images/").concat(W.author.image_url)}),r.a.createElement("span",{style:{margin:"0px 12px 0px 8px"}},W==null||((j=W.author)===null||j===void 0)?void 0:j.name),r.a.createElement("span",null,"\u53D1\u8868\u4E8E",W.created_at)),r.a.createElement("div",null,r.a.createElement("span",{style:{color:"#5F6368",cursor:"pointer"},onClick:function(){}},"\u56DE\u590D\uFF08",(W==null?void 0:W.descendants_count)||0,"\uFF09"),Object(i.j)()&&r.a.createElement("span",{onClick:function(){var C=Object(e.a)(o.a.mark(function F(G){var P;return o.a.wrap(function(we){for(;;)switch(we.prev=we.next){case 0:return G.stopPropagation(),we.next=3,Object(t.a)("/api/hack_messages/".concat(W.id,"/update_public"),{method:"post"});case 3:P=we.sent,P.status===0&&Q();case 5:case"end":return we.stop()}},F)}));return function(F){return C.apply(this,arguments)}}(),style:{color:"#44D7B6",cursor:"pointer",marginLeft:20}},W.is_public?"\u53D6\u6D88\u516C\u5F00":"\u516C\u5F00"))),r.a.createElement("div",{ref:de,style:{margin:"15px 0px",maxHeight:N?52:"",overflow:"hidden"}},r.a.createElement(u.a,{style:{color:"#434D6C",fontSize:14},value:W.content})),(W==null?void 0:W.hack_identifier)&&r.a.createElement("span",{onClick:function(){var C=Object(e.a)(o.a.mark(function F(G){var P,oe;return o.a.wrap(function(Re){for(;;)switch(Re.prev=Re.next){case 0:if(G.stopPropagation(),!Object(i.t)()){Re.next=3;break}return Re.abrupt("return");case 3:return Re.next=5,Object(t.a)("/api/problems/".concat(W==null?void 0:W.hack_identifier,"/start.json"),{method:"get",params:{hack_user_id:W==null||((P=W.author)===null||P===void 0)?void 0:P.id}});case 5:oe=Re.sent,oe&&(window.open("/myproblems/".concat(oe==null?void 0:oe.identifier,"?type=1")),localStorage.setItem("program_homework",[fe.coursesId,fe.categoryId]));case 7:case"end":return Re.stop()}},F)}));return function(F){return C.apply(this,arguments)}}(),className:p.a.tips},W==null?void 0:W.hack_name),Ie&&r.a.createElement("div",{onClick:function(F){F.stopPropagation(),A(!N)}},r.a.createElement(c.a,{dashed:!1,className:"",style:{cursor:"pointer"}},r.a.createElement("a",{className:"font14 ".concat(p.a.color999)},N?"\u9605\u8BFB\u5168\u6587 ":"\u6536\u8D77\u5168\u6587 ",r.a.createElement("i",{className:"iconfont font14 ".concat(N?"icon-jiantou9":"icon-changyongtubiao-xianxingdaochu-zhuanqu-")})))))},T=Object(n.a)(function(x){var D=x.user;return{user:D}})(y),M=function(D){var j,I,W,Q,fe=D.user,de=Object(a.useState)(Object(S.a)(Object(S.a)({},Object(l.i)()),{},{page:1,per_page:10,type:1,sort_by:"",course_group:Object(i.t)()?[fe.userInfo.course.course_group_id]:[]})),Oe=Object(d.a)(de,2),Se=Oe[0],Ie=Oe[1],Le=Object(a.useState)([]),Ne=Object(d.a)(Le,2),be=Ne[0],N=Ne[1];Object(a.useEffect)(function(){A()},[]);function A(){return C.apply(this,arguments)}function C(){return C=Object(e.a)(o.a.mark(function F(){var G;return o.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.next=2,Object(t.a)("/api/homework_commons/".concat(Se.categoryId,"/hack_messages"),{method:"get",params:Object(S.a)(Object(S.a)({},Se),{},{type:1})});case 2:G=oe.sent,N(G);case 4:case"end":return oe.stop()}},F)})),C.apply(this,arguments)}return r.a.createElement("div",{style:{width:1200,margin:"0px auto"}},r.a.createElement(U.a,{separator:">",style:{marginTop:20}},r.a.createElement(U.a.Item,null,r.a.createElement(s.a,{to:"/classrooms/".concat(be==null?void 0:be.course_id,"/program_homework")},be==null?void 0:be.course_name)),r.a.createElement(U.a.Item,null,r.a.createElement(s.a,{to:"/classrooms/".concat(be==null?void 0:be.course_id,"/program_homework/").concat(be==null?void 0:be.homework_id,"/detail")},be==null?void 0:be.homework_name)),r.a.createElement(U.a.Item,null,"\u9898\u89E3&\u95EE\u7B54")),r.a.createElement("div",{style:{marginTop:10,display:"flex"}},r.a.createElement("div",{style:{width:"860px",marginRight:30,background:"#fff"}},r.a.createElement(k.a,{tabBarStyle:{padding:"0px 10px"},style:{width:"850px"},tabBarExtraContent:Object(i.t)()&&r.a.createElement(R.a,{type:"primary",style:{width:88},onClick:function(){n.d.push("/classrooms/".concat(Se.coursesId,"/program_homework/").concat(Se.categoryId,"/answer/add"))}},"\u53D1\u8868\u7B54\u7591"," "),onChange:function(G){G==="1"?Se.sort_by="":Se.sort_by="created_at",Ie(Object(S.a)({},Se)),A()}},r.a.createElement(k.a.TabPane,{key:"1",tab:"\u6700\u65B0\u56DE\u590D"}),r.a.createElement(k.a.TabPane,{key:"2",tab:"\u6700\u65B0\u53D1\u8868"})),(be==null||((j=be.data)===null||j===void 0)?void 0:j.length)<=0&&r.a.createElement(v.a,{customText:"\u6682\u65E0\u8BA8\u8BBA"}),be==null||((I=be.data)===null||I===void 0)?void 0:I.map(function(F){return r.a.createElement(T,{item:F,params:Se,getdata:A})}),r.a.createElement("div",{style:{width:"100%",textAlign:"center",marginTop:10}},r.a.createElement(B.a,{current:Se.page,pageSize:Se.per_page,total:be==null?void 0:be.count,hideOnSinglePage:!0,onChange:function(G,P){Se.page=G,Se.per_page=P,Ie(Object(S.a)({},Se)),A()}}))),r.a.createElement("div",{className:p.a.right,style:{width:300,height:"100%"}},r.a.createElement("div",{style:{display:"flex"}},r.a.createElement("div",{style:{flex:1,display:"flex",alignItems:"center"}},r.a.createElement("span",{style:{marginRight:3,fontSize:20,fontWeight:600,color:"#000"}},"\u5E7F\u64AD"),r.a.createElement("img",{width:21,src:b.a})," "),Object(i.c)()&&r.a.createElement(R.a,{type:"primary",onClick:function(){n.d.push("/classrooms/".concat(Se.coursesId,"/program_homework/").concat(Se.categoryId,"/answer/add"))}},"\u53D1\u5E03\u5E7F\u64AD")),(be==null||((W=be.radio_messages)===null||W===void 0)?void 0:W.length)<=0&&r.a.createElement(v.a,null),be==null||((Q=be.radio_messages)===null||Q===void 0)?void 0:Q.map(function(F){return r.a.createElement("div",{onClick:function(){n.d.push("/classrooms/".concat(Se.coursesId,"/program_homework/").concat(Se.categoryId,"/answer/").concat(F.id,"/detail"))},style:{marginTop:30,cursor:"pointer"}},r.a.createElement("div",{className:p.a.title,style:{fontSize:"16px",fontWeight:600}},r.a.createElement("span",{style:{color:(F==null?void 0:F.message_type)===2?"#4C7BE6":"#E17E7E"}},(F==null?void 0:F.message_type)===2?"\u3010\u9898\u89E3\u3011":"\u3010\u901A\u77E5\u3011"),r.a.createElement("span",{title:F.name},F.name)),r.a.createElement("div",{style:{marginTop:15,color:"#5F6368"}},"\u53D1\u8868\u4E8E",F.created_at))}))))},L=ye.default=Object(n.a)(function(x){var D=x.user;return{user:D}})(M)},nEHx:function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return ae});var ae;(function(B){B.DARK="dark",B.LIGHT="light",B.HIGH_CONTRAST="hc"})(ae||(ae={}))},nnTU:function(Ye,ye,$){"use strict";$.d(ye,"b",function(){return H}),$.d(ye,"a",function(){return U});var ae=$("MI8n"),B=$("JYp7"),O=$("pmY6"),k=$("24hK"),w=$("746U"),R=$("Cg/j");const H=Object(R.c)("commandService"),U=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new ae.b,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(e,S){if(!e)throw new Error("invalid command");if(typeof e=="string"){if(!S)throw new Error("invalid command");return this.registerCommand({id:e,handler:S})}if(e.description){const r=[];for(let s of e.description.args)r.push(s.constraint);const l=e.handler;e.handler=function(s,...n){return Object(w.o)(n,r),l(s,...n)}}const{id:d}=e;let h=this._commands.get(d);h||(h=new k.a,this._commands.set(d,h));let o=h.unshift(e),a=Object(O.i)(()=>{o();const r=this._commands.get(d);(r==null?void 0:r.isEmpty())&&this._commands.delete(d)});return this._onDidRegisterCommand.fire(d),a}registerCommandAlias(e,S){return U.registerCommand(e,(d,...h)=>d.get(H).executeCommand(S,...h))}getCommand(e){const S=this._commands.get(e);return!S||S.isEmpty()?void 0:B.a.first(S)}getCommands(){const e=new Map;for(const S of this._commands.keys()){const d=this.getCommand(S);d&&e.set(S,d)}return e}};U.registerCommand("noop",()=>{})},p5ED:function(Ye,ye,$){"use strict";var ae=$("+L6B"),B=$("2/Rp"),O=$("5Dmo"),k=$("3S7+"),w=$("k1fw"),R=$("9og8"),H=$("tJVT"),U=$("WmNS"),e=$.n(U),S=$("q1tI"),d=$.n(S),h=$("vHTk"),o=$.n(h),a=$("yEEn"),r=$("ZW9T"),l=$("1vsH"),s=$("V0Rq"),n=$("m3rI");ye.a=function(i){var t,v,f,p,E,b,g,c=i.editOffice,m=c===void 0?"view":c,u=i.data,_=i.theme,y=i.type,T=i.filename,M=i.monacoEditor,L=i.className,x=i.style,D=i.close,j=i.onClose,I=i.hasMask,W=i.disabledDownload,Q=Object(S.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),fe=Object(H.a)(Q,2),de=fe[0],Oe=fe[1],Se=Object(S.useState)(""),Ie=Object(H.a)(Se,2),Le=Ie[0],Ne=Ie[1],be=Object(S.useState)(),N=Object(H.a)(be,2),A=N[0],C=N[1],F=window.ENV==="build"?"/react/build":"",G=n.a.PROXY_SERVER||location.origin,P,oe=1024*1024,we=10*oe,Re=Object(S.useRef)();(t=u)!==null&&t!==void 0&&t.startsWith("/api")&&y!=="txt"&&(u=(n.a.API_SERVER||location.origin)+u),y==="office"&&(P=Object(l.T)(u).filesize,P>we&&(y="other")),T&&M&&(M.filename=T),Object(S.useEffect)(function(){var Ae,Me,Be=(Ae=document.cookie)===null||Ae===void 0||((Me=Ae.replace(/\s/g,""))===null||Me===void 0)?void 0:Me.split(";");Be==null||Be.map(function(He){var Fe=He.split("=");Fe[0]==="_educoder_session"&&Ne(Fe[1])})},[]),Object(S.useEffect)(function(){y==="office"&&ee()},[y,u]);var ee=function(){var Ae=Object(R.a)(e.a.mark(function Me(){var Be,He,Fe;return e.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return console.log("data:",u),Be=u,u.startsWith("http")||(Be=location.origin+Be),He=new URL(Be).pathname.split("/").pop(),Ke.next=6,Object(s.V)({attachment_id:He});case 6:Fe=Ke.sent,C(Fe);case 8:case"end":return Ke.stop()}},Me)}));return function(){return Ae.apply(this,arguments)}}(),ce=function(){if(u.startsWith("http")||u.startsWith("blob:")){Ee();return}Object(l.z)(T||"educoder",u,T)},Ee=function(){Object(l.x)(T||"educoder",decodeURIComponent(u))};return d.a.createElement("div",{style:Object(w.a)({},x||{}),className:"".concat(I&&o.a.bgBlack," ").concat(y?o.a.wrp:"hide")},D&&d.a.createElement("div",{className:o.a.close,ref:Re},!W&&d.a.createElement(k.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Re.current}},d.a.createElement("span",{onClick:Ee},d.a.createElement("i",{className:"icon-quxiaozhiding"}))),d.a.createElement(k.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Re.current}},d.a.createElement("span",{className:"",onClick:j},d.a.createElement("i",{className:"icon-guanbi1"})))),d.a.createElement("div",{className:"".concat(o.a[L]," ").concat(L," ").concat(o.a.monaco," ").concat(y==="txt"?"show":"hide")},y==="txt"&&d.a.createElement(r.b,M)),y==="audio"&&d.a.createElement("audio",{src:"".concat(((v=u)===null||v===void 0?void 0:v.indexOf("http://"))>-1||((f=u)===null||f===void 0?void 0:f.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(u),autoPlay:!0}),y==="video"&&d.a.createElement(d.a.Fragment,null,((p=u)===null||p===void 0?void 0:p.indexOf("http"))>-1?d.a.createElement("video",{controls:!0,src:"".concat(u),autoPlay:!0}):d.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(u),autoPlay:!0})),y==="office"&&A&&d.a.createElement("iframe",{src:"".concat(F,"/office.html?key=").concat(A.key,"&url=").concat(G+A.url,"&callbackUrl=").concat(G+A.callbackUrl,"&fileType=").concat(A.fileType,"&title=").concat(A.title,"&model=").concat(m,"&officeServer=").concat(n.a.OFFICE_SERVER,"&disabledDownload=").concat(!!W)}),y==="html"&&d.a.createElement("iframe",{src:u+"&disposition=inline"}),y==="pdf"&&d.a.createElement("iframe",{src:"".concat(F,"/js/pdfview/index.html?url=").concat(u,"&disabledDownload=").concat(!!W)}),y==="image"&&d.a.createElement("img",{src:"".concat(((E=u)===null||E===void 0?void 0:E.indexOf("http://"))>-1||((b=u)===null||b===void 0?void 0:b.indexOf("https://"))>-1||(g=u)!==null&&g!==void 0&&g.startsWith("/api")?"":"data:image/png;base64,").concat(u)}),y==="other"&&d.a.createElement("div",null,d.a.createElement(B.a,{type:"primary",size:"large",onClick:ce},d.a.createElement(a.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),y==="download"&&d.a.createElement(B.a,{type:"primary",size:"large",onClick:ce},d.a.createElement(a.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},pmY6:function(Ye,ye,$){"use strict";$.d(ye,"h",function(){return S}),$.d(ye,"g",function(){return h}),$.d(ye,"f",function(){return o}),$.d(ye,"e",function(){return a}),$.d(ye,"i",function(){return r}),$.d(ye,"b",function(){return l}),$.d(ye,"a",function(){return s}),$.d(ye,"d",function(){return n}),$.d(ye,"c",function(){return i});var ae=$("C/vA"),B=$("JYp7");const O=!1;let k=null;function w(t){k=t}if(O){const t="__is_disposable_tracked__";w(new class{trackDisposable(v){const f=new Error("Potentially leaked disposable").stack;setTimeout(()=>{v[t]||console.log(f)},3e3)}setParent(v,f){if(v&&v!==s.None)try{v[t]=!0}catch(p){}}markAsDisposed(v){if(v&&v!==s.None)try{v[t]=!0}catch(f){}}markAsSingleton(v){}})}function R(t){return k==null||k.trackDisposable(t),t}function H(t){k==null||k.markAsDisposed(t)}function U(t,v){k==null||k.setParent(t,v)}function e(t,v){if(!k)return;for(const f of t)k.setParent(f,v)}function S(t){return k==null||k.markAsSingleton(t),t}class d extends Error{constructor(t){super(`Encountered errors while disposing of store. Errors: [${t.join(", ")}]`);this.errors=t}}function h(t){return typeof t.dispose=="function"&&t.dispose.length===0}function o(t){if(B.a.is(t)){let v=[];for(const f of t)if(f)try{f.dispose()}catch(p){v.push(p)}if(v.length===1)throw v[0];if(v.length>1)throw new d(v);return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function a(...t){const v=r(()=>o(t));return e(t,v),v}function r(t){const v=R({dispose:Object(ae.a)(()=>{H(v),t()})});return v}class l{constructor(){this._toDispose=new Set,this._isDisposed=!1,R(this)}dispose(){if(this._isDisposed)return;H(this),this._isDisposed=!0,this.clear()}clear(){try{o(this._toDispose.values())}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return U(t,this),this._isDisposed?l.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}}l.DISABLE_DISPOSED_WARNING=!1;class s{constructor(){this._store=new l,R(this),U(this._store,this)}dispose(){H(this),this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}}s.None=Object.freeze({dispose(){}});class n{constructor(){this._isDisposed=!1,R(this)}get value(){return this._isDisposed?void 0:this._value}set value(t){var v;if(this._isDisposed||t===this._value)return;(v=this._value)===null||v===void 0||v.dispose(),t&&U(t,this),this._value=t}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,H(this),(t=this._value)===null||t===void 0||t.dispose(),this._value=void 0}clearAndLeak(){const t=this._value;return this._value=void 0,t&&U(t,null),t}}class i{constructor(t){this.object=t}dispose(){}}},psGv:function(Ye,ye,$){var ae,B;(function(){var O;(function(){"use strict";var H=[,,function(d){function h(r){this.__parent=r,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=[]}h.prototype.clone_empty=function(){var r=new h(this.__parent);return r.set_indent(this.__indent_count,this.__alignment_count),r},h.prototype.item=function(r){return r<0?this.__items[this.__items.length+r]:this.__items[r]},h.prototype.has_match=function(r){for(var l=this.__items.length-1;l>=0;l--)if(this.__items[l].match(r))return!0;return!1},h.prototype.set_indent=function(r,l){this.is_empty()&&(this.__indent_count=r||0,this.__alignment_count=l||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},h.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)},h.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},h.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var r=this.__parent.current_line;return r.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),r.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),r.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,r.__items[0]===" "&&(r.__items.splice(0,1),r.__character_count-=1),!0}return!1},h.prototype.is_empty=function(){return this.__items.length===0},h.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},h.prototype.push=function(r){this.__items.push(r);var l=r.lastIndexOf(`
|
|
`);l!==-1?this.__character_count=r.length-l:this.__character_count+=r.length},h.prototype.pop=function(){var r=null;return this.is_empty()||(r=this.__items.pop(),this.__character_count-=r.length),r},h.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},h.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},h.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},h.prototype.toString=function(){var r="";return this.is_empty()?this.__parent.indent_empty_lines&&(r=this.__parent.get_indent_string(this.__indent_count)):(r=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),r+=this.__items.join("")),r};function o(r,l){this.__cache=[""],this.__indent_size=r.indent_size,this.__indent_string=r.indent_char,r.indent_with_tabs||(this.__indent_string=new Array(r.indent_size+1).join(r.indent_char)),l=l||"",r.indent_level>0&&(l=new Array(r.indent_level+1).join(this.__indent_string)),this.__base_string=l,this.__base_string_length=l.length}o.prototype.get_indent_size=function(r,l){var s=this.__base_string_length;return l=l||0,r<0&&(s=0),s+=r*this.__indent_size,s+=l,s},o.prototype.get_indent_string=function(r,l){var s=this.__base_string;return l=l||0,r<0&&(r=0,s=""),l+=r*this.__indent_size,this.__ensure_cache(l),s+=this.__cache[l],s},o.prototype.__ensure_cache=function(r){for(;r>=this.__cache.length;)this.__add_column()},o.prototype.__add_column=function(){var r=this.__cache.length,l=0,s="";this.__indent_size&&r>=this.__indent_size&&(l=Math.floor(r/this.__indent_size),r-=l*this.__indent_size,s=new Array(l+1).join(this.__indent_string)),r&&(s+=new Array(r+1).join(" ")),this.__cache.push(s)};function a(r,l){this.__indent_cache=new o(r,l),this.raw=!1,this._end_with_newline=r.end_with_newline,this.indent_size=r.indent_size,this.wrap_line_length=r.wrap_line_length,this.indent_empty_lines=r.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new h(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(r,l){return this.__indent_cache.get_indent_string(r,l)},a.prototype.get_indent_size=function(r,l){return this.__indent_cache.get_indent_size(r,l)},a.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},a.prototype.add_new_line=function(r){return this.is_empty()||!r&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},a.prototype.get_code=function(r){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 r!==`
|
|
`&&(s=s.replace(/[\n]/g,r)),s},a.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},a.prototype.set_indent=function(r,l){return r=r||0,l=l||0,this.next_line.set_indent(r,l),this.__lines.length>1?(this.current_line.set_indent(r,l),!0):(this.current_line.set_indent(),!1)},a.prototype.add_raw_token=function(r){for(var l=0;l<r.newlines;l++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(r.whitespace_before),this.current_line.push(r.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},a.prototype.add_token=function(r){this.__add_space_before_token(),this.current_line.push(r),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(r){for(var l=this.__lines.length;r<l;)this.__lines[r]._remove_indent(),r++;this.current_line._remove_wrap_indent()},a.prototype.trim=function(r){for(r=r===void 0?!1:r,this.current_line.trim();r&&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(r,l){for(var s=this.__lines.length-2;s>=0;){var n=this.__lines[s];if(n.is_empty())break;if(n.item(0).indexOf(r)!==0&&n.item(-1)!==l){this.__lines.splice(s+1,0,new h(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},d.exports.Output=a},function(d){function h(o,a,r,l){this.type=o,this.text=a,this.comments_before=null,this.newlines=r||0,this.whitespace_before=l||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}d.exports.Token=h},,,function(d){function h(r,l){this.raw_options=o(r,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"])}h.prototype._get_array=function(r,l){var s=this.raw_options[r],n=l||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(n=s.concat()):typeof s=="string"&&(n=s.split(/[^a-zA-Z0-9_\/\-]+/)),n},h.prototype._get_boolean=function(r,l){var s=this.raw_options[r],n=s===void 0?!!l:!!s;return n},h.prototype._get_characters=function(r,l){var s=this.raw_options[r],n=l||"";return typeof s=="string"&&(n=s.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),n},h.prototype._get_number=function(r,l){var s=this.raw_options[r];l=parseInt(l,10),isNaN(l)&&(l=0);var n=parseInt(s,10);return isNaN(n)&&(n=l),n},h.prototype._get_selection=function(r,l,s){var n=this._get_selection_list(r,l,s);if(n.length!==1)throw new Error("Invalid Option Value: The option '"+r+`' can only be one of the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[r]+"'");return n[0]},h.prototype._get_selection_list=function(r,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 n=this._get_array(r,s);if(!this._is_valid_selection(n,l))throw new Error("Invalid Option Value: The option '"+r+`' can contain only the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[r]+"'");return n},h.prototype._is_valid_selection=function(r,l){return r.length&&l.length&&!r.some(function(s){return l.indexOf(s)===-1})};function o(r,l){var s={};r=a(r);var n;for(n in r)n!==l&&(s[n]=r[n]);if(l&&r[l])for(n in r[l])s[n]=r[l][n];return s}function a(r){var l={},s;for(s in r){var n=s.replace(/-/g,"_");l[n]=r[s]}return l}d.exports.Options=h,d.exports.normalizeOpts=a,d.exports.mergeOpts=o},,function(d){var h=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 r=null;return a=a||0,a+=this.__position,a>=0&&a<this.__input_length&&(r=this.__input.charAt(a)),r},o.prototype.__match=function(a,r){a.lastIndex=r;var l=a.exec(this.__input);return l&&!(h&&a.sticky)&&(l.index!==r&&(l=null)),l},o.prototype.test=function(a,r){return r=r||0,r+=this.__position,r>=0&&r<this.__input_length?!!this.__match(a,r):!1},o.prototype.testChar=function(a,r){var l=this.peek(r);return a.lastIndex=0,l!==null&&a.test(l)},o.prototype.match=function(a){var r=this.__match(a,this.__position);return r?this.__position+=r[0].length:r=null,r},o.prototype.read=function(a,r,l){var s="",n;return a&&(n=this.match(a),n&&(s+=n[0])),r&&(n||!a)&&(s+=this.readUntil(r,l)),s},o.prototype.readUntil=function(a,r){var l="",s=this.__position;a.lastIndex=this.__position;var n=a.exec(this.__input);return n?(s=n.index,r&&(s+=n[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,r){var l=null,s="g";return r&&h&&(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 r=this.__position,l=this.readUntilAfter(a);return this.__position=r,l},o.prototype.lookBack=function(a){var r=this.__position-1;return r>=a.length&&this.__input.substring(r-a.length,r).toLowerCase()===a},d.exports.InputScanner=o},function(d,h,o){var a=o(8).InputScanner,r=o(3).Token,l=o(10).TokenStream,s=o(11).WhitespacePattern,n={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},i=function(t,v){this._input=new a(t),this._options=v||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};i.prototype.tokenize=function(){this._input.restart(),this.__tokens=new l,this._reset();for(var t,v=new r(n.START,""),f=null,p=[],E=new l;v.type!==n.EOF;){for(t=this._get_next_token(v,f);this._is_comment(t);)E.add(t),t=this._get_next_token(v,f);E.isEmpty()||(t.comments_before=E,E=new l),t.parent=f,this._is_opening(t)?(p.push(f),f=t):f&&this._is_closing(t,f)&&(t.opened=f,f.closed=t,f=p.pop(),t.parent=f),t.previous=v,v.next=t,this.__tokens.add(t),v=t}return this.__tokens},i.prototype._is_first_token=function(){return this.__tokens.isEmpty()},i.prototype._reset=function(){},i.prototype._get_next_token=function(t,v){this._readWhitespace();var f=this._input.read(/.+/g);return f?this._create_token(n.RAW,f):this._create_token(n.EOF,"")},i.prototype._is_comment=function(t){return!1},i.prototype._is_opening=function(t){return!1},i.prototype._is_closing=function(t,v){return!1},i.prototype._create_token=function(t,v){var f=new r(t,v,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return f},i.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},d.exports.Tokenizer=i,d.exports.TOKEN=n},function(d){function h(o){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=o}h.prototype.restart=function(){this.__position=0},h.prototype.isEmpty=function(){return this.__tokens_length===0},h.prototype.hasNext=function(){return this.__position<this.__tokens_length},h.prototype.next=function(){var o=null;return this.hasNext()&&(o=this.__tokens[this.__position],this.__position+=1),o},h.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},h.prototype.add=function(o){this.__parent_token&&(o.parent=this.__parent_token),this.__tokens.push(o),this.__tokens_length+=1},d.exports.TokenStream=h},function(d,h,o){var a=o(12).Pattern;function r(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=""}r.prototype=new a,r.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+"]")},r.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},r.prototype.matching=function(l,s){var n=this._create();return n.__set_whitespace_patterns(l,s),n._update(),n},r.prototype._create=function(){return new r(this._input,this)},r.prototype.__split=function(l,s){l.lastIndex=0;for(var n=0,i=[],t=l.exec(s);t;)i.push(s.substring(n,t.index)),n=t.index+t[0].length,t=l.exec(s);return n<s.length?i.push(s.substring(n,s.length)):i.push(""),i},d.exports.WhitespacePattern=r},function(d){function h(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)}h.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},h.prototype.read_match=function(){return this._input.match(this._match_pattern)},h.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},h.prototype.until=function(o){var a=this._create();return a._until_after=!1,a._until_pattern=this._input.get_regexp(o),a._update(),a},h.prototype.starting_with=function(o){var a=this._create();return a._starting_pattern=this._input.get_regexp(o,!0),a._update(),a},h.prototype.matching=function(o){var a=this._create();return a._match_pattern=this._input.get_regexp(o,!0),a._update(),a},h.prototype._create=function(){return new h(this._input,this)},h.prototype._update=function(){},d.exports.Pattern=h},function(d){function h(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")}h.prototype.get_directives=function(o){if(!o.match(this.__directives_block_pattern))return null;var a={};this.__directive_pattern.lastIndex=0;for(var r=this.__directive_pattern.exec(o);r;)a[r[1]]=r[2],r=this.__directive_pattern.exec(o);return a},h.prototype.readIgnored=function(o){return o.readUntilAfter(this.__directives_end_ignore_pattern)},d.exports.Directives=h},function(d,h,o){var a=o(12).Pattern,r={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function l(s,n){a.call(this,s,n),this.__template_pattern=null,this._disabled=Object.assign({},r),this._excluded=Object.assign({},r),n&&(this.__template_pattern=this._input.get_regexp(n.__template_pattern),this._excluded=Object.assign(this._excluded,n._excluded),this._disabled=Object.assign(this._disabled,n._disabled));var i=new a(s);this.__patterns={handlebars_comment:i.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:i.starting_with(/{{{/).until_after(/}}}/),handlebars:i.starting_with(/{{/).until_after(/}}/),php:i.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:i.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:i.starting_with(/{%/).until_after(/%}/),django_value:i.starting_with(/{{/).until_after(/}}/),django_comment:i.starting_with(/{#/).until_after(/#}/),smarty:i.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:i.starting_with(/{\*/).until_after(/\*}/),smarty_literal:i.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 n=this._create();return n._disabled[s]=!0,n._update(),n},l.prototype.read_options=function(s){var n=this._create();for(var i in r)n._disabled[i]=s.templating.indexOf(i)===-1;return n._update(),n},l.prototype.exclude=function(s){var n=this._create();return n._excluded[s]=!0,n._update(),n},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 n=this._read_template();n;)this._match_pattern?n+=this._input.read(this._match_pattern):n+=this._input.readUntil(this.__template_pattern),s+=n,n=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="",n=this._input.peek();if(n==="<"){var i=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&i==="?"&&(s=s||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&i==="%"&&(s=s||this.__patterns.erb.read())}else n==="{"&&(!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},d.exports.TemplatablePattern=l},,,,function(d,h,o){var a=o(19).Beautifier,r=o(20).Options;function l(s,n,i,t){var v=new a(s,n,i,t);return v.beautify()}d.exports=l,d.exports.defaultOptions=function(){return new r}},function(d,h,o){var a=o(20).Options,r=o(2).Output,l=o(21).Tokenizer,s=o(21).TOKEN,n=/\r\n|[\r\n]/,i=/\r\n|[\r\n]/g,t=function(_,y){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=_.max_preserve_newlines,this.preserve_newlines=_.preserve_newlines,this._output=new r(_,y)};t.prototype.current_line_has_match=function(_){return this._output.current_line.has_match(_)},t.prototype.set_space_before_token=function(_,y){this._output.space_before_token=_,this._output.non_breaking_space=y},t.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},t.prototype.add_raw_token=function(_){this._output.add_raw_token(_)},t.prototype.print_preserved_newlines=function(_){var y=0;_.type!==s.TEXT&&_.previous.type!==s.TEXT&&(y=_.newlines?1:0),this.preserve_newlines&&(y=_.newlines<this.max_preserve_newlines+1?_.newlines:this.max_preserve_newlines+1);for(var T=0;T<y;T++)this.print_newline(T>0);return y!==0},t.prototype.traverse_whitespace=function(_){return _.whitespace_before||_.newlines?(this.print_preserved_newlines(_)||(this._output.space_before_token=!0),!0):!1},t.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},t.prototype.print_newline=function(_){this._output.add_new_line(_)},t.prototype.print_token=function(_){_.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(_.text))},t.prototype.indent=function(){this.indent_level++},t.prototype.get_full_indent=function(_){return _=this.indent_level+(_||0),_<1?"":this._output.get_indent_string(_)};var v=function(_){for(var y=null,T=_.next;T.type!==s.EOF&&_.closed!==T;){if(T.type===s.ATTRIBUTE&&T.text==="type"){T.next&&T.next.type===s.EQUALS&&T.next.next&&T.next.next.type===s.VALUE&&(y=T.next.next.text);break}T=T.next}return y},f=function(_,y){var T=null,M=null;return y.closed?(_==="script"?T="text/javascript":_==="style"&&(T="text/css"),T=v(y)||T,T.search("text/css")>-1?M="css":T.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?M="javascript":T.search(/(text|application|dojo)\/(x-)?(html)/)>-1?M="html":T.search(/test\/null/)>-1&&(M="null"),M):null};function p(_,y){return y.indexOf(_)!==-1}function E(_,y,T){this.parent=_||null,this.tag=y?y.tag_name:"",this.indent_level=T||0,this.parser_token=y||null}function b(_){this._printer=_,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(_){var y=new E(this._current_frame,_,this._printer.indent_level);this._current_frame=y},b.prototype._try_pop_frame=function(_){var y=null;return _&&(y=_.parser_token,this._printer.indent_level=_.indent_level,this._current_frame=_.parent),y},b.prototype._get_frame=function(_,y){for(var T=this._current_frame;T&&!(_.indexOf(T.tag)!==-1);){if(y&&y.indexOf(T.tag)!==-1){T=null;break}T=T.parent}return T},b.prototype.try_pop=function(_,y){var T=this._get_frame([_],y);return this._try_pop_frame(T)},b.prototype.indent_to_tag=function(_){var y=this._get_frame(_);y&&(this._printer.indent_level=y.indent_level)};function g(_,y,T,M){this._source_text=_||"",y=y||{},this._js_beautify=T,this._css_beautify=M,this._tag_stack=null;var L=new a(y,"html");this._options=L,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"}g.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var _=this._source_text,y=this._options.eol;this._options.eol==="auto"&&(y=`
|
|
`,_&&n.test(_)&&(y=_.match(n)[0])),_=_.replace(i,`
|
|
`);var T=_.match(/^[\t ]*/)[0],M={text:"",type:""},L=new c,x=new t(this._options,T),D=new l(_,this._options).tokenize();this._tag_stack=new b(x);for(var j=null,I=D.next();I.type!==s.EOF;)I.type===s.TAG_OPEN||I.type===s.COMMENT?(j=this._handle_tag_open(x,I,L,M),L=j):I.type===s.ATTRIBUTE||I.type===s.EQUALS||I.type===s.VALUE||I.type===s.TEXT&&!L.tag_complete?j=this._handle_inside_tag(x,I,L,D):I.type===s.TAG_CLOSE?j=this._handle_tag_close(x,I,L):I.type===s.TEXT?j=this._handle_text(x,I,L):x.add_raw_token(I),M=j,I=D.next();var W=x._output.get_code(y);return W},g.prototype._handle_tag_close=function(_,y,T){var M={text:y.text,type:y.type};return _.alignment_size=0,T.tag_complete=!0,_.set_space_before_token(y.newlines||y.whitespace_before!=="",!0),T.is_unformatted?_.add_raw_token(y):(T.tag_start_char==="<"&&(_.set_space_before_token(y.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&T.has_wrapped_attrs&&_.print_newline(!1)),_.print_token(y)),T.indent_content&&!(T.is_unformatted||T.is_content_unformatted)&&(_.indent(),T.indent_content=!1),!T.is_inline_element&&!(T.is_unformatted||T.is_content_unformatted)&&_.set_wrap_point(),M},g.prototype._handle_inside_tag=function(_,y,T,M){var L=T.has_wrapped_attrs,x={text:y.text,type:y.type};if(_.set_space_before_token(y.newlines||y.whitespace_before!=="",!0),T.is_unformatted)_.add_raw_token(y);else if(T.tag_start_char==="{"&&y.type===s.TEXT)_.print_preserved_newlines(y)?(y.newlines=0,_.add_raw_token(y)):_.print_token(y);else{if(y.type===s.ATTRIBUTE?(_.set_space_before_token(!0),T.attr_count+=1):(y.type===s.EQUALS||y.type===s.VALUE&&y.previous.type===s.EQUALS)&&_.set_space_before_token(!1),y.type===s.ATTRIBUTE&&T.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(_.traverse_whitespace(y),L=L||y.newlines!==0),this._is_wrap_attributes_force)){var D=T.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&T.attr_count===1){var j=!0,I=0,W;do{if(W=M.peek(I),W.type===s.ATTRIBUTE){j=!1;break}I+=1}while(I<4&&W.type!==s.EOF&&W.type!==s.TAG_CLOSE);D=!j}D&&(_.print_newline(!1),L=!0)}_.print_token(y),L=L||_.previous_token_wrapped(),T.has_wrapped_attrs=L}return x},g.prototype._handle_text=function(_,y,T){var M={text:y.text,type:"TK_CONTENT"};return T.custom_beautifier_name?this._print_custom_beatifier_text(_,y,T):T.is_unformatted||T.is_content_unformatted?_.add_raw_token(y):(_.traverse_whitespace(y),_.print_token(y)),M},g.prototype._print_custom_beatifier_text=function(_,y,T){var M=this;if(y.text!==""){var L=y.text,x,D=1,j="",I="";T.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?x=this._js_beautify:T.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?x=this._css_beautify:T.custom_beautifier_name==="html"&&(x=function(Se,Ie){var Le=new g(Se,Ie,M._js_beautify,M._css_beautify);return Le.beautify()}),this._options.indent_scripts==="keep"?D=0:this._options.indent_scripts==="separate"&&(D=-_.indent_level);var W=_.get_full_indent(D);if(L=L.replace(/\n[ \t]*$/,""),T.custom_beautifier_name!=="html"&&L[0]==="<"&&L.match(/^(<!--|<!\[CDATA\[)/)){var Q=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(L);if(!Q){_.add_raw_token(y);return}j=W+Q[1]+`
|
|
`,L=Q[4],Q[5]&&(I=W+Q[5]),L=L.replace(/\n[ \t]*$/,""),(Q[2]||Q[3].indexOf(`
|
|
`)!==-1)&&(Q=Q[3].match(/[ \t]+$/),Q&&(y.whitespace_before=Q[0]))}if(L)if(x){var fe=function(){this.eol=`
|
|
`};fe.prototype=this._options.raw_options;var de=new fe;L=x(W+L,de)}else{var Oe=y.whitespace_before;Oe&&(L=L.replace(new RegExp(`
|
|
(`+Oe+")?","g"),`
|
|
`)),L=W+L.replace(/\n/g,`
|
|
`+W)}j&&(L?L=j+L+`
|
|
`+I:L=j+I),_.print_newline(!1),L&&(y.text=L,y.whitespace_before="",y.newlines=0,_.add_raw_token(y),_.print_newline(!0))}},g.prototype._handle_tag_open=function(_,y,T,M){var L=this._get_tag_open_token(y);return(T.is_unformatted||T.is_content_unformatted)&&!T.is_empty_element&&y.type===s.TAG_OPEN&&y.text.indexOf("</")===0?(_.add_raw_token(y),L.start_tag_token=this._tag_stack.try_pop(L.tag_name)):(_.traverse_whitespace(y),this._set_tag_position(_,y,L,T,M),L.is_inline_element||_.set_wrap_point(),_.print_token(y)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(L.alignment_size=y.text.length+1),!L.tag_complete&&!L.is_unformatted&&(_.alignment_size=L.alignment_size),L};var c=function(_,y){if(this.parent=_||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="",!y)this.tag_complete=!0;else{var T;this.tag_start_char=y.text[0],this.text=y.text,this.tag_start_char==="<"?(T=y.text.match(/^<([^\s>]*)/),this.tag_check=T?T[1]:""):(T=y.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=T?T[1]:"",(y.text.startsWith("{{#>")||y.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&y.next!==null?this.tag_check=y.next.text.split(" ")[0]:this.tag_check=y.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),y.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||y.closed&&y.closed.text==="/>";var M=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(M=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(M)))}};g.prototype._get_tag_open_token=function(_){var y=new c(this._tag_stack.get_parser_token(),_);return y.alignment_size=this._options.wrap_attributes_indent_size,y.is_end_tag=y.is_end_tag||p(y.tag_check,this._options.void_elements),y.is_empty_element=y.tag_complete||y.is_start_tag&&y.is_end_tag,y.is_unformatted=!y.tag_complete&&p(y.tag_check,this._options.unformatted),y.is_content_unformatted=!y.is_empty_element&&p(y.tag_check,this._options.content_unformatted),y.is_inline_element=p(y.tag_name,this._options.inline)||y.tag_name.includes("-")||y.tag_start_char==="{",y},g.prototype._set_tag_position=function(_,y,T,M,L){if(T.is_empty_element||(T.is_end_tag?T.start_tag_token=this._tag_stack.try_pop(T.tag_name):(this._do_optional_end_element(T)&&(T.is_inline_element||_.print_newline(!1)),this._tag_stack.record_tag(T),(T.tag_name==="script"||T.tag_name==="style")&&!(T.is_unformatted||T.is_content_unformatted)&&(T.custom_beautifier_name=f(T.tag_check,y)))),p(T.tag_check,this._options.extra_liners)&&(_.print_newline(!1),_._output.just_added_blankline()||_.print_newline(!0)),T.is_empty_element){if(T.tag_start_char==="{"&&T.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),T.indent_content=!0;var x=_.current_line_has_match(/{{#if/);x||_.print_newline(!1)}T.tag_name==="!--"&&L.type===s.TAG_CLOSE&&M.is_end_tag&&T.text.indexOf(`
|
|
`)===-1||(T.is_inline_element||T.is_unformatted||_.print_newline(!1),this._calcluate_parent_multiline(_,T))}else if(T.is_end_tag){var D=!1;D=T.start_tag_token&&T.start_tag_token.multiline_content,D=D||!T.is_inline_element&&!(M.is_inline_element||M.is_unformatted)&&!(L.type===s.TAG_CLOSE&&T.start_tag_token===M)&&L.type!=="TK_CONTENT",(T.is_content_unformatted||T.is_unformatted)&&(D=!1),D&&_.print_newline(!1)}else T.indent_content=!T.custom_beautifier_name,T.tag_start_char==="<"&&(T.tag_name==="html"?T.indent_content=this._options.indent_inner_html:T.tag_name==="head"?T.indent_content=this._options.indent_head_inner_html:T.tag_name==="body"&&(T.indent_content=this._options.indent_body_inner_html)),!(T.is_inline_element||T.is_unformatted)&&(L.type!=="TK_CONTENT"||T.is_content_unformatted)&&_.print_newline(!1),this._calcluate_parent_multiline(_,T)},g.prototype._calcluate_parent_multiline=function(_,y){y.parent&&_._output.just_added_newline()&&!((y.is_inline_element||y.is_unformatted)&&y.parent.is_inline_element)&&(y.parent.multiline_content=!0)};var m=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],u=["a","audio","del","ins","map","noscript","video"];g.prototype._do_optional_end_element=function(_){var y=null;if(_.is_empty_element||!_.is_start_tag||!_.parent)return;if(_.tag_name==="body")y=y||this._tag_stack.try_pop("head");else if(_.tag_name==="li")y=y||this._tag_stack.try_pop("li",["ol","ul"]);else if(_.tag_name==="dd"||_.tag_name==="dt")y=y||this._tag_stack.try_pop("dt",["dl"]),y=y||this._tag_stack.try_pop("dd",["dl"]);else if(_.parent.tag_name==="p"&&m.indexOf(_.tag_name)!==-1){var T=_.parent.parent;(!T||u.indexOf(T.tag_name)===-1)&&(y=y||this._tag_stack.try_pop("p"))}else _.tag_name==="rp"||_.tag_name==="rt"?(y=y||this._tag_stack.try_pop("rt",["ruby","rtc"]),y=y||this._tag_stack.try_pop("rp",["ruby","rtc"])):_.tag_name==="optgroup"?y=y||this._tag_stack.try_pop("optgroup",["select"]):_.tag_name==="option"?y=y||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):_.tag_name==="colgroup"?y=y||this._tag_stack.try_pop("caption",["table"]):_.tag_name==="thead"?(y=y||this._tag_stack.try_pop("caption",["table"]),y=y||this._tag_stack.try_pop("colgroup",["table"])):_.tag_name==="tbody"||_.tag_name==="tfoot"?(y=y||this._tag_stack.try_pop("caption",["table"]),y=y||this._tag_stack.try_pop("colgroup",["table"]),y=y||this._tag_stack.try_pop("thead",["table"]),y=y||this._tag_stack.try_pop("tbody",["table"])):_.tag_name==="tr"?(y=y||this._tag_stack.try_pop("caption",["table"]),y=y||this._tag_stack.try_pop("colgroup",["table"]),y=y||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(_.tag_name==="th"||_.tag_name==="td")&&(y=y||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),y=y||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return _.parent=this._tag_stack.get_parser_token(),y},d.exports.Beautifier=g},function(d,h,o){var a=o(6).Options;function r(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"])}r.prototype=new a,d.exports.Options=r},function(d,h,o){var a=o(9).Tokenizer,r=o(9).TOKEN,l=o(13).Directives,s=o(14).TemplatablePattern,n=o(12).Pattern,i={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:r.START,RAW:r.RAW,EOF:r.EOF},t=new l(/<\!--/,/-->/),v=function(f,p){a.call(this,f,p),this._current_tag_name="";var E=new s(this._input).read_options(this._options),b=new n(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 g=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=b.matching(g).until_after(g)}};v.prototype=new a,v.prototype._is_comment=function(f){return!1},v.prototype._is_opening=function(f){return f.type===i.TAG_OPEN},v.prototype._is_closing=function(f,p){return f.type===i.TAG_CLOSE&&p&&((f.text===">"||f.text==="/>")&&p.text[0]==="<"||f.text==="}}"&&p.text[0]==="{"&&p.text[1]==="{")},v.prototype._reset=function(){this._current_tag_name=""},v.prototype._get_next_token=function(f,p){var E=null;this._readWhitespace();var b=this._input.peek();return b===null?this._create_token(i.EOF,""):(E=E||this._read_open_handlebars(b,p),E=E||this._read_attribute(b,f,p),E=E||this._read_close(b,p),E=E||this._read_raw_content(b,f,p),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,p),E=E||this._create_token(i.UNKNOWN,this._input.next()),E)},v.prototype._read_comment_or_cdata=function(f){var p=null,E=null,b=null;if(f==="<"){var g=this._input.peek(1);g==="!"&&(E=this.__patterns.comment.read(),E?(b=t.get_directives(E),b&&b.ignore==="start"&&(E+=t.readIgnored(this._input))):E=this.__patterns.cdata.read()),E&&(p=this._create_token(i.COMMENT,E),p.directives=b)}return p},v.prototype._read_processing=function(f){var p=null,E=null,b=null;if(f==="<"){var g=this._input.peek(1);(g==="!"||g==="?")&&(E=this.__patterns.conditional_comment.read(),E=E||this.__patterns.processing.read()),E&&(p=this._create_token(i.COMMENT,E),p.directives=b)}return p},v.prototype._read_open=function(f,p){var E=null,b=null;return p||f==="<"&&(E=this._input.next(),this._input.peek()==="/"&&(E+=this._input.next()),E+=this.__patterns.element_name.read(),b=this._create_token(i.TAG_OPEN,E)),b},v.prototype._read_open_handlebars=function(f,p){var E=null,b=null;return p||this._options.indent_handlebars&&f==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(E=this.__patterns.handlebars_comment.read(),E=E||this.__patterns.handlebars.read(),b=this._create_token(i.COMMENT,E)):(E=this.__patterns.handlebars_open.read(),b=this._create_token(i.TAG_OPEN,E))),b},v.prototype._read_close=function(f,p){var E=null,b=null;return p&&(p.text[0]==="<"&&(f===">"||f==="/"&&this._input.peek(1)===">")?(E=this._input.next(),f==="/"&&(E+=this._input.next()),b=this._create_token(i.TAG_CLOSE,E)):p.text[0]==="{"&&f==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),b=this._create_token(i.TAG_CLOSE,"}}"))),b},v.prototype._read_attribute=function(f,p,E){var b=null,g="";if(E&&E.text[0]==="<")if(f==="=")b=this._create_token(i.EQUALS,this._input.next());else if(f==='"'||f==="'"){var c=this._input.next();f==='"'?c+=this.__patterns.double_quote.read():c+=this.__patterns.single_quote.read(),b=this._create_token(i.VALUE,c)}else g=this.__patterns.attribute.read(),g&&(p.type===i.EQUALS?b=this._create_token(i.VALUE,g):b=this._create_token(i.ATTRIBUTE,g));return b},v.prototype._is_content_unformatted=function(f){return this._options.void_elements.indexOf(f)===-1&&(this._options.content_unformatted.indexOf(f)!==-1||this._options.unformatted.indexOf(f)!==-1)},v.prototype._read_raw_content=function(f,p,E){var b="";if(E&&E.text[0]==="{")b=this.__patterns.handlebars_raw_close.read();else if(p.type===i.TAG_CLOSE&&p.opened.text[0]==="<"&&p.text[0]!=="/"){var g=p.opened.text.substr(1).toLowerCase();if(g==="script"||g==="style"){var c=this._read_comment_or_cdata(f);if(c)return c.type=i.TEXT,c;b=this._input.readUntil(new RegExp("</"+g+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(g)&&(b=this._input.readUntil(new RegExp("</"+g+"[\\n\\r\\t ]*?>","ig")))}return b?this._create_token(i.TEXT,b):null},v.prototype._read_content_word=function(f){var p="";if(this._options.unformatted_content_delimiter&&(f===this._options.unformatted_content_delimiter[0]&&(p=this.__patterns.unformatted_content_delimiter.read())),p||(p=this.__patterns.word.read()),p)return this._create_token(i.TEXT,p)},d.exports.Tokenizer=v,d.exports.TOKEN=i}],U={};function e(d){var h=U[d];if(h!==void 0)return h.exports;var o=U[d]={exports:{}};return H[d](o,o.exports,e),o.exports}var S=e(18);O=S})();var k=O;if(!0)!(ae=[$,$("6UM0"),$("TXwP")],B=function(H){var U=$("6UM0"),e=$("TXwP");return{html_beautify:function(S,d){return k(S,d,U.js_beautify,e.css_beautify)}}}.apply(ye,ae),B!==void 0&&(Ye.exports=B));else var w,R})()},"rAM+":function(Ye,ye,$){"use strict";$.d(ye,"a",function(){return B});var ae=$("Qw5x");function B(O,k){var w;if(typeof Symbol=="undefined"||O[Symbol.iterator]==null){if(Array.isArray(O)||(w=Object(ae.a)(O))||k&&O&&typeof O.length=="number"){w&&(O=w);var R=0,H=function(){};return{s:H,n:function(){return R>=O.length?{done:!0}:{done:!1,value:O[R++]}},e:function(h){throw h},f:H}}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 U=!0,e=!1,S;return{s:function(){w=O[Symbol.iterator]()},n:function(){var h=w.next();return U=h.done,h},e:function(h){e=!0,S=h},f:function(){try{!U&&w.return!=null&&w.return()}finally{if(e)throw S}}}}},rUJ1:function(Ye,ye){const $=/[&<>"']/,ae=/[&<>"']/g,B=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,k={"&":"&","<":"<",">":">",'"':""","'":"'"},w=b=>k[b];function R(b,g){if(g){if($.test(b))return b.replace(ae,w)}else if(B.test(b))return b.replace(O,w);return b}const H=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(b){return b.replace(H,(g,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const e=/(^|[^\[])\^/g;function S(b,g){b=b.source||b,g=g||"";const c={replace:(m,u)=>(u=u.source||u,u=u.replace(e,"$1"),b=b.replace(m,u),c),getRegex:()=>new RegExp(b,g)};return c}const d=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function o(b,g,c){if(b){let m;try{m=decodeURIComponent(U(c)).replace(d,"").toLowerCase()}catch(u){return null}if(m.indexOf("javascript:")===0||m.indexOf("vbscript:")===0||m.indexOf("data:")===0)return null}g&&!h.test(c)&&(c=n(g,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(m){return null}return c}const a={},r=/^[^:]+:\/*[^/]*$/,l=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function n(b,g){a[" "+b]||(r.test(b)?a[" "+b]=b+"/":a[" "+b]=f(b,"/",!0)),b=a[" "+b];const c=b.indexOf(":")===-1;return g.substring(0,2)==="//"?c?g:b.replace(l,"$1")+g:g.charAt(0)==="/"?c?g:b.replace(s,"$1")+g:b+g}const i={exec:function(){}};function t(b){let g=1,c,m;for(;g<arguments.length;g++){c=arguments[g];for(m in c)Object.prototype.hasOwnProperty.call(c,m)&&(b[m]=c[m])}return b}function v(b,g){const c=b.replace(/\|/g,(_,y,T)=>{let M=!1,L=y;for(;--L>=0&&T[L]==="\\";)M=!M;return M?"|":" |"}),m=c.split(/ \|/);let u=0;if(m.length>g)m.splice(g);else for(;m.length<g;)m.push("");for(;u<m.length;u++)m[u]=m[u].trim().replace(/\\\|/g,"|");return m}function f(b,g,c){const m=b.length;if(m===0)return"";let u=0;for(;u<m;){const _=b.charAt(m-u-1);if(_===g&&!c)u++;else if(_!==g&&c)u++;else break}return b.substr(0,m-u)}function p(b,g){if(b.indexOf(g[1])===-1)return-1;const c=b.length;let m=0,u=0;for(;u<c;u++)if(b[u]==="\\")u++;else if(b[u]===g[0])m++;else if(b[u]===g[1]&&(m--,m<0))return u;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")}Ye.exports={escape:R,unescape:U,edit:S,cleanUrl:o,resolveUrl:n,noopTest:i,merge:t,splitCells:v,rtrim:f,findClosingBracket:p,checkSanitizeDeprecation:E}},t23M:function(Ye,ye,$){"use strict";var ae=$("VTBJ"),B=$("1OyB"),O=$("vuIU"),k=$("Ji7U"),w=$("LK+K"),R=$("q1tI"),H=$.n(R),U=$("m+aA"),e=$("Zm9Q"),S=$("Kwbf"),d=$("c+Xe"),h=$("bdgK"),o="rc-observer-key",a=function(r){Object(k.a)(s,r);var l=Object(w.a)(s);function s(){var n;return Object(B.a)(this,s),n=l.apply(this,arguments),n.resizeObserver=null,n.childNode=null,n.currentElement=null,n.state={width:0,height:0,offsetHeight:0,offsetWidth:0},n.onResize=function(i){var t=n.props.onResize,v=i[0].target,f=v.getBoundingClientRect(),p=f.width,E=f.height,b=v.offsetWidth,g=v.offsetHeight,c=Math.floor(p),m=Math.floor(E);if(n.state.width!==c||n.state.height!==m||n.state.offsetWidth!==b||n.state.offsetHeight!==g){var u={width:c,height:m,offsetWidth:b,offsetHeight:g};n.setState(u),t&&Promise.resolve().then(function(){t(Object(ae.a)(Object(ae.a)({},u),{},{offsetWidth:b,offsetHeight:g}))})}},n.setChildNode=function(i){n.childNode=i},n}return Object(O.a)(s,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var i=this.props.disabled;if(i){this.destroyObserver();return}var t=Object(U.a)(this.childNode||this),v=t!==this.currentElement;v&&(this.destroyObserver(),this.currentElement=t),!this.resizeObserver&&t&&(this.resizeObserver=new h.default(this.onResize),this.resizeObserver.observe(t))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var i=this.props.children,t=Object(e.a)(i);if(t.length>1)Object(S.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(t.length===0)return Object(S.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var v=t[0];if(R.isValidElement(v)&&Object(d.c)(v)){var f=v.ref;t[0]=R.cloneElement(v,{ref:Object(d.a)(f,this.setChildNode)})}return t.length===1?t[0]:t.map(function(p,E){return!R.isValidElement(p)||"key"in p&&p.key!==null?p:R.cloneElement(p,{key:"".concat(o,"-").concat(E)})})}}]),s}(R.Component);a.displayName="ResizeObserver",ye.a=a},t9D7:function(Ye,ye,$){"use strict";$.d(ye,"b",function(){return H}),$.d(ye,"g",function(){return e}),$.d(ye,"d",function(){return S}),$.d(ye,"e",function(){return d}),$.d(ye,"a",function(){return h}),$.d(ye,"f",function(){return r}),$.d(ye,"c",function(){return l});var ae=$("Vhoy"),B=$("MI8n"),O=$("pmY6"),k=$("Cg/j"),w=$("ic2d"),R=$("nEHx");const H=Object(k.c)("themeService");var U;(function(s){function n(i){return i&&typeof i=="object"&&typeof i.id=="string"}s.isThemeColor=n})(U||(U={}));function e(s){return{id:s}}var S;(function(s){function n(E){return E&&typeof E=="object"&&typeof E.id=="string"&&(typeof E.color=="undefined"||U.isThemeColor(E.color))}s.isThemeIcon=n;const i=new RegExp(`^\\$\\((${ae.a.iconNameExpression}(?:${ae.a.iconModifierExpression})?)\\)$`);function t(E){const b=i.exec(E);if(!b)return;let[,g]=b;return{id:g}}s.fromString=t;function v(E,b){let g=E.id;const c=g.lastIndexOf("~");return c!==-1&&(g=g.substring(0,c)),b&&(g=`${g}~${b}`),{id:g}}s.modify=v;function f(E,b){var g,c;return E.id===b.id&&((g=E.color)===null||g===void 0?void 0:g.id)===((c=b.color)===null||c===void 0?void 0:c.id)}s.isEqual=f;function p(E,b){return{id:E.id,color:b?e(b):void 0}}s.asThemeIcon=p,s.asClassNameArray=ae.a.asClassNameArray,s.asClassName=ae.a.asClassName,s.asCSSSelector=ae.a.asCSSSelector})(S||(S={}));function d(s){switch(s){case R.a.DARK:return"vs-dark";case R.a.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const h={ThemingContribution:"base.contributions.theming"};class o{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new B.b}onColorThemeChange(s){return this.themingParticipants.push(s),this.onThemingParticipantAddedEmitter.fire(s),Object(O.i)(()=>{const n=this.themingParticipants.indexOf(s);this.themingParticipants.splice(n,1)})}getThemingParticipants(){return this.themingParticipants}}let a=new o;w.a.add(h.ThemingContribution,a);function r(s){return a.onColorThemeChange(s)}class l extends O.a{constructor(s){super();this.themeService=s,this.theme=s.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(n=>this.onThemeChange(n)))}onThemeChange(s){this.theme=s,this.updateStyles()}updateStyles(){}}},ulZh:function(Ye,ye,$){typeof window!="undefined"&&function(B,O){Ye.exports=O()}(this,function(){return function(ae){var B={};function O(k){if(B[k])return B[k].exports;var w=B[k]={i:k,l:!1,exports:{}};return ae[k].call(w.exports,w,w.exports,O),w.l=!0,w.exports}return O.m=ae,O.c=B,O.d=function(k,w,R){O.o(k,w)||Object.defineProperty(k,w,{enumerable:!0,get:R})},O.r=function(k){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(k,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(k,"__esModule",{value:!0})},O.t=function(k,w){if(w&1&&(k=O(k)),w&8)return k;if(w&4&&typeof k=="object"&&k&&k.__esModule)return k;var R=Object.create(null);if(O.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:k}),w&2&&typeof k!="string")for(var H in k)O.d(R,H,function(U){return k[U]}.bind(null,H));return R},O.n=function(k){var w=k&&k.__esModule?function(){return k.default}:function(){return k};return O.d(w,"a",w),w},O.o=function(k,w){return Object.prototype.hasOwnProperty.call(k,w)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ae,B,O){"use strict";var k=Object.prototype.hasOwnProperty,w="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(w=!1));function H(d,h,o){this.fn=d,this.context=h,this.once=o||!1}function U(d,h,o,a,r){if(typeof o!="function")throw new TypeError("The listener must be a function");var l=new H(o,a||d,r),s=w?w+h:h;return d._events[s]?d._events[s].fn?d._events[s]=[d._events[s],l]:d._events[s].push(l):(d._events[s]=l,d._eventsCount++),d}function e(d,h){--d._eventsCount===0?d._events=new R:delete d._events[h]}function S(){this._events=new R,this._eventsCount=0}S.prototype.eventNames=function(){var h=[],o,a;if(this._eventsCount===0)return h;for(a in o=this._events)k.call(o,a)&&h.push(w?a.slice(1):a);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(o)):h},S.prototype.listeners=function(h){var o=w?w+h:h,a=this._events[o];if(!a)return[];if(a.fn)return[a.fn];for(var r=0,l=a.length,s=new Array(l);r<l;r++)s[r]=a[r].fn;return s},S.prototype.listenerCount=function(h){var o=w?w+h:h,a=this._events[o];return a?a.fn?1:a.length:0},S.prototype.emit=function(h,o,a,r,l,s){var n=w?w+h:h;if(!this._events[n])return!1;var i=this._events[n],t=arguments.length,v,f;if(i.fn){i.once&&this.removeListener(h,i.fn,void 0,!0);switch(t){case 1:return i.fn.call(i.context),!0;case 2:return i.fn.call(i.context,o),!0;case 3:return i.fn.call(i.context,o,a),!0;case 4:return i.fn.call(i.context,o,a,r),!0;case 5:return i.fn.call(i.context,o,a,r,l),!0;case 6:return i.fn.call(i.context,o,a,r,l,s),!0}for(f=1,v=new Array(t-1);f<t;f++)v[f-1]=arguments[f];i.fn.apply(i.context,v)}else{var p=i.length,E;for(f=0;f<p;f++){i[f].once&&this.removeListener(h,i[f].fn,void 0,!0);switch(t){case 1:i[f].fn.call(i[f].context);break;case 2:i[f].fn.call(i[f].context,o);break;case 3:i[f].fn.call(i[f].context,o,a);break;case 4:i[f].fn.call(i[f].context,o,a,r);break;default:if(!v)for(E=1,v=new Array(t-1);E<t;E++)v[E-1]=arguments[E];i[f].fn.apply(i[f].context,v)}}}return!0},S.prototype.on=function(h,o,a){return U(this,h,o,a,!1)},S.prototype.once=function(h,o,a){return U(this,h,o,a,!0)},S.prototype.removeListener=function(h,o,a,r){var l=w?w+h:h;if(!this._events[l])return this;if(!o)return e(this,l),this;var s=this._events[l];if(s.fn)s.fn===o&&(!r||s.once)&&(!a||s.context===a)&&e(this,l);else{for(var n=0,i=[],t=s.length;n<t;n++)(s[n].fn!==o||r&&!s[n].once||a&&s[n].context!==a)&&i.push(s[n]);i.length?this._events[l]=i.length===1?i[0]:i:e(this,l)}return this},S.prototype.removeAllListeners=function(h){var o;return h?(o=w?w+h:h,this._events[o]&&e(this,o)):(this._events=new R,this._eventsCount=0),this},S.prototype.off=S.prototype.removeListener,S.prototype.addListener=S.prototype.on,S.prefixed=w,S.EventEmitter=S,ae.exports=S},"./node_modules/url-toolkit/src/url-toolkit.js":function(ae,B,O){(function(k){var w=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,H=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,e={buildAbsoluteURL:function(S,d,h){if(h=h||{},S=S.trim(),d=d.trim(),!d){if(!h.alwaysNormalize)return S;var o=e.parseURL(S);if(!o)throw new Error("Error trying to parse base URL.");return o.path=e.normalizePath(o.path),e.buildURLFromParts(o)}var a=e.parseURL(d);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return h.alwaysNormalize?(a.path=e.normalizePath(a.path),e.buildURLFromParts(a)):d;var r=e.parseURL(S);if(!r)throw new Error("Error trying to parse base URL.");if(!r.netLoc&&r.path&&r.path[0]!=="/"){var l=R.exec(r.path);r.netLoc=l[1],r.path=l[2]}r.netLoc&&!r.path&&(r.path="/");var s={scheme:r.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(s.netLoc=r.netLoc,a.path[0]!=="/"))if(!a.path)s.path=r.path,a.params||(s.params=r.params,a.query||(s.query=r.query));else{var n=r.path,i=n.substring(0,n.lastIndexOf("/")+1)+a.path;s.path=e.normalizePath(i)}return s.path===null&&(s.path=h.alwaysNormalize?e.normalizePath(a.path):a.path),e.buildURLFromParts(s)},parseURL:function(S){var d=w.exec(S);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(S){for(S=S.split("").reverse().join("").replace(H,"");S.length!==(S=S.replace(U,"")).length;);return S.split("").reverse().join("")},buildURLFromParts:function(S){return S.scheme+S.netLoc+S.path+S.params+S.query+S.fragment}};ae.exports=e})(this)},"./node_modules/webworkify-webpack/index.js":function(ae,B,O){function k(h){var o={};function a(l){if(o[l])return o[l].exports;var s=o[l]={i:l,l:!1,exports:{}};return h[l].call(s.exports,s,s.exports,a),s.l=!0,s.exports}a.m=h,a.c=o,a.i=function(l){return l},a.d=function(l,s,n){a.o(l,s)||Object.defineProperty(l,s,{configurable:!1,enumerable:!0,get:n})},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 r=a(a.s=ENTRY_MODULE);return r.default||r}var w="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+w+").*?\\)";function H(h){return(h+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(h){return!isNaN(1*h)}function e(h,o,a){var r={};r[a]=[];var l=o.toString(),s=l.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return r;for(var n=s[1],i=new RegExp("(\\\\n|\\W)"+H(n)+R,"g"),t;t=i.exec(l);){if(t[3]==="dll-reference")continue;r[a].push(t[3])}for(i=new RegExp("\\("+H(n)+'\\("(dll-reference\\s('+w+'))"\\)\\)'+R,"g");t=i.exec(l);)h[t[2]]||(r[a].push(t[1]),h[t[2]]=O(t[1]).m),r[t[2]]=r[t[2]]||[],r[t[2]].push(t[4]);for(var v=Object.keys(r),f=0;f<v.length;f++)for(var p=0;p<r[v[f]].length;p++)U(r[v[f]][p])&&(r[v[f]][p]=1*r[v[f]][p]);return r}function S(h){var o=Object.keys(h);return o.reduce(function(a,r){return a||h[r].length>0},!1)}function d(h,o){for(var a={main:[o]},r={main:[]},l={main:{}};S(a);)for(var s=Object.keys(a),n=0;n<s.length;n++){var i=s[n],t=a[i],v=t.pop();if(l[i]=l[i]||{},l[i][v]||!h[i][v])continue;l[i][v]=!0,r[i]=r[i]||[],r[i].push(v);for(var f=e(h,h[i][v],i),p=Object.keys(f),E=0;E<p.length;E++)a[p[E]]=a[p[E]]||[],a[p[E]]=a[p[E]].concat(f[p[E]])}return r}ae.exports=function(h,o){o=o||{};var a={main:O.m},r=o.all?{main:Object.keys(a.main)}:d(a,h),l="";Object.keys(r).filter(function(v){return v!=="main"}).forEach(function(v){for(var f=0;r[v][f];)f++;r[v].push(f),a[v][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",l=l+"var "+v+" = ("+k.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+r[v].map(function(p){return""+JSON.stringify(p)+": "+a[v][p].toString()}).join(",")+`});
|
|
`}),l=l+"new (("+k.toString().replace("ENTRY_MODULE",JSON.stringify(h))+")({"+r.main.map(function(v){return""+JSON.stringify(v)+": "+a.main[v].toString()}).join(",")+"}))(self);";var s=new window.Blob([l],{type:"text/javascript"});if(o.bare)return s;var n=window.URL||window.webkitURL||window.mozURL||window.msURL,i=n.createObjectURL(s),t=new window.Worker(i);return t.objectURL=i,t}},"./src/config.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"hlsDefaultConfig",function(){return E}),O.d(B,"mergeConfig",function(){return g}),O.d(B,"enableStreamingMode",function(){return c});var k=O("./src/controller/abr-controller.ts"),w=O("./src/controller/audio-stream-controller.ts"),R=O("./src/controller/audio-track-controller.ts"),H=O("./src/controller/subtitle-stream-controller.ts"),U=O("./src/controller/subtitle-track-controller.ts"),e=O("./src/controller/buffer-controller.ts"),S=O("./src/controller/timeline-controller.ts"),d=O("./src/controller/cap-level-controller.ts"),h=O("./src/controller/fps-controller.ts"),o=O("./src/controller/eme-controller.ts"),a=O("./src/controller/cmcd-controller.ts"),r=O("./src/utils/xhr-loader.ts"),l=O("./src/utils/fetch-loader.ts"),s=O("./src/utils/cues.ts"),n=O("./src/utils/mediakeys-helper.ts"),i=O("./src/utils/logger.ts");function t(){return t=Object.assign||function(m){for(var u=1;u<arguments.length;u++){var _=arguments[u];for(var y in _)Object.prototype.hasOwnProperty.call(_,y)&&(m[y]=_[y])}return m},t.apply(this,arguments)}function v(m,u){var _=Object.keys(m);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(m);u&&(y=y.filter(function(T){return Object.getOwnPropertyDescriptor(m,T).enumerable})),_.push.apply(_,y)}return _}function f(m){for(var u=1;u<arguments.length;u++){var _=arguments[u]!=null?arguments[u]:{};u%2?v(Object(_),!0).forEach(function(y){p(m,y,_[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(_)):v(Object(_)).forEach(function(y){Object.defineProperty(m,y,Object.getOwnPropertyDescriptor(_,y))})}return m}function p(m,u,_){return u in m?Object.defineProperty(m,u,{value:_,enumerable:!0,configurable:!0,writable:!0}):m[u]=_,m}var E=f(f({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:r.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:k.default,bufferController:e.default,capLevelController:d.default,fpsController:h.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:n.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:H.SubtitleStreamController,subtitleTrackController:U.default,timelineController:S.TimelineController,audioStreamController:w.default,audioTrackController:R.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 g(m,u){if((u.liveSyncDurationCount||u.liveMaxLatencyDurationCount)&&(u.liveSyncDuration||u.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(u.liveMaxLatencyDurationCount!==void 0&&(u.liveSyncDurationCount===void 0||u.liveMaxLatencyDurationCount<=u.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(u.liveMaxLatencyDuration!==void 0&&(u.liveSyncDuration===void 0||u.liveMaxLatencyDuration<=u.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return t({},m,u)}function c(m){var u=m.loader;if(u!==l.default&&u!==r.default)i.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),m.progressive=!1;else{var _=Object(l.fetchSupported)();_&&(m.loader=l.default,m.progressive=!0,m.enableSoftwareAES=!0,i.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/polyfills/number.ts"),w=O("./src/utils/ewma-bandwidth-estimator.ts"),R=O("./src/events.ts"),H=O("./src/utils/buffer-helper.ts"),U=O("./src/errors.ts"),e=O("./src/types/loader.ts"),S=O("./src/utils/logger.ts");function d(a,r){for(var l=0;l<r.length;l++){var s=r[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(a,s.key,s)}}function h(a,r,l){return r&&d(a.prototype,r),l&&d(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 w.default(s.abrEwmaSlowVoD,s.abrEwmaFastVoD,s.abrEwmaDefaultEstimate),this.registerListeners()}var r=a.prototype;return r.registerListeners=function(){var s=this.hls;s.on(R.Events.FRAG_LOADING,this.onFragLoading,this),s.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(R.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var s=this.hls;s.off(R.Events.FRAG_LOADING,this.onFragLoading,this),s.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(R.Events.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},r.onFragLoading=function(s,n){var i=n.frag;if(i.type===e.PlaylistLevelType.MAIN&&!this.timer){var t;this.fragCurrent=i,this.partCurrent=(t=n.part)!=null?t:null,this.timer=self.setInterval(this.onCheck,100)}},r.onLevelLoaded=function(s,n){var i=this.hls.config;n.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},r._abandonRulesCheck=function(){var s=this.fragCurrent,n=this.partCurrent,i=this.hls,t=i.autoLevelEnabled,v=i.config,f=i.media;if(!s||!f)return;var p=n?n.stats:s.stats,E=n?n.duration:s.duration;if(p.aborted){S.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!t||f.paused||!f.playbackRate||!f.readyState)return;var b=performance.now()-p.loading.start,g=Math.abs(f.playbackRate);if(b<=500*E/g)return;var c=i.levels,m=i.minAutoLevel,u=c[s.level],_=p.total||Math.max(p.loaded,Math.round(E*u.maxBitrate/8)),y=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/b),T=(_-p.loaded)/y,M=f.currentTime,L=(H.BufferHelper.bufferInfo(f,M,v.maxBufferHole).end-M)/g;if(L>=2*E/g||T<=L)return;var x=Number.POSITIVE_INFINITY,D;for(D=s.level-1;D>m;D--){var j=c[D].maxBitrate;if(x=E*j/(8*.8*y),x<L)break}if(x>=T)return;var I=this.bwEstimator.getEstimate();S.logger.warn("Fragment "+s.sn+(n?" part "+n.index:"")+" of level "+s.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+D+`
|
|
Current BW estimate: `+(Object(k.isFiniteNumber)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+T.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+x.toFixed(3)+` s
|
|
Time to underbuffer: `+L.toFixed(3)+" s"),i.nextLoadLevel=D,this.bwEstimator.sample(b,p.loaded),this.clearTimer(),s.loader&&(this.fragCurrent=this.partCurrent=null,s.loader.abort()),i.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:n,stats:p})},r.onFragLoaded=function(s,n){var i=n.frag,t=n.part;if(i.type===e.PlaylistLevelType.MAIN&&Object(k.isFiniteNumber)(i.sn)){var v=t?t.stats:i.stats,f=t?t.duration:i.duration;if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[i.level],E=(p.loaded?p.loaded.bytes:0)+v.loaded,b=(p.loaded?p.loaded.duration:0)+f;p.loaded={bytes:E,duration:b},p.realBitrate=Math.round(8*E/b)}if(i.bitrateTest){var g={stats:v,frag:i,part:t,id:i.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,g),i.bitrateTest=!1}}},r.onFragBuffered=function(s,n){var i=n.frag,t=n.part,v=t?t.stats:i.stats;if(v.aborted)return;if(i.type!==e.PlaylistLevelType.MAIN||i.sn==="initSegment")return;var f=v.parsing.end-v.loading.start;this.bwEstimator.sample(f,v.loaded),v.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},r.onError=function(s,n){switch(n.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},r.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},r.getNextABRAutoLevel=function(){var s=this.fragCurrent,n=this.partCurrent,i=this.hls,t=i.maxAutoLevel,v=i.config,f=i.minAutoLevel,p=i.media,E=n?n.duration:s?s.duration:0,b=p?p.currentTime:0,g=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():v.abrEwmaDefaultEstimate,m=(H.BufferHelper.bufferInfo(p,b,v.maxBufferHole).end-b)/g,u=this.findBestLevel(c,f,t,m,v.abrBandWidthFactor,v.abrBandWidthUpFactor);if(u>=0)return u;S.logger.trace((m?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var _=E?Math.min(E,v.maxStarvationDelay):v.maxStarvationDelay,y=v.abrBandWidthFactor,T=v.abrBandWidthUpFactor;if(!m){var M=this.bitrateTestDelay;if(M){var L=E?Math.min(E,v.maxLoadingDelay):v.maxLoadingDelay;_=L-M,S.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*_)+" ms"),y=T=1}}return u=this.findBestLevel(c,f,t,m+_,y,T),Math.max(u,0)},r.findBestLevel=function(s,n,i,t,v,f){for(var p,E=this.fragCurrent,b=this.partCurrent,g=this.lastLoadedFragLevel,c=this.hls.levels,m=c[g],u=!!(m!=null&&(p=m.details)!==null&&p!==void 0&&p.live),_=m==null?void 0:m.codecSet,y=b?b.duration:E?E.duration:0,T=i;T>=n;T--){var M=c[T];if(!M||_&&M.codecSet!==_)continue;var L=M.details,x=(b?L==null?void 0:L.partTarget:L==null?void 0:L.averagetargetduration)||y,D=void 0;T<=g?D=v*s:D=f*s;var j=c[T].maxBitrate,I=j*x/D;if(S.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+T+"/"+Math.round(D)+"/"+j+"/"+x+"/"+t+"/"+I),D>j&&(!I||u&&!this.bitrateTestDelay||I<t))return T}return-1},h(a,[{key:"nextAutoLevel",get:function(){var s=this._nextAutoLevel,n=this.bwEstimator;if(s!==-1&&(!n||!n.canEstimate()))return s;var i=this.getNextABRAutoLevel();return s!==-1&&(i=Math.min(s,i)),i},set:function(s){this._nextAutoLevel=s}}]),a}();B.default=o},"./src/controller/audio-stream-controller.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/polyfills/number.ts"),w=O("./src/controller/base-stream-controller.ts"),R=O("./src/events.ts"),H=O("./src/utils/buffer-helper.ts"),U=O("./src/controller/fragment-tracker.ts"),e=O("./src/types/level.ts"),S=O("./src/types/loader.ts"),d=O("./src/loader/fragment.ts"),h=O("./src/demux/chunk-cache.ts"),o=O("./src/demux/transmuxer-interface.ts"),a=O("./src/types/transmuxer.ts"),r=O("./src/controller/fragment-finders.ts"),l=O("./src/utils/discontinuities.ts"),s=O("./src/errors.ts"),n=O("./src/utils/logger.ts");function i(){return i=Object.assign||function(E){for(var b=1;b<arguments.length;b++){var g=arguments[b];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(E[c]=g[c])}return E},i.apply(this,arguments)}function t(E,b){E.prototype=Object.create(b.prototype),E.prototype.constructor=E,v(E,b)}function v(E,b){return v=Object.setPrototypeOf||function(c,m){return c.__proto__=m,c},v(E,b)}var f=100,p=function(E){t(b,E);function b(c,m){var u;return u=E.call(this,c,m,"[audio-stream-controller]")||this,u.videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u._registerListeners(),u}var g=b.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var m=this.hls;m.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),m.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),m.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),m.on(R.Events.ERROR,this.onError,this),m.on(R.Events.BUFFER_RESET,this.onBufferReset,this),m.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),m.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),m.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),m.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var m=this.hls;m.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),m.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),m.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),m.off(R.Events.ERROR,this.onError,this),m.off(R.Events.BUFFER_RESET,this.onBufferReset,this),m.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),m.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),m.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),m.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onInitPtsFound=function(m,u){var _=u.frag,y=u.id,T=u.initPTS;if(y==="main"){var M=_.cc;this.initPTS[_.cc]=T,this.log("InitPTS for cc: "+M+" found from main: "+T),this.videoTrackCC=M,this.state===w.State.WAITING_INIT_PTS&&this.tick()}},g.startLoad=function(m){if(!this.levels){this.startPosition=m,this.state=w.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,u>0&&m===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=w.State.IDLE):(this.loadedmetadata=!1,this.state=w.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=m,this.tick()},g.doTick=function(){switch(this.state){case w.State.IDLE:this.doTickIdle();break;case w.State.WAITING_TRACK:{var m,u=this.levels,_=this.trackId,y=u==null||((m=u[_])===null||m===void 0)?void 0:m.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=w.State.WAITING_INIT_PTS}break}case w.State.FRAG_LOADING_WAITING_RETRY:{var T,M=performance.now(),L=this.retryDate;(!L||M>=L||(T=this.media)!==null&&T!==void 0&&T.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=w.State.IDLE);break}case w.State.WAITING_INIT_PTS:{var x=this.waitingData;if(x){var D=x.frag,j=x.part,I=x.cache,W=x.complete;if(this.initPTS[D.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=w.State.FRAG_LOADING;var Q=I.flush(),fe={frag:D,part:j,payload:Q,networkDetails:null};this._handleFragmentLoadProgress(fe),W&&E.prototype._handleFragmentLoadComplete.call(this,fe)}else if(this.videoTrackCC!==this.waitingVideoCC)n.logger.log("Waiting fragment cc ("+D.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var de=this.getLoadPosition(),Oe=H.BufferHelper.bufferInfo(this.mediaBuffer,de,this.config.maxBufferHole),Se=Object(r.fragmentWithinToleranceTest)(Oe.end,this.config.maxFragLookUpTolerance,D);Se<0&&(n.logger.log("Waiting fragment cc ("+D.cc+") @ "+D.start+" cancelled because another fragment at "+Oe.end+" is needed"),this.clearWaitingFragment())}}else this.state=w.State.IDLE}}this.onTickEnd()},g.clearWaitingFragment=function(){var m=this.waitingData;m&&(this.fragmentTracker.removeFragment(m.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=w.State.IDLE)},g.onTickEnd=function(){var m=this.media;if(!m||!m.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:m,_=u.buffered;!this.loadedmetadata&&_.length&&(this.loadedmetadata=!0),this.lastCurrentTime=m.currentTime},g.doTickIdle=function(){var m,u,_=this.hls,y=this.levels,T=this.media,M=this.trackId,L=_.config;if(!y||!y[M])return;if(!T&&(this.startFragRequested||!L.startFragPrefetch))return;var x=y[M],D=x.details;if(!D||D.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(D)){this.state=w.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,d.ElementaryStreamTypes.AUDIO,S.PlaylistLevelType.AUDIO));var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,S.PlaylistLevelType.AUDIO);if(j===null)return;var I=j.len,W=this.getMaxBufferLength(),Q=this.audioSwitch;if(I>=W&&!Q)return;if(!Q&&this._streamEnded(j,D)){_.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=w.State.ENDED;return}var fe=D.fragments,de=fe[0].start,Oe=j.end;if(Q){var Se=this.getLoadPosition();Oe=Se,D.PTSKnown&&Se<de&&((j.end>de||j.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),T.currentTime=de+.05))}var Ie=this.getNextFragment(Oe,D);if(!Ie){this.bufferFlushed=!0;return}((m=Ie.decryptdata)===null||m===void 0?void 0:m.keyFormat)==="identity"&&!((u=Ie.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(Ie,D):this.loadFragment(Ie,D,Oe)},g.getMaxBufferLength=function(){var m=E.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,S.PlaylistLevelType.MAIN);return u===null?m:Math.max(m,u.len)},g.onMediaDetaching=function(){this.videoBuffer=null,E.prototype.onMediaDetaching.call(this)},g.onAudioTracksUpdated=function(m,u){var _=u.audioTracks;this.resetTransmuxer(),this.levels=_.map(function(y){return new e.Level(y)})},g.onAudioTrackSwitching=function(m,u){var _=!!u.url;this.trackId=u.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),_?this.setInterval(f):this.resetTransmuxer(),_?(this.audioSwitch=!0,this.state=w.State.IDLE):this.state=w.State.STOPPED,this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},g.onLevelLoaded=function(m,u){this.mainDetails=u.details},g.onAudioTrackLoaded=function(m,u){var _,y=this.levels,T=u.details,M=u.id;if(!y){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+T.startSN+","+T.endSN+"],duration:"+T.totalduration);var L=y[M],x=0;if(T.live||(_=L.details)!==null&&_!==void 0&&_.live){var D=this.mainDetails;if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed||!D)return;!L.details&&T.hasProgramDateTime&&D.hasProgramDateTime?(Object(l.alignMediaPlaylistByPDT)(T,D),x=T.fragments[0].start):x=this.alignPlaylists(T,L.details)}L.details=T,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!T.live)&&this.setStartPosition(L.details,x),this.state===w.State.WAITING_TRACK&&!this.waitForCdnTuneIn(T)&&(this.state=w.State.IDLE),this.tick()},g._handleFragmentLoadProgress=function(m){var u,_=m.frag,y=m.part,T=m.payload,M=this.config,L=this.trackId,x=this.levels;if(!x){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+_.sn+" of level "+_.level+" will not be buffered");return}var D=x[L];console.assert(D,"Audio track is defined on fragment load progress");var j=D.details;console.assert(j,"Audio track details are defined on fragment load progress");var I=M.defaultAudioCodec||D.audioCodec||"mp4a.40.2",W=this.transmuxer;W||(W=this.transmuxer=new o.default(this.hls,S.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Q=this.initPTS[_.cc],fe=(u=_.initSegment)===null||u===void 0?void 0:u.data;if(Q!==void 0){var de=!1,Oe=y?y.index:-1,Se=Oe!==-1,Ie=new a.ChunkMetadata(_.level,_.sn,_.stats.chunkCount,T.byteLength,Oe,Se);W.push(T,fe,I,"",_,y,j.totalduration,de,Ie,Q)}else{n.logger.log("Unknown video PTS for cc "+_.cc+", waiting for video PTS before demuxing audio frag "+_.sn+" of ["+j.startSN+" ,"+j.endSN+"],track "+L);var Le=this.waitingData=this.waitingData||{frag:_,part:y,cache:new h.default,complete:!1},Ne=Le.cache;Ne.push(new Uint8Array(T)),this.waitingVideoCC=this.videoTrackCC,this.state=w.State.WAITING_INIT_PTS}},g._handleFragmentLoadComplete=function(m){if(this.waitingData){this.waitingData.complete=!0;return}E.prototype._handleFragmentLoadComplete.call(this,m)},g.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},g.onBufferCreated=function(m,u){var _=u.tracks.audio;_&&(this.mediaBuffer=_.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},g.onFragBuffered=function(m,u){var _=u.frag,y=u.part;if(_.type!==S.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(_)){this.warn("Fragment "+_.sn+(y?" p: "+y.index:"")+" of level "+_.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}_.sn!=="initSegment"&&(this.fragPrevious=_,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(_,y)},g.onError=function(m,u){switch(u.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.AUDIO,u);break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==w.State.ERROR&&this.state!==w.State.STOPPED&&(this.state=u.fatal?w.State.ERROR:w.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="audio"&&(this.state===w.State.PARSING||this.state===w.State.PARSED)){var _=!0,y=this.getFwdBufferInfo(this.mediaBuffer,S.PlaylistLevelType.AUDIO);y&&y.len>.5&&(_=!this.reduceMaxBufferLength(y.len)),_&&(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}},g.onBufferFlushed=function(m,u){var _=u.type;_===d.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},g._handleTransmuxComplete=function(m){var u,_="audio",y=this.hls,T=m.remuxResult,M=m.chunkMeta,L=this.getCurrentContext(M);if(!L){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var x=L.frag,D=L.part,j=T.audio,I=T.text,W=T.id3,Q=T.initSegment;if(this.fragContextChanged(x))return;if(this.state=w.State.PARSING,this.audioSwitch&&j&&this.completeAudioSwitch(),Q!=null&&Q.tracks&&(this._bufferInitSegment(Q.tracks,x,M),y.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:x,id:_,tracks:Q.tracks})),j){var fe=j.startPTS,de=j.endPTS,Oe=j.startDTS,Se=j.endDTS;D&&(D.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:fe,endPTS:de,startDTS:Oe,endDTS:Se}),x.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,fe,de,Oe,Se),this.bufferFragmentData(j,x,D,M)}if(W!=null&&(u=W.samples)!==null&&u!==void 0&&u.length){var Ie=i({frag:x,id:_},W);y.trigger(R.Events.FRAG_PARSING_METADATA,Ie)}if(I){var Le=i({frag:x,id:_},I);y.trigger(R.Events.FRAG_PARSING_USERDATA,Le)}},g._bufferInitSegment=function(m,u,_){if(this.state!==w.State.PARSING)return;m.video&&delete m.video;var y=m.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,m);var T=y.initSegment;if(T!=null&&T.byteLength){var M={type:"audio",frag:u,part:null,chunkMeta:_,parent:u.type,data:T};this.hls.trigger(R.Events.BUFFER_APPENDING,M)}this.tick()},g.loadFragment=function(m,u,_){var y=this.fragmentTracker.getState(m);this.fragCurrent=m,(this.audioSwitch||y===U.FragmentState.NOT_LOADED||y===U.FragmentState.PARTIAL)&&(m.sn==="initSegment"?this._loadInitSegment(m):u.live&&!Object(k.isFiniteNumber)(this.initPTS[m.cc])?(this.log("Waiting for video PTS in continuity counter "+m.cc+" of live stream before loading audio fragment "+m.sn+" of level "+this.trackId),this.state=w.State.WAITING_INIT_PTS):(this.startFragRequested=!0,E.prototype.loadFragment.call(this,m,u,_)))},g.completeAudioSwitch=function(){var m=this.hls,u=this.media,_=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),E.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,m.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:_})},b}(w.default);B.default=p},"./src/controller/audio-track-controller.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/events.ts"),w=O("./src/errors.ts"),R=O("./src/controller/base-playlist-controller.ts"),H=O("./src/types/loader.ts");function U(o,a){for(var r=0;r<a.length;r++){var l=a[r];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(o,l.key,l)}}function e(o,a,r){return a&&U(o.prototype,a),r&&U(o,r),o}function S(o,a){o.prototype=Object.create(a.prototype),o.prototype.constructor=o,d(o,a)}function d(o,a){return d=Object.setPrototypeOf||function(l,s){return l.__proto__=s,l},d(o,a)}var h=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 r=a.prototype;return r.registerListeners=function(){var s=this.hls;s.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(k.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var s=this.hls;s.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(k.Events.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,o.prototype.destroy.call(this)},r.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},r.onManifestParsed=function(s,n){this.tracks=n.audioTracks||[]},r.onAudioTrackLoaded=function(s,n){var i=n.id,t=n.details,v=this.tracksInGroup[i];if(!v){this.warn("Invalid audio track id "+i);return}var f=v.details;v.details=n.details,this.log("audioTrack "+i+" loaded ["+t.startSN+"-"+t.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,n,f))},r.onLevelLoading=function(s,n){this.switchLevel(n.level)},r.onLevelSwitching=function(s,n){this.switchLevel(n.level)},r.switchLevel=function(s){var n=this.hls.levels[s];if(!(n!=null&&n.audioGroupIds))return;var i=n.audioGroupIds[n.urlId];if(this.groupId!==i){this.groupId=i;var t=this.tracks.filter(function(f){return!i||f.groupId===i});this.selectDefaultTrack&&!t.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=t;var v={audioTracks:t};this.log("Updating audio tracks, "+t.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger(k.Events.AUDIO_TRACKS_UPDATED,v),this.selectInitialTrack()}},r.onError=function(s,n){if(o.prototype.onError.call(this,s,n),n.fatal||!n.context)return;n.context.type===H.PlaylistContextType.AUDIO_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},r.setAudioTrack=function(s){var n=this.tracksInGroup;if(s<0||s>=n.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var i=n[this.trackId];this.log("Now switching to audio-track index "+s);var t=n[s],v=t.id,f=t.groupId,p=f===void 0?"":f,E=t.name,b=t.type,g=t.url;if(this.trackId=s,this.trackName=E,this.selectDefaultTrack=!1,this.hls.trigger(k.Events.AUDIO_TRACK_SWITCHING,{id:v,groupId:p,name:E,type:b,url:g}),t.details&&!t.details.live)return;var c=this.switchParams(t.url,i==null?void 0:i.details);this.loadPlaylist(c)},r.selectInitialTrack=function(){var s=this.tracksInGroup;console.assert(s.length,"Initial audio track should be selected when tracks are known");var n=this.trackName,i=this.findTrackId(n)||this.findTrackId();i!==-1?this.setAudioTrack(i):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},r.findTrackId=function(s){for(var n=this.tracksInGroup,i=0;i<n.length;i++){var t=n[i];if((!this.selectDefaultTrack||t.default)&&(!s||s===t.name))return t.id}return-1},r.loadPlaylist=function(s){var n=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(n)){var i=n.id,t=n.groupId,v=n.url;if(s)try{v=s.addDirectives(v)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+i),this.clearTimer(),this.hls.trigger(k.Events.AUDIO_TRACK_LOADING,{url:v,id:i,groupId:t,deliveryDirectives:s||null})}},e(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}(R.default);B.default=h},"./src/controller/base-playlist-controller.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return e});var k=O("./src/polyfills/number.ts"),w=O("./src/types/level.ts"),R=O("./src/controller/level-helper.ts"),H=O("./src/utils/logger.ts"),U=O("./src/errors.ts"),e=function(){function S(h,o){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=H.logger.log.bind(H.logger,o+":"),this.warn=H.logger.warn.bind(H.logger,o+":"),this.hls=h}var d=S.prototype;return d.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},d.onError=function(o,a){a.fatal&&a.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},d.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},d.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},d.stopLoad=function(){this.canLoad=!1,this.clearTimer()},d.switchParams=function(o,a){var r=a==null?void 0:a.renditionReports;if(r)for(var l=0;l<r.length;l++){var s=r[l],n=""+s.URI;if(n===o.substr(-n.length)){var i=parseInt(s["LAST-MSN"]),t=parseInt(s["LAST-PART"]);if(a&&this.hls.config.lowLatencyMode){var v=Math.min(a.age-a.partTarget,a.targetduration);t!==void 0&&v>a.partTarget&&(t+=1)}if(Object(k.isFiniteNumber)(i))return new w.HlsUrlParameters(i,Object(k.isFiniteNumber)(t)?t:void 0,w.HlsSkip.No)}}},d.loadPlaylist=function(o){},d.shouldLoadTrack=function(o){return this.canLoad&&o&&!!o.url&&(!o.details||o.details.live)},d.playlistLoaded=function(o,a,r){var l=this,s=a.details,n=a.stats,i=n.loading.end?Math.max(0,self.performance.now()-n.loading.end):0;if(s.advancedDateTime=Date.now()-i,s.live||r!=null&&r.live){if(s.reloaded(r),r&&this.log("live playlist "+o+" "+(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:"MISSED")),r&&s.fragments.length>0&&Object(R.mergeDetails)(r,s),!this.canLoad||!s.live)return;var t,v=void 0,f=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var p=this.hls.config.lowLatencyMode,E=s.lastPartSn,b=s.endSN,g=s.lastPartIndex,c=g!==-1,m=E===b,u=p?0:g;c?(v=m?b+1:E,f=m?u:g+1):v=b+1;var _=s.age,y=_+s.ageHeader,T=Math.min(y-s.partTarget,s.targetduration*1.5);if(T>0){if(r&&T>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+T+" with playlist age: "+s.age),T=0;else{var M=Math.floor(T/s.targetduration);if(v+=M,f!==void 0){var L=Math.round(T%s.targetduration/s.partTarget);f+=L}this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+_.toFixed(2)+"s goal: "+T+" skip sn "+M+" to part "+f)}s.tuneInGoal=T}if(t=this.getDeliveryDirectives(s,a.deliveryDirectives,v,f),p||!m){this.loadPlaylist(t);return}}else t=this.getDeliveryDirectives(s,a.deliveryDirectives,v,f);var x=Object(R.computeReloadInterval)(s,n);v!==void 0&&s.canBlockReload&&(x-=s.partTarget||1),this.log("reload live playlist "+o+" in "+Math.round(x)+" ms"),this.timer=self.setTimeout(function(){return l.loadPlaylist(t)},x)}else this.clearTimer()},d.getDeliveryDirectives=function(o,a,r,l){var s=Object(w.getSkipValue)(o,r);return a!=null&&a.skip&&o.deltaUpdateFailed&&(r=a.msn,l=a.part,s=w.HlsSkip.No),new w.HlsUrlParameters(r,l,s)},d.retryLoadingOrFail=function(o){var a=this,r=this.hls.config,l=this.retryCount<r.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 n=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return a.loadPlaylist()},n),this.warn("retry playlist loading #"+this.retryCount+" in "+n+' 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(ae,B,O){"use strict";O.r(B),O.d(B,"State",function(){return b}),O.d(B,"default",function(){return g});var k=O("./src/polyfills/number.ts"),w=O("./src/task-loop.ts"),R=O("./src/controller/fragment-tracker.ts"),H=O("./src/utils/buffer-helper.ts"),U=O("./src/utils/logger.ts"),e=O("./src/events.ts"),S=O("./src/errors.ts"),d=O("./src/types/transmuxer.ts"),h=O("./src/utils/mp4-tools.ts"),o=O("./src/utils/discontinuities.ts"),a=O("./src/controller/fragment-finders.ts"),r=O("./src/controller/level-helper.ts"),l=O("./src/loader/fragment-loader.ts"),s=O("./src/crypt/decrypter.ts"),n=O("./src/utils/time-ranges.ts"),i=O("./src/types/loader.ts");function t(c,m){for(var u=0;u<m.length;u++){var _=m[u];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(c,_.key,_)}}function v(c,m,u){return m&&t(c.prototype,m),u&&t(c,u),c}function f(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function p(c,m){c.prototype=Object.create(m.prototype),c.prototype.constructor=c,E(c,m)}function E(c,m){return E=Object.setPrototypeOf||function(_,y){return _.__proto__=y,_},E(c,m)}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"},g=function(c){p(m,c);function m(_,y,T){var M;return M=c.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=b.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=T,M.log=U.logger.log.bind(U.logger,T+":"),M.warn=U.logger.warn.bind(U.logger,T+":"),M.hls=_,M.fragmentLoader=new l.default(_.config),M.fragmentTracker=y,M.config=_.config,M.decrypter=new s.default(_,_.config),_.on(e.Events.KEY_LOADED,M.onKeyLoaded,f(M)),M}var u=m.prototype;return u.doTick=function(){this.onTickEnd()},u.onTickEnd=function(){},u.startLoad=function(y){},u.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},u._streamEnded=function(y,T){var M=this.fragCurrent,L=this.fragmentTracker;if(!T.live&&M&&M.sn===T.endSN&&!y.nextStart){var x=L.getState(M);return x===R.FragmentState.PARTIAL||x===R.FragmentState.OK}return!1},u.onMediaAttached=function(y,T){var M=this.media=this.mediaBuffer=T.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var L=this.config;this.levels&&L.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(L.startPosition)},u.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},u.onMediaSeeking=function(){var y=this.config,T=this.fragCurrent,M=this.media,L=this.mediaBuffer,x=this.state,D=M?M.currentTime:0,j=H.BufferHelper.bufferInfo(L||M,D,y.maxBufferHole);if(this.log("media seeking to "+(Object(k.isFiniteNumber)(D)?D.toFixed(3):D)+", state: "+x),x===b.ENDED)this.resetLoadingState();else if(T&&!j.len){var I=y.maxFragLookUpTolerance,W=T.start-I,Q=T.start+T.duration+I,fe=D>Q;(D<W||fe)&&(fe&&T.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),T.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=D),!this.loadedmetadata&&!j.len&&(this.nextLoadPosition=this.startPosition=D),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(y,T){if(this.state!==b.KEY_LOADING||T.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var M=this.levels[T.frag.level].details;M&&this.loadFragment(T.frag,M,T.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},u.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(e.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,c.prototype.onHandlerDestroyed.call(this)},u.loadKey=function(y,T){this.log("Loading key for "+y.sn+" of ["+T.startSN+"-"+T.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=b.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(e.Events.KEY_LOADING,{frag:y})},u.loadFragment=function(y,T,M){this._loadFragForPlayback(y,T,M)},u._loadFragForPlayback=function(y,T,M){var L=this,x=function(j){if(L.fragContextChanged(y)){L.warn("Fragment "+y.sn+(j.part?" p: "+j.part.index:"")+" of level "+y.level+" was dropped during download."),L.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,L._handleFragmentLoadProgress(j)};this._doFragLoad(y,T,M,x).then(function(D){if(!D)return;L.fragLoadError=0;var j=L.state;if(L.fragContextChanged(y)){(j===b.FRAG_LOADING||j===b.BACKTRACKING||!L.fragCurrent&&j===b.PARSING)&&(L.fragmentTracker.removeFragment(y),L.state=b.IDLE);return}if("payload"in D&&(L.log("Loaded fragment "+y.sn+" of level "+y.level),L.hls.trigger(e.Events.FRAG_LOADED,D),L.state===b.BACKTRACKING)){L.fragmentTracker.backtrack(y,D),L.resetFragmentLoading(y);return}L._handleFragmentLoadComplete(D)}).catch(function(D){L.warn(D),L.resetFragmentLoading(y)})},u.flushMainBuffer=function(y,T,M){if(M===void 0&&(M=null),!(y-T))return;var L={startOffset:y,endOffset:T,type:M};this.fragLoadError=0,this.hls.trigger(e.Events.BUFFER_FLUSHING,L)},u._loadInitSegment=function(y){var T=this;this._doFragLoad(y).then(function(M){if(!M||T.fragContextChanged(y)||!T.levels)throw new Error("init load aborted");return M}).then(function(M){var L=T.hls,x=M.payload,D=y.decryptdata;if(x&&x.byteLength>0&&D&&D.key&&D.iv&&D.method==="AES-128"){var j=self.performance.now();return T.decrypter.webCryptoDecrypt(new Uint8Array(x),D.key.buffer,D.iv.buffer).then(function(I){var W=self.performance.now();return L.trigger(e.Events.FRAG_DECRYPTED,{frag:y,payload:I,stats:{tstart:j,tdecrypt:W}}),M.payload=I,M})}return M}).then(function(M){var L=T.fragCurrent,x=T.hls,D=T.levels;if(!D)throw new Error("init load aborted, missing levels");var j=D[y.level].details;console.assert(j,"Level details are defined when init segment is loaded");var I=y.stats;T.state=b.IDLE,T.fragLoadError=0,y.data=new Uint8Array(M.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),M.frag===L&&x.trigger(e.Events.FRAG_BUFFERED,{stats:I,frag:L,part:null,id:y.type}),T.tick()}).catch(function(M){T.warn(M),T.resetFragmentLoading(y)})},u.fragContextChanged=function(y){var T=this.fragCurrent;return!y||!T||y.level!==T.level||y.sn!==T.sn||y.urlId!==T.urlId},u.fragBufferedComplete=function(y,T){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(T?" part: "+T.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+n.default.toString(H.BufferHelper.getBuffered(M))),this.state=b.IDLE,this.tick()},u._handleFragmentLoadComplete=function(y){var T=this.transmuxer;if(!T)return;var M=y.frag,L=y.part,x=y.partsLoaded,D=!x||x.length===0||x.some(function(I){return!I}),j=new d.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,L?L.index:-1,!D);T.flush(j)},u._handleFragmentLoadProgress=function(y){},u._doFragLoad=function(y,T,M,L){var x=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(y.start,M||0),this.config.lowLatencyMode&&T){var D=T.partList;if(D&&L){M>y.end&&T.fragmentHint&&(y=T.fragmentHint);var j=this.getNextPart(D,y,M);if(j>-1){var I=D[j];return this.log("Loading part sn: "+y.sn+" p: "+I.index+" cc: "+y.cc+" of playlist ["+T.startSN+"-"+T.endSN+"] parts [0-"+j+"-"+(D.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=b.FRAG_LOADING,this.hls.trigger(e.Events.FRAG_LOADING,{frag:y,part:D[j],targetBufferTime:M}),this.doFragPartsLoad(y,D,j,L).catch(function(W){return x.handleFragLoadError(W)})}else if(!y.url||this.loadedEndOfParts(D,M))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(T?"of ["+T.startSN+"-"+T.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(M.toFixed(3))),Object(k.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=b.FRAG_LOADING,this.hls.trigger(e.Events.FRAG_LOADING,{frag:y,targetBufferTime:M}),this.fragmentLoader.load(y,L).catch(function(W){return x.handleFragLoadError(W)})},u.doFragPartsLoad=function(y,T,M,L){var x=this;return new Promise(function(D,j){var I=[],W=function Q(fe){var de=T[fe];x.fragmentLoader.loadPart(y,de,L).then(function(Oe){I[de.index]=Oe;var Se=Oe.part;x.hls.trigger(e.Events.FRAG_LOADED,Oe);var Ie=T[fe+1];if(Ie&&Ie.fragment===y)Q(fe+1);else return D({frag:y,part:Se,partsLoaded:I})}).catch(j)};W(M)})},u.handleFragLoadError=function(y){var T=y.data;return T&&T.details===S.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(T.frag,T.part):this.hls.trigger(e.Events.ERROR,T),null},u._handleTransmuxerFlush=function(y){var T=this.getCurrentContext(y);if(!T||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var M=T.frag,L=T.part,x=T.level,D=self.performance.now();M.stats.parsing.end=D,L&&(L.stats.parsing.end=D),this.updateLevelTiming(M,L,x,y.partial)},u.getCurrentContext=function(y){var T=this.levels,M=y.level,L=y.sn,x=y.part;if(!T||!T[M])return this.warn("Levels object was unset while buffering fragment "+L+" of level "+M+". The current chunk will not be buffered."),null;var D=T[M],j=x>-1?Object(r.getPartWith)(D,L,x):null,I=j?j.fragment:Object(r.getFragmentWithSN)(D,L,this.fragCurrent);return I?{frag:I,part:j,level:D}:null},u.bufferFragmentData=function(y,T,M,L){if(!y||this.state!==b.PARSING)return;var x=y.data1,D=y.data2,j=x;if(x&&D&&(j=Object(h.appendUint8Array)(x,D)),!j||!j.length)return;var I={type:y.type,frag:T,part:M,chunkMeta:L,parent:T.type,data:j};this.hls.trigger(e.Events.BUFFER_APPENDING,I),y.dropped&&y.independent&&!M&&this.flushBufferGap(T)},u.flushBufferGap=function(y){var T=this.media;if(!T)return;if(!H.BufferHelper.isBuffered(T,T.currentTime)){this.flushMainBuffer(0,y.start);return}var M=T.currentTime,L=H.BufferHelper.bufferInfo(T,M,0),x=y.duration,D=Math.min(this.config.maxFragLookUpTolerance*2,x*.25),j=Math.max(Math.min(y.start-D,L.end-D),M+D);y.start-j>D&&this.flushMainBuffer(j,y.start)},u.getFwdBufferInfo=function(y,T){var M=this.config,L=this.getLoadPosition();if(!Object(k.isFiniteNumber)(L))return null;var x=H.BufferHelper.bufferInfo(y,L,M.maxBufferHole);if(x.len===0&&x.nextStart!==void 0){var D=this.fragmentTracker.getBufferedFrag(L,T);if(D&&x.nextStart<D.end)return H.BufferHelper.bufferInfo(y,L,Math.max(x.nextStart,M.maxBufferHole))}return x},u.getMaxBufferLength=function(y){var T=this.config,M;return y?M=Math.max(8*T.maxBufferSize/y,T.maxBufferLength):M=T.maxBufferLength,Math.min(M,T.maxMaxBufferLength)},u.reduceMaxBufferLength=function(y){var T=this.config,M=y||T.maxBufferLength;return T.maxMaxBufferLength>=M?(T.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+T.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(y,T){var M,L,x=T.fragments,D=x.length;if(!D)return null;var j=this.config,I=x[0].start,W;if(T.live){var Q=j.initialLiveManifestSize;if(D<Q)return this.warn("Not enough fragments to start playback (have: "+D+", need: "+Q+")"),null;!T.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(W=this.getInitialLiveFragment(T,x),this.startPosition=W?this.hls.liveSyncPosition||W.start:y)}else y<=I&&(W=x[0]);if(!W){var fe=j.lowLatencyMode?T.partEnd:T.fragmentEnd;W=this.getFragmentAtPosition(y,fe,T)}return(M=W)!==null&&M!==void 0&&M.initSegment&&!((L=W)!==null&&L!==void 0&&L.initSegment.data)&&!this.bitrateTest&&(W=W.initSegment),W},u.getNextPart=function(y,T,M){for(var L=-1,x=!1,D=!0,j=0,I=y.length;j<I;j++){var W=y[j];if(D=D&&!W.independent,L>-1&&M<W.start)break;var Q=W.loaded;!Q&&(x||W.independent||D)&&W.fragment===T&&(L=j),x=Q}return L},u.loadedEndOfParts=function(y,T){var M=y[y.length-1];return M&&T>M.start&&M.loaded},u.getInitialLiveFragment=function(y,T){var M=this.fragPrevious,L=null;if(M){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),L=Object(a.findFragmentByPDT)(T,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!L){var x=M.sn+1;if(x>=y.startSN&&x<=y.endSN){var D=T[x-y.startSN];M.cc===D.cc&&(L=D,this.log("Live playlist, switching playlist, load frag with next SN: "+L.sn))}L||(L=Object(a.findFragWithCC)(T,M.cc),L&&this.log("Live playlist, switching playlist, load frag with same CC: "+L.sn))}}else{var j=this.hls.liveSyncPosition;j!==null&&(L=this.getFragmentAtPosition(j,this.bitrateTest?y.fragmentEnd:y.edge,y))}return L},u.getFragmentAtPosition=function(y,T,M){var L=this.config,x=this.fragPrevious,D=M.fragments,j=M.endSN,I=M.fragmentHint,W=L.maxFragLookUpTolerance,Q=!!(L.lowLatencyMode&&M.partList&&I);Q&&I&&!this.bitrateTest&&(D=D.concat(I),j=I.sn);var fe;if(y<T){var de=y>T-W?0:W;fe=Object(a.findFragmentByPTS)(x,D,y,de)}else fe=D[D.length-1];if(fe){var Oe=fe.sn-M.startSN,Se=x&&fe.level===x.level,Ie=D[Oe+1],Le=this.fragmentTracker.getState(fe);if(Le===R.FragmentState.BACKTRACKED){fe=null;for(var Ne=Oe;D[Ne]&&this.fragmentTracker.getState(D[Ne])===R.FragmentState.BACKTRACKED;)x?fe=D[Ne--]:fe=D[--Ne];fe||(fe=Ie)}else x&&fe.sn===x.sn&&!Q&&(Se&&(fe.sn<j&&this.fragmentTracker.getState(Ie)!==R.FragmentState.OK?(this.log("SN "+fe.sn+" just loaded, load next one: "+Ie.sn),fe=Ie):fe=null))}return fe},u.synchronizeToLiveEdge=function(y){var T=this.config,M=this.media;if(!M)return;var L=this.hls.liveSyncPosition,x=M.currentTime,D=y.fragments[0].start,j=y.edge,I=x>=D-T.maxFragLookUpTolerance&&x<=j;if(L!==null&&M.duration>L&&(x<L||!I)){var W=T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:T.liveMaxLatencyDurationCount*y.targetduration;(!I&&M.readyState<4||x<j-W)&&(this.loadedmetadata||(this.nextLoadPosition=L),M.readyState&&(this.warn("Playback: "+x.toFixed(3)+" is located too far from the end of live sliding playlist: "+j+", reset currentTime to : "+L.toFixed(3)),M.currentTime=L))}},u.alignPlaylists=function(y,T){var M=this.levels,L=this.levelLastLoaded,x=this.fragPrevious,D=L!==null?M[L]:null,j=y.fragments.length;if(!j)return this.warn("No fragments in live playlist"),0;var I=y.fragments[0].start,W=!T,Q=y.alignedSliding&&Object(k.isFiniteNumber)(I);if(W||!Q&&!I){Object(o.alignStream)(x,D,y);var fe=y.fragments[0].start;return this.log("Live playlist sliding: "+fe.toFixed(2)+" start-sn: "+(T?T.startSN:"na")+"->"+y.startSN+" prev-sn: "+(x?x.sn:"na")+" fragments: "+j),fe}return I},u.waitForCdnTuneIn=function(y){var T=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*T)},u.setStartPosition=function(y,T){var M=this.startPosition;if(M<T&&(M=-1),M===-1||this.lastCurrentTime===-1){var L=y.startTimeOffset;Object(k.isFiniteNumber)(L)?(M=T+L,L<0&&(M+=y.totalduration),M=Math.min(Math.max(T,M),T+y.totalduration),this.log("Start time offset "+L+" found in playlist, adjust startPosition to "+M),this.startPosition=M):y.live?M=this.hls.liveSyncPosition||T:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},u.getLoadPosition=function(){var y=this.media,T=0;return this.loadedmetadata&&y?T=y.currentTime:this.nextLoadPosition&&(T=this.nextLoadPosition),T},u.handleFragLoadAborted=function(y,T){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(T?" part"+T.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},u.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=b.IDLE)},u.onFragmentOrKeyLoadError=function(y,T){if(T.fatal)return;var M=T.frag;if(!M||M.type!==y)return;var L=this.fragCurrent;console.assert(L&&M.sn===L.sn&&M.level===L.level&&M.urlId===L.urlId,"Frag load error must match current frag to retry");var x=this.config;if(this.fragLoadError+1<=x.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var D=Math.min(Math.pow(2,this.fragLoadError)*x.fragLoadingRetryDelay,x.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+y+" "+M.level+" failed to load, retrying in "+D+"ms"),this.retryDate=self.performance.now()+D,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else T.levelRetry?(y===i.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(U.logger.error(T.details+" reaches max retry, redispatch as fatal ..."),T.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},u.afterBufferFlushed=function(y,T,M){if(!y)return;var L=H.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(T,L,M),this.state===b.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},u.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var T=this.levels?this.levels[y].details:null;if(T!=null&&T.live)return this.startPosition=-1,this.setStartPosition(T,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(y,T,M,L){var x=this,D=M.details;console.assert(!!D,"level.details must be defined");var j=Object.keys(y.elementaryStreams).reduce(function(I,W){var Q=y.elementaryStreams[W];if(Q){var fe=Q.endPTS-Q.startPTS;if(fe<=0)return x.warn("Could not parse fragment "+y.sn+" "+W+" duration reliably ("+fe+") resetting transmuxer to fallback to playlist timing"),x.resetTransmuxer(),I||!1;var de=L?0:Object(r.updateFragPTSDTS)(D,y,Q.startPTS,Q.endPTS,Q.startDTS,Q.endDTS);return x.hls.trigger(e.Events.LEVEL_PTS_UPDATED,{details:D,level:M,drift:de,type:W,frag:y,start:Q.startPTS,end:Q.endPTS}),!0}return I},!1);j?(this.state=b.PARSED,this.hls.trigger(e.Events.FRAG_PARSED,{frag:y,part:T})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},v(m,[{key:"state",get:function(){return this._state},set:function(y){var T=this._state;T!==y&&(this._state=y,this.log(T+"->"+y))}}]),m}(w.default)},"./src/controller/buffer-controller.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return a});var k=O("./src/polyfills/number.ts"),w=O("./src/events.ts"),R=O("./src/utils/logger.ts"),H=O("./src/errors.ts"),U=O("./src/utils/buffer-helper.ts"),e=O("./src/utils/mediasource-helper.ts"),S=O("./src/loader/fragment.ts"),d=O("./src/controller/buffer-operation-queue.ts"),h=Object(e.getMediaSource)(),o=/([ha]vc.)(?:\.[^.,]+)+/,a=function(){function r(s){var n=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 i=n.hls,t=n.media,v=n.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),t&&(n.updateMediaElementDuration(),i.trigger(w.Events.MEDIA_ATTACHED,{media:t})),v&&v.removeEventListener("sourceopen",n._onMediaSourceOpen),n.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=s,this._initSourceBuffer(),this.registerListeners()}var l=r.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 n=this.hls;n.on(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.on(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(w.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(w.Events.BUFFER_RESET,this.onBufferReset,this),n.on(w.Events.BUFFER_APPENDING,this.onBufferAppending,this),n.on(w.Events.BUFFER_CODECS,this.onBufferCodecs,this),n.on(w.Events.BUFFER_EOS,this.onBufferEos,this),n.on(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.on(w.Events.LEVEL_UPDATED,this.onLevelUpdated,this),n.on(w.Events.FRAG_PARSED,this.onFragParsed,this),n.on(w.Events.FRAG_CHANGED,this.onFragChanged,this)},l.unregisterListeners=function(){var n=this.hls;n.off(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(w.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(w.Events.BUFFER_RESET,this.onBufferReset,this),n.off(w.Events.BUFFER_APPENDING,this.onBufferAppending,this),n.off(w.Events.BUFFER_CODECS,this.onBufferCodecs,this),n.off(w.Events.BUFFER_EOS,this.onBufferEos,this),n.off(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.off(w.Events.LEVEL_UPDATED,this.onLevelUpdated,this),n.off(w.Events.FRAG_PARSED,this.onFragParsed,this),n.off(w.Events.FRAG_CHANGED,this.onFragChanged,this)},l._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new d.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},l.onManifestParsed=function(n,i){var t=2;(i.audio&&!i.video||!i.altAudio)&&(t=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=t,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},l.onMediaAttaching=function(n,i){var t=this.media=i.media;if(t&&h){var v=this.mediaSource=new h;v.addEventListener("sourceopen",this._onMediaSourceOpen),v.addEventListener("sourceended",this._onMediaSourceEnded),v.addEventListener("sourceclose",this._onMediaSourceClose),t.src=self.URL.createObjectURL(v),this._objectUrl=t.src}},l.onMediaDetaching=function(){var n=this.media,i=this.mediaSource,t=this._objectUrl;if(i){if(R.logger.log("[buffer-controller]: media source detaching"),i.readyState==="open")try{i.endOfStream()}catch(v){R.logger.warn("[buffer-controller]: onMediaDetaching: "+v.message+" while calling endOfStream")}this.onBufferReset(),i.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("sourceended",this._onMediaSourceEnded),i.removeEventListener("sourceclose",this._onMediaSourceClose),n&&(t&&self.URL.revokeObjectURL(t),n.src===t?(n.removeAttribute("src"),n.load()):R.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(w.Events.MEDIA_DETACHED,void 0)},l.onBufferReset=function(){var n=this;this.getSourceBufferTypes().forEach(function(i){var t=n.sourceBuffer[i];try{t&&(n.removeBufferListeners(i),n.mediaSource&&n.mediaSource.removeSourceBuffer(t),n.sourceBuffer[i]=void 0)}catch(v){R.logger.warn("[buffer-controller]: Failed to reset the "+i+" buffer",v)}}),this._initSourceBuffer()},l.onBufferCodecs=function(n,i){var t=this,v=this.getSourceBufferTypes().length;if(Object.keys(i).forEach(function(f){if(v){var p=t.tracks[f];if(p&&typeof p.buffer.changeType=="function"){var E=i[f],b=E.codec,g=E.levelCodec,c=E.container,m=(p.levelCodec||p.codec).replace(o,"$1"),u=(g||b).replace(o,"$1");if(m!==u){var _=c+";codecs="+(g||b);t.appendChangeType(f,_)}}}else t.pendingTracks[f]=i[f]}),v)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},l.appendChangeType=function(n,i){var t=this,v=this.operationQueue,f={execute:function(){var E=t.sourceBuffer[n];E&&(R.logger.log("[buffer-controller]: changing "+n+" sourceBuffer type to "+i),E.changeType(i)),v.shiftAndExecuteNext(n)},onStart:function(){},onComplete:function(){},onError:function(E){R.logger.warn("[buffer-controller]: Failed to change "+n+" SourceBuffer type",E)}};v.append(f,n)},l.onBufferAppending=function(n,i){var t=this,v=this.hls,f=this.operationQueue,p=this.tracks,E=i.data,b=i.type,g=i.frag,c=i.part,m=i.chunkMeta,u=m.buffering[b],_=self.performance.now();u.start=_;var y=g.stats.buffering,T=c?c.stats.buffering:null;y.start===0&&(y.start=_),T&&T.start===0&&(T.start=_);var M=p.audio,L=b==="audio"&&m.id===1&&(M==null?void 0:M.container)==="audio/mpeg",x={execute:function(){if(u.executeStart=self.performance.now(),L){var j=t.sourceBuffer[b];if(j){var I=g.start-j.timestampOffset;Math.abs(I)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+g.start+" (delta: "+I+") sn: "+g.sn+")"),j.timestampOffset=g.start)}}t.appendExecutor(E,b)},onStart:function(){},onComplete:function(){var j=self.performance.now();u.executeEnd=u.end=j,y.first===0&&(y.first=j),T&&T.first===0&&(T.first=j);var I=t.sourceBuffer,W={};for(var Q in I)W[Q]=U.BufferHelper.getBuffered(I[Q]);t.appendError=0,t.hls.trigger(w.Events.BUFFER_APPENDED,{type:b,frag:g,part:c,chunkMeta:m,parent:g.type,timeRanges:W})},onError:function(j){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",j);var I={type:H.ErrorTypes.MEDIA_ERROR,parent:g.type,details:H.ErrorDetails.BUFFER_APPEND_ERROR,err:j,fatal:!1};j.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=H.ErrorDetails.BUFFER_FULL_ERROR:(t.appendError++,I.details=H.ErrorDetails.BUFFER_APPEND_ERROR,t.appendError>v.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+v.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),v.trigger(w.Events.ERROR,I)}};f.append(x,b)},l.onBufferFlushing=function(n,i){var t=this,v=this.operationQueue,f=function(E){return{execute:t.removeExecutor.bind(t,E,i.startOffset,i.endOffset),onStart:function(){},onComplete:function(){t.hls.trigger(w.Events.BUFFER_FLUSHED,{type:E})},onError:function(g){R.logger.warn("[buffer-controller]: Failed to remove from "+E+" SourceBuffer",g)}}};i.type?v.append(f(i.type),i.type):this.getSourceBufferTypes().forEach(function(p){v.append(f(p),p)})},l.onFragParsed=function(n,i){var t=this,v=i.frag,f=i.part,p=[],E=f?f.elementaryStreams:v.elementaryStreams;E[S.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(E[S.ElementaryStreamTypes.AUDIO]&&p.push("audio"),E[S.ElementaryStreamTypes.VIDEO]&&p.push("video"));var b=function(){var c=self.performance.now();v.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var m=f?f.stats:v.stats;t.hls.trigger(w.Events.FRAG_BUFFERED,{frag:v,part:f,stats:m,id:v.type})};p.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+v.type+" level: "+v.level+" sn: "+v.sn),this.blockBuffers(b,p)},l.onFragChanged=function(n,i){this.flushBackBuffer()},l.onBufferEos=function(n,i){var t=this,v=this.getSourceBufferTypes().reduce(function(f,p){var E=t.sourceBuffer[p];return(!i.type||i.type===p)&&(E&&!E.ended&&(E.ended=!0,R.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),f&&!!(!E||E.ended)},!0);v&&this.blockBuffers(function(){var f=t.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},l.onLevelUpdated=function(n,i){var t=i.details;if(!t.fragments.length)return;this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},l.flushBackBuffer=function(){var n=this.hls,i=this.details,t=this.media,v=this.sourceBuffer;if(!t||i===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var p=i.live&&n.config.liveBackBufferLength!==null?n.config.liveBackBufferLength:n.config.backBufferLength;if(!Object(k.isFiniteNumber)(p)||p<0)return;var E=t.currentTime,b=i.levelTargetDuration,g=Math.max(p,b),c=Math.floor(E/b)*b-g;f.forEach(function(m){var u=v[m];if(u){var _=U.BufferHelper.getBuffered(u);_.length>0&&c>_.start(0)&&(n.trigger(w.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),i.live&&n.trigger(w.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),n.trigger(w.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:m}))}})},l.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var n=this.details,i=this.hls,t=this.media,v=this.mediaSource,f=n.fragments[0].start+n.totalduration,p=t.duration,E=Object(k.isFiniteNumber)(v.duration)?v.duration:0;n.live&&i.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),v.duration=Infinity,this.updateSeekableRange(n)):(f>E&&f>p||!Object(k.isFiniteNumber)(p))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),v.duration=f)},l.updateSeekableRange=function(n){var i=this.mediaSource,t=n.fragments,v=t.length;if(v&&n.live&&i!==null&&i!==void 0&&i.setLiveSeekableRange){var f=Math.max(0,t[0].start),p=Math.max(f,f+n.totalduration);i.setLiveSeekableRange(f,p)}},l.checkPendingTracks=function(){var n=this.bufferCodecEventsExpected,i=this.operationQueue,t=this.pendingTracks,v=Object.keys(t).length;if(v&&!n||v===2){this.createSourceBuffers(t),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.length===0){this.hls.trigger(w.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}f.forEach(function(p){i.executeNext(p)})}},l.createSourceBuffers=function(n){var i=this.sourceBuffer,t=this.mediaSource;if(!t)throw Error("createSourceBuffers called when mediaSource was null");var v=0;for(var f in n)if(!i[f]){var p=n[f];if(!p)throw Error("source buffer exists for track "+f+", however track does not");var E=p.levelCodec||p.codec,b=p.container+";codecs="+E;R.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var g=i[f]=t.addSourceBuffer(b),c=f;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[f]={buffer:g,codec:E,container:p.container,levelCodec:p.levelCodec,id:p.id},v++}catch(m){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+m.message),this.hls.trigger(w.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:m,mimeType:b})}}v&&this.hls.trigger(w.Events.BUFFER_CREATED,{tracks:this.tracks})},l._onSBUpdateStart=function(n){var i=this.operationQueue,t=i.current(n);t.onStart()},l._onSBUpdateEnd=function(n){var i=this.operationQueue,t=i.current(n);t.onComplete(),i.shiftAndExecuteNext(n)},l._onSBUpdateError=function(n,i){R.logger.error("[buffer-controller]: "+n+" SourceBuffer error",i),this.hls.trigger(w.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var t=this.operationQueue.current(n);t&&t.onError(i)},l.removeExecutor=function(n,i,t){var v=this.media,f=this.mediaSource,p=this.operationQueue,E=this.sourceBuffer,b=E[n];if(!v||!f||!b){R.logger.warn("[buffer-controller]: Attempting to remove from the "+n+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(n);return}var g=Object(k.isFiniteNumber)(v.duration)?v.duration:Infinity,c=Object(k.isFiniteNumber)(f.duration)?f.duration:Infinity,m=Math.max(0,i),u=Math.min(t,g,c);u>m?(R.logger.log("[buffer-controller]: Removing ["+m+","+u+"] from the "+n+" SourceBuffer"),console.assert(!b.updating,n+" sourceBuffer must not be updating"),b.remove(m,u)):p.shiftAndExecuteNext(n)},l.appendExecutor=function(n,i){var t=this.operationQueue,v=this.sourceBuffer,f=v[i];if(!f){R.logger.warn("[buffer-controller]: Attempting to append to the "+i+" SourceBuffer, but it does not exist"),t.shiftAndExecuteNext(i);return}f.ended=!1,console.assert(!f.updating,i+" sourceBuffer must not be updating"),f.appendBuffer(n)},l.blockBuffers=function(n,i){var t=this;if(i===void 0&&(i=this.getSourceBufferTypes()),!i.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(n);return}var v=this.operationQueue,f=i.map(function(p){return v.appendBlocker(p)});Promise.all(f).then(function(){n(),i.forEach(function(p){var E=t.sourceBuffer[p];(!E||!E.updating)&&v.shiftAndExecuteNext(p)})})},l.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},l.addBufferListener=function(n,i,t){var v=this.sourceBuffer[n];if(!v)return;var f=t.bind(this,n);this.listeners[n].push({event:i,listener:f}),v.addEventListener(i,f)},l.removeBufferListeners=function(n){var i=this.sourceBuffer[n];if(!i)return;this.listeners[n].forEach(function(t){i.removeEventListener(t.event,t.listener)})},r}()},"./src/controller/buffer-operation-queue.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return w});var k=O("./src/utils/logger.ts"),w=function(){function R(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var H=R.prototype;return H.append=function(e,S){var d=this.queues[S];d.push(e),d.length===1&&this.buffers[S]&&this.executeNext(S)},H.insertAbort=function(e,S){var d=this.queues[S];d.unshift(e),this.executeNext(S)},H.appendBlocker=function(e){var S,d=new Promise(function(o){S=o}),h={execute:S,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(h,e),d},H.executeNext=function(e){var S=this.buffers,d=this.queues,h=S[e],o=d[e];if(o.length){var a=o[0];try{a.execute()}catch(r){k.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),a.onError(r),(!h||!h.updating)&&(o.shift(),this.executeNext(e))}}},H.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},H.current=function(e){return this.queues[e][0]},R}()},"./src/controller/cap-level-controller.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/events.ts");function w(U,e){for(var S=0;S<e.length;S++){var d=e[S];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(U,d.key,d)}}function R(U,e,S){return e&&w(U.prototype,e),S&&w(U,S),U}var H=function(){function U(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 e=U.prototype;return e.setStreamController=function(d){this.streamController=d},e.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},e.registerListeners=function(){var d=this.hls;d.on(k.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},e.unregisterListener=function(){var d=this.hls;d.off(k.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},e.onFpsDropLevelCapping=function(d,h){U.isLevelAllowed(h.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(h.droppedLevel)},e.onMediaAttaching=function(d,h){this.media=h.media instanceof HTMLVideoElement?h.media:null},e.onManifestParsed=function(d,h){var o=this.hls;this.restrictedLevels=[],this.firstLevel=h.firstLevel,o.config.capLevelToPlayerSize&&h.video&&this.startCapping()},e.onBufferCodecs=function(d,h){var o=this.hls;o.config.capLevelToPlayerSize&&h.video&&this.startCapping()},e.onMediaDetaching=function(){this.stopCapping()},e.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var d=this.hls.levels;if(d.length){var h=this.hls;h.autoLevelCapping=this.getMaxLevel(d.length-1),h.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=h.autoLevelCapping}}},e.getMaxLevel=function(d){var h=this,o=this.hls.levels;if(!o.length)return-1;var a=o.filter(function(r,l){return U.isLevelAllowed(l,h.restrictedLevels)&&l<=d});return this.clientRect=null,U.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)},e.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()},e.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},e.getDimensions=function(){if(this.clientRect)return this.clientRect;var d=this.media,h={width:0,height:0};if(d){var o=d.getBoundingClientRect();h.width=o.width,h.height=o.height,!h.width&&!h.height&&(h.width=o.right-o.left||d.width||0,h.height=o.bottom-o.top||d.height||0)}return this.clientRect=h,h},U.isLevelAllowed=function(d,h){return h===void 0&&(h=[]),h.indexOf(d)===-1},U.getMaxLevelByMediaSize=function(d,h,o){if(!d||!d.length)return-1;for(var a=function(i,t){return t?i.width!==t.width||i.height!==t.height:!0},r=d.length-1,l=0;l<d.length;l+=1){var s=d[l];if((s.width>=h||s.height>=o)&&a(s,d[l+1])){r=l;break}}return r},R(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var d=1;try{d=self.devicePixelRatio}catch(h){}return d}}]),U}();B.default=H},"./src/controller/cmcd-controller.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return a});var k=O("./src/events.ts"),w=O("./src/types/cmcd.ts"),R=O("./src/utils/buffer-helper.ts"),H=O("./src/utils/logger.ts");function U(r,l){for(var s=0;s<l.length;s++){var n=l[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function e(r,l,s){return l&&U(r.prototype,l),s&&U(r,s),r}function S(r,l){var s=typeof Symbol!="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(s)return(s=s.call(r)).next.bind(s);if(Array.isArray(r)||(s=d(r))||l&&r&&typeof r.length=="number"){s&&(r=s);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}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 d(r,l){if(!r)return;if(typeof r=="string")return h(r,l);var s=Object.prototype.toString.call(r).slice(8,-1);if(s==="Object"&&r.constructor&&(s=r.constructor.name),s==="Map"||s==="Set")return Array.from(r);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return h(r,l)}function h(r,l){(l==null||l>r.length)&&(l=r.length);for(var s=0,n=new Array(l);s<l;s++)n[s]=r[s];return n}function o(){return o=Object.assign||function(r){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(r[n]=s[n])}return r},o.apply(this,arguments)}var a=function(){function r(s){var n=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(){n.initialized&&(n.starved=!0),n.buffering=!0},this.onPlaying=function(){n.initialized||(n.initialized=!0),n.buffering=!1},this.applyPlaylistData=function(v){try{n.apply(v,{ot:w.CMCDObjectType.MANIFEST,su:!n.initialized})}catch(f){H.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(v){try{var f=v.frag,p=n.hls.levels[f.level],E=n.getObjectType(f),b={d:f.duration*1e3,ot:E};(E===w.CMCDObjectType.VIDEO||E===w.CMCDObjectType.AUDIO||E==w.CMCDObjectType.MUXED)&&(b.br=p.bitrate/1e3,b.tb=n.getTopBandwidth(E),b.bl=n.getBufferLength(E)),n.apply(v,b)}catch(g){H.logger.warn("Could not generate segment CMCD data.",g)}},this.hls=s;var i=this.config=s.config,t=i.cmcd;t!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=t.sessionId||r.uuid(),this.cid=t.contentId,this.useHeaders=t.useHeaders===!0,this.registerListeners())}var l=r.prototype;return l.registerListeners=function(){var n=this.hls;n.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),n.on(k.Events.BUFFER_CREATED,this.onBufferCreated,this)},l.unregisterListeners=function(){var n=this.hls;n.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),n.off(k.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(n,i){this.media=i.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(n,i){var t,v;this.audioBuffer=(t=i.tracks.audio)===null||t===void 0?void 0:t.buffer,this.videoBuffer=(v=i.tracks.video)===null||v===void 0?void 0:v.buffer},l.createData=function(){var n;return{v:w.CMCDVersion,sf:w.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(n=this.media)===null||n===void 0?void 0:n.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},l.apply=function(n,i){i===void 0&&(i={}),o(i,this.createData());var t=i.ot===w.CMCDObjectType.INIT||i.ot===w.CMCDObjectType.VIDEO||i.ot===w.CMCDObjectType.MUXED;if(this.starved&&t&&(i.bs=!0,i.su=!0,this.starved=!1),i.su==null&&(i.su=this.buffering),this.useHeaders){var v=r.toHeaders(i);if(!Object.keys(v).length)return;n.headers||(n.headers={}),o(n.headers,v)}else{var f=r.toQuery(i);if(!f)return;n.url=r.appendQueryToUri(n.url,f)}},l.getObjectType=function(n){var i=n.type;return i==="subtitle"?w.CMCDObjectType.TIMED_TEXT:n.sn==="initSegment"?w.CMCDObjectType.INIT:i==="audio"?w.CMCDObjectType.AUDIO:i==="main"?this.hls.audioTracks.length?w.CMCDObjectType.VIDEO:w.CMCDObjectType.MUXED:void 0},l.getTopBandwidth=function(n){for(var i=0,t=n===w.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,v=S(t),f;!(f=v()).done;){var p=f.value;p.bitrate>i&&(i=p.bitrate)}return i>0?i:NaN},l.getBufferLength=function(n){var i=this.hls.media,t=n===w.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!t||!i)return NaN;var v=R.BufferHelper.bufferInfo(t,i.currentTime,this.config.maxBufferHole);return v.len*1e3},l.createPlaylistLoader=function(){var n=this.config.pLoader,i=this.applyPlaylistData,t=n||this.config.loader;return function(){function v(p){this.loader=void 0,this.loader=new t(p)}var f=v.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(E,b,g){i(E),this.loader.load(E,b,g)},e(v,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),v}()},l.createFragmentLoader=function(){var n=this.config.fLoader,i=this.applyFragmentData,t=n||this.config.loader;return function(){function v(p){this.loader=void 0,this.loader=new t(p)}var f=v.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(E,b,g){i(E),this.loader.load(E,b,g)},e(v,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),v}()},r.uuid=function(){var n=URL.createObjectURL(new Blob),i=n.toString();return URL.revokeObjectURL(n),i.substr(i.lastIndexOf("/")+1)},r.serialize=function(n){for(var i=[],t=function(L){return!Number.isNaN(L)&&L!=null&&L!==""&&L!==!1},v=function(L){return Math.round(L)},f=function(L){return v(L/100)*100},p=function(L){return encodeURIComponent(L)},E={br:v,d:v,bl:f,dl:f,mtp:f,nor:p,rtp:f,tb:v},b=Object.keys(n||{}).sort(),g=S(b),c;!(c=g()).done;){var m=c.value,u=n[m];if(!t(u))continue;if(m==="v"&&u===1)continue;if(m=="pr"&&u===1)continue;var _=E[m];_&&(u=_(u));var y=typeof u,T=void 0;m==="ot"||m==="sf"||m==="st"?T=m+"="+u:y==="boolean"?T=m:y==="number"?T=m+"="+u:T=m+"="+JSON.stringify(u),i.push(T)}return i.join(",")},r.toHeaders=function(n){for(var i=Object.keys(n),t={},v=["Object","Request","Session","Status"],f=[{},{},{},{}],p={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=i;E<b.length;E++){var g=b[E],c=p[g]!=null?p[g]:1;f[c][g]=n[g]}for(var m=0;m<f.length;m++){var u=r.serialize(f[m]);u&&(t["CMCD-"+v[m]]=u)}return t},r.toQuery=function(n){return"CMCD="+encodeURIComponent(r.serialize(n))},r.appendQueryToUri=function(n,i){if(!i)return n;var t=n.includes("?")?"&":"?";return""+n+t+i},r}()},"./src/controller/eme-controller.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/events.ts"),w=O("./src/errors.ts"),R=O("./src/utils/logger.ts"),H=O("./src/utils/mediakeys-helper.ts");function U(a,r){for(var l=0;l<r.length;l++){var s=r[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(a,s.key,s)}}function e(a,r,l){return r&&U(a.prototype,r),l&&U(a,l),a}var S=3,d=function(r,l,s){var n={audioCapabilities:[],videoCapabilities:[]};return r.forEach(function(i){n.audioCapabilities.push({contentType:'audio/mp4; codecs="'+i+'"',robustness:s.audioRobustness||""})}),l.forEach(function(i){n.videoCapabilities.push({contentType:'video/mp4; codecs="'+i+'"',robustness:s.videoRobustness||""})}),[n]},h=function(r,l,s,n){switch(r){case H.KeySystems.WIDEVINE:return d(l,s,n);default:throw new Error("Unknown key-system: "+r)}},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 r=a.prototype;return r.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},r._registerListeners=function(){this.hls.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this)},r._unregisterListeners=function(){this.hls.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this)},r.getLicenseServerUrl=function(s){switch(s){case H.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+s+'"')},r._attemptKeySystemAccess=function(s,n,i){var t=this,v=h(s,n,i,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(s,v);this.mediaKeysPromise=f.then(function(p){return t._onMediaKeySystemAccessObtained(s,p)}),f.catch(function(p){R.logger.error('Failed to obtain key-system "'+s+'" access:',p)})},r._onMediaKeySystemAccessObtained=function(s,n){var i=this;R.logger.log('Access for key-system "'+s+'" obtained');var t={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:n,mediaKeySystemDomain:s};this._mediaKeysList.push(t);var v=Promise.resolve().then(function(){return n.createMediaKeys()}).then(function(f){return t.mediaKeys=f,R.logger.log('Media-keys created for key-system "'+s+'"'),i._onMediaKeysCreated(),f});return v.catch(function(f){R.logger.error("Failed to create media-keys:",f)}),v},r._onMediaKeysCreated=function(){var s=this;this._mediaKeysList.forEach(function(n){n.mediaKeysSession||(n.mediaKeysSession=n.mediaKeys.createSession(),s._onNewMediaKeySession(n.mediaKeysSession))})},r._onNewMediaKeySession=function(s){var n=this;R.logger.log("New key-system session "+s.sessionId),s.addEventListener("message",function(i){n._onKeySessionMessage(s,i.message)},!1)},r._onKeySessionMessage=function(s,n){R.logger.log("Got EME message event, creating license request"),this._requestLicense(n,function(i){R.logger.log("Received license data (length: "+(i&&i.byteLength)+"), updating key-session"),s.update(i)})},r.onMediaEncrypted=function(s){var n=this;if(R.logger.log('Media is encrypted using "'+s.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var i=function(v){if(!n._media)return;n._attemptSetMediaKeys(v),n._generateRequestWithPreferredKeySession(s.initDataType,s.initData)};this.mediaKeysPromise.then(i).catch(i)},r._attemptSetMediaKeys=function(s){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var n=this._mediaKeysList[0];if(!n||!n.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(n.mediaKeys),this._hasSetMediaKeys=!0}},r._generateRequestWithPreferredKeySession=function(s,n){var i=this,t=this._mediaKeysList[0];if(!t){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(t.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var v=t.mediaKeysSession;if(!v){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!n){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+s+'" init data type'),t.mediaKeysSessionInitialized=!0,v.generateRequest(s,n).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(f){R.logger.error("Error generating key-session request:",f),i.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},r._createLicenseXhr=function(s,n,i){var t=new XMLHttpRequest;t.responseType="arraybuffer",t.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,t,s,n,i);var v=this._licenseXhrSetup;if(v)try{v.call(this.hls,t,s),v=void 0}catch(f){R.logger.error(f)}try{t.readyState||t.open("POST",s,!0),v&&v.call(this.hls,t,s)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return t},r._onLicenseRequestReadyStageChange=function(s,n,i,t){switch(s.readyState){case 4:if(s.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var v=s.response,f=this._licenseResponseCallback;if(f)try{v=f.call(this.hls,s,n)}catch(E){R.logger.error(E)}t(v)}else{if(R.logger.error("License Request XHR failed ("+n+"). Status: "+s.status+" ("+s.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>S){this.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=S-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(i,t)}break}},r._generateLicenseRequestChallenge=function(s,n){switch(s.mediaKeySystemDomain){case H.KeySystems.WIDEVINE:return n}throw new Error("unsupported key-system: "+s.mediaKeySystemDomain)},r._requestLicense=function(s,n){R.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(!i){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var t=this.getLicenseServerUrl(i.mediaKeySystemDomain),v=this._createLicenseXhr(t,s,n);R.logger.log("Sending license request to URL: "+t);var f=this._generateLicenseRequestChallenge(i,s);v.send(f)}catch(p){R.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},r.onMediaAttached=function(s,n){if(!this._emeEnabled)return;var i=n.media;this._media=i,i.addEventListener("encrypted",this._onMediaEncrypted)},r.onMediaDetached=function(){var s=this._media,n=this._mediaKeysList;if(!s)return;s.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(n.map(function(i){if(i.mediaKeysSession)return i.mediaKeysSession.close().catch(function(){})})).then(function(){return s.setMediaKeys(null)}).catch(function(){})},r.onManifestParsed=function(s,n){if(!this._emeEnabled)return;var i=n.levels.map(function(v){return v.audioCodec}).filter(function(v){return!!v}),t=n.levels.map(function(v){return v.videoCodec}).filter(function(v){return!!v});this._attemptKeySystemAccess(H.KeySystems.WIDEVINE,i,t)},e(a,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),a}();B.default=o},"./src/controller/fps-controller.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/events.ts"),w=O("./src/utils/logger.ts"),R=function(){function H(e){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=e,this.registerListeners()}var U=H.prototype;return U.setStreamController=function(S){this.streamController=S},U.registerListeners=function(){this.hls.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(S,d){var h=this.hls.config;if(h.capLevelOnFPSDrop){var o=d.media instanceof self.HTMLVideoElement?d.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),h.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(S,d,h){var o=performance.now();if(d){if(this.lastTime){var a=o-this.lastTime,r=h-this.lastDroppedFrames,l=d-this.lastDecodedFrames,s=1e3*r/a,n=this.hls;if(n.trigger(k.Events.FPS_DROP,{currentDropped:r,currentDecoded:l,totalDroppedFrames:h}),s>0&&r>n.config.fpsDroppedMonitoringThreshold*l){var i=n.currentLevel;w.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+i),i>0&&(n.autoLevelCapping===-1||n.autoLevelCapping>=i)&&(i=i-1,n.trigger(k.Events.FPS_DROP_LEVEL_CAPPING,{level:i,droppedLevel:n.currentLevel}),n.autoLevelCapping=i,this.streamController.nextLevelSwitch())}}this.lastTime=o,this.lastDroppedFrames=h,this.lastDecodedFrames=d}},U.checkFPSInterval=function(){var S=this.media;if(S)if(this.isVideoPlaybackQualityAvailable){var d=S.getVideoPlaybackQuality();this.checkFPS(S,d.totalVideoFrames,d.droppedVideoFrames)}else this.checkFPS(S,S.webkitDecodedFrameCount,S.webkitDroppedFrameCount)},H}();B.default=R},"./src/controller/fragment-finders.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"findFragmentByPDT",function(){return R}),O.d(B,"findFragmentByPTS",function(){return H}),O.d(B,"fragmentWithinToleranceTest",function(){return U}),O.d(B,"pdtWithinToleranceTest",function(){return e}),O.d(B,"findFragWithCC",function(){return S});var k=O("./src/polyfills/number.ts"),w=O("./src/utils/binary-search.ts");function R(d,h,o){if(h===null||!Array.isArray(d)||!d.length||!Object(k.isFiniteNumber)(h))return null;var a=d[0].programDateTime;if(h<(a||0))return null;var r=d[d.length-1].endProgramDateTime;if(h>=(r||0))return null;o=o||0;for(var l=0;l<d.length;++l){var s=d[l];if(e(h,o,s))return s}return null}function H(d,h,o,a){o===void 0&&(o=0),a===void 0&&(a=0);var r=null;if(d?r=h[d.sn-h[0].sn+1]||null:o===0&&h[0].start===0&&(r=h[0]),r&&U(o,a,r)===0)return r;var l=w.default.search(h,U.bind(null,o,a));return l||r}function U(d,h,o){d===void 0&&(d=0),h===void 0&&(h=0);var a=Math.min(h,o.duration+(o.deltaPTS?o.deltaPTS:0));return o.start+o.duration-a<=d?1:o.start-a>d&&o.start?-1:0}function e(d,h,o){var a=Math.min(h,o.duration+(o.deltaPTS?o.deltaPTS:0))*1e3,r=o.endProgramDateTime||0;return r-a>d}function S(d,h){return w.default.search(d,function(o){return o.cc<h?1:o.cc>h?-1:0})}},"./src/controller/fragment-tracker.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"FragmentState",function(){return R}),O.d(B,"FragmentTracker",function(){return H});var k=O("./src/events.ts"),w=O("./src/types/loader.ts"),R;(function(S){S.NOT_LOADED="NOT_LOADED",S.BACKTRACKED="BACKTRACKED",S.APPENDING="APPENDING",S.PARTIAL="PARTIAL",S.OK="OK"})(R||(R={}));var H=function(){function S(h){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=h,this._registerListeners()}var d=S.prototype;return d._registerListeners=function(){var o=this.hls;o.on(k.Events.BUFFER_APPENDED,this.onBufferAppended,this),o.on(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.on(k.Events.FRAG_LOADED,this.onFragLoaded,this)},d._unregisterListeners=function(){var o=this.hls;o.off(k.Events.BUFFER_APPENDED,this.onBufferAppended,this),o.off(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),o.off(k.Events.FRAG_LOADED,this.onFragLoaded,this)},d.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},d.getAppendedFrag=function(o,a){if(a===w.PlaylistLevelType.MAIN){var r=this.activeFragment,l=this.activeParts;if(!r)return null;if(l)for(var s=l.length;s--;){var n=l[s],i=n?n.end:r.appendedPTS;if(n.start<=o&&i!==void 0&&o<=i)return s>9&&(this.activeParts=l.slice(s-9)),n}else if(r.start<=o&&r.appendedPTS!==void 0&&o<=r.appendedPTS)return r}return this.getBufferedFrag(o,a)},d.getBufferedFrag=function(o,a){for(var r=this.fragments,l=Object.keys(r),s=l.length;s--;){var n=r[l[s]];if((n==null?void 0:n.body.type)===a&&n.buffered){var i=n.body;if(i.start<=o&&o<=i.end)return i}}return null},d.detectEvictedFragments=function(o,a,r){var l=this;Object.keys(this.fragments).forEach(function(s){var n=l.fragments[s];if(!n)return;if(!n.buffered){n.body.type===r&&l.removeFragment(n.body);return}var i=n.range[o];if(!i)return;i.time.some(function(t){var v=!l.isTimeBuffered(t.startPTS,t.endPTS,a);return v&&l.removeFragment(n.body),v})})},d.detectPartialFragments=function(o){var a=this,r=this.timeRanges,l=o.frag,s=o.part;if(!r||l.sn==="initSegment")return;var n=e(l),i=this.fragments[n];if(!i)return;Object.keys(r).forEach(function(t){var v=l.elementaryStreams[t];if(!v)return;var f=r[t],p=s!==null||v.partial===!0;i.range[t]=a.getBufferedTimes(l,s,p,f)}),i.backtrack=i.loaded=null,Object.keys(i.range).length?i.buffered=!0:this.removeFragment(i.body)},d.fragBuffered=function(o){var a=e(o),r=this.fragments[a];r&&(r.backtrack=r.loaded=null,r.buffered=!0)},d.getBufferedTimes=function(o,a,r,l){for(var s={time:[],partial:r},n=a?a.start:o.start,i=a?a.end:o.end,t=o.minEndPTS||i,v=o.maxStartPTS||n,f=0;f<l.length;f++){var p=l.start(f)-this.bufferPadding,E=l.end(f)+this.bufferPadding;if(v>=p&&t<=E){s.time.push({startPTS:Math.max(n,l.start(f)),endPTS:Math.min(i,l.end(f))});break}else if(n<E&&i>p)s.partial=!0,s.time.push({startPTS:Math.max(n,l.start(f)),endPTS:Math.min(i,l.end(f))});else if(i<=p)break}return s},d.getPartialFragment=function(o){var a=null,r,l,s,n=0,i=this.bufferPadding,t=this.fragments;return Object.keys(t).forEach(function(v){var f=t[v];if(!f)return;U(f)&&(l=f.body.start-i,s=f.body.end+i,o>=l&&o<=s&&(r=Math.min(o-l,s-o),n<=r&&(a=f.body,n=r)))}),a},d.getState=function(o){var a=e(o),r=this.fragments[a];return r?r.buffered?U(r)?R.PARTIAL:R.OK:r.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},d.backtrack=function(o,a){var r=e(o),l=this.fragments[r];if(!l||l.backtrack)return null;var s=l.backtrack=a||l.loaded;return l.loaded=null,s},d.getBacktrackData=function(o){var a=e(o),r=this.fragments[a];if(r){var l,s=r.backtrack;if(s!=null&&(l=s.payload)!==null&&l!==void 0&&l.byteLength)return s;this.removeFragment(o)}return null},d.isTimeBuffered=function(o,a,r){for(var l,s,n=0;n<r.length;n++){if(l=r.start(n)-this.bufferPadding,s=r.end(n)+this.bufferPadding,o>=l&&a<=s)return!0;if(a<=l)return!1}return!1},d.onFragLoaded=function(o,a){var r=a.frag,l=a.part;if(r.sn==="initSegment"||r.bitrateTest||l)return;var s=e(r);this.fragments[s]={body:r,loaded:a,backtrack:null,buffered:!1,range:Object.create(null)}},d.onBufferAppended=function(o,a){var r=this,l=a.frag,s=a.part,n=a.timeRanges;if(l.type===w.PlaylistLevelType.MAIN)if(this.activeFragment=l,s){var i=this.activeParts;i||(this.activeParts=i=[]),i.push(s)}else this.activeParts=null;this.timeRanges=n,Object.keys(n).forEach(function(t){var v=n[t];if(r.detectEvictedFragments(t,v),!s)for(var f=0;f<v.length;f++)l.appendedPTS=Math.max(v.end(f),l.appendedPTS||0)})},d.onFragBuffered=function(o,a){this.detectPartialFragments(a)},d.hasFragment=function(o){var a=e(o);return!!this.fragments[a]},d.removeFragmentsInRange=function(o,a,r){var l=this;Object.keys(this.fragments).forEach(function(s){var n=l.fragments[s];if(!n)return;if(n.buffered){var i=n.body;i.type===r&&i.start<a&&i.end>o&&l.removeFragment(i)}})},d.removeFragment=function(o){var a=e(o);o.stats.loaded=0,o.clearElementaryStreamInfo(),delete this.fragments[a]},d.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},S}();function U(S){var d,h;return S.buffered&&(((d=S.range.video)===null||d===void 0?void 0:d.partial)||((h=S.range.audio)===null||h===void 0?void 0:h.partial))}function e(S){return S.type+"_"+S.level+"_"+S.urlId+"_"+S.sn}},"./src/controller/gap-controller.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"STALL_MINIMUM_DURATION_MS",function(){return U}),O.d(B,"MAX_START_GAP_JUMP",function(){return e}),O.d(B,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return S}),O.d(B,"SKIP_BUFFER_RANGE_START",function(){return d}),O.d(B,"default",function(){return h});var k=O("./src/utils/buffer-helper.ts"),w=O("./src/errors.ts"),R=O("./src/events.ts"),H=O("./src/utils/logger.ts"),U=250,e=2,S=.1,d=.05,h=function(){function o(r,l,s,n){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=r,this.media=l,this.fragmentTracker=s,this.hls=n}var a=o.prototype;return a.destroy=function(){this.hls=this.fragmentTracker=this.media=null},a.poll=function(l){var s=this.config,n=this.media,i=this.stalled,t=n.currentTime,v=n.seeking,f=this.seeking&&!v,p=!this.seeking&&v;if(this.seeking=v,t!==l){if(this.moved=!0,i!==null){if(this.stallReported){var E=self.performance.now()-i;H.logger.warn("playback not stuck anymore @"+t+", after "+Math.round(E)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||f)&&(this.stalled=null),n.paused||n.ended||n.playbackRate===0||!k.BufferHelper.getBuffered(n).length)return;var b=k.BufferHelper.bufferInfo(n,t,0),g=b.len>0,c=b.nextStart||0;if(!g&&!c)return;if(v){var m=b.len>e,u=!c||c-t>e&&!this.fragmentTracker.getPartialFragment(t);if(m||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var _,y=Math.max(c,b.start||0)-t,T=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=T==null||((_=T.details)===null||_===void 0)?void 0:_.live,L=M?T.details.targetduration*2:e;if(y>0&&y<=L){this._trySkipBufferHole(null);return}}var x=self.performance.now();if(i===null){this.stalled=x;return}var D=x-i;!v&&D>=U&&this._reportStall(b.len);var j=k.BufferHelper.bufferInfo(n,t,s.maxBufferHole);this._tryFixBufferStall(j,D)},a._tryFixBufferStall=function(l,s){var n=this.config,i=this.fragmentTracker,t=this.media,v=t.currentTime,f=i.getPartialFragment(v);if(f){var p=this._trySkipBufferHole(f);if(p)return}l.len>n.maxBufferHole&&s>n.highBufferWatchdogPeriod*1e3&&(H.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},a._reportStall=function(l){var s=this.hls,n=this.media,i=this.stallReported;i||(this.stallReported=!0,H.logger.warn("Playback stalling at @"+n.currentTime+" due to low buffer (buffer="+l+")"),s.trigger(R.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:l}))},a._trySkipBufferHole=function(l){for(var s=this.config,n=this.hls,i=this.media,t=i.currentTime,v=0,f=k.BufferHelper.getBuffered(i),p=0;p<f.length;p++){var E=f.start(p);if(t+s.maxBufferHole>=v&&t<E){var b=Math.max(E+d,i.currentTime+S);return H.logger.warn("skipping hole, adjusting currentTime from "+t+" to "+b),this.moved=!0,this.stalled=null,i.currentTime=b,l&&n.trigger(R.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+t+" to "+b,frag:l}),b}v=f.end(p)}return 0},a._tryNudgeBuffer=function(){var l=this.config,s=this.hls,n=this.media,i=n.currentTime,t=(this.nudgeRetry||0)+1;if(this.nudgeRetry=t,t<l.nudgeMaxRetry){var v=i+t*l.nudgeOffset;H.logger.warn("Nudging 'currentTime' from "+i+" to "+v),n.currentTime=v,s.trigger(R.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else H.logger.error("Playhead still not moving while enough data buffered @"+i+" after "+l.nudgeMaxRetry+" nudges"),s.trigger(R.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},o}()},"./src/controller/id3-track-controller.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/events.ts"),w=O("./src/utils/texttrack-utils.ts"),R=O("./src/demux/id3.ts"),H=.25,U=function(){function e(d){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=d,this._registerListeners()}var S=e.prototype;return S.destroy=function(){this._unregisterListeners()},S._registerListeners=function(){var h=this.hls;h.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(k.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),h.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var h=this.hls;h.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(k.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),h.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.onMediaAttached=function(h,o){this.media=o.media},S.onMediaDetaching=function(){if(!this.id3Track)return;Object(w.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},S.getID3Track=function(h){if(!this.media)return;for(var o=0;o<h.length;o++){var a=h[o];if(a.kind==="metadata"&&a.label==="id3")return Object(w.sendAddTrackEvent)(a,this.media),a}return this.media.addTextTrack("metadata","id3")},S.onFragParsingMetadata=function(h,o){if(!this.media)return;var a=o.frag,r=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<r.length;s++){var n=R.getID3Frames(r[s].data);if(n){var i=r[s].pts,t=s<r.length-1?r[s+1].pts:a.end,v=t-i;v<=0&&(t=i+H);for(var f=0;f<n.length;f++){var p=n[f];if(!R.isTimeStampFrame(p)){var E=new l(i,t,"");E.value=p,this.id3Track.addCue(E)}}}}},S.onBufferFlushing=function(h,o){var a=o.startOffset,r=o.endOffset,l=o.type;if(!l||l==="audio"){var s=this.id3Track;s&&Object(w.removeCuesInRange)(s,a,r)}},e}();B.default=U},"./src/controller/latency-controller.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return e});var k=O("./src/errors.ts"),w=O("./src/events.ts"),R=O("./src/utils/logger.ts");function H(S,d){for(var h=0;h<d.length;h++){var o=d[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(S,o.key,o)}}function U(S,d,h){return d&&H(S.prototype,d),h&&H(S,h),S}var e=function(){function S(h){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=h,this.config=h.config,this.registerListeners()}var d=S.prototype;return d.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},d.registerListeners=function(){this.hls.on(w.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(w.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(w.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){this.hls.off(w.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(w.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(w.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(w.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(w.Events.ERROR,this.onError)},d.onMediaAttached=function(o,a){this.media=a.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},d.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},d.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},d.onLevelUpdated=function(o,a){var r=a.details;this.levelDetails=r,r.advanced&&this.timeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},d.onError=function(o,a){if(a.details!==k.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},d.timeupdate=function(){var o=this.media,a=this.levelDetails;if(!o||!a)return;this.currentTime=o.currentTime;var r=this.computeLatency();if(r===null)return;this._latency=r;var l=this.config,s=l.lowLatencyMode,n=l.maxLiveSyncPlaybackRate;if(!s||n===1)return;var i=this.targetLatency;if(i===null)return;var t=r-i,v=Math.min(this.maxLatency,i+a.targetduration),f=t<v;if(a.live&&f&&t>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,n)),E=Math.round(2/(1+Math.exp(-.75*t-this.edgeStalled))*20)/20;o.playbackRate=Math.min(p,Math.max(1,E))}else o.playbackRate!==1&&o.playbackRate!==0&&(o.playbackRate=1)},d.estimateLiveEdge=function(){var o=this.levelDetails;return o===null?null:o.edge+o.age},d.computeLatency=function(){var o=this.estimateLiveEdge();return o===null?null:o-this.currentTime},U(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,r=o.partHoldBack,l=o.targetduration,s=this.config,n=s.liveSyncDuration,i=s.liveSyncDurationCount,t=s.lowLatencyMode,v=this.hls.userConfig,f=t&&r||a;(v.liveSyncDuration||v.liveSyncDurationCount||f===0)&&(f=n!==void 0?n:i*l);var p=l,E=1;return f+Math.min(this.stallCount*E,p)}},{key:"liveSyncPosition",get:function(){var o=this.estimateLiveEdge(),a=this.targetLatency,r=this.levelDetails;if(o===null||a===null||r===null)return null;var l=r.edge,s=o-a-this.edgeStalled,n=l-r.totalduration,i=l-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(n,s),i)}},{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 r=o.buffered.length;return r?o.buffered.end(r-1):a.edge-this.currentTime}}]),S}()},"./src/controller/level-controller.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return s});var k=O("./src/types/level.ts"),w=O("./src/events.ts"),R=O("./src/errors.ts"),H=O("./src/utils/codecs.ts"),U=O("./src/controller/level-helper.ts"),e=O("./src/controller/base-playlist-controller.ts"),S=O("./src/types/loader.ts");function d(){return d=Object.assign||function(n){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var v in t)Object.prototype.hasOwnProperty.call(t,v)&&(n[v]=t[v])}return n},d.apply(this,arguments)}function h(n,i){for(var t=0;t<i.length;t++){var v=i[t];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(n,v.key,v)}}function o(n,i,t){return i&&h(n.prototype,i),t&&h(n,t),n}function a(n,i){n.prototype=Object.create(i.prototype),n.prototype.constructor=n,r(n,i)}function r(n,i){return r=Object.setPrototypeOf||function(v,f){return v.__proto__=f,v},r(n,i)}var l=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),s=function(n){a(i,n);function i(v){var f;return f=n.call(this,v,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var t=i.prototype;return t._registerListeners=function(){var f=this.hls;f.on(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(w.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(w.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(w.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(w.Events.ERROR,this.onError,this)},t._unregisterListeners=function(){var f=this.hls;f.off(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(w.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(w.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(w.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(w.Events.ERROR,this.onError,this)},t.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,n.prototype.destroy.call(this)},t.startLoad=function(){var f=this._levels;f.forEach(function(p){p.loadError=0}),n.prototype.startLoad.call(this)},t.onManifestLoaded=function(f,p){var E=[],b=[],g=[],c,m={},u,_=!1,y=!1,T=!1;if(p.levels.forEach(function(D){var j=D.attrs;_=_||!!(D.width&&D.height),y=y||!!D.videoCodec,T=T||!!D.audioCodec,l&&D.audioCodec&&D.audioCodec.indexOf("mp4a.40.34")!==-1&&(D.audioCodec=void 0);var I=D.bitrate+"-"+D.attrs.RESOLUTION+"-"+D.attrs.CODECS;u=m[I],u?u.url.push(D.url):(u=new k.Level(D),m[I]=u,E.push(u)),j&&(j.AUDIO&&Object(U.addGroupId)(u,"audio",j.AUDIO),j.SUBTITLES&&Object(U.addGroupId)(u,"text",j.SUBTITLES))}),(_||y)&&T&&(E=E.filter(function(D){var j=D.videoCodec,I=D.width,W=D.height;return!!j||!!(I&&W)})),E=E.filter(function(D){var j=D.audioCodec,I=D.videoCodec;return(!j||Object(H.isCodecSupportedInMp4)(j,"audio"))&&(!I||Object(H.isCodecSupportedInMp4)(I,"video"))}),p.audioTracks&&(b=p.audioTracks.filter(function(D){return!D.audioCodec||Object(H.isCodecSupportedInMp4)(D.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(b)),p.subtitles&&(g=p.subtitles,Object(U.assignTrackIdsByGroup)(g)),E.length>0){c=E[0].bitrate,E.sort(function(D,j){return D.bitrate-j.bitrate}),this._levels=E;for(var M=0;M<E.length;M++)if(E[M].bitrate===c){this._firstLevel=M,this.log("manifest loaded, "+E.length+" level(s) found, first bitrate: "+c);break}var L=T&&!y,x={levels:E,audioTracks:b,subtitleTracks:g,firstLevel:this._firstLevel,stats:p.stats,audio:T,video:y,altAudio:!L&&b.some(function(D){return!!D.url})};this.hls.trigger(w.Events.MANIFEST_PARSED,x),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(w.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},t.onError=function(f,p){if(n.prototype.onError.call(this,f,p),p.fatal)return;var E=p.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 g=!1,c=!0,m;switch(p.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(p.frag){var u=this._levels[p.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(m=p.frag.level)):m=p.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:E&&(E.deliveryDirectives&&(c=!1),m=E.level),g=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:m=p.level,g=!0;break}m!==void 0&&this.recoverLevel(p,m,g,c)},t.recoverLevel=function(f,p,E,b){var g=f.details,c=this._levels[p];if(c.loadError++,E){var m=this.retryLoadingOrFail(f);if(m)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var u=c.url.length;if(u>1&&c.loadError<u)f.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var _=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==_&&this._levels[_].loadError===0&&(this.warn(g+": switch to "+_),f.levelRetry=!0,this.hls.nextAutoLevel=_)}}},t.redundantFailover=function(f){var p=this._levels[f],E=p.url.length;if(E>1){var b=(p.urlId+1)%E;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(g){g.urlId=b}),this.level=f}},t.onFragLoaded=function(f,p){var E=p.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)}},t.onLevelLoaded=function(f,p){var E,b=p.level,g=p.details,c=this._levels[b];if(!c){var m;this.warn("Invalid level index "+b),(m=p.deliveryDirectives)!==null&&m!==void 0&&m.skip&&(g.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(b,p,c.details)):(E=p.deliveryDirectives)!==null&&E!==void 0&&E.skip&&(g.deltaUpdateFailed=!0)},t.onAudioTrackSwitched=function(f,p){var E=this.hls.levels[this.currentLevelIndex];if(!E)return;if(E.audioGroupIds){for(var b=-1,g=this.hls.audioTracks[p.id].groupId,c=0;c<E.audioGroupIds.length;c++)if(E.audioGroupIds[c]===g){b=c;break}b!==E.urlId&&(E.urlId=b,this.startLoad())}},t.loadPlaylist=function(f){var p=this.currentLevelIndex,E=this._levels[p];if(this.canLoad&&E&&E.url.length>0){var b=E.urlId,g=E.url[b];if(f)try{g=f.addDirectives(g)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+p+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+b+" "+g),this.clearTimer(),this.hls.trigger(w.Events.LEVEL_LOADING,{url:g,level:p,id:b,deliveryDirectives:f||null})}},t.removeLevel=function(f,p){var E=function(c,m){return m!==p},b=this._levels.filter(function(g,c){return c!==f?!0:g.url.length>1&&p!==void 0?(g.url=g.url.filter(E),g.audioGroupIds&&(g.audioGroupIds=g.audioGroupIds.filter(E)),g.textGroupIds&&(g.textGroupIds=g.textGroupIds.filter(E)),g.urlId=0,!0):!1}).map(function(g,c){var m=g.details;return m!=null&&m.fragments&&m.fragments.forEach(function(u){u.level=c}),g});this._levels=b,this.hls.trigger(w.Events.LEVELS_UPDATED,{levels:b})},o(i,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var p,E=this._levels;if(E.length===0)return;if(this.currentLevelIndex===f&&(p=E[f])!==null&&p!==void 0&&p.details)return;if(f<0||f>=E.length){var b=f<0;if(this.hls.trigger(w.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:b,reason:"invalid level idx"}),b)return;f=Math.min(f,E.length-1)}this.clearTimer();var g=this.currentLevelIndex,c=E[g],m=E[f];this.log("switching to level "+f+" from "+g),this.currentLevelIndex=f;var u=d({},m,{level:f,maxBitrate:m.maxBitrate,uri:m.uri,urlId:m.urlId});delete u._urlId,this.hls.trigger(w.Events.LEVEL_SWITCHING,u);var _=m.details;if(!_||_.live){var y=this.switchParams(m.uri,c==null?void 0:c.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),i}(e.default)},"./src/controller/level-helper.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"addGroupId",function(){return R}),O.d(B,"assignTrackIdsByGroup",function(){return H}),O.d(B,"updatePTS",function(){return U}),O.d(B,"updateFragPTSDTS",function(){return S}),O.d(B,"mergeDetails",function(){return d}),O.d(B,"mapPartIntersection",function(){return h}),O.d(B,"mapFragmentIntersection",function(){return o}),O.d(B,"adjustSliding",function(){return a}),O.d(B,"addSliding",function(){return r}),O.d(B,"computeReloadInterval",function(){return l}),O.d(B,"getFragmentWithSN",function(){return s}),O.d(B,"getPartWith",function(){return n});var k=O("./src/polyfills/number.ts"),w=O("./src/utils/logger.ts");function R(i,t,v){switch(t){case"audio":i.audioGroupIds||(i.audioGroupIds=[]),i.audioGroupIds.push(v);break;case"text":i.textGroupIds||(i.textGroupIds=[]),i.textGroupIds.push(v);break}}function H(i){var t={};i.forEach(function(v){var f=v.groupId||"";v.id=t[f]=t[f]||0,t[f]++})}function U(i,t,v){var f=i[t],p=i[v];e(f,p)}function e(i,t){var v=t.startPTS;if(Object(k.isFiniteNumber)(v)){var f=0,p;t.sn>i.sn?(f=v-i.start,p=i):(f=i.start-v,p=t),p.duration!==f&&(p.duration=f)}else if(t.sn>i.sn){var E=i.cc===t.cc;E&&i.minEndPTS?t.start=i.start+(i.minEndPTS-i.start):t.start=i.start+i.duration}else t.start=Math.max(i.start-t.duration,0)}function S(i,t,v,f,p,E){var b=f-v;b<=0&&(w.logger.warn("Fragment should have a positive duration",t),f=v+t.duration,E=p+t.duration);var g=v,c=f,m=t.startPTS,u=t.endPTS;if(Object(k.isFiniteNumber)(m)){var _=Math.abs(m-v);Object(k.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(_,t.deltaPTS):t.deltaPTS=_,g=Math.max(v,m),v=Math.min(v,m),p=Math.min(p,t.startDTS),c=Math.min(f,u),f=Math.max(f,u),E=Math.max(E,t.endDTS)}t.duration=f-v;var y=v-t.start;t.appendedPTS=f,t.start=t.startPTS=v,t.maxStartPTS=g,t.startDTS=p,t.endPTS=f,t.minEndPTS=c,t.endDTS=E;var T=t.sn;if(!i||T<i.startSN||T>i.endSN)return 0;var M,L=T-i.startSN,x=i.fragments;for(x[L]=t,M=L;M>0;M--)e(x[M],x[M-1]);for(M=L;M<x.length-1;M++)e(x[M],x[M+1]);return i.fragmentHint&&e(x[x.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,y}function d(i,t){for(var v=null,f=i.fragments,p=f.length-1;p>=0;p--){var E=f[p].initSegment;if(E){v=E;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;var b=0,g;if(o(i,t,function(M,L){M.relurl&&(b=M.cc-L.cc),Object(k.isFiniteNumber)(M.startPTS)&&Object(k.isFiniteNumber)(M.endPTS)&&(L.start=L.startPTS=M.startPTS,L.startDTS=M.startDTS,L.appendedPTS=M.appendedPTS,L.maxStartPTS=M.maxStartPTS,L.endPTS=M.endPTS,L.endDTS=M.endDTS,L.minEndPTS=M.minEndPTS,L.duration=M.endPTS-M.startPTS,L.duration&&(g=L),t.PTSKnown=t.alignedSliding=!0),L.elementaryStreams=M.elementaryStreams,L.loader=M.loader,L.stats=M.stats,L.urlId=M.urlId,M.initSegment&&(L.initSegment=M.initSegment,v=M.initSegment)}),v){var c=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments;c.forEach(function(M){var L;(!M.initSegment||M.initSegment.relurl===((L=v)===null||L===void 0?void 0:L.relurl))&&(M.initSegment=v)})}if(t.skippedSegments&&(t.deltaUpdateFailed=t.fragments.some(function(M){return!M}),t.deltaUpdateFailed)){w.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var m=t.skippedSegments;m--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}var u=t.fragments;if(b){w.logger.warn("discontinuity sliding from playlist, take drift into account");for(var _=0;_<u.length;_++)u[_].cc+=b}t.skippedSegments&&(t.startCC=t.fragments[0].cc),h(i.partList,t.partList,function(M,L){L.elementaryStreams=M.elementaryStreams,L.stats=M.stats}),g?S(t,g,g.startPTS,g.endPTS,g.startDTS,g.endDTS):a(i,t),u.length&&(t.totalduration=t.edge-u[0].start),t.driftStartTime=i.driftStartTime,t.driftStart=i.driftStart;var y=t.advancedDateTime;if(t.advanced&&y){var T=t.edge;t.driftStart||(t.driftStartTime=y,t.driftStart=T),t.driftEndTime=y,t.driftEnd=T}else t.driftEndTime=i.driftEndTime,t.driftEnd=i.driftEnd,t.advancedDateTime=i.advancedDateTime}function h(i,t,v){if(i&&t)for(var f=0,p=0,E=i.length;p<=E;p++){var b=i[p],g=t[p+f];b&&g&&b.index===g.index&&b.fragment.sn===g.fragment.sn?v(b,g):f--}}function o(i,t,v){for(var f=t.skippedSegments,p=Math.max(i.startSN,t.startSN)-t.startSN,E=(i.fragmentHint?1:0)+(f?t.endSN:Math.min(i.endSN,t.endSN))-t.startSN,b=t.startSN-i.startSN,g=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,c=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments,m=p;m<=E;m++){var u=c[b+m],_=g[m];f&&!_&&m<f&&(_=t.fragments[m]=u),u&&_&&v(u,_)}}function a(i,t){var v=t.startSN+t.skippedSegments-i.startSN,f=i.fragments;if(v<0||v>=f.length)return;r(t,f[v].start)}function r(i,t){if(t){for(var v=i.fragments,f=i.skippedSegments;f<v.length;f++)v[f].start+=t;i.fragmentHint&&(i.fragmentHint.start+=t)}}function l(i,t){var v=1e3*i.levelTargetDuration,f=v/2,p=i.age,E=p>0&&p<v*3,b=t.loading.end-t.loading.start,g,c=i.availabilityDelay;if(i.updated===!1)if(E){var m=333*i.misses;g=Math.max(Math.min(f,b*2),m),i.availabilityDelay=(i.availabilityDelay||0)+g}else g=f;else E?(c=Math.min(c||v/2,p),i.availabilityDelay=c,g=c+v-p):g=v-b;return Math.round(g)}function s(i,t,v){if(!i||!i.details)return null;var f=i.details,p=f.fragments[t-f.startSN];return p||(p=f.fragmentHint,p&&p.sn===t?p:t<f.startSN&&v&&v.sn===t?v:null)}function n(i,t,v){if(!i||!i.details)return null;var f=i.details.partList;if(f)for(var p=f.length;p--;){var E=f[p];if(E.index===v&&E.fragment.sn===t)return E}return null}},"./src/controller/stream-controller.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return f});var k=O("./src/polyfills/number.ts"),w=O("./src/controller/base-stream-controller.ts"),R=O("./src/is-supported.ts"),H=O("./src/events.ts"),U=O("./src/utils/buffer-helper.ts"),e=O("./src/controller/fragment-tracker.ts"),S=O("./src/types/loader.ts"),d=O("./src/loader/fragment.ts"),h=O("./src/demux/transmuxer-interface.ts"),o=O("./src/types/transmuxer.ts"),a=O("./src/controller/gap-controller.ts"),r=O("./src/errors.ts"),l=O("./src/utils/logger.ts");function s(p,E){for(var b=0;b<E.length;b++){var g=E[b];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,g.key,g)}}function n(p,E,b){return E&&s(p.prototype,E),b&&s(p,b),p}function i(p,E){p.prototype=Object.create(E.prototype),p.prototype.constructor=p,t(p,E)}function t(p,E){return t=Object.setPrototypeOf||function(g,c){return g.__proto__=c,g},t(p,E)}var v=100,f=function(p){i(E,p);function E(g,c){var m;return m=p.call(this,g,c,"[stream-controller]")||this,m.audioCodecSwap=!1,m.gapController=null,m.level=-1,m._forceStartLoad=!1,m.altAudio=!1,m.audioOnly=!1,m.fragPlaying=null,m.onvplaying=null,m.onvseeked=null,m.fragLastKbps=0,m.stalled=!1,m.couldBacktrack=!1,m.audioCodecSwitch=!1,m.videoBuffer=null,m._registerListeners(),m}var b=E.prototype;return b._registerListeners=function(){var c=this.hls;c.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(H.Events.ERROR,this.onError,this),c.on(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var c=this.hls;c.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(H.Events.ERROR,this.onError,this),c.off(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(c){if(this.levels){var m=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(v),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var _=u.startLevel;_===-1&&(u.config.testBandwidth?(_=0,this.bitrateTest=!0):_=u.nextAutoLevel),this.level=u.nextLoadLevel=_,this.loadedmetadata=!1}m>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+m.toFixed(3)),c=m),this.state=w.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=w.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case w.State.IDLE:this.doTickIdle();break;case w.State.WAITING_LEVEL:{var c,m=this.levels,u=this.level,_=m==null||((c=m[u])===null||c===void 0)?void 0:c.details;if(_&&(!_.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(_))break;this.state=w.State.IDLE;break}break}case w.State.FRAG_LOADING_WAITING_RETRY:{var y,T=self.performance.now(),M=this.retryDate;(!M||T>=M||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=w.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var c,m,u=this.hls,_=this.levelLastLoaded,y=this.levels,T=this.media,M=u.config,L=u.nextLoadLevel;if(_===null||!T&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[L])return;var x=y[L];this.level=u.nextLoadLevel=L;var D=x.details;if(!D||this.state===w.State.WAITING_LEVEL||D.live&&this.levelLastLoaded!==L){this.state=w.State.WAITING_LEVEL;return}var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:T,S.PlaylistLevelType.MAIN);if(j===null)return;var I=j.len,W=this.getMaxBufferLength(x.maxBitrate);if(I>=W)return;if(this._streamEnded(j,D)){var Q={};this.altAudio&&(Q.type="video"),this.hls.trigger(H.Events.BUFFER_EOS,Q),this.state=w.State.ENDED;return}var fe=j.end,de=this.getNextFragment(fe,D);if(this.couldBacktrack&&!this.fragPrevious&&de&&de.sn!=="initSegment"){var Oe=de.sn-D.startSN;Oe>1&&(de=D.fragments[Oe-1],this.fragmentTracker.removeFragment(de))}if(de&&this.fragmentTracker.getState(de)===e.FragmentState.OK&&this.nextLoadPosition>fe){var Se=this.audioOnly&&!this.altAudio?d.ElementaryStreamTypes.AUDIO:d.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(T,Se,S.PlaylistLevelType.MAIN),de=this.getNextFragment(this.nextLoadPosition,D)}if(!de)return;de.initSegment&&!de.initSegment.data&&!this.bitrateTest&&(de=de.initSegment),((c=de.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((m=de.decryptdata)!==null&&m!==void 0&&m.key)?this.loadKey(de,D):this.loadFragment(de,D,fe)},b.loadFragment=function(c,m,u){var _,y=this.fragmentTracker.getState(c);if(this.fragCurrent=c,y===e.FragmentState.BACKTRACKED){var T=this.fragmentTracker.getBacktrackData(c);if(T){this._handleFragmentLoadProgress(T),this._handleFragmentLoadComplete(T);return}else y=e.FragmentState.NOT_LOADED}y===e.FragmentState.NOT_LOADED||y===e.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,p.prototype.loadFragment.call(this,c,m,u)):y===e.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((_=this.media)===null||_===void 0?void 0:_.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(c){var m=this.fragmentTracker.getAppendedFrag(c,S.PlaylistLevelType.MAIN);return m&&"fragment"in m?m.fragment:m},b.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,S.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var c=this.levels,m=this.media;if(m!=null&&m.readyState){var u,_=this.getAppendedFrag(m.currentTime);if(_&&_.start>1&&this.flushMainBuffer(0,_.start-1),!m.paused&&c){var y=this.hls.nextLoadLevel,T=c[y],M=this.fragLastKbps;M&&this.fragCurrent?u=this.fragCurrent.duration*T.maxBitrate/(1e3*M)+1:u=0}else u=0;var L=this.getBufferedFrag(m.currentTime+u);if(L){var x=this.followingBufferedFrag(L);if(x){this.abortCurrentFrag();var D=x.maxStartPTS?x.maxStartPTS:x.start,j=x.duration,I=Math.max(L.end,D+Math.min(Math.max(j-this.config.maxFragLookUpTolerance,j*.5),j*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===w.State.KEY_LOADING&&(this.state=w.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(c,m){p.prototype.flushMainBuffer.call(this,c,m,this.altAudio?"video":null)},b.onMediaAttached=function(c,m){p.prototype.onMediaAttached.call(this,c,m);var u=m.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),u.addEventListener("playing",this.onvplaying),u.addEventListener("seeked",this.onvseeked),this.gapController=new a.default(this.config,u,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),p.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var c=this.media,m=c?c.currentTime:null;Object(k.isFiniteNumber)(m)&&this.log("Media seeked to "+m.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(H.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(c,m){var u=!1,_=!1,y;m.levels.forEach(function(T){y=T.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(u=!0),y.indexOf("mp4a.40.5")!==-1&&(_=!0))}),this.audioCodecSwitch=u&&_&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=m.levels,this.startFragRequested=!1},b.onLevelLoading=function(c,m){var u=this.levels;if(!u||this.state!==w.State.IDLE)return;var _=u[m.level];(!_.details||_.details.live&&this.levelLastLoaded!==m.level||this.waitForCdnTuneIn(_.details))&&(this.state=w.State.WAITING_LEVEL)},b.onLevelLoaded=function(c,m){var u,_=this.levels,y=m.level,T=m.details,M=T.totalduration;if(!_){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+T.startSN+","+T.endSN+"], cc ["+T.startCC+", "+T.endCC+"] duration:"+M);var L=this.fragCurrent;L&&(this.state===w.State.FRAG_LOADING||this.state===w.State.FRAG_LOADING_WAITING_RETRY)&&(L.level!==m.level&&L.loader&&(this.state=w.State.IDLE,L.loader.abort()));var x=_[y],D=0;if(T.live||(u=x.details)!==null&&u!==void 0&&u.live){if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed)return;D=this.alignPlaylists(T,x.details)}if(x.details=T,this.levelLastLoaded=y,this.hls.trigger(H.Events.LEVEL_UPDATED,{details:T,level:y}),this.state===w.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(T))return;this.state=w.State.IDLE}this.startFragRequested?T.live&&this.synchronizeToLiveEdge(T):this.setStartPosition(T,D),this.tick()},b._handleFragmentLoadProgress=function(c){var m,u=c.frag,_=c.part,y=c.payload,T=this.levels;if(!T){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var M=T[u.level],L=M.details;if(!L){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var x=M.videoCodec,D=L.PTSKnown||!L.live,j=(m=u.initSegment)===null||m===void 0?void 0:m.data,I=this._getAudioCodec(M),W=this.transmuxer=this.transmuxer||new h.default(this.hls,S.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Q=_?_.index:-1,fe=Q!==-1,de=new o.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,y.byteLength,Q,fe),Oe=this.initPTS[u.cc];W.push(y,j,I,x,u,_,L.totalduration,D,de,Oe)},b.onAudioTrackSwitching=function(c,m){var u=this.altAudio,_=!!m.url,y=m.id;if(!_){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var T=this.fragCurrent;T!=null&&T.loader&&(this.log("Switching to main audio track, cancel main fragment load"),T.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;u&&M.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(H.Events.AUDIO_TRACK_SWITCHED,{id:y})}},b.onAudioTrackSwitched=function(c,m){var u=m.id,_=!!this.hls.audioTracks[u].url;if(_){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=_,this.tick()},b.onBufferCreated=function(c,m){var u=m.tracks,_,y,T=!1;for(var M in u){var L=u[M];if(L.id==="main"){if(y=M,_=L,M==="video"){var x=u[M];x&&(this.videoBuffer=x.buffer)}}else T=!0}T&&_?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=_.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(c,m){var u=m.frag,_=m.part;if(u&&u.type!==S.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(_?" p: "+_.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===w.State.PARSED&&(this.state=w.State.IDLE);return}var y=_?_.stats:u.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,_)},b.onError=function(c,m){switch(m.details){case r.ErrorDetails.FRAG_LOAD_ERROR:case r.ErrorDetails.FRAG_LOAD_TIMEOUT:case r.ErrorDetails.KEY_LOAD_ERROR:case r.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.MAIN,m);break;case r.ErrorDetails.LEVEL_LOAD_ERROR:case r.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==w.State.ERROR&&(m.fatal?(this.warn(""+m.details),this.state=w.State.ERROR):!m.levelRetry&&this.state===w.State.WAITING_LEVEL&&(this.state=w.State.IDLE));break;case r.ErrorDetails.BUFFER_FULL_ERROR:if(m.parent==="main"&&(this.state===w.State.PARSING||this.state===w.State.PARSED)){var u=!0,_=this.getFwdBufferInfo(this.media,S.PlaylistLevelType.MAIN);_&&_.len>.5&&(u=!this.reduceMaxBufferLength(_.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var c=this.media,m=this.gapController;if(!c||!m||!c.readyState)return;var u=U.BufferHelper.getBuffered(c);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):m.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=w.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(c,m){var u=m.type;if(u!==d.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var _=(u===d.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(_,u,S.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(c,m){this.levels=m.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var c=this.media,m=c.currentTime,u=this.startPosition;if(u>=0&&m<u){if(c.seeking){l.logger.log("could not seek to "+u+", already seeking at "+m);return}var _=U.BufferHelper.getBuffered(c),y=_.length?_.start(0):0,T=y-u;T>0&&(T<this.config.maxBufferHole||T<this.config.maxFragLookUpTolerance)&&(l.logger.log("adjusting start position by "+T+" to match buffer start"),u+=T,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+m),c.currentTime=u}},b._getAudioCodec=function(c){var m=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&m&&(this.log("Swapping audio codec"),m.indexOf("mp4a.40.5")!==-1?m="mp4a.40.2":m="mp4a.40.5"),m},b._loadBitrateTestFrag=function(c){var m=this;this._doFragLoad(c).then(function(u){var _=m.hls;if(!u||_.nextLoadLevel||m.fragContextChanged(c))return;m.fragLoadError=0,m.state=w.State.IDLE,m.startFragRequested=!1,m.bitrateTest=!1;var y=c.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),_.trigger(H.Events.FRAG_LOADED,u)})},b._handleTransmuxComplete=function(c){var m,u="main",_=this.hls,y=c.remuxResult,T=c.chunkMeta,M=this.getCurrentContext(T);if(!M){this.warn("The loading context changed while buffering fragment "+T.sn+" of level "+T.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(T.level);return}var L=M.frag,x=M.part,D=M.level,j=y.video,I=y.text,W=y.id3,Q=y.initSegment,fe=this.altAudio?void 0:y.audio;if(this.fragContextChanged(L))return;if(this.state=w.State.PARSING,Q){Q.tracks&&(this._bufferInitSegment(D,Q.tracks,L,T),_.trigger(H.Events.FRAG_PARSING_INIT_SEGMENT,{frag:L,id:u,tracks:Q.tracks}));var de=Q.initPTS,Oe=Q.timescale;Object(k.isFiniteNumber)(de)&&(this.initPTS[L.cc]=de,_.trigger(H.Events.INIT_PTS_FOUND,{frag:L,id:u,initPTS:de,timescale:Oe}))}if(j&&y.independent!==!1){if(D.details){var Se=j.startPTS,Ie=j.endPTS,Le=j.startDTS,Ne=j.endDTS;if(x)x.elementaryStreams[j.type]={startPTS:Se,endPTS:Ie,startDTS:Le,endDTS:Ne};else if(j.firstKeyFrame&&j.independent&&(this.couldBacktrack=!0),j.dropped&&j.independent){var be=this.getLoadPosition()+this.config.maxBufferHole;if(be<Se){this.backtrack(L);return}L.setElementaryStreamInfo(j.type,L.start,Ie,L.start,Ne,!0)}L.setElementaryStreamInfo(j.type,Se,Ie,Le,Ne),this.bufferFragmentData(j,L,x,T)}}else if(y.independent===!1){this.backtrack(L);return}if(fe){var N=fe.startPTS,A=fe.endPTS,C=fe.startDTS,F=fe.endDTS;x&&(x.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:N,endPTS:A,startDTS:C,endDTS:F}),L.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,N,A,C,F),this.bufferFragmentData(fe,L,x,T)}if(W!=null&&(m=W.samples)!==null&&m!==void 0&&m.length){var G={frag:L,id:u,samples:W.samples};_.trigger(H.Events.FRAG_PARSING_METADATA,G)}if(I){var P={frag:L,id:u,samples:I.samples};_.trigger(H.Events.FRAG_PARSING_USERDATA,P)}},b._bufferInitSegment=function(c,m,u,_){var y=this;if(this.state!==w.State.PARSING)return;this.audioOnly=!!m.audio&&!m.video,this.altAudio&&!this.audioOnly&&delete m.audio;var T=m.audio,M=m.video,L=m.audiovideo;if(T){var x=c.audioCodec,D=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(x&&(x.indexOf("mp4a.40.5")!==-1?x="mp4a.40.2":x="mp4a.40.5"),T.metadata.channelCount!==1&&D.indexOf("firefox")===-1&&(x="mp4a.40.5")),D.indexOf("android")!==-1&&T.container!=="audio/mpeg"&&(x="mp4a.40.2",this.log("Android: force audio codec to "+x)),c.audioCodec&&c.audioCodec!==x&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+x+'"'),T.levelCodec=x,T.id="main",this.log("Init audio buffer, container:"+T.container+", codecs[selected/level/parsed]=["+(x||"")+"/"+(c.audioCodec||"")+"/"+T.codec+"]")}M&&(M.levelCodec=c.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+M.codec+"]")),L&&this.log("Init audiovideo buffer, container:"+L.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+L.codec+"]"),this.hls.trigger(H.Events.BUFFER_CODECS,m),Object.keys(m).forEach(function(j){var I=m[j],W=I.initSegment;W!=null&&W.byteLength&&y.hls.trigger(H.Events.BUFFER_APPENDING,{type:j,data:W,frag:u,part:null,chunkMeta:_,parent:u.type})}),this.tick()},b.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var m=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,m?this.resetFragmentLoading(c):this.state=w.State.BACKTRACKING},b.checkFragmentChanged=function(){var c=this.media,m=null;if(c&&c.readyState>1&&c.seeking===!1){var u=c.currentTime;if(U.BufferHelper.isBuffered(c,u)?m=this.getAppendedFrag(u):U.BufferHelper.isBuffered(c,u+.1)&&(m=this.getAppendedFrag(u+.1)),m){var _=this.fragPlaying,y=m.level;(!_||m.sn!==_.sn||_.level!==y||m.urlId!==_.urlId)&&(this.hls.trigger(H.Events.FRAG_CHANGED,{frag:m}),(!_||_.level!==y)&&this.hls.trigger(H.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=m)}}},n(E,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var m=this.getAppendedFrag(c.currentTime);if(m)return m.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var m=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(m)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),E}(w.default)},"./src/controller/subtitle-stream-controller.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"SubtitleStreamController",function(){return i});var k=O("./src/events.ts"),w=O("./src/utils/logger.ts"),R=O("./src/utils/buffer-helper.ts"),H=O("./src/controller/fragment-finders.ts"),U=O("./src/utils/discontinuities.ts"),e=O("./src/controller/level-helper.ts"),S=O("./src/controller/fragment-tracker.ts"),d=O("./src/controller/base-stream-controller.ts"),h=O("./src/types/loader.ts"),o=O("./src/types/level.ts");function a(t,v){for(var f=0;f<v.length;f++){var p=v[f];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(t,p.key,p)}}function r(t,v,f){return v&&a(t.prototype,v),f&&a(t,f),t}function l(t,v){t.prototype=Object.create(v.prototype),t.prototype.constructor=t,s(t,v)}function s(t,v){return s=Object.setPrototypeOf||function(p,E){return p.__proto__=E,p},s(t,v)}var n=500,i=function(t){l(v,t);function v(p,E){var b;return b=t.call(this,p,E,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var f=v.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var E=this.hls;E.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(k.Events.ERROR,this.onError,this),E.on(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),E.on(k.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),E.on(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),E.on(k.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),E.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f._unregisterListeners=function(){var E=this.hls;E.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(k.Events.ERROR,this.onError,this),E.off(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),E.off(k.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),E.off(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),E.off(k.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),E.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f.startLoad=function(){this.stopLoad(),this.state=d.State.IDLE,this.setInterval(n),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(E,b){this.mainDetails=b.details},f.onSubtitleFragProcessed=function(E,b){var g=b.frag,c=b.success;if(this.fragPrevious=g,this.state=d.State.IDLE,!c)return;var m=this.tracksBuffered[this.currentTrackId];if(!m)return;for(var u,_=g.start,y=0;y<m.length;y++)if(_>=m[y].start&&_<=m[y].end){u=m[y];break}var T=g.start+g.duration;u?u.end=T:(u={start:_,end:T},m.push(u)),this.fragmentTracker.fragBuffered(g)},f.onBufferFlushing=function(E,b){var g=b.startOffset,c=b.endOffset;if(g===0&&c!==Number.POSITIVE_INFINITY){var m=this.currentTrackId,u=this.levels;if(!u.length||!u[m]||!u[m].details)return;var _=u[m].details,y=_.targetduration,T=c-y;if(T<=0)return;b.endOffsetSubtitles=Math.max(0,T),this.tracksBuffered.forEach(function(M){for(var L=0;L<M.length;){if(M[L].end<=T){M.shift();continue}else if(M[L].start<T)M[L].start=T;else break;L++}}),this.fragmentTracker.removeFragmentsInRange(g,T,h.PlaylistLevelType.SUBTITLE)}},f.onError=function(E,b){var g,c=b.frag;if(!c||c.type!==h.PlaylistLevelType.SUBTITLE)return;(g=this.fragCurrent)!==null&&g!==void 0&&g.loader&&this.fragCurrent.loader.abort(),this.state=d.State.IDLE},f.onSubtitleTracksUpdated=function(E,b){var g=this,c=b.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(m){return new o.Level(m)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(m){g.tracksBuffered[m.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(E,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var g=this.levels[this.currentTrackId];g!=null&&g.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,g&&this.setInterval(n)},f.onSubtitleTrackLoaded=function(E,b){var g,c=b.details,m=b.id,u=this.currentTrackId,_=this.levels;if(!_.length)return;var y=_[u];if(m>=_.length||m!==u||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(g=y.details)!==null&&g!==void 0&&g.live){var T=this.mainDetails;if(c.deltaUpdateFailed||!T)return;var M=T.fragments[0];if(!y.details)c.hasProgramDateTime&&T.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(c,T):M&&Object(e.addSliding)(c,M.start);else{var L=this.alignPlaylists(c,y.details);L===0&&M&&Object(e.addSliding)(c,M.start)}}if(y.details=c,this.levelLastLoaded=m,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===d.State.IDLE){var x=Object(H.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);x||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},f._handleFragmentLoadComplete=function(E){var b=E.frag,g=E.payload,c=b.decryptdata,m=this.hls;if(this.fragContextChanged(b))return;if(g&&g.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(g),c.key.buffer,c.iv.buffer).then(function(_){var y=performance.now();m.trigger(k.Events.FRAG_DECRYPTED,{frag:b,payload:_,stats:{tstart:u,tdecrypt:y}})})}},f.doTick=function(){if(!this.media){this.state=d.State.IDLE;return}if(this.state===d.State.IDLE){var E,b=this.currentTrackId,g=this.levels;if(!g.length||!g[b]||!g[b].details)return;var c=g[b].details,m=c.targetduration,u=this.config,_=this.media,y=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,_.currentTime-m,u.maxBufferHole),T=y.end,M=y.len,L=this.getMaxBufferLength()+m;if(M>L)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var x=c.fragments,D=x.length,j=c.edge,I,W=this.fragPrevious;if(T<j){var Q=u.maxFragLookUpTolerance;W&&c.hasProgramDateTime&&(I=Object(H.findFragmentByPDT)(x,W.endProgramDateTime,Q)),I||(I=Object(H.findFragmentByPTS)(W,x,T,Q),!I&&W&&W.start<x[0].start&&(I=x[0]))}else I=x[D-1];(E=I)!==null&&E!==void 0&&E.encrypted?(w.logger.log("Loading key for "+I.sn),this.state=d.State.KEY_LOADING,this.hls.trigger(k.Events.KEY_LOADING,{frag:I})):I&&this.fragmentTracker.getState(I)===S.FragmentState.NOT_LOADED&&this.loadFragment(I,c,T)}},f.loadFragment=function(E,b,g){this.fragCurrent=E,t.prototype.loadFragment.call(this,E,b,g)},r(v,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),v}(d.default)},"./src/controller/subtitle-track-controller.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/events.ts"),w=O("./src/utils/texttrack-utils.ts"),R=O("./src/controller/base-playlist-controller.ts"),H=O("./src/types/loader.ts");function U(a,r){for(var l=0;l<r.length;l++){var s=r[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(a,s.key,s)}}function e(a,r,l){return r&&U(a.prototype,r),l&&U(a,l),a}function S(a,r){a.prototype=Object.create(r.prototype),a.prototype.constructor=a,d(a,r)}function d(a,r){return d=Object.setPrototypeOf||function(s,n){return s.__proto__=n,s},d(a,r)}var h=function(a){S(r,a);function r(s){var n;return n=a.call(this,s,"[subtitle-track-controller]")||this,n.media=null,n.tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.selectDefaultTrack=!0,n.queuedDefaultTrack=-1,n.trackChangeListener=function(){return n.onTextTracksChanged()},n.asyncPollTrackChange=function(){return n.pollTrackChange(0)},n.useTextTrackPolling=!1,n.subtitlePollingInterval=-1,n.subtitleDisplay=!0,n.registerListeners(),n}var l=r.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 n=this.hls;n.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.on(k.Events.ERROR,this.onError,this)},l.unregisterListeners=function(){var n=this.hls;n.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.off(k.Events.ERROR,this.onError,this)},l.onMediaAttached=function(n,i){if(this.media=i.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(n){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,n)},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 n=o(this.media.textTracks);n.forEach(function(i){Object(w.clearCurrentCues)(i)}),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(n,i){this.tracks=i.subtitleTracks},l.onSubtitleTrackLoaded=function(n,i){var t=i.id,v=i.details,f=this.trackId,p=this.tracksInGroup[f];if(!p){this.warn("Invalid subtitle track id "+t);return}var E=p.details;p.details=i.details,this.log("subtitle track "+t+" loaded ["+v.startSN+"-"+v.endSN+"]"),t===this.trackId&&(this.retryCount=0,this.playlistLoaded(t,i,E))},l.onLevelLoading=function(n,i){this.switchLevel(i.level)},l.onLevelSwitching=function(n,i){this.switchLevel(i.level)},l.switchLevel=function(n){var i=this.hls.levels[n];if(!(i!=null&&i.textGroupIds))return;var t=i.textGroupIds[i.urlId];if(this.groupId!==t){var v=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(b){return!t||b.groupId===t});this.tracksInGroup=f;var p=this.findTrackId(v==null?void 0:v.name)||this.findTrackId();this.groupId=t;var E={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+t+'" group-id'),this.hls.trigger(k.Events.SUBTITLE_TRACKS_UPDATED,E),p!==-1&&this.setSubtitleTrack(p,v)}},l.findTrackId=function(n){for(var i=this.tracksInGroup,t=0;t<i.length;t++){var v=i[t];if((!this.selectDefaultTrack||v.default)&&(!n||n===v.name))return v.id}return-1},l.onError=function(n,i){if(a.prototype.onError.call(this,n,i),i.fatal||!i.context)return;i.context.type===H.PlaylistContextType.SUBTITLE_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},l.loadPlaylist=function(n){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var t=i.id,v=i.groupId,f=i.url;if(n)try{f=n.addDirectives(f)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+t),this.hls.trigger(k.Events.SUBTITLE_TRACK_LOADING,{url:f,id:t,groupId:v,deliveryDirectives:n||null})}},l.toggleTrackModes=function(n){var i=this,t=this.media,v=this.subtitleDisplay,f=this.trackId;if(!t)return;var p=o(t.textTracks),E=p.filter(function(c){return c.groupId===i.groupId});if(n===-1)[].slice.call(p).forEach(function(c){c.mode="disabled"});else{var b=E[f];b&&(b.mode="disabled")}var g=E[n];g&&(g.mode=v?"showing":"hidden")},l.setSubtitleTrack=function(n,i){var t,v=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=n;return}if(this.trackId!==n&&this.toggleTrackModes(n),this.trackId===n&&(n===-1||(t=v[n])!==null&&t!==void 0&&t.details)||n<-1||n>=v.length)return;this.clearTimer();var f=v[n];if(this.log("Switching to subtitle track "+n),this.trackId=n,f){var p=f.id,E=f.groupId,b=E===void 0?"":E,g=f.name,c=f.type,m=f.url;this.hls.trigger(k.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:b,name:g,type:c,url:m});var u=this.switchParams(f.url,i==null?void 0:i.details);this.loadPlaylist(u)}else this.hls.trigger(k.Events.SUBTITLE_TRACK_SWITCH,{id:n})},l.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var n=-1,i=o(this.media.textTracks),t=0;t<i.length;t++)if(i[t].mode==="hidden")n=t;else if(i[t].mode==="showing"){n=t;break}this.subtitleTrack!==n&&(this.subtitleTrack=n)},e(r,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(n){this.selectDefaultTrack=!1;var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(n,i)}}]),r}(R.default);function o(a){for(var r=[],l=0;l<a.length;l++){var s=a[l];s.kind==="subtitles"&&s.label&&r.push(a[l])}return r}B.default=h},"./src/controller/timeline-controller.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"TimelineController",function(){return o});var k=O("./src/polyfills/number.ts"),w=O("./src/events.ts"),R=O("./src/utils/cea-608-parser.ts"),H=O("./src/utils/output-filter.ts"),U=O("./src/utils/webvtt-parser.ts"),e=O("./src/utils/texttrack-utils.ts"),S=O("./src/utils/imsc1-ttml-parser.ts"),d=O("./src/types/loader.ts"),h=O("./src/utils/logger.ts"),o=function(){function s(i){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=i,this.config=i.config,this.Cues=i.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 t=new H.default(this,"textTrack1"),v=new H.default(this,"textTrack2"),f=new H.default(this,"textTrack3"),p=new H.default(this,"textTrack4");this.cea608Parser1=new R.default(1,t,v),this.cea608Parser2=new R.default(3,f,p)}i.on(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),i.on(w.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),i.on(w.Events.FRAG_LOADING,this.onFragLoading,this),i.on(w.Events.FRAG_LOADED,this.onFragLoaded,this),i.on(w.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),i.on(w.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),i.on(w.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.on(w.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),i.on(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var n=s.prototype;return n.destroy=function(){var t=this.hls;t.off(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(w.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(w.Events.FRAG_LOADING,this.onFragLoading,this),t.off(w.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(w.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(w.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(w.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(w.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},n.addCues=function(t,v,f,p,E){for(var b=!1,g=E.length;g--;){var c=E[g],m=r(c[0],c[1],v,f);if(m>=0&&(c[0]=Math.min(c[0],v),c[1]=Math.max(c[1],f),b=!0,m/(f-v)>.5))return}if(b||E.push([v,f]),this.config.renderTextTracksNatively){var u=this.captionsTracks[t];this.Cues.newCue(u,v,f,p)}else{var _=this.Cues.newCue(null,v,f,p);this.hls.trigger(w.Events.CUES_PARSED,{type:"captions",cues:_,track:t})}},n.onInitPtsFound=function(t,v){var f=this,p=v.frag,E=v.id,b=v.initPTS,g=v.timescale,c=this.unparsedVttFrags;E==="main"&&(this.initPTS[p.cc]=b,this.timescale[p.cc]=g),c.length&&(this.unparsedVttFrags=[],c.forEach(function(m){f.onFragLoaded(w.Events.FRAG_LOADED,m)}))},n.getExistingTrack=function(t){var v=this.media;if(v)for(var f=0;f<v.textTracks.length;f++){var p=v.textTracks[f];if(p[t])return p}return null},n.createCaptionsTrack=function(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)},n.createNativeTrack=function(t){if(this.captionsTracks[t])return;var v=this.captionsProperties,f=this.captionsTracks,p=this.media,E=v[t],b=E.label,g=E.languageCode,c=this.getExistingTrack(t);if(c)f[t]=c,Object(e.clearCurrentCues)(f[t]),Object(e.sendAddTrackEvent)(f[t],p);else{var m=this.createTextTrack("captions",b,g);m&&(m[t]=!0,f[t]=m)}},n.createNonNativeTrack=function(t){if(this.nonNativeCaptionsTracks[t])return;var v=this.captionsProperties[t];if(!v)return;var f=v.label,p={_id:t,label:f,kind:"captions",default:v.media?!!v.media.default:!1,closedCaptions:v.media};this.nonNativeCaptionsTracks[t]=p,this.hls.trigger(w.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},n.createTextTrack=function(t,v,f){var p=this.media;return p?p.addTextTrack(t,v,f):void 0},n.onMediaAttaching=function(t,v){this.media=v.media,this._cleanTracks()},n.onMediaDetaching=function(){var t=this.captionsTracks;Object.keys(t).forEach(function(v){Object(e.clearCurrentCues)(t[v]),delete t[v]}),this.nonNativeCaptionsTracks={}},n.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())},n._cleanTracks=function(){var t=this.media;if(!t)return;var v=t.textTracks;if(v)for(var f=0;f<v.length;f++)Object(e.clearCurrentCues)(v[f])},n.onSubtitleTracksUpdated=function(t,v){var f=this;this.textTracks=[];var p=v.subtitleTracks||[],E=p.some(function(m){return m.textCodec===S.IMSC1_CODEC});if(this.config.enableWebVTT||E&&this.config.enableIMSC1){var b=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var g=this.media?this.media.textTracks:[];this.tracks.forEach(function(m,u){var _;if(u<g.length){for(var y=null,T=0;T<g.length;T++)if(a(g[T],m)){y=g[T];break}y&&(_=y)}_?Object(e.clearCurrentCues)(_):(_=f.createTextTrack("subtitles",m.name,m.lang),_&&(_.mode="disabled")),_&&(_.groupId=m.groupId,f.textTracks.push(_))})}else if(!b&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(m){return{label:m.name,kind:m.type.toLowerCase(),default:m.default,subtitleTrack:m}});this.hls.trigger(w.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},n.onManifestLoaded=function(t,v){var f=this;this.config.enableCEA708Captions&&v.captions&&v.captions.forEach(function(p){var E=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!E)return;var b="textTrack"+E[1],g=f.captionsProperties[b];if(!g)return;g.label=p.name,p.lang&&(g.languageCode=p.lang),g.media=p})},n.onFragLoading=function(t,v){var f=this.cea608Parser1,p=this.cea608Parser2,E=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(f&&p))return;if(v.frag.type===d.PlaylistLevelType.MAIN){var g,c,m=v.frag.sn,u=(g=v==null||((c=v.part)===null||c===void 0)?void 0:c.index)!=null?g:-1;m===E+1||m===E&&u===b+1||(f.reset(),p.reset()),this.lastSn=m,this.lastPartIndex=u}},n.onFragLoaded=function(t,v){var f=v.frag,p=v.payload,E=this.initPTS,b=this.unparsedVttFrags;if(f.type===d.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(k.isFiniteNumber)(E[f.cc])){b.push(v),E.length&&this.hls.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var g=f.decryptdata;if(g==null||g.key==null||g.method!=="AES-128"){var c=this.tracks[f.level],m=this.vttCCs;m[f.cc]||(m[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),c&&c.textCodec===S.IMSC1_CODEC?this._parseIMSC1(f,p):this._parseVTTs(f,p,m)}}else this.hls.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},n._parseIMSC1=function(t,v){var f=this,p=this.hls;Object(S.parseIMSC1)(v,this.initPTS[t.cc],this.timescale[t.cc],function(E){f._appendCues(E,t.level),p.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})},function(E){h.logger.log("Failed to parse IMSC1: "+E),p.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:E})})},n._parseVTTs=function(t,v,f){var p=this,E=this.hls;Object(U.parseWebVTT)(v,this.initPTS[t.cc],this.timescale[t.cc],f,t.cc,t.start,function(b){p._appendCues(b,t.level),E.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})},function(b){p._fallbackToIMSC1(t,v),h.logger.log("Failed to parse VTT cue: "+b),E.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:b})})},n._fallbackToIMSC1=function(t,v){var f=this,p=this.tracks[t.level];p.textCodec||Object(S.parseIMSC1)(v,this.initPTS[t.cc],this.timescale[t.cc],function(){p.textCodec=S.IMSC1_CODEC,f._parseIMSC1(t,v)},function(){p.textCodec="wvtt"})},n._appendCues=function(t,v){var f=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[v];if(p.mode==="disabled")return;t.forEach(function(g){return Object(e.addCueToTrack)(p,g)})}else{var E=this.tracks[v],b=E.default?"default":"subtitles"+v;f.trigger(w.Events.CUES_PARSED,{type:"subtitles",cues:t,track:b})}},n.onFragDecrypted=function(t,v){var f=v.frag;if(f.type===d.PlaylistLevelType.SUBTITLE){if(!Object(k.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(v);return}this.onFragLoaded(w.Events.FRAG_LOADED,v)}},n.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},n.onFragParsingUserdata=function(t,v){var f=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(f&&p))return;for(var E=0;E<v.samples.length;E++){var b=v.samples[E].bytes;if(b){var g=this.extractCea608Data(b);f.addData(v.samples[E].pts,g[0]),p.addData(v.samples[E].pts,g[1])}}},n.onBufferFlushing=function(t,v){var f=v.startOffset,p=v.endOffset,E=v.endOffsetSubtitles,b=v.type,g=this.media;if(!g||g.currentTime<p)return;if(!b||b==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(u){return Object(e.removeCuesInRange)(c[u],f,p)})}if(this.config.renderTextTracksNatively&&(f===0&&E!==void 0)){var m=this.textTracks;Object.keys(m).forEach(function(u){return Object(e.removeCuesInRange)(m[u],f,E)})}},n.extractCea608Data=function(t){for(var v=t[0]&31,f=2,p=[[],[]],E=0;E<v;E++){var b=t[f++],g=127&t[f++],c=127&t[f++],m=(4&b)!==0,u=3&b;if(g===0&&c===0)continue;m&&((u===0||u===1)&&(p[u].push(g),p[u].push(c)))}return p},s}();function a(s,n){return s&&s.label===n.name&&!(s.textTrack1||s.textTrack2)}function r(s,n,i,t){return Math.min(n,t)-Math.max(s,i)}function l(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return k});var k=function(){function w(H,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=H,this.aesIV=U}var R=w.prototype;return R.decrypt=function(U,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,U)},w}()},"./src/crypt/aes-decryptor.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"removePadding",function(){return w}),O.d(B,"default",function(){return R});var k=O("./src/utils/typed-array.ts");function w(H){var U=H.byteLength,e=U&&new DataView(H.buffer).getUint8(U-1);return e?Object(k.sliceUint8)(H,0,U-e):H}var R=function(){function H(){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 U=H.prototype;return U.uint8ArrayToUint32Array_=function(S){for(var d=new DataView(S),h=new Uint32Array(4),o=0;o<4;o++)h[o]=d.getUint32(o*4);return h},U.initTable=function(){var S=this.sBox,d=this.invSBox,h=this.subMix,o=h[0],a=h[1],r=h[2],l=h[3],s=this.invSubMix,n=s[0],i=s[1],t=s[2],v=s[3],f=new Uint32Array(256),p=0,E=0,b=0;for(b=0;b<256;b++)b<128?f[b]=b<<1:f[b]=b<<1^283;for(b=0;b<256;b++){var g=E^E<<1^E<<2^E<<3^E<<4;g=g>>>8^g&255^99,S[p]=g,d[g]=p;var c=f[p],m=f[c],u=f[m],_=f[g]*257^g*16843008;o[p]=_<<24|_>>>8,a[p]=_<<16|_>>>16,r[p]=_<<8|_>>>24,l[p]=_,_=u*16843009^m*65537^c*257^p*16843008,n[g]=_<<24|_>>>8,i[g]=_<<16|_>>>16,t[g]=_<<8|_>>>24,v[g]=_,p?(p=c^f[f[f[u^c]]],E^=f[f[E]]):p=E=1}},U.expandKey=function(S){for(var d=this.uint8ArrayToUint32Array_(S),h=!0,o=0;o<d.length&&h;)h=d[o]===this.key[o],o++;if(h)return;this.key=d;var a=this.keySize=d.length;if(a!==4&&a!==6&&a!==8)throw new Error("Invalid aes key size="+a);var r=this.ksRows=(a+6+1)*4,l,s,n=this.keySchedule=new Uint32Array(r),i=this.invKeySchedule=new Uint32Array(r),t=this.sBox,v=this.rcon,f=this.invSubMix,p=f[0],E=f[1],b=f[2],g=f[3],c,m;for(l=0;l<r;l++){if(l<a){c=n[l]=d[l];continue}m=c,l%a===0?(m=m<<8|m>>>24,m=t[m>>>24]<<24|t[m>>>16&255]<<16|t[m>>>8&255]<<8|t[m&255],m^=v[l/a|0]<<24):a>6&&l%a===4&&(m=t[m>>>24]<<24|t[m>>>16&255]<<16|t[m>>>8&255]<<8|t[m&255]),n[l]=c=(n[l-a]^m)>>>0}for(s=0;s<r;s++)l=r-s,s&3?m=n[l]:m=n[l-4],s<4||l<=4?i[s]=m:i[s]=p[t[m>>>24]]^E[t[m>>>16&255]]^b[t[m>>>8&255]]^g[t[m&255]],i[s]=i[s]>>>0},U.networkToHostOrderSwap=function(S){return S<<24|(S&65280)<<8|(S&16711680)>>8|S>>>24},U.decrypt=function(S,d,h){for(var o=this.keySize+6,a=this.invKeySchedule,r=this.invSBox,l=this.invSubMix,s=l[0],n=l[1],i=l[2],t=l[3],v=this.uint8ArrayToUint32Array_(h),f=v[0],p=v[1],E=v[2],b=v[3],g=new Int32Array(S),c=new Int32Array(g.length),m,u,_,y,T,M,L,x,D,j,I,W,Q,fe,de=this.networkToHostOrderSwap;d<g.length;){for(D=de(g[d]),j=de(g[d+1]),I=de(g[d+2]),W=de(g[d+3]),T=D^a[0],M=W^a[1],L=I^a[2],x=j^a[3],Q=4,fe=1;fe<o;fe++)m=s[T>>>24]^n[M>>16&255]^i[L>>8&255]^t[x&255]^a[Q],u=s[M>>>24]^n[L>>16&255]^i[x>>8&255]^t[T&255]^a[Q+1],_=s[L>>>24]^n[x>>16&255]^i[T>>8&255]^t[M&255]^a[Q+2],y=s[x>>>24]^n[T>>16&255]^i[M>>8&255]^t[L&255]^a[Q+3],T=m,M=u,L=_,x=y,Q=Q+4;m=r[T>>>24]<<24^r[M>>16&255]<<16^r[L>>8&255]<<8^r[x&255]^a[Q],u=r[M>>>24]<<24^r[L>>16&255]<<16^r[x>>8&255]<<8^r[T&255]^a[Q+1],_=r[L>>>24]<<24^r[x>>16&255]<<16^r[T>>8&255]<<8^r[M&255]^a[Q+2],y=r[x>>>24]<<24^r[T>>16&255]<<16^r[M>>8&255]<<8^r[L&255]^a[Q+3],c[d]=de(m^f),c[d+1]=de(y^p),c[d+2]=de(_^E),c[d+3]=de(u^b),f=D,p=j,E=I,b=W,d=d+4}return c.buffer},H}()},"./src/crypt/decrypter.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return d});var k=O("./src/crypt/aes-crypto.ts"),w=O("./src/crypt/fast-aes-key.ts"),R=O("./src/crypt/aes-decryptor.ts"),H=O("./src/utils/logger.ts"),U=O("./src/utils/mp4-tools.ts"),e=O("./src/utils/typed-array.ts"),S=16,d=function(){function h(a,r,l){var s=l===void 0?{}:l,n=s.removePKCS7Padding,i=n===void 0?!0:n;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=r,this.removePKCS7Padding=i,i)try{var t=self.crypto;t&&(this.subtle=t.subtle||t.webkitSubtle)}catch(v){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var o=h.prototype;return o.destroy=function(){this.observer=null},o.isSync=function(){return this.config.enableSoftwareAES},o.flush=function(){var r=this.currentResult;if(!r){this.reset();return}var l=new Uint8Array(r);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(l):l},o.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},o.decrypt=function(r,l,s,n){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(r),l,s);var i=this.flush();i&&n(i.buffer)}else this.webCryptoDecrypt(new Uint8Array(r),l,s).then(n)},o.softwareDecrypt=function(r,l,s){var n=this.currentIV,i=this.currentResult,t=this.remainderData;this.logOnce("JS AES decrypt"),t&&(r=Object(U.appendUint8Array)(t,r),this.remainderData=null);var v=this.getValidChunk(r);if(!v.length)return null;n&&(s=n);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new R.default),f.expandKey(l);var p=i;return this.currentResult=f.decrypt(v.buffer,0,s),this.currentIV=Object(e.sliceUint8)(v,-16).buffer,p||null},o.webCryptoDecrypt=function(r,l,s){var n=this,i=this.subtle;return(this.key!==l||!this.fastAesKey)&&(this.key=l,this.fastAesKey=new w.default(i,l)),this.fastAesKey.expandKey().then(function(t){if(!i)return Promise.reject(new Error("web crypto not initialized"));var v=new k.default(i,s);return v.decrypt(r.buffer,t)}).catch(function(t){return n.onWebCryptoError(t,r,l,s)})},o.onWebCryptoError=function(r,l,s,n){return H.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",r),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(l,s,n)},o.getValidChunk=function(r){var l=r,s=r.length-r.length%S;return s!==r.length&&(l=Object(e.sliceUint8)(r,0,s),this.remainderData=Object(e.sliceUint8)(r,s)),l},o.logOnce=function(r){if(!this.logEnabled)return;H.logger.log("[decrypter.ts]: "+r),this.logEnabled=!1},h}()},"./src/crypt/fast-aes-key.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return k});var k=function(){function w(H,U){this.subtle=void 0,this.key=void 0,this.subtle=H,this.key=U}var R=w.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},w}()},"./src/demux/aacdemuxer.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/demux/base-audio-demuxer.ts"),w=O("./src/demux/adts.ts"),R=O("./src/utils/logger.ts"),H=O("./src/demux/id3.ts");function U(d,h){d.prototype=Object.create(h.prototype),d.prototype.constructor=d,e(d,h)}function e(d,h){return e=Object.setPrototypeOf||function(a,r){return a.__proto__=r,a},e(d,h)}var S=function(d){U(h,d);function h(a,r){var l;return l=d.call(this)||this,l.observer=void 0,l.config=void 0,l.observer=a,l.config=r,l}var o=h.prototype;return o.resetInitSegment=function(r,l,s){d.prototype.resetInitSegment.call(this,r,l,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:r,duration:s,inputTimeScale:9e4,dropped:0}},h.probe=function(r){if(!r)return!1;for(var l=H.getID3Data(r,0)||[],s=l.length,n=r.length;s<n;s++)if(w.probe(r,s))return R.logger.log("ADTS sync word found !"),!0;return!1},o.canParse=function(r,l){return w.canParse(r,l)},o.appendFrame=function(r,l,s){w.initTrackConfig(r,this.observer,l,s,r.manifestCodec);var n=w.appendFrame(r,l,s,this.initPTS,this.frameIndex);if(n&&n.missing===0)return n},h}(k.default);S.minProbeByteLength=9,B.default=S},"./src/demux/adts.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"getAudioConfig",function(){return H}),O.d(B,"isHeaderPattern",function(){return U}),O.d(B,"getHeaderLength",function(){return e}),O.d(B,"getFullFrameLength",function(){return S}),O.d(B,"canGetFrameLength",function(){return d}),O.d(B,"isHeader",function(){return h}),O.d(B,"canParse",function(){return o}),O.d(B,"probe",function(){return a}),O.d(B,"initTrackConfig",function(){return r}),O.d(B,"getFrameDuration",function(){return l}),O.d(B,"parseFrameHeader",function(){return s}),O.d(B,"appendFrame",function(){return n});var k=O("./src/utils/logger.ts"),w=O("./src/errors.ts"),R=O("./src/events.ts");function H(i,t,v,f){var p,E,b,g,c=navigator.userAgent.toLowerCase(),m=f,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((t[v+2]&192)>>>6)+1;var _=(t[v+2]&60)>>>2;if(_>u.length-1){i.trigger(R.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+_});return}return b=(t[v+2]&1)<<2,b|=(t[v+3]&192)>>>6,k.logger.log("manifest codec:"+f+", ADTS type:"+p+", samplingIndex:"+_),/firefox/i.test(c)?_>=6?(p=5,g=new Array(4),E=_-3):(p=2,g=new Array(2),E=_):c.indexOf("android")!==-1?(p=2,g=new Array(2),E=_):(p=5,g=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&_>=6?E=_-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(_>=6&&b===1||/vivaldi/i.test(c))||!f&&b===1)&&(p=2,g=new Array(2)),E=_)),g[0]=p<<3,g[0]|=(_&14)>>1,g[1]|=(_&1)<<7,g[1]|=b<<3,p===5&&(g[1]|=(E&14)>>1,g[2]=(E&1)<<7,g[2]|=2<<2,g[3]=0),{config:g,samplerate:u[_],channelCount:b,codec:"mp4a.40."+p,manifestCodec:m}}function U(i,t){return i[t]===255&&(i[t+1]&246)===240}function e(i,t){return i[t+1]&1?7:9}function S(i,t){return(i[t+3]&3)<<11|i[t+4]<<3|(i[t+5]&224)>>>5}function d(i,t){return t+5<i.length}function h(i,t){return t+1<i.length&&U(i,t)}function o(i,t){return d(i,t)&&U(i,t)&&S(i,t)<=i.length-t}function a(i,t){if(h(i,t)){var v=e(i,t);if(t+v>=i.length)return!1;var f=S(i,t);if(f<=v)return!1;var p=t+f;return p===i.length||h(i,p)}return!1}function r(i,t,v,f,p){if(!i.samplerate){var E=H(t,v,f,p);if(!E)return;i.config=E.config,i.samplerate=E.samplerate,i.channelCount=E.channelCount,i.codec=E.codec,i.manifestCodec=E.manifestCodec,k.logger.log("parsed codec:"+i.codec+", rate:"+E.samplerate+", channels:"+E.channelCount)}}function l(i){return 1024*9e4/i}function s(i,t,v,f,p){var E=e(i,t),b=S(i,t);if(b-=E,b>0){var g=v+f*p;return{headerLength:E,frameLength:b,stamp:g}}}function n(i,t,v,f,p){var E=l(i.samplerate),b=s(t,v,f,p,E);if(b){var g=b.frameLength,c=b.headerLength,m=b.stamp,u=c+g,_=Math.max(0,v+u-t.length),y;_?(y=new Uint8Array(u-c),y.set(t.subarray(v+c,t.length),0)):y=t.subarray(v+c,v+u);var T={unit:y,pts:m};return _||i.samples.push(T),{sample:T,length:u,missing:_}}}},"./src/demux/base-audio-demuxer.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"initPTSFn",function(){return S});var k=O("./src/polyfills/number.ts"),w=O("./src/demux/id3.ts"),R=O("./src/demux/dummy-demuxed-track.ts"),H=O("./src/utils/mp4-tools.ts"),U=O("./src/utils/typed-array.ts"),e=function(){function d(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var h=d.prototype;return h.resetInitSegment=function(a,r,l){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},h.resetTimeStamp=function(){},h.resetContiguity=function(){},h.canParse=function(a,r){return!1},h.appendFrame=function(a,r,l){},h.demux=function(a,r){this.cachedData&&(a=Object(H.appendUint8Array)(this.cachedData,a),this.cachedData=null);var l=w.getID3Data(a,0),s=l?l.length:0,n,i,t=this._audioTrack,v=this._id3Track,f=l?w.getTimeStamp(l):void 0,p=a.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=S(f,r)),l&&l.length>0&&v.samples.push({pts:this.initPTS,dts:this.initPTS,data:l}),i=this.initPTS;s<p;){if(this.canParse(a,s)){var E=this.appendFrame(t,a,s);E?(this.frameIndex++,i=E.sample.pts,s+=E.length,n=s):s=p}else w.canParse(a,s)?(l=w.getID3Data(a,s),v.samples.push({pts:i,dts:i,data:l}),s+=l.length,n=s):s++;if(s===p&&n!==p){var b=Object(U.sliceUint8)(a,n);this.cachedData?this.cachedData=Object(H.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:t,avcTrack:Object(R.dummyTrack)(),id3Track:v,textTrack:Object(R.dummyTrack)()}},h.demuxSampleAes=function(a,r,l){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},h.flush=function(a){var r=this.cachedData;return r&&(this.cachedData=null,this.demux(r,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},h.destroy=function(){},d}(),S=function(h,o){return Object(k.isFiniteNumber)(h)?h*90:o*9e4};B.default=e},"./src/demux/chunk-cache.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return k});var k=function(){function R(){this.chunks=[],this.dataLength=0}var H=R.prototype;return H.push=function(e){this.chunks.push(e),this.dataLength+=e.length},H.flush=function(){var e=this.chunks,S=this.dataLength,d;if(e.length)e.length===1?d=e[0]:d=w(e,S);else return new Uint8Array(0);return this.reset(),d},H.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function w(R,H){for(var U=new Uint8Array(H),e=0,S=0;S<R.length;S++){var d=R[S];U.set(d,e),e+=d.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"dummyTrack",function(){return k});function k(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/utils/logger.ts"),w=function(){function R(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var H=R.prototype;return H.loadWord=function(){var e=this.data,S=this.bytesAvailable,d=e.byteLength-S,h=new Uint8Array(4),o=Math.min(4,S);if(o===0)throw new Error("no bytes available");h.set(e.subarray(d,d+o)),this.word=new DataView(h.buffer).getUint32(0),this.bitsAvailable=o*8,this.bytesAvailable-=o},H.skipBits=function(e){var S;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,S=e>>3,e-=S>>3,this.bytesAvailable-=S,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},H.readBits=function(e){var S=Math.min(this.bitsAvailable,e),d=this.word>>>32-S;return e>32&&k.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=e-S,S>0&&this.bitsAvailable?d<<S|this.readBits(S):d},H.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},H.skipUEG=function(){this.skipBits(1+this.skipLZ())},H.skipEG=function(){this.skipBits(1+this.skipLZ())},H.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},H.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},H.readBoolean=function(){return this.readBits(1)===1},H.readUByte=function(){return this.readBits(8)},H.readUShort=function(){return this.readBits(16)},H.readUInt=function(){return this.readBits(32)},H.skipScalingList=function(e){for(var S=8,d=8,h,o=0;o<e;o++)d!==0&&(h=this.readEG(),d=(S+h+256)%256),S=d===0?S:d},H.readSPS=function(){var e=0,S=0,d=0,h=0,o,a,r,l=this.readUByte.bind(this),s=this.readBits.bind(this),n=this.readUEG.bind(this),i=this.readBoolean.bind(this),t=this.skipBits.bind(this),v=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);l();var E=l();if(s(5),t(3),l(),f(),E===100||E===110||E===122||E===244||E===44||E===83||E===86||E===118||E===128){var b=n();if(b===3&&t(1),f(),f(),t(1),i())for(a=b!==3?8:12,r=0;r<a;r++)i()&&(r<6?p(16):p(64))}f();var g=n();if(g===0)n();else if(g===1)for(t(1),v(),v(),o=n(),r=0;r<o;r++)v();f(),t(1);var c=n(),m=n(),u=s(1);u===0&&t(1),t(1),i()&&(e=n(),S=n(),d=n(),h=n());var _=[1,1];if(i()&&i()){var y=l();switch(y){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:{_=[l()<<8|l(),l()<<8|l()];break}}}return{width:Math.ceil((c+1)*16-e*2-S*2),height:(2-u)*(m+1)*16-(u?2:4)*(d+h),pixelRatio:_}},H.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();B.default=w},"./src/demux/id3.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"isHeader",function(){return k}),O.d(B,"isFooter",function(){return w}),O.d(B,"getID3Data",function(){return R}),O.d(B,"canParse",function(){return U}),O.d(B,"getTimeStamp",function(){return e}),O.d(B,"isTimeStampFrame",function(){return S}),O.d(B,"getID3Frames",function(){return h}),O.d(B,"decodeFrame",function(){return o}),O.d(B,"utf8ArrayToStr",function(){return n}),O.d(B,"testables",function(){return i});var k=function(p,E){return E+10<=p.length&&(p[E]===73&&p[E+1]===68&&p[E+2]===51&&(p[E+3]<255&&p[E+4]<255&&(p[E+6]<128&&p[E+7]<128&&p[E+8]<128&&p[E+9]<128)))},w=function(p,E){return E+10<=p.length&&(p[E]===51&&p[E+1]===68&&p[E+2]===73&&(p[E+3]<255&&p[E+4]<255&&(p[E+6]<128&&p[E+7]<128&&p[E+8]<128&&p[E+9]<128)))},R=function(p,E){for(var b=E,g=0;k(p,E);){g+=10;var c=H(p,E+6);g+=c,w(p,E+10)&&(g+=10),E+=g}return g>0?p.subarray(b,b+g):void 0},H=function(p,E){var b=0;return b=(p[E]&127)<<21,b|=(p[E+1]&127)<<14,b|=(p[E+2]&127)<<7,b|=p[E+3]&127,b},U=function(p,E){return k(p,E)&&H(p,E+6)+10<=p.length-E},e=function(p){for(var E=h(p),b=0;b<E.length;b++){var g=E[b];if(S(g))return s(g)}return},S=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},d=function(p){var E=String.fromCharCode(p[0],p[1],p[2],p[3]),b=H(p,4),g=10;return{type:E,size:b,data:p.subarray(g,g+b)}},h=function(p){for(var E=0,b=[];k(p,E);){var g=H(p,E+6);E+=10;for(var c=E+g;E+8<c;){var m=d(p.subarray(E)),u=o(m);u&&b.push(u),E+=m.size+10}w(p,E)&&(E+=10)}return b},o=function(p){return p.type==="PRIV"?a(p):p.type[0]==="W"?l(p):r(p)},a=function(p){if(p.size<2)return;var E=n(p.data,!0),b=new Uint8Array(p.data.subarray(E.length+1));return{key:p.type,info:E,data:b.buffer}},r=function(p){if(p.size<2)return;if(p.type==="TXXX"){var E=1,b=n(p.data.subarray(E),!0);E+=b.length+1;var g=n(p.data.subarray(E));return{key:p.type,info:b,data:g}}var c=n(p.data.subarray(1));return{key:p.type,data:c}},l=function(p){if(p.type==="WXXX"){if(p.size<2)return;var E=1,b=n(p.data.subarray(E),!0);E+=b.length+1;var g=n(p.data.subarray(E));return{key:p.type,info:b,data:g}}var c=n(p.data);return{key:p.type,data:c}},s=function(p){if(p.data.byteLength===8){var E=new Uint8Array(p.data),b=E[3]&1,g=(E[4]<<23)+(E[5]<<15)+(E[6]<<7)+E[7];return g/=45,b&&(g+=4772185884e-2),Math.round(g)}return},n=function(p,E){E===void 0&&(E=!1);var b=v();if(b){var g=b.decode(p);if(E){var c=g.indexOf("\0");return c!==-1?g.substring(0,c):g}return g.replace(/\0/g,"")}for(var m=p.length,u,_,y,T="",M=0;M<m;){if(u=p[M++],u===0&&E)return T;if(u===0||u===3)continue;switch(u>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:T+=String.fromCharCode(u);break;case 12:case 13:_=p[M++],T+=String.fromCharCode((u&31)<<6|_&63);break;case 14:_=p[M++],y=p[M++],T+=String.fromCharCode((u&15)<<12|(_&63)<<6|(y&63)<<0);break;default:}}return T},i={decodeTextFrame:r},t;function v(){return!t&&typeof self.TextDecoder!="undefined"&&(t=new self.TextDecoder("utf-8")),t}},"./src/demux/mp3demuxer.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/demux/base-audio-demuxer.ts"),w=O("./src/demux/id3.ts"),R=O("./src/utils/logger.ts"),H=O("./src/demux/mpegaudio.ts");function U(d,h){d.prototype=Object.create(h.prototype),d.prototype.constructor=d,e(d,h)}function e(d,h){return e=Object.setPrototypeOf||function(a,r){return a.__proto__=r,a},e(d,h)}var S=function(d){U(h,d);function h(){return d.apply(this,arguments)||this}var o=h.prototype;return o.resetInitSegment=function(r,l,s){d.prototype.resetInitSegment.call(this,r,l,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:r,duration:s,inputTimeScale:9e4,dropped:0}},h.probe=function(r){if(!r)return!1;for(var l=w.getID3Data(r,0)||[],s=l.length,n=r.length;s<n;s++)if(H.probe(r,s))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},o.canParse=function(r,l){return H.canParse(r,l)},o.appendFrame=function(r,l,s){return this.initPTS===null?void 0:H.appendFrame(r,l,s,this.initPTS,this.frameIndex)},h}(k.default);S.minProbeByteLength=4,B.default=S},"./src/demux/mp4demuxer.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/utils/mp4-tools.ts"),w=O("./src/demux/dummy-demuxed-track.ts"),R=function(){function H(e,S){this.remainderData=null,this.config=void 0,this.config=S}var U=H.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},H.probe=function(S){return Object(k.findBox)({data:S,start:0,end:Math.min(S.length,16384)},["moof"]).length>0},U.demux=function(S){var d=S,h=Object(w.dummyTrack)();if(this.config.progressive){this.remainderData&&(d=Object(k.appendUint8Array)(this.remainderData,S));var o=Object(k.segmentValidRange)(d);this.remainderData=o.remainder,h.samples=o.valid||new Uint8Array}else h.samples=d;return{audioTrack:Object(w.dummyTrack)(),avcTrack:h,id3Track:Object(w.dummyTrack)(),textTrack:Object(w.dummyTrack)()}},U.flush=function(){var S=Object(w.dummyTrack)();return S.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(w.dummyTrack)(),avcTrack:S,id3Track:Object(w.dummyTrack)(),textTrack:Object(w.dummyTrack)()}},U.demuxSampleAes=function(S,d,h){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},H}();R.minProbeByteLength=1024,B.default=R},"./src/demux/mpegaudio.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"appendFrame",function(){return e}),O.d(B,"parseHeader",function(){return S}),O.d(B,"isHeaderPattern",function(){return d}),O.d(B,"isHeader",function(){return h}),O.d(B,"canParse",function(){return o}),O.d(B,"probe",function(){return a});var k=null,w=[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],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],H=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function e(r,l,s,n,i){if(s+24>l.length)return;var t=S(l,s);if(t&&s+t.frameLength<=l.length){var v=t.samplesPerFrame*9e4/t.sampleRate,f=n+i*v,p={unit:l.subarray(s,s+t.frameLength),pts:f,dts:f};return r.config=[],r.channelCount=t.channelCount,r.samplerate=t.sampleRate,r.samples.push(p),{sample:p,length:t.frameLength,missing:0}}}function S(r,l){var s=r[l+1]>>3&3,n=r[l+1]>>1&3,i=r[l+2]>>4&15,t=r[l+2]>>2&3;if(s!==1&&i!==0&&i!==15&&t!==3){var v=r[l+2]>>1&1,f=r[l+3]>>6,p=s===3?3-n:n===3?3:4,E=w[p*14+i-1]*1e3,b=s===3?0:s===2?1:2,g=R[b*3+t],c=f===3?1:2,m=H[s][n],u=U[n],_=m*8*u,y=Math.floor(m*E/g+v)*u;if(k===null){var T=navigator.userAgent||"",M=T.match(/Chrome\/(\d+)/i);k=M?parseInt(M[1]):0}var L=!!k&&k<=87;return L&&n===2&&E>=224e3&&f===0&&(r[l+3]=r[l+3]|128),{sampleRate:g,channelCount:c,frameLength:y,samplesPerFrame:_}}}function d(r,l){return r[l]===255&&(r[l+1]&224)===224&&(r[l+1]&6)!==0}function h(r,l){return l+1<r.length&&d(r,l)}function o(r,l){var s=4;return d(r,l)&&s<=r.length-l}function a(r,l){if(l+1<r.length&&d(r,l)){var s=4,n=S(r,l),i=s;n!=null&&n.frameLength&&(i=n.frameLength);var t=l+i;return t===r.length||h(r,t)}return!1}},"./src/demux/sample-aes.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/crypt/decrypter.ts"),w=O("./src/demux/tsdemuxer.ts"),R=function(){function H(e,S,d){this.keyData=void 0,this.decrypter=void 0,this.keyData=d,this.decrypter=new k.default(e,S,{removePKCS7Padding:!1})}var U=H.prototype;return U.decryptBuffer=function(S,d){this.decrypter.decrypt(S,this.keyData.key.buffer,this.keyData.iv.buffer,d)},U.decryptAacSample=function(S,d,h,o){var a=S[d].unit,r=a.subarray(16,a.length-a.length%16),l=r.buffer.slice(r.byteOffset,r.byteOffset+r.length),s=this;this.decryptBuffer(l,function(n){var i=new Uint8Array(n);a.set(i,16),o||s.decryptAacSamples(S,d+1,h)})},U.decryptAacSamples=function(S,d,h){for(;;d++){if(d>=S.length){h();return}if(S[d].unit.length<32)continue;var o=this.decrypter.isSync();if(this.decryptAacSample(S,d,h,o),!o)return}},U.getAvcEncryptedData=function(S){for(var d=Math.floor((S.length-48)/160)*16+16,h=new Int8Array(d),o=0,a=32;a<=S.length-16;a+=160,o+=16)h.set(S.subarray(a,a+16),o);return h},U.getAvcDecryptedUnit=function(S,d){for(var h=new Uint8Array(d),o=0,a=32;a<=S.length-16;a+=160,o+=16)S.set(h.subarray(o,o+16),a);return S},U.decryptAvcSample=function(S,d,h,o,a,r){var l=Object(w.discardEPB)(a.data),s=this.getAvcEncryptedData(l),n=this;this.decryptBuffer(s.buffer,function(i){a.data=n.getAvcDecryptedUnit(l,i),r||n.decryptAvcSamples(S,d,h+1,o)})},U.decryptAvcSamples=function(S,d,h,o){if(S instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;d++,h=0){if(d>=S.length){o();return}for(var a=S[d].units;!(h>=a.length);h++){var r=a[h];if(r.data.length<=48||r.type!==1&&r.type!==5)continue;var l=this.decrypter.isSync();if(this.decryptAvcSample(S,d,h,o,r,l),!l)return}}},H}();B.default=R},"./src/demux/transmuxer-interface.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return a});var k=O("./node_modules/webworkify-webpack/index.js"),w=O.n(k),R=O("./src/events.ts"),H=O("./src/demux/transmuxer.ts"),U=O("./src/utils/logger.ts"),e=O("./src/errors.ts"),S=O("./src/utils/mediasource-helper.ts"),d=O("./node_modules/eventemitter3/index.js"),h=O.n(d),o=Object(S.getMediaSource)()||{isTypeSupported:function(){return!1}},a=function(){function r(s,n,i,t){var v=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=n,this.onTransmuxComplete=i,this.onFlush=t;var f=s.config,p=function(m,u){u=u||{},u.frag=v.frag,u.id=v.id,s.trigger(m,u)};this.observer=new d.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,p),this.observer.on(R.Events.ERROR,p);var E={mp4:o.isTypeSupported("video/mp4"),mpeg:o.isTypeSupported("audio/mpeg"),mp3:o.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var g;try{g=this.worker=k("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),g.addEventListener("message",this.onwmsg),g.onerror=function(c){s.trigger(R.Events.ERROR,{type:e.ErrorTypes.OTHER_ERROR,details:e.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},g.postMessage({cmd:"init",typeSupported:E,vendor:b,id:n,config:JSON.stringify(f)})}catch(c){U.logger.warn("Error in worker:",c),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),g&&self.URL.revokeObjectURL(g.objectURL),this.transmuxer=new H.default(this.observer,E,f,b,n),this.worker=null}}else this.transmuxer=new H.default(this.observer,E,f,b,n)}var l=r.prototype;return l.destroy=function(){var n=this.worker;if(n)n.removeEventListener("message",this.onwmsg),n.terminate(),this.worker=null;else{var i=this.transmuxer;i&&(i.destroy(),this.transmuxer=null)}var t=this.observer;t&&t.removeAllListeners(),this.observer=null},l.push=function(n,i,t,v,f,p,E,b,g,c){var m=this;g.transmuxing.start=self.performance.now();var u=this.transmuxer,_=this.worker,y=p?p.start:f.start,T=f.decryptdata,M=this.frag,L=!(M&&f.cc===M.cc),x=!(M&&g.level===M.level),D=M?g.sn-M.sn:-1,j=this.part?g.part-this.part.index:1,I=!x&&(D===1||D===0&&j===1),W=self.performance.now();(x||D||f.stats.parsing.start===0)&&(f.stats.parsing.start=W),p&&(j||!I)&&(p.stats.parsing.start=W);var Q=new H.TransmuxState(L,I,b,x,y);if(!I||L){U.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+g.sn+" p: "+g.part+" level: "+g.level+" id: "+g.id+`
|
|
discontinuity: `+L+`
|
|
trackSwitch: `+x+`
|
|
contiguous: `+I+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+y);var fe=new H.TransmuxConfig(t,v,i,E,c);this.configureTransmuxer(fe)}if(this.frag=f,this.part=p,_)_.postMessage({cmd:"demux",data:n,decryptdata:T,chunkMeta:g,state:Q},n instanceof ArrayBuffer?[n]:[]);else if(u){var de=u.push(n,T,g,Q);Object(H.isPromise)(de)?de.then(function(Oe){m.handleTransmuxComplete(Oe)}):this.handleTransmuxComplete(de)}},l.flush=function(n){var i=this;n.transmuxing.start=self.performance.now();var t=this.transmuxer,v=this.worker;if(v)v.postMessage({cmd:"flush",chunkMeta:n});else if(t){var f=t.flush(n);Object(H.isPromise)(f)?f.then(function(p){i.handleFlushResult(p,n)}):this.handleFlushResult(f,n)}},l.handleFlushResult=function(n,i){var t=this;n.forEach(function(v){t.handleTransmuxComplete(v)}),this.onFlush(i)},l.onWorkerMessage=function(n){var i=n.data,t=this.hls;switch(i.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(i.data);break}case"flush":{this.onFlush(i.data);break}default:{i.data=i.data||{},i.data.frag=this.frag,i.data.id=this.id,t.trigger(i.event,i.data);break}}},l.configureTransmuxer=function(n){var i=this.worker,t=this.transmuxer;i?i.postMessage({cmd:"configure",config:n}):t&&t.configure(n)},l.handleTransmuxComplete=function(n){n.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(n)},r}()},"./src/demux/transmuxer-worker.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return e});var k=O("./src/demux/transmuxer.ts"),w=O("./src/events.ts"),R=O("./src/utils/logger.ts"),H=O("./node_modules/eventemitter3/index.js"),U=O.n(H);function e(a){var r=new H.EventEmitter,l=function(n,i){a.postMessage({event:n,data:i})};r.on(w.Events.FRAG_DECRYPTED,l),r.on(w.Events.ERROR,l),a.addEventListener("message",function(s){var n=s.data;switch(n.cmd){case"init":{var i=JSON.parse(n.config);a.transmuxer=new k.default(r,n.typeSupported,i,n.vendor,n.id),Object(R.enableLogs)(i.debug),l("init",null);break}case"configure":{a.transmuxer.configure(n.config);break}case"demux":{var t=a.transmuxer.push(n.data,n.decryptdata,n.chunkMeta,n.state);Object(k.isPromise)(t)?t.then(function(p){S(a,p)}):S(a,t);break}case"flush":{var v=n.chunkMeta,f=a.transmuxer.flush(v);Object(k.isPromise)(f)?f.then(function(p){h(a,p,v)}):h(a,f,v);break}default:break}})}function S(a,r){if(o(r.remuxResult))return;var l=[],s=r.remuxResult,n=s.audio,i=s.video;n&&d(l,n),i&&d(l,i),a.postMessage({event:"transmuxComplete",data:r},l)}function d(a,r){r.data1&&a.push(r.data1.buffer),r.data2&&a.push(r.data2.buffer)}function h(a,r,l){r.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(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return i}),O.d(B,"isPromise",function(){return f}),O.d(B,"TransmuxConfig",function(){return p}),O.d(B,"TransmuxState",function(){return E});var k=O("./src/events.ts"),w=O("./src/errors.ts"),R=O("./src/crypt/decrypter.ts"),H=O("./src/demux/aacdemuxer.ts"),U=O("./src/demux/mp4demuxer.ts"),e=O("./src/demux/tsdemuxer.ts"),S=O("./src/demux/mp3demuxer.ts"),d=O("./src/remux/mp4-remuxer.ts"),h=O("./src/remux/passthrough-remuxer.ts"),o=O("./src/demux/chunk-cache.ts"),a=O("./src/utils/mp4-tools.ts"),r=O("./src/utils/logger.ts"),l;try{l=self.performance.now.bind(self.performance)}catch(b){r.logger.debug("Unable to use Performance API on this environment"),l=self.Date.now}var s=[{demux:e.default,remux:d.default},{demux:U.default,remux:h.default},{demux:H.default,remux:d.default},{demux:S.default,remux:d.default}],n=1024;s.forEach(function(b){var g=b.demux;n=Math.max(n,g.minProbeByteLength)});var i=function(){function b(c,m,u,_,y){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=c,this.typeSupported=m,this.config=u,this.vendor=_,this.id=y}var g=b.prototype;return g.configure=function(m){this.transmuxConfig=m,this.decrypter&&this.decrypter.reset()},g.push=function(m,u,_,y){var T=this,M=_.transmuxing;M.executeStart=l();var L=new Uint8Array(m),x=this.cache,D=this.config,j=this.currentTransmuxState,I=this.transmuxConfig;y&&(this.currentTransmuxState=y);var W=t(L,u);if(W&&W.method==="AES-128"){var Q=this.getDecrypter();if(D.enableSoftwareAES){var fe=Q.softwareDecrypt(L,W.key.buffer,W.iv.buffer);if(!fe)return M.executeEnd=l(),v(_);L=new Uint8Array(fe)}else return this.decryptionPromise=Q.webCryptoDecrypt(L,W.key.buffer,W.iv.buffer).then(function(we){var Re=T.push(we,null,_);return T.decryptionPromise=null,Re}),this.decryptionPromise}var de=y||j,Oe=de.contiguous,Se=de.discontinuity,Ie=de.trackSwitch,Le=de.accurateTimeOffset,Ne=de.timeOffset,be=I.audioCodec,N=I.videoCodec,A=I.defaultInitPts,C=I.duration,F=I.initSegmentData;if((Se||Ie)&&this.resetInitSegment(F,be,N,C),Se&&this.resetInitialTimestamp(A),Oe||this.resetContiguity(),this.needsProbing(L,Se,Ie)){if(x.dataLength){var G=x.flush();L=Object(a.appendUint8Array)(G,L)}this.configureTransmuxer(L,I)}var P=this.transmux(L,W,Ne,Le,_),oe=this.currentTransmuxState;return oe.contiguous=!0,oe.discontinuity=!1,oe.trackSwitch=!1,M.executeEnd=l(),P},g.flush=function(m){var u=this,_=m.transmuxing;_.executeStart=l();var y=this.decrypter,T=this.cache,M=this.currentTransmuxState,L=this.decryptionPromise;if(L)return L.then(function(){return u.flush(m)});var x=[],D=M.timeOffset;if(y){var j=y.flush();j&&x.push(this.push(j,null,m))}var I=T.dataLength;T.reset();var W=this.demuxer,Q=this.remuxer;if(!W||!Q)return I>=n&&this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),_.executeEnd=l(),[v(m)];var fe=W.flush(D);return f(fe)?fe.then(function(de){return u.flushRemux(x,de,m),x}):(this.flushRemux(x,fe,m),x)},g.flushRemux=function(m,u,_){var y=u.audioTrack,T=u.avcTrack,M=u.id3Track,L=u.textTrack,x=this.currentTransmuxState,D=x.accurateTimeOffset,j=x.timeOffset;r.logger.log("[transmuxer.ts]: Flushed fragment "+_.sn+(_.part>-1?" p: "+_.part:"")+" of level "+_.level);var I=this.remuxer.remux(y,T,M,L,j,D,!0,this.id);m.push({remuxResult:I,chunkMeta:_}),_.transmuxing.executeEnd=l()},g.resetInitialTimestamp=function(m){var u=this.demuxer,_=this.remuxer;if(!u||!_)return;u.resetTimeStamp(m),_.resetTimeStamp(m)},g.resetContiguity=function(){var m=this.demuxer,u=this.remuxer;if(!m||!u)return;m.resetContiguity(),u.resetNextTimestamp()},g.resetInitSegment=function(m,u,_,y){var T=this.demuxer,M=this.remuxer;if(!T||!M)return;T.resetInitSegment(u,_,y),M.resetInitSegment(m,u,_)},g.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},g.transmux=function(m,u,_,y,T){var M;return u&&u.method==="SAMPLE-AES"?M=this.transmuxSampleAes(m,u,_,y,T):M=this.transmuxUnencrypted(m,_,y,T),M},g.transmuxUnencrypted=function(m,u,_,y){var T=this.demuxer.demux(m,u,!1,!this.config.progressive),M=T.audioTrack,L=T.avcTrack,x=T.id3Track,D=T.textTrack,j=this.remuxer.remux(M,L,x,D,u,_,!1,this.id);return{remuxResult:j,chunkMeta:y}},g.transmuxSampleAes=function(m,u,_,y,T){var M=this;return this.demuxer.demuxSampleAes(m,u,_).then(function(L){var x=M.remuxer.remux(L.audioTrack,L.avcTrack,L.id3Track,L.textTrack,_,y,!1,M.id);return{remuxResult:x,chunkMeta:T}})},g.configureTransmuxer=function(m,u){for(var _=this.config,y=this.observer,T=this.typeSupported,M=this.vendor,L=u.audioCodec,x=u.defaultInitPts,D=u.duration,j=u.initSegmentData,I=u.videoCodec,W,Q=0,fe=s.length;Q<fe;Q++)if(s[Q].demux.probe(m)){W=s[Q];break}W||(r.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),W={demux:U.default,remux:h.default});var de=this.demuxer,Oe=this.remuxer,Se=W.remux,Ie=W.demux;(!Oe||!(Oe instanceof Se))&&(this.remuxer=new Se(y,_,T,M)),(!de||!(de instanceof Ie))&&(this.demuxer=new Ie(y,_,T),this.probe=Ie.probe),this.resetInitSegment(j,L,I,D),this.resetInitialTimestamp(x)},g.needsProbing=function(m,u,_){return!this.demuxer||!this.remuxer||u||_},g.getDecrypter=function(){var m=this.decrypter;return m||(m=this.decrypter=new R.default(this.observer,this.config)),m},b}();function t(b,g){var c=null;return b.byteLength>0&&g!=null&&g.key!=null&&g.iv!==null&&g.method!=null&&(c=g),c}var v=function(g){return{remuxResult:{},chunkMeta:g}};function f(b){return"then"in b&&b.then instanceof Function}var p=function(g,c,m,u,_){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=g,this.videoCodec=c,this.initSegmentData=m,this.duration=u,this.defaultInitPts=_},E=function(g,c,m,u,_){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=g,this.contiguous=c,this.accurateTimeOffset=m,this.trackSwitch=u,this.timeOffset=_}},"./src/demux/tsdemuxer.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"discardEPB",function(){return v});var k=O("./src/demux/adts.ts"),w=O("./src/demux/mpegaudio.ts"),R=O("./src/demux/exp-golomb.ts"),H=O("./src/demux/id3.ts"),U=O("./src/demux/sample-aes.ts"),e=O("./src/events.ts"),S=O("./src/utils/mp4-tools.ts"),d=O("./src/utils/logger.ts"),h=O("./src/errors.ts"),o={video:1,audio:2,id3:3,text:4},a=function(){function f(E,b,g){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=g}f.probe=function(b){var g=f.syncOffset(b);return g<0?!1:(g&&d.logger.warn("MPEG2-TS detected but first sync word found @ offset "+g+", junk ahead ?"),!0)},f.syncOffset=function(b){for(var g=Math.min(1e3,b.length-3*188),c=0;c<g;){if(b[c]===71&&b[c+188]===71&&b[c+2*188]===71)return c;c++}return-1},f.createTrack=function(b,g){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"?g:void 0}};var p=f.prototype;return p.resetInitSegment=function(b,g,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",c),this._audioTrack=f.createTrack("audio",c),this._id3Track=f.createTrack("id3",c),this._txtTrack=f.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=g,this._duration=c},p.resetTimeStamp=function(){},p.resetContiguity=function(){var b=this._audioTrack,g=this._avcTrack,c=this._id3Track;b&&(b.pesData=null),g&&(g.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(b,g,c,m){c===void 0&&(c=!1),m===void 0&&(m=!1),c||(this.sampleAes=null);var u,_=this._avcTrack,y=this._audioTrack,T=this._id3Track,M=_.pid,L=_.pesData,x=y.pid,D=T.pid,j=y.pesData,I=T.pesData,W=!1,Q=this.pmtParsed,fe=this._pmtId,de=b.length;if(this.remainderData&&(b=Object(S.appendUint8Array)(this.remainderData,b),de=b.length,this.remainderData=null),de<188&&!m)return this.remainderData=b,{audioTrack:y,avcTrack:_,id3Track:T,textTrack:this._txtTrack};var Oe=Math.max(0,f.syncOffset(b));de-=(de+Oe)%188,de<b.byteLength&&!m&&(this.remainderData=new Uint8Array(b.buffer,de,b.buffer.byteLength-de));for(var Se=Oe;Se<de;Se+=188)if(b[Se]===71){var Ie=!!(b[Se+1]&64),Le=((b[Se+1]&31)<<8)+b[Se+2],Ne=(b[Se+3]&48)>>4,be=void 0;if(Ne>1){if(be=Se+5+b[Se+4],be===Se+188)continue}else be=Se+4;switch(Le){case M:Ie&&(L&&(u=n(L))&&this.parseAVCPES(u,!1),L={data:[],size:0}),L&&(L.data.push(b.subarray(be,Se+188)),L.size+=Se+188-be);break;case x:Ie&&(j&&(u=n(j))&&(y.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),j={data:[],size:0}),j&&(j.data.push(b.subarray(be,Se+188)),j.size+=Se+188-be);break;case D:Ie&&(I&&(u=n(I))&&this.parseID3PES(u),I={data:[],size:0}),I&&(I.data.push(b.subarray(be,Se+188)),I.size+=Se+188-be);break;case 0:Ie&&(be+=b[be]+1),fe=this._pmtId=l(b,be);break;case fe:{Ie&&(be+=b[be]+1);var N=s(b,be,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);M=N.avc,M>0&&(_.pid=M),x=N.audio,x>0&&(y.pid=x,y.isAAC=N.isAAC),D=N.id3,D>0&&(T.pid=D),W&&!Q&&(d.logger.log("reparse from beginning"),W=!1,Se=Oe-188),Q=this.pmtParsed=!0;break}case 17:case 8191:break;default:W=!0;break}}else this.observer.emit(e.Events.ERROR,e.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});_.pesData=L,y.pesData=j,T.pesData=I;var A={audioTrack:y,avcTrack:_,id3Track:T,textTrack:this._txtTrack};return m&&this.extractRemainingSamples(A),A},p.flush=function(){var b=this.remainderData;this.remainderData=null;var g;return b?g=this.demux(b,-1,!1,!0):g={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(g),this.sampleAes?this.decrypt(g,this.sampleAes):g},p.extractRemainingSamples=function(b){var g=b.audioTrack,c=b.avcTrack,m=b.id3Track,u=c.pesData,_=g.pesData,y=m.pesData,T;u&&(T=n(u))?(this.parseAVCPES(T,!0),c.pesData=null):c.pesData=u,_&&(T=n(_))?(g.isAAC?this.parseAACPES(T):this.parseMPEGPES(T),g.pesData=null):(_!=null&&_.size&&d.logger.log("last AAC PES packet truncated,might overlap between fragments"),g.pesData=_),y&&(T=n(y))?(this.parseID3PES(T),m.pesData=null):m.pesData=y},p.demuxSampleAes=function(b,g,c){var m=this.demux(b,c,!0,!this.config.progressive),u=this.sampleAes=new U.default(this.observer,this.config,g);return this.decrypt(m,u)},p.decrypt=function(b,g){return new Promise(function(c){var m=b.audioTrack,u=b.avcTrack;m.samples&&m.isAAC?g.decryptAacSamples(m.samples,0,function(){u.samples?g.decryptAvcSamples(u.samples,0,0,function(){c(b)}):c(b)}):u.samples&&g.decryptAvcSamples(u.samples,0,0,function(){c(b)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(b,g){var c=this,m=this._avcTrack,u=this.parseAVCNALu(b.data),_=!1,y=this.avcSample,T,M=!1;b.data=null,y&&u.length&&!m.audFound&&(i(y,m),y=this.avcSample=r(!1,b.pts,b.dts,"")),u.forEach(function(L){switch(L.type){case 1:{T=!0,y||(y=c.avcSample=r(!0,b.pts,b.dts,"")),_&&(y.debug+="NDR "),y.frame=!0;var x=L.data;if(M&&x.length>4){var D=new R.default(x).readSliceType();(D===2||D===4||D===7||D===9)&&(y.key=!0)}break}case 5:T=!0,y||(y=c.avcSample=r(!0,b.pts,b.dts,"")),_&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{T=!0,_&&y&&(y.debug+="SEI ");var j=new R.default(v(L.data));j.readUByte();for(var I=0,W=0,Q=!1,fe=0;!Q&&j.bytesAvailable>1;){I=0;do fe=j.readUByte(),I+=fe;while(fe===255);W=0;do fe=j.readUByte(),W+=fe;while(fe===255);if(I===4&&j.bytesAvailable!==0){Q=!0;var de=j.readUByte();if(de===181){var Oe=j.readUShort();if(Oe===49){var Se=j.readUInt();if(Se===1195456820){var Ie=j.readUByte();if(Ie===3){for(var Le=j.readUByte(),Ne=j.readUByte(),be=31&Le,N=[Le,Ne],A=0;A<be;A++)N.push(j.readUByte()),N.push(j.readUByte()),N.push(j.readUByte());t(c._txtTrack.samples,{type:3,pts:b.pts,bytes:N})}}}}}else if(I===5&&j.bytesAvailable!==0){if(Q=!0,W>16){for(var C=[],F=0;F<16;F++)C.push(j.readUByte().toString(16)),(F===3||F===5||F===7||F===9)&&C.push("-");for(var G=W-16,P=new Uint8Array(G),oe=0;oe<G;oe++)P[oe]=j.readUByte();t(c._txtTrack.samples,{pts:b.pts,payloadType:I,uuid:C.join(""),userData:Object(H.utf8ArrayToStr)(P),userDataBytes:P})}}else if(W<j.bytesAvailable)for(var we=0;we<W;we++)j.readUByte()}break}case 7:if(T=!0,M=!0,_&&y&&(y.debug+="SPS "),!m.sps){var Re=new R.default(L.data),ee=Re.readSPS();m.width=ee.width,m.height=ee.height,m.pixelRatio=ee.pixelRatio,m.sps=[L.data],m.duration=c._duration;for(var ce=L.data.subarray(1,4),Ee="avc1.",Ae=0;Ae<3;Ae++){var Me=ce[Ae].toString(16);Me.length<2&&(Me="0"+Me),Ee+=Me}m.codec=Ee}break;case 8:T=!0,_&&y&&(y.debug+="PPS "),m.pps||(m.pps=[L.data]);break;case 9:T=!1,m.audFound=!0,y&&i(y,m),y=c.avcSample=r(!1,b.pts,b.dts,_?"AUD ":"");break;case 12:T=!1;break;default:T=!1,y&&(y.debug+="unknown NAL "+L.type+" ");break}if(y&&T){var Be=y.units;Be.push(L)}}),g&&y&&(i(y,m),this.avcSample=null)},p.getLastNalUnit=function(){var b,g=this.avcSample,c;if(!g||g.units.length===0){var m=this._avcTrack.samples;g=m[m.length-1]}if((b=g)!==null&&b!==void 0&&b.units){var u=g.units;c=u[u.length-1]}return c},p.parseAVCNALu=function(b){var g=b.byteLength,c=this._avcTrack,m=c.naluState||0,u=m,_=[],y=0,T,M,L,x=-1,D=0;for(m===-1&&(x=0,D=b[0]&31,m=0,y=1);y<g;){if(T=b[y++],!m){m=T?0:1;continue}if(m===1){m=T?0:2;continue}if(!T)m=3;else if(T===1){if(x>=0){var j={data:b.subarray(x,y-m-1),type:D};_.push(j)}else{var I=this.getLastNalUnit();if(I&&(u&&y<=4-u&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-u))),M=y-m-1,M>0)){var W=new Uint8Array(I.data.byteLength+M);W.set(I.data,0),W.set(b.subarray(0,M),I.data.byteLength),I.data=W,I.state=0}}y<g?(L=b[y]&31,x=y,D=L,m=0):m=-1}else m=0}if(x>=0&&m>=0){var Q={data:b.subarray(x,g),type:D,state:m};_.push(Q)}if(_.length===0){var fe=this.getLastNalUnit();if(fe){var de=new Uint8Array(fe.data.byteLength+b.byteLength);de.set(fe.data,0),de.set(b,fe.data.byteLength),fe.data=de}}return c.naluState=m,_},p.parseAACPES=function(b){var g=0,c=this._audioTrack,m=this.aacOverFlow,u=b.data;if(m){this.aacOverFlow=null;var _=m.sample.unit.byteLength,y=Math.min(m.missing,_),T=_-y;m.sample.unit.set(u.subarray(0,y),T),c.samples.push(m.sample),g=m.missing}var M,L;for(M=g,L=u.length;M<L-1&&!k.isHeader(u,M);M++);if(M!==g){var x,D;if(M<L-1?(x="AAC PES did not start with ADTS header,offset:"+M,D=!1):(x="no ADTS header found in AAC PES",D=!0),d.logger.warn("parsing error:"+x),this.observer.emit(e.Events.ERROR,e.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:D,reason:x}),D)return}k.initTrackConfig(c,this.observer,u,M,this.audioCodec);var j;if(b.pts!==void 0)j=b.pts;else if(m){var I=k.getFrameDuration(c.samplerate);j=m.sample.pts+I}else{d.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var W=0;M<L;)if(k.isHeader(u,M)){if(M+5<L){var Q=k.appendFrame(c,u,M,j,W);if(Q)if(Q.missing)this.aacOverFlow=Q;else{M+=Q.length,W++;continue}}break}else M++},p.parseMPEGPES=function(b){var g=b.data,c=g.length,m=0,u=0,_=b.pts;if(_===void 0){d.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<c;)if(w.isHeader(g,u)){var y=w.appendFrame(this._audioTrack,g,u,_,m);if(y)u+=y.length,m++;else break}else u++},p.parseID3PES=function(b){if(b.pts===void 0){d.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},f}();a.minProbeByteLength=188;function r(f,p,E,b){return{key:f,frame:!1,pts:p,dts:E,units:[],debug:b,length:0}}function l(f,p){return(f[p+10]&31)<<8|f[p+11]}function s(f,p,E,b){var g={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[p+1]&15)<<8|f[p+2],m=p+3+c-4,u=(f[p+10]&15)<<8|f[p+11];for(p+=12+u;p<m;){var _=(f[p+1]&31)<<8|f[p+2];switch(f[p]){case 207:if(!b){d.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:g.audio===-1&&(g.audio=_);break;case 21:g.id3===-1&&(g.id3=_);break;case 219:if(!b){d.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:g.avc===-1&&(g.avc=_);break;case 3:case 4:E?g.audio===-1&&(g.audio=_,g.isAAC=!1):d.logger.log("MPEG audio found, not supported in this browser");break;case 36:d.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((f[p+3]&15)<<8|f[p+4])+5}return g}function n(f){var p=0,E,b,g,c,m,u=f.data;if(!f||f.size===0)return null;for(;u[0].length<19&&u.length>1;){var _=new Uint8Array(u[0].length+u[1].length);_.set(u[0]),_.set(u[1],u[0].length),u[0]=_,u.splice(1,1)}E=u[0];var y=(E[0]<<16)+(E[1]<<8)+E[2];if(y===1){if(b=(E[4]<<8)+E[5],b&&b>f.size-6)return null;var T=E[7];T&192&&(c=(E[9]&14)*536870912+(E[10]&255)*4194304+(E[11]&254)*16384+(E[12]&255)*128+(E[13]&254)/2,T&64?(m=(E[14]&14)*536870912+(E[15]&255)*4194304+(E[16]&254)*16384+(E[17]&255)*128+(E[18]&254)/2,c-m>60*9e4&&(d.logger.warn(Math.round((c-m)/9e4)+"s delta between PTS and DTS, align them"),c=m)):m=c),g=E[8];var M=g+9;if(f.size<=M)return null;f.size-=M;for(var L=new Uint8Array(f.size),x=0,D=u.length;x<D;x++){E=u[x];var j=E.byteLength;if(M)if(M>j){M-=j;continue}else E=E.subarray(M),j-=M,M=0;L.set(E,p),p+=j}return b&&(b-=g+3),{data:L,pts:c,dts:m,len:b}}return null}function i(f,p){if(f.units.length&&f.frame){if(f.pts===void 0){var E=p.samples,b=E.length;if(b){var g=E[b-1];f.pts=g.pts,f.dts=g.dts}else{p.dropped++;return}}p.samples.push(f)}f.debug.length&&d.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function t(f,p){var E=f.length;if(E>0){if(p.pts>=f[E-1].pts)f.push(p);else for(var b=E-1;b>=0;b--)if(p.pts<f[b].pts){f.splice(b,0,p);break}}else f.push(p)}function v(f){for(var p=f.byteLength,E=[],b=1;b<p-2;)f[b]===0&&f[b+1]===0&&f[b+2]===3?(E.push(b+2),b+=2):b++;if(E.length===0)return f;var g=p-E.length,c=new Uint8Array(g),m=0;for(b=0;b<g;m++,b++)m===E[0]&&(m++,E.shift()),c[b]=f[m];return c}B.default=a},"./src/errors.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"ErrorTypes",function(){return k}),O.d(B,"ErrorDetails",function(){return w});var k;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(k||(k={}));var w;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(w||(w={}))},"./src/events.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"Events",function(){return k});var k;(function(w){w.MEDIA_ATTACHING="hlsMediaAttaching",w.MEDIA_ATTACHED="hlsMediaAttached",w.MEDIA_DETACHING="hlsMediaDetaching",w.MEDIA_DETACHED="hlsMediaDetached",w.BUFFER_RESET="hlsBufferReset",w.BUFFER_CODECS="hlsBufferCodecs",w.BUFFER_CREATED="hlsBufferCreated",w.BUFFER_APPENDING="hlsBufferAppending",w.BUFFER_APPENDED="hlsBufferAppended",w.BUFFER_EOS="hlsBufferEos",w.BUFFER_FLUSHING="hlsBufferFlushing",w.BUFFER_FLUSHED="hlsBufferFlushed",w.MANIFEST_LOADING="hlsManifestLoading",w.MANIFEST_LOADED="hlsManifestLoaded",w.MANIFEST_PARSED="hlsManifestParsed",w.LEVEL_SWITCHING="hlsLevelSwitching",w.LEVEL_SWITCHED="hlsLevelSwitched",w.LEVEL_LOADING="hlsLevelLoading",w.LEVEL_LOADED="hlsLevelLoaded",w.LEVEL_UPDATED="hlsLevelUpdated",w.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",w.LEVELS_UPDATED="hlsLevelsUpdated",w.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",w.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",w.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",w.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",w.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",w.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",w.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",w.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",w.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",w.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",w.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",w.CUES_PARSED="hlsCuesParsed",w.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",w.INIT_PTS_FOUND="hlsInitPtsFound",w.FRAG_LOADING="hlsFragLoading",w.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",w.FRAG_LOADED="hlsFragLoaded",w.FRAG_DECRYPTED="hlsFragDecrypted",w.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",w.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",w.FRAG_PARSING_METADATA="hlsFragParsingMetadata",w.FRAG_PARSED="hlsFragParsed",w.FRAG_BUFFERED="hlsFragBuffered",w.FRAG_CHANGED="hlsFragChanged",w.FPS_DROP="hlsFpsDrop",w.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",w.ERROR="hlsError",w.DESTROYING="hlsDestroying",w.KEY_LOADING="hlsKeyLoading",w.KEY_LOADED="hlsKeyLoaded",w.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",w.BACK_BUFFER_REACHED="hlsBackBufferReached"})(k||(k={}))},"./src/hls.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return f});var k=O("./node_modules/url-toolkit/src/url-toolkit.js"),w=O.n(k),R=O("./src/loader/playlist-loader.ts"),H=O("./src/loader/key-loader.ts"),U=O("./src/controller/id3-track-controller.ts"),e=O("./src/controller/latency-controller.ts"),S=O("./src/controller/level-controller.ts"),d=O("./src/controller/fragment-tracker.ts"),h=O("./src/controller/stream-controller.ts"),o=O("./src/is-supported.ts"),a=O("./src/utils/logger.ts"),r=O("./src/config.ts"),l=O("./node_modules/eventemitter3/index.js"),s=O.n(l),n=O("./src/events.ts"),i=O("./src/errors.ts");function t(p,E){for(var b=0;b<E.length;b++){var g=E[b];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,g.key,g)}}function v(p,E,b){return E&&t(p.prototype,E),b&&t(p,b),p}var f=function(){p.isSupported=function(){return Object(o.isSupported)()};function p(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 g=this.config=Object(r.mergeConfig)(p.DefaultConfig,b);this.userConfig=b,Object(a.enableLogs)(g.debug),this._autoLevelCapping=-1,g.progressive&&Object(r.enableStreamingMode)(g);var c=g.abrController,m=g.bufferController,u=g.capLevelController,_=g.fpsController,y=this.abrController=new c(this),T=this.bufferController=new m(this),M=this.capLevelController=new u(this),L=new _(this),x=new R.default(this),D=new H.default(this),j=new U.default(this),I=this.levelController=new S.default(this),W=new d.FragmentTracker(this),Q=this.streamController=new h.default(this,W);M.setStreamController(Q),L.setStreamController(Q);var fe=[I,Q];this.networkControllers=fe;var de=[x,D,y,T,M,L,j,W];this.audioTrackController=this.createController(g.audioTrackController,null,fe),this.createController(g.audioStreamController,W,fe),this.subtitleTrackController=this.createController(g.subtitleTrackController,null,fe),this.createController(g.subtitleStreamController,W,fe),this.createController(g.timelineController,null,de),this.emeController=this.createController(g.emeController,null,de),this.cmcdController=this.createController(g.cmcdController,null,de),this.latencyController=this.createController(e.default,null,de),this.coreComponents=de}var E=p.prototype;return E.createController=function(g,c,m){if(g){var u=c?new g(this,c):new g(this);return m&&m.push(u),u}return null},E.on=function(g,c,m){m===void 0&&(m=this),this._emitter.on(g,c,m)},E.once=function(g,c,m){m===void 0&&(m=this),this._emitter.once(g,c,m)},E.removeAllListeners=function(g){this._emitter.removeAllListeners(g)},E.off=function(g,c,m,u){m===void 0&&(m=this),this._emitter.off(g,c,m,u)},E.listeners=function(g){return this._emitter.listeners(g)},E.emit=function(g,c,m){return this._emitter.emit(g,c,m)},E.trigger=function(g,c){if(this.config.debug)return this.emit(g,g,c);try{return this.emit(g,g,c)}catch(m){a.logger.error("An internal error happened while handling event "+g+'. Error message: "'+m.message+'". Here is a stacktrace:',m),this.trigger(n.Events.ERROR,{type:i.ErrorTypes.OTHER_ERROR,details:i.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:g,error:m})}return!1},E.listenerCount=function(g){return this._emitter.listenerCount(g)},E.destroy=function(){a.logger.log("destroy"),this.trigger(n.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(g){return g.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(g){return g.destroy()}),this.coreComponents.length=0},E.attachMedia=function(g){a.logger.log("attachMedia"),this._media=g,this.trigger(n.Events.MEDIA_ATTACHING,{media:g})},E.detachMedia=function(){a.logger.log("detachMedia"),this.trigger(n.Events.MEDIA_DETACHING,void 0),this._media=null},E.loadSource=function(g){this.stopLoad();var c=this.media,m=this.url,u=this.url=k.buildAbsoluteURL(self.location.href,g,{alwaysNormalize:!0});a.logger.log("loadSource:"+u),c&&m&&m!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(n.Events.MANIFEST_LOADING,{url:g})},E.startLoad=function(g){g===void 0&&(g=-1),a.logger.log("startLoad("+g+")"),this.networkControllers.forEach(function(c){c.startLoad(g)})},E.stopLoad=function(){a.logger.log("stopLoad"),this.networkControllers.forEach(function(g){g.stopLoad()})},E.swapAudioCodec=function(){a.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},E.recoverMediaError=function(){a.logger.log("recoverMediaError");var g=this._media;this.detachMedia(),g&&this.attachMedia(g)},E.removeLevel=function(g,c){c===void 0&&(c=0),this.levelController.removeLevel(g,c)},v(p,[{key:"levels",get:function(){var g=this.levelController.levels;return g||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(g){a.logger.log("set currentLevel:"+g),this.loadLevel=g,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(g){a.logger.log("set nextLevel:"+g),this.levelController.manualLevel=g,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(g){a.logger.log("set loadLevel:"+g),this.levelController.manualLevel=g}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(g){this.levelController.nextLoadLevel=g}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(g){a.logger.log("set firstLevel:"+g),this.levelController.firstLevel=g}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(g){a.logger.log("set startLevel:"+g),g!==-1&&(g=Math.max(g,this.minAutoLevel)),this.levelController.startLevel=g}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(g){var c=!!g;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(g){this._autoLevelCapping!==g&&(a.logger.log("set autoLevelCapping:"+g),this._autoLevelCapping=g)}},{key:"bandwidthEstimate",get:function(){var g=this.abrController.bwEstimator;return g?g.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var g=this.levels,c=this.config.minAutoBitrate;if(!g)return 0;for(var m=g.length,u=0;u<m;u++)if(g[u].maxBitrate>c)return u;return 0}},{key:"maxAutoLevel",get:function(){var g=this.levels,c=this.autoLevelCapping,m;return c===-1&&g&&g.length?m=g.length-1:m=c,m}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(g){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,g)}},{key:"audioTracks",get:function(){var g=this.audioTrackController;return g?g.audioTracks:[]}},{key:"audioTrack",get:function(){var g=this.audioTrackController;return g?g.audioTrack:-1},set:function(g){var c=this.audioTrackController;c&&(c.audioTrack=g)}},{key:"subtitleTracks",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTrack:-1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleTrack=g)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var g=this.subtitleTrackController;return g?g.subtitleDisplay:!1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=g)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(g){this.config.lowLatencyMode=g}},{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 n.Events}},{key:"ErrorTypes",get:function(){return i.ErrorTypes}},{key:"ErrorDetails",get:function(){return i.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:r.hlsDefaultConfig},set:function(g){p.defaultConfig=g}}]),p}();f.defaultConfig=void 0},"./src/is-supported.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"isSupported",function(){return R}),O.d(B,"changeTypeSupported",function(){return H});var k=O("./src/utils/mediasource-helper.ts");function w(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var U=Object(k.getMediaSource)();if(!U)return!1;var e=w(),S=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),d=!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function";return!!S&&!!d}function H(){var U,e=w();return typeof(e==null||((U=e.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return a}),O.d(B,"LoadError",function(){return l});var k=O("./src/polyfills/number.ts"),w=O("./src/errors.ts");function R(s,n){s.prototype=Object.create(n.prototype),s.prototype.constructor=s,d(s,n)}function H(s){var n=typeof Map=="function"?new Map:void 0;return H=function(t){if(t===null||!S(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(typeof n!="undefined"){if(n.has(t))return n.get(t);n.set(t,v)}function v(){return U(t,arguments,h(this).constructor)}return v.prototype=Object.create(t.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),d(v,t)},H(s)}function U(s,n,i){return e()?U=Reflect.construct:U=function(v,f,p){var E=[null];E.push.apply(E,f);var b=Function.bind.apply(v,E),g=new b;return p&&d(g,p.prototype),g},U.apply(null,arguments)}function e(){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 d(s,n){return d=Object.setPrototypeOf||function(t,v){return t.__proto__=v,t},d(s,n)}function h(s){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},h(s)}var o=Math.pow(2,17),a=function(){function s(i){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=i}var n=s.prototype;return n.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},n.abort=function(){this.loader&&this.loader.abort()},n.load=function(t,v){var f=this,p=t.url;if(!p)return Promise.reject(new l({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var E=this.config,b=E.fLoader,g=E.loader;return new Promise(function(c,m){f.loader&&f.loader.destroy();var u=f.loader=t.loader=b?new b(E):new g(E),_=r(t),y={timeout:E.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:E.fragLoadingMaxRetryTimeout,highWaterMark:o};t.stats=u.stats,u.load(_,y,{onSuccess:function(M,L,x,D){f.resetLoader(t,u),c({frag:t,part:null,payload:M.data,networkDetails:D})},onError:function(M,L,x){f.resetLoader(t,u),m(new l({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:M,networkDetails:x}))},onAbort:function(M,L,x){f.resetLoader(t,u),m(new l({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,networkDetails:x}))},onTimeout:function(M,L,x){f.resetLoader(t,u),m(new l({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,networkDetails:x}))},onProgress:function(M,L,x,D){v&&v({frag:t,part:null,payload:x,networkDetails:D})}})})},n.loadPart=function(t,v,f){var p=this;this.abort();var E=this.config,b=E.fLoader,g=E.loader;return new Promise(function(c,m){p.loader&&p.loader.destroy();var u=p.loader=t.loader=b?new b(E):new g(E),_=r(t,v),y={timeout:E.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:E.fragLoadingMaxRetryTimeout,highWaterMark:o};v.stats=u.stats,u.load(_,y,{onSuccess:function(M,L,x,D){p.resetLoader(t,u),p.updateStatsFromPart(t,v);var j={frag:t,part:v,payload:M.data,networkDetails:D};f(j),c(j)},onError:function(M,L,x){p.resetLoader(t,u),m(new l({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:v,response:M,networkDetails:x}))},onAbort:function(M,L,x){t.stats.aborted=v.stats.aborted,p.resetLoader(t,u),m(new l({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,part:v,networkDetails:x}))},onTimeout:function(M,L,x){p.resetLoader(t,u),m(new l({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:v,networkDetails:x}))}})})},n.updateStatsFromPart=function(t,v){var f=t.stats,p=v.stats,E=p.total;if(f.loaded+=p.loaded,E){var b=Math.round(t.duration/v.duration),g=Math.min(Math.round(f.loaded/E),b),c=b-g,m=c*Math.round(f.loaded/g);f.total=f.loaded+m}else f.total=Math.max(f.loaded,f.total);var u=f.loading,_=p.loading;u.start?u.first+=_.first-_.start:(u.start=_.start,u.first=_.first),u.end=_.end},n.resetLoader=function(t,v){t.loader=null,this.loader===v&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),v.destroy()},s}();function r(s,n){n===void 0&&(n=null);var i=n||s,t={frag:s,part:n,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},v=i.byteRangeStartOffset,f=i.byteRangeEndOffset;return Object(k.isFiniteNumber)(v)&&Object(k.isFiniteNumber)(f)&&(t.rangeStart=v,t.rangeEnd=f),t}var l=function(s){R(n,s);function n(i){for(var t,v=arguments.length,f=new Array(v>1?v-1:0),p=1;p<v;p++)f[p-1]=arguments[p];return t=s.call.apply(s,[this].concat(f))||this,t.data=void 0,t.data=i,t}return n}(H(Error))},"./src/loader/fragment.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"ElementaryStreamTypes",function(){return a}),O.d(B,"BaseSegment",function(){return r}),O.d(B,"Fragment",function(){return l}),O.d(B,"Part",function(){return s});var k=O("./src/polyfills/number.ts"),w=O("./node_modules/url-toolkit/src/url-toolkit.js"),R=O.n(w),H=O("./src/utils/logger.ts"),U=O("./src/loader/level-key.ts"),e=O("./src/loader/load-stats.ts");function S(n,i){n.prototype=Object.create(i.prototype),n.prototype.constructor=n,d(n,i)}function d(n,i){return d=Object.setPrototypeOf||function(v,f){return v.__proto__=f,v},d(n,i)}function h(n,i){for(var t=0;t<i.length;t++){var v=i[t];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(n,v.key,v)}}function o(n,i,t){return i&&h(n.prototype,i),t&&h(n,t),n}var a;(function(n){n.AUDIO="audio",n.VIDEO="video",n.AUDIOVIDEO="audiovideo"})(a||(a={}));var r=function(){function n(t){var v;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(v={},v[a.AUDIO]=null,v[a.VIDEO]=null,v[a.AUDIOVIDEO]=null,v),this.baseurl=t}var i=n.prototype;return i.setByteRange=function(v,f){var p=v.split("@",2),E=[];p.length===1?E[0]=f?f.byteRangeEndOffset:0:E[0]=parseInt(p[1]),E[1]=parseInt(p[0])+E[0],this._byteRange=E},o(n,[{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(w.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(v){this._url=v}}]),n}(),l=function(n){S(i,n);function i(v,f){var p;return p=n.call(this,f)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new e.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=v,p}var t=i.prototype;return t.createInitializationVector=function(f){for(var p=new Uint8Array(16),E=12;E<16;E++)p[E]=f>>8*(15-E)&255;return p},t.setDecryptDataFromLevelKey=function(f,p){var E=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(E=U.LevelKey.fromURI(f.uri),E.method=f.method,E.iv=this.createInitializationVector(p),E.keyFormat="identity"),E},t.setElementaryStreamInfo=function(f,p,E,b,g,c){c===void 0&&(c=!1);var m=this.elementaryStreams,u=m[f];if(!u){m[f]={startPTS:p,endPTS:E,startDTS:b,endDTS:g,partial:c};return}u.startPTS=Math.min(u.startPTS,p),u.endPTS=Math.max(u.endPTS,E),u.startDTS=Math.min(u.startDTS,b),u.endDTS=Math.max(u.endDTS,g)},t.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[a.AUDIO]=null,f[a.VIDEO]=null,f[a.AUDIOVIDEO]=null},o(i,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&H.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(k.isFiniteNumber)(this.programDateTime))return null;var f=Object(k.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),i}(r),s=function(n){S(i,n);function i(t,v,f,p,E){var b;b=n.call(this,f)||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 e.LoadStats,b.duration=t.decimalFloatingPoint("DURATION"),b.gap=t.bool("GAP"),b.independent=t.bool("INDEPENDENT"),b.relurl=t.enumeratedString("URI"),b.fragment=v,b.index=p;var g=t.enumeratedString("BYTERANGE");return g&&b.setByteRange(g,E),E&&(b.fragOffset=E.fragOffset+E.duration),b}return o(i,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var v=this.elementaryStreams;return!!(v.audio||v.video||v.audiovideo)}}]),i}(r)},"./src/loader/key-loader.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return H});var k=O("./src/events.ts"),w=O("./src/errors.ts"),R=O("./src/utils/logger.ts"),H=function(){function U(S){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=S,this._registerListeners()}var e=U.prototype;return e._registerListeners=function(){this.hls.on(k.Events.KEY_LOADING,this.onKeyLoading,this)},e._unregisterListeners=function(){this.hls.off(k.Events.KEY_LOADING,this.onKeyLoading)},e.destroy=function(){this._unregisterListeners();for(var d in this.loaders){var h=this.loaders[d];h&&h.destroy()}this.loaders={}},e.onKeyLoading=function(d,h){var o=h.frag,a=o.type,r=this.loaders[a];if(!o.decryptdata){R.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(r&&(R.logger.warn("abort previous key loader for type:"+a),r.abort()),!l){R.logger.warn("key uri is falsy");return}var n=s.loader,i=o.loader=this.loaders[a]=new n(s);this.decrypturl=l,this.decryptkey=null;var t={url:l,frag:o,responseType:"arraybuffer"},v={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};i.load(t,v,f)}else this.decryptkey&&(o.decryptdata.key=this.decryptkey,this.hls.trigger(k.Events.KEY_LOADED,{frag:o}))},e.loadsuccess=function(d,h,o){var a=o.frag;if(!a.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=a.decryptdata.key=new Uint8Array(d.data),a.loader=null,delete this.loaders[a.type],this.hls.trigger(k.Events.KEY_LOADED,{frag:a})},e.loaderror=function(d,h){var o=h.frag,a=o.loader;a&&a.abort(),delete this.loaders[o.type],this.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:o,response:d})},e.loadtimeout=function(d,h){var o=h.frag,a=o.loader;a&&a.abort(),delete this.loaders[o.type],this.hls.trigger(k.Events.ERROR,{type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:o})},U}()},"./src/loader/level-details.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"LevelDetails",function(){return U});var k=O("./src/polyfills/number.ts");function w(e,S){for(var d=0;d<S.length;d++){var h=S[d];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(e,h.key,h)}}function R(e,S,d){return S&&w(e.prototype,S),d&&w(e,d),e}var H=10,U=function(){function e(d){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=d}var S=e.prototype;return S.reloaded=function(h){if(!h){this.advanced=!0,this.updated=!0;return}var o=this.lastPartSn-h.lastPartSn,a=this.lastPartIndex-h.lastPartIndex;this.updated=this.endSN!==h.endSN||!!a||!!o,this.advanced=this.endSN>h.endSN||o>0||o===0&&a>0,this.updated||this.advanced?this.misses=Math.floor(h.misses*.6):this.misses=h.misses+1,this.availabilityDelay=h.availabilityDelay},R(e,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(k.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||H}},{key:"drift",get:function(){var h=this.driftEndTime-this.driftStartTime;if(h>0){var o=this.driftEnd-this.driftStart;return o*1e3/h}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var h;return(h=this.partList)!==null&&h!==void 0&&h.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var h;return(h=this.fragments)!==null&&h!==void 0&&h.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 h;return(h=this.partList)!==null&&h!==void 0&&h.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var h;return(h=this.partList)!==null&&h!==void 0&&h.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),e}()},"./src/loader/level-key.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"LevelKey",function(){return U});var k=O("./node_modules/url-toolkit/src/url-toolkit.js"),w=O.n(k);function R(e,S){for(var d=0;d<S.length;d++){var h=S[d];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(e,h.key,h)}}function H(e,S,d){return S&&R(e.prototype,S),d&&R(e,d),e}var U=function(){e.fromURL=function(d,h){return new e(d,h)},e.fromURI=function(d){return new e(d)};function e(S,d){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,d?this._uri=Object(k.buildAbsoluteURL)(S,d,{alwaysNormalize:!0}):this._uri=S}return H(e,[{key:"uri",get:function(){return this._uri}}]),e}()},"./src/loader/load-stats.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"LoadStats",function(){return k});var k=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return i});var k=O("./src/polyfills/number.ts"),w=O("./node_modules/url-toolkit/src/url-toolkit.js"),R=O.n(w),H=O("./src/loader/fragment.ts"),U=O("./src/loader/level-details.ts"),e=O("./src/loader/level-key.ts"),S=O("./src/utils/attr-list.ts"),d=O("./src/utils/logger.ts"),h=O("./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,r=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 n(E){var b,g;return s.test((b=(g=w.parseURL(E))===null||g===void 0?void 0:g.path)!=null?b:"")}var i=function(){function E(){}return E.findGroup=function(g,c){for(var m=0;m<g.length;m++){var u=g[m];if(u.id===c)return u}},E.convertAVC1ToAVCOTI=function(g){var c=g.split(".");if(c.length>2){var m=c.shift()+".";return m+=parseInt(c.shift()).toString(16),m+=("000"+parseInt(c.shift()).toString(16)).substr(-4),m}return g},E.resolve=function(g,c){return w.buildAbsoluteURL(c,g,{alwaysNormalize:!0})},E.parseMasterPlaylist=function(g,c){var m=[],u={},_=!1;o.lastIndex=0;for(var y;(y=o.exec(g))!=null;)if(y[1]){var T=new S.AttrList(y[1]),M={attrs:T,bitrate:T.decimalInteger("AVERAGE-BANDWIDTH")||T.decimalInteger("BANDWIDTH"),name:T.NAME,url:E.resolve(y[2],c)},L=T.decimalResolution("RESOLUTION");L&&(M.width=L.width,M.height=L.height),t((T.CODECS||"").split(/[ ,]+/).filter(function(D){return D}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=E.convertAVC1ToAVCOTI(M.videoCodec)),m.push(M)}else if(y[3]){var x=new S.AttrList(y[3]);x["DATA-ID"]&&(_=!0,u[x["DATA-ID"]]=x)}return{levels:m,sessionData:_?u:null}},E.parseMasterPlaylistMedia=function(g,c,m,u){u===void 0&&(u=[]);var _,y=[],T=0;for(a.lastIndex=0;(_=a.exec(g))!==null;){var M=new S.AttrList(_[1]);if(M.TYPE===m){var L={attrs:M,bitrate:0,id:T++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:m,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?E.resolve(M.URI,c):""};if(u.length){var x=E.findGroup(u,L.groupId)||u[0];v(L,x,"audioCodec"),v(L,x,"textCodec")}y.push(L)}}return y},E.parseLevelPlaylist=function(g,c,m,u,_){var y=new U.LevelDetails(c),T=y.fragments,M=null,L=0,x=0,D=0,j=0,I=null,W=new H.Fragment(u,c),Q,fe,de,Oe=-1,Se=!1;for(r.lastIndex=0,y.m3u8=g;(Q=r.exec(g))!==null;){Se&&(Se=!1,W=new H.Fragment(u,c),W.start=D,W.sn=L,W.cc=j,W.level=m,M&&(W.initSegment=M,W.rawProgramDateTime=M.rawProgramDateTime));var Ie=Q[1];if(Ie){W.duration=parseFloat(Ie);var Le=(" "+Q[2]).slice(1);W.title=Le||null,W.tagList.push(Le?["INF",Ie,Le]:["INF",Ie])}else if(Q[3])Object(k.isFiniteNumber)(W.duration)&&(W.start=D,de&&(W.levelkey=de),W.sn=L,W.level=m,W.cc=j,W.urlId=_,T.push(W),W.relurl=(" "+Q[3]).slice(1),p(W,I),I=W,D+=W.duration,L++,x=0,Se=!0);else if(Q[4]){var Ne=(" "+Q[4]).slice(1);I?W.setByteRange(Ne,I):W.setByteRange(Ne)}else if(Q[5])W.rawProgramDateTime=(" "+Q[5]).slice(1),W.tagList.push(["PROGRAM-DATE-TIME",W.rawProgramDateTime]),Oe===-1&&(Oe=T.length);else{if(Q=Q[0].match(l),!Q){d.logger.warn("No matches on slow regex match for level playlist!");continue}for(fe=1;fe<Q.length&&!(typeof Q[fe]!="undefined");fe++);var be=(" "+Q[fe]).slice(1),N=(" "+Q[fe+1]).slice(1),A=Q[fe+2]?(" "+Q[fe+2]).slice(1):"";switch(be){case"PLAYLIST-TYPE":y.type=N.toUpperCase();break;case"MEDIA-SEQUENCE":L=y.startSN=parseInt(N);break;case"SKIP":{var C=new S.AttrList(N),F=C.decimalInteger("SKIPPED-SEGMENTS");if(Object(k.isFiniteNumber)(F)){y.skippedSegments=F;for(var G=F;G--;)T.unshift(null);L+=F}var P=C.enumeratedString("RECENTLY-REMOVED-DATERANGES");P&&(y.recentlyRemovedDateranges=P.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(N);break;case"VERSION":y.version=parseInt(N);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(N||A)&&W.tagList.push(A?[N,A]:[N]);break;case"DIS":j++;case"GAP":W.tagList.push([be]);break;case"BITRATE":W.tagList.push([be,N]);break;case"DISCONTINUITY-SEQ":j=parseInt(N);break;case"KEY":{var oe,we=new S.AttrList(N),Re=we.enumeratedString("METHOD"),ee=we.URI,ce=we.hexadecimalInteger("IV"),Ee=we.enumeratedString("KEYFORMATVERSIONS"),Ae=we.enumeratedString("KEYID"),Me=(oe=we.enumeratedString("KEYFORMAT"))!=null?oe:"identity",Be=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Be.indexOf(Me)>-1){d.logger.warn("Keyformat "+Me+" is not supported from the manifest");continue}else if(Me!=="identity")continue;Re&&(de=e.LevelKey.fromURL(c,ee),ee&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Re)>=0&&(de.method=Re,de.keyFormat=Me,Ae&&(de.keyID=Ae),Ee&&(de.keyFormatVersions=Ee),de.iv=ce));break}case"START":{var He=new S.AttrList(N),Fe=He.decimalFloatingPoint("TIME-OFFSET");Object(k.isFiniteNumber)(Fe)&&(y.startTimeOffset=Fe);break}case"MAP":{var Ve=new S.AttrList(N);W.relurl=Ve.URI,Ve.BYTERANGE&&W.setByteRange(Ve.BYTERANGE),W.level=m,W.sn="initSegment",de&&(W.levelkey=de),W.initSegment=null,M=W,Se=!0;break}case"SERVER-CONTROL":{var Ke=new S.AttrList(N);y.canBlockReload=Ke.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Ke.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Ke.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Ke.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Ke.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ge=new S.AttrList(N);y.partTarget=Ge.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ue=y.partList;Ue||(Ue=y.partList=[]);var qe=x>0?Ue[Ue.length-1]:void 0,et=x++,q=new H.Part(new S.AttrList(N),W,c,et,qe);Ue.push(q),W.duration+=q.duration;break}case"PRELOAD-HINT":{var K=new S.AttrList(N);y.preloadHint=K;break}case"RENDITION-REPORT":{var V=new S.AttrList(N);y.renditionReports=y.renditionReports||[],y.renditionReports.push(V);break}default:d.logger.warn("line parsed but not handled: "+Q);break}}}I&&!I.relurl?(T.pop(),D-=I.duration,y.partList&&(y.fragmentHint=I)):y.partList&&(p(W,I),W.cc=j,y.fragmentHint=W);var Z=T.length,ie=T[0],Y=T[Z-1];if(D+=y.skippedSegments*y.targetduration,D>0&&Z&&Y){y.averagetargetduration=D/Z;var J=Y.sn;y.endSN=J!=="initSegment"?J:0,ie&&(y.startCC=ie.cc,ie.initSegment||y.fragments.every(function(ne){return ne.relurl&&n(ne.relurl)})&&(d.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),W=new H.Fragment(u,c),W.relurl=Y.relurl,W.level=m,W.sn="initSegment",ie.initSegment=W,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(D+=y.fragmentHint.duration),y.totalduration=D,y.endCC=j,Oe>0&&f(T,Oe),y},E}();function t(E,b){["video","audio","text"].forEach(function(g){var c=E.filter(function(u){return Object(h.isCodecType)(u,g)});if(c.length){var m=c.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});b[g+"Codec"]=m.length>0?m[0]:c[0],E=E.filter(function(u){return c.indexOf(u)===-1})}}),b.unknownCodecs=E}function v(E,b,g){var c=b[g];c&&(E[g]=c)}function f(E,b){for(var g=E[b],c=b;c--;){var m=E[c];if(!m)return;m.programDateTime=g.programDateTime-m.duration*1e3,g=m}}function p(E,b){E.rawProgramDateTime?E.programDateTime=Date.parse(E.rawProgramDateTime):b!=null&&b.programDateTime&&(E.programDateTime=b.endProgramDateTime),Object(k.isFiniteNumber)(E.programDateTime)||(E.programDateTime=null,E.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/polyfills/number.ts"),w=O("./src/events.ts"),R=O("./src/errors.ts"),H=O("./src/utils/logger.ts"),U=O("./src/utils/mp4-tools.ts"),e=O("./src/loader/m3u8-parser.ts"),S=O("./src/types/loader.ts"),d=O("./src/utils/attr-list.ts");function h(r){var l=r.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(r,l){var s=r.url;return(s===void 0||s.indexOf("data:")===0)&&(s=l.url),s}var a=function(){function r(s){this.hls=void 0,this.loaders=Object.create(null),this.hls=s,this.registerListeners()}var l=r.prototype;return l.registerListeners=function(){var n=this.hls;n.on(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(w.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(w.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.on(w.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},l.unregisterListeners=function(){var n=this.hls;n.off(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(w.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(w.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.off(w.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},l.createInternalLoader=function(n){var i=this.hls.config,t=i.pLoader,v=i.loader,f=t||v,p=new f(i);return n.loader=p,this.loaders[n.type]=p,p},l.getInternalLoader=function(n){return this.loaders[n.type]},l.resetInternalLoader=function(n){this.loaders[n]&&delete this.loaders[n]},l.destroyInternalLoaders=function(){for(var n in this.loaders){var i=this.loaders[n];i&&i.destroy(),this.resetInternalLoader(n)}},l.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},l.onManifestLoading=function(n,i){var t=i.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:S.PlaylistContextType.MANIFEST,url:t,deliveryDirectives:null})},l.onLevelLoading=function(n,i){var t=i.id,v=i.level,f=i.url,p=i.deliveryDirectives;this.load({id:t,groupId:null,level:v,responseType:"text",type:S.PlaylistContextType.LEVEL,url:f,deliveryDirectives:p})},l.onAudioTrackLoading=function(n,i){var t=i.id,v=i.groupId,f=i.url,p=i.deliveryDirectives;this.load({id:t,groupId:v,level:null,responseType:"text",type:S.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:p})},l.onSubtitleTrackLoading=function(n,i){var t=i.id,v=i.groupId,f=i.url,p=i.deliveryDirectives;this.load({id:t,groupId:v,level:null,responseType:"text",type:S.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:p})},l.load=function(n){var i,t=this.hls.config,v=this.getInternalLoader(n);if(v){var f=v.context;if(f&&f.url===n.url){H.logger.trace("[playlist-loader]: playlist request ongoing");return}H.logger.log("[playlist-loader]: aborting previous loader for type: "+n.type),v.abort()}var p,E,b,g;switch(n.type){case S.PlaylistContextType.MANIFEST:p=t.manifestLoadingMaxRetry,E=t.manifestLoadingTimeOut,b=t.manifestLoadingRetryDelay,g=t.manifestLoadingMaxRetryTimeout;break;case S.PlaylistContextType.LEVEL:case S.PlaylistContextType.AUDIO_TRACK:case S.PlaylistContextType.SUBTITLE_TRACK:p=0,E=t.levelLoadingTimeOut;break;default:p=t.levelLoadingMaxRetry,E=t.levelLoadingTimeOut,b=t.levelLoadingRetryDelay,g=t.levelLoadingMaxRetryTimeout;break}if(v=this.createInternalLoader(n),(i=n.deliveryDirectives)!==null&&i!==void 0&&i.part){var c;if(n.type===S.PlaylistContextType.LEVEL&&n.level!==null?c=this.hls.levels[n.level].details:n.type===S.PlaylistContextType.AUDIO_TRACK&&n.id!==null?c=this.hls.audioTracks[n.id].details:n.type===S.PlaylistContextType.SUBTITLE_TRACK&&n.id!==null&&(c=this.hls.subtitleTracks[n.id].details),c){var m=c.partTarget,u=c.targetduration;m&&u&&(E=Math.min(Math.max(m*3,u*.8)*1e3,E))}}var _={timeout:E,maxRetry:p,retryDelay:b,maxRetryDelay:g,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};v.load(n,_,y)},l.loadsuccess=function(n,i,t,v){if(v===void 0&&(v=null),t.isSidxRequest){this.handleSidxRequest(n,t),this.handlePlaylistLoaded(n,i,t,v);return}this.resetInternalLoader(t.type);var f=n.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(n,t,"no EXTM3U delimiter",v);return}i.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(n,i,t,v):this.handleMasterPlaylist(n,i,t,v)},l.loaderror=function(n,i,t){t===void 0&&(t=null),this.handleNetworkError(i,t,!1,n)},l.loadtimeout=function(n,i,t){t===void 0&&(t=null),this.handleNetworkError(i,t,!0)},l.handleMasterPlaylist=function(n,i,t,v){var f=this.hls,p=n.data,E=o(n,t),b=e.default.parseMasterPlaylist(p,E),g=b.levels,c=b.sessionData;if(!g.length){this.handleManifestParsingError(n,t,"no level found in manifest",v);return}var m=g.map(function(L){return{id:L.attrs.AUDIO,audioCodec:L.audioCodec}}),u=g.map(function(L){return{id:L.attrs.SUBTITLES,textCodec:L.textCodec}}),_=e.default.parseMasterPlaylistMedia(p,E,"AUDIO",m),y=e.default.parseMasterPlaylistMedia(p,E,"SUBTITLES",u),T=e.default.parseMasterPlaylistMedia(p,E,"CLOSED-CAPTIONS");if(_.length){var M=_.some(function(L){return!L.url});!M&&g[0].audioCodec&&!g[0].attrs.AUDIO&&(H.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),_.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new d.AttrList({}),bitrate:0,url:""}))}f.trigger(w.Events.MANIFEST_LOADED,{levels:g,audioTracks:_,subtitles:y,captions:T,url:E,stats:i,networkDetails:v,sessionData:c})},l.handleTrackOrLevelPlaylist=function(n,i,t,v){var f=this.hls,p=t.id,E=t.level,b=t.type,g=o(n,t),c=Object(k.isFiniteNumber)(p)?p:0,m=Object(k.isFiniteNumber)(E)?E:c,u=h(t),_=e.default.parseLevelPlaylist(n.data,g,m,u,c);if(!_.fragments.length){f.trigger(w.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:typeof t.level=="number"?t.level:void 0});return}if(b===S.PlaylistContextType.MANIFEST){var y={attrs:new d.AttrList({}),bitrate:0,details:_,name:"",url:g};f.trigger(w.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:g,stats:i,networkDetails:v,sessionData:null})}if(i.parsing.end=performance.now(),_.needSidxRanges){var T,M=(T=_.fragments[0].initSegment)===null||T===void 0?void 0:T.url;this.load({url:M,isSidxRequest:!0,type:b,level:E,levelDetails:_,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}t.levelDetails=_,this.handlePlaylistLoaded(n,i,t,v)},l.handleSidxRequest=function(n,i){var t=Object(U.parseSegmentIndex)(new Uint8Array(n.data));if(!t)return;var v=t.references,f=i.levelDetails;v.forEach(function(p,E){var b=p.info,g=f.fragments[E];g.byteRange.length===0&&g.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),g.initSegment&&g.initSegment.setByteRange(String(t.moovEndOffset)+"@0")})},l.handleManifestParsingError=function(n,i,t,v){this.hls.trigger(w.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:i.type===S.PlaylistContextType.MANIFEST,url:n.url,reason:t,response:n,context:i,networkDetails:v})},l.handleNetworkError=function(n,i,t,v){t===void 0&&(t=!1),H.logger.warn("[playlist-loader]: A network "+(t?"timeout":"error")+" occurred while loading "+n.type+" level: "+n.level+" id: "+n.id+' group-id: "'+n.groupId+'"');var f=R.ErrorDetails.UNKNOWN,p=!1,E=this.getInternalLoader(n);switch(n.type){case S.PlaylistContextType.MANIFEST:f=t?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case S.PlaylistContextType.LEVEL:f=t?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case S.PlaylistContextType.AUDIO_TRACK:f=t?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case S.PlaylistContextType.SUBTITLE_TRACK:f=t?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}E&&this.resetInternalLoader(n.type);var b={type:R.ErrorTypes.NETWORK_ERROR,details:f,fatal:p,url:n.url,loader:E,context:n,networkDetails:i};v&&(b.response=v),this.hls.trigger(w.Events.ERROR,b)},l.handlePlaylistLoaded=function(n,i,t,v){var f=t.type,p=t.level,E=t.id,b=t.groupId,g=t.loader,c=t.levelDetails,m=t.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(n,t,"invalid target duration",v);return}if(!g)return;c.live&&(g.getCacheAge&&(c.ageHeader=g.getCacheAge()||0),(!g.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(f){case S.PlaylistContextType.MANIFEST:case S.PlaylistContextType.LEVEL:this.hls.trigger(w.Events.LEVEL_LOADED,{details:c,level:p||0,id:E||0,stats:i,networkDetails:v,deliveryDirectives:m});break;case S.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(w.Events.AUDIO_TRACK_LOADED,{details:c,id:E||0,groupId:b||"",stats:i,networkDetails:v,deliveryDirectives:m});break;case S.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(w.Events.SUBTITLE_TRACK_LOADED,{details:c,id:E||0,groupId:b||"",stats:i,networkDetails:v,deliveryDirectives:m});break}},r}();B.default=a},"./src/polyfills/number.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"isFiniteNumber",function(){return k}),O.d(B,"MAX_SAFE_INTEGER",function(){return w});var k=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},w=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ae,B,O){"use strict";O.r(B);var k=function(){function w(){}return w.getSilentFrame=function(H,U){switch(H){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===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(U===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(U===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(U===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(U===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},w}();B.default=k},"./src/remux/mp4-generator.ts":function(ae,B,O){"use strict";O.r(B);var k=Math.pow(2,32)-1,w=function(){function R(){}return R.init=function(){R.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 U;for(U in R.types)R.types.hasOwnProperty(U)&&(R.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var e=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]);R.HDLR_TYPES={video:e,audio:S};var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),h=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=h,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.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]),r=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,o,r,o,a),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,d))},R.box=function(U){for(var e=8,S=arguments.length,d=new Array(S>1?S-1:0),h=1;h<S;h++)d[h-1]=arguments[h];for(var o=d.length,a=o;o--;)e+=d[o].byteLength;var r=new Uint8Array(e);for(r[0]=e>>24&255,r[1]=e>>16&255,r[2]=e>>8&255,r[3]=e&255,r.set(U,4),o=0,e=8;o<a;o++)r.set(d[o],e),e+=d[o].byteLength;return r},R.hdlr=function(U){return R.box(R.types.hdlr,R.HDLR_TYPES[U])},R.mdat=function(U){return R.box(R.types.mdat,U)},R.mdhd=function(U,e){e*=U;var S=Math.floor(e/(k+1)),d=Math.floor(e%(k+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,S>>24,S>>16&255,S>>8&255,S&255,d>>24,d>>16&255,d>>8&255,d&255,85,196,0,0]))},R.mdia=function(U){return R.box(R.types.mdia,R.mdhd(U.timescale,U.duration),R.hdlr(U.type),R.minf(U))},R.mfhd=function(U){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},R.minf=function(U){return U.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(U)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(U))},R.moof=function(U,e,S){return R.box(R.types.moof,R.mfhd(U),R.traf(S,e))},R.moov=function(U){for(var e=U.length,S=[];e--;)S[e]=R.trak(U[e]);return R.box.apply(null,[R.types.moov,R.mvhd(U[0].timescale,U[0].duration)].concat(S).concat(R.mvex(U)))},R.mvex=function(U){for(var e=U.length,S=[];e--;)S[e]=R.trex(U[e]);return R.box.apply(null,[R.types.mvex].concat(S))},R.mvhd=function(U,e){e*=U;var S=Math.floor(e/(k+1)),d=Math.floor(e%(k+1)),h=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,S>>24,S>>16&255,S>>8&255,S&255,d>>24,d>>16&255,d>>8&255,d&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 R.box(R.types.mvhd,h)},R.sdtp=function(U){var e=U.samples||[],S=new Uint8Array(4+e.length),d,h;for(d=0;d<e.length;d++)h=e[d].flags,S[d+4]=h.dependsOn<<4|h.isDependedOn<<2|h.hasRedundancy;return R.box(R.types.sdtp,S)},R.stbl=function(U){return R.box(R.types.stbl,R.stsd(U),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(U){var e=[],S=[],d,h,o;for(d=0;d<U.sps.length;d++)h=U.sps[d],o=h.byteLength,e.push(o>>>8&255),e.push(o&255),e=e.concat(Array.prototype.slice.call(h));for(d=0;d<U.pps.length;d++)h=U.pps[d],o=h.byteLength,S.push(o>>>8&255),S.push(o&255),S=S.concat(Array.prototype.slice.call(h));var a=R.box(R.types.avcC,new Uint8Array([1,e[3],e[4],e[5],252|3,224|U.sps.length].concat(e).concat([U.pps.length]).concat(S))),r=U.width,l=U.height,s=U.pixelRatio[0],n=U.pixelRatio[1];return R.box(R.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,r>>8&255,r&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,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([s>>24,s>>16&255,s>>8&255,s&255,n>>24,n>>16&255,n>>8&255,n&255])))},R.esds=function(U){var e=U.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(U.config).concat([6,1,2]))},R.mp4a=function(U){var e=U.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,e>>8&255,e&255,0,0]),R.box(R.types.esds,R.esds(U)))},R.mp3=function(U){var e=U.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,e>>8&255,e&255,0,0]))},R.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(U)):R.box(R.types.stsd,R.STSD,R.mp4a(U)):R.box(R.types.stsd,R.STSD,R.avc1(U))},R.tkhd=function(U){var e=U.id,S=U.duration*U.timescale,d=U.width,h=U.height,o=Math.floor(S/(k+1)),a=Math.floor(S%(k+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&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,d>>8&255,d&255,0,0,h>>8&255,h&255,0,0]))},R.traf=function(U,e){var S=R.sdtp(U),d=U.id,h=Math.floor(e/(k+1)),o=Math.floor(e%(k+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,d>>24,d>>16&255,d>>8&255,d&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,h>>24,h>>16&255,h>>8&255,h&255,o>>24,o>>16&255,o>>8&255,o&255])),R.trun(U,S.length+16+20+8+16+8+8),S)},R.trak=function(U){return U.duration=U.duration||4294967295,R.box(R.types.trak,R.tkhd(U),R.mdia(U))},R.trex=function(U){var e=U.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(U,e){var S=U.samples||[],d=S.length,h=12+16*d,o=new Uint8Array(h),a,r,l,s,n,i;for(e+=8+h,o.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,d&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255],0),a=0;a<d;a++)r=S[a],l=r.duration,s=r.size,n=r.flags,i=r.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,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.paddingValue<<1|n.isNonSync,n.degradPrio&240<<8,n.degradPrio&15,i>>>24&255,i>>>16&255,i>>>8&255,i&255],12+16*a);return R.box(R.types.trun,o)},R.initSegment=function(U){R.types||R.init();var e=R.moov(U),S=new Uint8Array(R.FTYP.byteLength+e.byteLength);return S.set(R.FTYP),S.set(e,R.FTYP.byteLength),S},R}();w.types=void 0,w.HDLR_TYPES=void 0,w.STTS=void 0,w.STSC=void 0,w.STCO=void 0,w.STSZ=void 0,w.VMHD=void 0,w.SMHD=void 0,w.STSD=void 0,w.FTYP=void 0,w.DINF=void 0,B.default=w},"./src/remux/mp4-remuxer.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return i}),O.d(B,"normalizePts",function(){return t});var k=O("./src/polyfills/number.ts"),w=O("./src/remux/aac-helper.ts"),R=O("./src/remux/mp4-generator.ts"),H=O("./src/events.ts"),U=O("./src/errors.ts"),e=O("./src/utils/logger.ts"),S=O("./src/types/loader.ts"),d=O("./src/utils/timescale-conversion.ts");function h(){return h=Object.assign||function(E){for(var b=1;b<arguments.length;b++){var g=arguments[b];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(E[c]=g[c])}return E},h.apply(this,arguments)}var o=10*1e3,a=1024,r=1152,l=null,s=null,n=!1,i=function(){function E(g,c,m,u){if(u===void 0&&(u=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=g,this.config=c,this.typeSupported=m,this.ISGenerated=!1,l===null){var _=navigator.userAgent||"",y=_.match(/Chrome\/(\d+)/i);l=y?parseInt(y[1]):0}if(s===null){var T=navigator.userAgent.match(/Safari\/(\d+)/i);s=T?parseInt(T[1]):0}n=!!l&&l<75||!!s&&s<600}var b=E.prototype;return b.destroy=function(){},b.resetTimeStamp=function(c){e.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},b.resetNextTimestamp=function(){e.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){e.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(c){var m=!1,u=c.reduce(function(_,y){var T=y.pts-_;return T<-4294967296?(m=!0,t(_,y.pts)):T>0?_:y.pts},c[0].pts);return m&&e.logger.debug("PTS rollover detected"),u},b.remux=function(c,m,u,_,y,T,M,L){var x,D,j,I,W,Q,fe=y,de=y,Oe=c.pid>-1,Se=m.pid>-1,Ie=m.samples.length,Le=c.samples.length>0,Ne=Ie>1,be=(!Oe||Le)&&(!Se||Ne)||this.ISGenerated||M;if(be){this.ISGenerated||(j=this.generateIS(c,m,y));var N=this.isVideoContiguous,A=-1;if(Ne&&(A=v(m.samples),!N&&this.config.forceKeyFrameOnDiscontinuity))if(Q=!0,A>0){e.logger.warn("[mp4-remuxer]: Dropped "+A+" out of "+Ie+" video samples due to a missing keyframe");var C=this.getVideoStartPts(m.samples);m.samples=m.samples.slice(A),m.dropped+=A,de+=(m.samples[0].pts-C)/(m.timescale||9e4)}else A===-1&&(e.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ie+" video samples"),Q=!1);if(this.ISGenerated){if(Le&&Ne){var F=this.getVideoStartPts(m.samples),G=t(c.samples[0].pts,F)-F,P=G/m.inputTimeScale;fe+=Math.max(0,P),de+=Math.max(0,-P)}if(Le){if(c.samplerate||(e.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),j=this.generateIS(c,m,y)),D=this.remuxAudio(c,fe,this.isAudioContiguous,T,Se||Ne||L===S.PlaylistLevelType.AUDIO?de:void 0),Ne){var oe=D?D.endPTS-D.startPTS:0;m.inputTimeScale||(e.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),j=this.generateIS(c,m,y)),x=this.remuxVideo(m,de,N,oe)}}else Ne&&(x=this.remuxVideo(m,de,N,0));x&&(x.firstKeyFrame=A,x.independent=A!==-1)}}return this.ISGenerated&&(u.samples.length&&(W=this.remuxID3(u,y)),_.samples.length&&(I=this.remuxText(_,y))),{audio:D,video:x,initSegment:j,independent:Q,text:I,id3:W}},b.generateIS=function(c,m,u){var _=c.samples,y=m.samples,T=this.typeSupported,M={},L=!Object(k.isFiniteNumber)(this._initPTS),x="audio/mp4",D,j,I;if(L&&(D=j=Infinity),c.config&&_.length&&(c.timescale=c.samplerate,c.isAAC||(T.mpeg?(x="audio/mpeg",c.codec=""):T.mp3&&(c.codec="mp3")),M.audio={id:"audio",container:x,codec:c.codec,initSegment:!c.isAAC&&T.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},L&&(I=c.inputTimeScale,D=j=_[0].pts-Math.round(I*u))),m.sps&&m.pps&&y.length&&(m.timescale=m.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:m.codec,initSegment:R.default.initSegment([m]),metadata:{width:m.width,height:m.height}},L)){I=m.inputTimeScale;var W=this.getVideoStartPts(y),Q=Math.round(I*u);j=Math.min(j,t(y[0].dts,W)-Q),D=Math.min(D,W-Q)}if(Object.keys(M).length)return this.ISGenerated=!0,L&&(this._initPTS=D,this._initDTS=j),{tracks:M,initPTS:D,timescale:I}},b.remuxVideo=function(c,m,u,_){var y=c.inputTimeScale,T=c.samples,M=[],L=T.length,x=this._initPTS,D=this.nextAvcDts,j=8,I,W,Q,fe=Number.POSITIVE_INFINITY,de=Number.NEGATIVE_INFINITY,Oe=0,Se=!1;if(!u||D===null){var Ie=m*y,Le=T[0].pts-t(T[0].dts,T[0].pts);D=Ie-Le}for(var Ne=0;Ne<L;Ne++){var be=T[Ne];if(be.pts=t(be.pts-x,D),be.dts=t(be.dts-x,D),be.dts>be.pts){var N=9e4*.2;Oe=Math.max(Math.min(Oe,be.pts-be.dts),-1*N)}be.dts<T[Ne>0?Ne-1:Ne].dts&&(Se=!0)}Se&&T.sort(function(_t,at){var Qe=_t.dts-at.dts,kt=_t.pts-at.pts;return Qe||kt}),W=T[0].dts,Q=T[T.length-1].dts;var A=Math.round((Q-W)/(L-1));if(Oe<0){if(Oe<A*-2){e.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(d.toMsFromMpegTsClock)(-A,!0)+" ms");for(var C=Oe,F=0;F<L;F++)T[F].dts=C=Math.max(C,T[F].pts-A),T[F].pts=Math.max(C,T[F].pts)}else{e.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(d.toMsFromMpegTsClock)(Oe,!0)+" ms to overcome this issue");for(var G=0;G<L;G++)T[G].dts=T[G].dts+Oe}W=T[0].dts}if(u){var P=W-D,oe=P>A,we=P<-1;if(oe||we){oe?e.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(P,!0)+" ms ("+P+"dts) hole between fragments detected, filling it"):e.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(-P,!0)+" ms ("+P+"dts) overlapping between fragments detected"),W=D;var Re=T[0].pts-P;T[0].dts=W,T[0].pts=Re,e.logger.log("Video: First PTS/DTS adjusted: "+Object(d.toMsFromMpegTsClock)(Re,!0)+"/"+Object(d.toMsFromMpegTsClock)(W,!0)+", delta: "+Object(d.toMsFromMpegTsClock)(P,!0)+" ms")}}n&&(W=Math.max(0,W));for(var ee=0,ce=0,Ee=0;Ee<L;Ee++){for(var Ae=T[Ee],Me=Ae.units,Be=Me.length,He=0,Fe=0;Fe<Be;Fe++)He+=Me[Fe].data.length;ce+=He,ee+=Be,Ae.length=He,Ae.dts=Math.max(Ae.dts,W),Ae.pts=Math.max(Ae.pts,Ae.dts,0),fe=Math.min(Ae.pts,fe),de=Math.max(Ae.pts,de)}Q=T[L-1].dts;var Ve=ce+4*ee+8,Ke;try{Ke=new Uint8Array(Ve)}catch(_t){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ve,reason:"fail allocating video mdat "+Ve});return}var Ge=new DataView(Ke.buffer);Ge.setUint32(0,Ve),Ke.set(R.default.types.mdat,4);for(var Ue=0;Ue<L;Ue++){for(var qe=T[Ue],et=qe.units,q=0,K=0,V=et.length;K<V;K++){var Z=et[K],ie=Z.data,Y=Z.data.byteLength;Ge.setUint32(j,Y),j+=4,Ke.set(ie,j),j+=Y,q+=4+Y}if(Ue<L-1)I=T[Ue+1].dts-qe.dts;else{var J=this.config,ne=qe.dts-T[Ue>0?Ue-1:Ue].dts;if(J.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(J.maxBufferHole*y),Te=(_?fe+_*y:this.nextAudioPts)-qe.pts;Te>se?(I=Te-ne,I<0&&(I=ne),e.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=ne}else I=ne}var _e=Math.round(qe.pts-qe.dts);M.push(new f(qe.key,I,q,_e))}if(M.length&&l&&l<70){var De=M[0].flags;De.dependsOn=2,De.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=D=Q+I,this.isVideoContiguous=!0;var We=R.default.moof(c.sequenceNumber++,W,h({},c,{samples:M})),$e="video",Xe={data1:We,data2:Ke,startPTS:fe/y,endPTS:(de+I)/y,startDTS:W/y,endDTS:D/y,type:$e,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Ke.length,"MDAT length must not be zero"),Xe},b.remuxAudio=function(c,m,u,_,y){var T=c.inputTimeScale,M=c.samplerate?c.samplerate:T,L=T/M,x=c.isAAC?a:r,D=x*L,j=this._initPTS,I=!c.isAAC&&this.typeSupported.mpeg,W=[],Q=c.samples,fe=I?0:8,de=this.nextAudioPts||-1,Oe=m*T;if(this.isAudioContiguous=u=u||Q.length&&de>0&&(_&&Math.abs(Oe-de)<9e3||Math.abs(t(Q[0].pts-j,Oe)-de)<20*D),Q.forEach(function(ie){ie.pts=t(ie.pts-j,Oe)}),!u||de<0){if(Q=Q.filter(function(ie){return ie.pts>=0}),!Q.length)return;y===0?de=0:_?de=Math.max(0,Oe):de=Q[0].pts}if(c.isAAC)for(var Se=y!==void 0,Ie=this.config.maxAudioFramesDrift,Le=0,Ne=de;Le<Q.length;Le++){var be=Q[Le],N=be.pts,A=N-Ne,C=Math.abs(1e3*A/T);if(A<=-Ie*D&&Se)Le===0&&(e.logger.warn("Audio frame @ "+(N/T).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*A/T)+" ms."),this.nextAudioPts=de=Ne=N);else if(A>=Ie*D&&C<o&&Se){var F=Math.round(A/D);Ne=N-F*D,Ne<0&&(F--,Ne+=D),Le===0&&(this.nextAudioPts=de=Ne),e.logger.warn("[mp4-remuxer]: Injecting "+F+" audio frame @ "+(Ne/T).toFixed(3)+"s due to "+Math.round(1e3*A/T)+" ms gap.");for(var G=0;G<F;G++){var P=Math.max(Ne,0),oe=w.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);oe||(e.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),oe=be.unit.subarray()),Q.splice(Le,0,{unit:oe,pts:P}),Ne+=D,Le++}}be.pts=Ne,Ne+=D}for(var we=null,Re=null,ee,ce=0,Ee=Q.length;Ee--;)ce+=Q[Ee].unit.byteLength;for(var Ae=0,Me=Q.length;Ae<Me;Ae++){var Be=Q[Ae],He=Be.unit,Fe=Be.pts;if(Re!==null){var Ve=W[Ae-1];Ve.duration=Math.round((Fe-Re)/L)}else if(u&&c.isAAC&&(Fe=de),we=Fe,ce>0){ce+=fe;try{ee=new Uint8Array(ce)}catch(ie){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ce,reason:"fail allocating audio mdat "+ce});return}if(!I){var Ke=new DataView(ee.buffer);Ke.setUint32(0,ce),ee.set(R.default.types.mdat,4)}}else return;ee.set(He,fe);var Ge=He.byteLength;fe+=Ge,W.push(new f(!0,x,Ge,0)),Re=Fe}var Ue=W.length;if(!Ue)return;var qe=W[W.length-1];this.nextAudioPts=de=Re+L*qe.duration;var et=I?new Uint8Array(0):R.default.moof(c.sequenceNumber++,we/L,h({},c,{samples:W}));c.samples=[];var q=we/T,K=de/T,V="audio",Z={data1:et,data2:ee,startPTS:q,endPTS:K,startDTS:q,endDTS:K,type:V,hasAudio:!0,hasVideo:!1,nb:Ue};return this.isAudioContiguous=!0,console.assert(ee.length,"MDAT length must not be zero"),Z},b.remuxEmptyAudio=function(c,m,u,_){var y=c.inputTimeScale,T=c.samplerate?c.samplerate:y,M=y/T,L=this.nextAudioPts,x=(L!==null?L:_.startDTS*y)+this._initDTS,D=_.endDTS*y+this._initDTS,j=M*a,I=Math.ceil((D-x)/j),W=w.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(e.logger.warn("[mp4-remuxer]: remux empty Audio"),!W){e.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Q=[],fe=0;fe<I;fe++){var de=x+fe*j;Q.push({unit:W,pts:de,dts:de})}return c.samples=Q,this.remuxAudio(c,m,u,!1)},b.remuxID3=function(c,m){var u=c.samples.length;if(!u)return;for(var _=c.inputTimeScale,y=this._initPTS,T=this._initDTS,M=0;M<u;M++){var L=c.samples[M];L.pts=t(L.pts-y,m*_)/_,L.dts=t(L.dts-T,m*_)/_}var x=c.samples;return c.samples=[],{samples:x}},b.remuxText=function(c,m){var u=c.samples.length;if(!u)return;for(var _=c.inputTimeScale,y=this._initPTS,T=0;T<u;T++){var M=c.samples[T];M.pts=t(M.pts-y,m*_)/_}c.samples.sort(function(x,D){return x.pts-D.pts});var L=c.samples;return c.samples=[],{samples:L}},E}();function t(E,b){var g;if(b===null)return E;for(b<E?g=-8589934592:g=8589934592;Math.abs(E-b)>4294967296;)E+=g;return E}function v(E){for(var b=0;b<E.length;b++)if(E[b].key)return b;return-1}var f=function(b,g,c,m){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=g,this.size=c,this.cts=m,this.flags=new p(b)},p=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(ae,B,O){"use strict";O.r(B);var k=O("./src/polyfills/number.ts"),w=O("./src/utils/mp4-tools.ts"),R=O("./src/loader/fragment.ts"),H=O("./src/utils/logger.ts"),U=function(){function d(){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 h=d.prototype;return h.destroy=function(){},h.resetTimeStamp=function(a){this.initPTS=a,this.lastEndDTS=null},h.resetNextTimestamp=function(){this.lastEndDTS=null},h.resetInitSegment=function(a,r,l){this.audioCodec=r,this.videoCodec=l,this.generateInitSegment(a),this.emitInitSegment=!0},h.generateInitSegment=function(a){var r=this.audioCodec,l=this.videoCodec;if(!a||!a.byteLength){this.initTracks=void 0,this.initData=void 0;return}var s=this.initData=Object(w.parseInitSegment)(a);r||(r=S(s.audio,R.ElementaryStreamTypes.AUDIO)),l||(l=S(s.video,R.ElementaryStreamTypes.VIDEO));var n={};s.audio&&s.video?n.audiovideo={container:"video/mp4",codec:r+","+l,initSegment:a,id:"main"}:s.audio?n.audio={container:"audio/mp4",codec:r,initSegment:a,id:"audio"}:s.video?n.video={container:"video/mp4",codec:l,initSegment:a,id:"main"}:H.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n},h.remux=function(a,r,l,s,n){var i=this.initPTS,t=this.lastEndDTS,v={audio:void 0,video:void 0,text:s,id3:l,initSegment:void 0};Object(k.isFiniteNumber)(t)||(t=this.lastEndDTS=n||0);var f=r.samples;if(!f||!f.length)return v;var p={initPTS:void 0,timescale:1},E=this.initData;if((!E||!E.length)&&(this.generateInitSegment(f),E=this.initData),!E||!E.length)return H.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),v;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(k.isFiniteNumber)(i)||(this.initPTS=p.initPTS=i=e(E,f,t));var b=Object(w.getDuration)(f,E),g=t,c=b+g;Object(w.offsetStartDTS)(E,f,i),b>0?this.lastEndDTS=c:(H.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var m=!!E.audio,u=!!E.video,_="";m&&(_+="audio"),u&&(_+="video");var y={data1:f,startPTS:g,startDTS:g,endPTS:c,endDTS:c,type:_,hasAudio:m,hasVideo:u,nb:1,dropped:0};return v.audio=y.type==="audio"?y:void 0,v.video=y.type!=="audio"?y:void 0,v.text=s,v.id3=l,v.initSegment=p,v},d}(),e=function(h,o,a){return Object(w.getStartDTS)(h,o)-a};function S(d,h){var o=d==null?void 0:d.codec;return o&&o.length>4?o:o==="hvc1"?"hvc1.1.c.L120.90":o==="av01"?"av01.0.04M.08":o==="avc1"||h===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}B.default=U},"./src/task-loop.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return k});var k=function(){function w(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=w.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},w}()},"./src/types/cmcd.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"CMCDVersion",function(){return k}),O.d(B,"CMCDObjectType",function(){return w}),O.d(B,"CMCDStreamingFormat",function(){return R}),O.d(B,"CMCDStreamType",function(){return H});var k=1,w;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(w||(w={}));var R;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(R||(R={}));var H;(function(U){U.VOD="v",U.LIVE="l"})(H||(H={}))},"./src/types/level.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"HlsSkip",function(){return R}),O.d(B,"getSkipValue",function(){return H}),O.d(B,"HlsUrlParameters",function(){return U}),O.d(B,"Level",function(){return e});function k(S,d){for(var h=0;h<d.length;h++){var o=d[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(S,o.key,o)}}function w(S,d,h){return d&&k(S.prototype,d),h&&k(S,h),S}var R;(function(S){S.No="",S.Yes="YES",S.v2="v2"})(R||(R={}));function H(S,d){var h=S.canSkipUntil,o=S.canSkipDateRanges,a=S.endSN,r=d!==void 0?d-a:0;return h&&r<h?o?R.v2:R.Yes:R.No}var U=function(){function S(h,o,a){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=h,this.part=o,this.skip=a}var d=S.prototype;return d.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}(),e=function(){function S(d){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=[d.url],this.attrs=d.attrs,this.bitrate=d.bitrate,d.details&&(this.details=d.details),this.id=d.id||0,this.name=d.name,this.width=d.width||0,this.height=d.height||0,this.audioCodec=d.audioCodec,this.videoCodec=d.videoCodec,this.unknownCodecs=d.unknownCodecs,this.codecSet=[d.videoCodec,d.audioCodec].filter(function(h){return h}).join(",").replace(/\.[^.,]+/g,"")}return w(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(h){var o=h%this.url.length;this._urlId!==o&&(this.details=void 0,this._urlId=o)}}]),S}()},"./src/types/loader.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"PlaylistContextType",function(){return k}),O.d(B,"PlaylistLevelType",function(){return w});var k;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(k||(k={}));var w;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(w||(w={}))},"./src/types/transmuxer.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"ChunkMetadata",function(){return k});var k=function(H,U,e,S,d,h){S===void 0&&(S=0),d===void 0&&(d=-1),h===void 0&&(h=!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=w(),this.buffering={audio:w(),video:w(),audiovideo:w()},this.level=H,this.sn=U,this.id=e,this.size=S,this.part=d,this.partial=h};function w(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"AttrList",function(){return R});var k=/^(\d+)x(\d+)$/,w=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function H(e){typeof e=="string"&&(e=H.parseAttrList(e));for(var S in e)e.hasOwnProperty(S)&&(this[S]=e[S])}var U=H.prototype;return U.decimalInteger=function(S){var d=parseInt(this[S],10);return d>Number.MAX_SAFE_INTEGER?Infinity:d},U.hexadecimalInteger=function(S){if(this[S]){var d=(this[S]||"0x").slice(2);d=(d.length&1?"0":"")+d;for(var h=new Uint8Array(d.length/2),o=0;o<d.length/2;o++)h[o]=parseInt(d.slice(o*2,o*2+2),16);return h}else return null},U.hexadecimalIntegerAsNumber=function(S){var d=parseInt(this[S],16);return d>Number.MAX_SAFE_INTEGER?Infinity:d},U.decimalFloatingPoint=function(S){return parseFloat(this[S])},U.optionalFloat=function(S,d){var h=this[S];return h?parseFloat(h):d},U.enumeratedString=function(S){return this[S]},U.bool=function(S){return this[S]==="YES"},U.decimalResolution=function(S){var d=k.exec(this[S]);return d===null?void 0:{width:parseInt(d[1],10),height:parseInt(d[2],10)}},H.parseAttrList=function(S){var d,h={},o='"';for(w.lastIndex=0;(d=w.exec(S))!==null;){var a=d[2];a.indexOf(o)===0&&a.lastIndexOf(o)===a.length-1&&(a=a.slice(1,-1)),h[d[1]]=a}return h},H}()},"./src/utils/binary-search.ts":function(ae,B,O){"use strict";O.r(B);var k={search:function(R,H){for(var U=0,e=R.length-1,S=null,d=null;U<=e;){S=(U+e)/2|0,d=R[S];var h=H(d);if(h>0)U=S+1;else if(h<0)e=S-1;else return d}return null}};B.default=k},"./src/utils/buffer-helper.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"BufferHelper",function(){return R});var k=O("./src/utils/logger.ts"),w={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function H(){}return H.isBuffered=function(e,S){try{if(e){for(var d=H.getBuffered(e),h=0;h<d.length;h++)if(S>=d.start(h)&&S<=d.end(h))return!0}}catch(o){}return!1},H.bufferInfo=function(e,S,d){try{if(e){var h=H.getBuffered(e),o=[],a;for(a=0;a<h.length;a++)o.push({start:h.start(a),end:h.end(a)});return this.bufferedInfo(o,S,d)}}catch(r){}return{len:0,start:S,end:S,nextStart:void 0}},H.bufferedInfo=function(e,S,d){S=Math.max(0,S),e.sort(function(p,E){var b=p.start-E.start;return b||E.end-p.end});var h=[];if(d)for(var o=0;o<e.length;o++){var a=h.length;if(a){var r=h[a-1].end;e[o].start-r<d?e[o].end>r&&(h[a-1].end=e[o].end):h.push(e[o])}else h.push(e[o])}else h=e;for(var l=0,s,n=S,i=S,t=0;t<h.length;t++){var v=h[t].start,f=h[t].end;if(S+d>=v&&S<f)n=v,i=f,l=i-S;else if(S+d<v){s=v;break}}return{len:l,start:n||0,end:i||0,nextStart:s}},H.getBuffered=function(e){try{return e.buffered}catch(S){return k.logger.log("failed to get media.buffered",S),w}},H}()},"./src/utils/cea-608-parser.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"Row",function(){return i}),O.d(B,"CaptionScreen",function(){return t});var k=O("./src/utils/logger.ts"),w={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},R=function(c){var m=c;return w.hasOwnProperty(c)&&(m=w[c]),String.fromCharCode(m)},H=15,U=100,e={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},d={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},h={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(g){g[g.ERROR=0]="ERROR",g[g.TEXT=1]="TEXT",g[g.WARNING=2]="WARNING",g[g.INFO=2]="INFO",g[g.DEBUG=3]="DEBUG",g[g.DATA=3]="DATA"})(a||(a={}));var r=function(){function g(){this.time=null,this.verboseLevel=a.ERROR}var c=g.prototype;return c.log=function(u,_){this.verboseLevel>=u&&k.logger.log(this.time+" ["+u+"] "+_)},g}(),l=function(c){for(var m=[],u=0;u<c.length;u++)m.push(c[u].toString(16));return m},s=function(){function g(m,u,_,y,T){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=m||"white",this.underline=u||!1,this.italics=_||!1,this.background=y||"black",this.flash=T||!1}var c=g.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(u){for(var _=["foreground","underline","italics","background","flash"],y=0;y<_.length;y++){var T=_[y];u.hasOwnProperty(T)&&(this[T]=u[T])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(u){return this.foreground===u.foreground&&this.underline===u.underline&&this.italics===u.italics&&this.background===u.background&&this.flash===u.flash},c.copy=function(u){this.foreground=u.foreground,this.underline=u.underline,this.italics=u.italics,this.background=u.background,this.flash=u.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},g}(),n=function(){function g(m,u,_,y,T,M){this.uchar=void 0,this.penState=void 0,this.uchar=m||" ",this.penState=new s(u,_,y,T,M)}var c=g.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(u,_){this.uchar=u,this.penState.copy(_)},c.setPenState=function(u){this.penState.copy(u)},c.equals=function(u){return this.uchar===u.uchar&&this.penState.equals(u.penState)},c.copy=function(u){this.uchar=u.uchar,this.penState.copy(u.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},g}(),i=function(){function g(m){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var u=0;u<U;u++)this.chars.push(new n);this.logger=m,this.pos=0,this.currPenState=new s}var c=g.prototype;return c.equals=function(u){for(var _=!0,y=0;y<U;y++)if(!this.chars[y].equals(u.chars[y])){_=!1;break}return _},c.copy=function(u){for(var _=0;_<U;_++)this.chars[_].copy(u.chars[_])},c.isEmpty=function(){for(var u=!0,_=0;_<U;_++)if(!this.chars[_].isEmpty()){u=!1;break}return u},c.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(a.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(a.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},c.moveCursor=function(u){var _=this.pos+u;if(u>1)for(var y=this.pos+1;y<_+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(_)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(u){u>=144&&this.backSpace();var _=R(u);if(this.pos>=U){this.logger.log(a.ERROR,"Cannot insert "+u.toString(16)+" ("+_+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(_,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(u){var _;for(_=u;_<U;_++)this.chars[_].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var u=[],_=!0,y=0;y<U;y++){var T=this.chars[y].uchar;T!==" "&&(_=!1),u.push(T)}return _?"":u.join("")},c.setPenStyles=function(u){this.currPenState.setStyles(u);var _=this.chars[this.pos];_.setPenState(this.currPenState)},g}(),t=function(){function g(m){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var u=0;u<H;u++)this.rows.push(new i(m));this.logger=m,this.currRow=H-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=g.prototype;return c.reset=function(){for(var u=0;u<H;u++)this.rows[u].clear();this.currRow=H-1},c.equals=function(u){for(var _=!0,y=0;y<H;y++)if(!this.rows[y].equals(u.rows[y])){_=!1;break}return _},c.copy=function(u){for(var _=0;_<H;_++)this.rows[_].copy(u.rows[_])},c.isEmpty=function(){for(var u=!0,_=0;_<H;_++)if(!this.rows[_].isEmpty()){u=!1;break}return u},c.backSpace=function(){var u=this.rows[this.currRow];u.backSpace()},c.clearToEndOfRow=function(){var u=this.rows[this.currRow];u.clearToEndOfRow()},c.insertChar=function(u){var _=this.rows[this.currRow];_.insertChar(u)},c.setPen=function(u){var _=this.rows[this.currRow];_.setPenStyles(u)},c.moveCursor=function(u){var _=this.rows[this.currRow];_.moveCursor(u)},c.setCursor=function(u){this.logger.log(a.INFO,"setCursor: "+u);var _=this.rows[this.currRow];_.setCursor(u)},c.setPAC=function(u){this.logger.log(a.INFO,"pacData = "+JSON.stringify(u));var _=u.row-1;if(this.nrRollUpRows&&_<this.nrRollUpRows-1&&(_=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==_){for(var y=0;y<H;y++)this.rows[y].clear();var T=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var L=M.rows[T].cueStartTime,x=this.logger.time;if(L&&x!==null&&L<x)for(var D=0;D<this.nrRollUpRows;D++)this.rows[_-this.nrRollUpRows+D+1].copy(M.rows[T+D])}}this.currRow=_;var j=this.rows[this.currRow];if(u.indent!==null){var I=u.indent,W=Math.max(I-1,0);j.setCursor(u.indent),u.color=j.chars[W].penState.foreground}var Q={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(Q)},c.setBkgData=function(u){this.logger.log(a.INFO,"bkgData = "+JSON.stringify(u)),this.backSpace(),this.setPen(u),this.insertChar(32)},c.setRollUpRows=function(u){this.nrRollUpRows=u},c.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 u=this.currRow+1-this.nrRollUpRows,_=this.rows.splice(u,1)[0];_.clear(),this.rows.splice(this.currRow,0,_),this.logger.log(a.INFO,"Rolling up")},c.getDisplayText=function(u){u=u||!1;for(var _=[],y="",T=-1,M=0;M<H;M++){var L=this.rows[M].getTextString();L&&(T=M+1,u?_.push("Row "+T+": '"+L+"'"):_.push(L.trim()))}return _.length>0&&(u?y="["+_.join(" | ")+"]":y=_.join(`
|
|
`)),y},c.getTextAndFormat=function(){return this.rows},g}(),v=function(){function g(m,u,_){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=m,this.outputFilter=u,this.mode=null,this.verbose=0,this.displayedMemory=new t(_),this.nonDisplayedMemory=new t(_),this.lastOutputScreen=new t(_),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=_}var c=g.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(u){this.outputFilter=u},c.setPAC=function(u){this.writeScreen.setPAC(u)},c.setBkgData=function(u){this.writeScreen.setBkgData(u)},c.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(a.INFO,"MODE="+u),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=u},c.insertChars=function(u){for(var _=0;_<u.length;_++)this.writeScreen.insertChar(u[_]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(a.INFO,y+": "+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())},c.ccRCL=function(){this.logger.log(a.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(a.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(a.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(u){this.logger.log(a.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},c.ccFON=function(){this.logger.log(a.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(a.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(a.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(a.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(a.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(a.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(a.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(a.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var u=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=u,this.writeScreen=this.nonDisplayedMemory,this.logger.log(a.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(u){this.logger.log(a.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},c.ccMIDROW=function(u){var _={flash:!1};if(_.underline=u%2===1,_.italics=u>=46,_.italics)_.foreground="white";else{var y=Math.floor(u/2)-16,T=["white","green","blue","cyan","red","yellow","magenta"];_.foreground=T[y]}this.logger.log(a.INFO,"MIDROW: "+JSON.stringify(_)),this.writeScreen.setPen(_)},c.outputDataUpdate=function(u){u===void 0&&(u=!1);var _=this.logger.time;if(_===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=_:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,_,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:_),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},g}(),f=function(){function g(m,u,_){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new r;this.channels=[null,new v(m,u,y),new v(m+1,_,y)],this.cmdHistory=b(),this.logger=y}var c=g.prototype;return c.getHandler=function(u){return this.channels[u].getHandler()},c.setHandler=function(u,_){this.channels[u].setHandler(_)},c.addData=function(u,_){var y,T,M,L=!1;this.logger.time=u;for(var x=0;x<_.length;x+=2){if(T=_[x]&127,M=_[x+1]&127,T===0&&M===0)continue;if(this.logger.log(a.DATA,"["+l([_[x],_[x+1]])+"] -> ("+l([T,M])+")"),y=this.parseCmd(T,M),y||(y=this.parseMidrow(T,M)),y||(y=this.parsePAC(T,M)),y||(y=this.parseBackgroundAttributes(T,M)),!y&&(L=this.parseChars(T,M),L)){var D=this.currentChannel;if(D&&D>0){var j=this.channels[D];j.insertChars(L)}else this.logger.log(a.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!L&&this.logger.log(a.WARNING,"Couldn't parse cleaned data "+l([T,M])+" orig: "+l([_[x],_[x+1]]))}},c.parseCmd=function(u,_){var y=this.cmdHistory,T=(u===20||u===28||u===21||u===29)&&_>=32&&_<=47,M=(u===23||u===31)&&_>=33&&_<=35;if(!(T||M))return!1;if(E(u,_,y))return p(null,null,y),this.logger.log(a.DEBUG,"Repeated command ("+l([u,_])+") is dropped"),!0;var L=u===20||u===21||u===23?1:2,x=this.channels[L];return u===20||u===21||u===28||u===29?_===32?x.ccRCL():_===33?x.ccBS():_===34?x.ccAOF():_===35?x.ccAON():_===36?x.ccDER():_===37?x.ccRU(2):_===38?x.ccRU(3):_===39?x.ccRU(4):_===40?x.ccFON():_===41?x.ccRDC():_===42?x.ccTR():_===43?x.ccRTD():_===44?x.ccEDM():_===45?x.ccCR():_===46?x.ccENM():_===47&&x.ccEOC():x.ccTO(_-32),p(u,_,y),this.currentChannel=L,!0},c.parseMidrow=function(u,_){var y=0;if((u===17||u===25)&&_>=32&&_<=47){if(u===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(a.ERROR,"Mismatch channel in midrow parsing"),!1;var T=this.channels[y];return T?(T.ccMIDROW(_),this.logger.log(a.DEBUG,"MIDROW ("+l([u,_])+")"),!0):!1}return!1},c.parsePAC=function(u,_){var y,T=this.cmdHistory,M=(u>=17&&u<=23||u>=25&&u<=31)&&_>=64&&_<=127,L=(u===16||u===24)&&_>=64&&_<=95;if(!(M||L))return!1;if(E(u,_,T))return p(null,null,T),!0;var x=u<=23?1:2;_>=64&&_<=95?y=x===1?e[u]:d[u]:y=x===1?S[u]:h[u];var D=this.channels[x];return D?(D.setPAC(this.interpretPAC(y,_)),p(u,_,T),this.currentChannel=x,!0):!1},c.interpretPAC=function(u,_){var y,T={color:null,italics:!1,indent:null,underline:!1,row:u};return _>95?y=_-96:y=_-64,T.underline=(y&1)===1,y<=13?T.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(T.italics=!0,T.color="white"):T.indent=Math.floor((y-16)/2)*4,T},c.parseChars=function(u,_){var y,T=null,M=null;if(u>=25?(y=2,M=u-8):(y=1,M=u),M>=17&&M<=19){var L;M===17?L=_+80:M===18?L=_+112:L=_+144,this.logger.log(a.INFO,"Special char '"+R(L)+"' in channel "+y),T=[L]}else u>=32&&u<=127&&(T=_===0?[u]:[u,_]);if(T){var x=l(T);this.logger.log(a.DEBUG,"Char codes = "+x.join(",")),p(u,_,this.cmdHistory)}return T},c.parseBackgroundAttributes=function(u,_){var y=(u===16||u===24)&&_>=32&&_<=47,T=(u===23||u===31)&&_>=45&&_<=47;if(!(y||T))return!1;var M,L={};u===16||u===24?(M=Math.floor((_-32)/2),L.background=o[M],_%2===1&&(L.background=L.background+"_semi")):_===45?L.background="transparent":(L.foreground="black",_===47&&(L.underline=!0));var x=u<=23?1:2,D=this.channels[x];return D.setBkgData(L),p(u,_,this.cmdHistory),!0},c.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var _=this.channels[u];_&&_.reset()}this.cmdHistory=b()},c.cueSplitAtTime=function(u){for(var _=0;_<this.channels.length;_++){var y=this.channels[_];y&&y.cueSplitAtTime(u)}},g}();function p(g,c,m){m.a=g,m.b=c}function E(g,c,m){return m.a===g&&m.b===c}function b(){return{a:null,b:null}}B.default=f},"./src/utils/codecs.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"isCodecType",function(){return w}),O.d(B,"isCodecSupportedInMp4",function(){return R});var k={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 w(H,U){var e=k[U];return!!e&&e[H.slice(0,4)]===!0}function R(H,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+H+'"')}},"./src/utils/cues.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/utils/vttparser.ts"),w=O("./src/utils/webvtt-parser.ts"),R=O("./src/utils/texttrack-utils.ts"),H=/\s/,U={newCue:function(S,d,h,o){for(var a=[],r,l,s,n,i,t=self.VTTCue||self.TextTrackCue,v=0;v<o.rows.length;v++)if(r=o.rows[v],s=!0,n=0,i="",!r.isEmpty()){for(var f=0;f<r.chars.length;f++)H.test(r.chars[f].uchar)&&s?n++:(i+=r.chars[f].uchar,s=!1);r.cueStartTime=d,d===h&&(h+=1e-4),n>=16?n--:n++;var p=Object(k.fixLineBreaks)(i.trim()),E=Object(w.generateCueId)(d,h,p);(!S||!S.cues||!S.cues.getCueById(E))&&(l=new t(d,h,p),l.id=E,l.line=v+1,l.align="left",l.position=10+Math.min(80,Math.floor(n*8/32)*10),a.push(l))}return S&&a.length&&(a.sort(function(b,g){return b.line==="auto"||g.line==="auto"?0:b.line>8&&g.line>8?g.line-b.line:b.line-g.line}),a.forEach(function(b){return Object(R.addCueToTrack)(S,b)})),a}};B.default=U},"./src/utils/discontinuities.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"findFirstFragWithCC",function(){return H}),O.d(B,"shouldAlignOnDiscontinuities",function(){return U}),O.d(B,"findDiscontinuousReferenceFrag",function(){return e}),O.d(B,"adjustSlidingStart",function(){return d}),O.d(B,"alignStream",function(){return h}),O.d(B,"alignPDT",function(){return a}),O.d(B,"alignFragmentByPDTDelta",function(){return r}),O.d(B,"alignMediaPlaylistByPDT",function(){return l});var k=O("./src/polyfills/number.ts"),w=O("./src/utils/logger.ts"),R=O("./src/controller/level-helper.ts");function H(s,n){for(var i=null,t=0,v=s.length;t<v;t++){var f=s[t];if(f&&f.cc===n){i=f;break}}return i}function U(s,n,i){return!!(n.details&&(i.endCC>i.startCC||s&&s.cc<i.startCC))}function e(s,n){var i=s.fragments,t=n.fragments;if(!t.length||!i.length){w.logger.log("No fragments to align");return}var v=H(i,t[0].cc);if(!v||v&&!v.startPTS){w.logger.log("No frag in previous level to align on");return}return v}function S(s,n){if(s){var i=s.start+n;s.start=s.startPTS=i,s.endPTS=i+s.duration}}function d(s,n){for(var i=n.fragments,t=0,v=i.length;t<v;t++)S(i[t],s);n.fragmentHint&&S(n.fragmentHint,s),n.alignedSliding=!0}function h(s,n,i){if(!n)return;o(s,i,n),!i.alignedSliding&&n.details&&a(i,n.details),!i.alignedSliding&&n.details&&!i.skippedSegments&&Object(R.adjustSliding)(n.details,i)}function o(s,n,i){if(U(s,i,n)){var t=e(i.details,n);t&&Object(k.isFiniteNumber)(t.start)&&(w.logger.log("Adjusting PTS using last level due to CC increase within current level "+n.url),d(t.start,n))}}function a(s,n){if(!n.fragments.length||!s.hasProgramDateTime||!n.hasProgramDateTime)return;var i=n.fragments[0].programDateTime,t=s.fragments[0].programDateTime,v=(t-i)/1e3+n.fragments[0].start;v&&Object(k.isFiniteNumber)(v)&&(w.logger.log("Adjusting PTS using programDateTime delta "+(t-i)+"ms, sliding:"+v.toFixed(3)+" "+s.url+" "),d(v,s))}function r(s,n){var i=s.programDateTime;if(!i)return;var t=(i-n)/1e3;s.start=s.startPTS=t,s.endPTS=t+s.duration}function l(s,n){if(!n.fragments.length||!s.hasProgramDateTime||!n.hasProgramDateTime)return;var i=n.fragments[0].programDateTime,t=n.fragments[0].start,v=i-t*1e3;s.fragments.forEach(function(f){r(f,v)}),s.fragmentHint&&r(s.fragmentHint,v),s.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/utils/ewma.ts"),w=function(){function R(U,e,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 k.default(U),this.fast_=new k.default(e)}var H=R.prototype;return H.update=function(e,S){var d=this.slow_,h=this.fast_;this.slow_.halfLife!==e&&(this.slow_=new k.default(e,d.getEstimate(),d.getTotalWeight())),this.fast_.halfLife!==S&&(this.fast_=new k.default(S,h.getEstimate(),h.getTotalWeight()))},H.sample=function(e,S){e=Math.max(e,this.minDelayMs_);var d=8*S,h=e/1e3,o=d/h;this.fast_.sample(h,o),this.slow_.sample(h,o)},H.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},H.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},H.destroy=function(){},R}();B.default=w},"./src/utils/ewma.ts":function(ae,B,O){"use strict";O.r(B);var k=function(){function w(H,U,e){U===void 0&&(U=0),e===void 0&&(e=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=H,this.alpha_=H?Math.exp(Math.log(.5)/H):0,this.estimate_=U,this.totalWeight_=e}var R=w.prototype;return R.sample=function(U,e){var S=Math.pow(this.alpha_,U);this.estimate_=e*(1-S)+S*this.estimate_,this.totalWeight_+=U},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},w}();B.default=k},"./src/utils/fetch-loader.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"fetchSupported",function(){return r});var k=O("./src/polyfills/number.ts"),w=O("./src/loader/load-stats.ts"),R=O("./src/demux/chunk-cache.ts");function H(t,v){t.prototype=Object.create(v.prototype),t.prototype.constructor=t,h(t,v)}function U(t){var v=typeof Map=="function"?new Map:void 0;return U=function(p){if(p===null||!d(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof v!="undefined"){if(v.has(p))return v.get(p);v.set(p,E)}function E(){return e(p,arguments,o(this).constructor)}return E.prototype=Object.create(p.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),h(E,p)},U(t)}function e(t,v,f){return S()?e=Reflect.construct:e=function(E,b,g){var c=[null];c.push.apply(c,b);var m=Function.bind.apply(E,c),u=new m;return g&&h(u,g.prototype),u},e.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(t){return!1}}function d(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function h(t,v){return h=Object.setPrototypeOf||function(p,E){return p.__proto__=E,p},h(t,v)}function o(t){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},o(t)}function a(){return a=Object.assign||function(t){for(var v=1;v<arguments.length;v++){var f=arguments[v];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(t[p]=f[p])}return t},a.apply(this,arguments)}function r(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(t){}return!1}var l=function(){function t(f){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=f.fetchSetup||n,this.controller=new self.AbortController,this.stats=new w.LoadStats}var v=t.prototype;return v.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},v.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},v.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},v.load=function(p,E,b){var g=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var m=s(p,this.controller.signal),u=b.onProgress,_=p.responseType==="arraybuffer",y=_?"byteLength":"length";this.context=p,this.config=E,this.callbacks=b,this.request=this.fetchSetup(p,m),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){g.abortInternal(),b.onTimeout(c,p,g.response)},E.timeout),self.fetch(this.request).then(function(T){if(g.response=g.loader=T,!T.ok){var M=T.status,L=T.statusText;throw new i(L||"fetch, bad network response",M,T)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(T.headers.get("Content-Length")||"0"),u&&Object(k.isFiniteNumber)(E.highWaterMark)?g.loadProgressively(T,c,p,E.highWaterMark,u):_?T.arrayBuffer():T.text()}).then(function(T){var M=g.response;self.clearTimeout(g.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=T[y];var L={url:M.url,data:T};u&&!Object(k.isFiniteNumber)(E.highWaterMark)&&u(c,p,T,M),b.onSuccess(L,c,p,M)}).catch(function(T){if(self.clearTimeout(g.requestTimeout),c.aborted)return;var M=T.code||0;b.onError({code:M,text:T.message},p,T.details)})},v.getCacheAge=function(){var p=null;if(this.response){var E=this.response.headers.get("age");p=E?parseFloat(E):null}return p},v.loadProgressively=function(p,E,b,g,c){g===void 0&&(g=0);var m=new R.default,u=p.body.getReader(),_=function y(){return u.read().then(function(T){if(T.done)return m.dataLength&&c(E,b,m.flush(),p),Promise.resolve(new ArrayBuffer(0));var M=T.value,L=M.length;return E.loaded+=L,L<g||m.dataLength?(m.push(M),m.dataLength>=g&&c(E,b,m.flush(),p)):c(E,b,M,p),y()}).catch(function(){return Promise.reject()})};return _()},t}();function s(t,v){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:v,headers:new self.Headers(a({},t.headers))};return t.rangeEnd&&f.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)),f}function n(t,v){return new self.Request(t.url,v)}var i=function(t){H(v,t);function v(f,p,E){var b;return b=t.call(this,f)||this,b.code=void 0,b.details=void 0,b.code=p,b.details=E,b}return v}(U(Error));B.default=l},"./src/utils/imsc1-ttml-parser.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"IMSC1_CODEC",function(){return d}),O.d(B,"parseIMSC1",function(){return r});var k=O("./src/utils/mp4-tools.ts"),w=O("./src/utils/vttparser.ts"),R=O("./src/utils/vttcue.ts"),H=O("./src/demux/id3.ts"),U=O("./src/utils/timescale-conversion.ts"),e=O("./src/utils/webvtt-parser.ts");function S(){return S=Object.assign||function(g){for(var c=1;c<arguments.length;c++){var m=arguments[c];for(var u in m)Object.prototype.hasOwnProperty.call(m,u)&&(g[u]=m[u])}return g},S.apply(this,arguments)}var d="stpp.ttml.im1t",h=/^(\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 r(g,c,m,u,_){var y=Object(k.findBox)(new Uint8Array(g),["mdat"]);if(y.length===0){_(new Error("Could not parse IMSC1 mdat"));return}var T=y[0],M=Object(H.utf8ArrayToStr)(new Uint8Array(g,T.start,T.end-T.start)),L=Object(U.toTimescaleFromScale)(c,1,m);try{u(l(M,L))}catch(x){_(x)}}function l(g,c){var m=new DOMParser,u=m.parseFromString(g,"text/xml"),_=u.getElementsByTagName("tt")[0];if(!_)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},T=Object.keys(y).reduce(function(j,I){return j[I]=_.getAttribute("ttp:"+I)||y[I],j},{}),M=_.getAttribute("xml:space")!=="preserve",L=n(s(_,"styling","style")),x=n(s(_,"layout","region")),D=s(_,"body","[begin]");return[].map.call(D,function(j){var I=i(j,M);if(!I||!j.hasAttribute("begin"))return null;var W=p(j.getAttribute("begin"),T),Q=p(j.getAttribute("dur"),T),fe=p(j.getAttribute("end"),T);if(W===null)throw f(j);if(fe===null){if(Q===null)throw f(j);fe=W+Q}var de=new R.default(W-c,fe-c,I);de.id=Object(e.generateCueId)(de.startTime,de.endTime,de.text);var Oe=x[j.getAttribute("region")],Se=L[j.getAttribute("style")];de.position=10,de.size=80;var Ie=t(Oe,Se),Le=Ie.textAlign;if(Le){var Ne=a[Le];Ne&&(de.lineAlign=Ne),de.align=Le}return S(de,Ie),de}).filter(function(j){return j!==null})}function s(g,c,m){var u=g.getElementsByTagName(c)[0];return u?[].slice.call(u.querySelectorAll(m)):[]}function n(g){return g.reduce(function(c,m){var u=m.getAttribute("xml:id");return u&&(c[u]=m),c},{})}function i(g,c){return[].slice.call(g.childNodes).reduce(function(m,u,_){var y;return u.nodeName==="br"&&_?m+`
|
|
`:(y=u.childNodes)!==null&&y!==void 0&&y.length?i(u,c):c?m+u.textContent.trim().replace(/\s+/g," "):m+u.textContent},"")}function t(g,c){var m="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(_,y){var T=v(c,m,y)||v(g,m,y);return T&&(_[y]=T),_},{})}function v(g,c,m){return g.hasAttributeNS(c,m)?g.getAttributeNS(c,m):null}function f(g){return new Error("Could not parse ttml timestamp "+g)}function p(g,c){if(!g)return null;var m=Object(w.parseTimeStamp)(g);return m===null&&(h.test(g)?m=E(g,c):o.test(g)&&(m=b(g,c))),m}function E(g,c){var m=h.exec(g),u=(m[4]|0)+(m[5]|0)/c.subFrameRate;return(m[1]|0)*3600+(m[2]|0)*60+(m[3]|0)+u/c.frameRate}function b(g,c){var m=o.exec(g),u=Number(m[1]),_=m[2];switch(_){case"h":return u*3600;case"m":return u*60;case"ms":return u*1e3;case"f":return u/c.frameRate;case"t":return u/c.tickRate}return u}},"./src/utils/logger.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"enableLogs",function(){return e}),O.d(B,"logger",function(){return S});var k=function(){},w={trace:k,debug:k,log:k,warn:k,info:k,error:k},R=w;function H(d){var h=self.console[d];return h?h.bind(self.console,"["+d+"] >"):k}function U(d){for(var h=arguments.length,o=new Array(h>1?h-1:0),a=1;a<h;a++)o[a-1]=arguments[a];o.forEach(function(r){R[r]=d[r]?d[r].bind(d):H(r)})}function e(d){if(self.console&&d===!0||typeof d=="object"){U(d,"debug","log","info","warn","error");try{R.log()}catch(h){R=w}}else R=w}var S=R},"./src/utils/mediakeys-helper.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"KeySystems",function(){return k}),O.d(B,"requestMediaKeySystemAccess",function(){return w});var k;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(k||(k={}));var w=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"getMediaSource",function(){return k});function k(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"bin2str",function(){return U}),O.d(B,"readUint16",function(){return e}),O.d(B,"readUint32",function(){return S}),O.d(B,"writeUint32",function(){return d}),O.d(B,"findBox",function(){return h}),O.d(B,"parseSegmentIndex",function(){return o}),O.d(B,"parseInitSegment",function(){return a}),O.d(B,"getStartDTS",function(){return r}),O.d(B,"getDuration",function(){return l}),O.d(B,"computeRawDurationFromSamples",function(){return s}),O.d(B,"offsetStartDTS",function(){return n}),O.d(B,"segmentValidRange",function(){return i}),O.d(B,"appendUint8Array",function(){return t});var k=O("./src/utils/typed-array.ts"),w=O("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,H=[].push;function U(v){return String.fromCharCode.apply(null,v)}function e(v,f){"data"in v&&(f+=v.start,v=v.data);var p=v[f]<<8|v[f+1];return p<0?65536+p:p}function S(v,f){"data"in v&&(f+=v.start,v=v.data);var p=v[f]<<24|v[f+1]<<16|v[f+2]<<8|v[f+3];return p<0?4294967296+p:p}function d(v,f,p){"data"in v&&(f+=v.start,v=v.data),v[f]=p>>24,v[f+1]=p>>16&255,v[f+2]=p>>8&255,v[f+3]=p&255}function h(v,f){var p=[];if(!f.length)return p;var E,b,g;"data"in v?(E=v.data,b=v.start,g=v.end):(E=v,b=0,g=E.byteLength);for(var c=b;c<g;){var m=S(E,c),u=U(E.subarray(c+4,c+8)),_=m>1?c+m:g;if(u===f[0])if(f.length===1)p.push({data:E,start:c+8,end:_});else{var y=h({data:E,start:c+8,end:_},f.slice(1));y.length&&H.apply(p,y)}c=_}return p}function o(v){var f=h(v,["moov"]),p=f[0],E=p?p.end:null,b=h(v,["sidx"]);if(!b||!b[0])return null;var g=[],c=b[0],m=c.data[0],u=m===0?8:16,_=S(c,u);u+=4;var y=0,T=0;m===0?u+=8:u+=16,u+=2;var M=c.end+T,L=e(c,u);u+=2;for(var x=0;x<L;x++){var D=u,j=S(c,D);D+=4;var I=j&2147483647,W=(j&2147483648)>>>31;if(W===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Q=S(c,D);D+=4,g.push({referenceSize:I,subsegmentDuration:Q,info:{duration:Q/_,start:M,end:M+I-1}}),M+=I,D+=4,u=D}return{earliestPresentationTime:y,timescale:_,version:m,referencesCount:L,references:g,moovEndOffset:E}}function a(v){for(var f=[],p=h(v,["moov","trak"]),E=0;E<p.length;E++){var b=p[E],g=h(b,["tkhd"])[0];if(g){var c=g.data[g.start],m=c===0?12:20,u=S(g,m),_=h(b,["mdia","mdhd"])[0];if(_){c=_.data[_.start],m=c===0?12:20;var y=S(_,m),T=h(b,["mdia","hdlr"])[0];if(T){var M=U(T.data.subarray(T.start+8,T.start+12)),L={soun:w.ElementaryStreamTypes.AUDIO,vide:w.ElementaryStreamTypes.VIDEO}[M];if(L){var x=h(b,["mdia","minf","stbl","stsd"])[0],D=void 0;x&&(D=U(x.data.subarray(x.start+12,x.start+16))),f[u]={timescale:y,type:L},f[L]={timescale:y,id:u,codec:D}}}}}}var j=h(v,["moov","mvex","trex"]);return j.forEach(function(I){var W=S(I,4),Q=f[W];Q&&(Q.default={duration:S(I,12),flags:S(I,20)})}),f}function r(v,f){return h(f,["moof","traf"]).reduce(function(p,E){var b=h(E,["tfdt"])[0],g=b.data[b.start],c=h(E,["tfhd"]).reduce(function(m,u){var _=S(u,4),y=v[_];if(y){var T=S(b,4);g===1&&(T*=Math.pow(2,32),T+=S(b,8));var M=y.timescale||9e4,L=T/M;if(isFinite(L)&&(m===null||L<m))return L}return m},null);return c!==null&&isFinite(c)&&(p===null||c<p)?c:p},null)||0}function l(v,f){for(var p=0,E=0,b=0,g=h(v,["moof","traf"]),c=0;c<g.length;c++){var m=g[c],u=h(m,["tfhd"])[0],_=S(u,4),y=f[_];if(!y)continue;var T=y.default,M=S(u,0)|(T==null?void 0:T.flags),L=T==null?void 0:T.duration;M&8&&(M&2?L=S(u,12):L=S(u,8));for(var x=y.timescale||9e4,D=h(m,["trun"]),j=0;j<D.length;j++){if(L){var I=S(D[j],4);p=L*I}else p=s(D[j]);y.type===w.ElementaryStreamTypes.VIDEO?E+=p/x:y.type===w.ElementaryStreamTypes.AUDIO&&(b+=p/x)}}if(E===0&&b===0){var W=o(v);if(W!=null&&W.references)return W.references.reduce(function(Q,fe){return Q+fe.info.duration||0},0)}return E||b}function s(v){var f=S(v,0),p=8;f&1&&(p+=4),f&4&&(p+=4);for(var E=0,b=S(v,4),g=0;g<b;g++){if(f&256){var c=S(v,p);E+=c,p+=4}f&512&&(p+=4),f&1024&&(p+=4),f&2048&&(p+=4)}return E}function n(v,f,p){h(f,["moof","traf"]).forEach(function(E){h(E,["tfhd"]).forEach(function(b){var g=S(b,4),c=v[g];if(!c)return;var m=c.timescale||9e4;h(E,["tfdt"]).forEach(function(u){var _=u.data[u.start],y=S(u,4);if(_===0)d(u,4,y-p*m);else{y*=Math.pow(2,32),y+=S(u,8),y-=p*m,y=Math.max(y,0);var T=Math.floor(y/(R+1)),M=Math.floor(y%(R+1));d(u,4,T),d(u,8,M)}})})})}function i(v){var f={valid:null,remainder:null},p=h(v,["moof"]);if(p){if(p.length<2)return f.remainder=v,f}else return f;var E=p[p.length-1];return f.valid=Object(k.sliceUint8)(v,0,E.start-8),f.remainder=Object(k.sliceUint8)(v,E.start-8),f}function t(v,f){var p=new Uint8Array(v.length+f.length);return p.set(v),p.set(f,v.length),p}},"./src/utils/output-filter.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"default",function(){return k});var k=function(){function w(H,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=H,this.trackName=U}var R=w.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(U,e,S){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=e,this.screen=S,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},w}()},"./src/utils/texttrack-utils.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"sendAddTrackEvent",function(){return w}),O.d(B,"addCueToTrack",function(){return R}),O.d(B,"clearCurrentCues",function(){return H}),O.d(B,"removeCuesInRange",function(){return U}),O.d(B,"getCuesInRange",function(){return S});var k=O("./src/utils/logger.ts");function w(d,h){var o;try{o=new Event("addtrack")}catch(a){o=document.createEvent("Event"),o.initEvent("addtrack",!1,!1)}o.track=d,h.dispatchEvent(o)}function R(d,h){var o=d.mode;if(o==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(h.id))try{if(d.addCue(h),!d.cues.getCueById(h.id))throw new Error("addCue is failed for: "+h)}catch(r){k.logger.debug("[texttrack-utils]: "+r);var a=new self.TextTrackCue(h.startTime,h.endTime,h.text);a.id=h.id,d.addCue(a)}o==="disabled"&&(d.mode=o)}function H(d){var h=d.mode;if(h==="disabled"&&(d.mode="hidden"),d.cues)for(var o=d.cues.length;o--;)d.removeCue(d.cues[o]);h==="disabled"&&(d.mode=h)}function U(d,h,o){var a=d.mode;if(a==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var r=S(d.cues,h,o),l=0;l<r.length;l++)d.removeCue(r[l]);a==="disabled"&&(d.mode=a)}function e(d,h){if(h<d[0].startTime)return 0;var o=d.length-1;if(h>d[o].endTime)return-1;for(var a=0,r=o;a<=r;){var l=Math.floor((r+a)/2);if(h<d[l].startTime)r=l-1;else if(h>d[l].startTime&&a<o)a=l+1;else return l}return d[a].startTime-h<h-d[r].startTime?a:r}function S(d,h,o){var a=[],r=e(d,h);if(r>-1)for(var l=r,s=d.length;l<s;l++){var n=d[l];if(n.startTime>=h&&n.endTime<=o)a.push(n);else if(n.startTime>o)return a}return a}},"./src/utils/time-ranges.ts":function(ae,B,O){"use strict";O.r(B);var k={toString:function(R){for(var H="",U=R.length,e=0;e<U;e++)H+="["+R.start(e).toFixed(3)+","+R.end(e).toFixed(3)+"]";return H}};B.default=k},"./src/utils/timescale-conversion.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"toTimescaleFromBase",function(){return w}),O.d(B,"toTimescaleFromScale",function(){return R}),O.d(B,"toMsFromMpegTsClock",function(){return H}),O.d(B,"toMpegTsClockFromTimescale",function(){return U});var k=9e4;function w(e,S,d,h){d===void 0&&(d=1),h===void 0&&(h=!1);var o=e*S*d;return h?Math.round(o):o}function R(e,S,d,h){return d===void 0&&(d=1),h===void 0&&(h=!1),w(e,S,1/d,h)}function H(e,S){return S===void 0&&(S=!1),w(e,1e3,1/k,S)}function U(e,S){return S===void 0&&(S=1),w(e,k,1/S)}},"./src/utils/typed-array.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"sliceUint8",function(){return k});function k(w,R,H){return Uint8Array.prototype.slice?w.slice(R,H):new Uint8Array(Array.prototype.slice.call(w,R,H))}},"./src/utils/vttcue.ts":function(ae,B,O){"use strict";O.r(B),B.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var k=["","lr","rl"],w=["start","middle","end","left","right"];function R(d,h){if(typeof h!="string")return!1;if(!Array.isArray(d))return!1;var o=h.toLowerCase();return~d.indexOf(o)?o:!1}function H(d){return R(k,d)}function U(d){return R(w,d)}function e(d){for(var h=arguments.length,o=new Array(h>1?h-1:0),a=1;a<h;a++)o[a-1]=arguments[a];for(var r=1;r<arguments.length;r++){var l=arguments[r];for(var s in l)d[s]=l[s]}return d}function S(d,h,o){var a=this,r={enumerable:!0};a.hasBeenReset=!1;var l="",s=!1,n=d,i=h,t=o,v=null,f="",p=!0,E="auto",b="start",g=50,c="middle",m=50,u="middle";Object.defineProperty(a,"id",e({},r,{get:function(){return l},set:function(y){l=""+y}})),Object.defineProperty(a,"pauseOnExit",e({},r,{get:function(){return s},set:function(y){s=!!y}})),Object.defineProperty(a,"startTime",e({},r,{get:function(){return n},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");n=y,this.hasBeenReset=!0}})),Object.defineProperty(a,"endTime",e({},r,{get:function(){return i},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");i=y,this.hasBeenReset=!0}})),Object.defineProperty(a,"text",e({},r,{get:function(){return t},set:function(y){t=""+y,this.hasBeenReset=!0}})),Object.defineProperty(a,"region",e({},r,{get:function(){return v},set:function(y){v=y,this.hasBeenReset=!0}})),Object.defineProperty(a,"vertical",e({},r,{get:function(){return f},set:function(y){var T=H(y);if(T===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=T,this.hasBeenReset=!0}})),Object.defineProperty(a,"snapToLines",e({},r,{get:function(){return p},set:function(y){p=!!y,this.hasBeenReset=!0}})),Object.defineProperty(a,"line",e({},r,{get:function(){return E},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");E=y,this.hasBeenReset=!0}})),Object.defineProperty(a,"lineAlign",e({},r,{get:function(){return b},set:function(y){var T=U(y);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");b=T,this.hasBeenReset=!0}})),Object.defineProperty(a,"position",e({},r,{get:function(){return g},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");g=y,this.hasBeenReset=!0}})),Object.defineProperty(a,"positionAlign",e({},r,{get:function(){return c},set:function(y){var T=U(y);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");c=T,this.hasBeenReset=!0}})),Object.defineProperty(a,"size",e({},r,{get:function(){return m},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");m=y,this.hasBeenReset=!0}})),Object.defineProperty(a,"align",e({},r,{get:function(){return u},set:function(y){var T=U(y);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");u=T,this.hasBeenReset=!0}})),a.displayState=void 0}return S.prototype.getCueAsHTML=function(){var d=self.WebVTT;return d.convertCueToDOMTree(self,this.text)},S}()},"./src/utils/vttparser.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"parseTimeStamp",function(){return R}),O.d(B,"fixLineBreaks",function(){return h}),O.d(B,"VTTParser",function(){return o});var k=O("./src/utils/vttcue.ts"),w=function(){function a(){}var r=a.prototype;return r.decode=function(s,n){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},a}();function R(a){function r(s,n,i,t){return(s|0)*3600+(n|0)*60+(i|0)+parseFloat(t||0)}var l=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return l?parseFloat(l[2])>59?r(l[2],l[3],0,l[4]):r(l[1],l[2],l[3],l[4]):null}var H=function(){function a(){this.values=Object.create(null)}var r=a.prototype;return r.set=function(s,n){!this.get(s)&&n!==""&&(this.values[s]=n)},r.get=function(s,n,i){return i?this.has(s)?this.values[s]:n[i]:this.has(s)?this.values[s]:n},r.has=function(s){return s in this.values},r.alt=function(s,n,i){for(var t=0;t<i.length;++t)if(n===i[t]){this.set(s,n);break}},r.integer=function(s,n){/^-?\d+$/.test(n)&&this.set(s,parseInt(n,10))},r.percent=function(s,n){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(n)){var i=parseFloat(n);if(i>=0&&i<=100)return this.set(s,i),!0}return!1},a}();function U(a,r,l,s){var n=s?a.split(s):[a];for(var i in n){if(typeof n[i]!="string")continue;var t=n[i].split(l);if(t.length!==2)continue;var v=t[0],f=t[1];r(v,f)}}var e=new k.default(0,0,""),S=e.align==="middle"?"middle":"center";function d(a,r,l){var s=a;function n(){var v=R(a);if(v===null)throw new Error("Malformed timestamp: "+s);return a=a.replace(/^[^\sa-zA-Z-]+/,""),v}function i(v,f){var p=new H;U(v,function(g,c){var m;switch(g){case"region":for(var u=l.length-1;u>=0;u--)if(l[u].id===c){p.set(g,l[u].region);break}break;case"vertical":p.alt(g,c,["rl","lr"]);break;case"line":m=c.split(","),p.integer(g,m[0]),p.percent(g,m[0])&&p.set("snapToLines",!1),p.alt(g,m[0],["auto"]),m.length===2&&p.alt("lineAlign",m[1],["start",S,"end"]);break;case"position":m=c.split(","),p.percent(g,m[0]),m.length===2&&p.alt("positionAlign",m[1],["start",S,"end","line-left","line-right","auto"]);break;case"size":p.percent(g,c);break;case"align":p.alt(g,c,["start",S,"end","left","right"]);break}},/:/,/\s/),f.region=p.get("region",null),f.vertical=p.get("vertical","");var E=p.get("line","auto");E==="auto"&&e.line===-1&&(E=-1),f.line=E,f.lineAlign=p.get("lineAlign","start"),f.snapToLines=p.get("snapToLines",!0),f.size=p.get("size",100),f.align=p.get("align",S);var b=p.get("position","auto");b==="auto"&&e.position===50&&(b=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=b}function t(){a=a.replace(/^\s+/,"")}if(t(),r.startTime=n(),t(),a.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);a=a.substr(3),t(),r.endTime=n(),t(),i(a,r)}function h(a){return a.replace(/<br(?: \/)?>/gi,`
|
|
`)}var o=function(){function a(){this.state="INITIAL",this.buffer="",this.decoder=new w,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var r=a.prototype;return r.parse=function(s){var n=this;s&&(n.buffer+=n.decoder.decode(s,{stream:!0}));function i(){var b=n.buffer,g=0;for(b=h(b);g<b.length&&b[g]!=="\r"&&b[g]!==`
|
|
`;)++g;var c=b.substr(0,g);return b[g]==="\r"&&++g,b[g]===`
|
|
`&&++g,n.buffer=b.substr(g),c}function t(b){U(b,function(g,c){},/:/)}try{var v="";if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;v=i();var f=v.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Error("Malformed WebVTT signature.");n.state="HEADER"}for(var p=!1;n.buffer;){if(!/\r\n|\n/.test(n.buffer))return this;p?p=!1:v=i();switch(n.state){case"HEADER":/:/.test(v)?t(v):v||(n.state="ID");continue;case"NOTE":v||(n.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(v)){n.state="NOTE";break}if(!v)continue;if(n.cue=new k.default(0,0,""),n.state="CUE",v.indexOf("-->")===-1){n.cue.id=v;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{d(v,n.cue,n.regionList)}catch(b){n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{var E=v.indexOf("-->")!==-1;if(!v||E&&(p=!0)){n.oncue&&n.cue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue===null)continue;n.cue.text&&(n.cue.text+=`
|
|
`),n.cue.text+=v}continue;case"BADCUE":v||(n.state="ID")}}}catch(b){n.state==="CUETEXT"&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},r.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(n){s.onparsingerror&&s.onparsingerror(n)}return s.onflush&&s.onflush(),this},a}()},"./src/utils/webvtt-parser.ts":function(ae,B,O){"use strict";O.r(B),O.d(B,"generateCueId",function(){return o}),O.d(B,"parseWebVTT",function(){return r});var k=O("./src/polyfills/number.ts"),w=O("./src/utils/vttparser.ts"),R=O("./src/demux/id3.ts"),H=O("./src/utils/timescale-conversion.ts"),U=O("./src/remux/mp4-remuxer.ts"),e=/\r\n|\n\r|\n|\r/g,S=function(s,n,i){return i===void 0&&(i=0),s.substr(i,n.length)===n},d=function(s){var n=parseInt(s.substr(-3)),i=parseInt(s.substr(-6,2)),t=parseInt(s.substr(-9,2)),v=s.length>9?parseInt(s.substr(0,s.indexOf(":"))):0;if(!Object(k.isFiniteNumber)(n)||!Object(k.isFiniteNumber)(i)||!Object(k.isFiniteNumber)(t)||!Object(k.isFiniteNumber)(v))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+s);return n+=1e3*i,n+=60*1e3*t,n+=60*60*1e3*v,n},h=function(s){for(var n=5381,i=s.length;i;)n=n*33^s.charCodeAt(--i);return(n>>>0).toString()};function o(l,s,n){return h(l.toString())+h(s.toString())+h(n)}var a=function(s,n,i){var t=s[n],v=s[t.prevCC];if(!v||!v.new&&t.new){s.ccOffset=s.presentationOffset=t.start,t.new=!1;return}for(;(f=v)!==null&&f!==void 0&&f.new;){var f;s.ccOffset+=t.start-v.start,t.new=!1,t=v,v=s[t.prevCC]}s.presentationOffset=i};function r(l,s,n,i,t,v,f,p){var E=new w.VTTParser,b=Object(R.utf8ArrayToStr)(new Uint8Array(l)).trim().replace(e,`
|
|
`).split(`
|
|
`),g=[],c=Object(H.toMpegTsClockFromTimescale)(s,n),m="00:00.000",u=0,_=0,y,T=!0,M=!1;E.oncue=function(L){var x=i[t],D=i.ccOffset,j=(u-c)/9e4;if(x!=null&&x.new&&(_!==void 0?D=i.ccOffset=x.start:a(i,t,j)),j&&(D=j-i.presentationOffset),M){var I=L.endTime-L.startTime,W=Object(U.normalizePts)((L.startTime+D-_)*9e4,v*9e4)/9e4;L.startTime=W,L.endTime=W+I}var Q=L.text.trim();L.text=decodeURIComponent(encodeURIComponent(Q)),L.id||(L.id=o(L.startTime,L.endTime,Q)),L.endTime>0&&g.push(L)},E.onparsingerror=function(L){y=L},E.onflush=function(){if(y){p(y);return}f(g)},b.forEach(function(L){if(T)if(S(L,"X-TIMESTAMP-MAP=")){T=!1,M=!0,L.substr(16).split(",").forEach(function(x){S(x,"LOCAL:")?m=x.substr(6):S(x,"MPEGTS:")&&(u=parseInt(x.substr(7)))});try{_=d(m)/1e3}catch(x){M=!1,y=x}return}else L===""&&(T=!1);E.parse(L+`
|
|
`)}),E.flush()}},"./src/utils/xhr-loader.ts":function(ae,B,O){"use strict";O.r(B);var k=O("./src/utils/logger.ts"),w=O("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,H=function(){function U(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 w.LoadStats,this.retryDelay=0}var e=U.prototype;return e.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},e.abortInternal=function(){var d=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),d&&(d.onreadystatechange=null,d.onprogress=null,d.readyState!==4&&(this.stats.aborted=!0,d.abort()))},e.abort=function(){var d;this.abortInternal(),(d=this.callbacks)!==null&&d!==void 0&&d.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},e.load=function(d,h,o){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=d,this.config=h,this.callbacks=o,this.retryDelay=h.retryDelay,this.loadInternal()},e.loadInternal=function(){var d=this.config,h=this.context;if(!d)return;var o=this.loader=new self.XMLHttpRequest,a=this.stats;a.loading.first=0,a.loaded=0;var r=this.xhrSetup;try{if(r)try{r(o,h.url)}catch(n){o.open("GET",h.url,!0),r(o,h.url)}o.readyState||o.open("GET",h.url,!0);var l=this.context.headers;if(l)for(var s in l)o.setRequestHeader(s,l[s])}catch(n){this.callbacks.onError({code:o.status,text:n.message},h,o);return}h.rangeEnd&&o.setRequestHeader("Range","bytes="+h.rangeStart+"-"+(h.rangeEnd-1)),o.onreadystatechange=this.readystatechange.bind(this),o.onprogress=this.loadprogress.bind(this),o.responseType=h.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),d.timeout),o.send()},e.readystatechange=function(){var d=this.context,h=this.loader,o=this.stats;if(!d||!h)return;var a=h.readyState,r=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){h.onreadystatechange=null,h.onprogress=null;var l=h.status;if(l>=200&&l<300){o.loading.end=Math.max(self.performance.now(),o.loading.first);var s,n;if(d.responseType==="arraybuffer"?(s=h.response,n=s.byteLength):(s=h.responseText,n=s.length),o.loaded=o.total=n,!this.callbacks)return;var i=this.callbacks.onProgress;if(i&&i(o,d,s,h),!this.callbacks)return;var t={url:h.responseURL,data:s};this.callbacks.onSuccess(t,o,d,h)}else o.retry>=r.maxRetry||l>=400&&l<499?(k.logger.error(l+" while loading "+d.url),this.callbacks.onError({code:l,text:h.statusText},d,h)):(k.logger.warn(l+" while loading "+d.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,r.maxRetryDelay),o.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout)},e.loadtimeout=function(){k.logger.warn("timeout while loading "+this.context.url);var d=this.callbacks;d&&(this.abortInternal(),d.onTimeout(this.stats,this.context,this.loader))},e.loadprogress=function(d){var h=this.stats;h.loaded=d.loaded,d.lengthComputable&&(h.total=d.total)},e.getCacheAge=function(){var d=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var h=this.loader.getResponseHeader("age");d=h?parseFloat(h):null}return d},U}();B.default=H}}).default})},vHTk:function(Ye,ye,$){Ye.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|