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.
468 lines
1.2 MiB
468 lines
1.2 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[168,5,6,8,9],{"+NIl":function(at,ve,Z){(function(se){se(Z("VrN/"))})(function(se){"use strict";se.defineMode("stex",function(Se,ce){"use strict";function ye(p,u){p.cmdState.push(u)}function le(p){return p.cmdState.length>0?p.cmdState[p.cmdState.length-1]:null}function X(p){var u=p.cmdState.pop();u&&u.closeBracket()}function F(p){for(var u=p.cmdState,m=u.length-1;m>=0;m--){var b=u[m];if(b.name=="DEFAULT")continue;return b}return{styleIdentifier:function(){return null}}}function W(p,u,m){return function(){this.name=p,this.bracketNo=0,this.style=u,this.styles=m,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var r={};r.importmodule=W("importmodule","tag",["string","builtin"]),r.documentclass=W("documentclass","tag",["","atom"]),r.usepackage=W("usepackage","tag",["atom"]),r.begin=W("begin","tag",["atom"]),r.end=W("end","tag",["atom"]),r.label=W("label","tag",["atom"]),r.ref=W("ref","tag",["atom"]),r.eqref=W("eqref","tag",["atom"]),r.cite=W("cite","tag",["atom"]),r.bibitem=W("bibitem","tag",["atom"]),r.Bibitem=W("Bibitem","tag",["atom"]),r.RBibitem=W("RBibitem","tag",["atom"]),r.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function H(p,u){p.f=u}function D(p,u){var m;if(p.match(/^\\[a-zA-Z@]+/)){var b=p.current().slice(1);return m=r.hasOwnProperty(b)?r[b]:r.DEFAULT,m=new m,ye(u,m),H(u,g),m.style}if(p.match(/^\\[$&%#{}_]/))return"tag";if(p.match(/^\\[,;!\/\\]/))return"tag";if(p.match("\\["))return H(u,function(_,f){return M(_,f,"\\]")}),"keyword";if(p.match("\\("))return H(u,function(_,f){return M(_,f,"\\)")}),"keyword";if(p.match("$$"))return H(u,function(_,f){return M(_,f,"$$")}),"keyword";if(p.match("$"))return H(u,function(_,f){return M(_,f,"$")}),"keyword";var E=p.next();if(E=="%")return p.skipToEnd(),"comment";if(E=="}"||E=="]"){if(m=le(u),m)m.closeBracket(E),H(u,g);else return"error";return"bracket"}else return E=="{"||E=="["?(m=r.DEFAULT,m=new m,ye(u,m),"bracket"):/\d/.test(E)?(p.eatWhile(/[\w.%]/),"atom"):(p.eatWhile(/[\w\-_]/),m=F(u),m.name=="begin"&&(m.argument=p.current()),m.styleIdentifier())}function M(p,u,m){if(p.eatSpace())return null;if(m&&p.match(m))return H(u,D),"keyword";if(p.match(/^\\[a-zA-Z@]+/))return"tag";if(p.match(/^[a-zA-Z]+/))return"variable-2";if(p.match(/^\\[$&%#{}_]/))return"tag";if(p.match(/^\\[,;!\/]/))return"tag";if(p.match(/^[\^_&]/))return"tag";if(p.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(p.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var b=p.next();return b=="{"||b=="}"||b=="["||b=="]"||b=="("||b==")"?"bracket":b=="%"?(p.skipToEnd(),"comment"):"error"}function g(p,u){var m=p.peek(),b;return m=="{"||m=="["?(b=le(u),b.openBracket(m),p.eat(m),H(u,D),"bracket"):/[ \t\r]/.test(m)?(p.eat(m),null):(H(u,D),X(u),D(p,u))}return{startState:function(){var p=ce.inMathMode?function(u,m){return M(u,m)}:D;return{cmdState:[],f:p}},copyState:function(p){return{cmdState:p.cmdState.slice(),f:p.f}},token:function(p,u){return u.f(p,u)},blankLine:function(p){p.f=D,p.cmdState.length=0},lineComment:"%"}}),se.defineMIME("text/x-stex","stex"),se.defineMIME("text/x-latex","stex")})},"+ua5":function(at,ve,Z){},"/cxE":function(at,ve,Z){"use strict";Z.d(ve,"f",function(){return ce}),Z.d(ve,"g",function(){return ye}),Z.d(ve,"h",function(){return le}),Z.d(ve,"e",function(){return F}),Z.d(ve,"b",function(){return W}),Z.d(ve,"c",function(){return r}),Z.d(ve,"d",function(){return H}),Z.d(ve,"a",function(){return D});class se{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(M){setTimeout(()=>{throw M.stack?new Error(M.message+`
|
|
|
|
`+M.stack):M},0)}}emit(M){this.listeners.forEach(g=>{g(M)})}onUnexpectedError(M){this.unexpectedErrorHandler(M),this.emit(M)}onUnexpectedExternalError(M){this.unexpectedErrorHandler(M)}}const Se=new se;function ce(M){F(M)||Se.onUnexpectedError(M);return}function ye(M){F(M)||Se.onUnexpectedExternalError(M);return}function le(M){if(M instanceof Error){let{name:g,message:p}=M;const u=M.stacktrace||M.stack;return{$isError:!0,name:g,message:p,stack:u}}return M}const X="Canceled";function F(M){return M instanceof Error&&M.name===X&&M.message===X}function W(){const M=new Error(X);return M.name=M.message,M}function r(M){return M?new Error(`Illegal argument: ${M}`):new Error("Illegal argument")}function H(M){return M?new Error(`Illegal state: ${M}`):new Error("Illegal state")}class D extends Error{constructor(M){super("NotSupported");M&&(this.message=M)}}},"19Vz":function(at,ve,Z){(function(se){se(Z("VrN/"))})(function(se){se.defineOption("placeholder","",function(W,r,H){var D=H&&H!=se.Init;if(r&&!D)W.on("blur",le),W.on("change",X),W.on("swapDoc",X),se.on(W.getInputField(),"compositionupdate",W.state.placeholderCompose=function(){ye(W)}),X(W);else if(!r&&D){W.off("blur",le),W.off("change",X),W.off("swapDoc",X),se.off(W.getInputField(),"compositionupdate",W.state.placeholderCompose),Se(W);var M=W.getWrapperElement();M.className=M.className.replace(" CodeMirror-empty","")}r&&!W.hasFocus()&&le(W)});function Se(W){W.state.placeholder&&(W.state.placeholder.parentNode.removeChild(W.state.placeholder),W.state.placeholder=null)}function ce(W){Se(W);var r=W.state.placeholder=document.createElement("pre");r.style.cssText="height: 0; overflow: visible",r.style.direction=W.getOption("direction"),r.className="CodeMirror-placeholder CodeMirror-line-like";var H=W.getOption("placeholder");typeof H=="string"&&(H=document.createTextNode(H)),r.appendChild(H),W.display.lineSpace.insertBefore(r,W.display.lineSpace.firstChild)}function ye(W){setTimeout(function(){var r=!1,H=W.getInputField();H.nodeName=="TEXTAREA"?r=!H.value:W.lineCount()==1&&(r=!/[^\u200b]/.test(H.querySelector(".CodeMirror-line").textContent)),r?ce(W):Se(W)},20)}function le(W){F(W)&&ce(W)}function X(W){var r=W.getWrapperElement(),H=F(W);r.className=r.className.replace(" CodeMirror-empty","")+(H?" CodeMirror-empty":""),H?ce(W):Se(W)}function F(W){return W.lineCount()===1&&W.getLine(0)===""}})},"1eCo":function(at,ve,Z){(function(se){se(Z("VrN/"))})(function(se){"use strict";var Se={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},ce={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};se.defineMode("xml",function(ye,le){var X=ye.indentUnit,F={},W=le.htmlMode?Se:ce;for(var r in W)F[r]=W[r];for(var r in le)F[r]=le[r];var H,D;function M(S,C){function c(l){return C.tokenize=l,l(S,C)}var o=S.next();if(o=="<")return S.eat("!")?S.eat("[")?S.match("CDATA[")?c(u("atom","]]>")):null:S.match("--")?c(u("comment","-->")):S.match("DOCTYPE",!0,!0)?(S.eatWhile(/[\w\._\-]/),c(m(1))):null:S.eat("?")?(S.eatWhile(/[\w\._\-]/),C.tokenize=u("meta","?>"),"meta"):(H=S.eat("/")?"closeTag":"openTag",C.tokenize=g,"tag bracket");if(o=="&"){var v;return S.eat("#")?S.eat("x")?v=S.eatWhile(/[a-fA-F\d]/)&&S.eat(";"):v=S.eatWhile(/[\d]/)&&S.eat(";"):v=S.eatWhile(/[\w\.\-:]/)&&S.eat(";"),v?"atom":"error"}else return S.eatWhile(/[^&<]/),null}M.isInText=!0;function g(S,C){var c=S.next();if(c==">"||c=="/"&&S.eat(">"))return C.tokenize=M,H=c==">"?"endTag":"selfcloseTag","tag bracket";if(c=="=")return H="equals",null;if(c=="<"){C.tokenize=M,C.state=f,C.tagName=C.tagStart=null;var o=C.tokenize(S,C);return o?o+" tag error":"tag error"}else return/[\'\"]/.test(c)?(C.tokenize=p(c),C.stringStartCol=S.column(),C.tokenize(S,C)):(S.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function p(S){var C=function(c,o){for(;!c.eol();)if(c.next()==S){o.tokenize=g;break}return"string"};return C.isInAttribute=!0,C}function u(S,C){return function(c,o){for(;!c.eol();){if(c.match(C)){o.tokenize=M;break}c.next()}return S}}function m(S){return function(C,c){for(var o;(o=C.next())!=null;){if(o=="<")return c.tokenize=m(S+1),c.tokenize(C,c);if(o==">")if(S==1){c.tokenize=M;break}else return c.tokenize=m(S-1),c.tokenize(C,c)}return"meta"}}function b(S,C,c){this.prev=S.context,this.tagName=C,this.indent=S.indented,this.startOfLine=c,(F.doNotIndent.hasOwnProperty(C)||S.context&&S.context.noIndent)&&(this.noIndent=!0)}function E(S){S.context&&(S.context=S.context.prev)}function _(S,C){for(var c;;){if(!S.context)return;if(c=S.context.tagName,!F.contextGrabbers.hasOwnProperty(c)||!F.contextGrabbers[c].hasOwnProperty(C))return;E(S)}}function f(S,C,c){return S=="openTag"?(c.tagStart=C.column(),O):S=="closeTag"?w:f}function O(S,C,c){return S=="word"?(c.tagName=C.current(),D="tag",I):F.allowMissingTagName&&S=="endTag"?(D="tag bracket",I(S,C,c)):(D="error",O)}function w(S,C,c){if(S=="word"){var o=C.current();return c.context&&c.context.tagName!=o&&F.implicitlyClosed.hasOwnProperty(c.context.tagName)&&E(c),c.context&&c.context.tagName==o||F.matchClosing===!1?(D="tag",R):(D="tag error",x)}else return F.allowMissingTagName&&S=="endTag"?(D="tag bracket",R(S,C,c)):(D="error",x)}function R(S,C,c){return S!="endTag"?(D="error",R):(E(c),f)}function x(S,C,c){return D="error",R(S,C,c)}function I(S,C,c){if(S=="word")return D="attribute",k;if(S=="endTag"||S=="selfcloseTag"){var o=c.tagName,v=c.tagStart;return c.tagName=c.tagStart=null,S=="selfcloseTag"||F.autoSelfClosers.hasOwnProperty(o)?_(c,o):(_(c,o),c.context=new b(c,o,v==c.indented)),f}return D="error",I}function k(S,C,c){return S=="equals"?A:(F.allowMissing||(D="error"),I(S,C,c))}function A(S,C,c){return S=="string"?P:S=="word"&&F.allowUnquoted?(D="string",I):(D="error",I(S,C,c))}function P(S,C,c){return S=="string"?P:I(S,C,c)}return{startState:function(S){var C={tokenize:M,state:f,indented:S||0,tagName:null,tagStart:null,context:null};return S!=null&&(C.baseIndent=S),C},token:function(S,C){if(!C.tagName&&S.sol()&&(C.indented=S.indentation()),S.eatSpace())return null;H=null;var c=C.tokenize(S,C);return(c||H)&&c!="comment"&&(D=null,C.state=C.state(H||c,S,C),D&&(c=D=="error"?c+" error":D)),c},indent:function(S,C,c){var o=S.context;if(S.tokenize.isInAttribute)return S.tagStart==S.indented?S.stringStartCol+1:S.indented+X;if(o&&o.noIndent)return se.Pass;if(S.tokenize!=g&&S.tokenize!=M)return c?c.match(/^(\s*)/)[0].length:0;if(S.tagName)return F.multilineTagIndentPastTag!==!1?S.tagStart+S.tagName.length+2:S.tagStart+X*(F.multilineTagIndentFactor||1);if(F.alignCDATA&&/<!\[CDATA\[/.test(C))return 0;var v=C&&/^<(\/)?([\w_:\.-]*)/.exec(C);if(v&&v[1])for(;o;)if(o.tagName==v[2]){o=o.prev;break}else if(F.implicitlyClosed.hasOwnProperty(o.tagName))o=o.prev;else break;else if(v)for(;o;){var l=F.contextGrabbers[o.tagName];if(l&&l.hasOwnProperty(v[2]))o=o.prev;else break}for(;o&&o.prev&&!o.startOfLine;)o=o.prev;return o?o.indent+X:S.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:F.htmlMode?"html":"xml",helperType:F.htmlMode?"html":"xml",skipAttribute:function(S){S.state==A&&(S.state=I)},xmlCurrentTag:function(S){return S.tagName?{name:S.tagName,close:S.type=="closeTag"}:null},xmlCurrentContext:function(S){for(var C=[],c=S.context;c;c=c.prev)c.tagName&&C.push(c.tagName);return C.reverse()}}}),se.defineMIME("text/xml","xml"),se.defineMIME("application/xml","xml"),se.mimeModes.hasOwnProperty("text/html")||se.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"24hK":function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return Se});class se{constructor(ce){this.element=ce,this.next=se.Undefined,this.prev=se.Undefined}}se.Undefined=new se(void 0);class Se{constructor(){this._first=se.Undefined,this._last=se.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===se.Undefined}clear(){let ce=this._first;for(;ce!==se.Undefined;){const ye=ce.next;ce.prev=se.Undefined,ce.next=se.Undefined,ce=ye}this._first=se.Undefined,this._last=se.Undefined,this._size=0}unshift(ce){return this._insert(ce,!1)}push(ce){return this._insert(ce,!0)}_insert(ce,ye){const le=new se(ce);if(this._first===se.Undefined)this._first=le,this._last=le;else if(ye){const F=this._last;this._last=le,le.prev=F,F.next=le}else{const F=this._first;this._first=le,le.next=F,F.prev=le}this._size+=1;let X=!1;return()=>{X||(X=!0,this._remove(le))}}shift(){if(this._first===se.Undefined)return;{const ce=this._first.element;return this._remove(this._first),ce}}pop(){if(this._last===se.Undefined)return;{const ce=this._last.element;return this._remove(this._last),ce}}_remove(ce){if(ce.prev!==se.Undefined&&ce.next!==se.Undefined){const ye=ce.prev;ye.next=ce.next,ce.next.prev=ye}else ce.prev===se.Undefined&&ce.next===se.Undefined?(this._first=se.Undefined,this._last=se.Undefined):ce.next===se.Undefined?(this._last=this._last.prev,this._last.next=se.Undefined):ce.prev===se.Undefined&&(this._first=this._first.next,this._first.prev=se.Undefined);this._size-=1}*[Symbol.iterator](){let ce=this._first;for(;ce!==se.Undefined;)yield ce.element,ce=ce.next}}},"3/fG":function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return Se});function se(ce,ye){let le;return ye.length===0?le=ce:le=ce.replace(/\{(\d+)\}/g,function(X,F){const W=F[0];return typeof ye[W]!="undefined"?ye[W]:X}),le}function Se(ce,ye,...le){return se(ye,le)}},"5VLF":function(at,ve,Z){"use strict";var se,Se;function ce(ye,le,X){var F=function(W,r){return ye.js_beautify(W,r)};return F.js=ye.js_beautify,F.css=le.css_beautify,F.html=X.html_beautify,F.js_beautify=ye.js_beautify,F.css_beautify=le.css_beautify,F.html_beautify=X.html_beautify,F}!(se=[Z("6UM0"),Z("TXwP"),Z("psGv")],Se=function(ye,le,X){return ce(ye,le,X)}.apply(ve,se),Se!==void 0&&(at.exports=Se))},"5Y4S":function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return ce});var se=Z("MNsG");const Se=se.b.performance&&typeof se.b.performance.now=="function";class ce{constructor(ye){this._highResolution=Se&&ye,this._startTime=this._now(),this._stopTime=-1}static create(ye=!0){return new ce(ye)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?se.b.performance.now():Date.now()}}},"6UM0":function(at,ve,Z){var se,Se;(function(){var ce;(function(){"use strict";var le=[function(r,H,D){var M=D(1).Beautifier,g=D(5).Options;function p(u,m){var b=new M(u,m);return b.beautify()}r.exports=p,r.exports.defaultOptions=function(){return new g}},function(r,H,D){var M=D(2).Output,g=D(3).Token,p=D(4),u=D(5).Options,m=D(7).Tokenizer,b=D(7).line_starters,E=D(7).positionable_operators,_=D(7).TOKEN;function f(n,N){return N.indexOf(n)!==-1}function O(n){return n.replace(/^\s+/g,"")}function w(n){for(var N={},U=0;U<n.length;U++)N[n[U].replace(/-/g,"_")]=n[U];return N}function R(n,N){return n&&n.type===_.RESERVED&&n.text===N}function x(n,N){return n&&n.type===_.RESERVED&&f(n.text,N)}var I=["case","return","do","if","throw","else","await","break","continue","async"],k=["before-newline","after-newline","preserve-newline"],A=w(k),P=[A.before_newline,A.preserve_newline],S={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function C(n,N){if(N.multiline_frame||N.mode===S.ForInitializer||N.mode===S.Conditional)return;n.remove_indent(N.start_line_index)}function c(n){n=n.replace(p.allLineBreaks,`
|
|
`);for(var N=[],U=n.indexOf(`
|
|
`);U!==-1;)N.push(n.substring(0,U)),n=n.substring(U+1),U=n.indexOf(`
|
|
`);return n.length&&N.push(n),N}function o(n){return n===S.ArrayLiteral}function v(n){return f(n,[S.Expression,S.ForInitializer,S.Conditional])}function l(n,N){for(var U=0;U<n.length;U++){var j=n[U].trim();if(j.charAt(0)!==N)return!1}return!0}function a(n,N){for(var U=0,j=n.length,Y;U<j;U++)if(Y=n[U],Y&&Y.indexOf(N)!==0)return!1;return!0}function T(n,N){N=N||{},this._source_text=n||"",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 u(N)}T.prototype.create_flags=function(n,N){var U=0;n&&(U=n.indentation_level,!this._output.just_added_newline()&&n.line_indent_level>U&&(U=n.line_indent_level));var j={mode:N,parent:n,last_token:n?n.last_token:new g(_.START_BLOCK,""),last_word:n?n.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:U,alignment:0,line_indent_level:n?n.line_indent_level:U,start_line_index:this._output.get_line_number(),ternary_depth:0};return j},T.prototype._reset=function(n){var N=n.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new M(this._options,N),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(S.BlockStatement);var U=new m(n,this._options);return this._tokens=U.tokenize(),n},T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var n,N=this._reset(this._source_text),U=this._options.eol;this._options.eol==="auto"&&(U=`
|
|
`,N&&p.lineBreak.test(N||"")&&(U=N.match(p.lineBreak)[0]));for(var j=this._tokens.next();j;)this.handle_token(j),this._last_last_text=this._flags.last_token.text,this._flags.last_token=j,j=this._tokens.next();return n=this._output.get_code(U),n},T.prototype.handle_token=function(n,N){n.type===_.START_EXPR?this.handle_start_expr(n):n.type===_.END_EXPR?this.handle_end_expr(n):n.type===_.START_BLOCK?this.handle_start_block(n):n.type===_.END_BLOCK?this.handle_end_block(n):n.type===_.WORD?this.handle_word(n):n.type===_.RESERVED?this.handle_word(n):n.type===_.SEMICOLON?this.handle_semicolon(n):n.type===_.STRING?this.handle_string(n):n.type===_.EQUALS?this.handle_equals(n):n.type===_.OPERATOR?this.handle_operator(n):n.type===_.COMMA?this.handle_comma(n):n.type===_.BLOCK_COMMENT?this.handle_block_comment(n,N):n.type===_.COMMENT?this.handle_comment(n,N):n.type===_.DOT?this.handle_dot(n):n.type===_.EOF?this.handle_eof(n):n.type===_.UNKNOWN?this.handle_unknown(n,N):this.handle_unknown(n,N)},T.prototype.handle_whitespace_and_comments=function(n,N){var U=n.newlines,j=this._options.keep_array_indentation&&o(this._flags.mode);if(n.comments_before)for(var Y=n.comments_before.next();Y;)this.handle_whitespace_and_comments(Y,N),this.handle_token(Y,N),Y=n.comments_before.next();if(j)for(var J=0;J<U;J+=1)this.print_newline(J>0,N);else if(this._options.max_preserve_newlines&&U>this._options.max_preserve_newlines&&(U=this._options.max_preserve_newlines),this._options.preserve_newlines&&U>1){this.print_newline(!1,N);for(var ee=1;ee<U;ee+=1)this.print_newline(!0,N)}};var h=["async","break","continue","return","throw","yield"];T.prototype.allow_wrap_or_preserved_newline=function(n,N){if(N=N===void 0?!1:N,this._output.just_added_newline())return;var U=this._options.preserve_newlines&&n.newlines||N,j=f(this._flags.last_token.text,E)||f(n.text,E);if(j){var Y=f(this._flags.last_token.text,E)&&f(this._options.operator_position,P)||f(n.text,E);U=U&&Y}if(U)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(x(this._flags.last_token,h))return;this._output.set_wrap_point()}},T.prototype.print_newline=function(n,N){if(!N&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==_.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var U=this._tokens.peek();this._flags.mode===S.Statement&&!(this._flags.if_block&&R(U,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(n)&&(this._flags.multiline_frame=!0)},T.prototype.print_token_line_indentation=function(n){this._output.just_added_newline()&&(this._options.keep_array_indentation&&n.newlines&&(n.text==="["||o(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(n.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))},T.prototype.print_token=function(n){if(this._output.raw){this._output.add_raw_token(n);return}if(this._options.comma_first&&n.previous&&n.previous.type===_.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var N=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(N),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(n),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(n),this._output.non_breaking_space=!0,this._output.add_token(n.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},T.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},T.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))},T.prototype.set_mode=function(n){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,n),this._flags=this.create_flags(this._previous_flags,n),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},T.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===S.Statement&&C(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},T.prototype.start_of_object_property=function(){return this._flags.parent.mode===S.ObjectLiteral&&this._flags.mode===S.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||x(this._flags.last_token,["get","set"]))},T.prototype.start_of_statement=function(n){var N=!1;return N=N||x(this._flags.last_token,["var","let","const"])&&n.type===_.WORD,N=N||R(this._flags.last_token,"do"),N=N||!(this._flags.parent.mode===S.ObjectLiteral&&this._flags.mode===S.Statement)&&x(this._flags.last_token,h)&&!n.newlines,N=N||R(this._flags.last_token,"else")&&!(R(n,"if")&&!n.comments_before),N=N||this._flags.last_token.type===_.END_EXPR&&(this._previous_flags.mode===S.ForInitializer||this._previous_flags.mode===S.Conditional),N=N||this._flags.last_token.type===_.WORD&&this._flags.mode===S.BlockStatement&&!this._flags.in_case&&!(n.text==="--"||n.text==="++")&&this._last_last_text!=="function"&&n.type!==_.WORD&&n.type!==_.RESERVED,N=N||this._flags.mode===S.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||x(this._flags.last_token,["get","set"])),N?(this.set_mode(S.Statement),this.indent(),this.handle_whitespace_and_comments(n,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(n,x(n,["do","for","if","while"])),!0):!1},T.prototype.handle_start_expr=function(n){this.start_of_statement(n)||this.handle_whitespace_and_comments(n);var N=S.Expression;if(n.text==="["){if(this._flags.last_token.type===_.WORD||this._flags.last_token.text===")"){x(this._flags.last_token,b)&&(this._output.space_before_token=!0),this.print_token(n),this.set_mode(N),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}N=S.ArrayLiteral,o(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())),f(this._flags.last_token.type,[_.START_EXPR,_.END_EXPR,_.WORD,_.OPERATOR,_.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===_.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,N=S.ForInitializer):f(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,N=S.Conditional):f(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&n.whitespace_before===""?this._output.space_before_token=!1:(f(this._flags.last_token.text,b)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===_.EQUALS||this._flags.last_token.type===_.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(n);else if(this._flags.last_token.type===_.WORD){this._output.space_before_token=!1;var U=this._tokens.peek(-3);if(this._options.space_after_named_function&&U){var j=this._tokens.peek(-4);x(U,["async","function"])||U.text==="*"&&x(j,["async","function"])?this._output.space_before_token=!0:this._flags.mode===S.ObjectLiteral?(U.text==="{"||U.text===","||U.text==="*"&&(j.text==="{"||j.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(n);(this._flags.last_token.type===_.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(f(this._last_last_text,["function","yield"])||this._flags.mode===S.ObjectLiteral&&f(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===_.START_BLOCK?this.print_newline():(this._flags.last_token.type===_.END_EXPR||this._flags.last_token.type===_.START_EXPR||this._flags.last_token.type===_.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===_.COMMA)&&this.allow_wrap_or_preserved_newline(n,n.newlines),this.print_token(n),this.set_mode(N),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},T.prototype.handle_end_expr=function(n){for(;this._flags.mode===S.Statement;)this.restore_mode();this.handle_whitespace_and_comments(n),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(n,n.text==="]"&&o(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===_.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(n),this.restore_mode(),C(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===S.Conditional&&(this._previous_flags.mode=S.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},T.prototype.handle_start_block=function(n){this.handle_whitespace_and_comments(n);var N=this._tokens.peek(),U=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===_.END_EXPR?(this.set_mode(S.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(S.BlockStatement):U&&(f(U.text,[":",","])&&f(N.type,[_.STRING,_.WORD,_.RESERVED])||f(N.text,["get","set","..."])&&f(U.type,[_.WORD,_.RESERVED]))?f(this._last_last_text,["class","interface"])&&!f(U.text,[":",","])?this.set_mode(S.BlockStatement):this.set_mode(S.ObjectLiteral):this._flags.last_token.type===_.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(S.BlockStatement):f(this._flags.last_token.type,[_.EQUALS,_.START_EXPR,_.COMMA,_.OPERATOR])||x(this._flags.last_token,["return","throw","import","default"])?this.set_mode(S.ObjectLiteral):this.set_mode(S.BlockStatement),this._flags.last_token&&(x(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var j=!N.comments_before&&N.text==="}",Y=j&&this._flags.last_word==="function"&&this._flags.last_token.type===_.END_EXPR;if(this._options.brace_preserve_inline){var J=0,ee=null;this._flags.inline_frame=!0;do if(J+=1,ee=this._tokens.peek(J-1),ee.newlines){this._flags.inline_frame=!1;break}while(ee.type!==_.EOF&&!(ee.type===_.END_BLOCK&&ee.opened===n))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&n.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==_.OPERATOR&&(Y||this._flags.last_token.type===_.EQUALS||x(this._flags.last_token,I)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(o(this._previous_flags.mode)&&(this._flags.last_token.type===_.START_EXPR||this._flags.last_token.type===_.COMMA)&&((this._flags.last_token.type===_.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===_.COMMA||this._flags.last_token.type===_.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(n),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==_.OPERATOR&&this._flags.last_token.type!==_.START_EXPR&&(this._flags.last_token.type===_.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(n),this.indent(),!j&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},T.prototype.handle_end_block=function(n){for(this.handle_whitespace_and_comments(n);this._flags.mode===S.Statement;)this.restore_mode();var N=this._flags.last_token.type===_.START_BLOCK;this._flags.inline_frame&&!N?this._output.space_before_token=!0:this._options.brace_style==="expand"?N||this.print_newline():N||(o(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(n)},T.prototype.handle_word=function(n){if(n.type===_.RESERVED){if(f(n.text,["set","get"])&&this._flags.mode!==S.ObjectLiteral)n.type=_.WORD;else if(n.text==="import"&&f(this._tokens.peek().text,["(","."]))n.type=_.WORD;else if(f(n.text,["as","from"])&&!this._flags.import_block)n.type=_.WORD;else if(this._flags.mode===S.ObjectLiteral){var N=this._tokens.peek();N.text===":"&&(n.type=_.WORD)}}if(this.start_of_statement(n)?x(this._flags.last_token,["var","let","const"])&&n.type===_.WORD&&(this._flags.declaration_statement=!0):n.newlines&&!v(this._flags.mode)&&(this._flags.last_token.type!==_.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==_.EQUALS&&(this._options.preserve_newlines||!x(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(n),this.print_newline()):this.handle_whitespace_and_comments(n),this._flags.do_block&&!this._flags.do_while)if(R(n,"while")){this._output.space_before_token=!0,this.print_token(n),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&&R(n,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===S.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&x(n,["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(n),this._flags.in_case=!0;return}if((this._flags.last_token.type===_.COMMA||this._flags.last_token.type===_.START_EXPR||this._flags.last_token.type===_.EQUALS||this._flags.last_token.type===_.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(n)),R(n,"function")){(f(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(f(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===_.OPERATOR))&&(!this._output.just_added_blankline()&&!n.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===_.RESERVED||this._flags.last_token.type===_.WORD?x(this._flags.last_token,["get","set","new","export"])||x(this._flags.last_token,h)?this._output.space_before_token=!0:R(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===_.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(v(this._flags.mode)||o(this._flags.mode))||this.print_newline(),this.print_token(n),this._flags.last_word=n.text;return}var U="NONE";if(this._flags.last_token.type===_.END_BLOCK?this._previous_flags.inline_frame?U="SPACE":x(n,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&n.newlines?U="NEWLINE":(U="SPACE",this._output.space_before_token=!0):U="NEWLINE":this._flags.last_token.type===_.SEMICOLON&&this._flags.mode===S.BlockStatement?U="NEWLINE":this._flags.last_token.type===_.SEMICOLON&&v(this._flags.mode)?U="SPACE":this._flags.last_token.type===_.STRING?U="NEWLINE":this._flags.last_token.type===_.RESERVED||this._flags.last_token.type===_.WORD||this._flags.last_token.text==="*"&&(f(this._last_last_text,["function","yield"])||this._flags.mode===S.ObjectLiteral&&f(this._last_last_text,["{",","]))?U="SPACE":this._flags.last_token.type===_.START_BLOCK?this._flags.inline_frame?U="SPACE":U="NEWLINE":this._flags.last_token.type===_.END_EXPR&&(this._output.space_before_token=!0,U="NEWLINE"),x(n,b)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?U="SPACE":U="NEWLINE"),x(n,["else","catch","finally"]))if((!(this._flags.last_token.type===_.END_BLOCK&&this._previous_flags.mode===S.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&n.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var j=this._output.current_line;j.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else U==="NEWLINE"?x(this._flags.last_token,I)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&x(n,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==_.END_EXPR?(this._flags.last_token.type!==_.START_EXPR||!x(n,["var","let","const"]))&&this._flags.last_token.text!==":"&&(R(n,"if")&&R(n.previous,"else")?this._output.space_before_token=!0:this.print_newline()):x(n,b)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&o(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():U==="SPACE"&&(this._output.space_before_token=!0);n.previous&&(n.previous.type===_.WORD||n.previous.type===_.RESERVED)&&(this._output.space_before_token=!0),this.print_token(n),this._flags.last_word=n.text,n.type===_.RESERVED&&(n.text==="do"?this._flags.do_block=!0:n.text==="if"?this._flags.if_block=!0:n.text==="import"?this._flags.import_block=!0:this._flags.import_block&&R(n,"from")&&(this._flags.import_block=!1))},T.prototype.handle_semicolon=function(n){this.start_of_statement(n)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(n);for(var N=this._tokens.peek();this._flags.mode===S.Statement&&!(this._flags.if_block&&R(N,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(n)},T.prototype.handle_string=function(n){n.text.startsWith("`")&&n.newlines===0&&n.whitespace_before===""&&(n.previous.text===")"||this._flags.last_token.type===_.WORD)||(this.start_of_statement(n)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(n),this._flags.last_token.type===_.RESERVED||this._flags.last_token.type===_.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===_.COMMA||this._flags.last_token.type===_.START_EXPR||this._flags.last_token.type===_.EQUALS||this._flags.last_token.type===_.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(n):n.text.startsWith("`")&&this._flags.last_token.type===_.END_EXPR&&(n.previous.text==="]"||n.previous.text===")")&&n.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(n)},T.prototype.handle_equals=function(n){this.start_of_statement(n)||this.handle_whitespace_and_comments(n),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(n),this._output.space_before_token=!0},T.prototype.handle_comma=function(n){this.handle_whitespace_and_comments(n,!0),this.print_token(n),this._output.space_before_token=!0,this._flags.declaration_statement?(v(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(n)):this._flags.mode===S.ObjectLiteral||this._flags.mode===S.Statement&&this._flags.parent.mode===S.ObjectLiteral?(this._flags.mode===S.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(n)},T.prototype.handle_operator=function(n){var N=n.text==="*"&&(x(this._flags.last_token,["function","yield"])||f(this._flags.last_token.type,[_.START_BLOCK,_.COMMA,_.END_BLOCK,_.SEMICOLON])),U=f(n.text,["-","+"])&&(f(this._flags.last_token.type,[_.START_BLOCK,_.START_EXPR,_.EQUALS,_.OPERATOR])||f(this._flags.last_token.text,b)||this._flags.last_token.text===",");if(!this.start_of_statement(n)){var j=!N;this.handle_whitespace_and_comments(n,j)}if(n.text==="*"&&this._flags.last_token.type===_.DOT){this.print_token(n);return}if(n.text==="::"){this.print_token(n);return}if(this._flags.last_token.type===_.OPERATOR&&f(this._options.operator_position,P)&&this.allow_wrap_or_preserved_newline(n),n.text===":"&&this._flags.in_case){this.print_token(n),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==_.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 Y=!0,J=!0,ee=!1;if(n.text===":"?this._flags.ternary_depth===0?Y=!1:(this._flags.ternary_depth-=1,ee=!0):n.text==="?"&&(this._flags.ternary_depth+=1),!U&&!N&&this._options.preserve_newlines&&f(n.text,E)){var ie=n.text===":",re=ie&&ee,he=ie&&!ee;switch(this._options.operator_position){case A.before_newline:this._output.space_before_token=!he,this.print_token(n),(!ie||re)&&this.allow_wrap_or_preserved_newline(n),this._output.space_before_token=!0;return;case A.after_newline:this._output.space_before_token=!0,!ie||re?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(n):this._output.space_before_token=!1,this.print_token(n),this._output.space_before_token=!0;return;case A.preserve_newline:he||this.allow_wrap_or_preserved_newline(n),Y=!(this._output.just_added_newline()||he),this._output.space_before_token=Y,this.print_token(n),this._output.space_before_token=!0;return}}if(N){this.allow_wrap_or_preserved_newline(n),Y=!1;var oe=this._tokens.peek();J=oe&&f(oe.type,[_.WORD,_.RESERVED])}else if(n.text==="...")this.allow_wrap_or_preserved_newline(n),Y=this._flags.last_token.type===_.START_BLOCK,J=!1;else if(f(n.text,["--","++","!","~"])||U){if((this._flags.last_token.type===_.COMMA||this._flags.last_token.type===_.START_EXPR)&&this.allow_wrap_or_preserved_newline(n),Y=!1,J=!1,n.newlines&&(n.text==="--"||n.text==="++"||n.text==="~")){var ae=x(this._flags.last_token,I)&&n.newlines;ae&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(ae,!0)}this._flags.last_token.text===";"&&v(this._flags.mode)&&(Y=!0),this._flags.last_token.type===_.RESERVED?Y=!0:this._flags.last_token.type===_.END_EXPR?Y=!(this._flags.last_token.text==="]"&&(n.text==="--"||n.text==="++")):this._flags.last_token.type===_.OPERATOR&&(Y=f(n.text,["--","-","++","+"])&&f(this._flags.last_token.text,["--","-","++","+"]),f(n.text,["+","-"])&&f(this._flags.last_token.text,["--","++"])&&(J=!0)),(this._flags.mode===S.BlockStatement&&!this._flags.inline_frame||this._flags.mode===S.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Y,this.print_token(n),this._output.space_before_token=J},T.prototype.handle_block_comment=function(n,N){if(this._output.raw){this._output.add_raw_token(n),n.directives&&n.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(n.directives){this.print_newline(!1,N),this.print_token(n),n.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!p.newline.test(n.text)&&!n.newlines){this._output.space_before_token=!0,this.print_token(n),this._output.space_before_token=!0;return}else this.print_block_commment(n,N)},T.prototype.print_block_commment=function(n,N){var U=c(n.text),j,Y=!1,J=!1,ee=n.whitespace_before,ie=ee.length;if(this.print_newline(!1,N),this.print_token_line_indentation(n),this._output.add_token(U[0]),this.print_newline(!1,N),U.length>1){for(U=U.slice(1),Y=l(U,"*"),J=a(U,ee),Y&&(this._flags.alignment=1),j=0;j<U.length;j++)Y?(this.print_token_line_indentation(n),this._output.add_token(O(U[j]))):J&&U[j]?(this.print_token_line_indentation(n),this._output.add_token(U[j].substring(ie))):(this._output.current_line.set_indent(-1),this._output.add_token(U[j])),this.print_newline(!1,N);this._flags.alignment=0}},T.prototype.handle_comment=function(n,N){n.newlines?this.print_newline(!1,N):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(n),this.print_newline(!1,N)},T.prototype.handle_dot=function(n){this.start_of_statement(n)||this.handle_whitespace_and_comments(n,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),x(this._flags.last_token,I)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(n,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(n)},T.prototype.handle_unknown=function(n,N){this.print_token(n),n.text[n.text.length-1]===`
|
|
`&&this.print_newline(!1,N)},T.prototype.handle_eof=function(n){for(;this._flags.mode===S.Statement;)this.restore_mode();this.handle_whitespace_and_comments(n)},r.exports.Beautifier=T},function(r){function H(g){this.__parent=g,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 g=new H(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},H.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},H.prototype.has_match=function(g){for(var p=this.__items.length-1;p>=0;p--)if(this.__items[p].match(g))return!0;return!1},H.prototype.set_indent=function(g,p){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=p||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 g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__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(g){this.__items.push(g);var p=g.lastIndexOf(`
|
|
`);p!==-1?this.__character_count=g.length-p:this.__character_count+=g.length},H.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},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 g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function D(g,p){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),p=p||"",g.indent_level>0&&(p=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=p,this.__base_string_length=p.length}D.prototype.get_indent_size=function(g,p){var u=this.__base_string_length;return p=p||0,g<0&&(u=0),u+=g*this.__indent_size,u+=p,u},D.prototype.get_indent_string=function(g,p){var u=this.__base_string;return p=p||0,g<0&&(g=0,u=""),p+=g*this.__indent_size,this.__ensure_cache(p),u+=this.__cache[p],u},D.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},D.prototype.__add_column=function(){var g=this.__cache.length,p=0,u="";this.__indent_size&&g>=this.__indent_size&&(p=Math.floor(g/this.__indent_size),g-=p*this.__indent_size,u=new Array(p+1).join(this.__indent_string)),g&&(u+=new Array(g+1).join(" ")),this.__cache.push(u)};function M(g,p){this.__indent_cache=new D(g,p),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.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()}M.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},M.prototype.get_line_number=function(){return this.__lines.length},M.prototype.get_indent_string=function(g,p){return this.__indent_cache.get_indent_string(g,p)},M.prototype.get_indent_size=function(g,p){return this.__indent_cache.get_indent_size(g,p)},M.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},M.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},M.prototype.get_code=function(g){this.trim(!0);var p=this.current_line.pop();p&&(p[p.length-1]===`
|
|
`&&(p=p.replace(/\n+$/g,"")),this.current_line.push(p)),this._end_with_newline&&this.__add_outputline();var u=this.__lines.join(`
|
|
`);return g!==`
|
|
`&&(u=u.replace(/[\n]/g,g)),u},M.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},M.prototype.set_indent=function(g,p){return g=g||0,p=p||0,this.next_line.set_indent(g,p),this.__lines.length>1?(this.current_line.set_indent(g,p),!0):(this.current_line.set_indent(),!1)},M.prototype.add_raw_token=function(g){for(var p=0;p<g.newlines;p++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},M.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},M.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(" "))},M.prototype.remove_indent=function(g){for(var p=this.__lines.length;g<p;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},M.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&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},M.prototype.just_added_newline=function(){return this.current_line.is_empty()},M.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},M.prototype.ensure_empty_line_above=function(g,p){for(var u=this.__lines.length-2;u>=0;){var m=this.__lines[u];if(m.is_empty())break;if(m.item(0).indexOf(g)!==0&&m.item(-1)!==p){this.__lines.splice(u+1,0,new H(this)),this.previous_line=this.__lines[this.__lines.length-2];break}u--}},r.exports.Output=M},function(r){function H(D,M,g,p){this.type=D,this.text=M,this.comments_before=null,this.newlines=g||0,this.whitespace_before=p||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}r.exports.Token=H},function(r,H){var D="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",M="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",g="\\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",p="\\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",u="(?:\\\\u[0-9a-fA-F]{4}|["+D+g+"])",m="(?:\\\\u[0-9a-fA-F]{4}|["+M+g+p+"])*";H.identifier=new RegExp(u+m,"g"),H.identifierStart=new RegExp(u),H.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+M+g+p+"])+");var b=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;H.newline=/[\n\r\u2028\u2029]/,H.lineBreak=new RegExp(`\r
|
|
|`+H.newline.source),H.allLineBreaks=new RegExp(H.lineBreak.source,"g")},function(r,H,D){var M=D(6).Options,g=["before-newline","after-newline","preserve-newline"];function p(u){M.call(this,u,"js");var m=this.raw_options.brace_style||null;m==="expand-strict"?this.raw_options.brace_style="expand":m==="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 b=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var E=0;E<b.length;E++)b[E]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=b[E];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",g),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}p.prototype=new M,r.exports.Options=p},function(r){function H(g,p){this.raw_options=D(g,p),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(g,p){var u=this.raw_options[g],m=p||[];return typeof u=="object"?u!==null&&typeof u.concat=="function"&&(m=u.concat()):typeof u=="string"&&(m=u.split(/[^a-zA-Z0-9_\/\-]+/)),m},H.prototype._get_boolean=function(g,p){var u=this.raw_options[g],m=u===void 0?!!p:!!u;return m},H.prototype._get_characters=function(g,p){var u=this.raw_options[g],m=p||"";return typeof u=="string"&&(m=u.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),m},H.prototype._get_number=function(g,p){var u=this.raw_options[g];p=parseInt(p,10),isNaN(p)&&(p=0);var m=parseInt(u,10);return isNaN(m)&&(m=p),m},H.prototype._get_selection=function(g,p,u){var m=this._get_selection_list(g,p,u);if(m.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
|
|
`+p+`
|
|
You passed in: '`+this.raw_options[g]+"'");return m[0]},H.prototype._get_selection_list=function(g,p,u){if(!p||p.length===0)throw new Error("Selection list cannot be empty.");if(u=u||[p[0]],!this._is_valid_selection(u,p))throw new Error("Invalid Default Value!");var m=this._get_array(g,u);if(!this._is_valid_selection(m,p))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
|
|
`+p+`
|
|
You passed in: '`+this.raw_options[g]+"'");return m},H.prototype._is_valid_selection=function(g,p){return g.length&&p.length&&!g.some(function(u){return p.indexOf(u)===-1})};function D(g,p){var u={};g=M(g);var m;for(m in g)m!==p&&(u[m]=g[m]);if(p&&g[p])for(m in g[p])u[m]=g[p][m];return u}function M(g){var p={},u;for(u in g){var m=u.replace(/-/g,"_");p[m]=g[u]}return p}r.exports.Options=H,r.exports.normalizeOpts=M,r.exports.mergeOpts=D},function(r,H,D){var M=D(8).InputScanner,g=D(9).Tokenizer,p=D(9).TOKEN,u=D(13).Directives,m=D(4),b=D(12).Pattern,E=D(14).TemplatablePattern;function _(l,a){return a.indexOf(l)!==-1}var f={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:p.START,RAW:p.RAW,EOF:p.EOF},O=new u(/\/\*/,/\*\//),w=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,R=/[0-9]/,x=/[^\d\.]/,I=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),k=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";k=k.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),k="\\?\\.(?!\\d) "+k,k=k.replace(/ /g,"|");var A=new RegExp(k),P="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),S=P.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),C=new RegExp("^(?:"+S.join("|")+")$"),c,o=function(l,a){g.call(this,l,a),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var T=new b(this._input),h=new E(this._input).read_options(this._options);this.__patterns={template:h,identifier:h.starting_with(m.identifier).matching(m.identifierMatch),number:T.matching(w),punct:T.matching(A),comment:T.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:T.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:T.matching(/<!--/),html_comment_end:T.matching(/-->/),include:T.starting_with(/#include/).until_after(m.lineBreak),shebang:T.starting_with(/#!/).until_after(m.lineBreak),xml:T.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:h.until(/['\\\n\r\u2028\u2029]/),double_quote:h.until(/["\\\n\r\u2028\u2029]/),template_text:h.until(/[`\\$]/),template_expression:h.until(/[`}\\]/)}};o.prototype=new g,o.prototype._is_comment=function(l){return l.type===f.COMMENT||l.type===f.BLOCK_COMMENT||l.type===f.UNKNOWN},o.prototype._is_opening=function(l){return l.type===f.START_BLOCK||l.type===f.START_EXPR},o.prototype._is_closing=function(l,a){return(l.type===f.END_BLOCK||l.type===f.END_EXPR)&&a&&(l.text==="]"&&a.text==="["||l.text===")"&&a.text==="("||l.text==="}"&&a.text==="{")},o.prototype._reset=function(){c=!1},o.prototype._get_next_token=function(l,a){var T=null;this._readWhitespace();var h=this._input.peek();return h===null?this._create_token(f.EOF,""):(T=T||this._read_non_javascript(h),T=T||this._read_string(h),T=T||this._read_word(l),T=T||this._read_singles(h),T=T||this._read_comment(h),T=T||this._read_regexp(h,l),T=T||this._read_xml(h,l),T=T||this._read_punctuation(),T=T||this._create_token(f.UNKNOWN,this._input.next()),T)},o.prototype._read_word=function(l){var a;if(a=this.__patterns.identifier.read(),a!=="")return a=a.replace(m.allLineBreaks,`
|
|
`),!(l.type===f.DOT||l.type===f.RESERVED&&(l.text==="set"||l.text==="get"))&&C.test(a)?(a==="in"||a==="of")&&(l.type===f.WORD||l.type===f.STRING)?this._create_token(f.OPERATOR,a):this._create_token(f.RESERVED,a):this._create_token(f.WORD,a);if(a=this.__patterns.number.read(),a!=="")return this._create_token(f.WORD,a)},o.prototype._read_singles=function(l){var a=null;return l==="("||l==="["?a=this._create_token(f.START_EXPR,l):l===")"||l==="]"?a=this._create_token(f.END_EXPR,l):l==="{"?a=this._create_token(f.START_BLOCK,l):l==="}"?a=this._create_token(f.END_BLOCK,l):l===";"?a=this._create_token(f.SEMICOLON,l):l==="."&&x.test(this._input.peek(1))?a=this._create_token(f.DOT,l):l===","&&(a=this._create_token(f.COMMA,l)),a&&this._input.next(),a},o.prototype._read_punctuation=function(){var l=this.__patterns.punct.read();if(l!=="")return l==="="?this._create_token(f.EQUALS,l):l==="?."?this._create_token(f.DOT,l):this._create_token(f.OPERATOR,l)},o.prototype._read_non_javascript=function(l){var a="";if(l==="#"){if(this._is_first_token()&&(a=this.__patterns.shebang.read(),a))return this._create_token(f.UNKNOWN,a.trim()+`
|
|
`);if(a=this.__patterns.include.read(),a)return this._create_token(f.UNKNOWN,a.trim()+`
|
|
`);l=this._input.next();var T="#";if(this._input.hasNext()&&this._input.testChar(R)){do l=this._input.next(),T+=l;while(this._input.hasNext()&&l!=="#"&&l!=="=");return l==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(T+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(T+="{}",this._input.next(),this._input.next())),this._create_token(f.WORD,T)}this._input.back()}else if(l==="<"&&this._is_first_token()){if(a=this.__patterns.html_comment_start.read(),a){for(;this._input.hasNext()&&!this._input.testChar(m.newline);)a+=this._input.next();return c=!0,this._create_token(f.COMMENT,a)}}else if(c&&l==="-"&&(a=this.__patterns.html_comment_end.read(),a))return c=!1,this._create_token(f.COMMENT,a);return null},o.prototype._read_comment=function(l){var a=null;if(l==="/"){var T="";if(this._input.peek(1)==="*"){T=this.__patterns.block_comment.read();var h=O.get_directives(T);h&&h.ignore==="start"&&(T+=O.readIgnored(this._input)),T=T.replace(m.allLineBreaks,`
|
|
`),a=this._create_token(f.BLOCK_COMMENT,T),a.directives=h}else this._input.peek(1)==="/"&&(T=this.__patterns.comment.read(),a=this._create_token(f.COMMENT,T))}return a},o.prototype._read_string=function(l){if(l==="`"||l==="'"||l==='"'){var a=this._input.next();return this.has_char_escapes=!1,l==="`"?a+=this._read_string_recursive("`",!0,"${"):a+=this._read_string_recursive(l),this.has_char_escapes&&this._options.unescape_strings&&(a=v(a)),this._input.peek()===l&&(a+=this._input.next()),a=a.replace(m.allLineBreaks,`
|
|
`),this._create_token(f.STRING,a)}return null},o.prototype._allow_regexp_or_xml=function(l){return l.type===f.RESERVED&&_(l.text,["return","case","throw","else","do","typeof","yield"])||l.type===f.END_EXPR&&l.text===")"&&l.opened.previous.type===f.RESERVED&&_(l.opened.previous.text,["if","while","for"])||_(l.type,[f.COMMENT,f.START_EXPR,f.START_BLOCK,f.START,f.END_BLOCK,f.OPERATOR,f.EQUALS,f.EOF,f.SEMICOLON,f.COMMA])},o.prototype._read_regexp=function(l,a){if(l==="/"&&this._allow_regexp_or_xml(a)){for(var T=this._input.next(),h=!1,n=!1;this._input.hasNext()&&(h||n||this._input.peek()!==l)&&!this._input.testChar(m.newline);)T+=this._input.peek(),h?h=!1:(h=this._input.peek()==="\\",this._input.peek()==="["?n=!0:this._input.peek()==="]"&&(n=!1)),this._input.next();return this._input.peek()===l&&(T+=this._input.next(),T+=this._input.read(m.identifier)),this._create_token(f.STRING,T)}return null},o.prototype._read_xml=function(l,a){if(this._options.e4x&&l==="<"&&this._allow_regexp_or_xml(a)){var T="",h=this.__patterns.xml.read_match();if(h){for(var n=h[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),N=n.indexOf("{")===0,U=0;h;){var j=!!h[1],Y=h[2],J=!!h[h.length-1]||Y.slice(0,8)==="![CDATA[";if(!J&&(Y===n||N&&Y.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(j?--U:++U),T+=h[0],U<=0)break;h=this.__patterns.xml.read_match()}return h||(T+=this._input.match(/[\s\S]*/g)[0]),T=T.replace(m.allLineBreaks,`
|
|
`),this._create_token(f.STRING,T)}}return null};function v(l){for(var a="",T=0,h=new M(l),n=null;h.hasNext();)if(n=h.match(/([\s]|[^\\]|\\\\)+/g),n&&(a+=n[0]),h.peek()==="\\"){if(h.next(),h.peek()==="x")n=h.match(/x([0-9A-Fa-f]{2})/g);else if(h.peek()==="u")n=h.match(/u([0-9A-Fa-f]{4})/g);else{a+="\\",h.hasNext()&&(a+=h.next());continue}if(!n)return l;if(T=parseInt(n[1],16),T>126&&T<=255&&n[0].indexOf("x")===0)return l;if(T>=0&&T<32){a+="\\"+n[0];continue}else T===34||T===39||T===92?a+="\\"+String.fromCharCode(T):a+=String.fromCharCode(T)}return a}o.prototype._read_string_recursive=function(l,a,T){var h,n;l==="'"?n=this.__patterns.single_quote:l==='"'?n=this.__patterns.double_quote:l==="`"?n=this.__patterns.template_text:l==="}"&&(n=this.__patterns.template_expression);for(var N=n.read(),U="";this._input.hasNext();){if(U=this._input.next(),U===l||!a&&m.newline.test(U)){this._input.back();break}else U==="\\"&&this._input.hasNext()?(h=this._input.peek(),h==="x"||h==="u"?this.has_char_escapes=!0:h==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),U+=this._input.next()):T&&(T==="${"&&U==="$"&&this._input.peek()==="{"&&(U+=this._input.next()),T===U&&(l==="`"?U+=this._read_string_recursive("}",a,"`"):U+=this._read_string_recursive("`",a,"${"),this._input.hasNext()&&(U+=this._input.next())));U+=n.read(),N+=U}return N},r.exports.Tokenizer=o,r.exports.TOKEN=f,r.exports.positionable_operators=I.slice(),r.exports.line_starters=P.slice()},function(r){var H=RegExp.prototype.hasOwnProperty("sticky");function D(M){this.__input=M||"",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 M=null;return this.hasNext()&&(M=this.__input.charAt(this.__position),this.__position+=1),M},D.prototype.peek=function(M){var g=null;return M=M||0,M+=this.__position,M>=0&&M<this.__input_length&&(g=this.__input.charAt(M)),g},D.prototype.__match=function(M,g){M.lastIndex=g;var p=M.exec(this.__input);return p&&!(H&&M.sticky)&&(p.index!==g&&(p=null)),p},D.prototype.test=function(M,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(M,g):!1},D.prototype.testChar=function(M,g){var p=this.peek(g);return M.lastIndex=0,p!==null&&M.test(p)},D.prototype.match=function(M){var g=this.__match(M,this.__position);return g?this.__position+=g[0].length:g=null,g},D.prototype.read=function(M,g,p){var u="",m;return M&&(m=this.match(M),m&&(u+=m[0])),g&&(m||!M)&&(u+=this.readUntil(g,p)),u},D.prototype.readUntil=function(M,g){var p="",u=this.__position;M.lastIndex=this.__position;var m=M.exec(this.__input);return m?(u=m.index,g&&(u+=m[0].length)):u=this.__input_length,p=this.__input.substring(this.__position,u),this.__position=u,p},D.prototype.readUntilAfter=function(M){return this.readUntil(M,!0)},D.prototype.get_regexp=function(M,g){var p=null,u="g";return g&&H&&(u="y"),typeof M=="string"&&M!==""?p=new RegExp(M,u):M&&(p=new RegExp(M.source,u)),p},D.prototype.get_literal_regexp=function(M){return RegExp(M.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},D.prototype.peekUntilAfter=function(M){var g=this.__position,p=this.readUntilAfter(M);return this.__position=g,p},D.prototype.lookBack=function(M){var g=this.__position-1;return g>=M.length&&this.__input.substring(g-M.length,g).toLowerCase()===M},r.exports.InputScanner=D},function(r,H,D){var M=D(8).InputScanner,g=D(3).Token,p=D(10).TokenStream,u=D(11).WhitespacePattern,m={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},b=function(E,_){this._input=new M(E),this._options=_||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new u(this._input)};b.prototype.tokenize=function(){this._input.restart(),this.__tokens=new p,this._reset();for(var E,_=new g(m.START,""),f=null,O=[],w=new p;_.type!==m.EOF;){for(E=this._get_next_token(_,f);this._is_comment(E);)w.add(E),E=this._get_next_token(_,f);w.isEmpty()||(E.comments_before=w,w=new p),E.parent=f,this._is_opening(E)?(O.push(f),f=E):f&&this._is_closing(E,f)&&(E.opened=f,f.closed=E,f=O.pop(),E.parent=f),E.previous=_,_.next=E,this.__tokens.add(E),_=E}return this.__tokens},b.prototype._is_first_token=function(){return this.__tokens.isEmpty()},b.prototype._reset=function(){},b.prototype._get_next_token=function(E,_){this._readWhitespace();var f=this._input.read(/.+/g);return f?this._create_token(m.RAW,f):this._create_token(m.EOF,"")},b.prototype._is_comment=function(E){return!1},b.prototype._is_opening=function(E){return!1},b.prototype._is_closing=function(E,_){return!1},b.prototype._create_token=function(E,_){var f=new g(E,_,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return f},b.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},r.exports.Tokenizer=b,r.exports.TOKEN=m},function(r){function H(D){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=D}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 D=null;return this.hasNext()&&(D=this.__tokens[this.__position],this.__position+=1),D},H.prototype.peek=function(D){var M=null;return D=D||0,D+=this.__position,D>=0&&D<this.__tokens_length&&(M=this.__tokens[D]),M},H.prototype.add=function(D){this.__parent_token&&(D.parent=this.__parent_token),this.__tokens.push(D),this.__tokens_length+=1},r.exports.TokenStream=H},function(r,H,D){var M=D(12).Pattern;function g(p,u){M.call(this,p,u),u?this._line_regexp=this._input.get_regexp(u._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}g.prototype=new M,g.prototype.__set_whitespace_patterns=function(p,u){p+="\\t ",u+="\\n\\r",this._match_pattern=this._input.get_regexp("["+p+u+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+u+"]")},g.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var p=this._input.read(this._match_pattern);if(p===" ")this.whitespace_before_token=" ";else if(p){var u=this.__split(this._newline_regexp,p);this.newline_count=u.length-1,this.whitespace_before_token=u[this.newline_count]}return p},g.prototype.matching=function(p,u){var m=this._create();return m.__set_whitespace_patterns(p,u),m._update(),m},g.prototype._create=function(){return new g(this._input,this)},g.prototype.__split=function(p,u){p.lastIndex=0;for(var m=0,b=[],E=p.exec(u);E;)b.push(u.substring(m,E.index)),m=E.index+E[0].length,E=p.exec(u);return m<u.length?b.push(u.substring(m,u.length)):b.push(""),b},r.exports.WhitespacePattern=g},function(r){function H(D,M){this._input=D,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,M&&(this._starting_pattern=this._input.get_regexp(M._starting_pattern,!0),this._match_pattern=this._input.get_regexp(M._match_pattern,!0),this._until_pattern=this._input.get_regexp(M._until_pattern),this._until_after=M._until_after)}H.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},H.prototype.read_match=function(){return this._input.match(this._match_pattern)},H.prototype.until_after=function(D){var M=this._create();return M._until_after=!0,M._until_pattern=this._input.get_regexp(D),M._update(),M},H.prototype.until=function(D){var M=this._create();return M._until_after=!1,M._until_pattern=this._input.get_regexp(D),M._update(),M},H.prototype.starting_with=function(D){var M=this._create();return M._starting_pattern=this._input.get_regexp(D,!0),M._update(),M},H.prototype.matching=function(D){var M=this._create();return M._match_pattern=this._input.get_regexp(D,!0),M._update(),M},H.prototype._create=function(){return new H(this._input,this)},H.prototype._update=function(){},r.exports.Pattern=H},function(r){function H(D,M){D=typeof D=="string"?D:D.source,M=typeof M=="string"?M:M.source,this.__directives_block_pattern=new RegExp(D+/ beautify( \w+[:]\w+)+ /.source+M,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(D+/\sbeautify\signore:end\s/.source+M,"g")}H.prototype.get_directives=function(D){if(!D.match(this.__directives_block_pattern))return null;var M={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(D);g;)M[g[1]]=g[2],g=this.__directive_pattern.exec(D);return M},H.prototype.readIgnored=function(D){return D.readUntilAfter(this.__directives_end_ignore_pattern)},r.exports.Directives=H},function(r,H,D){var M=D(12).Pattern,g={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function p(u,m){M.call(this,u,m),this.__template_pattern=null,this._disabled=Object.assign({},g),this._excluded=Object.assign({},g),m&&(this.__template_pattern=this._input.get_regexp(m.__template_pattern),this._excluded=Object.assign(this._excluded,m._excluded),this._disabled=Object.assign(this._disabled,m._disabled));var b=new M(u);this.__patterns={handlebars_comment:b.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:b.starting_with(/{{{/).until_after(/}}}/),handlebars:b.starting_with(/{{/).until_after(/}}/),php:b.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:b.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:b.starting_with(/{%/).until_after(/%}/),django_value:b.starting_with(/{{/).until_after(/}}/),django_comment:b.starting_with(/{#/).until_after(/#}/),smarty:b.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:b.starting_with(/{\*/).until_after(/\*}/),smarty_literal:b.starting_with(/{literal}/).until_after(/{\/literal}/)}}p.prototype=new M,p.prototype._create=function(){return new p(this._input,this)},p.prototype._update=function(){this.__set_templated_pattern()},p.prototype.disable=function(u){var m=this._create();return m._disabled[u]=!0,m._update(),m},p.prototype.read_options=function(u){var m=this._create();for(var b in g)m._disabled[b]=u.templating.indexOf(b)===-1;return m._update(),m},p.prototype.exclude=function(u){var m=this._create();return m._excluded[u]=!0,m._update(),m},p.prototype.read=function(){var u="";this._match_pattern?u=this._input.read(this._starting_pattern):u=this._input.read(this._starting_pattern,this.__template_pattern);for(var m=this._read_template();m;)this._match_pattern?m+=this._input.read(this._match_pattern):m+=this._input.readUntil(this.__template_pattern),u+=m,m=this._read_template();return this._until_after&&(u+=this._input.readUntilAfter(this._until_pattern)),u},p.prototype.__set_templated_pattern=function(){var u=[];this._disabled.php||u.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||u.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||u.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(u.push(this.__patterns.django._starting_pattern.source),u.push(this.__patterns.django_value._starting_pattern.source),u.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||u.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&u.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+u.join("|")+")")},p.prototype._read_template=function(){var u="",m=this._input.peek();if(m==="<"){var b=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&b==="?"&&(u=u||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&b==="%"&&(u=u||this.__patterns.erb.read())}else m==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(u=u||this.__patterns.handlebars_comment.read(),u=u||this.__patterns.handlebars_unescaped.read(),u=u||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(u=u||this.__patterns.django_value.read()),this._excluded.django||(u=u||this.__patterns.django_comment.read(),u=u||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(u=u||this.__patterns.smarty_comment.read(),u=u||this.__patterns.smarty_literal.read(),u=u||this.__patterns.smarty.read()));return u},r.exports.TemplatablePattern=p}],X={};function F(r){var H=X[r];if(H!==void 0)return H.exports;var D=X[r]={exports:{}};return le[r](D,D.exports,F),D.exports}var W=F(0);ce=W})();var ye=ce;!(se=[],Se=function(){return{js_beautify:ye}}.apply(ve,se),Se!==void 0&&(at.exports=Se))})()},"746U":function(at,ve,Z){"use strict";Z.d(ve,"f",function(){return se}),Z.d(ve,"l",function(){return Se}),Z.d(ve,"k",function(){return ce}),Z.d(ve,"j",function(){return ye}),Z.d(ve,"g",function(){return le}),Z.d(ve,"m",function(){return X}),Z.d(ve,"h",function(){return F}),Z.d(ve,"n",function(){return W}),Z.d(ve,"c",function(){return r}),Z.d(ve,"a",function(){return H}),Z.d(ve,"i",function(){return D}),Z.d(ve,"o",function(){return M}),Z.d(ve,"e",function(){return u}),Z.d(ve,"d",function(){return m}),Z.d(ve,"p",function(){return b}),Z.d(ve,"b",function(){return E});function se(_){return Array.isArray(_)}function Se(_){return typeof _=="string"}function ce(_){return typeof _=="object"&&_!==null&&!Array.isArray(_)&&!(_ instanceof RegExp)&&!(_ instanceof Date)}function ye(_){return typeof _=="number"&&!isNaN(_)}function le(_){return _===!0||_===!1}function X(_){return typeof _=="undefined"}function F(_){return!W(_)}function W(_){return X(_)||_===null}function r(_,f){if(!_)throw new Error(f?`Unexpected type, expected '${f}'`:"Unexpected type")}function H(_){if(W(_))throw new Error("Assertion Failed: argument is undefined or null");return _}function D(_){return typeof _=="function"}function M(_,f){const O=Math.min(_.length,f.length);for(let w=0;w<O;w++)g(_[w],f[w])}function g(_,f){if(Se(f)){if(typeof _!==f)throw new Error(`argument does not match constraint: typeof ${f}`)}else if(D(f)){try{if(_ instanceof f)return}catch(O){}if(!W(_)&&_.constructor===f)return;if(f.length===1&&f.call(void 0,_)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function p(_){let f=[],O=Object.getPrototypeOf(_);for(;Object.prototype!==O;)f=f.concat(Object.getOwnPropertyNames(O)),O=Object.getPrototypeOf(O);return f}function u(_){const f=[];for(const O of p(_))typeof _[O]=="function"&&f.push(O);return f}function m(_,f){const O=R=>function(){const x=Array.prototype.slice.call(arguments,0);return f(R,x)};let w={};for(const R of _)w[R]=O(R);return w}function b(_){return _===null?void 0:_}function E(_,f="Unreachable"){throw new Error(f)}},"7Cbv":function(at,ve,Z){"use strict";var se=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Se=new Uint8Array(16);function ce(){if(!se)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return se(Se)}var ye=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function le(g){return typeof g=="string"&&ye.test(g)}for(var X=le,F=[],W=0;W<256;++W)F.push((W+256).toString(16).substr(1));function r(g){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,u=(F[g[p+0]]+F[g[p+1]]+F[g[p+2]]+F[g[p+3]]+"-"+F[g[p+4]]+F[g[p+5]]+"-"+F[g[p+6]]+F[g[p+7]]+"-"+F[g[p+8]]+F[g[p+9]]+"-"+F[g[p+10]]+F[g[p+11]]+F[g[p+12]]+F[g[p+13]]+F[g[p+14]]+F[g[p+15]]).toLowerCase();if(!X(u))throw TypeError("Stringified UUID is invalid");return u}var H=r;function D(g,p,u){g=g||{};var m=g.random||(g.rng||ce)();if(m[6]=m[6]&15|64,m[8]=m[8]&63|128,p){u=u||0;for(var b=0;b<16;++b)p[u+b]=m[b];return p}return H(m)}var M=ve.a=D},"7O0G":function(at,ve,Z){(function(se,Se){at.exports=Se()})(this,function(){"use strict";function se(Ce,_e){for(var Te=0;Te<_e.length;Te++){var ne=_e[Te];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(Ce,ne.key,ne)}}function Se(Ce,_e,Te){return _e&&se(Ce.prototype,_e),Te&&se(Ce,Te),Ce}function ce(Ce,_e){if(!Ce)return;if(typeof Ce=="string")return ye(Ce,_e);var Te=Object.prototype.toString.call(Ce).slice(8,-1);if(Te==="Object"&&Ce.constructor&&(Te=Ce.constructor.name),Te==="Map"||Te==="Set")return Array.from(Ce);if(Te==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Te))return ye(Ce,_e)}function ye(Ce,_e){(_e==null||_e>Ce.length)&&(_e=Ce.length);for(var Te=0,ne=new Array(_e);Te<_e;Te++)ne[Te]=Ce[Te];return ne}function le(Ce,_e){var Te;if(typeof Symbol=="undefined"||Ce[Symbol.iterator]==null){if(Array.isArray(Ce)||(Te=ce(Ce))||_e&&Ce&&typeof Ce.length=="number"){Te&&(Ce=Te);var ne=0;return function(){return ne>=Ce.length?{done:!0}:{done:!1,value:Ce[ne++]}}}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 Te=Ce[Symbol.iterator](),Te.next.bind(Te)}function X(Ce,_e){return _e={exports:{}},Ce(_e,_e.exports),_e.exports}var F=X(function(Ce){function _e(){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 Te(ne){Ce.exports.defaults=ne}Ce.exports={defaults:_e(),getDefaults:_e,changeDefaults:Te}}),W=F.defaults,r=F.getDefaults,H=F.changeDefaults,D=/[&<>"']/,M=/[&<>"']/g,g=/[<>"']|&(?!#?\w+;)/,p=/[<>"']|&(?!#?\w+;)/g,u={"&":"&","<":"<",">":">",'"':""","'":"'"},m=function(_e){return u[_e]};function b(Ce,_e){if(_e){if(D.test(Ce))return Ce.replace(M,m)}else if(g.test(Ce))return Ce.replace(p,m);return Ce}var E=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function _(Ce){return Ce.replace(E,function(_e,Te){return Te=Te.toLowerCase(),Te==="colon"?":":Te.charAt(0)==="#"?Te.charAt(1)==="x"?String.fromCharCode(parseInt(Te.substring(2),16)):String.fromCharCode(+Te.substring(1)):""})}var f=/(^|[^\[])\^/g;function O(Ce,_e){Ce=Ce.source||Ce,_e=_e||"";var Te={replace:function(ue,fe){return fe=fe.source||fe,fe=fe.replace(f,"$1"),Ce=Ce.replace(ue,fe),Te},getRegex:function(){return new RegExp(Ce,_e)}};return Te}var w=/[^\w:]/g,R=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function x(Ce,_e,Te){if(Ce){var ne;try{ne=decodeURIComponent(_(Te)).replace(w,"").toLowerCase()}catch(ue){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}_e&&!R.test(Te)&&(Te=S(_e,Te));try{Te=encodeURI(Te).replace(/%25/g,"%")}catch(ue){return null}return Te}var I={},k=/^[^:]+:\/*[^/]*$/,A=/^([^:]+:)[\s\S]*$/,P=/^([^:]+:\/*[^/]*)[\s\S]*$/;function S(Ce,_e){I[" "+Ce]||(k.test(Ce)?I[" "+Ce]=Ce+"/":I[" "+Ce]=v(Ce,"/",!0)),Ce=I[" "+Ce];var Te=Ce.indexOf(":")===-1;return _e.substring(0,2)==="//"?Te?_e:Ce.replace(A,"$1")+_e:_e.charAt(0)==="/"?Te?_e:Ce.replace(P,"$1")+_e:Ce+_e}var C={exec:function(){}};function c(Ce){for(var _e=1,Te,ne;_e<arguments.length;_e++){Te=arguments[_e];for(ne in Te)Object.prototype.hasOwnProperty.call(Te,ne)&&(Ce[ne]=Te[ne])}return Ce}function o(Ce,_e){var Te=Ce.replace(/\|/g,function(fe,me,we){for(var Me=!1,je=me;--je>=0&&we[je]==="\\";)Me=!Me;return Me?"|":" |"}),ne=Te.split(/ \|/),ue=0;if(ne.length>_e)ne.splice(_e);else for(;ne.length<_e;)ne.push("");for(;ue<ne.length;ue++)ne[ue]=ne[ue].trim().replace(/\\\|/g,"|");return ne}function v(Ce,_e,Te){var ne=Ce.length;if(ne===0)return"";for(var ue=0;ue<ne;){var fe=Ce.charAt(ne-ue-1);if(fe===_e&&!Te)ue++;else if(fe!==_e&&Te)ue++;else break}return Ce.substr(0,ne-ue)}function l(Ce,_e){if(Ce.indexOf(_e[1])===-1)return-1;for(var Te=Ce.length,ne=0,ue=0;ue<Te;ue++)if(Ce[ue]==="\\")ue++;else if(Ce[ue]===_e[0])ne++;else if(Ce[ue]===_e[1]&&(ne--,ne<0))return ue;return-1}function a(Ce){Ce&&Ce.sanitize&&!Ce.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 T={escape:b,unescape:_,edit:O,cleanUrl:x,resolveUrl:S,noopTest:C,merge:c,splitCells:o,rtrim:v,findClosingBracket:l,checkSanitizeDeprecation:a},h=F.defaults,n=T.rtrim,N=T.splitCells,U=T.escape,j=T.findClosingBracket;function Y(Ce,_e,Te){var ne=_e.href,ue=_e.title?U(_e.title):null,fe=Ce[1].replace(/\\([\[\]])/g,"$1");return Ce[0].charAt(0)!=="!"?{type:"link",raw:Te,href:ne,title:ue,text:fe}:{type:"image",raw:Te,href:ne,title:ue,text:U(fe)}}function J(Ce,_e){var Te=Ce.match(/^(\s+)(?:```)/);if(Te===null)return _e;var ne=Te[1];return _e.split(`
|
|
`).map(function(ue){var fe=ue.match(/^\s+/);if(fe===null)return ue;var me=fe[0];return me.length>=ne.length?ue.slice(ne.length):ue}).join(`
|
|
`)}var ee=function(){function Ce(Te){this.options=Te||h}var _e=Ce.prototype;return _e.space=function(ne){var ue=this.rules.block.newline.exec(ne);if(ue)return ue[0].length>1?{type:"space",raw:ue[0]}:{raw:`
|
|
`}},_e.code=function(ne,ue){var fe=this.rules.block.code.exec(ne);if(fe){var me=ue[ue.length-1];if(me&&me.type==="paragraph")return{raw:fe[0],text:fe[0].trimRight()};var we=fe[0].replace(/^ {4}/gm,"");return{type:"code",raw:fe[0],codeBlockStyle:"indented",text:this.options.pedantic?we:n(we,`
|
|
`)}}},_e.fences=function(ne){var ue=this.rules.block.fences.exec(ne);if(ue){var fe=ue[0],me=J(fe,ue[3]||"");return{type:"code",raw:fe,lang:ue[2]?ue[2].trim():ue[2],text:me}}},_e.heading=function(ne){var ue=this.rules.block.heading.exec(ne);if(ue)return{type:"heading",raw:ue[0],depth:ue[1].length,text:ue[2]}},_e.nptable=function(ne){var ue=this.rules.block.nptable.exec(ne);if(ue){var fe={type:"table",header:N(ue[1].replace(/^ *| *\| *$/g,"")),align:ue[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ue[3]?ue[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ue[0]};if(fe.header.length===fe.align.length){var me=fe.align.length,we;for(we=0;we<me;we++)/^ *-+: *$/.test(fe.align[we])?fe.align[we]="right":/^ *:-+: *$/.test(fe.align[we])?fe.align[we]="center":/^ *:-+ *$/.test(fe.align[we])?fe.align[we]="left":fe.align[we]=null;for(me=fe.cells.length,we=0;we<me;we++)fe.cells[we]=N(fe.cells[we],fe.header.length);return fe}}},_e.hr=function(ne){var ue=this.rules.block.hr.exec(ne);if(ue)return{type:"hr",raw:ue[0]}},_e.blockquote=function(ne){var ue=this.rules.block.blockquote.exec(ne);if(ue){var fe=ue[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ue[0],text:fe}}},_e.list=function(ne){var ue=this.rules.block.list.exec(ne);if(ue){for(var fe=ue[0],me=ue[2],we=me.length>1,Me=me[me.length-1]===")",je={type:"list",raw:fe,ordered:we,start:we?+me.slice(0,-1):"",loose:!1,items:[]},qe=ue[0].match(this.rules.block.item),ct=!1,et,kt,Ct,pt,Nt,Et,wt,Ht=qe.length,It=0;It<Ht;It++)et=qe[It],fe=et,kt=et.length,et=et.replace(/^ *([*+-]|\d+[.)]) */,""),~et.indexOf(`
|
|
`)&&(kt-=et.length,et=this.options.pedantic?et.replace(/^ {1,4}/gm,""):et.replace(new RegExp("^ {1,"+kt+"}","gm"),"")),It!==Ht-1&&(Ct=this.rules.block.bullet.exec(qe[It+1])[0],(we?Ct.length===1||!Me&&Ct[Ct.length-1]===")":Ct.length>1||this.options.smartLists&&Ct!==me)&&(pt=qe.slice(It+1).join(`
|
|
`),je.raw=je.raw.substring(0,je.raw.length-pt.length),It=Ht-1)),Nt=ct||/\n\n(?!\s*$)/.test(et),It!==Ht-1&&(ct=et.charAt(et.length-1)===`
|
|
`,Nt||(Nt=ct)),Nt&&(je.loose=!0),Et=/^\[[ xX]\] /.test(et),wt=void 0,Et&&(wt=et[1]!==" ",et=et.replace(/^\[[ xX]\] +/,"")),je.items.push({type:"list_item",raw:fe,task:Et,checked:wt,loose:Nt,text:et});return je}},_e.html=function(ne){var ue=this.rules.block.html.exec(ne);if(ue)return{type:this.options.sanitize?"paragraph":"html",raw:ue[0],pre:!this.options.sanitizer&&(ue[1]==="pre"||ue[1]==="script"||ue[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):U(ue[0]):ue[0]}},_e.def=function(ne){var ue=this.rules.block.def.exec(ne);if(ue){ue[3]&&(ue[3]=ue[3].substring(1,ue[3].length-1));var fe=ue[1].toLowerCase().replace(/\s+/g," ");return{tag:fe,raw:ue[0],href:ue[2],title:ue[3]}}},_e.table=function(ne){var ue=this.rules.block.table.exec(ne);if(ue){var fe={type:"table",header:N(ue[1].replace(/^ *| *\| *$/g,"")),align:ue[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ue[3]?ue[3].replace(/\n$/,"").split(`
|
|
`):[]};if(fe.header.length===fe.align.length){fe.raw=ue[0];var me=fe.align.length,we;for(we=0;we<me;we++)/^ *-+: *$/.test(fe.align[we])?fe.align[we]="right":/^ *:-+: *$/.test(fe.align[we])?fe.align[we]="center":/^ *:-+ *$/.test(fe.align[we])?fe.align[we]="left":fe.align[we]=null;for(me=fe.cells.length,we=0;we<me;we++)fe.cells[we]=N(fe.cells[we].replace(/^ *\| *| *\| *$/g,""),fe.header.length);return fe}}},_e.lheading=function(ne){var ue=this.rules.block.lheading.exec(ne);if(ue)return{type:"heading",raw:ue[0],depth:ue[2].charAt(0)==="="?1:2,text:ue[1]}},_e.paragraph=function(ne){var ue=this.rules.block.paragraph.exec(ne);if(ue)return{type:"paragraph",raw:ue[0],text:ue[1].charAt(ue[1].length-1)===`
|
|
`?ue[1].slice(0,-1):ue[1]}},_e.text=function(ne,ue){var fe=this.rules.block.text.exec(ne);if(fe){var me=ue[ue.length-1];return me&&me.type==="text"?{raw:fe[0],text:fe[0]}:{type:"text",raw:fe[0],text:fe[0]}}},_e.escape=function(ne){var ue=this.rules.inline.escape.exec(ne);if(ue)return{type:"escape",raw:ue[0],text:U(ue[1])}},_e.tag=function(ne,ue,fe){var me=this.rules.inline.tag.exec(ne);if(me)return!ue&&/^<a /i.test(me[0])?ue=!0:ue&&/^<\/a>/i.test(me[0])&&(ue=!1),!fe&&/^<(pre|code|kbd|script)(\s|>)/i.test(me[0])?fe=!0:fe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(me[0])&&(fe=!1),{type:this.options.sanitize?"text":"html",raw:me[0],inLink:ue,inRawBlock:fe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):U(me[0]):me[0]}},_e.link=function(ne){var ue=this.rules.inline.link.exec(ne);if(ue){var fe=j(ue[2],"()");if(fe>-1){var me=ue[0].indexOf("!")===0?5:4,we=me+ue[1].length+fe;ue[2]=ue[2].substring(0,fe),ue[0]=ue[0].substring(0,we).trim(),ue[3]=""}var Me=ue[2],je="";if(this.options.pedantic){var qe=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Me);qe?(Me=qe[1],je=qe[3]):je=""}else je=ue[3]?ue[3].slice(1,-1):"";Me=Me.trim().replace(/^<([\s\S]*)>$/,"$1");var ct=Y(ue,{href:Me&&Me.replace(this.rules.inline._escapes,"$1"),title:je&&je.replace(this.rules.inline._escapes,"$1")},ue[0]);return ct}},_e.reflink=function(ne,ue){var fe;if((fe=this.rules.inline.reflink.exec(ne))||(fe=this.rules.inline.nolink.exec(ne))){var me=(fe[2]||fe[1]).replace(/\s+/g," ");if(me=ue[me.toLowerCase()],!me||!me.href){var we=fe[0].charAt(0);return{type:"text",raw:we,text:we}}var Me=Y(fe,me,fe[0]);return Me}},_e.strong=function(ne,ue,fe){fe===void 0&&(fe="");var me=this.rules.inline.strong.start.exec(ne);if(me&&(!me[1]||me[1]&&(fe===""||this.rules.inline.punctuation.exec(fe)))){ue=ue.slice(-1*ne.length);var we=me[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;we.lastIndex=0;for(var Me;(me=we.exec(ue))!=null;)if(Me=this.rules.inline.strong.middle.exec(ue.slice(0,me.index+3)),Me)return{type:"strong",raw:ne.slice(0,Me[0].length),text:ne.slice(2,Me[0].length-2)}}},_e.em=function(ne,ue,fe){fe===void 0&&(fe="");var me=this.rules.inline.em.start.exec(ne);if(me&&(!me[1]||me[1]&&(fe===""||this.rules.inline.punctuation.exec(fe)))){ue=ue.slice(-1*ne.length);var we=me[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;we.lastIndex=0;for(var Me;(me=we.exec(ue))!=null;)if(Me=this.rules.inline.em.middle.exec(ue.slice(0,me.index+2)),Me)return{type:"em",raw:ne.slice(0,Me[0].length),text:ne.slice(1,Me[0].length-1)}}},_e.codespan=function(ne){var ue=this.rules.inline.code.exec(ne);if(ue){var fe=ue[2].replace(/\n/g," "),me=/[^ ]/.test(fe),we=fe.startsWith(" ")&&fe.endsWith(" ");return me&&we&&(fe=fe.substring(1,fe.length-1)),fe=U(fe,!0),{type:"codespan",raw:ue[0],text:fe}}},_e.br=function(ne){var ue=this.rules.inline.br.exec(ne);if(ue)return{type:"br",raw:ue[0]}},_e.del=function(ne){var ue=this.rules.inline.del.exec(ne);if(ue)return{type:"del",raw:ue[0],text:ue[1]}},_e.autolink=function(ne,ue){var fe=this.rules.inline.autolink.exec(ne);if(fe){var me,we;return fe[2]==="@"?(me=U(this.options.mangle?ue(fe[1]):fe[1]),we="mailto:"+me):(me=U(fe[1]),we=me),{type:"link",raw:fe[0],text:me,href:we,tokens:[{type:"text",raw:me,text:me}]}}},_e.url=function(ne,ue){var fe;if(fe=this.rules.inline.url.exec(ne)){var me,we;if(fe[2]==="@")me=U(this.options.mangle?ue(fe[0]):fe[0]),we="mailto:"+me;else{var Me;do Me=fe[0],fe[0]=this.rules.inline._backpedal.exec(fe[0])[0];while(Me!==fe[0]);me=U(fe[0]),fe[1]==="www."?we="http://"+me:we=me}return{type:"link",raw:fe[0],text:me,href:we,tokens:[{type:"text",raw:me,text:me}]}}},_e.inlineText=function(ne,ue,fe){var me=this.rules.inline.text.exec(ne);if(me){var we;return ue?we=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):U(me[0]):me[0]:we=U(this.options.smartypants?fe(me[0]):me[0]),{type:"text",raw:me[0],text:we}}},Ce}(),ie=T.noopTest,re=T.edit,he=T.merge,oe={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]+/};oe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,oe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,oe.def=re(oe.def).replace("label",oe._label).replace("title",oe._title).getRegex(),oe.bullet=/(?:[*+-]|\d{1,9}[.)])/,oe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,oe.item=re(oe.item,"gm").replace(/bull/g,oe.bullet).getRegex(),oe.list=re(oe.list).replace(/bull/g,oe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+oe.def.source+")").getRegex(),oe._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",oe._comment=/<!--(?!-?>)[\s\S]*?-->/,oe.html=re(oe.html,"i").replace("comment",oe._comment).replace("tag",oe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oe.paragraph=re(oe._paragraph).replace("hr",oe.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",oe._tag).getRegex(),oe.blockquote=re(oe.blockquote).replace("paragraph",oe.paragraph).getRegex(),oe.normal=he({},oe),oe.gfm=he({},oe.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*|$)"}),oe.gfm.nptable=re(oe.gfm.nptable).replace("hr",oe.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",oe._tag).getRegex(),oe.gfm.table=re(oe.gfm.table).replace("hr",oe.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",oe._tag).getRegex(),oe.pedantic=he({},oe.normal,{html:re(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",oe._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:re(oe.normal._paragraph).replace("hr",oe.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",oe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ae={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])/};ae._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ae.punctuation=re(ae.punctuation).replace(/punctuation/g,ae._punctuation).getRegex(),ae._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ae._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ae.em.start=re(ae.em.start).replace(/punctuation/g,ae._punctuation).getRegex(),ae.em.middle=re(ae.em.middle).replace(/punctuation/g,ae._punctuation).replace(/overlapSkip/g,ae._overlapSkip).getRegex(),ae.em.endAst=re(ae.em.endAst,"g").replace(/punctuation/g,ae._punctuation).getRegex(),ae.em.endUnd=re(ae.em.endUnd,"g").replace(/punctuation/g,ae._punctuation).getRegex(),ae.strong.start=re(ae.strong.start).replace(/punctuation/g,ae._punctuation).getRegex(),ae.strong.middle=re(ae.strong.middle).replace(/punctuation/g,ae._punctuation).replace(/blockSkip/g,ae._blockSkip).getRegex(),ae.strong.endAst=re(ae.strong.endAst,"g").replace(/punctuation/g,ae._punctuation).getRegex(),ae.strong.endUnd=re(ae.strong.endUnd,"g").replace(/punctuation/g,ae._punctuation).getRegex(),ae.blockSkip=re(ae._blockSkip,"g").getRegex(),ae.overlapSkip=re(ae._overlapSkip,"g").getRegex(),ae._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ae._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ae._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])?)+(?![-_])/,ae.autolink=re(ae.autolink).replace("scheme",ae._scheme).replace("email",ae._email).getRegex(),ae._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ae.tag=re(ae.tag).replace("comment",oe._comment).replace("attribute",ae._attribute).getRegex(),ae._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ae._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ae._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ae.link=re(ae.link).replace("label",ae._label).replace("href",ae._href).replace("title",ae._title).getRegex(),ae.reflink=re(ae.reflink).replace("label",ae._label).getRegex(),ae.reflinkSearch=re(ae.reflinkSearch,"g").replace("reflink",ae.reflink).replace("nolink",ae.nolink).getRegex(),ae.normal=he({},ae),ae.pedantic=he({},ae.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:re(/^!?\[(label)\]\((.*?)\)/).replace("label",ae._label).getRegex(),reflink:re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ae._label).getRegex()}),ae.gfm=he({},ae.normal,{escape:re(ae.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),ae.gfm.url=re(ae.gfm.url,"i").replace("email",ae.gfm._extended_email).getRegex(),ae.breaks=he({},ae.gfm,{br:re(ae.br).replace("{2,}","*").getRegex(),text:re(ae.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Ee={block:oe,inline:ae},Le=F.defaults,Fe=Ee.block,Xe=Ee.inline;function He(Ce){return Ce.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 Ae(Ce){var _e="",Te,ne,ue=Ce.length;for(Te=0;Te<ue;Te++)ne=Ce.charCodeAt(Te),Math.random()>.5&&(ne="x"+ne.toString(16)),_e+="&#"+ne+";";return _e}var Oe=function(){function Ce(Te){this.tokens=[],this.tokens.links=Object.create(null),this.options=Te||Le,this.options.tokenizer=this.options.tokenizer||new ee,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ne={block:Fe.normal,inline:Xe.normal};this.options.pedantic?(ne.block=Fe.pedantic,ne.inline=Xe.pedantic):this.options.gfm&&(ne.block=Fe.gfm,this.options.breaks?ne.inline=Xe.breaks:ne.inline=Xe.gfm),this.tokenizer.rules=ne}Ce.lex=function(ne,ue){var fe=new Ce(ue);return fe.lex(ne)};var _e=Ce.prototype;return _e.lex=function(ne){return ne=ne.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(ne,this.tokens,!0),this.inline(this.tokens),this.tokens},_e.blockTokens=function(ne,ue,fe){ue===void 0&&(ue=[]),fe===void 0&&(fe=!0),ne=ne.replace(/^ +$/gm,"");for(var me,we,Me,je;ne;){if(me=this.tokenizer.space(ne)){ne=ne.substring(me.raw.length),me.type&&ue.push(me);continue}if(me=this.tokenizer.code(ne,ue)){ne=ne.substring(me.raw.length),me.type?ue.push(me):(je=ue[ue.length-1],je.raw+=`
|
|
`+me.raw,je.text+=`
|
|
`+me.text);continue}if(me=this.tokenizer.fences(ne)){ne=ne.substring(me.raw.length),ue.push(me);continue}if(me=this.tokenizer.heading(ne)){ne=ne.substring(me.raw.length),ue.push(me);continue}if(me=this.tokenizer.nptable(ne)){ne=ne.substring(me.raw.length),ue.push(me);continue}if(me=this.tokenizer.hr(ne)){ne=ne.substring(me.raw.length),ue.push(me);continue}if(me=this.tokenizer.blockquote(ne)){ne=ne.substring(me.raw.length),me.tokens=this.blockTokens(me.text,[],fe),ue.push(me);continue}if(me=this.tokenizer.list(ne)){for(ne=ne.substring(me.raw.length),Me=me.items.length,we=0;we<Me;we++)me.items[we].tokens=this.blockTokens(me.items[we].text,[],!1);ue.push(me);continue}if(me=this.tokenizer.html(ne)){ne=ne.substring(me.raw.length),ue.push(me);continue}if(fe&&(me=this.tokenizer.def(ne))){ne=ne.substring(me.raw.length),this.tokens.links[me.tag]||(this.tokens.links[me.tag]={href:me.href,title:me.title});continue}if(me=this.tokenizer.table(ne)){ne=ne.substring(me.raw.length),ue.push(me);continue}if(me=this.tokenizer.lheading(ne)){ne=ne.substring(me.raw.length),ue.push(me);continue}if(fe&&(me=this.tokenizer.paragraph(ne))){ne=ne.substring(me.raw.length),ue.push(me);continue}if(me=this.tokenizer.text(ne,ue)){ne=ne.substring(me.raw.length),me.type?ue.push(me):(je=ue[ue.length-1],je.raw+=`
|
|
`+me.raw,je.text+=`
|
|
`+me.text);continue}if(ne){var qe="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(qe);break}else throw new Error(qe)}}return ue},_e.inline=function(ne){var ue,fe,me,we,Me,je,qe=ne.length;for(ue=0;ue<qe;ue++){je=ne[ue];switch(je.type){case"paragraph":case"text":case"heading":{je.tokens=[],this.inlineTokens(je.text,je.tokens);break}case"table":{for(je.tokens={header:[],cells:[]},we=je.header.length,fe=0;fe<we;fe++)je.tokens.header[fe]=[],this.inlineTokens(je.header[fe],je.tokens.header[fe]);for(we=je.cells.length,fe=0;fe<we;fe++)for(Me=je.cells[fe],je.tokens.cells[fe]=[],me=0;me<Me.length;me++)je.tokens.cells[fe][me]=[],this.inlineTokens(Me[me],je.tokens.cells[fe][me]);break}case"blockquote":{this.inline(je.tokens);break}case"list":{for(we=je.items.length,fe=0;fe<we;fe++)this.inline(je.items[fe].tokens);break}}}return ne},_e.inlineTokens=function(ne,ue,fe,me,we){ue===void 0&&(ue=[]),fe===void 0&&(fe=!1),me===void 0&&(me=!1),we===void 0&&(we="");var Me,je=ne,qe;if(this.tokens.links){var ct=Object.keys(this.tokens.links);if(ct.length>0)for(;(qe=this.tokenizer.rules.inline.reflinkSearch.exec(je))!=null;)ct.includes(qe[0].slice(qe[0].lastIndexOf("[")+1,-1))&&(je=je.slice(0,qe.index)+"["+"a".repeat(qe[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(qe=this.tokenizer.rules.inline.blockSkip.exec(je))!=null;)je=je.slice(0,qe.index)+"["+"a".repeat(qe[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ne;){if(Me=this.tokenizer.escape(ne)){ne=ne.substring(Me.raw.length),ue.push(Me);continue}if(Me=this.tokenizer.tag(ne,fe,me)){ne=ne.substring(Me.raw.length),fe=Me.inLink,me=Me.inRawBlock,ue.push(Me);continue}if(Me=this.tokenizer.link(ne)){ne=ne.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,me)),ue.push(Me);continue}if(Me=this.tokenizer.reflink(ne,this.tokens.links)){ne=ne.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,me)),ue.push(Me);continue}if(Me=this.tokenizer.strong(ne,je,we)){ne=ne.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],fe,me),ue.push(Me);continue}if(Me=this.tokenizer.em(ne,je,we)){ne=ne.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],fe,me),ue.push(Me);continue}if(Me=this.tokenizer.codespan(ne)){ne=ne.substring(Me.raw.length),ue.push(Me);continue}if(Me=this.tokenizer.br(ne)){ne=ne.substring(Me.raw.length),ue.push(Me);continue}if(Me=this.tokenizer.del(ne)){ne=ne.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],fe,me),ue.push(Me);continue}if(Me=this.tokenizer.autolink(ne,Ae)){ne=ne.substring(Me.raw.length),ue.push(Me);continue}if(!fe&&(Me=this.tokenizer.url(ne,Ae))){ne=ne.substring(Me.raw.length),ue.push(Me);continue}if(Me=this.tokenizer.inlineText(ne,me,He)){ne=ne.substring(Me.raw.length),we=Me.raw.slice(-1),ue.push(Me);continue}if(ne){var et="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(et);break}else throw new Error(et)}}return ue},Se(Ce,null,[{key:"rules",get:function(){return{block:Fe,inline:Xe}}}]),Ce}(),Ke=F.defaults,de=T.cleanUrl,xe=T.escape,Ie=function(){function Ce(Te){this.options=Te||Ke}var _e=Ce.prototype;return _e.code=function(ne,ue,fe){var me=(ue||"").match(/\S*/)[0];if(this.options.highlight){var we=this.options.highlight(ne,me);we!=null&&we!==ne&&(fe=!0,ne=we)}return me?'<pre><code class="'+this.options.langPrefix+xe(me,!0)+'">'+(fe?ne:xe(ne,!0))+`</code></pre>
|
|
`:"<pre><code>"+(fe?ne:xe(ne,!0))+`</code></pre>
|
|
`},_e.blockquote=function(ne){return`<blockquote>
|
|
`+ne+`</blockquote>
|
|
`},_e.html=function(ne){return ne},_e.heading=function(ne,ue,fe,me){return this.options.headerIds?"<h"+ue+' id="'+this.options.headerPrefix+me.slug(fe)+'">'+ne+"</h"+ue+`>
|
|
`:"<h"+ue+">"+ne+"</h"+ue+`>
|
|
`},_e.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},_e.list=function(ne,ue,fe){var me=ue?"ol":"ul",we=ue&&fe!==1?' start="'+fe+'"':"";return"<"+me+we+`>
|
|
`+ne+"</"+me+`>
|
|
`},_e.listitem=function(ne){return"<li>"+ne+`</li>
|
|
`},_e.checkbox=function(ne){return"<input "+(ne?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},_e.paragraph=function(ne){return"<p>"+ne+`</p>
|
|
`},_e.table=function(ne,ue){return ue&&(ue="<tbody>"+ue+"</tbody>"),`<table>
|
|
<thead>
|
|
`+ne+`</thead>
|
|
`+ue+`</table>
|
|
`},_e.tablerow=function(ne){return`<tr>
|
|
`+ne+`</tr>
|
|
`},_e.tablecell=function(ne,ue){var fe=ue.header?"th":"td",me=ue.align?"<"+fe+' align="'+ue.align+'">':"<"+fe+">";return me+ne+"</"+fe+`>
|
|
`},_e.strong=function(ne){return"<strong>"+ne+"</strong>"},_e.em=function(ne){return"<em>"+ne+"</em>"},_e.codespan=function(ne){return"<code>"+ne+"</code>"},_e.br=function(){return this.options.xhtml?"<br/>":"<br>"},_e.del=function(ne){return"<del>"+ne+"</del>"},_e.link=function(ne,ue,fe){if(ne=de(this.options.sanitize,this.options.baseUrl,ne),ne===null)return fe;var me='<a href="'+xe(ne)+'"';return ue&&(me+=' title="'+ue+'"'),me+=">"+fe+"</a>",me},_e.image=function(ne,ue,fe){if(ne=de(this.options.sanitize,this.options.baseUrl,ne),ne===null)return fe;var me='<img src="'+ne+'" alt="'+fe+'"';return ue&&(me+=' title="'+ue+'"'),me+=this.options.xhtml?"/>":">",me},_e.text=function(ne){return ne},Ce}(),De=function(){function Ce(){}var _e=Ce.prototype;return _e.strong=function(ne){return ne},_e.em=function(ne){return ne},_e.codespan=function(ne){return ne},_e.del=function(ne){return ne},_e.html=function(ne){return ne},_e.text=function(ne){return ne},_e.link=function(ne,ue,fe){return""+fe},_e.image=function(ne,ue,fe){return""+fe},_e.br=function(){return""},Ce}(),Be=function(){function Ce(){this.seen={}}var _e=Ce.prototype;return _e.slug=function(ne){var ue=ne.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ue)){var fe=ue;do this.seen[fe]++,ue=fe+"-"+this.seen[fe];while(this.seen.hasOwnProperty(ue))}return this.seen[ue]=0,ue},Ce}(),ze=F.defaults,Ye=T.unescape,Ze=function(){function Ce(Te){this.options=Te||ze,this.options.renderer=this.options.renderer||new Ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new De,this.slugger=new Be}Ce.parse=function(ne,ue){var fe=new Ce(ue);return fe.parse(ne)};var _e=Ce.prototype;return _e.parse=function(ne,ue){ue===void 0&&(ue=!0);var fe="",me,we,Me,je,qe,ct,et,kt,Ct,pt,Nt,Et,wt,Ht,It,rr,Rr,ar,xr=ne.length;for(me=0;me<xr;me++){pt=ne[me];switch(pt.type){case"space":continue;case"hr":{fe+=this.renderer.hr();continue}case"heading":{fe+=this.renderer.heading(this.parseInline(pt.tokens),pt.depth,Ye(this.parseInline(pt.tokens,this.textRenderer)),this.slugger);continue}case"code":{fe+=this.renderer.code(pt.text,pt.lang,pt.escaped);continue}case"table":{for(kt="",et="",je=pt.header.length,we=0;we<je;we++)et+=this.renderer.tablecell(this.parseInline(pt.tokens.header[we]),{header:!0,align:pt.align[we]});for(kt+=this.renderer.tablerow(et),Ct="",je=pt.cells.length,we=0;we<je;we++){for(ct=pt.tokens.cells[we],et="",qe=ct.length,Me=0;Me<qe;Me++)et+=this.renderer.tablecell(this.parseInline(ct[Me]),{header:!1,align:pt.align[Me]});Ct+=this.renderer.tablerow(et)}fe+=this.renderer.table(kt,Ct);continue}case"blockquote":{Ct=this.parse(pt.tokens),fe+=this.renderer.blockquote(Ct);continue}case"list":{for(Nt=pt.ordered,Et=pt.start,wt=pt.loose,je=pt.items.length,Ct="",we=0;we<je;we++)It=pt.items[we],rr=It.checked,Rr=It.task,Ht="",It.task&&(ar=this.renderer.checkbox(rr),wt?It.tokens.length>0&&It.tokens[0].type==="text"?(It.tokens[0].text=ar+" "+It.tokens[0].text,It.tokens[0].tokens&&It.tokens[0].tokens.length>0&&It.tokens[0].tokens[0].type==="text"&&(It.tokens[0].tokens[0].text=ar+" "+It.tokens[0].tokens[0].text)):It.tokens.unshift({type:"text",text:ar}):Ht+=ar),Ht+=this.parse(It.tokens,wt),Ct+=this.renderer.listitem(Ht,Rr,rr);fe+=this.renderer.list(Ct,Nt,Et);continue}case"html":{fe+=this.renderer.html(pt.text);continue}case"paragraph":{fe+=this.renderer.paragraph(this.parseInline(pt.tokens));continue}case"text":{for(Ct=pt.tokens?this.parseInline(pt.tokens):pt.text;me+1<xr&&ne[me+1].type==="text";)pt=ne[++me],Ct+=`
|
|
`+(pt.tokens?this.parseInline(pt.tokens):pt.text);fe+=ue?this.renderer.paragraph(Ct):Ct;continue}default:{var tt='Token with "'+pt.type+'" type was not found.';if(this.options.silent){console.error(tt);return}else throw new Error(tt)}}}return fe},_e.parseInline=function(ne,ue){ue=ue||this.renderer;var fe="",me,we,Me=ne.length;for(me=0;me<Me;me++){we=ne[me];switch(we.type){case"escape":{fe+=ue.text(we.text);break}case"html":{fe+=ue.html(we.text);break}case"link":{fe+=ue.link(we.href,we.title,this.parseInline(we.tokens,ue));break}case"image":{fe+=ue.image(we.href,we.title,we.text);break}case"strong":{fe+=ue.strong(this.parseInline(we.tokens,ue));break}case"em":{fe+=ue.em(this.parseInline(we.tokens,ue));break}case"codespan":{fe+=ue.codespan(we.text);break}case"br":{fe+=ue.br();break}case"del":{fe+=ue.del(this.parseInline(we.tokens,ue));break}case"text":{fe+=ue.text(we.text);break}default:{var je='Token with "'+we.type+'" type was not found.';if(this.options.silent){console.error(je);return}else throw new Error(je)}}}return fe},Ce}(),ut=T.merge,Qe=T.checkSanitizeDeprecation,st=T.escape,Ne=F.getDefaults,vt=F.changeDefaults,ht=F.defaults;function Ue(Ce,_e,Te){if(typeof Ce=="undefined"||Ce===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ce!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ce)+", string expected");if(typeof _e=="function"&&(Te=_e,_e=null),_e=ut({},Ue.defaults,_e||{}),Qe(_e),Te){var ne=_e.highlight,ue;try{ue=Oe.lex(Ce,_e)}catch(Me){return Te(Me)}var fe=function(je){var qe;if(!je)try{qe=Ze.parse(ue,_e)}catch(ct){je=ct}return _e.highlight=ne,je?Te(je):Te(null,qe)};if(!ne||ne.length<3)return fe();if(delete _e.highlight,!ue.length)return fe();var me=0;Ue.walkTokens(ue,function(Me){Me.type==="code"&&(me++,setTimeout(function(){ne(Me.text,Me.lang,function(je,qe){if(je)return fe(je);qe!=null&&qe!==Me.text&&(Me.text=qe,Me.escaped=!0),me--,me===0&&fe()})},0))}),me===0&&fe();return}try{var we=Oe.lex(Ce,_e);return _e.walkTokens&&Ue.walkTokens(we,_e.walkTokens),Ze.parse(we,_e)}catch(Me){if(Me.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,_e.silent)return"<p>An error occurred:</p><pre>"+st(Me.message+"",!0)+"</pre>";throw Me}}Ue.options=Ue.setOptions=function(Ce){return ut(Ue.defaults,Ce),vt(Ue.defaults),Ue},Ue.getDefaults=Ne,Ue.defaults=ht,Ue.use=function(Ce){var _e=ut({},Ce);if(Ce.renderer&&function(){var ne=Ue.defaults.renderer||new Ie,ue=function(we){var Me=ne[we];ne[we]=function(){for(var je=arguments.length,qe=new Array(je),ct=0;ct<je;ct++)qe[ct]=arguments[ct];var et=Ce.renderer[we].apply(ne,qe);return et===!1&&(et=Me.apply(ne,qe)),et}};for(var fe in Ce.renderer)ue(fe);_e.renderer=ne}(),Ce.tokenizer&&function(){var ne=Ue.defaults.tokenizer||new ee,ue=function(we){var Me=ne[we];ne[we]=function(){for(var je=arguments.length,qe=new Array(je),ct=0;ct<je;ct++)qe[ct]=arguments[ct];var et=Ce.tokenizer[we].apply(ne,qe);return et===!1&&(et=Me.apply(ne,qe)),et}};for(var fe in Ce.tokenizer)ue(fe);_e.tokenizer=ne}(),Ce.walkTokens){var Te=Ue.defaults.walkTokens;_e.walkTokens=function(ne){Ce.walkTokens(ne),Te&&Te(ne)}}Ue.setOptions(_e)},Ue.walkTokens=function(Ce,_e){for(var Te=le(Ce),ne;!(ne=Te()).done;){var ue=ne.value;_e(ue);switch(ue.type){case"table":{for(var fe=le(ue.tokens.header),me;!(me=fe()).done;){var we=me.value;Ue.walkTokens(we,_e)}for(var Me=le(ue.tokens.cells),je;!(je=Me()).done;)for(var qe=je.value,ct=le(qe),et;!(et=ct()).done;){var kt=et.value;Ue.walkTokens(kt,_e)}break}case"list":{Ue.walkTokens(ue.items,_e);break}default:ue.tokens&&Ue.walkTokens(ue.tokens,_e)}}},Ue.Parser=Ze,Ue.parser=Ze.parse,Ue.Renderer=Ie,Ue.TextRenderer=De,Ue.Lexer=Oe,Ue.lexer=Oe.lex,Ue.Tokenizer=ee,Ue.Slugger=Be,Ue.parse=Ue;var Ve=Ue;return Ve})},"7Se7":function(at,ve,Z){"use strict";var se=Z("yuO0"),Se=Z("eA01"),ce=Z("fXDJ"),ye=Z("BPTR"),le=Z("udol"),X=Z("T/Jt"),F=Z.n(X),W=Z("XjgL"),r=Z("fNpE"),H=Z("MZ8U"),D=Z("kxoy"),M=Z("83jQ"),g=Z("aVTQ"),p=Z("27eb"),u=Z.n(p),m=Z("E0BR");function b(a,T){var h="cannot ".concat(a.method," ").concat(a.action," ").concat(T.status,"'"),n=new Error(h);return n.status=T.status,n.method=a.method,n.url=a.action,n}function E(a){var T=a.responseText||a.response;if(!T)return T;try{return JSON.parse(T)}catch(h){return T}}function _(a){var T=new XMLHttpRequest;a.onProgress&&T.upload&&(T.upload.onprogress=function(U){U.total>0&&(U.percent=U.loaded/U.total*100),a.onProgress(U)});var h=new FormData;a.data&&Object.keys(a.data).forEach(function(N){var U=a.data[N];if(Array.isArray(U)){U.forEach(function(j){h.append("".concat(N,"[]"),j)});return}h.append(N,U)}),a.file instanceof Blob?h.append(a.filename,a.file,a.file.name):h.append(a.filename,a.file),T.onerror=function(U){a.onError(U)},T.onload=function(){return T.status<200||T.status>=300?a.onError(b(a,T),E(T)):a.onSuccess(E(T),T)},T.open(a.method,a.action,!0),a.withCredentials&&"withCredentials"in T&&(T.withCredentials=!0);var n=a.headers||{};return n["X-Requested-With"]!==null&&T.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(n).forEach(function(N){n[N]!==null&&T.setRequestHeader(N,n[N])}),T.send(h),{abort:function(){T.abort()}}}var f=+new Date,O=0;function w(){return"rc-upload-".concat(f,"-").concat(++O)}var R=Z("B/uU"),x=function(a,T){if(a&&T){var h=Array.isArray(T)?T:T.split(","),n=a.name||"",N=a.type||"",U=N.replace(/\/.*$/,"");return h.some(function(j){var Y=j.trim();if(/^\*(\/\*)?$/.test(j))return!0;if(Y.charAt(0)==="."){var J=n.toLowerCase(),ee=Y.toLowerCase(),ie=[ee];return(ee===".jpg"||ee===".jpeg")&&(ie=[".jpg",".jpeg"]),ie.some(function(re){return J.endsWith(re)})}return/\/\*$/.test(Y)?U===Y.replace(/\/.*$/,""):N===Y?!0:/^\w+$/.test(Y)?(Object(R.a)(!1,"Upload takes an invalidate 'accept' type '".concat(Y,"'.Skip for check.")),!0):!1})}return!0};function I(a,T){var h=a.createReader(),n=[];function N(){h.readEntries(function(U){var j=Array.prototype.slice.apply(U);n=n.concat(j);var Y=!j.length;Y?T(n):N()})}N()}var k=function(T,h,n){var N=function U(j,Y){if(!j)return;j.path=Y||"",j.isFile?j.file(function(J){n(J)&&(j.fullPath&&!J.webkitRelativePath&&(Object.defineProperties(J,{webkitRelativePath:{writable:!0}}),J.webkitRelativePath=j.fullPath.replace(/^\//,""),Object.defineProperties(J,{webkitRelativePath:{writable:!1}})),h([J]))}):j.isDirectory&&I(j,function(J){J.forEach(function(ee){U(ee,"".concat(Y).concat(j.name,"/"))})})};T.forEach(function(U){N(U.webkitGetAsEntry())})},A=k,P=["component","prefixCls","className","disabled","id","style","multiple","accept","capture","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"],S=function(a){Object(ye.a)(h,a);var T=Object(le.a)(h);function h(){var n;Object(Se.a)(this,h);for(var N=arguments.length,U=new Array(N),j=0;j<N;j++)U[j]=arguments[j];return n=T.call.apply(T,[this].concat(U)),n.state={uid:w()},n.reqs={},n.fileInput=void 0,n._isMounted=void 0,n.onChange=function(Y){var J=n.props,ee=J.accept,ie=J.directory,re=Y.target.files,he=Object(g.a)(re).filter(function(oe){return!ie||x(oe,ee)});n.uploadFiles(he),n.reset()},n.onClick=function(Y){var J=n.fileInput;if(!J)return;var ee=Y.target,ie=n.props.onClick;if(ee&&ee.tagName==="BUTTON"){var re=J.parentNode;re.focus(),ee.blur()}J.click(),ie&&ie(Y)},n.onKeyDown=function(Y){Y.key==="Enter"&&n.onClick(Y)},n.onFileDrop=function(Y){var J=n.props.multiple;if(Y.preventDefault(),Y.type==="dragover")return;if(n.props.directory)A(Array.prototype.slice.call(Y.dataTransfer.items),n.uploadFiles,function(ie){return x(ie,n.props.accept)});else{var ee=Object(g.a)(Y.dataTransfer.files).filter(function(ie){return x(ie,n.props.accept)});J===!1&&(ee=ee.slice(0,1)),n.uploadFiles(ee)}},n.uploadFiles=function(Y){var J=Object(g.a)(Y),ee=J.map(function(ie){return ie.uid=w(),n.processFile(ie,J)});Promise.all(ee).then(function(ie){var re=n.props.onBatchStart;re==null||re(ie.map(function(he){var oe=he.origin,ae=he.parsedFile;return{file:oe,parsedFile:ae}})),ie.filter(function(he){return he.parsedFile!==null}).forEach(function(he){n.post(he)})})},n.processFile=function(){var Y=Object(M.a)(Object(H.a)().mark(function J(ee,ie){var re,he,oe,ae,Ee,Le,Fe,Xe,He;return Object(H.a)().wrap(function(Oe){for(;;)switch(Oe.prev=Oe.next){case 0:if(re=n.props.beforeUpload,he=ee,!re){Oe.next=14;break}return Oe.prev=3,Oe.next=6,re(ee,ie);case 6:he=Oe.sent,Oe.next=12;break;case 9:Oe.prev=9,Oe.t0=Oe.catch(3),he=!1;case 12:if(!(he===!1)){Oe.next=14;break}return Oe.abrupt("return",{origin:ee,parsedFile:null,action:null,data:null});case 14:if(oe=n.props.action,!(typeof oe=="function")){Oe.next=21;break}return Oe.next=18,oe(ee);case 18:ae=Oe.sent,Oe.next=22;break;case 21:ae=oe;case 22:if(Ee=n.props.data,!(typeof Ee=="function")){Oe.next=29;break}return Oe.next=26,Ee(ee);case 26:Le=Oe.sent,Oe.next=30;break;case 29:Le=Ee;case 30:return Fe=(Object(D.a)(he)==="object"||typeof he=="string")&&he?he:ee,Fe instanceof File?Xe=Fe:Xe=new File([Fe],ee.name,{type:ee.type}),He=Xe,He.uid=ee.uid,Oe.abrupt("return",{origin:ee,data:Le,parsedFile:He,action:ae});case 35:case"end":return Oe.stop()}},J,null,[[3,9]])}));return function(J,ee){return Y.apply(this,arguments)}}(),n.saveFileInput=function(Y){n.fileInput=Y},n}return Object(ce.a)(h,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"post",value:function(N){var U=this,j=N.data,Y=N.origin,J=N.action,ee=N.parsedFile;if(!this._isMounted)return;var ie=this.props,re=ie.onStart,he=ie.customRequest,oe=ie.name,ae=ie.headers,Ee=ie.withCredentials,Le=ie.method,Fe=Y.uid,Xe=he||_,He={action:J,filename:oe,data:j,file:ee,headers:ae,withCredentials:Ee,method:Le||"post",onProgress:function(Oe){var Ke=U.props.onProgress;Ke==null||Ke(Oe,ee)},onSuccess:function(Oe,Ke){var de=U.props.onSuccess;de==null||de(Oe,ee,Ke),delete U.reqs[Fe]},onError:function(Oe,Ke){var de=U.props.onError;de==null||de(Oe,Ke,ee),delete U.reqs[Fe]}};re(Y),this.reqs[Fe]=Xe(He)}},{key:"reset",value:function(){this.setState({uid:w()})}},{key:"abort",value:function(N){var U=this.reqs;if(N){var j=N.uid?N.uid:N;U[j]&&U[j].abort&&U[j].abort(),delete U[j]}else Object.keys(U).forEach(function(Y){U[Y]&&U[Y].abort&&U[Y].abort(),delete U[Y]})}},{key:"render",value:function(){var N=this.props,U=N.component,j=N.prefixCls,Y=N.className,J=N.disabled,ee=N.id,ie=N.style,re=N.multiple,he=N.accept,oe=N.capture,ae=N.children,Ee=N.directory,Le=N.openFileDialogOnClick,Fe=N.onMouseEnter,Xe=N.onMouseLeave,He=Object(r.a)(N,P),Ae=u()(Object(W.a)(Object(W.a)(Object(W.a)({},j,!0),"".concat(j,"-disabled"),J),Y,Y)),Oe=Ee?{directory:"directory",webkitdirectory:"webkitdirectory"}:{},Ke=J?{}:{onClick:Le?this.onClick:function(){},onKeyDown:Le?this.onKeyDown:function(){},onMouseEnter:Fe,onMouseLeave:Xe,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return F.a.createElement(U,Object(se.a)({},Ke,{className:Ae,role:"button",style:ie}),F.a.createElement("input",Object(se.a)({},Object(m.a)(He,{aria:!0,data:!0}),{id:ee,disabled:J,type:"file",ref:this.saveFileInput,onClick:function(xe){return xe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:he},Oe,{multiple:re,onChange:this.onChange},oe!=null?{capture:oe}:{})),ae)}}]),h}(X.Component),C=S;function c(){}var o=function(a){Object(ye.a)(h,a);var T=Object(le.a)(h);function h(){var n;Object(Se.a)(this,h);for(var N=arguments.length,U=new Array(N),j=0;j<N;j++)U[j]=arguments[j];return n=T.call.apply(T,[this].concat(U)),n.uploader=void 0,n.saveUploader=function(Y){n.uploader=Y},n}return Object(ce.a)(h,[{key:"abort",value:function(N){this.uploader.abort(N)}},{key:"render",value:function(){return F.a.createElement(C,Object(se.a)({},this.props,{ref:this.saveUploader}))}}]),h}(X.Component);o.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:c,onError:c,onSuccess:c,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var v=o,l=ve.a=v},"7ahc":function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return O});var se=Z("YaWb"),Se=Z("HPgX"),ce=Z("dLI4"),ye=Z("4d5L"),le=Z("y6Ii"),X=Z("Wuip"),F=Z("Hqw+"),W=Z("FrBR"),r=Z("SCzF"),H=Z("T/Jt"),D=Z.n(H),M=Z("VrN/"),g=Z.n(M),p=Z("p77/"),u=Z.n(p),m=Z("c5Ni"),b=Z.n(m),E=r.a.Option,_={labelCol:{span:4},wrapperCol:{span:20}},f={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};ve.b=function(w){var R=w.callback,x=w.onCancel,I=Object(H.useState)("python"),k=Object(F.a)(I,2),A=k[0],P=k[1];function S(c){P(f[c][1])}function C(c){R(c)}return D.a.createElement(X.a,Object(Se.a)({},_,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:C}),D.a.createElement(X.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},D.a.createElement(r.a,{onChange:S},Object.keys(f).map(function(c){return D.a.createElement(E,{key:c,value:c},f[c][0])}))),D.a.createElement(X.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},D.a.createElement(O,{mode:A})),D.a.createElement("div",{className:"flex-container flex-end"},D.a.createElement(ye.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(ye.a,{type:"ghost",onClick:x},"\u53D6\u6D88")))};function O(w){var R=w.value,x=w.onChange,I=w.mode,k=w.options,A=k===void 0?{}:k,P=Object(H.useRef)(),S=Object(H.useState)(),C=Object(F.a)(S,2),c=C[0],o=C[1];return Object(H.useEffect)(function(){if(c){function v(l){var a=l.getValue();x&&x(a)}return c.on("change",v),function(){c.off("change",v)}}},[c,x]),Object(H.useEffect)(function(){c&&c.setOption("mode",I)},[c,I]),Object(H.useEffect)(function(){c&&((R!==c.getValue()||R==="")&&setTimeout(function(){c.setValue(R||" ")},300))},[c,R]),Object(H.useEffect)(function(){if(P.current&&!c){var v=g.a.fromTextArea(P.current,Object(se.a)({mode:I,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},A));o(v)}},[P.current,c]),D.a.createElement("div",{className:"my-codemirror-container"},D.a.createElement("textarea",{ref:P}))}},"7oQw":function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return I});var se=Z("yuO0"),Se=Z("6ASS"),ce=Z("fNpE"),ye=Z("T/Jt"),le=Z("27eb"),X=Z.n(le),F={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},W=function(){var P=Object(ye.useRef)([]),S=Object(ye.useRef)(null);return Object(ye.useEffect)(function(){var C=Date.now(),c=!1;P.current.forEach(function(o){if(!o)return;c=!0;var v=o.style;v.transitionDuration=".3s, .3s, .3s, .06s",S.current&&C-S.current<100&&(v.transitionDuration="0s, 0s")}),c&&(S.current=Date.now())}),P.current},r=["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"],H=function(P){var S=Object(Se.a)(Object(Se.a)({},F),P),C=S.className,c=S.percent,o=S.prefixCls,v=S.strokeColor,l=S.strokeLinecap,a=S.strokeWidth,T=S.style,h=S.trailColor,n=S.trailWidth,N=S.transition,U=Object(ce.a)(S,r);delete U.gapPosition;var j=Array.isArray(c)?c:[c],Y=Array.isArray(v)?v:[v],J=W(),ee=a/2,ie=100-a/2,re="M ".concat(l==="round"?ee:0,",").concat(ee,`
|
|
L `).concat(l==="round"?ie:100,",").concat(ee),he="0 0 100 ".concat(a),oe=0;return ye.createElement("svg",Object(se.a)({className:X()("".concat(o,"-line"),C),viewBox:he,preserveAspectRatio:"none",style:T},U),ye.createElement("path",{className:"".concat(o,"-line-trail"),d:re,strokeLinecap:l,stroke:h,strokeWidth:n||a,fillOpacity:"0"}),j.map(function(ae,Ee){var Le=1;switch(l){case"round":Le=1-a/100;break;case"square":Le=1-a/2/100;break;default:Le=1;break}var Fe={strokeDasharray:"".concat(ae*Le,"px, 100px"),strokeDashoffset:"-".concat(oe,"px"),transition:N||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Xe=Y[Ee]||Y[Y.length-1];return oe+=ae,ye.createElement("path",{key:Ee,className:"".concat(o,"-line-path"),d:re,strokeLinecap:l,stroke:Xe,strokeWidth:a,fillOpacity:"0",ref:function(Ae){J[Ee]=Ae},style:Fe})}))},D=H,M=Z("kxoy"),g=Z("36hc"),p=Z("Zfln"),u=0,m=Object(p.a)();function b(){var A;return m?(A=u,u+=1):A="TEST_OR_SSR",A}var E=function(A){var P=ye.useState(),S=Object(g.a)(P,2),C=S[0],c=S[1];return ye.useEffect(function(){c("rc_progress_".concat(b()))},[]),A||C},_=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function f(A){return+A.replace("%","")}function O(A){var P=A!=null?A:[];return Array.isArray(P)?P:[P]}var w=100,R=function(P,S,C,c,o,v,l,a,T,h){var n=arguments.length>10&&arguments[10]!==void 0?arguments[10]:0,N=C/100*360*((360-v)/360),U=v===0?0:{bottom:0,top:180,left:90,right:-90}[l],j=(100-c)/100*S;return T==="round"&&c!==100&&(j+=h/2,j>=S&&(j=S-.01)),{stroke:typeof a=="string"?a:void 0,strokeDasharray:"".concat(S,"px ").concat(P),strokeDashoffset:j+n,transform:"rotate(".concat(o+N+U,"deg)"),transformOrigin:"0 0",transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s",fillOpacity:0}},x=function(P){var S=Object(Se.a)(Object(Se.a)({},F),P),C=S.id,c=S.prefixCls,o=S.steps,v=S.strokeWidth,l=S.trailWidth,a=S.gapDegree,T=a===void 0?0:a,h=S.gapPosition,n=S.trailColor,N=S.strokeLinecap,U=S.style,j=S.className,Y=S.strokeColor,J=S.percent,ee=Object(ce.a)(S,_),ie=E(C),re="".concat(ie,"-gradient"),he=w/2-v/2,oe=Math.PI*2*he,ae=T>0?90+T/2:-90,Ee=oe*((360-T)/360),Le=Object(M.a)(o)==="object"?o:{count:o,space:2},Fe=Le.count,Xe=Le.space,He=R(oe,Ee,0,100,ae,T,h,n,N,v),Ae=O(J),Oe=O(Y),Ke=Oe.find(function(De){return De&&Object(M.a)(De)==="object"}),de=W(),xe=function(){var Be=0;return Ae.map(function(ze,Ye){var Ze=Oe[Ye]||Oe[Oe.length-1],ut=Ze&&Object(M.a)(Ze)==="object"?"url(#".concat(re,")"):void 0,Qe=R(oe,Ee,Be,ze,ae,T,h,Ze,N,v);return Be+=ze,ye.createElement("circle",{key:Ye,className:"".concat(c,"-circle-path"),r:he,cx:0,cy:0,stroke:ut,strokeLinecap:N,strokeWidth:v,opacity:ze===0?0:1,style:Qe,ref:function(Ne){de[Ye]=Ne}})}).reverse()},Ie=function(){var Be=Math.round(Fe*(Ae[0]/100)),ze=100/Fe,Ye=0;return new Array(Fe).fill(null).map(function(Ze,ut){var Qe=ut<=Be-1?Oe[0]:n,st=Qe&&Object(M.a)(Qe)==="object"?"url(#".concat(re,")"):void 0,Ne=R(oe,Ee,Ye,ze,ae,T,h,Qe,"butt",v,Xe);return Ye+=(Ee-Ne.strokeDashoffset+Xe)*100/Ee,ye.createElement("circle",{key:ut,className:"".concat(c,"-circle-path"),r:he,cx:0,cy:0,stroke:st,strokeWidth:v,opacity:1,style:Ne,ref:function(ht){de[ut]=ht}})})};return ye.createElement("svg",Object(se.a)({className:X()("".concat(c,"-circle"),j),viewBox:"".concat(-w/2," ").concat(-w/2," ").concat(w," ").concat(w),style:U,id:C,role:"presentation"},ee),Ke&&ye.createElement("defs",null,ye.createElement("linearGradient",{id:re,x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ke).sort(function(De,Be){return f(De)-f(Be)}).map(function(De,Be){return ye.createElement("stop",{key:Be,offset:De,stopColor:Ke[De]})}))),!Fe&&ye.createElement("circle",{className:"".concat(c,"-circle-trail"),r:he,cx:0,cy:0,stroke:n,strokeLinecap:N,strokeWidth:l||v,style:He}),Fe?Ie():xe())},I=x,k={Line:D,Circle:I}},"8EBN":function(at,ve,Z){(function(se){se(Z("VrN/"))})(function(se){"use strict";se.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var Se=0;Se<se.modeInfo.length;Se++){var ce=se.modeInfo[Se];ce.mimes&&(ce.mime=ce.mimes[0])}se.findModeByMIME=function(ye){ye=ye.toLowerCase();for(var le=0;le<se.modeInfo.length;le++){var X=se.modeInfo[le];if(X.mime==ye)return X;if(X.mimes){for(var F=0;F<X.mimes.length;F++)if(X.mimes[F]==ye)return X}}if(/\+xml$/.test(ye))return se.findModeByMIME("application/xml");if(/\+json$/.test(ye))return se.findModeByMIME("application/json")},se.findModeByExtension=function(ye){ye=ye.toLowerCase();for(var le=0;le<se.modeInfo.length;le++){var X=se.modeInfo[le];if(X.ext){for(var F=0;F<X.ext.length;F++)if(X.ext[F]==ye)return X}}},se.findModeByFileName=function(ye){for(var le=0;le<se.modeInfo.length;le++){var X=se.modeInfo[le];if(X.file&&X.file.test(ye))return X}var F=ye.lastIndexOf("."),W=F>-1&&ye.substring(F+1,ye.length);if(W)return se.findModeByExtension(W)},se.findModeByName=function(ye){ye=ye.toLowerCase();for(var le=0;le<se.modeInfo.length;le++){var X=se.modeInfo[le];if(X.name.toLowerCase()==ye)return X;if(X.alias){for(var F=0;F<X.alias.length;F++)if(X.alias[F].toLowerCase()==ye)return X}}}})},"8HAY":function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return le}),Z.d(ve,"b",function(){return X}),Z.d(ve,"d",function(){return F}),Z.d(ve,"e",function(){return W}),Z.d(ve,"c",function(){return r});var se=Z("MI8n"),Se=Z("pmY6"),ce=Z("3/fG"),ye=function(H,D,M,g){function p(u){return u instanceof M?u:new M(function(m){m(u)})}return new(M||(M=Promise))(function(u,m){function b(f){try{_(g.next(f))}catch(O){m(O)}}function E(f){try{_(g.throw(f))}catch(O){m(O)}}function _(f){f.done?u(f.value):p(f.value).then(b,E)}_((g=g.apply(H,D||[])).next())})};class le extends Se.a{constructor(H,D="",M="",g=!0,p){super();this._onDidChange=this._register(new se.b),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=H,this._label=D,this._cssClass=M,this._enabled=g,this._actionCallback=p}get id(){return this._id}get label(){return this._label}set label(H){this._setLabel(H)}_setLabel(H){this._label!==H&&(this._label=H,this._onDidChange.fire({label:H}))}get tooltip(){return this._tooltip||""}set tooltip(H){this._setTooltip(H)}_setTooltip(H){this._tooltip!==H&&(this._tooltip=H,this._onDidChange.fire({tooltip:H}))}get class(){return this._cssClass}set class(H){this._setClass(H)}_setClass(H){this._cssClass!==H&&(this._cssClass=H,this._onDidChange.fire({class:H}))}get enabled(){return this._enabled}set enabled(H){this._setEnabled(H)}_setEnabled(H){this._enabled!==H&&(this._enabled=H,this._onDidChange.fire({enabled:H}))}get checked(){return this._checked}set checked(H){this._setChecked(H)}_setChecked(H){this._checked!==H&&(this._checked=H,this._onDidChange.fire({checked:H}))}run(H,D){return ye(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(H))})}}class X extends Se.a{constructor(){super(...arguments);this._onBeforeRun=this._register(new se.b),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new se.b),this.onDidRun=this._onDidRun.event}run(H,D){return ye(this,void 0,void 0,function*(){if(!H.enabled)return;this._onBeforeRun.fire({action:H});let M;try{yield this.runAction(H,D)}catch(g){M=g}this._onDidRun.fire({action:H,error:M})})}runAction(H,D){return ye(this,void 0,void 0,function*(){yield H.run(D)})}}class F extends le{constructor(H){super(F.ID,H,H?"separator text":"separator");this.checked=!1,this.enabled=!1}}F.ID="vs.actions.separator";class W{constructor(H,D,M,g){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=H,this.label=D,this.class=g,this._actions=M}get actions(){return this._actions}dispose(){}run(){return ye(this,void 0,void 0,function*(){})}}class r extends le{constructor(){super(r.ID,ce.a("submenu.empty","(empty)"),void 0,!1)}}r.ID="vs.actions.empty"},"8hTe":function(at,ve,Z){at.exports={button:"button___1wy9m"}},"9Bee":function(at,ve,Z){"use strict";var se=Z("CDKA"),Se=Z("d7ih"),ce=Z("dLI4"),ye=Z("4d5L"),le=Z("YaWb"),X=Z("IYef"),F=Z("Hqw+"),W=Z("XXmO"),r=Z.n(W),H=Z("T/Jt"),D=Z.n(H),M=Z("vg9a"),g=Z("7O0G"),p=Z.n(g),u=Z("GcTH");function m(V,y){var L=V.match(/^(\s+)(?:```)/);if(L===null)return y;var G=L[1];return y.split(`
|
|
`).map(function(q){var K=q.match(/^\s+/);if(K===null)return q;var pe=Object(F.a)(K,1),Pe=pe[0];return Pe.length>=G.length?q.slice(G.length):q}).join(`
|
|
`)}var b=[],E=["<ul>"],_=new p.a.Renderer,f=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function O(){b.length=0,E=["<ul>"]}var w={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function R(V,y,L,G){if(y>=V.length||V[y].level<=L)return y;var q=V[y];G.push("<li><a href='#"+q.anchor+"'>"+q.text+"</a>"),y++;var K=[];return y=R(V,y,q.level,K),K.length>0&&(G.push("<ul>"),K.forEach(function(pe){G.push(pe)}),G.push("</ul>")),G.push("</li>"),y=R(V,y,L,G),y}function x(){return R(b,0,0,E),E.push("</ul>"),E.join("")}var I={heading:function(y){var L=f.exec(y);if(L)return{type:"heading",raw:L[0],depth:L[1].length,text:L[2]}},fences:function(y){var L=this.rules.block.fences.exec(y);if(L){var G=L[0],q=m(G,L[3]||""),K=L[2]?L[2].trim():L[2];if(["latex","katex","math"].indexOf(K)>=0){var pe=P(),Pe=q;q=pe,S[pe]={type:"block",expression:Pe}}return{type:"code",raw:G,lang:K,text:q}}}},k=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,P=function(){return"__special_katext_id_".concat(A++,"__")},S={};function C(){return S}function c(){A=0,S={}}function o(V){return V=V.replace(k,function(y,L){var G=P();return S[G]={type:"inline",expression:L},G}),V}var v=_.listitem;_.listitem=function(V){return v(o(V))};var l=_.paragraph;_.paragraph=function(V){return l(o(V))};var a=_.tablecell;_.tablecell=function(V,y){return a(o(V),y)},_.code=function(V,y,L){var G=(y||"").match(/\S*/)[0];return G?["latex","katex","math"].indexOf(G)>=0?"<p class='editormd-tex'>".concat(V,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(y,'">').concat(L?V:Object(u.escape)(V,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(L?V:Object(u.escape)(V,!0))+"</code></pre>"},_.heading=function(V,y,L){var G=this.options.headerPrefix+L.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return b.push({anchor:G,level:y,text:V}),"<h"+y+' id="'+G+'">'+V+"</h"+y+">"},p.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),p.a.use({tokenizer:I,renderer:_});var T=p.a,h=Z("SJMd"),n=Z("ulZh"),N=Z.n(n),U=Z("m3rI"),j=Z("Oy/b"),Y=Z("p5ED"),J=Z("ErOA");/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var ee=function(V,y){return(ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,G){L.__proto__=G}||function(L,G){for(var q in G)Object.prototype.hasOwnProperty.call(G,q)&&(L[q]=G[q])})(V,y)};function ie(V,y){function L(){this.constructor=V}ee(V,y),V.prototype=y===null?Object.create(y):(L.prototype=y.prototype,new L)}function re(V,y,L,G){return new(L||(L=Promise))(function(q,K){function pe(dt){try{it(G.next(dt))}catch(Ge){K(Ge)}}function Pe(dt){try{it(G.throw(dt))}catch(Ge){K(Ge)}}function it(dt){var Ge;dt.done?q(dt.value):(Ge=dt.value,Ge instanceof L?Ge:new L(function(yt){yt(Ge)})).then(pe,Pe)}it((G=G.apply(V,y||[])).next())})}function he(V,y){var L,G,q,K,pe={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return K={next:Pe(0),throw:Pe(1),return:Pe(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function Pe(it){return function(dt){return function(Ge){if(L)throw new TypeError("Generator is already executing.");for(;pe;)try{if(L=1,G&&(q=2&Ge[0]?G.return:Ge[0]?G.throw||((q=G.return)&&q.call(G),0):G.next)&&!(q=q.call(G,Ge[1])).done)return q;switch(G=0,q&&(Ge=[2&Ge[0],q.value]),Ge[0]){case 0:case 1:q=Ge;break;case 4:return pe.label++,{value:Ge[1],done:!1};case 5:pe.label++,G=Ge[1],Ge=[0];continue;case 7:Ge=pe.ops.pop(),pe.trys.pop();continue;default:if(!(q=pe.trys,(q=q.length>0&&q[q.length-1])||Ge[0]!==6&&Ge[0]!==2)){pe=0;continue}if(Ge[0]===3&&(!q||Ge[1]>q[0]&&Ge[1]<q[3])){pe.label=Ge[1];break}if(Ge[0]===6&&pe.label<q[1]){pe.label=q[1],q=Ge;break}if(q&&pe.label<q[2]){pe.label=q[2],pe.ops.push(Ge);break}q[2]&&pe.ops.pop(),pe.trys.pop();continue}Ge=y.call(V,pe)}catch(yt){Ge=[6,yt],G=0}finally{L=q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([it,dt])}}}function oe(){for(var V=0,y=0,L=arguments.length;y<L;y++)V+=arguments[y].length;var G=Array(V),q=0;for(y=0;y<L;y++)for(var K=arguments[y],pe=0,Pe=K.length;pe<Pe;pe++,q++)G[q]=K[pe];return G}var ae=function(){function V(){}return V.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},V.setAttributes=function(y,L){for(var G=0,q=L;G<q.length;G++){var K=q[G],pe=K[0],Pe=K[1];y.setAttribute(pe,Pe)}},V.createRect=function(y,L,G){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",y.toString()),q.setAttribute("height",L.toString()),G&&V.setAttributes(q,G),q},V.createLine=function(y,L,G,q,K){var pe=document.createElementNS("http://www.w3.org/2000/svg","line");return pe.setAttribute("x1",y.toString()),pe.setAttribute("y1",L.toString()),pe.setAttribute("x2",G.toString()),pe.setAttribute("y2",q.toString()),K&&V.setAttributes(pe,K),pe},V.createPolygon=function(y,L){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",y),L&&V.setAttributes(G,L),G},V.createCircle=function(y,L){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(y/2).toString()),G.setAttribute("cy",(y/2).toString()),G.setAttribute("r",y.toString()),L&&V.setAttributes(G,L),G},V.createEllipse=function(y,L,G){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(y/2).toString()),q.setAttribute("cy",(L/2).toString()),q.setAttribute("rx",(y/2).toString()),q.setAttribute("ry",(L/2).toString()),G&&V.setAttributes(q,G),q},V.createGroup=function(y){var L=document.createElementNS("http://www.w3.org/2000/svg","g");return y&&V.setAttributes(L,y),L},V.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},V.createMarker=function(y,L,G,q,K,pe,Pe){var it=document.createElementNS("http://www.w3.org/2000/svg","marker");return V.setAttributes(it,[["id",y],["orient",L],["markerWidth",G.toString()],["markerHeight",q.toString()],["refX",K.toString()],["refY",pe.toString()]]),it.appendChild(Pe),it},V.createText=function(y){var L=document.createElementNS("http://www.w3.org/2000/svg","text");return L.setAttribute("x","0"),L.setAttribute("y","0"),y&&V.setAttributes(L,y),L},V.createTSpan=function(y,L){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=y,L&&V.setAttributes(G,L),G},V.createImage=function(y){var L=document.createElementNS("http://www.w3.org/2000/svg","image");return y&&V.setAttributes(L,y),L},V.createPoint=function(y,L){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=y,G.y=L,G},V.createPath=function(y,L){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",y),L&&V.setAttributes(G,L),G},V}(),Ee=function(){function V(){}return V.addKey=function(y){V.key=y},Object.defineProperty(V,"isLicensed",{get:function(){return!!V.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(V.key)},enumerable:!1,configurable:!0}),V}(),Le=function(){function V(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return V.prototype.rasterize=function(y,L,G){var q=this;return new Promise(function(K){var pe=G!==void 0?G:document.createElement("canvas");y===null&&(q.markersOnly=!0,q.naturalSize=!1);var Pe=document.createElementNS("http://www.w3.org/2000/svg","svg");Pe.setAttribute("xmlns","http://www.w3.org/2000/svg"),Pe.setAttribute("width",L.width.baseVal.valueAsString),Pe.setAttribute("height",L.height.baseVal.valueAsString),Pe.setAttribute("viewBox","0 0 "+L.viewBox.baseVal.width.toString()+" "+L.viewBox.baseVal.height.toString()),Pe.innerHTML=L.innerHTML,q.naturalSize===!0?(Pe.width.baseVal.value=y.naturalWidth,Pe.height.baseVal.value=y.naturalHeight):q.width!==void 0&&q.height!==void 0&&(Pe.width.baseVal.value=q.width,Pe.height.baseVal.value=q.height),pe.width=Pe.width.baseVal.value,pe.height=Pe.height.baseVal.value;var it=Pe.outerHTML,dt=pe.getContext("2d");q.markersOnly!==!0&&dt.drawImage(y,0,0,pe.width,pe.height);var Ge=window.URL,yt=new Image(pe.width,pe.height);yt.setAttribute("crossOrigin","anonymous");var Ft=new Blob([it],{type:"image/svg+xml"}),qt=Ge.createObjectURL(Ft);yt.onload=function(){dt.drawImage(yt,0,0),Ge.revokeObjectURL(qt);var Zr=pe.toDataURL(q.imageType,q.imageQuality);K(Zr)},yt.src=qt})},V}(),Fe=function(){},Xe=function(){function V(y){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+y+"_"}return Object.defineProperty(V.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(V.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(V.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),V.prototype.addClass=function(y){return this.styleSheet===void 0&&this.addStyleSheet(),y.name=""+this.classNamePrefix+y.localName,this.classes.push(y),this.styleSheet.sheet.insertRule("."+y.name+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length),y},V.prototype.addRule=function(y){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(y),this.styleSheet.sheet.insertRule(y.selector+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length)},V.prototype.addStyleSheet=function(){var y;this.styleSheet=document.createElement("style"),((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).appendChild(this.styleSheet),this.addRule(new He("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new He("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new He("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Ae("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Ae("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},V.prototype.removeStyleSheet=function(){var y;this.styleSheet&&(((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},V}(),He=function(V,y){this.selector=V,this.style=y},Ae=function(V,y){this.localName=V,this.style=y},Oe=function(){function V(y,L,G,q,K){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=y,this.displayMode=L,this.markerItems=G,this.uiStyleSettings=q,this.styles=K,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return V.prototype.show=function(y){var L=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=y,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var G=document.createElement("div");G.className=this.toolbarBlockStyleClass.name,G.style.whiteSpace="nowrap",this.uiContainer.appendChild(G),this.addActionButton(G,'<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","Select mode"),this.addActionButton(G,'<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","Delete marker"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(G,'<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","Delete all markers"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(G,'<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","Undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(G,'<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","Redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(G,'<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","Zoom in"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(G,'<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","Zoom out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(G,'<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","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(K){var pe=document.createElement("div");pe.className=""+L.toolbarButtonStyleClass.name,pe.setAttribute("data-type-name",K.typeName),pe.setAttribute("aria-label",K.title),pe.setAttribute("title",K.title),pe.innerHTML=K.icon,pe.addEventListener("click",function(){L.markerToolbarButtonClicked(pe,K)}),L.buttons.push(pe),L.markerButtons.push(pe)}),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 q=document.createElement("div");q.className=this.toolbarBlockStyleClass.name,q.style.whiteSpace="nowrap",q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(q),this.addActionButton(q,'<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","Save and close"),this.addActionButton(q,'<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","Close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},V.prototype.addButtonClickListener=function(y){this.buttonClickListeners.push(y)},V.prototype.removeButtonClickListener=function(y){this.buttonClickListeners.indexOf(y)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(y),1)},V.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},V.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var y=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var L=0;L<this.markerButtons.length;L++)L<y||L===y&&this.markerButtons.length-1===y?this.markerButtonBlock.appendChild(this.markerButtons[L]):(L===y&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[L]))}},V.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")},V.prototype.resetButtonStyles=function(){var y=this;this.buttons.forEach(function(L){L.className=L.className.replace(y.uiStyleSettings.toolbarButtonStyleColorsClassName?y.uiStyleSettings.toolbarButtonStyleColorsClassName:y.toolbarButtonStyleColorsClass.name,"").trim(),L.className=L.className.replace(y.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?y.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:y.toolbarActiveButtonStyleColorsClass.name,"").trim(),L.className+=" "+(y.uiStyleSettings.toolbarButtonStyleColorsClassName?y.uiStyleSettings.toolbarButtonStyleColorsClassName:y.toolbarButtonStyleColorsClass.name)})},V.prototype.addActionButton=function(y,L,G,q){var K=this,pe=document.createElement("div");switch(pe.className=""+this.toolbarButtonStyleClass.name,pe.innerHTML=L,pe.setAttribute("role","button"),pe.setAttribute("data-action",G),pe.title=q,pe.setAttribute("aria-label",q),pe.addEventListener("click",function(){K.actionToolbarButtonClicked(pe,G)}),G){case"select":pe.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":pe.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":pe.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":pe.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":pe.style.fill=this.uiStyleSettings.closeButtonColor}y.appendChild(pe),this.buttons.push(pe)},V.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ae("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 Ae("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ae("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Ae("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 Ae("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var y=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ae("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
|
|
padding: `+y+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ae("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ae("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new He("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new He("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},V.prototype.markerToolbarButtonClicked=function(y,L){this.setActiveButton(y),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("marker",L)}),this.markerButtonOverflowBlock.style.display="none"},V.prototype.actionToolbarButtonClicked=function(y,L){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("action",L)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},V.prototype.setActiveButton=function(y){this.resetButtonStyles(),y.className=y.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),y.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},V.prototype.setActiveMarkerButton=function(y){var L=this.markerButtons.find(function(G){return G.getAttribute("data-type-name")===y});L&&this.setActiveButton(L)},V.prototype.setCurrentMarker=function(y){var L=this;this.currentMarker=y,this.buttons.filter(function(G){return/delete|notes/.test(G.getAttribute("data-action"))}).forEach(function(G){L.currentMarker===void 0?(G.style.fillOpacity="0.4",G.style.pointerEvents="none"):(G.style.fillOpacity="1",G.style.pointerEvents="all")})},V}(),Ke=function(){function V(y,L,G,q){this.panels=[],this.panelButtons=[],this.markerjsContainer=y,this.displayMode=L,this.uiStyleSettings=G,this.styles=q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return V.prototype.addStyles=function(){var y;this.toolboxStyleClass=this.styles.addClass(new Ae("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 Ae("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var L=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ae("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ae("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ae("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 Ae("toolbox-panel-row_colors",`
|
|
background-color: `+((y=this.uiStyleSettings.toolboxBackgroundColor)!==null&&y!==void 0?y:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Ae("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*L)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*L)+`px;
|
|
padding: `+L+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Ae("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ae("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new He("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new He("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new He("."+this.toolboxPanelRowStyleClass.name+" > div",`
|
|
scrollbar-width: thin;
|
|
`)),this.styles.addRule(new He("."+this.toolboxPanelRowStyleClass.name+" > div::-webkit-scrollbar",`
|
|
height: 10px;
|
|
width: 10px;
|
|
`)),this.styles.addRule(new He("."+this.toolboxPanelRowStyleClass.name+" > div::-webkit-scrollbar-track",`
|
|
background-color: transparent;
|
|
`)),this.styles.addRule(new He("."+this.toolboxPanelRowStyleClass.name+" > div::-webkit-scrollbar-thumb",`
|
|
background-color: #444;
|
|
border-radius: 20px;
|
|
border: 2px solid #aaa;
|
|
`))},V.prototype.show=function(y){var L;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=y,this.uiContainer.className=this.toolboxStyleClass.name+" "+((L=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&L!==void 0?L:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},V.prototype.setPanelButtons=function(y){var L,G,q=this;this.panels=y,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((L=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&L!==void 0?L:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((G=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&G!==void 0?G:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(K){var pe;K.uiStyleSettings=q.uiStyleSettings;var Pe=document.createElement("div");Pe.className=q.toolboxButtonStyleClass.name+" "+((pe=q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&pe!==void 0?pe:q.toolboxButtonStyleColorsClass.name),Pe.innerHTML=K.icon,Pe.title=K.title,Pe.setAttribute("role","button"),Pe.setAttribute("aria-label",K.title),K.id&&Pe.setAttribute("data-action",K.id),Pe.addEventListener("click",function(){q.panelButtonClick(K)}),q.panelButtons.push(Pe),q.buttonRow.appendChild(Pe)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},V.prototype.panelButtonClick=function(y){var L=this,G=-1;if(y!==this.activePanel){G=this.panels.indexOf(y),this.panelRow.innerHTML="";var q=y.getUi();q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=y}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){L.displayMode==="inline"?L.panelRow.style.display="none":L.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(K,pe){var Pe,it;K.className=L.toolboxButtonStyleClass.name+" "+(pe===G?""+((Pe=L.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Pe!==void 0?Pe:L.toolboxActiveButtonStyleColorsClass.name):""+((it=L.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&it!==void 0?it:L.toolboxButtonStyleColorsClass.name))})},V}(),de=function(){function V(y,L,G){this.title=y,this.icon=L,this._id=G}return Object.defineProperty(V.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),V}(),xe=function(V){function y(L,G,q,K,pe){var Pe=V.call(this,L,K||'<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>',pe||"color-picker-panel")||this;return Pe.colors=[],Pe.addTransparent=!1,Pe.colorBoxes=[],Pe.colors=G,Pe.currentColor=q,Pe.setCurrentColor=Pe.setCurrentColor.bind(Pe),Pe.getColorBox=Pe.getColorBox.bind(Pe),Pe}return ie(y,V),y.prototype.getUi=function(){var L=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.overflowX="auto",G.style.whiteSpace="nowrap",this.colors.forEach(function(q){var K=L.getColorBox(q);G.appendChild(K),L.colorBoxes.push(K)}),G},y.prototype.getColorBox=function(L){var G=this,q=this.uiStyleSettings.toolbarHeight/4,K=this.uiStyleSettings.toolbarHeight-q,pe=document.createElement("div");pe.style.display="inline-block",pe.style.boxSizing="content-box",pe.style.width=K-2+"px",pe.style.height=K-2+"px",pe.style.padding="1px",pe.style.marginRight="2px",pe.style.marginBottom="2px",pe.style.borderWidth="2px",pe.style.borderStyle="solid",pe.style.borderRadius=(K+2)/2+"px",pe.style.borderColor=L===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",pe.addEventListener("click",function(){G.setCurrentColor(L,pe)});var Pe=document.createElement("div");return Pe.style.display="inline-block",Pe.style.width=K-2+"px",Pe.style.height=K-2+"px",Pe.style.backgroundColor=L,Pe.style.borderRadius=K/2+"px",L==="transparent"&&(Pe.style.fill=this.uiStyleSettings.toolboxAccentColor,Pe.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>`),pe.appendChild(Pe),pe},y.prototype.setCurrentColor=function(L,G){var q=this;this.currentColor=L,this.colorBoxes.forEach(function(K){K.style.borderColor=K===G?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(L)},y}(de),Ie=function(){function V(y,L,G){this._state="new",this._isSelected=!1,this._container=y,this._overlayContainer=L,this.globalSettings=G,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(V.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),V.prototype.ownsTarget=function(y){return!1},Object.defineProperty(V.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),V.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},V.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},V.prototype.pointerDown=function(y,L){},V.prototype.dblClick=function(y,L){},V.prototype.manipulate=function(y){},V.prototype.pointerUp=function(y){this.stateChanged()},V.prototype.dispose=function(){},V.prototype.addMarkerVisualToContainer=function(y){this.container.childNodes.length>0?this.container.insertBefore(y,this.container.childNodes[0]):this.container.appendChild(y)},V.prototype.getState=function(){return{typeName:V.typeName,state:this.state,notes:this.notes}},V.prototype.restoreState=function(y){this._state=y.state,this.notes=y.notes},V.prototype.scale=function(y,L){},V.prototype.colorChanged=function(y){this.onColorChanged&&this.onColorChanged(y),this.stateChanged()},V.prototype.fillColorChanged=function(y){this.onFillColorChanged&&this.onFillColorChanged(y),this.stateChanged()},V.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var y=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),y.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(y)&&this.onStateChanged(this)}},V.typeName="MarkerBase",V}(),De=function(){function V(){this.findGripByVisual=this.findGripByVisual.bind(this)}return V.prototype.findGripByVisual=function(y){return this.topLeft.ownsTarget(y)?this.topLeft:this.topCenter.ownsTarget(y)?this.topCenter:this.topRight.ownsTarget(y)?this.topRight:this.centerLeft.ownsTarget(y)?this.centerLeft:this.centerRight.ownsTarget(y)?this.centerRight:this.bottomLeft.ownsTarget(y)?this.bottomLeft:this.bottomCenter.ownsTarget(y)?this.bottomCenter:this.bottomRight.ownsTarget(y)?this.bottomRight:void 0},V}(),Be=function(){function V(){this.GRIP_SIZE=10,this.visual=ae.createGroup(),this.visual.appendChild(ae.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ae.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return V.prototype.ownsTarget=function(y){return y===this.visual||y===this.visual.childNodes[0]||y===this.visual.childNodes[1]},V}(),ze=function(){function V(){}return V.toITransformMatrix=function(y){return{a:y.a,b:y.b,c:y.c,d:y.d,e:y.e,f:y.f}},V.toSVGMatrix=function(y,L){return y.a=L.a,y.b=L.b,y.c=L.c,y.d=L.d,y.e=L.e,y.f=L.f,y},V}(),Ye=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.left=0,K.top=0,K.width=0,K.height=0,K.defaultSize={x:50,y:20},K.offsetX=0,K.offsetY=0,K.rotationAngle=0,K.CB_DISTANCE=10,K._suppressMarkerCreateEvent=!1,K.container.transform.baseVal.appendItem(ae.createTransform()),K.setupControlBox(),K}return ie(y,V),Object.defineProperty(y.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"visual",{get:function(){return this._visual},set:function(L){this._visual=L;var G=ae.createTransform();this._visual.transform.baseVal.appendItem(G)},enumerable:!1,configurable:!0}),y.prototype.ownsTarget=function(L){return!!V.prototype.ownsTarget.call(this,L)||!!(this.controlGrips.findGripByVisual(L)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(L))},y.prototype.pointerDown=function(L,G){V.prototype.pointerDown.call(this,L,G),this.state==="new"&&(this.left=L.x,this.top=L.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var q=this.unrotatePoint(L);if(this.manipulationStartX=q.x,this.manipulationStartY=q.y,this.offsetX=q.x-this.left,this.offsetY=q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(G),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(G)){this.activeGrip=this.rotatorGrip;var K=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=K.x-this.width/2,this.top=K.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var pe=this.container.transform.baseVal.getItem(0);pe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(pe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},y.prototype.pointerUp=function(L){var G=this.state;V.prototype.pointerUp.call(this,L),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(L),this._state="select",G==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},y.prototype.moveVisual=function(L){this.visual.style.transform="translate("+L.x+"px, "+L.y+"px)"},y.prototype.manipulate=function(L){var G=this.unrotatePoint(L);this.state==="creating"?this.resize(L):this.state==="move"?(this.left=this.manipulationStartLeft+(G.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(G.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(G):this.state==="rotate"&&this.rotate(L)},y.prototype.resize=function(L){var G=this.manipulationStartLeft,q=this.manipulationStartWidth,K=this.manipulationStartTop,pe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:G=this.manipulationStartLeft+L.x-this.manipulationStartX,q=this.manipulationStartWidth+this.manipulationStartLeft-G;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:q=this.manipulationStartWidth+L.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:K=this.manipulationStartTop+L.y-this.manipulationStartY,pe=this.manipulationStartHeight+this.manipulationStartTop-K;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:pe=this.manipulationStartHeight+L.y-this.manipulationStartY}q>=0?(this.left=G,this.width=q):(this.left=G+q,this.width=-q),pe>=0?(this.top=K,this.height=pe):(this.top=K+pe,this.height=-pe),this.setSize()},y.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},y.prototype.rotate=function(L){if(Math.abs(L.x-this.centerX)>.1){var G=Math.sign(L.x-this.centerX);this.rotationAngle=180*Math.atan((L.y-this.centerY)/(L.x-this.centerX))/Math.PI+90*G,this.applyRotation()}},y.prototype.applyRotation=function(){var L=this.container.transform.baseVal.getItem(0);L.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(L,0)},y.prototype.rotatePoint=function(L){if(this.rotationAngle===0)return L;var G=this.container.getCTM(),q=ae.createPoint(L.x,L.y);return{x:(q=q.matrixTransform(G)).x,y:q.y}},y.prototype.unrotatePoint=function(L){if(this.rotationAngle===0)return L;var G=this.container.getCTM();G=G.inverse();var q=ae.createPoint(L.x,L.y);return{x:(q=q.matrixTransform(G)).x,y:q.y}},y.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},y.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},y.prototype.setupControlBox=function(){this.controlBox=ae.createGroup();var L=ae.createTransform();L.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(L),this.container.appendChild(this.controlBox),this.controlRect=ae.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=ae.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new De,this.addControlGrips(),this.controlBox.style.display="none"},y.prototype.adjustControlBox=function(){var L=this.controlBox.transform.baseVal.getItem(0);L.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(L,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()},y.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()},y.prototype.createGrip=function(){var L=new Be;return L.visual.transform.baseVal.appendItem(ae.createTransform()),this.controlBox.appendChild(L.visual),L},y.prototype.positionGrips=function(){var L=this.controlGrips.topLeft.GRIP_SIZE,G=-L/2,q=G,K=(this.width+this.CB_DISTANCE)/2-L/2,pe=(this.height+this.CB_DISTANCE)/2-L/2,Pe=this.height+this.CB_DISTANCE-L/2,it=this.width+this.CB_DISTANCE-L/2;this.positionGrip(this.controlGrips.topLeft.visual,G,q),this.positionGrip(this.controlGrips.topCenter.visual,K,q),this.positionGrip(this.controlGrips.topRight.visual,it,q),this.positionGrip(this.controlGrips.centerLeft.visual,G,pe),this.positionGrip(this.controlGrips.centerRight.visual,it,pe),this.positionGrip(this.controlGrips.bottomLeft.visual,G,Pe),this.positionGrip(this.controlGrips.bottomCenter.visual,K,Pe),this.positionGrip(this.controlGrips.bottomRight.visual,it,Pe),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,K,q-3*this.CB_DISTANCE)},y.prototype.positionGrip=function(L,G,q){var K=L.transform.baseVal.getItem(0);K.setTranslate(G,q),L.transform.baseVal.replaceItem(K,0)},y.prototype.hideControlBox=function(){this.controlBox.style.display="none"},y.prototype.showControlBox=function(){this.controlBox.style.display=""},y.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:ze.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ze.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},V.prototype.getState.call(this))},y.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L);var G=L;this.left=G.left,this.top=G.top,this.width=G.width,this.height=G.height,this.rotationAngle=G.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(ze.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,G.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ze.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,G.containerTransformMatrix))},y.prototype.scale=function(L,G){V.prototype.scale.call(this,L,G);var q=this.rotatePoint({x:this.left,y:this.top}),K=this.unrotatePoint({x:q.x*L,y:q.y*G});this.left=K.x,this.top=K.y,this.width=this.width*L,this.height=this.height*G,this.adjustControlBox()},y}(Ie),Ze=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.createVisual=K.createVisual.bind(K),K}return ie(y,V),y.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.visual)},y.prototype.createVisual=function(){this.visual=ae.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)},y.prototype.pointerDown=function(L,G){V.prototype.pointerDown.call(this,L,G),this.state==="new"&&(this.createVisual(),this.moveVisual(L),this._state="creating")},y.prototype.manipulate=function(L){V.prototype.manipulate.call(this,L)},y.prototype.resize=function(L){V.prototype.resize.call(this,L),this.setSize()},y.prototype.setSize=function(){V.prototype.setSize.call(this),ae.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},y.prototype.pointerUp=function(L){V.prototype.pointerUp.call(this,L),this.setSize()},y.prototype.setStrokeColor=function(L){this.strokeColor=L,this.visual&&ae.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(L),this.stateChanged()},y.prototype.setFillColor=function(L){this.fillColor=L,this.visual&&ae.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},y.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.visual&&ae.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},y.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.visual&&ae.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},y.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this))},y.prototype.restoreState=function(L){var G=L;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.opacity=G.opacity,this.createVisual(),V.prototype.restoreState.call(this,L),this.setSize()},y.prototype.scale=function(L,G){V.prototype.scale.call(this,L,G),this.setSize()},y.title="Rectangle marker",y}(Ye),ut=function(V){function y(L,G,q,K,pe){var Pe=V.call(this,L,K||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>',pe||"line-width-panel")||this;return Pe.widths=[],Pe.widthBoxes=[],Pe.widths=G,Pe.currentWidth=q,Pe.setCurrentWidth=Pe.setCurrentWidth.bind(Pe),Pe}return ie(y,V),y.prototype.getUi=function(){var L=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.widths.forEach(function(q){var K=document.createElement("div");K.style.display="flex",K.style.flexGrow="2",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=q===L.currentWidth?L.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){L.setCurrentWidth(q,K)}),G.appendChild(K);var pe=document.createElement("div");pe.innerText=q.toString(),pe.style.marginRight="5px",K.appendChild(pe);var Pe=document.createElement("div");Pe.style.minHeight="20px",Pe.style.flexGrow="2",Pe.style.display="flex",Pe.style.alignItems="center";var it=document.createElement("hr");it.style.minWidth="20px",it.style.border="0px",it.style.borderTop=q+"px solid "+L.uiStyleSettings.toolboxColor,it.style.flexGrow="2",Pe.appendChild(it),K.appendChild(Pe),L.widthBoxes.push(K)}),G},y.prototype.setCurrentWidth=function(L,G){var q=this;this.currentWidth=L,this.widthBoxes.forEach(function(K){K.style.borderColor=K===G?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},y}(de),Qe=function(V){function y(L,G,q,K,pe){var Pe=V.call(this,L,K||'<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>',pe||"line-style-panel")||this;return Pe.styles=[],Pe.styleBoxes=[],Pe.styles=G,Pe.currentStyle=q,Pe.setCurrentStyle=Pe.setCurrentStyle.bind(Pe),Pe}return ie(y,V),y.prototype.getUi=function(){var L=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.styles.forEach(function(q){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/L.styles.length-5+"%",K.style.borderColor=q===L.currentStyle?L.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){L.setCurrentStyle(q,K)}),G.appendChild(K);var pe=document.createElement("div");pe.style.minHeight="20px",pe.style.flexGrow="2",pe.style.overflow="hidden";var Pe=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+L.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(q!==""?'stroke-dasharray="'+q+'"':"")+` />
|
|
</svg>`;pe.innerHTML=Pe,K.appendChild(pe),L.styleBoxes.push(K)}),G},y.prototype.setCurrentStyle=function(L,G){var q=this;this.currentStyle=L,this.styleBoxes.forEach(function(K){K.style.borderColor=K===G?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},y}(de),st=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.strokePanel=new xe("Line color",q.defaultColorSet,q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new ut("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Qe("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return ie(y,V),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=V.prototype.getState.call(this);return L.typeName=y.typeName,L},y.typeName="FrameMarker",y.title="Frame marker",y.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',y}(Ze),Ne=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,this.defaultCaptionFontSize="1rem",this.defaultCaptionText="Text",this.wrapText=!1,this.defaultText="Your text here"},vt=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.x1=0,K.y1=0,K.x2=0,K.y2=0,K.defaultLength=50,K.manipulationStartX=0,K.manipulationStartY=0,K.manipulationStartX1=0,K.manipulationStartY1=0,K.manipulationStartX2=0,K.manipulationStartY2=0,K.setupControlBox(),K}return ie(y,V),y.prototype.ownsTarget=function(L){return!!V.prototype.ownsTarget.call(this,L)||!(!this.grip1.ownsTarget(L)&&!this.grip2.ownsTarget(L))},y.prototype.pointerDown=function(L,G){V.prototype.pointerDown.call(this,L,G),this.manipulationStartX=L.x,this.manipulationStartY=L.y,this.state==="new"&&(this.x1=L.x,this.y1=L.y,this.x2=L.x,this.y2=L.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(G)?this.activeGrip=this.grip1:this.grip2.ownsTarget(G)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},y.prototype.pointerUp=function(L){var G=this.state;V.prototype.pointerUp.call(this,L),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(L),this._state="select",G==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},y.prototype.adjustVisual=function(){},y.prototype.manipulate=function(L){this.state==="creating"?this.resize(L):this.state==="move"?(this.x1=this.manipulationStartX1+L.x-this.manipulationStartX,this.y1=this.manipulationStartY1+L.y-this.manipulationStartY,this.x2=this.manipulationStartX2+L.x-this.manipulationStartX,this.y2=this.manipulationStartY2+L.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(L)},y.prototype.resize=function(L){switch(this.activeGrip){case this.grip1:this.x1=L.x,this.y1=L.y;break;case this.grip2:case void 0:this.x2=L.x,this.y2=L.y}this.adjustVisual(),this.adjustControlBox()},y.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},y.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},y.prototype.setupControlBox=function(){this.controlBox=ae.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},y.prototype.adjustControlBox=function(){this.positionGrips()},y.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},y.prototype.createGrip=function(){var L=new Be;return L.visual.transform.baseVal.appendItem(ae.createTransform()),this.controlBox.appendChild(L.visual),L},y.prototype.positionGrips=function(){var L=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-L/2,this.y1-L/2),this.positionGrip(this.grip2.visual,this.x2-L/2,this.y2-L/2)},y.prototype.positionGrip=function(L,G,q){var K=L.transform.baseVal.getItem(0);K.setTranslate(G,q),L.transform.baseVal.replaceItem(K,0)},y.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},V.prototype.getState.call(this))},y.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L);var G=L;this.x1=G.x1,this.y1=G.y1,this.x2=G.x2,this.y2=G.y2},y.prototype.scale=function(L,G){V.prototype.scale.call(this,L,G),this.x1=this.x1*L,this.y1=this.y1*G,this.x2=this.x2*L,this.y2=this.y2*G,this.adjustVisual(),this.adjustControlBox()},y}(Ie),ht=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.strokePanel=new xe("Line color",q.defaultColorSet,q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new ut("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Qe("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return ie(y,V),y.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.visual&&L!==this.selectorLine&&L!==this.visibleLine)},y.prototype.createVisual=function(){this.visual=ae.createGroup(),this.selectorLine=ae.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ae.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)},y.prototype.pointerDown=function(L,G){V.prototype.pointerDown.call(this,L,G),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},y.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()),ae.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ae.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ae.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},y.prototype.setStrokeColor=function(L){this.strokeColor=L,this.adjustVisual(),this.colorChanged(L)},y.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.adjustVisual()},y.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.adjustVisual(),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},V.prototype.getState.call(this));return L.typeName=y.typeName,L},y.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L);var G=L;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.createVisual(),this.adjustVisual()},y.typeName="LineMarker",y.title="Line marker",y.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',y}(vt),Ue=function(V){function y(L,G,q,K,pe){var Pe=V.call(this,L,K||'<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>',pe||"font-family-panel")||this;return Pe.fonts=[],Pe.fontBoxes=[],Pe.fonts=G,Pe.currentFont=q,Pe.setCurrentFont=Pe.setCurrentFont.bind(Pe),Pe}return ie(y,V),y.prototype.getUi=function(){var L=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.flexGrow="2",this.fonts.forEach(function(q){var K=document.createElement("div");K.style.display="inline-block",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/L.fonts.length-5+"%",K.style.borderColor=q===L.currentFont?L.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){L.setCurrentFont(q,K)}),G.appendChild(K);var pe=document.createElement("div");pe.style.display="flex",pe.style.minHeight="20px",pe.style.flexGrow="2",pe.style.fontFamily=q,pe.style.overflow="hidden";var Pe=document.createElement("div");Pe.style.whiteSpace="nowrap",Pe.style.overflow="hidden",Pe.style.textOverflow="ellipsis",Pe.innerHTML="The quick brown fox jumps over the lazy dog",pe.appendChild(Pe),K.appendChild(pe),L.fontBoxes.push(K)}),G},y.prototype.setCurrentFont=function(L,G){var q=this;this.currentFont=L,this.fontBoxes.forEach(function(K){K.style.borderColor=K===G?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},y}(de),Ve=function(V){function y(L,G,q){var K,pe=V.call(this,L,G,q)||this;return pe.color="transparent",pe.padding=5,pe.DEFAULT_TEXT="your text here",pe.isMoved=!1,pe.color=q.defaultColor,pe.fontFamily=q.defaultFontFamily,pe.text=(K=q.defaultText)!==null&&K!==void 0?K:pe.DEFAULT_TEXT,pe.defaultSize={x:100,y:30},pe.setColor=pe.setColor.bind(pe),pe.setFont=pe.setFont.bind(pe),pe.renderText=pe.renderText.bind(pe),pe.sizeText=pe.sizeText.bind(pe),pe.textEditDivClicked=pe.textEditDivClicked.bind(pe),pe.showTextEditor=pe.showTextEditor.bind(pe),pe.setSize=pe.setSize.bind(pe),pe.positionTextEditor=pe.positionTextEditor.bind(pe),pe.wrapText=pe.wrapText.bind(pe),pe.colorPanel=new xe("Color",q.defaultColorSet,q.defaultColor),pe.colorPanel.onColorChanged=pe.setColor,pe.fontFamilyPanel=new Ue("Font",q.defaultFontFamilies,q.defaultFontFamily),pe.fontFamilyPanel.onFontChanged=pe.setFont,pe}return ie(y,V),y.prototype.ownsTarget=function(L){if(V.prototype.ownsTarget.call(this,L)||L===this.visual||L===this.textElement||L===this.bgRectangle)return!0;var G=!1;return this.textElement.childNodes.forEach(function(q){q===L&&(G=!0)}),G},y.prototype.createVisual=function(){this.visual=ae.createGroup(),this.bgRectangle=ae.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ae.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ae.createTransform()),this.textElement.transform.baseVal.appendItem(ae.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},y.prototype.pointerDown=function(L,G){V.prototype.pointerDown.call(this,L,G),this.isMoved=!1,this.pointerDownPoint=L,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(L),this._state="creating")},y.prototype.wrapText=function(){function L(dt){var Ge=dt[0].length;return dt.forEach(function(yt){yt.length>Ge&&(Ge=yt.length)}),.35*Ge/dt.length}if(this.text!==""){for(var G=this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/),q=1*this.width/this.height,K=new(Array.bind.apply(Array,oe([void 0],G))),pe=L(K),Pe=Number.MAX_VALUE,it=function(){var dt=K[0];K.forEach(function(Ge){Ge.length>dt.length&&(dt=Ge)}),(Pe=dt.lastIndexOf(" ",Pe-1))>0?(K=[],G.forEach(function(Ge){for(var yt=Ge;yt.length>Pe;){var Ft=yt.lastIndexOf(" ",Pe);Ft<0&&(Ft=yt.indexOf(" ")),Ft>0?(K.push(yt.substring(0,Ft)),yt=yt.substring(Ft).trim()):(K.push(yt),yt="")}K.push(yt)}),pe=L(K)):pe=-1};pe>q;)it();return K.join(`\r
|
|
`)}return this.text},y.prototype.renderText=function(){var L=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);(this.globalSettings.wrapText?this.wrapText():this.text).split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(G){L.textElement.appendChild(ae.createTSpan(G.trim()===""?" ":G.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},y.prototype.getTextScale=function(){var L=this.textElement.getBBox(),G=1;if(L.width>0&&L.height>0){var q=(1*this.width-this.width*this.padding*2/100)/L.width,K=(1*this.height-this.height*this.padding*2/100)/L.height;G=Math.min(q,K)}return G},y.prototype.getTextPosition=function(L){var G=window.getComputedStyle(this.textElement).direction==="rtl"?1:-1,q=this.textElement.getBBox(),K=0,pe=0;return q.width>0&&q.height>0&&(K=(this.width+G*q.width*L)/2,pe=this.height/2-q.height*L/2),{x:K,y:pe}},y.prototype.sizeText=function(){var L=this.textElement.getBBox(),G=this.getTextScale(),q=this.getTextPosition(G);q.y-=L.y*G,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+q.x+"px, "+q.y+"px) scale("+G+", "+G+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(q.x,q.y),this.textElement.transform.baseVal.getItem(1).setScale(G,G))},y.prototype.manipulate=function(L){V.prototype.manipulate.call(this,L),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(L.x-this.pointerDownPoint.x)>5||Math.abs(L.y-this.pointerDownPoint.y)>5)},y.prototype.resize=function(L){V.prototype.resize.call(this,L),this.isMoved=!0,this.setSize(),this.globalSettings.wrapText?this.renderText():this.sizeText()},y.prototype.setSize=function(){V.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ae.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ae.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},y.prototype.pointerUp=function(L){var G=this.state;G==="creating"&&(this._suppressMarkerCreateEvent=!0),V.prototype.pointerUp.call(this,L),this.setSize(),(G==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},y.prototype.showTextEditor=function(){var L=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(G){G.stopPropagation()}),this.globalSettings.wrapText||this.textEditor.addEventListener("input",function(){for(var G=Number.parseFloat(L.textEditor.style.fontSize);L.textEditor.clientWidth>=Number.parseInt(L.textEditor.style.maxWidth)&&G>.9;)G-=.1,L.textEditor.style.fontSize=Math.max(G,.9)+"em"}),this.textEditor.addEventListener("keyup",function(G){G.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(G){if(G.clipboardData){var q=G.clipboardData.getData("text"),K=window.getSelection();if(!K.rangeCount)return!1;K.deleteFromDocument(),K.getRangeAt(0).insertNode(document.createTextNode(q)),G.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){L.textEditDivClicked(L.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},y.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else if(this.globalSettings.wrapText)this.textEditor.style.left=this.left+this.padding+"px",this.textEditor.style.top=this.top+this.padding+"px",this.textEditor.style.width=this.width-2*this.padding+"px",this.textEditor.style.height=this.height-2*this.padding+"px",this.textEditor.style.maxHeight=this.textEditor.style.height,this.textEditor.style.whiteSpace="wrap";else{this.textElement.style.display="";var L=this.getTextScale(),G=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),q=this.textElement.getBBox(),K={x:q.width*L,y:q.height*L};G.x-=K.x/2,G.y-=K.y/2,this.textEditor.style.top=G.y+"px",this.textEditor.style.left=G.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-G.x+"px",this.textEditor.style.fontSize=Math.max(16*L,12)+"px",this.textElement.style.display="none"}},y.prototype.textEditDivClicked=function(L){this.text=L.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},y.prototype.select=function(){V.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},y.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),V.prototype.deselect.call(this)},y.prototype.dblClick=function(L,G){V.prototype.dblClick.call(this,L,G),this.showTextEditor()},y.prototype.setColor=function(L){this.textElement&&ae.setAttributes(this.textElement,[["fill",L]]),this.color=L,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(L)},y.prototype.setFont=function(L){this.textElement&&ae.setAttributes(this.textElement,[["font-family",L]]),this.fontFamily=L,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},y.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},y.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text,wrapText:this.globalSettings.wrapText},V.prototype.getState.call(this));return L.typeName=y.typeName,L},y.prototype.restoreState=function(L){var G=L;this.color=G.color,this.fontFamily=G.fontFamily,this.padding=G.padding,this.text=G.text,this.createVisual(),V.prototype.restoreState.call(this,L),this.setSize(),this.globalSettings.wrapText&&this.renderText()},y.prototype.scale=function(L,G){V.prototype.scale.call(this,L,G),this.setSize(),this.sizeText(),this.positionTextEditor()},y.typeName="TextMarker",y.title="Text marker",y.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>',y}(Ye),Ce=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.color="transparent",K.lineWidth=3,K.drawing=!1,K.pixelRatio=1,K.color=q.defaultColor,K.lineWidth=q.defaultStrokeWidth,K.pixelRatio=q.freehandPixelRatio,K.setColor=K.setColor.bind(K),K.addCanvas=K.addCanvas.bind(K),K.finishCreation=K.finishCreation.bind(K),K.setLineWidth=K.setLineWidth.bind(K),K.colorPanel=new xe("Color",q.defaultColorSet,q.defaultColor),K.colorPanel.onColorChanged=K.setColor,K.lineWidthPanel=new ut("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.lineWidthPanel.onWidthChanged=K.setLineWidth,K}return ie(y,V),y.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.visual&&L!==this.drawingImage)},y.prototype.createVisual=function(){this.visual=ae.createGroup(),this.drawingImage=ae.createImage(),this.visual.appendChild(this.drawingImage);var L=ae.createTransform();this.visual.transform.baseVal.appendItem(L),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(L,G){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(L.x,L.y),this.drawing=!0):V.prototype.pointerDown.call(this,L,G)},y.prototype.manipulate=function(L){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(L.x,L.y),this.canvasContext.stroke()):V.prototype.manipulate.call(this,L)},y.prototype.resize=function(L){V.prototype.resize.call(this,L),ae.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ae.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},y.prototype.pointerUp=function(L){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):V.prototype.pointerUp.call(this,L)},y.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)},y.prototype.select=function(){this.state==="creating"&&this.finishCreation(),V.prototype.select.call(this)},y.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),V.prototype.deselect.call(this)},y.prototype.finishCreation=function(){for(var L=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),G=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],q=G[0],K=G[1],pe=G[2],Pe=G[3],it=!1,dt=0;dt<this.canvasElement.height;dt++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)L.data[dt*this.canvasElement.width*4+4*Ge+3]>0&&(it=!0,dt<K&&(K=dt),Ge<q&&(q=Ge),dt>Pe&&(Pe=dt),Ge>pe&&(pe=Ge));if(it){this.left=q/this.pixelRatio,this.top=K/this.pixelRatio,this.width=(pe-q)/this.pixelRatio,this.height=(Pe-K)/this.pixelRatio;var yt=document.createElement("canvas");yt.width=pe-q,yt.height=Pe-K,yt.getContext("2d").putImageData(this.canvasContext.getImageData(q,K,pe-q,Pe-K),0,0),this.drawingImgUrl=yt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},y.prototype.setDrawingImage=function(){ae.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ae.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},y.prototype.setColor=function(L){this.color=L,this.colorChanged(L)},y.prototype.setLineWidth=function(L){this.lineWidth=L},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=Object.assign({drawingImgUrl:this.drawingImgUrl},V.prototype.getState.call(this));return L.typeName=y.typeName,L},y.prototype.restoreState=function(L){this.createVisual(),V.prototype.restoreState.call(this,L),this.drawingImgUrl=L.drawingImgUrl,this.setDrawingImage()},y.prototype.scale=function(L,G){V.prototype.scale.call(this,L,G),this.setDrawingImage()},y.typeName="FreehandMarker",y.title="Freehand marker",y.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>',y}(Ye),_e=function(V){function y(L,G,q,K){var pe=V.call(this,L,q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>',K||"arrow-type-panel")||this;return pe.typeBoxes=[],pe.currentType=G,pe.setCurrentType=pe.setCurrentType.bind(pe),pe}return ie(y,V),y.prototype.getUi=function(){var L=this,G=document.createElement("div");G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2";for(var q=function(Pe){var it="both";switch(Pe){case 0:it="both";break;case 1:it="start";break;case 2:it="end";break;case 3:it="none"}var dt=document.createElement("div");if(dt.style.display="flex",dt.style.flexGrow="2",dt.style.alignItems="center",dt.style.justifyContent="space-between",dt.style.padding="5px",dt.style.borderWidth="2px",dt.style.borderStyle="solid",dt.style.borderColor=it===K.currentType?K.uiStyleSettings.toolboxAccentColor:"transparent",dt.addEventListener("click",function(){L.setCurrentType(it,dt)}),G.appendChild(dt),it==="both"||it==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.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="`+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ge.style.marginLeft="5px",dt.appendChild(Ge)}var yt=document.createElement("div");yt.style.display="flex",yt.style.alignItems="center",yt.style.minHeight="20px",yt.style.flexGrow="2";var Ft=document.createElement("hr");if(Ft.style.minWidth="20px",Ft.style.border="0px",Ft.style.borderTop="3px solid "+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee"),Ft.style.flexGrow="2",yt.appendChild(Ft),dt.appendChild(yt),it==="both"||it==="end"){var qt=document.createElement("div");qt.style.display="flex",qt.style.alignItems="center",qt.style.minHeight="20px",qt.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="`+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,qt.style.marginRight="5px",dt.appendChild(qt)}K.typeBoxes.push(dt)},K=this,pe=0;pe<4;pe++)q(pe);return G},y.prototype.setCurrentType=function(L,G){var q=this;this.currentType=L,this.typeBoxes.forEach(function(K){K.style.borderColor=K===G?q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},y}(de),Te=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.arrowType="end",K.arrowBaseHeight=10,K.arrowBaseWidth=10,K.getArrowPoints=K.getArrowPoints.bind(K),K.setArrowType=K.setArrowType.bind(K),K.arrowTypePanel=new _e("Arrow type","end"),K.arrowTypePanel.onArrowTypeChanged=K.setArrowType,K}return ie(y,V),y.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.arrow1&&L!==this.arrow2)},y.prototype.getArrowPoints=function(L,G){var q=this.arrowBaseWidth+2*this.strokeWidth,K=this.arrowBaseHeight+2*this.strokeWidth;return L-q/2+","+(G+K/2)+" "+L+","+(G-K/2)+" "+(L+q/2)+","+(G+K/2)},y.prototype.createTips=function(){this.arrow1=ae.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ae.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ae.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ae.createTransform()),this.visual.appendChild(this.arrow2)},y.prototype.pointerDown=function(L,G){V.prototype.pointerDown.call(this,L,G),this.state==="creating"&&this.createTips()},y.prototype.adjustVisual=function(){if(V.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",ae.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ae.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]);var L=0;Math.abs(this.x1-this.x2)>.1&&(L=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2));var G=this.arrow1.transform.baseVal.getItem(0);G.setRotate(L,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(G,0);var q=this.arrow2.transform.baseVal.getItem(0);q.setRotate(L+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(q,0)}},y.prototype.setArrowType=function(L){this.arrowType=L,this.adjustVisual(),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=Object.assign({arrowType:this.arrowType},V.prototype.getState.call(this));return L.typeName=y.typeName,L},y.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L);var G=L;this.arrowType=G.arrowType,this.createTips(),this.adjustVisual()},y.typeName="ArrowMarker",y.title="Arrow marker",y.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',y}(ht),ne=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.fillColor=q.defaultFillColor,K.strokeWidth=0,K.fillPanel=new xe("Color",q.defaultColorSet,q.defaultFillColor),K.fillPanel.onColorChanged=K.setFillColor,K}return ie(y,V),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=V.prototype.getState.call(this);return L.typeName=y.typeName,L},y.typeName="CoverMarker",y.title="Cover marker",y.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',y}(Ze),ue=function(V){function y(L,G,q,K,pe){var Pe=V.call(this,L,K||'<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>',pe||"opacity-panel")||this;return Pe.opacities=[],Pe.opacityBoxes=[],Pe.opacities=G,Pe.currentOpacity=q,Pe.setCurrentOpacity=Pe.setCurrentOpacity.bind(Pe),Pe}return ie(y,V),y.prototype.getUi=function(){var L=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",G.style.justifyContent="space-between",this.opacities.forEach(function(q){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="center",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=q===L.currentOpacity?L.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){L.setCurrentOpacity(q,K)}),G.appendChild(K);var pe=document.createElement("div");pe.innerText=100*q+"%",K.appendChild(pe),L.opacityBoxes.push(K)}),G},y.prototype.setCurrentOpacity=function(L,G){var q=this;this.currentOpacity=L,this.opacityBoxes.forEach(function(K){K.style.borderColor=K===G?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},y}(de),fe=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.setOpacity=K.setOpacity.bind(K),K.fillColor=q.defaultHighlightColor,K.strokeWidth=0,K.opacity=q.defaultHighlightOpacity,K.fillPanel=new xe("Color",q.defaultColorSet,K.fillColor),K.fillPanel.onColorChanged=K.setFillColor,K.opacityPanel=new ue("Opacity",q.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return ie(y,V),y.prototype.setOpacity=function(L){this.opacity=L,this.visual&&ae.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=V.prototype.getState.call(this);return L.typeName=y.typeName,L},y.typeName="HighlightMarker",y.title="Highlight marker",y.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>',y}(ne),me='<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>',we='<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>',Me=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.bgColor="transparent",K.tipPosition={x:0,y:0},K.tipBase1Position={x:0,y:0},K.tipBase2Position={x:0,y:0},K.tipMoving=!1,K.color=q.defaultStrokeColor,K.bgColor=q.defaultFillColor,K.fontFamily=q.defaultFontFamily,K.defaultSize={x:100,y:30},K.setBgColor=K.setBgColor.bind(K),K.getTipPoints=K.getTipPoints.bind(K),K.positionTip=K.positionTip.bind(K),K.setTipPoints=K.setTipPoints.bind(K),K.colorPanel=new xe("Text color",q.defaultColorSet,K.color,me,"text-color-panel"),K.colorPanel.onColorChanged=K.setColor,K.bgColorPanel=new xe("Fill color",q.defaultColorSet,K.bgColor,we,"fill-color-panel"),K.bgColorPanel.onColorChanged=K.setBgColor,K.fontFamilyPanel=new Ue("Font",q.defaultFontFamilies,q.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K.tipGrip=new Be,K.tipGrip.visual.transform.baseVal.appendItem(ae.createTransform()),K.controlBox.appendChild(K.tipGrip.visual),K}return ie(y,V),y.prototype.ownsTarget=function(L){return V.prototype.ownsTarget.call(this,L)||this.tipGrip.ownsTarget(L)||this.tip===L},y.prototype.createTip=function(){ae.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ae.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},y.prototype.pointerDown=function(L,G){this.state==="new"&&V.prototype.pointerDown.call(this,L,G),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(G)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):V.prototype.pointerDown.call(this,L,G)},y.prototype.pointerUp=function(L){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,V.prototype.pointerUp.call(this,L);else{var G=this.state==="creating";V.prototype.pointerUp.call(this,L),this.setTipPoints(G),this.positionTip()}},y.prototype.manipulate=function(L){if(this.tipMoving){var G=this.unrotatePoint(L);this.tipPosition={x:G.x-this.manipulationStartLeft,y:G.y-this.manipulationStartTop},this.positionTip()}else V.prototype.manipulate.call(this,L)},y.prototype.setBgColor=function(L){this.bgRectangle&&this.tip&&(ae.setAttributes(this.bgRectangle,[["fill",L]]),ae.setAttributes(this.tip,[["fill",L]])),this.bgColor=L,this.fillColorChanged(L)},y.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},y.prototype.setTipPoints=function(L){L===void 0&&(L=!1);var G=Math.min(this.height/2,15),q=this.height/5;L&&(this.tipPosition={x:G+q/2,y:this.height+20});var K=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?K<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(q=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:G,y:0},this.tipBase2Position={x:G+q,y:0}):(this.tipBase1Position={x:0,y:G},this.tipBase2Position={x:0,y:G+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?K<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(q=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-G-q,y:0},this.tipBase2Position={x:this.width-G,y:0}):(this.tipBase1Position={x:this.width,y:G},this.tipBase2Position={x:this.width,y:G+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?K<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(q=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-G-q,y:this.height},this.tipBase2Position={x:this.width-G,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-G-q},this.tipBase2Position={x:this.width,y:this.height-G}):K<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(q=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:G,y:this.height},this.tipBase2Position={x:G+q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-G},this.tipBase2Position={x:0,y:this.height-G-q})},y.prototype.resize=function(L){V.prototype.resize.call(this,L),this.positionTip()},y.prototype.positionTip=function(){ae.setAttributes(this.tip,[["points",this.getTipPoints()]]);var L=this.tipGrip.visual.transform.baseVal.getItem(0);L.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(L,0)},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),y.prototype.select=function(){this.positionTip(),V.prototype.select.call(this)},y.prototype.getState=function(){var L=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},V.prototype.getState.call(this));return L.typeName=y.typeName,L},y.prototype.restoreState=function(L){var G=L;this.bgColor=G.bgColor,this.tipPosition=G.tipPosition,V.prototype.restoreState.call(this,L),this.createTip(),this.setTipPoints()},y.prototype.scale=function(L,G){V.prototype.scale.call(this,L,G),this.tipPosition={x:this.tipPosition.x*L,y:this.tipPosition.y*G},this.positionTip()},y.typeName="CalloutMarker",y.title="Callout marker",y.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>',y}(Ve),je=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.fillColor=q.defaultFillColor,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.setOpacity=K.setOpacity.bind(K),K.createVisual=K.createVisual.bind(K),K.strokePanel=new xe("Line color",oe(q.defaultColorSet,["transparent"]),q.defaultColor,void 0,"stroke-color-panel"),K.strokePanel.onColorChanged=K.setStrokeColor,K.fillPanel=new xe("Fill color",oe(q.defaultColorSet,["transparent"]),K.fillColor,we,"fill-color-panel"),K.fillPanel.onColorChanged=K.setFillColor,K.strokeWidthPanel=new ut("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Qe("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K.opacityPanel=new ue("Opacity",q.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return ie(y,V),y.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.visual)},y.prototype.createVisual=function(){this.visual=ae.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)},y.prototype.pointerDown=function(L,G){V.prototype.pointerDown.call(this,L,G),this.state==="new"&&(this.createVisual(),this.moveVisual(L),this._state="creating")},y.prototype.manipulate=function(L){V.prototype.manipulate.call(this,L)},y.prototype.resize=function(L){V.prototype.resize.call(this,L),this.setSize()},y.prototype.setSize=function(){V.prototype.setSize.call(this),ae.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},y.prototype.pointerUp=function(L){V.prototype.pointerUp.call(this,L),this.setSize()},y.prototype.setStrokeColor=function(L){this.strokeColor=L,this.visual&&ae.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(L),this.stateChanged()},y.prototype.setFillColor=function(L){this.fillColor=L,this.visual&&ae.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(L),this.stateChanged()},y.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.visual&&ae.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},y.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.visual&&ae.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},y.prototype.setOpacity=function(L){this.opacity=L,this.visual&&ae.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this));return L.typeName=y.typeName,L},y.prototype.restoreState=function(L){var G=L;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.opacity=G.opacity,this.createVisual(),V.prototype.restoreState.call(this,L),this.setSize()},y.prototype.scale=function(L,G){V.prototype.scale.call(this,L,G),this.setSize()},y.typeName="EllipseMarker",y.title="Ellipse marker",y.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>',y}(Ye),qe=function(V){function y(L,G,q){return V.call(this,L,G,q)||this}return ie(y,V),Object.defineProperty(y.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),y.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.tip1&&L!==this.tip2)},y.prototype.createTips=function(){this.tip1=ae.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(ae.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ae.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(ae.createTransform()),this.visual.appendChild(this.tip2)},y.prototype.pointerDown=function(L,G){V.prototype.pointerDown.call(this,L,G),this.state==="creating"&&this.createTips()},y.prototype.adjustVisual=function(){if(V.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ae.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()]]),ae.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 L=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),G=this.tip1.transform.baseVal.getItem(0);G.setRotate(L,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(G,0);var q=this.tip2.transform.baseVal.getItem(0);q.setRotate(L+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(q,0)}},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=V.prototype.getState.call(this);return L.typeName=y.typeName,L},y.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L),this.createTips(),this.adjustVisual()},y.typeName="MeasurementMarker",y.title="Measurement marker",y.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>',y}(ht),ct=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.strokePanel.colors=q.defaultColorSet,K.fillColor="transparent",K}return ie(y,V),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=V.prototype.getState.call(this);return L.typeName=y.typeName,L},y.typeName="EllipseFrameMarker",y.title="Ellipse frame marker",y.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>',y}(je),et=function(){function V(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),V.prototype.addUndoStep=function(y){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(y)||(this.undoStack.push(y),JSON.stringify(this.lastRedoStep)!==JSON.stringify(y)&&this.redoStack.splice(0,this.redoStack.length))},V.prototype.replaceLastUndoStep=function(y){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=y)},V.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},V.prototype.undo=function(){if(this.undoStack.length>1){var y=this.undoStack.pop();return y!==void 0&&this.redoStack.push(y),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},V.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},V}(),kt=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.curveX=0,K.curveY=0,K.manipulationStartCurveX=0,K.manipulationStartCurveY=0,K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.positionGrips=K.positionGrips.bind(K),K.addControlGrips=K.addControlGrips.bind(K),K.adjustVisual=K.adjustVisual.bind(K),K.setupControlBox=K.setupControlBox.bind(K),K.resize=K.resize.bind(K),K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.strokePanel=new xe("Line color",q.defaultColorSet,q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new ut("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Qe("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return ie(y,V),y.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.visual&&L!==this.selectorCurve&&L!==this.visibleCurve&&!this.curveGrip.ownsTarget(L))},y.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},y.prototype.createVisual=function(){this.visual=ae.createGroup(),this.selectorCurve=ae.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ae.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)},y.prototype.pointerDown=function(L,G){V.prototype.pointerDown.call(this,L,G),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=L.x,this.curveY=L.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(G)&&(this.activeGrip=this.curveGrip,this._state="resize")},y.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),ae.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ae.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ae.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},y.prototype.setupControlBox=function(){V.prototype.setupControlBox.call(this),this.curveControlLine1=ae.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ae.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)},y.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,V.prototype.addControlGrips.call(this)},y.prototype.positionGrips=function(){V.prototype.positionGrips.call(this);var L=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-L/2,this.curveY-L/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()))},y.prototype.manipulate=function(L){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+L.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+L.y-this.manipulationStartY),V.prototype.manipulate.call(this,L)},y.prototype.resize=function(L){this.activeGrip===this.curveGrip&&(this.curveX=L.x,this.curveY=L.y),V.prototype.resize.call(this,L),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},y.prototype.setStrokeColor=function(L){this.strokeColor=L,this.adjustVisual(),this.colorChanged(L)},y.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.adjustVisual()},y.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.adjustVisual()},y.prototype.scale=function(L,G){this.curveX=this.curveX*L,this.curveY=this.curveY*G,V.prototype.scale.call(this,L,G)},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},V.prototype.getState.call(this));return L.typeName=y.typeName,L},y.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L);var G=L;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.curveX=G.curveX,this.curveY=G.curveY,this.createVisual(),this.adjustVisual()},y.typeName="CurveMarker",y.title="Curve marker",y.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>',y}(vt),Ct=function(V){function y(L,G,q){var K=V.call(this,L,G,q)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.textColor="transparent",K.fontSize="1rem",K.isMoved=!1,K.captionText="Caption",K.PADDING=5,K.captionBoxWidth=0,K.captionBoxHeight=0,K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.fillColor=q.defaultFillColor,K.textColor=q.defaultStrokeColor,K.fontFamily=q.defaultFontFamily,K.fontSize=q.defaultCaptionFontSize,K.captionText=q.defaultCaptionText,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.createVisual=K.createVisual.bind(K),K.sizeCaption=K.sizeCaption.bind(K),K.setCaptionText=K.setCaptionText.bind(K),K.showTextEditor=K.showTextEditor.bind(K),K.positionTextEditor=K.positionTextEditor.bind(K),K.finishTextEditing=K.finishTextEditing.bind(K),K.setFont=K.setFont.bind(K),K.setTextColor=K.setTextColor.bind(K),K.strokePanel=new xe("Line color",oe(q.defaultColorSet,["transparent"]),K.strokeColor,void 0,"stroke-color-panel"),K.strokePanel.onColorChanged=K.setStrokeColor,K.fillPanel=new xe("Fill color",oe(q.defaultColorSet,["transparent"]),K.fillColor,we,"fill-color-panel"),K.fillPanel.onColorChanged=K.setFillColor,K.strokeWidthPanel=new ut("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Qe("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K.fontFamilyPanel=new Ue("Font",q.defaultFontFamilies,q.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K.textColorPanel=new xe("Text color",q.defaultColorSet,K.textColor,me,"text-color-panel"),K.textColorPanel.onColorChanged=K.setTextColor,K}return ie(y,V),y.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.visual&&L!==this.frame&&L!==this.captionBg&&L!==this.captionElement)},y.prototype.createVisual=function(){this.visual=ae.createGroup(),this.addMarkerVisualToContainer(this.visual),this.captionBg=ae.createRect(1,1,[["fill",this.fillColor]]),this.visual.appendChild(this.captionBg),this.captionElement=ae.createText([["fill",this.textColor],["font-family",this.fontFamily]]),this.captionElement.style.fontSize=this.fontSize,this.captionElement.style.textAnchor="start",this.captionElement.style.dominantBaseline="text-before-edge",this.captionElement.textContent=this.captionText,this.visual.appendChild(this.captionElement),this.frame=ae.createRect(this.width,this.height,[["fill","transparent"],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray]]),this.visual.appendChild(this.frame),this.sizeCaption()},y.prototype.setCaptionText=function(L){this.captionText=L,this.captionElement.textContent=this.captionText,this.sizeCaption()},y.prototype.pointerDown=function(L,G){V.prototype.pointerDown.call(this,L,G),this.isMoved=!1,this.pointerDownPoint=L,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(L),this._state="creating")},y.prototype.manipulate=function(L){V.prototype.manipulate.call(this,L),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(L.x-this.pointerDownPoint.x)>5||Math.abs(L.y-this.pointerDownPoint.y)>5)},y.prototype.resize=function(L){V.prototype.resize.call(this,L),this.setSize()},y.prototype.sizeCaption=function(){var L=this.captionElement.getBBox();this.captionText.trim()!==""?(this.captionBoxWidth=L.width+2*this.PADDING,this.captionBoxHeight=L.height+2*this.PADDING):(this.captionBoxWidth=0,this.captionBoxHeight=0),ae.setAttributes(this.captionBg,[["width",this.captionBoxWidth.toString()],["height",this.captionBoxHeight.toString()],["clip-path","path('M0,0 H"+this.width+" V"+this.height+" H"+-this.width+" Z')"]]),ae.setAttributes(this.captionElement,[["x",this.PADDING.toString()],["y",this.PADDING.toString()],["clip-path","path('M0,0 H"+(this.width-this.PADDING)+" V"+this.height+" H"+(-this.width-this.PADDING)+" Z')"]])},y.prototype.showTextEditor=function(){var L=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.textEditBox=document.createElement("input"),this.textEditBox.style.position="absolute",this.textEditBox.style.width=this.width+"px",this.captionBoxHeight>0&&(this.textEditBox.style.height=this.captionBoxHeight+"px"),this.textEditBox.style.fontSize=this.fontSize,this.textEditBox.style.fontFamily=this.fontFamily,this.textEditBox.style.backgroundColor=this.fillColor,this.textEditBox.style.color=this.textColor,this.textEditBox.style.borderWidth="0",this.textEditBox.setAttribute("value",this.captionText),this.textEditBox.select(),this.textEditDiv.appendChild(this.textEditBox),this.overlayContainer.appendChild(this.textEditDiv),this.textEditBox.addEventListener("pointerup",function(G){G.stopPropagation()}),this.textEditBox.addEventListener("keypress",function(G){G.key==="Enter"&&L.finishTextEditing(L.textEditBox.value)}),this.textEditBox.addEventListener("keyup",function(G){G.cancelBubble=!0}),this.textEditBox.addEventListener("blur",function(){L.finishTextEditing(L.textEditBox.value)}),this.textEditDiv.addEventListener("pointerup",function(){L.finishTextEditing(L.textEditBox.value)}),this.positionTextEditor(),this.textEditBox.focus()},y.prototype.positionTextEditor=function(){this.state==="edit"&&(this.textEditBox===void 0?this.showTextEditor():(this.textEditBox.style.left=this.left+"px",this.textEditBox.style.top=this.top+"px",this.textEditBox.style.transform="rotate("+this.rotationAngle+"deg)",this.textEditBox.style.transformOrigin=this.width/2+"px "+this.height/2+"px"))},y.prototype.finishTextEditing=function(L){this.setCaptionText(L.trim()),this.overlayContainer.innerHTML="",this.stateChanged()},y.prototype.setFont=function(L){this.captionElement&&ae.setAttributes(this.captionElement,[["font-family",L]]),this.fontFamily=L,this.textEditBox&&(this.textEditBox.style.fontFamily=this.fontFamily),this.sizeCaption(),this.stateChanged()},y.prototype.setTextColor=function(L){this.captionElement&&ae.setAttributes(this.captionElement,[["fill",L]]),this.textColor=L,this.textEditBox&&(this.textEditBox.style.color=this.textColor),this.stateChanged()},y.prototype.setSize=function(){V.prototype.setSize.call(this),ae.setAttributes(this.frame,[["width",this.width.toString()],["height",this.height.toString()]]),this.sizeCaption()},y.prototype.pointerUp=function(L){V.prototype.pointerUp.call(this,L),this.setSize(),!this.isMoved&&Date.now()-this.pointerDownTimestamp>500&&this.showTextEditor(),this.pointerDownPoint=void 0},y.prototype.dblClick=function(L,G){V.prototype.dblClick.call(this,L,G),this.showTextEditor()},y.prototype.setStrokeColor=function(L){this.strokeColor=L,this.frame&&ae.setAttributes(this.frame,[["stroke",this.strokeColor]]),this.colorChanged(L),this.stateChanged()},y.prototype.setFillColor=function(L){this.fillColor=L,this.captionBg&&ae.setAttributes(this.captionBg,[["fill",this.fillColor]]),this.fillColorChanged(L),this.stateChanged()},y.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.frame&&ae.setAttributes(this.frame,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},y.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.frame&&ae.setAttributes(this.frame,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.fontFamilyPanel,this.textColorPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var L=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:1,textColor:this.textColor,fontFamily:this.fontFamily,fontSize:this.fontSize,captionText:this.captionText},V.prototype.getState.call(this));return L.typeName=this.typeName,L},y.prototype.restoreState=function(L){var G=L;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.textColor=G.textColor,this.fontFamily=G.fontFamily,this.captionText=G.captionText,this.fontSize=G.fontSize,this.createVisual(),V.prototype.restoreState.call(this,L),this.setSize()},y.prototype.scale=function(L,G){V.prototype.scale.call(this,L,G),this.setSize()},y.typeName="CaptionFrameMarker",y.title="Caption frame marker",y.icon='<svg viewBox="0 0 24 24"><path d="M5 3c-1.11 0-2 .89-2 2v14c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2H5m0 2h14v14H5V5m2 2v2h10V7H7z"/></svg>',y}(Ye),pt=function(){function V(y,L){L===void 0&&(L=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=y,this.cancelable=L}return Object.defineProperty(V.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),V.prototype.preventDefault=function(){this._defaultPrevented=!0},V}(),Nt=function(V){function y(L,G,q){var K=V.call(this,L,!1)||this;return K.dataUrl=G,K.state=q,K}return ie(y,V),y}(pt),Et=function(V){function y(L,G,q){q===void 0&&(q=!1);var K=V.call(this,L,q)||this;return K.marker=G,K}return ie(y,V),y}(pt),wt=function(){function V(){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 V.prototype.addEventListener=function(y,L){this[y].push(L)},V.prototype.removeEventListener=function(y,L){var G=this[y].indexOf(L);G>-1&&this[y].splice(G,1)},V}(),Ht=function(){function V(y){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ne,this._isOpen=!1,this.undoRedoManager=new et,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 wt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=V.instanceCounter++,this.styles=new Xe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=y,this.targetRoot=document.body,this.width=y.clientWidth,this.height=y.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),this.addMarkerEvents=this.addMarkerEvents.bind(this)}return Object.defineProperty(V.prototype,"ALL_MARKER_TYPES",{get:function(){return[st,Ce,Te,Ve,ct,je,fe,Me,qe,ne,ht,kt,Ct]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[st,Ce,Te,Ve,je,fe,Me]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"BASIC_MARKER_TYPES",{get:function(){return[st,Ce,Te,Ve,fe]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(y){var L=this;this._availableMarkerTypes.splice(0),y.forEach(function(G){if(typeof G=="string"){var q=L.ALL_MARKER_TYPES.find(function(K){return K.typeName===G});q!==void 0&&L._availableMarkerTypes.push(q)}else L._availableMarkerTypes.push(G)})},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(y){this._zoomLevel=y,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(V.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),V.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Ee.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},V.prototype.show=function(){var y=this;this.styles.styleSheetRoot===void 0&&Fe.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Fe.styleSheetRoot),this.markers.splice(0),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(L){return L(new pt(y))})},V.prototype.render=function(){return re(this,void 0,void 0,function(){var y;return he(this,function(L){switch(L.label){case 0:return this.setCurrentMarker(),(y=new Le).naturalSize=this.renderAtNaturalSize,y.imageType=this.renderImageType,y.imageQuality=this.renderImageQuality,y.markersOnly=this.renderMarkersOnly,y.width=this.renderWidth,y.height=this.renderHeight,[4,y.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return L.sent(),[4,y.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,L.sent()]}})})},V.prototype.close=function(y){var L=this;if(y===void 0&&(y=!1),this.isOpen){var G=!1;y||this.eventListeners.beforeclose.forEach(function(q){var K=new pt(L,!0);q(K),K.defaultPrevented&&(G=!0)}),G||(this.coverDiv&&this.closeUI(),this.targetObserver&&(this.targetObserver.unobserve(this.target),this.targetObserver.unobserve(this.editorCanvas)),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(q){return q(new pt(L))}),this.detachEvents(),this._isOpen=!1)}},V.prototype.addMarkersToToolbar=function(){for(var y,L=[],G=0;G<arguments.length;G++)L[G]=arguments[G];(y=this._availableMarkerTypes).push.apply(y,L)},V.prototype.addRenderEventListener=function(y){this.addEventListener("render",function(L){y(L.dataUrl,L.state)})},V.prototype.removeRenderEventListener=function(y){},V.prototype.addCloseEventListener=function(y){this.addEventListener("close",function(){y()})},V.prototype.removeCloseEventListener=function(y){},V.prototype.setupResizeObserver=function(){var y=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){y.resize(y.target.clientWidth,y.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return y.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},V.prototype.onPopupTargetResize=function(){var y=1*this.target.clientWidth/this.target.clientHeight,L=this.editorCanvas.clientWidth/y>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*y:this.editorCanvas.clientWidth,G=L<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/y;this.resize(L,G)},V.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},V.prototype.resize=function(y,L){this._isResizing=!0;var G=y/this.imageWidth,q=L/this.imageHeight;this.imageWidth=Math.round(y),this.imageHeight=Math.round(L),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(G,q),this._isResizing=!1},V.prototype.scaleMarkers=function(y,L){var G,q=this;this._currentMarker&&this._currentMarker instanceof Ve?this._currentMarker.scale(y,L):(G=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(K){K!==q._currentMarker&&K.scale(y,L)}),G!==void 0&&this.setCurrentMarker(G)},V.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"},V.prototype.setTopLeft=function(){var y=this.editingTarget.getBoundingClientRect(),L=this.editorCanvas.getBoundingClientRect();this.left=y.left-L.left,this.top=y.top-L.top},V.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)},V.prototype.addDefs=function(){for(var y,L=[],G=0;G<arguments.length;G++)L[G]=arguments[G];this.defs=ae.createDefs(),this.addDefsToImage(),(y=this.defs).append.apply(y,L)},V.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},V.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)},V.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},V.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("touchmove",function(y){return y.preventDefault()}),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},V.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)},V.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},V.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)},V.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 y=document.createElement("a");y.href="https://markerjs.com/",y.target="_blank",y.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>',y.title="Powered by marker.js",y.style.display="grid",y.style.alignItems="center",y.style.justifyItems="center",y.style.padding="3px",y.style.width="20px",y.style.height="20px",this.logoUI.appendChild(y),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},V.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")},V.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"},V.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},V.prototype.showUI=function(){var y;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 L=this.settings.uiOffsetTop!==void 0?this.target.offsetTop+this.settings.uiOffsetTop:this.target.offsetTop>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0,G=this.target.offsetLeft+((y=this.settings.uiOffsetLeft)!==null&&y!==void 0?y:0);this.coverDiv.style.top=L+"px",this.coverDiv.style.left=G+"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="fixed",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.settings.displayMode==="popup"&&(this.uiDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px"),this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Oe(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.settings.displayMode==="inline"&&this.settings.uiOffsetTop===void 0&&this.target.offsetTop<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Ke(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},V.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv),this.coverDiv.remove(),this.coverDiv=null},V.prototype.removeMarker=function(y){this.markerImage.removeChild(y.container),this.markers.indexOf(y)>-1&&this.markers.splice(this.markers.indexOf(y),1),y.dispose()},V.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())},V.prototype.toolbarButtonClicked=function(y,L){if(y==="marker"&&L!==void 0)this.createNewMarker(L);else if(y==="action")switch(L){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()}},V.prototype.deleteSelectedMarker=function(){var y=this;if(this._currentMarker!==void 0&&this._currentMarker.state==="select"){var L=!1;if(this.eventListeners.markerbeforedelete.forEach(function(q){var K=new Et(y,y._currentMarker,!0);q(K),K.defaultPrevented&&(L=!0)}),!L){var G=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(q){return q(new Et(y,G))})}}},V.prototype.clear=function(){var y=this,L=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(pe){var Pe=new Et(y,void 0,!0);pe(Pe),Pe.defaultPrevented&&(L=!0)}),!L)){this.setCurrentMarker();for(var G=function(pe){var Pe=q.markers[pe];q.setCurrentMarker(q.markers[pe]),q._currentMarker.dispose(),q.markerImage.removeChild(q._currentMarker.container),q.markers.splice(q.markers.indexOf(q._currentMarker),1),q.eventListeners.markerdelete.forEach(function(it){return it(new Et(y,Pe))})},q=this,K=this.markers.length-1;K>=0;K--)G(K);this.addUndoStep()}},Object.defineProperty(V.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),V.prototype.showNotesEditor=function(){var y;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=(y=this._currentMarker.notes)!==null&&y!==void 0?y:"",this.overlayContainer.appendChild(this.notesArea))},V.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)},V.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},V.prototype.addUndoStep=function(){var y=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var L=this.getState(),G=this.undoRedoManager.getLastUndoStep();if(!G||G.width===L.width&&G.height===L.height){var q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(L),q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(K){return K(new pt(y))})}else this.undoRedoManager.replaceLastUndoStep(L)}},V.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},V.prototype.undoStep=function(){var y=this,L=this.undoRedoManager.undo();L!==void 0&&(this.restoreState(L),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new pt(y))}))},V.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},V.prototype.redoStep=function(){var y=this,L=this.undoRedoManager.redo();L!==void 0&&(this.restoreState(L),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new pt(y))}))},V.prototype.stepZoom=function(){var y=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=y<this.zoomSteps.length-1?this.zoomSteps[y+1]:this.zoomSteps[0]},V.prototype.panTo=function(y){this.contentDiv.scrollBy({left:this.prevPanPoint.x-y.x,top:this.prevPanPoint.y-y.y}),this.prevPanPoint=y},V.prototype.startRenderAndClose=function(){return re(this,void 0,void 0,function(){var y,L,G=this;return he(this,function(q){switch(q.label){case 0:return[4,this.render()];case 1:return y=q.sent(),L=this.getState(),this.eventListeners.render.forEach(function(K){return K(new Nt(G,y,L))}),this.close(!0),[2]}})})},V.prototype.getState=function(y){y===!0&&this.setCurrentMarker();var L={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(G){return L.markers.push(G.getState())}),L},V.prototype.restoreState=function(y){var L=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);y.markers.forEach(function(G){var q=L._availableMarkerTypes.find(function(pe){return pe.typeName===G.typeName});if(q!==void 0){var K=L.addNewMarker(q);K.restoreState(G),L.addMarkerEvents(K),L.markers.push(K)}}),y.width&&y.height&&(y.width!==this.imageWidth||y.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/y.width,this.imageHeight/y.height),this.eventListeners.restorestate.forEach(function(G){return G(new pt(L))})},V.prototype.addNewMarker=function(y){var L=ae.createGroup();return this.markerImage.appendChild(L),new y(L,this.overlayContainer,this.settings)},V.prototype.createNewMarker=function(y){var L,G=this;(L=typeof y=="string"?this._availableMarkerTypes.find(function(q){return q.typeName===y}):y)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(L),this.addMarkerEvents(this._currentMarker),this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(L.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(q){return q(new Et(G,G._currentMarker))}))},V.prototype.addMarkerEvents=function(y){y.onMarkerCreated=this.markerCreated,y.onColorChanged=this.colorChanged,y.onFillColorChanged=this.fillColorChanged,y.onStateChanged=this.markerStateChanged},V.prototype.markerCreated=function(y){var L=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(y),this.setCurrentMarker(y),y instanceof Ce&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ce):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(G){return G(new Et(L,y))})},V.prototype.colorChanged=function(y){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=y,this.settings.defaultStrokeColor=y)},V.prototype.fillColorChanged=function(y){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=y)},V.prototype.markerStateChanged=function(y){var L=this;this.eventListeners.markerchange.forEach(function(G){return G(new Et(L,y))})},V.prototype.setCurrentMarker=function(y){var L=this;this._currentMarker!==y&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(G){return G(new Et(L,L._currentMarker))})),this._currentMarker=y,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(G){return G(new Et(L,L._currentMarker))}))},V.prototype.onPointerDown=function(y){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||y.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var L=this.markers.find(function(G){return G.ownsTarget(y.target)});L!==void 0?(this.setCurrentMarker(L),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(y.clientX,y.clientY),y.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:y.clientX,y:y.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(y.clientX,y.clientY))},V.prototype.onDblClick=function(y){if(this._isFocused||this.focus(),this.mode==="select"){var L=this.markers.find(function(G){return G.ownsTarget(y.target)});L!==void 0&&L!==this._currentMarker&&this.setCurrentMarker(L),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(y.clientX,y.clientY),y.target):this.setCurrentMarker()}},V.prototype.onPointerMove=function(y){this.touchPoints!==1&&y.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||y.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(y.clientX,y.clientY)):this.zoomLevel>1&&this.panTo({x:y.clientX,y:y.clientY}))},V.prototype.onPointerUp=function(y){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(y.clientX,y.clientY)),this.isDragging=!1,this.addUndoStep()},V.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},V.prototype.onKeyUp=function(y){this._currentMarker===void 0||this.notesArea!==void 0||y.key!=="Delete"&&y.key!=="Backspace"||this.deleteSelectedMarker()},V.prototype.clientToLocalCoordinates=function(y,L){var G=this.markerImage.getBoundingClientRect(),q=G.width/this.imageWidth/this.zoomLevel,K=G.height/this.imageHeight/this.zoomLevel;return{x:(y-G.left)/this.zoomLevel/q,y:(L-G.top)/this.zoomLevel/K}},V.prototype.onWindowResize=function(){this.positionUI()},V.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var y=this.target.getClientRects(),L=y.length>0&&y.item(0)&&y.item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=L+"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()},V.prototype.addLicenseKey=function(y){Ee.addKey(y)},V.prototype.addEventListener=function(y,L){this.eventListeners.addEventListener(y,L)},V.prototype.removeEventListener=function(y,L){this.eventListeners.removeEventListener(y,L)},V.prototype.renderState=function(y){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(y),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(V.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),V.prototype.focus=function(){var y=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(L){return L(new pt(y))}))},V.prototype.blur=function(){var y=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(L){return L(new pt(y))}))},V.instanceCounter=0,V}();/* **********************************
|
|
cropro version 1.6.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 It=function(V,y){return(It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,G){L.__proto__=G}||function(L,G){for(var q in G)Object.prototype.hasOwnProperty.call(G,q)&&(L[q]=G[q])})(V,y)};function rr(V,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function L(){this.constructor=V}It(V,y),V.prototype=y===null?Object.create(y):(L.prototype=y.prototype,new L)}function Rr(V,y,L,G){return new(L||(L=Promise))(function(q,K){function pe(dt){try{it(G.next(dt))}catch(Ge){K(Ge)}}function Pe(dt){try{it(G.throw(dt))}catch(Ge){K(Ge)}}function it(dt){var Ge;dt.done?q(dt.value):(Ge=dt.value,Ge instanceof L?Ge:new L(function(yt){yt(Ge)})).then(pe,Pe)}it((G=G.apply(V,y||[])).next())})}function ar(V,y){var L,G,q,K,pe={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return K={next:Pe(0),throw:Pe(1),return:Pe(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function Pe(it){return function(dt){return function(Ge){if(L)throw new TypeError("Generator is already executing.");for(;pe;)try{if(L=1,G&&(q=2&Ge[0]?G.return:Ge[0]?G.throw||((q=G.return)&&q.call(G),0):G.next)&&!(q=q.call(G,Ge[1])).done)return q;switch(G=0,q&&(Ge=[2&Ge[0],q.value]),Ge[0]){case 0:case 1:q=Ge;break;case 4:return pe.label++,{value:Ge[1],done:!1};case 5:pe.label++,G=Ge[1],Ge=[0];continue;case 7:Ge=pe.ops.pop(),pe.trys.pop();continue;default:if(!(q=pe.trys,(q=q.length>0&&q[q.length-1])||Ge[0]!==6&&Ge[0]!==2)){pe=0;continue}if(Ge[0]===3&&(!q||Ge[1]>q[0]&&Ge[1]<q[3])){pe.label=Ge[1];break}if(Ge[0]===6&&pe.label<q[1]){pe.label=q[1],q=Ge;break}if(q&&pe.label<q[2]){pe.label=q[2],pe.ops.push(Ge);break}q[2]&&pe.ops.pop(),pe.trys.pop();continue}Ge=y.call(V,pe)}catch(yt){Ge=[6,yt],G=0}finally{L=q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([it,dt])}}}var xr=function(){function V(){}return V.addKey=function(y){V.key=y},Object.defineProperty(V,"isLicensed",{get:function(){return!!V.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(V.key)},enumerable:!1,configurable:!0}),V}(),tt=function(){function V(){}return V.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},V.setAttributes=function(y,L){for(var G=0,q=L;G<q.length;G++){var K=q[G],pe=K[0],Pe=K[1];y.setAttribute(pe,Pe)}},V.createRect=function(y,L,G){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",y.toString()),q.setAttribute("height",L.toString()),G&&V.setAttributes(q,G),q},V.createLine=function(y,L,G,q,K){var pe=document.createElementNS("http://www.w3.org/2000/svg","line");return pe.setAttribute("x1",y.toString()),pe.setAttribute("y1",L.toString()),pe.setAttribute("x2",G.toString()),pe.setAttribute("y2",q.toString()),K&&V.setAttributes(pe,K),pe},V.createPolygon=function(y,L){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",y),L&&V.setAttributes(G,L),G},V.createCircle=function(y,L){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(y/2).toString()),G.setAttribute("cy",(y/2).toString()),G.setAttribute("r",y.toString()),L&&V.setAttributes(G,L),G},V.createEllipse=function(y,L,G){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(y/2).toString()),q.setAttribute("cy",(L/2).toString()),q.setAttribute("rx",(y/2).toString()),q.setAttribute("ry",(L/2).toString()),G&&V.setAttributes(q,G),q},V.createGroup=function(y){var L=document.createElementNS("http://www.w3.org/2000/svg","g");return y&&V.setAttributes(L,y),L},V.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},V.createMarker=function(y,L,G,q,K,pe,Pe){var it=document.createElementNS("http://www.w3.org/2000/svg","marker");return V.setAttributes(it,[["id",y],["orient",L],["markerWidth",G.toString()],["markerHeight",q.toString()],["refX",K.toString()],["refY",pe.toString()]]),it.appendChild(Pe),it},V.createText=function(y){var L=document.createElementNS("http://www.w3.org/2000/svg","text");return L.setAttribute("x","0"),L.setAttribute("y","0"),y&&V.setAttributes(L,y),L},V.createTSpan=function(y,L){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=y,L&&V.setAttributes(G,L),G},V.createImage=function(y){var L=document.createElementNS("http://www.w3.org/2000/svg","image");return y&&V.setAttributes(L,y),L},V.createPoint=function(y,L){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=y,G.y=L,G},V.createPath=function(y,L){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",y),L&&V.setAttributes(G,L),G},V.createElement=function(y,L){var G=document.createElementNS("http://www.w3.org/2000/svg",y);return L&&V.setAttributes(G,L),G},V.getHollowRectanglePath=function(y,L,G,q,K,pe,Pe,it){return"M"+y+","+L+"V"+(L+q)+"H"+(y+G)+"V"+L+"H"+K+"V"+pe+"H"+(K+Pe)+"V"+(pe+it)+"H"+K+"V"+L+"Z"},V}(),At=function(){function V(y){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+y+"_"}return Object.defineProperty(V.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(V.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(V.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),V.prototype.addClass=function(y){return this.styleSheet===void 0&&this.addStyleSheet(),y.name=""+this.classNamePrefix+y.localName,this.classes.push(y),this.styleSheet.sheet.insertRule("."+y.name+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length),y},V.prototype.addRule=function(y){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(y),this.styleSheet.sheet.insertRule(y.selector+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length)},V.prototype.addStyleSheet=function(){var y;this.styleSheet=document.createElement("style"),((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).appendChild(this.styleSheet),this.addRule(new Lt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Lt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Lt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Ut("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Ut("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},V.prototype.removeStyleSheet=function(){var y;this.styleSheet&&(((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},V}(),Lt=function(V,y){this.selector=V,this.style=y},Ut=function(V,y){this.localName=V,this.style=y},fr=function(){function V(){this.blocks=[],this.display=""}return V.prototype.addButtonBlock=function(y){y.className=this.blockClassName,y.buttonClassName=this.buttonClassName,y.buttonColorsClassName=this.buttonColorsClassName,y.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(y)},V.prototype.addElementBlock=function(y){y.className===void 0&&(y.className=this.blockClassName),this.blocks.push(y)},V.prototype.getUI=function(){var y=document.createElement("div");return y.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,y.style.display=this.display,this.blocks.forEach(function(L){return y.appendChild(L.getUI())}),y},V}(),Yt=function(){function V(){}return V.prototype.getUI=function(){var y=document.createElement("div");if(y.className=this.className,this.minWidth!==void 0&&(y.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":y.style.justifyContent="flex-start";break;case"center":y.style.justifyContent="center";break;case"end":y.style.justifyContent="flex-end"}return y.style.whiteSpace="nowrap",y},V}(),mt=function(V){function y(){var L=V!==null&&V.apply(this,arguments)||this;return L.buttons=[],L}return rr(y,V),y.prototype.addButton=function(L){L.className=this.buttonClassName,L.colorsClassName=this.buttonColorsClassName,L.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(L)},y.prototype.getUI=function(){var L=V.prototype.getUI.call(this);return this.buttons.forEach(function(G){return L.appendChild(G.getUI())}),L},y}(Yt),sr=function(){function V(y,L){this._isActive=!1,this._isHidden=!1,this._icon=y,this.title=L,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(V.prototype,"icon",{get:function(){return this._icon},set:function(y){this._icon=y,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isActive",{get:function(){return this._isActive},set:function(y){this._isActive=y,this.adjustClassName()},enumerable:!1,configurable:!0}),V.prototype.getUI=function(){var y=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.setAttribute("role","button"),this.buttonContainer.setAttribute("aria-label",this.title),this.buttonContainer.setAttribute("data-action",this.title),this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return y.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},V.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,"")))},V.prototype.hide=function(){this._isHidden=!0},V}(),Qt=function(V){function y(){var L=V!==null&&V.apply(this,arguments)||this;return L.elements=[],L}return rr(y,V),y.prototype.addElement=function(L){this.elements.push(L)},y.prototype.getUI=function(){var L=V.prototype.getUI.call(this);return this.elements.forEach(function(G){return L.appendChild(G)}),L},y}(Yt),Jt=function(){function V(y,L){this.horizontal=y,this.vertical=L}return Object.defineProperty(V.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),V.prototype.getVerticalLength=function(y){return y/this.ratio},V.prototype.getHorizontalLength=function(y){return y*this.ratio},V}(),Dt=function(){function V(){}return V.getIcon=function(y,L){if(y>0&&L>0){var G=new Jt(y,L),q=G.ratio>=1?20:G.getHorizontalLength(20),K=G.ratio<1?20:G.getVerticalLength(20),pe=document.createElementNS("http://www.w3.org/2000/svg","svg");pe.setAttribute("xmlns","http://www.w3.org/2000/svg"),pe.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(pe);var Pe=tt.createDefs();pe.appendChild(Pe);var it=tt.createElement("clipPath",[["id","text-bg-clip"]]);Pe.appendChild(it);var dt=tt.createPath(tt.getHollowRectanglePath((24-q)/2,(24-K)/2,q,K,(24-q)/2+2,(24-K)/2+2,q-4,K-4));pe.appendChild(dt);var Ge=tt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(tt.createTSpan(y+":"+L)),pe.appendChild(Ge);var yt=Ge.getBBox();tt.setAttributes(Ge,[["x",((24-yt.width)/2).toString()],["y",((24-yt.height)/2-yt.y).toString()]]);var Ft=tt.createPath(tt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(yt.width))/2,(24-Math.ceil(yt.height))/2,Math.ceil(yt.width),Math.ceil(yt.height)));return it.appendChild(Ft),tt.setAttributes(dt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(pe),pe.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>'},V}(),dr=function(V){function y(L,G,q){var K=V.call(this,L,G)||this;return K.isDropdownOpen=!1,K.onClick=K.dropdownButtonClicked,K.dropdownButtons=q,K}return rr(y,V),y.prototype.setupDropdown=function(){var L=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(G){G.className=L.className,G.colorsClassName=L.colorsClassName,L.dropdownBlock.appendChild(G.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},y.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},y.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},y.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},y.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},y.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},y}(sr),yr=function(){function V(y,L){this.GRIP_SIZE=10,this.color=y,this.fillColor=L,this.visual=tt.createGroup(),this.visual.appendChild(tt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(tt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return V.prototype.ownsTarget=function(y){return y===this.visual||y===this.visual.childNodes[0]||y===this.visual.childNodes[1]},V.prototype.setCenter=function(y,L){this.visual.childNodes.forEach(function(G){return tt.setAttributes(G,[["cx",y.toString()],["cy",L.toString()]])})},V}(),Yr=function(){function V(y,L,G,q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this._zoomToCropEnabled=!1,this.cropRectChanged=!1,this.canvasWidth=y,this.canvasHeight=L,this.margin=G,this.container=q,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(V.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(y){this._aspectRatio=y,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(y){this._isGridVisible=y,this.gridContainer&&tt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(y){this._zoomFactor=y,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomToCropEnabled",{set:function(y){this._zoomToCropEnabled=y},enumerable:!1,configurable:!0}),V.prototype.open=function(){var y=this;this.cropShadeElement=tt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=tt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var L=0;L<this.numberOfGridLines;L++)this.horizontalGridLines.push(tt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(tt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(G){return y.gridContainer.appendChild(G)}),this.verticalGridLines.forEach(function(G){return y.gridContainer.appendChild(G)}),this.cropRectElement=tt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new yr(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new yr(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new yr(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new yr(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},V.prototype.setCropRectangle=function(y){this.cropRect=y;var L=Object.assign({},this.cropRect);this._zoomToCropEnabled&&(L.width=this.cropRect.width*this.zoomFactor,L.height=this.cropRect.height*this.zoomFactor,L.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-L.width/2,L.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-L.height/2),tt.setAttributes(this.cropRectElement,[["x",L.x.toString()],["y",L.y.toString()],["width",L.width.toString()],["height",L.height.toString()]]);var G=L.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(K,pe){var Pe=L.y+G*(pe+1);tt.setAttributes(K,[["x1",""+L.x],["y1",""+Pe],["x2",""+(L.x+L.width)],["y2",""+Pe]])});var q=L.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(K,pe){var Pe=L.x+q*(pe+1);tt.setAttributes(K,[["x1",""+Pe],["y1",""+L.y],["x2",""+Pe],["y2",""+(L.y+L.height)]])}),tt.setAttributes(this.cropShadeElement,[["d",tt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,L.x,L.y,L.width,L.height)]]),this.topLeftGrip.setCenter(L.x,L.y),this.topRightGrip.setCenter(L.x+L.width,L.y),this.bottomLeftGrip.setCenter(L.x,L.y+L.height),this.bottomRightGrip.setCenter(L.x+L.width,L.y+L.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},V.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)},V.prototype.clientToLocalCoordinates=function(y,L){var G=this.container.getBoundingClientRect();return{x:y-G.left+this.margin,y:L-G.top+this.margin}},V.prototype.onPointerDown=function(y){this.container.setPointerCapture(y.pointerId),this.previousPoint=this.clientToLocalCoordinates(y.clientX,y.clientY),this.cropRectElement===y.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(y.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(y.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(y.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(y.target)&&(this.activeGrip=this.bottomRightGrip)},V.prototype.onPointerMove=function(y){if(this.isMoving)this.move(this.clientToLocalCoordinates(y.clientX,y.clientY));else if(this.activeGrip){var L=this.clientToLocalCoordinates(y.clientX,y.clientY);this.resize(L)}y.preventDefault()},V.prototype.onPointerUp=function(y){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(y.pointerId)},V.prototype.move=function(y){var L=y.x-this.previousPoint.x,G=y.y-this.previousPoint.y;this.zoomFactor!==1&&(L=-L/this.zoomFactor,G=-G/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+L),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+G),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=y},V.prototype.resize=function(y){var L=Object.assign({},this.cropRect),G=y.x-this.previousPoint.x,q=y.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:L.x+G<this.margin&&(G=this.margin-L.x),L.x+=G,L.width=this.cropRect.x+this.cropRect.width-L.x;break;case this.bottomRightGrip:case this.topRightGrip:L.width+G>this.canvasWidth*this.zoomFactor&&(G=this.canvasWidth*this.zoomFactor-L.width),L.width+=G}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(L.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(G),L.height=this.aspectRatio.getVerticalLength(L.width)):(L.y+=q,L.height=this.cropRect.y+this.cropRect.height-L.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?L.height=this.aspectRatio.getVerticalLength(L.width):L.height+=q}L.width<10&&(L.x=this.cropRect.x,L.width=10),L.height<10&&(L.y=this.cropRect.y,L.height=10),this.previousPoint=y,L.x>=this.margin&&L.y>=this.margin&&Math.floor(L.x-this.margin+L.width)<=Math.ceil(this.canvasWidth)&&Math.floor(L.y-this.margin+L.height)<=Math.ceil(this.canvasHeight)&&(this.cropRect=L,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},V.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var y=this.cropRect.x+this.cropRect.width/2,L=this.cropRect.y+this.cropRect.height/2,G=this.aspectRatio.getHorizontalLength(this.cropRect.height),q=this.aspectRatio.getVerticalLength(this.cropRect.width);G/this.canvasWidth<q/this.canvasHeight?this.cropRect.width=G:this.cropRect.height=q,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=y-this.cropRect.width/2,this.cropRect.y=L-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)}},V.prototype.getRescaledRect=function(y,L,G,q,K,pe){var Pe=G/y,it=q/L;return{x:(K.x-pe)*Pe+pe,y:(K.y-pe)*it+pe,width:K.width*Pe,height:K.height*it}},V.prototype.scaleCanvas=function(y,L){var G=this.getRescaledRect(this.canvasWidth,this.canvasHeight,y,L,this.cropRect,this.margin);this.canvasWidth=y,this.canvasHeight=L,this.onCropChange&&this.onCropChange(G),this.setCropRectangle(G)},V}(),Je=function(){function V(y){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=y,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(V.prototype,"angle",{get:function(){return this._angle},set:function(y){this._angle=y,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),V.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.setAttribute("role","button"),this.controlContainer.setAttribute("aria-label",this.title),this.controlContainer.setAttribute("data-action",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},V.prototype.onPointerDown=function(y){this.controlContainer.setPointerCapture(y.pointerId),this.isDragging=!0,this.previousPoint={x:y.clientX,y:y.clientY}},V.prototype.onPointerMove=function(y){this.isDragging&&(this.onAngleChange&&this.onAngleChange((y.clientX-this.previousPoint.x)/5),this.previousPoint.x=y.clientX)},V.prototype.onPointerUp=function(y){this.isDragging&&this.onAngleChange&&this.onAngleChange((y.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(y.pointerId)},V.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var y=this.angleLabelText.getBBox();tt.setAttributes(this.angleLabelElement,[["x",((this.width-y.width)/2).toString()],["y",(this.height/2).toString()]])}},V.prototype.positionScaleShape=function(){if(this.scaleShape){var y=this.scaleShape.transform.baseVal.getItem(0);y.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(y,0)}},V.prototype.getVisual=function(){var y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("xmlns","http://www.w3.org/2000/svg"),y.setAttribute("width",this.width+"px"),y.setAttribute("height",this.height+"px"),y.setAttribute("viewBox","0 0 "+this.width+" "+this.height),y.style.flexShrink="0",document.body.appendChild(y);for(var L="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,G=1;G<=this.width/5+10;G++){var q=G%5==0?this.height/3:this.height/6;L+="h4v"+-q+"h1v"+q}L+="v1H0Z",this.scaleShape=tt.createPath(L);var K=tt.createTransform();this.scaleShape.transform.baseVal.appendItem(K),y.appendChild(this.scaleShape),this.angleLabelElement=tt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=tt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var pe=tt.createTSpan("");return pe.innerHTML="°",this.angleLabelElement.appendChild(pe),y.appendChild(this.angleLabelElement),document.body.removeChild(y),y},V}(),nt=function(){function V(){this.naturalSize=!1,this.imageType="image/png",this.rasterize=this.rasterize.bind(this)}return V.prototype.rasterize=function(y,L,G,q,K,pe,Pe){var it=this;return new Promise(function(dt){var Ge=document.createElement("canvas");Ge.width=y.width.baseVal.value-2*q,Ge.height=y.height.baseVal.value-2*q;var yt=1,Ft=1;if(it.naturalSize===!0?(yt=Math.abs(L.naturalWidth/(y.width.baseVal.value-2*q)/pe),Ft=Math.abs(L.naturalHeight/(y.height.baseVal.value-2*q)/Pe),Ge.width=Math.abs(L.naturalWidth/pe),Ge.height=Math.abs(L.naturalHeight/Pe)):it.width!==void 0&&it.height!==void 0&&(yt=it.width/G.width,Ft=it.height/G.height,Ge.width*=yt,Ge.height*=Ft),it.maxSize!==void 0&&Ge.width*Ge.height>=it.maxSize){var qt=Ge.width*Ge.height,Zr=Math.sqrt(it.maxSize/qt);yt*=Zr,Ft*=Zr,Ge.width*=Zr,Ge.height*=Zr}var Fr=Ge.getContext("2d");Fr.translate(Ge.width/2,Ge.height/2),Fr.rotate(K*Math.PI/180),Fr.scale(pe,Pe),Fr.translate(-Ge.width/2,-Ge.height/2),Fr.drawImage(L,0,0,Ge.width,Ge.height);var ur=document.createElement("canvas");ur.width=G.width*yt,ur.height=G.height*Ft,ur.getContext("2d").putImageData(Fr.getImageData((G.x-q)*yt,(G.y-q)*Ft,G.width*yt,G.height*Ft),0,0),dt(ur.toDataURL(it.imageType,it.imageQuality))})},V}(),Ot=function(){function V(y){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.stateChangeEventListeners=[],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.previousState="",this._instanceNo=V.instanceCounter++,this.styles=new At(this.instanceNo),this.target=y,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),this.renderState=this.renderState.bind(this),this.addStateChangeEventListener=this.addStateChangeEventListener.bind(this),this.removeStateChangeEventListener=this.removeStateChangeEventListener.bind(this),this.onStateChanged=this.onStateChanged.bind(this)}return Object.defineProperty(V.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(y){this._zoomToCropEnabled=y,this.cropLayer!==void 0&&(this.cropLayer.zoomToCropEnabled=this._zoomToCropEnabled),y?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(y){this._isGridVisible=y,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"gridLines",{get:function(){return this._gridLines},set:function(y){this._gridLines=y,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(y){this._rotationAngle=y,this.straightener&&(this.straightener.angle=this._rotationAngle),this.onStateChanged()},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"aspectRatio",{get:function(){var y;return(y=this._aspectRatio)!==null&&y!==void 0?y:this.aspectRatios[0]},set:function(y){this._aspectRatio=y},enumerable:!1,configurable:!0}),V.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},V.prototype.show=function(){this.showUI(),this.open()},V.prototype.close=function(y){y===void 0&&(y=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),y||this.closeEventListeners.forEach(function(L){return L()}),this._isOpen=!1)},V.prototype.addRenderEventListener=function(y){this.renderEventListeners.push(y)},V.prototype.removeRenderEventListener=function(y){this.renderEventListeners.indexOf(y)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(y),1)},V.prototype.addCloseEventListener=function(y){this.closeEventListeners.push(y)},V.prototype.removeCloseEventListener=function(y){this.closeEventListeners.indexOf(y)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(y),1)},V.prototype.addStateChangeEventListener=function(y){this.stateChangeEventListeners.push(y)},V.prototype.removeStateChangeEventListener=function(y){this.stateChangeEventListeners.indexOf(y)>-1&&this.stateChangeEventListeners.splice(this.stateChangeEventListeners.indexOf(y),1)},V.prototype.setupResizeObserver=function(){var y=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){y.resize(y.target.clientWidth,y.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))},V.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var y=1*this.target.clientWidth/this.target.clientHeight,L=this.contentDiv.clientWidth/y>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*y:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,G=L+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/y;this.resize(L,G)}},V.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},V.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",tt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},V.prototype.resize=function(y,L){this.imageWidth=Math.round(y),this.imageHeight=Math.round(L),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(),this.onStateChanged()},V.prototype.setEditingTarget=function(){tt.setAttributes(this.editingTarget,[["href",this.target.src]]),this.setEditingTargetSize()},V.prototype.setTopLeft=function(){var y=this.target.getBoundingClientRect(),L=this.editorCanvas.getBoundingClientRect();this.left=y.left-L.left-this.CANVAS_MARGIN,this.top=y.top-L.top-this.CANVAS_MARGIN},V.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=tt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=tt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=tt.createGroup(),this.editingTargetRotationScaleContainer=tt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var y=tt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(y);var L=tt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(L),this.editingTargetContainer=tt.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)},V.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},V.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=tt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Yr(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.zoomToCropEnabled=this.zoomToCropEnabled,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},V.prototype.zoomToCrop=function(){if(this.cropRect){var y=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,L=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=y+"px "+L+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-y+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-L+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},V.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)},V.prototype.cropRectChanged=function(y){this.cropRect=y,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1,this.onStateChanged()},V.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},V.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"},V.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},V.prototype.showUI=function(){var y,L;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 G=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,q=this.target.offsetTop>G+this.CANVAS_MARGIN?this.target.offsetTop-(G+this.CANVAS_MARGIN):0;q+=(y=this.uiOffsetTop)!==null&&y!==void 0?y:0;var K=this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0;K+=(L=this.uiOffsetLeft)!==null&&L!==void 0?L:0,this.coverDiv.style.top=q+"px",this.coverDiv.style.left=K+"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.processingUi=document.createElement("div"),this.processingUi.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block; shape-rendering: auto;" width="50px" height="50px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
|
|
<rect x="19" y="19" width="20" height="20" fill="#eeeeee">
|
|
<animate attributeName="fill" values="#888888;#eeeeee;#eeeeee" keyTimes="0;0.125;1" dur="1s" repeatCount="indefinite" begin="0s" calcMode="discrete"></animate>
|
|
</rect><rect x="40" y="19" width="20" height="20" fill="#eeeeee">
|
|
<animate attributeName="fill" values="#888888;#eeeeee;#eeeeee" keyTimes="0;0.125;1" dur="1s" repeatCount="indefinite" begin="0.125s" calcMode="discrete"></animate>
|
|
</rect><rect x="61" y="19" width="20" height="20" fill="#eeeeee">
|
|
<animate attributeName="fill" values="#888888;#eeeeee;#eeeeee" keyTimes="0;0.125;1" dur="1s" repeatCount="indefinite" begin="0.25s" calcMode="discrete"></animate>
|
|
</rect><rect x="19" y="40" width="20" height="20" fill="#eeeeee">
|
|
<animate attributeName="fill" values="#888888;#eeeeee;#eeeeee" keyTimes="0;0.125;1" dur="1s" repeatCount="indefinite" begin="0.875s" calcMode="discrete"></animate>
|
|
</rect><rect x="61" y="40" width="20" height="20" fill="#eeeeee">
|
|
<animate attributeName="fill" values="#888888;#eeeeee;#eeeeee" keyTimes="0;0.125;1" dur="1s" repeatCount="indefinite" begin="0.375s" calcMode="discrete"></animate>
|
|
</rect><rect x="19" y="61" width="20" height="20" fill="#eeeeee">
|
|
<animate attributeName="fill" values="#888888;#eeeeee;#eeeeee" keyTimes="0;0.125;1" dur="1s" repeatCount="indefinite" begin="0.75s" calcMode="discrete"></animate>
|
|
</rect><rect x="40" y="61" width="20" height="20" fill="#eeeeee">
|
|
<animate attributeName="fill" values="#888888;#eeeeee;#eeeeee" keyTimes="0;0.125;1" dur="1s" repeatCount="indefinite" begin="0.625s" calcMode="discrete"></animate>
|
|
</rect><rect x="61" y="61" width="20" height="20" fill="#eeeeee">
|
|
<animate attributeName="fill" values="#888888;#eeeeee;#eeeeee" keyTimes="0;0.125;1" dur="1s" repeatCount="indefinite" begin="0.5s" calcMode="discrete"></animate>
|
|
</rect>
|
|
</svg>`,this.processingUi.style.position="absolute",this.processingUi.style.width="100%",this.processingUi.style.height="100%",this.processingUi.style.backgroundColor="rgba(0,0,0,0.3)",this.processingUi.style.alignItems="center",this.processingUi.style.justifyContent="center",this.processingUi.style.display="none",this.editorCanvas.appendChild(this.processingUi),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},V.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},V.prototype.addTopToolbar=function(){var y=this;this.topToolbar=new fr,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 L=new mt;L.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(L);var G=[];this.aspectRatios.forEach(function(Ft){var qt=new sr(Dt.getIcon(Ft.horizontal,Ft.vertical),Ft.horizontal===0&&Ft.vertical===0?"FREE":Ft.horizontal+":"+Ft.vertical);qt.onClick=function(){return y.ratioButtonClicked(Ft)},G.push(qt)}),this.aspectRatioButton=new dr(Dt.getIcon(0,0),"Aspect ratio",G),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,L.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var q=new sr('<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");q.isActive=this.isGridVisible,q.onClick=function(){y.isGridVisible=!y.isGridVisible,q.isActive=y.isGridVisible},L.addButton(q);var K=new sr('<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(K.isActive=this.zoomToCropEnabled,K.onClick=function(){y.zoomToCropEnabled=!y.zoomToCropEnabled,K.isActive=y.zoomToCropEnabled},L.addButton(K),!xr.isLicensed){var pe=new Qt;this.topToolbar.addElementBlock(pe);var Pe=document.createElement("div");Pe.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var it=document.createElement("a");it.style.color="currentColor",it.href="https://markerjs.com/products/cropro",it.target="_blank",it.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>',Pe.appendChild(it),pe.addElement(Pe)}var dt=new mt;dt.minWidth=3*this.toolbarHeight+"px",dt.contentAlign="end",this.topToolbar.addButtonBlock(dt);var Ge=new sr('<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");Ge.onClick=function(){y.processingUi.style.display="flex",setTimeout(y.startRenderAndClose,100)},dt.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var yt=new sr('<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");yt.onClick=this.close,dt.addButton(yt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(yt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},V.prototype.addBottomToolbar=function(){var y=this;this.bottomToolbar=new fr,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 L=new mt;L.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(L);var G=new sr('<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");G.onClick=this.rotateLeftButtonClicked,L.addButton(G);var q=new sr('<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");q.onClick=this.rotateRightButtonClicked,L.addButton(q);var K=new Qt;K.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(K),this.straightener=new Je("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(dt){y.rotateBy(dt),y.straightener.angle=y.rotationAngle},K.addElement(this.straightener.getUI());var pe=new mt;pe.minWidth=2*this.toolbarHeight+"px",pe.contentAlign="end",this.bottomToolbar.addButtonBlock(pe);var Pe=new sr('<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");Pe.onClick=this.flipHorizontallyButtonClicked,pe.addButton(Pe);var it=new sr('<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");it.onClick=this.flipVerticallyButtonClicked,pe.addButton(it)},V.prototype.ratioButtonClicked=function(y){this.aspectRatio=y,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},V.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Dt.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},V.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Jt(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0,this.onStateChanged())},V.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},V.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},V.prototype.restoreState=function(y){if(y){var L=this.cropLayer.getRescaledRect(y.width,y.height,this.imageWidth,this.imageHeight,y.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(L),this.cropRectChanged(L),this.flippedHorizontally=y.flippedHorizontally,this.flippedVertically=y.flippedVertically,this.applyFlip(),this.rotationAngle=y.rotationAngle,this.applyRotation(),this.onStateChanged()}},V.prototype.renderState=function(y){this.displayMode="inline",this.isOpen||this.show(),this.restoreState(y),this.startRenderAndClose()},V.prototype.clientToLocalCoordinates=function(y,L){var G=this.cropImage.getBoundingClientRect();return{x:y-G.left,y:L-G.top}},V.prototype.onWindowResize=function(){this.positionUI()},V.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var y=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=y+"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()},V.prototype.rotateLeftButtonClicked=function(){var y=this.rotationAngle-90;this.rotationAngle%90!=0&&(y+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(y)},V.prototype.rotateRightButtonClicked=function(){var y=this.rotationAngle+90;this.rotationAngle%90!=0&&(y-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(y)},V.prototype.rotateTo=function(y){y=(y=y>180?y-360:y)<=-180?y+360:y,this.rotationAngle=y,this.applyRotation()},V.prototype.rotateBy=function(y){this.rotateTo((this.rotationAngle+y)%360)},V.prototype.applyRotation=function(){var y=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var L=this.editingTargetRotationContainer.transform.baseVal.getItem(0);L.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(L,0);var G=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/G.width,this.imageHeight/G.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=y},V.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},V.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},V.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")",this.onStateChanged()},V.prototype.startRenderAndClose=function(){return Rr(this,void 0,void 0,function(){var y,L;return ar(this,function(G){switch(G.label){case 0:return[4,this.render()];case 1:return y=G.sent(),L=this.getState(),this.renderEventListeners.forEach(function(q){return q(y,L)}),this.close(!0),[2]}})})},V.prototype.render=function(){return Rr(this,void 0,void 0,function(){var y,L;return ar(this,function(G){switch(G.label){case 0:return(y=new nt).naturalSize=this.renderAtNaturalSize,y.imageType=this.renderImageType,y.imageQuality=this.renderImageQuality,y.width=this.renderWidth,y.height=this.renderHeight,y.maxSize=this.renderMaxSize,this.unzoomFromCrop(),tt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,y.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 G.sent(),[4,y.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 L=G.sent(),this.processingUi.style.display="none",[2,L]}})})},V.prototype.onStateChanged=function(){var y=this.getState(),L=JSON.stringify(y);this.previousState!==L&&(this.stateChangeEventListeners.forEach(function(G){return G(y)}),this.previousState=L)},V.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ut("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 Ut("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ut("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var y=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ut("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*y)+`px;
|
|
height: `+(this.toolbarHeight-2*y)+`px;
|
|
padding: `+y+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ut("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ut("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new Lt("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Lt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Ut("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 Ut("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ut("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 Ut("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*y)+`px;
|
|
padding: `+y+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ut("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},V.instanceCounter=0,V}(),Kt=Z("8hTe"),Pt=Z.n(Kt),br=/<pre[^>]*>/g;function Xr(V){var y=document.createElement("div");return y.innerHTML=V,y.childNodes.length===0?"":y.childNodes[0].nodeValue}var St=ve.a=function(V){var y=V.value,L=y===void 0?"":y,G=V.edit,q=G===void 0?!1:G,K=V.className,pe=V.showTextOnly,Pe=V.showLines,it=V.replaces,dt=V.zoomImg,Ge=V.hasMask,yt=V.style,Ft=yt===void 0?{}:yt,qt=V.stylesPrev,Zr=qt===void 0?{}:qt,Fr=String(L),ur=Object(H.useRef)(),or=Object(H.useRef)(),ln=Object(H.useState)(""),Vn=Object(F.a)(ln,2),en=Vn[0],kr=Vn[1],Dn=Object(H.useState)("office"),Yn=Object(F.a)(Dn,2),Xn=Yn[0],mn=Yn[1],Tn=function(){var zt=new Ot(or.current);zt.displayMode="popup",zt.addRenderEventListener(function(){var mr=Object(X.a)(r.a.mark(function jt(Or){var nr;return r.a.wrap(function(wr){for(;;)switch(wr.prev=wr.next){case 0:return ur.current.style.display="none",wr.next=3,Object(J.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Or}});case 3:nr=wr.sent,nr!=null&&nr.id&&it(or.current.getAttribute("src").replace(U.a.API_SERVER,""),"/api/attachments/".concat(nr==null?void 0:nr.id,"?type=").concat(nr.content_type));case 5:case"end":return wr.stop()}},jt)}));return function(jt){return mr.apply(this,arguments)}}()),zt.show()},$n=function(){var zt=new Ht(or.current);zt.settings.displayMode="popup",zt.addEventListener("render",function(){var mr=Object(X.a)(r.a.mark(function jt(Or){var nr;return r.a.wrap(function(wr){for(;;)switch(wr.prev=wr.next){case 0:if(ur.current.style.display="none",!or.current){wr.next=6;break}return wr.next=4,Object(J.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Or.dataUrl}});case 4:nr=wr.sent,nr!=null&&nr.id&&it(or.current.getAttribute("src").replace(U.a.API_SERVER,""),"/api/attachments/".concat(nr==null?void 0:nr.id,"?type=").concat(nr.content_type));case 6:case"end":return wr.stop()}},jt)}));return function(jt){return mr.apply(this,arguments)}}()),zt.show(),window.markerArea=zt},gn=Object(H.useMemo)(function(){ur.current&&(ur.current.style.zIndex=-1);try{var pr=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,zt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,mr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Fr=Fr.replace(pr,"("+U.a.API_SERVER+"/api/attachments/").replace(zt,'"'+U.a.API_SERVER+"/api/attachments/").replace(mr,'"'+U.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(Dr){}var jt=T(Fr),Or=C();if(Fr.match(/\[TOC\]/)&&(jt=jt.replace("<p>[TOC]</p>",x()),O()),jt=jt.replace(/(__special_katext_id_\d+__)/g,function(Dr,wr){var bn=Or[wr],Pn=bn.type,hn=bn.expression;return Object(j.renderToString)(Xr(hn)||"",{displayMode:Pn==="block",throwOnError:!1,output:"html"})}),jt=jt.replace(/▁/g,"\u2581\u2581\u2581"),c(),pe){var nr=document.createElement("div");return nr.innerHTML=jt,nr.innerText}return setTimeout(function(){return vn()},500),jt},[Fr]),rn=Object(H.useRef)();w.WebkitLineClamp=Pe,Pe&&(Ft=Object(le.a)(Object(le.a)({},Ft),w));function un(pr){var zt=pr.target;if(zt.tagName.toUpperCase()==="IMG"){if(dt){var mr=zt.getAttribute("src");kr(mr),mn("image")}}else if(zt.tagName.toUpperCase()==="A"){var jt=zt.getAttribute("href");if(jt.indexOf("office")>-1)pr.preventDefault(),kr(jt),mn("office");else if(jt.indexOf("application/pdf")>-1)pr.preventDefault(),kr(jt),mn("pdf");else if(jt.indexOf("text/html")>-1)pr.preventDefault(),kr(jt),mn("html");else if(jt.startsWith("#")){pr.preventDefault();var Or=document.getElementById(jt.replace("#",""));Or&&Or.scrollIntoView(!0)}}}var vn=function(){var zt,mr=(zt=rn.current)===null||zt===void 0?void 0:zt.querySelectorAll("video");mr==null||mr.forEach(function(jt){if(jt.oncontextmenu=function(){return!1},jt.src.indexOf(".m3u8")>-1&&!jt.canPlayType("application/vnd.apple.mpegurl")){if(N.a.isSupported()){var Or=new N.a;Or.loadSource(jt.src),Or.attachMedia(jt)}}})};Object(H.useEffect)(function(){if(rn.current&&gn&&(gn.match(br)&&window.PR.prettyPrint()),rn.current)return rn.current.addEventListener("click",un),function(){rn.current.removeEventListener("click",un),c(),O()}},[gn,rn.current,un]);var yn=function(zt){if(!q)return;zt.target.nodeName==="IMG"?(ur.current.style.zIndex=1,ur.current.style.display="flex",ur.current.style.width=zt.target.clientWidth+"px",ur.current.style.height=zt.target.clientHeight+"px",ur.current.style.top=zt.target.offsetTop+"px",ur.current.style.left=zt.target.offsetLeft+"px",or.current.src=zt.target.getAttribute("src")):ur.current.style.display="none"};return D.a.createElement("div",{style:{position:"relative"}},D.a.createElement("div",{ref:rn,style:Object(le.a)({},Ft),className:"".concat(K||""," markdown-body ").concat(Pt.a.mdBody),onMouseOver:yn,dangerouslySetInnerHTML:{__html:gn}}),D.a.createElement("div",{ref:ur,className:Pt.a.button},D.a.createElement(Se.b,null,D.a.createElement(ye.a,{onClick:function(){return Tn()}},"\u88C1\u526A"),D.a.createElement(ye.a,{onClick:function(){return $n()}},"\u7F16\u8F91"))),D.a.createElement("img",{ref:or,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),D.a.createElement(Y.a,{close:!0,data:en,type:en!=null&&en.length?Xn:"",style:Object(le.a)({},Zr),onClose:function(){return kr("")}}))}},"9VGf":function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return ce});var se=Z("T/Jt"),Se=Z.n(se);function ce(ye,le){var X=Object(se.useRef)();Object(se.useEffect)(function(){X.current=ye}),Object(se.useEffect)(function(){function F(){X.current()}if(le!==null){var W=setInterval(F,le);return function(){return clearInterval(W)}}},[le])}},"9ivq":function(at,ve,Z){},Bd2K:function(at,ve,Z){(function(se){se(Z("VrN/"),Z("osHv"))})(function(se){se.defineOption("autoCloseTags",!1,function(r,H,D){if(D!=se.Init&&D&&r.removeKeyMap("autoCloseTags"),!H)return;var M={name:"autoCloseTags"};(typeof H!="object"||H.whenClosing!==!1)&&(M["'/'"]=function(g){return X(g)}),(typeof H!="object"||H.whenOpening!==!1)&&(M["'>'"]=function(g){return ye(g)}),r.addKeyMap(M)});var Se=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],ce=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function ye(r){if(r.getOption("disableInput"))return se.Pass;for(var H=r.listSelections(),D=[],M=r.getOption("autoCloseTags"),g=0;g<H.length;g++){if(!H[g].empty())return se.Pass;var p=H[g].head,u=r.getTokenAt(p),m=se.innerMode(r.getMode(),u.state),b=m.state,E=m.mode.xmlCurrentTag&&m.mode.xmlCurrentTag(b),_=E&&E.name;if(!_)return se.Pass;var f=m.mode.configuration=="html",O=typeof M=="object"&&M.dontCloseTags||f&&Se,w=typeof M=="object"&&M.indentTags||f&&ce;u.end>p.ch&&(_=_.slice(0,_.length-u.end+p.ch));var R=_.toLowerCase();if(!_||u.type=="string"&&(u.end!=p.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||u.string.length==1)||u.type=="tag"&&E.close||u.string.indexOf("/")==p.ch-u.start-1||O&&F(O,R)>-1||W(r,m.mode.xmlCurrentContext&&m.mode.xmlCurrentContext(b)||[],_,p,!0))return se.Pass;var x=typeof M=="object"&&M.emptyTags;if(x&&F(x,_)>-1){D[g]={text:"/>",newPos:se.Pos(p.line,p.ch+2)};continue}var I=w&&F(w,R)>-1;D[g]={indent:I,text:">"+(I?`
|
|
|
|
`:"")+"</"+_+">",newPos:I?se.Pos(p.line+1,0):se.Pos(p.line,p.ch+1)}}for(var k=typeof M=="object"&&M.dontIndentOnAutoClose,g=H.length-1;g>=0;g--){var A=D[g];r.replaceRange(A.text,H[g].head,H[g].anchor,"+insert");var P=r.listSelections().slice(0);P[g]={head:A.newPos,anchor:A.newPos},r.setSelections(P),!k&&A.indent&&(r.indentLine(A.newPos.line,null,!0),r.indentLine(A.newPos.line+1,null,!0))}}function le(r,H){for(var D=r.listSelections(),M=[],g=H?"/":"</",p=r.getOption("autoCloseTags"),u=typeof p=="object"&&p.dontIndentOnSlash,m=0;m<D.length;m++){if(!D[m].empty())return se.Pass;var b=D[m].head,E=r.getTokenAt(b),_=se.innerMode(r.getMode(),E.state),f=_.state;if(H&&(E.type=="string"||E.string.charAt(0)!="<"||E.start!=b.ch-1))return se.Pass;var O,w=_.mode.name!="xml"&&r.getMode().name=="htmlmixed";if(w&&_.mode.name=="javascript")O=g+"script";else if(w&&_.mode.name=="css")O=g+"style";else{var R=_.mode.xmlCurrentContext&&_.mode.xmlCurrentContext(f);if(!R||R.length&&W(r,R,R[R.length-1],b))return se.Pass;O=g+R[R.length-1]}r.getLine(b.line).charAt(E.end)!=">"&&(O+=">"),M[m]=O}if(r.replaceSelections(M),D=r.listSelections(),!u)for(var m=0;m<D.length;m++)(m==D.length-1||D[m].head.line<D[m+1].head.line)&&r.indentLine(D[m].head.line)}function X(r){return r.getOption("disableInput")?se.Pass:le(r,!0)}se.commands.closeTag=function(r){return le(r)};function F(r,H){if(r.indexOf)return r.indexOf(H);for(var D=0,M=r.length;D<M;++D)if(r[D]==H)return D;return-1}function W(r,H,D,M,g){if(!se.scanForClosingTag)return!1;var p=Math.min(r.lastLine()+1,M.line+500),u=se.scanForClosingTag(r,M,null,p);if(!u||u.tag!=D)return!1;for(var m=g?1:0,b=H.length-1;b>=0&&H[b]==D;b--)++m;M=u.to;for(var b=1;b<m;b++){var E=se.scanForClosingTag(r,M,null,p);if(!E||E.tag!=D)return!1;M=E.to}return!0}})},BjJ7:function(at,ve,Z){"use strict";Z.d(ve,"d",function(){return Se}),Z.d(ve,"c",function(){return ce}),Z.d(ve,"e",function(){return ye}),Z.d(ve,"b",function(){return le}),Z.d(ve,"a",function(){return F});var se=Z("m3rI");function Se(W){var r=!0;if(W.length>0){for(var H=0;H<W.length;H++)if(W[H].compile_success==0||!W[H].compile_success){r=!1;break}}else r=!1;return r}function ce(W){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",H=[],D=0;D<W.length;D++){var M=W[D],g=r?"".concat(r,"/").concat(M.name):"".concat(M.name);H.push({title:M.name,isLeaf:!(M.type==="tree"),key:g})}return H}function ye(W,r,H){for(var D=0;D<W.length;D++){var M=W[D];if(M.key===r){M.children=H;break}M.children&&ye(M.children,r,H)}return W}function le(W,r,H){var D;return function(){var M=this,g=arguments,p=function(){D=null,H||W.apply(M,g)},u=H&&!D;clearTimeout(D),D=setTimeout(p,r),u&&W.apply(M,g)}}var X=!0,F=se.a.API_SERVER},BsWD:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return Se});var se=Z("a3WO");function Se(ce,ye){if(!ce)return;if(typeof ce=="string")return Object(se.a)(ce,ye);var le=Object.prototype.toString.call(ce).slice(8,-1);if(le==="Object"&&ce.constructor&&(le=ce.constructor.name),le==="Map"||le==="Set")return Array.from(ce);if(le==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(le))return Object(se.a)(ce,ye)}},"C+DQ":function(at,ve,Z){},"C/vA":function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return se});function se(Se){const ce=this;let ye=!1,le;return function(){return ye||(ye=!0,le=Se.apply(ce,arguments)),le}}},"Cg/j":function(at,ve,Z){"use strict";Z.d(ve,"b",function(){return se}),Z.d(ve,"a",function(){return Se}),Z.d(ve,"c",function(){return ye}),Z.d(ve,"d",function(){return le});var se;(function(X){X.serviceIds=new Map,X.DI_TARGET="$di$target",X.DI_DEPENDENCIES="$di$dependencies";function F(W){return W[X.DI_DEPENDENCIES]||[]}X.getServiceDependencies=F})(se||(se={}));const Se=ye("instantiationService");function ce(X,F,W,r){F[se.DI_TARGET]===F?F[se.DI_DEPENDENCIES].push({id:X,index:W,optional:r}):(F[se.DI_DEPENDENCIES]=[{id:X,index:W,optional:r}],F[se.DI_TARGET]=F)}function ye(X){if(se.serviceIds.has(X))return se.serviceIds.get(X);const F=function(W,r,H){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");ce(F,W,H,!1)};return F.toString=()=>X,se.serviceIds.set(X,F),F}function le(X){return function(F,W,r){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");ce(X,F,r,!0)}}},ELLl:function(at,ve,Z){(function(se){se(Z("VrN/"))})(function(se){var Se={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},ce=se.Pos;se.defineOption("autoCloseBrackets",!1,function(u,m,b){b&&b!=se.Init&&(u.removeKeyMap(le),u.state.closeBrackets=null),m&&(X(ye(m,"pairs")),u.state.closeBrackets=m,u.addKeyMap(le))});function ye(u,m){return m=="pairs"&&typeof u=="string"?u:typeof u=="object"&&u[m]!=null?u[m]:Se[m]}var le={Backspace:r,Enter:H};function X(u){for(var m=0;m<u.length;m++){var b=u.charAt(m),E="'"+b+"'";le[E]||(le[E]=F(b))}}X(Se.pairs+"`");function F(u){return function(m){return M(m,u)}}function W(u){var m=u.state.closeBrackets;if(!m||m.override)return m;var b=u.getModeAt(u.getCursor());return b.closeBrackets||m}function r(u){var m=W(u);if(!m||u.getOption("disableInput"))return se.Pass;for(var b=ye(m,"pairs"),E=u.listSelections(),_=0;_<E.length;_++){if(!E[_].empty())return se.Pass;var f=g(u,E[_].head);if(!f||b.indexOf(f)%2!=0)return se.Pass}for(var _=E.length-1;_>=0;_--){var O=E[_].head;u.replaceRange("",ce(O.line,O.ch-1),ce(O.line,O.ch+1),"+delete")}}function H(u){var m=W(u),b=m&&ye(m,"explode");if(!b||u.getOption("disableInput"))return se.Pass;for(var E=u.listSelections(),_=0;_<E.length;_++){if(!E[_].empty())return se.Pass;var f=g(u,E[_].head);if(!f||b.indexOf(f)%2!=0)return se.Pass}u.operation(function(){var O=u.lineSeparator()||`
|
|
`;u.replaceSelection(O+O,null),u.execCommand("goCharLeft"),E=u.listSelections();for(var w=0;w<E.length;w++){var R=E[w].head.line;u.indentLine(R,null,!0),u.indentLine(R+1,null,!0)}})}function D(u){var m=se.cmpPos(u.anchor,u.head)>0;return{anchor:new ce(u.anchor.line,u.anchor.ch+(m?-1:1)),head:new ce(u.head.line,u.head.ch+(m?1:-1))}}function M(u,m){var b=W(u);if(!b||u.getOption("disableInput"))return se.Pass;var E=ye(b,"pairs"),_=E.indexOf(m);if(_==-1)return se.Pass;for(var f=ye(b,"closeBefore"),O=ye(b,"triples"),w=E.charAt(_+1)==m,R=u.listSelections(),x=_%2==0,I,k=0;k<R.length;k++){var A=R[k],P=A.head,S,C=u.getRange(P,ce(P.line,P.ch+1));if(x&&!A.empty())S="surround";else if((w||!x)&&C==m)w&&p(u,P)?S="both":O.indexOf(m)>=0&&u.getRange(P,ce(P.line,P.ch+3))==m+m+m?S="skipThree":S="skip";else if(w&&P.ch>1&&O.indexOf(m)>=0&&u.getRange(ce(P.line,P.ch-2),P)==m+m){if(P.ch>2&&/\bstring/.test(u.getTokenTypeAt(ce(P.line,P.ch-2))))return se.Pass;S="addFour"}else if(w){var c=P.ch==0?" ":u.getRange(ce(P.line,P.ch-1),P);if(!se.isWordChar(C)&&c!=m&&!se.isWordChar(c))S="both";else return se.Pass}else if(x&&(C.length===0||/\s/.test(C)||f.indexOf(C)>-1))S="both";else return se.Pass;if(!I)I=S;else if(I!=S)return se.Pass}var o=_%2?E.charAt(_-1):m,v=_%2?m:E.charAt(_+1);u.operation(function(){if(I=="skip")u.execCommand("goCharRight");else if(I=="skipThree")for(var l=0;l<3;l++)u.execCommand("goCharRight");else if(I=="surround"){for(var a=u.getSelections(),l=0;l<a.length;l++)a[l]=o+a[l]+v;u.replaceSelections(a,"around"),a=u.listSelections().slice();for(var l=0;l<a.length;l++)a[l]=D(a[l]);u.setSelections(a)}else I=="both"?(u.replaceSelection(o+v,null),u.triggerElectric(o+v),u.execCommand("goCharLeft")):I=="addFour"&&(u.replaceSelection(o+o+o+o,"before"),u.execCommand("goCharRight"))})}function g(u,m){var b=u.getRange(ce(m.line,m.ch-1),ce(m.line,m.ch+1));return b.length==2?b:null}function p(u,m){var b=u.getTokenAt(ce(m.line,m.ch+1));return/\bstring/.test(b.type)&&b.start==m.ch&&(m.ch==0||!/\bstring/.test(u.getTokenTypeAt(m)))}})},FER5:function(at,ve,Z){"use strict";Z.d(ve,"g",function(){return Se}),Z.d(ve,"b",function(){return le}),Z.d(ve,"f",function(){return X}),Z.d(ve,"c",function(){return F}),Z.d(ve,"e",function(){return W}),Z.d(ve,"a",function(){return M}),Z.d(ve,"d",function(){return g});var se=Z("b3aT");function Se(u,m,b){return{r:Object(se.a)(u,255)*255,g:Object(se.a)(m,255)*255,b:Object(se.a)(b,255)*255}}function ce(u,m,b){u=Object(se.a)(u,255),m=Object(se.a)(m,255),b=Object(se.a)(b,255);var E=Math.max(u,m,b),_=Math.min(u,m,b),f=0,O=0,w=(E+_)/2;if(E===_)O=0,f=0;else{var R=E-_;O=w>.5?R/(2-E-_):R/(E+_);switch(E){case u:f=(m-b)/R+(m<b?6:0);break;case m:f=(b-u)/R+2;break;case b:f=(u-m)/R+4;break;default:break}f/=6}return{h:f,s:O,l:w}}function ye(u,m,b){return b<0&&(b+=1),b>1&&(b-=1),b<1/6?u+(m-u)*(6*b):b<1/2?m:b<2/3?u+(m-u)*(2/3-b)*6:u}function le(u,m,b){var E,_,f;if(u=Object(se.a)(u,360),m=Object(se.a)(m,100),b=Object(se.a)(b,100),m===0)_=b,f=b,E=b;else{var O=b<.5?b*(1+m):b+m-b*m,w=2*b-O;E=ye(w,O,u+1/3),_=ye(w,O,u),f=ye(w,O,u-1/3)}return{r:E*255,g:_*255,b:f*255}}function X(u,m,b){u=Object(se.a)(u,255),m=Object(se.a)(m,255),b=Object(se.a)(b,255);var E=Math.max(u,m,b),_=Math.min(u,m,b),f=0,O=E,w=E-_,R=E===0?0:w/E;if(E===_)f=0;else{switch(E){case u:f=(m-b)/w+(m<b?6:0);break;case m:f=(b-u)/w+2;break;case b:f=(u-m)/w+4;break;default:break}f/=6}return{h:f,s:R,v:O}}function F(u,m,b){u=Object(se.a)(u,360)*6,m=Object(se.a)(m,100),b=Object(se.a)(b,100);var E=Math.floor(u),_=u-E,f=b*(1-m),O=b*(1-_*m),w=b*(1-(1-_)*m),R=E%6,x=[b,O,f,f,w,b][R],I=[w,b,b,O,f,f][R],k=[f,f,w,b,b,O][R];return{r:x*255,g:I*255,b:k*255}}function W(u,m,b,E){var _=[Object(se.d)(Math.round(u).toString(16)),Object(se.d)(Math.round(m).toString(16)),Object(se.d)(Math.round(b).toString(16))];return E&&_[0].startsWith(_[0].charAt(1))&&_[1].startsWith(_[1].charAt(1))&&_[2].startsWith(_[2].charAt(1))?_[0].charAt(0)+_[1].charAt(0)+_[2].charAt(0):_.join("")}function r(u,m,b,E,_){var f=[Object(se.d)(Math.round(u).toString(16)),Object(se.d)(Math.round(m).toString(16)),Object(se.d)(Math.round(b).toString(16)),Object(se.d)(D(E))];return _&&f[0].startsWith(f[0].charAt(1))&&f[1].startsWith(f[1].charAt(1))&&f[2].startsWith(f[2].charAt(1))&&f[3].startsWith(f[3].charAt(1))?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0)+f[3].charAt(0):f.join("")}function H(u,m,b,E){var _=[Object(se.d)(D(E)),Object(se.d)(Math.round(u).toString(16)),Object(se.d)(Math.round(m).toString(16)),Object(se.d)(Math.round(b).toString(16))];return _.join("")}function D(u){return Math.round(parseFloat(u)*255).toString(16)}function M(u){return g(u)/255}function g(u){return parseInt(u,16)}function p(u){return{r:u>>16,g:(u&65280)>>8,b:u&255}}},FWmy:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return se});function se(Se,ce){if(!Se)throw new Error(ce?`Assertion failed (${ce})`:"Assertion Failed")}},Ff2n:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return Se});var se=Z("zLVn");function Se(ce,ye){if(ce==null)return{};var le=Object(se.a)(ce,ye),X,F;if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(ce);for(F=0;F<W.length;F++){if(X=W[F],ye.indexOf(X)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(ce,X))continue;le[X]=ce[X]}}return le}},GcTH:function(at,ve){const Z=/[&<>"']/,se=/[&<>"']/g,Se=/[<>"']|&(?!#?\w+;)/,ce=/[<>"']|&(?!#?\w+;)/g,ye={"&":"&","<":"<",">":">",'"':""","'":"'"},le=I=>ye[I];function X(I,k){if(k){if(Z.test(I))return I.replace(se,le)}else if(Se.test(I))return I.replace(ce,le);return I}const F=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function W(I){return I.replace(F,(k,A)=>(A=A.toLowerCase(),A==="colon"?":":A.charAt(0)==="#"?A.charAt(1)==="x"?String.fromCharCode(parseInt(A.substring(2),16)):String.fromCharCode(+A.substring(1)):""))}const r=/(^|[^\[])\^/g;function H(I,k){I=I.source||I,k=k||"";const A={replace:(P,S)=>(S=S.source||S,S=S.replace(r,"$1"),I=I.replace(P,S),A),getRegex:()=>new RegExp(I,k)};return A}const D=/[^\w:]/g,M=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function g(I,k,A){if(I){let P;try{P=decodeURIComponent(W(A)).replace(D,"").toLowerCase()}catch(S){return null}if(P.indexOf("javascript:")===0||P.indexOf("vbscript:")===0||P.indexOf("data:")===0)return null}k&&!M.test(A)&&(A=E(k,A));try{A=encodeURI(A).replace(/%25/g,"%")}catch(P){return null}return A}const p={},u=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,b=/^([^:]+:\/*[^/]*)[\s\S]*$/;function E(I,k){p[" "+I]||(u.test(I)?p[" "+I]=I+"/":p[" "+I]=w(I,"/",!0)),I=p[" "+I];const A=I.indexOf(":")===-1;return k.substring(0,2)==="//"?A?k:I.replace(m,"$1")+k:k.charAt(0)==="/"?A?k:I.replace(b,"$1")+k:I+k}const _={exec:function(){}};function f(I){let k=1,A,P;for(;k<arguments.length;k++){A=arguments[k];for(P in A)Object.prototype.hasOwnProperty.call(A,P)&&(I[P]=A[P])}return I}function O(I,k){const A=I.replace(/\|/g,(C,c,o)=>{let v=!1,l=c;for(;--l>=0&&o[l]==="\\";)v=!v;return v?"|":" |"}),P=A.split(/ \|/);let S=0;if(P.length>k)P.splice(k);else for(;P.length<k;)P.push("");for(;S<P.length;S++)P[S]=P[S].trim().replace(/\\\|/g,"|");return P}function w(I,k,A){const P=I.length;if(P===0)return"";let S=0;for(;S<P;){const C=I.charAt(P-S-1);if(C===k&&!A)S++;else if(C!==k&&A)S++;else break}return I.substr(0,P-S)}function R(I,k){if(I.indexOf(k[1])===-1)return-1;const A=I.length;let P=0,S=0;for(;S<A;S++)if(I[S]==="\\")S++;else if(I[S]===k[0])P++;else if(I[S]===k[1]&&(P--,P<0))return S;return-1}function x(I){I&&I.sanitize&&!I.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}at.exports={escape:X,unescape:W,edit:H,cleanUrl:g,resolveUrl:E,noopTest:_,merge:f,splitCells:O,rtrim:w,findClosingBracket:R,checkSanitizeDeprecation:x}},HmJG:function(at,ve,Z){},JYp7:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return se});var se;(function(Se){function ce(f){return f&&typeof f=="object"&&typeof f[Symbol.iterator]=="function"}Se.is=ce;const ye=Object.freeze([]);function le(){return ye}Se.empty=le;function*X(f){yield f}Se.single=X;function F(f){return f||ye}Se.from=F;function W(f){return!f||f[Symbol.iterator]().next().done===!0}Se.isEmpty=W;function r(f){return f[Symbol.iterator]().next().value}Se.first=r;function H(f,O){for(const w of f)if(O(w))return!0;return!1}Se.some=H;function D(f,O){for(const w of f)if(O(w))return w;return}Se.find=D;function*M(f,O){for(const w of f)O(w)&&(yield w)}Se.filter=M;function*g(f,O){let w=0;for(const R of f)yield O(R,w++)}Se.map=g;function*p(...f){for(const O of f)for(const w of O)yield w}Se.concat=p;function*u(f){for(const O of f)for(const w of O)yield w}Se.concatNested=u;function m(f,O,w){let R=w;for(const x of f)R=O(R,x);return R}Se.reduce=m;function*b(f,O,w=f.length){for(O<0&&(O+=f.length),w<0?w+=f.length:w>f.length&&(w=f.length);O<w;O++)yield f[O]}Se.slice=b;function E(f,O=Number.POSITIVE_INFINITY){const w=[];if(O===0)return[w,f];const R=f[Symbol.iterator]();for(let x=0;x<O;x++){const I=R.next();if(I.done)return[w,Se.empty()];w.push(I.value)}return[w,{[Symbol.iterator](){return R}}]}Se.consume=E;function _(f,O,w=(R,x)=>R===x){const R=f[Symbol.iterator](),x=O[Symbol.iterator]();for(;;){const I=R.next(),k=x.next();if(I.done!==k.done)return!1;if(I.done)return!0;if(!w(I.value,k.value))return!1}}Se.equals=_})(se||(se={}))},LuSS:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return ye});var se=Z("FER5"),Se={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},ce=Z("b3aT");function ye(g){var p={r:0,g:0,b:0},u=1,m=null,b=null,E=null,_=!1,f=!1;return typeof g=="string"&&(g=D(g)),typeof g=="object"&&(M(g.r)&&M(g.g)&&M(g.b)?(p=Object(se.g)(g.r,g.g,g.b),_=!0,f=String(g.r).substr(-1)==="%"?"prgb":"rgb"):M(g.h)&&M(g.s)&&M(g.v)?(m=Object(ce.c)(g.s),b=Object(ce.c)(g.v),p=Object(se.c)(g.h,m,b),_=!0,f="hsv"):M(g.h)&&M(g.s)&&M(g.l)&&(m=Object(ce.c)(g.s),E=Object(ce.c)(g.l),p=Object(se.b)(g.h,m,E),_=!0,f="hsl"),Object.prototype.hasOwnProperty.call(g,"a")&&(u=g.a)),u=Object(ce.b)(u),{ok:_,format:g.format||f,r:Math.min(255,Math.max(p.r,0)),g:Math.min(255,Math.max(p.g,0)),b:Math.min(255,Math.max(p.b,0)),a:u}}var le="[-\\+]?\\d+%?",X="[-\\+]?\\d*\\.\\d+%?",F="(?:".concat(X,")|(?:").concat(le,")"),W="[\\s|\\(]+(".concat(F,")[,|\\s]+(").concat(F,")[,|\\s]+(").concat(F,")\\s*\\)?"),r="[\\s|\\(]+(".concat(F,")[,|\\s]+(").concat(F,")[,|\\s]+(").concat(F,")[,|\\s]+(").concat(F,")\\s*\\)?"),H={CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+W),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+W),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+W),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function D(g){if(g=g.trim().toLowerCase(),g.length===0)return!1;var p=!1;if(Se[g])g=Se[g],p=!0;else if(g==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var u=H.rgb.exec(g);return u?{r:u[1],g:u[2],b:u[3]}:(u=H.rgba.exec(g),u?{r:u[1],g:u[2],b:u[3],a:u[4]}:(u=H.hsl.exec(g),u?{h:u[1],s:u[2],l:u[3]}:(u=H.hsla.exec(g),u?{h:u[1],s:u[2],l:u[3],a:u[4]}:(u=H.hsv.exec(g),u?{h:u[1],s:u[2],v:u[3]}:(u=H.hsva.exec(g),u?{h:u[1],s:u[2],v:u[3],a:u[4]}:(u=H.hex8.exec(g),u?{r:Object(se.d)(u[1]),g:Object(se.d)(u[2]),b:Object(se.d)(u[3]),a:Object(se.a)(u[4]),format:p?"name":"hex8"}:(u=H.hex6.exec(g),u?{r:Object(se.d)(u[1]),g:Object(se.d)(u[2]),b:Object(se.d)(u[3]),format:p?"name":"hex"}:(u=H.hex4.exec(g),u?{r:Object(se.d)(u[1]+u[1]),g:Object(se.d)(u[2]+u[2]),b:Object(se.d)(u[3]+u[3]),a:Object(se.a)(u[4]+u[4]),format:p?"name":"hex8"}:(u=H.hex3.exec(g),u?{r:Object(se.d)(u[1]+u[1]),g:Object(se.d)(u[2]+u[2]),b:Object(se.d)(u[3]+u[3]),format:p?"name":"hex"}:!1)))))))))}function M(g){return Boolean(H.CSS_UNIT.exec(String(g)))}},M8RZ:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return r});var se=Z("gKMJ"),Se=Z("d9ep"),ce=Z("BSjk"),ye=Z("FA6E"),le=Z("T/Jt"),X=Z.n(le),F=Z("gLfR"),W=Z.n(F),r=function(H){Object(ce.a)(M,H);var D=Object(ye.a)(M);function M(g){var p;Object(se.a)(this,M),p=D.call(this,g);var u=window.document;return p.node=u.createElement("div"),u.body.appendChild(p.node),p}return Object(Se.a)(M,[{key:"render",value:function(){var p=this.props.children;return Object(F.createPortal)(p,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),M}(X.a.Component)},MI8n:function(at,ve,Z){"use strict";Z.d(ve,"c",function(){return le}),Z.d(ve,"b",function(){return r}),Z.d(ve,"e",function(){return H}),Z.d(ve,"a",function(){return D}),Z.d(ve,"d",function(){return M}),Z.d(ve,"f",function(){return g});var se=Z("/cxE"),Se=Z("pmY6"),ce=Z("24hK"),ye=Z("5Y4S"),le;(function(p){p.None=()=>Se.a.None;function u(o){return(v,l=null,a)=>{let T=!1,h;return h=o(n=>T?void 0:(h?h.dispose():T=!0,v.call(l,n)),null,a),T&&h.dispose(),h}}p.once=u;function m(o,v){return w((l,a=null,T)=>o(h=>l.call(a,v(h)),null,T))}p.map=m;function b(o,v){return w((l,a=null,T)=>o(h=>{v(h),l.call(a,h)},null,T))}p.forEach=b;function E(o,v){return w((l,a=null,T)=>o(h=>v(h)&&l.call(a,h),null,T))}p.filter=E;function _(o){return o}p.signal=_;function f(...o){return(v,l=null,a)=>Object(Se.e)(...o.map(T=>T(h=>v.call(l,h),null,a)))}p.any=f;function O(o,v,l){let a=l;return m(o,T=>(a=v(a,T),a))}p.reduce=O;function w(o){let v;const l=new r({onFirstListenerAdd(){v=o(l.fire,l)},onLastListenerRemove(){v.dispose()}});return l.event}function R(o,v,l=100,a=!1,T){let h,n,N,U=0;const j=new r({leakWarningThreshold:T,onFirstListenerAdd(){h=o(Y=>{U++,n=v(n,Y),a&&!N&&(j.fire(n),n=void 0),clearTimeout(N),N=setTimeout(()=>{const J=n;n=void 0,N=void 0,(!a||U>1)&&j.fire(J),U=0},l)})},onLastListenerRemove(){h.dispose()}});return j.event}p.debounce=R;function x(o,v=(l,a)=>l===a){let l=!0,a;return E(o,T=>{const h=l||!v(T,a);return l=!1,a=T,h})}p.latch=x;function I(o,v){return[p.filter(o,v),p.filter(o,l=>!v(l))]}p.split=I;function k(o,v=!1,l=[]){let a=l.slice(),T=o(N=>{a?a.push(N):n.fire(N)});const h=()=>{a&&a.forEach(N=>n.fire(N)),a=null},n=new r({onFirstListenerAdd(){T||(T=o(N=>n.fire(N)))},onFirstListenerDidAdd(){a&&(v?setTimeout(h):h())},onLastListenerRemove(){T&&T.dispose(),T=null}});return n.event}p.buffer=k;class A{constructor(o){this.event=o}map(o){return new A(m(this.event,o))}forEach(o){return new A(b(this.event,o))}filter(o){return new A(E(this.event,o))}reduce(o,v){return new A(O(this.event,o,v))}latch(){return new A(x(this.event))}debounce(o,v=100,l=!1,a){return new A(R(this.event,o,v,l,a))}on(o,v,l){return this.event(o,v,l)}once(o,v,l){return u(this.event)(o,v,l)}}function P(o){return new A(o)}p.chain=P;function S(o,v,l=a=>a){const a=(...N)=>n.fire(l(...N)),T=()=>o.on(v,a),h=()=>o.removeListener(v,a),n=new r({onFirstListenerAdd:T,onLastListenerRemove:h});return n.event}p.fromNodeEventEmitter=S;function C(o,v,l=a=>a){const a=(...N)=>n.fire(l(...N)),T=()=>o.addEventListener(v,a),h=()=>o.removeEventListener(v,a),n=new r({onFirstListenerAdd:T,onLastListenerRemove:h});return n.event}p.fromDOMEventEmitter=C;function c(o){return new Promise(v=>u(o)(v))}p.toPromise=c})(le||(le={}));class X{constructor(p){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${p}_${X._idPool++}`}start(p){this._stopWatch=new ye.a(!0),this._listenerCount=p}stop(){if(this._stopWatch){const p=this._stopWatch.elapsed();this._elapsedOverall+=p,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${p.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}X._idPool=0;let F=-1;class W{constructor(p,u=Math.random().toString(18).slice(2,5)){this.customThreshold=p,this.name=u,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(p){let u=F;if(typeof this.customThreshold=="number"&&(u=this.customThreshold),u<=0||p<u)return;this._stacks||(this._stacks=new Map);const m=new Error().stack.split(`
|
|
`).slice(3).join(`
|
|
`),b=this._stacks.get(m)||0;if(this._stacks.set(m,b+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=u*.5;let E,_=0;for(const[f,O]of this._stacks)(!E||_<O)&&(E=f,_=O);console.warn(`[${this.name}] potential listener LEAK detected, having ${p} listeners already. MOST frequent listener (${_}):`),console.warn(E)}return()=>{const E=this._stacks.get(m)||0;this._stacks.set(m,E-1)}}}class r{constructor(p){var u;this._disposed=!1,this._options=p,this._leakageMon=F>0?new W(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=((u=this._options)===null||u===void 0?void 0:u._profName)?new X(this._options._profName):void 0}get event(){return this._event||(this._event=(p,u,m)=>{var b;this._listeners||(this._listeners=new ce.a);const E=this._listeners.isEmpty();E&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const _=this._listeners.push(u?[p,u]:p);E&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,p,u);const f=(b=this._leakageMon)===null||b===void 0?void 0:b.check(this._listeners.size),O=Object(Se.i)(()=>{if(f&&f(),!this._disposed&&(_(),this._options&&this._options.onLastListenerRemove)){const w=this._listeners&&!this._listeners.isEmpty();w||this._options.onLastListenerRemove(this)}});return m instanceof Se.b?m.add(O):Array.isArray(m)&&m.push(O),O}),this._event}fire(p){var u,m;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new ce.a);for(let b of this._listeners)this._deliveryQueue.push([b,p]);for((u=this._perfMon)===null||u===void 0||u.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[b,E]=this._deliveryQueue.shift();try{typeof b=="function"?b.call(void 0,E):b[0].call(b[1],E)}catch(_){Object(se.f)(_)}}(m=this._perfMon)===null||m===void 0||m.stop()}}dispose(){var p,u,m,b,E;this._disposed||(this._disposed=!0,(p=this._listeners)===null||p===void 0||p.clear(),(u=this._deliveryQueue)===null||u===void 0||u.clear(),(b=(m=this._options)===null||m===void 0?void 0:m.onLastListenerRemove)===null||b===void 0||b.call(m),(E=this._leakageMon)===null||E===void 0||E.dispose())}}class H extends r{constructor(p){super(p);this._isPaused=0,this._eventQueue=new ce.a,this._mergeFn=p==null?void 0:p.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const p=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(p))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(p){this._listeners&&(this._isPaused!==0?this._eventQueue.push(p):super.fire(p))}}class D extends H{constructor(p){var u;super(p);this._delay=(u=p.delay)!==null&&u!==void 0?u:100}fire(p){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(p)}}class M{constructor(){this.buffers=[]}wrapEvent(p){return(u,m,b)=>p(E=>{const _=this.buffers[this.buffers.length-1];_?_.push(()=>u.call(m,E)):u.call(m,E)},void 0,b)}bufferEvents(p){const u=[];this.buffers.push(u);const m=p();return this.buffers.pop(),u.forEach(b=>b()),m}}class g{constructor(){this.listening=!1,this.inputEvent=le.None,this.inputEventListener=Se.a.None,this.emitter=new r({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(p){this.inputEvent=p,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=p(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},MNsG:function(at,ve,Z){"use strict";(function(se,Se){Z.d(ve,"b",function(){return m}),Z.d(ve,"i",function(){return f}),Z.d(ve,"f",function(){return O}),Z.d(ve,"d",function(){return w}),Z.d(ve,"g",function(){return R}),Z.d(ve,"h",function(){return x}),Z.d(ve,"c",function(){return I}),Z.d(ve,"k",function(){return k}),Z.d(ve,"j",function(){return A}),Z.d(ve,"a",function(){return P}),Z.d(ve,"e",function(){return c});var ce;const ye="en";let le=!1,X=!1,F=!1,W=!1,r=!1,H=!1,D=!1,M,g=ye,p,u;const m=typeof self=="object"?self:typeof se=="object"?se:{};let b;typeof m.vscode!="undefined"&&typeof m.vscode.process!="undefined"?b=m.vscode.process:typeof Se!="undefined"&&(b=Se);const E=typeof((ce=b==null?void 0:b.versions)===null||ce===void 0?void 0:ce.electron)=="string"&&b.type==="renderer";if(typeof navigator=="object"&&!E)u=navigator.userAgent,le=u.indexOf("Windows")>=0,X=u.indexOf("Macintosh")>=0,D=(u.indexOf("Macintosh")>=0||u.indexOf("iPad")>=0||u.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,F=u.indexOf("Linux")>=0,H=!0,M=navigator.language,g=M;else if(typeof b=="object"){le=b.platform==="win32",X=b.platform==="darwin",F=b.platform==="linux",W=F&&!!b.env.SNAP&&!!b.env.SNAP_REVISION,M=ye,g=ye;const o=b.env.VSCODE_NLS_CONFIG;if(o)try{const v=JSON.parse(o),l=v.availableLanguages["*"];M=v.locale,g=l||ye,p=v._translationsConfigFile}catch(v){}r=!0}else console.error("Unable to resolve platform.");let _=0;X?_=1:le?_=3:F&&(_=2);const f=le,O=X,w=F,R=r,x=H,I=D,k=u,A=function(){if(m.setImmediate)return m.setImmediate.bind(m);if(typeof m.postMessage=="function"&&!m.importScripts){let l=[];m.addEventListener("message",T=>{if(T.data&&T.data.vscodeSetImmediateId)for(let h=0,n=l.length;h<n;h++){const N=l[h];if(N.id===T.data.vscodeSetImmediateId){l.splice(h,1),N.callback();return}}});let a=0;return T=>{const h=++a;l.push({id:h,callback:T}),m.postMessage({vscodeSetImmediateId:h},"*")}}if(typeof(b==null?void 0:b.nextTick)=="function")return b.nextTick.bind(b);const v=Promise.resolve();return l=>v.then(l)}(),P=X||D?2:le?1:3;let S=!0,C=!1;function c(){if(!C){C=!0;const o=new Uint8Array(2);o[0]=1,o[1]=2;const v=new Uint16Array(o.buffer);S=v[0]===(2<<8)+1}return S}}).call(this,Z("IGO8"),Z("B0ME"))},N0LK:function(at,ve,Z){"use strict";Z.d(ve,"C",function(){return se}),Z.d(ve,"v",function(){return ce}),Z.d(ve,"s",function(){return ye}),Z.d(ve,"t",function(){return le}),Z.d(ve,"U",function(){return X}),Z.d(ve,"J",function(){return F}),Z.d(ve,"O",function(){return W}),Z.d(ve,"p",function(){return r}),Z.d(ve,"T",function(){return H}),Z.d(ve,"q",function(){return D}),Z.d(ve,"N",function(){return M}),Z.d(ve,"M",function(){return g}),Z.d(ve,"Q",function(){return p}),Z.d(ve,"u",function(){return u}),Z.d(ve,"x",function(){return m}),Z.d(ve,"I",function(){return b}),Z.d(ve,"f",function(){return E}),Z.d(ve,"h",function(){return _}),Z.d(ve,"g",function(){return f}),Z.d(ve,"i",function(){return O}),Z.d(ve,"G",function(){return w}),Z.d(ve,"H",function(){return R}),Z.d(ve,"r",function(){return x}),Z.d(ve,"R",function(){return I}),Z.d(ve,"d",function(){return k}),Z.d(ve,"e",function(){return A}),Z.d(ve,"E",function(){return P}),Z.d(ve,"F",function(){return S}),Z.d(ve,"j",function(){return C}),Z.d(ve,"z",function(){return c}),Z.d(ve,"K",function(){return v}),Z.d(ve,"L",function(){return l}),Z.d(ve,"m",function(){return T}),Z.d(ve,"k",function(){return n}),Z.d(ve,"A",function(){return U}),Z.d(ve,"a",function(){return j}),Z.d(ve,"n",function(){return Y}),Z.d(ve,"l",function(){return J}),Z.d(ve,"D",function(){return ee}),Z.d(ve,"B",function(){return ie}),Z.d(ve,"b",function(){return re}),Z.d(ve,"S",function(){return he}),Z.d(ve,"o",function(){return oe}),Z.d(ve,"P",function(){return ae}),Z.d(ve,"w",function(){return Ee}),Z.d(ve,"c",function(){return Le}),Z.d(ve,"y",function(){return He});function se(de){return!de||typeof de!="string"?!0:de.trim().length===0}const Se=/{(\d+)}/g;function ce(de,...xe){return xe.length===0?de:de.replace(Se,function(Ie,De){const Be=parseInt(De,10);return isNaN(Be)||Be<0||Be>=xe.length?Ie:xe[Be]})}function ye(de){return de.replace(/[<>&]/g,function(xe){switch(xe){case"<":return"<";case">":return">";case"&":return"&";default:return xe}})}function le(de){return de.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function X(de,xe=" "){const Ie=F(de,xe);return W(Ie,xe)}function F(de,xe){if(!de||!xe)return de;const Ie=xe.length;if(Ie===0||de.length===0)return de;let De=0;for(;de.indexOf(xe,De)===De;)De=De+Ie;return de.substring(De)}function W(de,xe){if(!de||!xe)return de;const Ie=xe.length,De=de.length;if(Ie===0||De===0)return de;let Be=De,ze=-1;for(;!(ze=de.lastIndexOf(xe,Be-1),ze===-1||ze+Ie!==Be);){if(ze===0)return"";Be=ze}return de.substring(0,Be)}function r(de){return de.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function H(de){return de.replace(/\*/g,"")}function D(de,xe,Ie={}){if(!de)throw new Error("Cannot create regex from empty string");xe||(de=le(de)),Ie.wholeWord&&(/\B/.test(de.charAt(0))||(de="\\b"+de),/\B/.test(de.charAt(de.length-1))||(de=de+"\\b"));let De="";return Ie.global&&(De+="g"),Ie.matchCase||(De+="i"),Ie.multiline&&(De+="m"),Ie.unicode&&(De+="u"),new RegExp(de,De)}function M(de){if(de.source==="^"||de.source==="^$"||de.source==="$"||de.source==="^\\s*$")return!1;const xe=de.exec("");return!!(xe&&de.lastIndex===0)}function g(de){return(de.global?"g":"")+(de.ignoreCase?"i":"")+(de.multiline?"m":"")+(de.unicode?"u":"")}function p(de){return de.split(/\r\n|\r|\n/)}function u(de){for(let xe=0,Ie=de.length;xe<Ie;xe++){const De=de.charCodeAt(xe);if(De!==32&&De!==9)return xe}return-1}function m(de,xe=0,Ie=de.length){for(let De=xe;De<Ie;De++){const Be=de.charCodeAt(De);if(Be!==32&&Be!==9)return de.substring(xe,De)}return de.substring(xe,Ie)}function b(de,xe=de.length-1){for(let Ie=xe;Ie>=0;Ie--){const De=de.charCodeAt(Ie);if(De!==32&&De!==9)return Ie}return-1}function E(de,xe){return de<xe?-1:de>xe?1:0}function _(de,xe,Ie=0,De=de.length,Be=0,ze=xe.length){for(;Ie<De&&Be<ze;Ie++,Be++){let ut=de.charCodeAt(Ie),Qe=xe.charCodeAt(Be);if(ut<Qe)return-1;if(ut>Qe)return 1}const Ye=De-Ie,Ze=ze-Be;return Ye<Ze?-1:Ye>Ze?1:0}function f(de,xe){return O(de,xe,0,de.length,0,xe.length)}function O(de,xe,Ie=0,De=de.length,Be=0,ze=xe.length){for(;Ie<De&&Be<ze;Ie++,Be++){let ut=de.charCodeAt(Ie),Qe=xe.charCodeAt(Be);if(ut===Qe)continue;if(ut>=128||Qe>=128)return _(de.toLowerCase(),xe.toLowerCase(),Ie,De,Be,ze);w(ut)&&(ut-=32),w(Qe)&&(Qe-=32);const st=ut-Qe;if(st===0)continue;return st}const Ye=De-Ie,Ze=ze-Be;return Ye<Ze?-1:Ye>Ze?1:0}function w(de){return de>=97&&de<=122}function R(de){return de>=65&&de<=90}function x(de,xe){return de.length===xe.length&&O(de,xe)===0}function I(de,xe){const Ie=xe.length;return xe.length>de.length?!1:O(de,xe,0,Ie)===0}function k(de,xe){let Ie,De=Math.min(de.length,xe.length);for(Ie=0;Ie<De;Ie++)if(de.charCodeAt(Ie)!==xe.charCodeAt(Ie))return Ie;return De}function A(de,xe){let Ie,De=Math.min(de.length,xe.length);const Be=de.length-1,ze=xe.length-1;for(Ie=0;Ie<De;Ie++)if(de.charCodeAt(Be-Ie)!==xe.charCodeAt(ze-Ie))return Ie;return De}function P(de){return 55296<=de&&de<=56319}function S(de){return 56320<=de&&de<=57343}function C(de,xe){return(de-55296<<10)+(xe-56320)+65536}function c(de,xe,Ie){const De=de.charCodeAt(Ie);if(P(De)&&Ie+1<xe){const Be=de.charCodeAt(Ie+1);if(S(Be))return C(De,Be)}return De}function o(de,xe){const Ie=de.charCodeAt(xe-1);if(S(Ie)&&xe>1){const De=de.charCodeAt(xe-2);if(P(De))return C(De,Ie)}return Ie}function v(de,xe){const Ie=Fe.getInstance(),De=xe,Be=de.length,ze=c(de,Be,xe);xe+=ze>=65536?2:1;let Ye=Ie.getGraphemeBreakType(ze);for(;xe<Be;){const Ze=c(de,Be,xe),ut=Ie.getGraphemeBreakType(Ze);if(Le(Ye,ut))break;xe+=Ze>=65536?2:1,Ye=ut}return xe-De}function l(de,xe){const Ie=Fe.getInstance(),De=xe,Be=o(de,xe);xe-=Be>=65536?2:1;let ze=Ie.getGraphemeBreakType(Be);for(;xe>0;){const Ye=o(de,xe),Ze=Ie.getGraphemeBreakType(Ye);if(Le(Ze,ze))break;xe-=Ye>=65536?2:1,ze=Ze}return De-xe}const a=/(?:[\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 T(de){return a.test(de)}const h=/(?:[\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 n(de){return h.test(de)}const N=/^[\t\n\r\x20-\x7E]*$/;function U(de){return N.test(de)}const j=/[\u2028\u2029]/;function Y(de){return j.test(de)}function J(de){for(let xe=0,Ie=de.length;xe<Ie;xe++)if(ee(de.charCodeAt(xe)))return!0;return!1}function ee(de){return de=+de,de>=11904&&de<=55215||de>=63744&&de<=64255||de>=65281&&de<=65374}function ie(de){return de>=127462&&de<=127487||de===8986||de===8987||de===9200||de===9203||de>=9728&&de<=10175||de===11088||de===11093||de>=127744&&de<=128591||de>=128640&&de<=128764||de>=128992&&de<=129003||de>=129280&&de<=129535||de>=129648&&de<=129750}const re=String.fromCharCode(65279);function he(de){return!!(de&&de.length>0&&de.charCodeAt(0)===65279)}function oe(de,xe=!1){return de?(xe&&(de=de.replace(/\\./g,"")),de.toLowerCase()!==de):!1}function ae(de){const xe=90-65+1;return de=de%(2*xe),de<xe?String.fromCharCode(97+de):String.fromCharCode(65+de-xe)}function Ee(de){const xe=Fe.getInstance();return xe.getGraphemeBreakType(de)}function Le(de,xe){return de===0?xe!==5&&xe!==7:de===2&&xe===3?!1:de===4||de===2||de===3||(xe===4||xe===2||xe===3)?!0:de===8&&(xe===8||xe===9||xe===11||xe===12)||((de===11||de===9)&&(xe===9||xe===10)||((de===12||de===10)&&xe===10||(xe===5||xe===13||(xe===7||(de===1||de===13&&xe===14)))))?!1:!(de===6&&xe===6)}class Fe{constructor(){this._data=Xe()}static getInstance(){return Fe._INSTANCE||(Fe._INSTANCE=new Fe),Fe._INSTANCE}getGraphemeBreakType(de){if(de<32)return de===10?3:de===13?2:4;if(de<127)return 0;const xe=this._data,Ie=xe.length/3;let De=1;for(;De<=Ie;)if(de<xe[3*De])De=2*De;else if(de>xe[3*De+1])De=2*De+1;else return xe[3*De+2];return 0}}Fe._INSTANCE=null;function Xe(){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 He(de,xe){if(de===0)return 0;const Ie=Ae(de,xe);if(Ie!==void 0)return Ie;const De=o(xe,de);return de-=Oe(De),de}function Ae(de,xe){let Ie=o(xe,de);for(de-=Oe(Ie);Ke(Ie)||Ie===65039||Ie===8419;){if(de===0)return;Ie=o(xe,de),de-=Oe(Ie)}if(!ie(Ie))return;if(de>=0){const De=o(xe,de);De===8205&&(de-=Oe(De))}return de}function Oe(de){return de>=65536?2:1}function Ke(de){return 127995<=de&&de<=127999}},ODXe:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return le});function se(X){if(Array.isArray(X))return X}function Se(X,F){var W=X==null?null:typeof Symbol!="undefined"&&X[Symbol.iterator]||X["@@iterator"];if(W!=null){var r,H,D,M,g=[],p=!0,u=!1;try{if(D=(W=W.call(X)).next,F===0){if(Object(W)!==W)return;p=!1}else for(;!(p=(r=D.call(W)).done)&&(g.push(r.value),g.length!==F);p=!0);}catch(m){u=!0,H=m}finally{try{if(!p&&W.return!=null&&(M=W.return(),Object(M)!==M))return}finally{if(u)throw H}}return g}}var ce=Z("BsWD");function ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function le(X,F){return se(X)||Se(X,F)||Object(ce.a)(X,F)||ye()}},Ot1p:function(at,ve,Z){"use strict";var se=Z("c3Iv"),Se=Z("rBQ5"),ce=Z("sh+1"),ye=Z("8OG5"),le=Z("mgsT"),X=Z("IYef"),F=Z("Hqw+"),W=Z("Hbia"),r=Z("XXmO"),H=Z.n(r),D=Z("T/Jt"),M=Z.n(D),g=Z("VrN/"),p=Z.n(g),u=Z("bdgK"),m=Z("p77/"),b=Z("Bd2K"),E=Z("ELLl"),_=Z("19Vz"),f=Z("lZu9"),O=Z("+NIl"),w=Z("kSUc"),R=Z("9Bee"),x=function(we){var Me=we.value,je=Me===void 0?"":Me,qe=we.className,ct=we.showTextOnly,et=we.showLines,kt=we.style,Ct=kt===void 0?{}:kt,pt=Object(D.useMemo)(function(){return""},[je]);return M.a.createElement(M.a.Fragment,null,M.a.createElement("div",{dangerouslySetInnerHTML:{__html:pt}}))},I=Z("HPgX"),k=Z("dejd"),A=Z("C+DQ"),P=Z("1vsH"),S=Z("m3rI"),C=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function c(we){var Me=we.onActionCallback,je=we.title,qe=we.icon,ct=we.actionName,et=we.className,kt=et===void 0?"":et,Ct=we.children;function pt(){Me(ct)}return M.a.createElement("a",{title:je,className:kt,onClick:pt},M.a.createElement("i",{className:"md-iconfont ".concat(qe)}),Ct)}var o=function(we){var Me=we.watch,je=we.showNullButton,qe=we.onActionCallback,ct=we.fullScreen,et=we.insertTemp,kt=we.hidetoolBar,Ct=we.uuid,pt=we.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(P.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(P.G)("_educoder_session"),"&key=").concat(Ct,"&api=").concat(encodeURIComponent(S.a.PROXY_SERVER)));var Nt=[].concat(C,[{title:"".concat(Me?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Me?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return M.a.createElement("ul",{className:"markdown-toolbar-container"},!kt&&Nt.map(function(Et,wt){return M.a.createElement("li",{key:wt},Et.actionName?M.a.createElement(c,Object(I.a)({},Et,{onActionCallback:qe})):M.a.createElement("span",{className:"v-line"}))}),je?M.a.createElement("li",null,M.a.createElement(c,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:qe},M.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,et&&M.a.createElement("li",null,M.a.createElement(c,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(et),onActionCallback:qe},M.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),M.a.createElement("li",{className:"btn-full-screen"},M.a.createElement(c,{icon:"".concat(ct?"icon-shrink":"icon-enlarge"),title:ct?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:qe})))},v=Z("M8RZ"),l=Z("dLI4"),a=Z("4d5L"),T=Z("y6Ii"),h=Z("Wuip"),n=Z("47JS"),N=Z("TOZL"),U={labelCol:{span:4},wrapperCol:{span:20}},j=function(we){var Me=we.callback,je=we.onCancel;function qe(ct){Me(ct)}return M.a.createElement(h.a,Object(I.a)({},U,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:qe}),M.a.createElement(h.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},M.a.createElement(N.a,null)),M.a.createElement(h.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},M.a.createElement(N.a,null)),M.a.createElement("div",{className:"flex-container flex-end"},M.a.createElement(a.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),M.a.createElement(a.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))},Y=Z("7ahc"),J=Z("HmJG"),ee=Z("BjJ7"),ie=h.a.useForm,re={width:280,marginRight:10},he={labelCol:{span:5},wrapperCol:{span:19}},oe=function(we){var Me=we.callback,je=we.onCancel,qe=ie(),ct=Object(F.a)(qe,1),et=ct[0];function kt(Nt){Me(Nt)}function Ct(Nt,Et){if(Nt.status===-1){le.b.error(Nt.message);return}et.setFieldsValue({src:"/api/attachments/".concat(Nt.id),type:Et.type})}function pt(Nt){var Et=Nt.target.files[0];Ee(Et,Ct)}return M.a.createElement(h.a,Object(I.a)({form:et},he,{className:"upload-image-panel",onFinish:kt}),M.a.createElement(h.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},M.a.createElement("div",{className:"flex-container"},M.a.createElement(h.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},M.a.createElement(N.a,{style:re})),M.a.createElement(ae,{onFileChange:pt}))),M.a.createElement(h.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},M.a.createElement(N.a,{style:{width:264}})),M.a.createElement(h.a.Item,{style:{textAlign:"right"}},M.a.createElement(a.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),M.a.createElement(a.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))};function ae(we){var Me=we.onFileChange;return M.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",M.a.createElement("input",{type:"file",onChange:Me}))}function Ee(we,Me){if(!we)throw new String("\u6CA1\u6709\u6587\u4EF6");var je=new FormData;je.append("editormd-image-file",we),je.append("file_param_name","editormd-image-file"),je.append("byxhr","true");var qe=new window.XMLHttpRequest;qe.withCredentials=!0,qe.addEventListener("load",function(ct){Me(JSON.parse(ct.target.responseText),we)},!1),qe.addEventListener("error",function(ct){console.error(ct)},!1),qe.open("POST","".concat(ee.a,"/api/attachments.json")),qe.send(je)}var Le=Z("XlT3"),Fe=Z("e7Hv"),Xe=Z("2yBE"),He=Z("5LYH"),Ae=He.a.Group,Oe={margin:"0 8px"},Ke=function(we){var Me=we.callback,je=we.onCancel;function qe(ct){Me(ct)}return M.a.createElement(h.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:qe},M.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},M.a.createElement("span",{style:Oe},"\u5355\u5143\u683C\u6570\uFF1A"),M.a.createElement("span",{style:Oe},"\u884C\u6570"),M.a.createElement(h.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},M.a.createElement(Fe.a,null)),M.a.createElement("span",{style:Oe},"\u5217\u6570"),M.a.createElement(h.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},M.a.createElement(Fe.a,null))),M.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},M.a.createElement("span",{style:Oe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),M.a.createElement(h.a.Item,{name:"align"},M.a.createElement(Ae,null,M.a.createElement(He.a,{value:"default"},M.a.createElement("i",{className:"fa fa-align-justify"})),M.a.createElement(He.a,{value:"left"},M.a.createElement("i",{className:"fa fa-align-left"})),M.a.createElement(He.a,{value:"center"},M.a.createElement("i",{className:"fa fa-align-center"})),M.a.createElement(He.a,{value:"right"},M.a.createElement("i",{className:"fa fa-align-right"}))))),M.a.createElement("div",{className:"flex-container flex-end"},M.a.createElement(a.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),M.a.createElement(a.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))},de=Z("ErOA"),xe=Z("7Cbv"),Ie="link",De="upload-image",Be="code-block",ze="add-table",Ye="------------",Ze={default:Ye,left:":".concat(Ye),center:":".concat(Ye,":"),right:"".concat(Ye,":")},ut=Z("9VGf"),Qe,st;function Ne(){}var vt=0,ht=1e4,Ue="\u2581",Ve=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function Ce(we){return/^\d+$/.test(we)?"".concat(we,"px"):we}var _e=navigator.platform.toUpperCase().indexOf("MAC")>=0,Te=_e?"Cmd":"Ctrl",ne=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ue=(Qe={},Object(W.a)(Qe,Te+"-B","bold"),Object(W.a)(Qe,Te+"-I","italic"),Qe),fe=(st={},Object(W.a)(st,Ie,"\u6DFB\u52A0\u94FE\u63A5"),Object(W.a)(st,Be,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(W.a)(st,De,"\u6DFB\u52A0\u6587\u4EF6"),Object(W.a)(st,ze,"\u6DFB\u52A0\u8868\u683C"),st),me=ve.a=function(we){var Me=we.defaultValue,je=Me===void 0?"":Me,qe=we.onChange,ct=we.width,et=ct===void 0?"100%":ct,kt=we.height,Ct=kt===void 0?400:kt,pt=we.miniToolbar,Nt=pt===void 0?!1:pt,Et=we.isFocus,wt=Et===void 0?!1:Et,Ht=we.watch,It=we.insertTemp,rr=we.mode,Rr=rr===void 0?"markdown":rr,ar=we.id,xr=ar===void 0?"markdown-editor-id":ar,tt=we.showResizeBar,At=tt===void 0?!1:tt,Lt=we.noStorage,Ut=Lt===void 0?!1:Lt,fr=we.showNullButton,Yt=fr===void 0?!1:fr,mt=we.hidetoolBar,sr=mt===void 0?!1:mt,Qt=we.fullScreen,Jt=Qt===void 0?!1:Qt,Dt=we.onBlur,dr=we.onCMBeforeChange,yr=we.onFullScreen,Yr=we.className,Je=Yr===void 0?"":Yr,nt=we.disablePaste,Ot=nt===void 0?!1:nt,Kt=we.placeholder,Pt=Kt===void 0?"":Kt,br=we.values,Xr=br===void 0?"":br,St=Object(D.useState)(null),V=Object(F.a)(St,2),y=V[0],L=V[1],G=Object(D.useState)(je),q=Object(F.a)(G,2),K=q[0],pe=q[1],Pe=Object(D.useState)(Ht),it=Object(F.a)(Pe,2),dt=it[0],Ge=it[1],yt=Object(D.useState)(Jt),Ft=Object(F.a)(yt,2),qt=Ft[0],Zr=Ft[1],Fr=Object(D.useState)(""),ur=Object(F.a)(Fr,2),or=ur[0],ln=ur[1],Vn=Object(D.useState)(0),en=Object(F.a)(Vn,2),kr=en[0],Dn=en[1],Yn=Object(D.useState)(Ct),Xn=Object(F.a)(Yn,2),mn=Xn[0],Tn=Xn[1],$n=Object(D.useState)(!1),gn=Object(F.a)($n,2),rn=gn[0],un=gn[1],vn=Object(D.useRef)(Object(xe.a)()),yn=Object(D.useRef)(!1),pr=Object(D.useRef)(),zt=Object(D.useRef)(),mr=Object(D.useRef)(),jt=Object(D.useRef)(),Or=Object(D.useRef)(),nr=function(){var bt=Object(X.a)(H.a.mark(function Rt(){var xt,Bt;return H.a.wrap(function(er){for(;;)switch(er.prev=er.next){case 0:return er.next=2,Object(de.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:vn.current}});case 2:Bt=er.sent,Bt!=null&&(xt=Bt.attachments)!==null&&xt!==void 0&&xt.length&&(console.log("cm:",y,zt),Bt.attachments.map(function(Gt){Gt.content_type.indexOf("image")>-1?y.replaceSelection(".concat(Gt.content_type,")")):Gt.content_type.indexOf("video")>-1?y.replaceSelection('<video width="100%" controls src="'.concat(S.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Gt.content_type.indexOf("pdf")>-1?y.replaceSelection('<a href="'.concat(S.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):y.replaceSelection("[".concat(Gt.name,"](").concat(S.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}));case 4:case"end":return er.stop()}},Rt)}));return function(){return bt.apply(this,arguments)}}();Object(D.useEffect)(function(){pe(Xr),y==null||y.setValue(Xr)},[Xr]),Object(D.useEffect)(function(){yr==null||yr(qt)},[qt]),Object(D.useEffect)(function(){if(zt.current){var bt=p.a.fromTextArea(zt.current,{mode:Rr,lineNumbers:!Nt,lineWrapping:!0,value:je,autoCloseTags:!0,autoCloseBrackets:!0});wt&&bt.focus();function Rt(xt,Bt){if(Ot){Bt.preventDefault();return}var Vt=Bt.clipboardData;if(Vt){var er=Vt.types.toString(),Gt=Vt.items;if(er==="Files"||Vt.types.indexOf("Files")>-1){if(Bt.preventDefault(),Rr=="stex")return;try{var _r,Hr=Gt[1];((_r=Gt[0])===null||_r===void 0?void 0:_r.kind)==="file"&&(Hr=Gt[0]);var Wt=Hr.getAsFile(),_n=Wt.name.split(".").pop();Ee(Wt,function(Xt){if(Xt.id){var jr,Pr,tn;(Wt==null||((jr=Wt.type)===null||jr===void 0)?void 0:jr.indexOf("image"))>-1?bt.replaceSelection(".concat(Xt.content_type,")")):(Wt==null||((Pr=Wt.type)===null||Pr===void 0)?void 0:Pr.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(S.a.API_SERVER,"/api/attachments/").concat(Xt.id,'"></video>')):(Wt==null||((tn=Wt.type)===null||tn===void 0)?void 0:tn.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(S.a.API_SERVER,"/api/attachments/").concat(Xt.id,"?type=").concat(Wt.type,'&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):ne.includes(_n)?bt.replaceSelection('<a href="'.concat(S.a.API_SERVER,"/api/attachments/").concat(Xt.id,'?type=office&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):bt.replaceSelection("[".concat(Wt.name,"](").concat(S.a.API_SERVER,"/api/attachments/").concat(Xt.id,"?type=").concat(Xt.content_type,")"))}else(Xt==null?void 0:Xt.status)===401&&(document.location.href="/user/login")})}catch(Xt){le.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return bt.on("paste",Rt),bt.on("dragleave",function(xt,Bt){mr.current.classList.remove("mouse-hover-md")}),bt.on("dragover",function(xt,Bt){mr.current.classList.add("mouse-hover-md")}),bt.on("drop",function(xt,Bt){mr.current.classList.add("mouse-hover-md");var Vt;if(Vt=Bt.dataTransfer.files,Vt.length>0){Bt.preventDefault(),Bt.stopPropagation();for(var er=function(Hr){var Wt=Vt[Hr],_n=Wt.name.split(".").pop();Ee(Wt,function(Xt){if(Xt.id){var jr,Pr,tn;(Wt==null||((jr=Wt.type)===null||jr===void 0)?void 0:jr.indexOf("image"))>-1?bt.replaceSelection(".concat(Xt.content_type,")")):(Wt==null||((Pr=Wt.type)===null||Pr===void 0)?void 0:Pr.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(S.a.API_SERVER,"/api/attachments/").concat(Xt.id,'"></video>')):(Wt==null||((tn=Wt.type)===null||tn===void 0)?void 0:tn.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(S.a.API_SERVER,"/api/attachments/").concat(Xt.id,"?type=").concat(Wt.type,'&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):ne.includes(_n)?bt.replaceSelection('<a href="'.concat(S.a.API_SERVER,"/api/attachments/").concat(Xt.id,'?type=office&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):bt.replaceSelection("[".concat(Wt.name,"](").concat(S.a.API_SERVER,"/api/attachments/").concat(Xt.id,"?type=").concat(Xt.content_type,")"))}else(Xt==null?void 0:Xt.status)===401&&(document.location.href="/user/login")})},Gt=0;Gt<Vt.length;Gt++)er(Gt)}}),L(bt),function(){bt.off("paste",Rt)}}},[]);var Dr=Object(D.useCallback)(function(){if(mr.current)try{}catch(bt){console.log(bt,"---- to set md editor body height")}},[mn,mr,qt]);Object(D.useEffect)(function(){function bt(){var xt=new u.a(function(Bt){var Vt=Object(ce.a)(Bt),er;try{for(Vt.s();!(er=Vt.n()).done;){var Gt=er.value;(Gt.target.offsetHeight>0||Gt.target.offsetWidth>0)&&(Dr(),y.setSize("100%","100%"),y.refresh())}}catch(_r){Vt.e(_r)}finally{Vt.f()}});return xt.observe(zt.current.parentElement),xt}if(y){var Rt=bt();return function(){Rt.unobserve(zt.current.parentElement)}}},[y,Dr]),Object(D.useEffect)(function(){if(y){for(var bt=[],Rt=function(){var Gt=Bt[xt];Vt=Object(F.a)(Gt,2);var _r=Vt[0],Hr=Vt[1],Wt=Object(W.a)({},_r,function(){wr(Hr)});bt.push(Wt),y.addKeyMap(Wt)},xt=0,Bt=Object.entries(ue);xt<Bt.length;xt++){var Vt;Rt()}return pr.current=setInterval(function(){yn.current&&nr()},4e3),function(){clearInterval(pr.current);var er=Object(ce.a)(bt),Gt;try{for(er.s();!(Gt=er.n()).done;){var _r=Gt.value;y.removeKeyMap(_r)}}catch(Hr){er.e(Hr)}finally{er.f()}}}},[y]),Object(D.useEffect)(function(){Jt!==qt&&Zr(Jt)},[Jt]),Object(ut.a)(function(){if(!Ut&&kr>0){var bt=new Date().getTime(),Rt=window.sessionStorage.getItem(xr);bt>=kr+ht&&(!Rt||Rt!==K)&&(window.sessionStorage.setItem(xr,K),un(!0))}},ht),Object(D.useEffect)(function(){Ge(Ht)},[y,Ht]),Object(D.useEffect)(function(){y&&(wt&&y.focus())},[y,wt]),Object(D.useEffect)(function(){if(dt&&y){var bt=y.getScrollerElement();function Rt(xt){var Bt=xt.target;if(Or.current){var Vt=Bt.scrollTop/Bt.scrollHeight;Or.current.scrollTop=Or.current.scrollHeight*Vt}}return bt.addEventListener("scroll",Rt),function(){bt.removeEventListener("scroll",Rt)}}},[y,dt]),Object(D.useEffect)(function(){if(y&&dr){function bt(Rt,xt){dr(Rt,xt)}return y.on("beforeChange",bt),function(){y.off("beforeChange",bt)}}},[y,dr]),Object(D.useEffect)(function(){if(y&&Dt){function bt(){Dt(y.getValue())}return y.on("blur",bt),function(){y.off("blur",bt)}}},[y,Dt]),Object(D.useEffect)(function(){if(y){function bt(Rt){var xt=Rt.getValue();pe(xt),Dn(new Date().getTime()),Rt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),qe&&qe(xt)}return y.on("change",bt),function(){y.off("change",bt)}}},[y,qe]),Object(D.useEffect)(function(){y&&(je==null?(y.setValue(""),pe("")):je!==y.getValue()&&(y.setValue(je),pe(je),y.setCursor(y.lineCount(),0)))},[y,je]);var wr=Object(D.useCallback)(function(bt){var Rt=y.getCursor(),xt=y.getSelection(),Bt=xt.split(`
|
|
`);switch(bt){case"bold":return y.replaceSelection("**"+xt+"**"),xt===""&&y.setCursor(Rt.line,Rt.ch+2),y.focus();case"italic":return y.replaceSelection("*"+xt+"*"),xt===""&&y.setCursor(Rt.line,Rt.ch+1),y.focus();case"code":return y.replaceSelection("`"+xt+"`"),xt===""&&y.setCursor(Rt.line,Rt.ch+1),y.focus();case"inline-latex":return y.replaceSelection("`$$"+xt+"$$`"),xt===""&&y.setCursor(Rt.line,Rt.ch+3),y.focus();case"latex":return y.replaceSelection("```latex\n"+xt+"\n```"),y.setCursor(Rt.line+1,xt.length+1),y.focus();case"line-break":return y.replaceSelection(`<br/>
|
|
`),y.focus();case"list-ul":return xt===""?y.replaceSelection("- "+xt):y.replaceSelection(Bt.map(function(Vt){return Vt===""?"":"- ".concat(Vt)}).join(`
|
|
`)),y.focus();case"list-ol":return xt===""?y.replaceSelection("1. "+xt):y.replaceSelection(Bt.map(function(Vt,er){return Vt===""?"":"".concat(er+1,". ").concat(Vt)}).join(`
|
|
`)),y.focus();case"add-null-ch":return xt===""&&y.setCursor(Rt.line,Rt.ch+1),y.replaceSelection(Ue),y.focus();case"inster-template-1":return xt===""&&y.setCursor(Rt.line,Rt.ch),y.replaceSelection(Ve),y.focus();case"eraser":return y.setValue(""),y.focus();case"trigger-watch":return Ge(!dt),y.focus();case"trigger-full-screen":return Zr(!qt),y.focus();case Ie:ln(Ie);return;case Be:ln(Be);return;case De:ln(De);return;case ze:ln(ze);return;default:throw new Error}},[y,dt,qt]),bn=Object(D.useCallback)(function(bt){ln("");switch(or){case Ie:var Rt=bt.title,xt=bt.link;return y.replaceSelection("[".concat(Rt,"](").concat(xt,")")),y.focus();case Be:var Bt=bt.language,Vt=bt.content;return y.replaceSelection(["```"+Bt,Vt,"```"].join(`
|
|
`)),y.focus();case De:var er=bt.src,Gt=bt.alt;return Gt?y.replaceSelection(".concat(er,' "').concat(Gt,'" )')):y.replaceSelection("")),y.focus();case ze:for(var _r=bt.row,Hr=bt.col,Wt=bt.align,_n=`
|
|
`,Xt=0;Xt<_r;Xt++){for(var jr=[],Pr=[],tn=0;tn<Hr;tn++)Xt===1&&Pr.push(Ze[Wt]),jr.push(" ");Xt===1&&(_n+="| ".concat(Pr.join(" | "),` |
|
|
`)),_n+="| ".concat(jr.join(Hr===1?"":" | "),` |
|
|
`)}return y.replaceSelection(_n+`
|
|
`),y.focus();default:throw new Error}},[y,or]),Pn=Object(D.useMemo)(function(){switch(or){case Ie:return M.a.createElement(j,{callback:bn,onCancel:hn});case Be:return M.a.createElement(Y.b,{callback:bn,onCancel:hn});case De:return M.a.createElement(oe,{callback:bn,onCancel:hn});case ze:return M.a.createElement(Ke,{callback:bn,onCancel:hn});default:return null}},[or]);function hn(){ln("")}Object(D.useEffect)(function(){if(jt.current){var bt=jt.current,Rt=!1,xt=0;function Bt(Gt){Rt=!0,xt=Gt.pageY}function Vt(){Rt=!1}function er(Gt){if(Rt){var _r=Gt.pageY-xt;_r<0&&(_r=0),_r>300&&(_r=300);var Hr=Ct+_r+"px";Tn(Hr)}}return bt.addEventListener("mousedown",Bt),document.addEventListener("mousemove",er),document.addEventListener("mouseup",Vt),function(){bt.removeEventListener("mousedown",Bt),document.removeEventListener("mousemove",er),document.removeEventListener("mouseup",Vt)}}},[y,jt]),Object(D.useEffect)(function(){Tn(Ct)},[Ct]);var dn=Ce(et),fi=Ce(mn),nn={width:dn,height:fi},pi=Object(D.useMemo)(function(){if(kr){var bt=new Date(kr),Rt=bt.getHours(),xt=bt.getMinutes(),Bt=bt.getSeconds();return Rt=Rt<10?"0"+Rt:Rt,xt=xt<10?"0"+xt:xt,Bt=Bt<10?"0"+Bt:Bt,"".concat(Rt,":").concat(xt,":").concat(Bt)}return 0},[kr]);function Hi(){window.sessionStorage.removeItem(xr),un(!1),Dn(0)}function Mn(){un(!1),Dn(0),y.setValue(window.sessionStorage.getItem(xr))}function ua(bt,Rt){var xt=y.getValue();xt=xt.replace(bt,Rt),pe(xt),y==null||y.setValue(xt)}return M.a.createElement(D.Fragment,null,M.a.createElement("div",{className:"markdown-editor-wrapper",ref:mr},M.a.createElement("div",{className:"markdown-editor-container ".concat(Je," ").concat(dt?"on-preview":""," ").concat(Nt?"mini":""," ").concat(qt?"full-screen":""),style:nn},M.a.createElement(o,{insertTemp:It,watch:dt,fullScreen:qt,showNullButton:Yt,onActionCallback:wr,hidetoolBar:sr,uuid:vn.current,setOpenPhones:function(){yn.current=!0}}),M.a.createElement("div",{className:"markdown-editor-body"},M.a.createElement("div",{className:"codemirror-container"},M.a.createElement("textarea",{ref:zt,placeholder:Pt})),dt?M.a.createElement("div",{ref:Or,className:"preview-container"},Rr==="stex"&&M.a.createElement(x,{value:K}),Rr!=="stex"&&M.a.createElement(R.a,{edit:!0,value:K,replaces:ua})):null))),At?M.a.createElement("a",{ref:jt,className:"editor-resize"}):null,M.a.createElement(v.a,null,fe[or]?M.a.createElement(Se.a,{centered:!0,title:fe[or],visible:!0,onCancel:hn,footer:null,className:"markdown-popup-form"},Pn):null))}},SJMd:function(at,ve){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var Z,se,Se,ce=!1,ye,le;window.PR_SHOULD_USE_CONTINUATION=!0;var X,F;(function(){var W=window,r=["break,continue,do,else,for,if,return,while"],H=[r,"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=[H,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[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"],g=[D,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],p=[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"],u="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",m=[D,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],b="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",E=[r,"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"],_=[r,"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"],f=[r,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],O=[M,p,g,m,b,E,_,f],w=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,R="str",x="kwd",I="com",k="typ",A="lit",P="pun",S="pln",C="tag",c="dec",o="src",v="atn",l="atv",a="nocode",T="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function h(Ae){for(var Oe=0,Ke=!1,de=!1,xe=0,Ie=Ae.length;xe<Ie;++xe){var De=Ae[xe];if(De.ignoreCase)de=!0;else if(/[a-z]/i.test(De.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ke=!0,de=!1;break}}var Be={b:8,t:9,n:10,v:11,f:12,r:13};function ze(st){var Ne=st.charCodeAt(0);if(Ne!==92)return Ne;var vt=st.charAt(1);return Ne=Be[vt],Ne||("0"<=vt&&vt<="7"?parseInt(st.substring(1),8):vt==="u"||vt==="x"?parseInt(st.substring(2),16):st.charCodeAt(1))}function Ye(st){if(st<32)return(st<16?"\\x0":"\\x")+st.toString(16);var Ne=String.fromCharCode(st);return Ne==="\\"||Ne==="-"||Ne==="]"||Ne==="^"?"\\"+Ne:Ne}function Ze(st){var Ne=st.substring(1,st.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")),vt=[],ht=Ne[0]==="^",Ue=["["];ht&&Ue.push("^");for(var Ve=ht?1:0,Ce=Ne.length;Ve<Ce;++Ve){var _e=Ne[Ve];if(/\\[bdsw]/i.test(_e))Ue.push(_e);else{var Te=ze(_e),ne;Ve+2<Ce&&Ne[Ve+1]==="-"?(ne=ze(Ne[Ve+2]),Ve+=2):ne=Te,vt.push([Te,ne]),ne<65||Te>122||(ne<65||Te>90||vt.push([Math.max(65,Te)|32,Math.min(ne,90)|32]),ne<97||Te>122||vt.push([Math.max(97,Te)&~32,Math.min(ne,122)&~32]))}}vt.sort(function(we,Me){return we[0]-Me[0]||Me[1]-we[1]});for(var ue=[],fe=[],Ve=0;Ve<vt.length;++Ve){var me=vt[Ve];me[0]<=fe[1]+1?fe[1]=Math.max(fe[1],me[1]):ue.push(fe=me)}for(var Ve=0;Ve<ue.length;++Ve){var me=ue[Ve];Ue.push(Ye(me[0])),me[1]>me[0]&&(me[1]+1>me[0]&&Ue.push("-"),Ue.push(Ye(me[1])))}return Ue.push("]"),Ue.join("")}function ut(st){for(var Ne=st.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")),vt=Ne.length,ht=[],Ue=0,Ve=0;Ue<vt;++Ue){var Ce=Ne[Ue];if(Ce==="(")++Ve;else if(Ce.charAt(0)==="\\"){var _e=+Ce.substring(1);_e&&(_e<=Ve?ht[_e]=-1:Ne[Ue]=Ye(_e))}}for(var Ue=1;Ue<ht.length;++Ue)ht[Ue]===-1&&(ht[Ue]=++Oe);for(var Ue=0,Ve=0;Ue<vt;++Ue){var Ce=Ne[Ue];if(Ce==="(")++Ve,ht[Ve]||(Ne[Ue]="(?:");else if(Ce.charAt(0)==="\\"){var _e=+Ce.substring(1);_e&&_e<=Ve&&(Ne[Ue]="\\"+ht[_e])}}for(var Ue=0;Ue<vt;++Ue)Ne[Ue]==="^"&&Ne[Ue+1]!=="^"&&(Ne[Ue]="");if(st.ignoreCase&&Ke)for(var Ue=0;Ue<vt;++Ue){var Ce=Ne[Ue],Te=Ce.charAt(0);Ce.length>=2&&Te==="["?Ne[Ue]=Ze(Ce):Te!=="\\"&&(Ne[Ue]=Ce.replace(/[a-zA-Z]/g,function(fe){var me=fe.charCodeAt(0);return"["+String.fromCharCode(me&~32,me|32)+"]"}))}return Ne.join("")}for(var Qe=[],xe=0,Ie=Ae.length;xe<Ie;++xe){var De=Ae[xe];if(De.global||De.multiline)throw new Error(""+De);Qe.push("(?:"+ut(De)+")")}return new RegExp(Qe.join("|"),de?"gi":"g")}function n(Ae,Oe){var Ke=/(?:^|\s)nocode(?:\s|$)/,de=[],xe=0,Ie=[],De=0;function Be(ze){var Ye=ze.nodeType;if(Ye==1){if(Ke.test(ze.className))return;for(var Ze=ze.firstChild;Ze;Ze=Ze.nextSibling)Be(Ze);var ut=ze.nodeName.toLowerCase();(ut==="br"||ut==="li")&&(de[De]=`
|
|
`,Ie[De<<1]=xe++,Ie[De++<<1|1]=ze)}else if(Ye==3||Ye==4){var Qe=ze.nodeValue;Qe.length&&(Oe?Qe=Qe.replace(/\r\n?/g,`
|
|
`):Qe=Qe.replace(/[ \t\r\n]+/g," "),de[De]=Qe,Ie[De<<1]=xe,xe+=Qe.length,Ie[De++<<1|1]=ze)}}return Be(Ae),{sourceCode:de.join("").replace(/\n$/,""),spans:Ie}}function N(Ae,Oe,Ke,de,xe){if(!Ke)return;var Ie={sourceNode:Ae,pre:1,langExtension:null,numberLines:null,sourceCode:Ke,spans:null,basePos:Oe,decorations:null};de(Ie),xe.push.apply(xe,Ie.decorations)}var U=/\S/;function j(Ae){for(var Oe=void 0,Ke=Ae.firstChild;Ke;Ke=Ke.nextSibling){var de=Ke.nodeType;Oe=de===1?Oe?Ae:Ke:de===3&&U.test(Ke.nodeValue)?Ae:Oe}return Oe===Ae?void 0:Oe}function Y(Ae,Oe){var Ke={},de;(function(){for(var De=Ae.concat(Oe),Be=[],ze={},Ye=0,Ze=De.length;Ye<Ze;++Ye){var ut=De[Ye],Qe=ut[3];if(Qe)for(var st=Qe.length;--st>=0;)Ke[Qe.charAt(st)]=ut;var Ne=ut[1],vt=""+Ne;ze.hasOwnProperty(vt)||(Be.push(Ne),ze[vt]=null)}Be.push(/[\0-\uffff]/),de=h(Be)})();var xe=Oe.length,Ie=function(De){for(var Be=De.sourceCode,ze=De.basePos,Ye=De.sourceNode,Ze=[ze,S],ut=0,Qe=Be.match(de)||[],st={},Ne=0,vt=Qe.length;Ne<vt;++Ne){var ht=Qe[Ne],Ue=st[ht],Ve=void 0,Ce;if(typeof Ue=="string")Ce=!1;else{var _e=Ke[ht.charAt(0)];if(_e)Ve=ht.match(_e[1]),Ue=_e[0];else{for(var Te=0;Te<xe;++Te)if(_e=Oe[Te],Ve=ht.match(_e[1]),Ve){Ue=_e[0];break}Ve||(Ue=S)}Ce=Ue.length>=5&&Ue.substring(0,5)==="lang-",Ce&&!(Ve&&typeof Ve[1]=="string")&&(Ce=!1,Ue=o),Ce||(st[ht]=Ue)}var ne=ut;if(ut+=ht.length,!Ce)Ze.push(ze+ne,Ue);else{var ue=Ve[1],fe=ht.indexOf(ue),me=fe+ue.length;Ve[2]&&(me=ht.length-Ve[2].length,fe=me-ue.length);var we=Ue.substring(5);N(Ye,ze+ne,ht.substring(0,fe),Ie,Ze),N(Ye,ze+ne+fe,ue,ae(we,ue),Ze),N(Ye,ze+ne+me,ht.substring(me),Ie,Ze)}}De.decorations=Ze};return Ie}function J(Ae){var Oe=[],Ke=[];Ae.tripleQuotedStrings?Oe.push([R,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ae.multiLineStrings?Oe.push([R,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Oe.push([R,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ae.verbatimStrings&&Ke.push([R,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var de=Ae.hashComments;de&&(Ae.cStyleComments?(de>1?Oe.push([I,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Oe.push([I,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ke.push([R,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Oe.push([I,/^#[^\r\n]*/,null,"#"])),Ae.cStyleComments&&(Ke.push([I,/^\/\/[^\r\n]*/,null]),Ke.push([I,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var xe=Ae.regexLiterals;if(xe){var Ie=xe>1?"":`
|
|
\r`,De=Ie?".":"[\\S\\s]",Be="/(?=[^/*"+Ie+"])(?:[^/\\x5B\\x5C"+Ie+"]|\\x5C"+De+"|\\x5B(?:[^\\x5C\\x5D"+Ie+"]|\\x5C"+De+")*(?:\\x5D|$))+/";Ke.push(["lang-regex",RegExp("^"+T+"("+Be+")")])}var ze=Ae.types;ze&&Ke.push([k,ze]);var Ye=(""+Ae.keywords).replace(/^ | $/g,"");Ye.length&&Ke.push([x,new RegExp("^(?:"+Ye.replace(/[\s,]+/g,"|")+")\\b"),null]),Oe.push([S,/^\s+/,null,` \r
|
|
\xA0`]);var Ze="^.[^\\s\\w.$@'\"`/\\\\]*";return Ae.regexLiterals&&(Ze+="(?!s*/)"),Ke.push([A,/^@[a-z_$][a-z_$@0-9]*/i,null],[k,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[S,/^[a-z_$][a-z_$@0-9]*/i,null],[A,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[S,/^\\[\s\S]?/,null],[P,new RegExp(Ze),null]),Y(Oe,Ke)}var ee=J({keywords:O,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ie(Ae,Oe,Ke){for(var de=/(?:^|\s)nocode(?:\s|$)/,xe=/\r\n?|\n/,Ie=Ae.ownerDocument,De=Ie.createElement("li");Ae.firstChild;)De.appendChild(Ae.firstChild);var Be=[De];function ze(Ne){var vt=Ne.nodeType;if(vt==1&&!de.test(Ne.className))if(Ne.nodeName==="br")Ye(Ne),Ne.parentNode&&Ne.parentNode.removeChild(Ne);else for(var ht=Ne.firstChild;ht;ht=ht.nextSibling)ze(ht);else if((vt==3||vt==4)&&Ke){var Ue=Ne.nodeValue,Ve=Ue.match(xe);if(Ve){var Ce=Ue.substring(0,Ve.index);Ne.nodeValue=Ce;var _e=Ue.substring(Ve.index+Ve[0].length);if(_e){var Te=Ne.parentNode;Te.insertBefore(Ie.createTextNode(_e),Ne.nextSibling)}Ye(Ne),Ce||Ne.parentNode.removeChild(Ne)}}}function Ye(Ne){for(;!Ne.nextSibling;)if(Ne=Ne.parentNode,!Ne)return;function vt(Ve,Ce){var _e=Ce?Ve.cloneNode(!1):Ve,Te=Ve.parentNode;if(Te){var ne=vt(Te,1),ue=Ve.nextSibling;ne.appendChild(_e);for(var fe=ue;fe;fe=ue)ue=fe.nextSibling,ne.appendChild(fe)}return _e}for(var ht=vt(Ne.nextSibling,0),Ue;(Ue=ht.parentNode)&&Ue.nodeType===1;)ht=Ue;Be.push(ht)}for(var Ze=0;Ze<Be.length;++Ze)ze(Be[Ze]);Oe===(Oe|0)&&Be[0].setAttribute("value",Oe);var ut=Ie.createElement("ol");ut.className="linenums";for(var Qe=Math.max(0,Oe-1|0)||0,Ze=0,st=Be.length;Ze<st;++Ze)De=Be[Ze],De.className="L"+(Ze+Qe)%10,De.firstChild||De.appendChild(Ie.createTextNode("\xA0")),ut.appendChild(De);Ae.appendChild(ut)}function re(Ae){var Oe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Oe=Oe&&+Oe[1]<=8;var Ke=/\n/g,de=Ae.sourceCode,xe=de.length,Ie=0,De=Ae.spans,Be=De.length,ze=0,Ye=Ae.decorations,Ze=Ye.length,ut=0;Ye[Ze]=xe;var Qe,st;for(st=Qe=0;st<Ze;)Ye[st]!==Ye[st+2]?(Ye[Qe++]=Ye[st++],Ye[Qe++]=Ye[st++]):st+=2;for(Ze=Qe,st=Qe=0;st<Ze;){for(var Ne=Ye[st],vt=Ye[st+1],ht=st+2;ht+2<=Ze&&Ye[ht+1]===vt;)ht+=2;Ye[Qe++]=Ne,Ye[Qe++]=vt,st=ht}Ze=Ye.length=Qe;var Ue=Ae.sourceNode,Ve="";Ue&&(Ve=Ue.style.display,Ue.style.display="none");try{for(var Ce=null;ze<Be;){var _e=De[ze],Te=De[ze+2]||xe,ne=Ye[ut+2]||xe,ht=Math.min(Te,ne),ue=De[ze+1],fe;if(ue.nodeType!==1&&(fe=de.substring(Ie,ht))){Oe&&(fe=fe.replace(Ke,"\r")),ue.nodeValue=fe;var me=ue.ownerDocument,we=me.createElement("span");we.className=Ye[ut+1];var Me=ue.parentNode;Me.replaceChild(we,ue),we.appendChild(ue),Ie<Te&&(De[ze+1]=ue=me.createTextNode(de.substring(ht,Te)),Me.insertBefore(ue,we.nextSibling))}Ie=ht,Ie>=Te&&(ze+=2),Ie>=ne&&(ut+=2)}}finally{Ue&&(Ue.style.display=Ve)}}var he={};function oe(Ae,Oe){for(var Ke=Oe.length;--Ke>=0;){var de=Oe[Ke];he.hasOwnProperty(de)?W.console&&console.warn("cannot override language handler %s",de):he[de]=Ae}}function ae(Ae,Oe){return Ae&&he.hasOwnProperty(Ae)||(Ae=/^\s*</.test(Oe)?"default-markup":"default-code"),he[Ae]}oe(ee,["default-code"]),oe(Y([],[[S,/^[^<?]+/],[c,/^<!\w[^>]*(?:>|$)/],[I,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[P,/^(?:<[%?]|[%?]>)/],["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"]),oe(Y([[S,/^[\s]+/,null,` \r
|
|
`],[l,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[C,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[v,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[P,/^[=<>\/]+/],["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"]),oe(Y([],[[l,/^[\s\S]+/]]),["uq.val"]),oe(J({keywords:M,hashComments:!0,cStyleComments:!0,types:w}),["c","cc","cpp","cxx","cyc","m"]),oe(J({keywords:"null,true,false"}),["json"]),oe(J({keywords:p,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:w}),["cs"]),oe(J({keywords:g,cStyleComments:!0}),["java"]),oe(J({keywords:f,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),oe(J({keywords:E,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),oe(J({keywords:b,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),oe(J({keywords:_,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),oe(J({keywords:m,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),oe(J({keywords:u,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),oe(Y([],[[R,/^[\s\S]+/]]),["regex"]);function Ee(Ae){var Oe=Ae.langExtension;try{var Ke=n(Ae.sourceNode,Ae.pre),de=Ke.sourceCode;Ae.sourceCode=de,Ae.spans=Ke.spans,Ae.basePos=0,ae(Oe,de)(Ae),re(Ae)}catch(xe){W.console&&console.log(xe&&xe.stack||xe)}}function Le(Ae,Oe,Ke){var de=Ke||!1,xe=Oe||null,Ie=document.createElement("div");Ie.innerHTML="<pre>"+Ae+"</pre>",Ie=Ie.firstChild,de&&ie(Ie,de,!0);var De={langExtension:xe,numberLines:de,sourceNode:Ie,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Ee(De),Ie.innerHTML}function Fe(Ae,Oe){var Ke=Oe||document.body,de=Ke.ownerDocument||document;function xe(_e){return Ke.getElementsByTagName(_e)}for(var Ie=[xe("pre"),xe("code"),xe("xmp")],De=[],Be=0;Be<Ie.length;++Be)for(var ze=0,Ye=Ie[Be].length;ze<Ye;++ze)De.push(Ie[Be][ze]);Ie=null;var Ze=Date;Ze.now||(Ze={now:function(){return+new Date}});var ut=0,Qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,st=/\bprettyprint\b/,Ne=/\bprettyprinted\b/,vt=/pre|xmp/i,ht=/^code$/i,Ue=/^(?:pre|code|xmp)$/i,Ve={};function Ce(){for(var _e=W.PR_SHOULD_USE_CONTINUATION?Ze.now()+250:Infinity;ut<De.length&&Ze.now()<_e;ut++){for(var Te=De[ut],ne=Ve,ue=Te;ue=ue.previousSibling;){var fe=ue.nodeType,me=(fe===7||fe===8)&&ue.nodeValue;if(me?!/^\??prettify\b/.test(me):fe!==3||/\S/.test(ue.nodeValue))break;if(me){ne={},me.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ht,It,rr){ne[It]=rr});break}}var we=Te.className;if((ne!==Ve||st.test(we))&&!Ne.test(we)){for(var Me=!1,je=Te.parentNode;je;je=je.parentNode){var qe=je.tagName;if(Ue.test(qe)&&je.className&&st.test(je.className)){Me=!0;break}}if(!Me){Te.className+=" prettyprinted";var ct=ne.lang;if(!ct){ct=we.match(Qe);var et;!ct&&(et=j(Te))&&ht.test(et.tagName)&&(ct=et.className.match(Qe)),ct&&(ct=ct[1])}var kt;if(vt.test(Te.tagName))kt=1;else{var Ct=Te.currentStyle,pt=de.defaultView,Nt=Ct?Ct.whiteSpace:pt&&pt.getComputedStyle?pt.getComputedStyle(Te,null).getPropertyValue("white-space"):0;kt=Nt&&Nt.substring(0,3)==="pre"}var Et=ne.linenums;(Et=Et==="true"||+Et)||(Et=we.match(/\blinenums\b(?::(\d+))?/),Et=Et?Et[1]&&Et[1].length?+Et[1]:!0:!1),Et&&ie(Te,Et,kt);var wt={langExtension:ct,sourceNode:Te,numberLines:Et,pre:kt,sourceCode:null,basePos:null,spans:null,decorations:null};Ee(wt)}}}ut<De.length?W.setTimeout(Ce,250):typeof Ae=="function"&&Ae()}Ce()}var Xe=W.PR={createSimpleLexer:Y,registerLangHandler:oe,sourceDecorator:J,PR_ATTRIB_NAME:v,PR_ATTRIB_VALUE:l,PR_COMMENT:I,PR_DECLARATION:c,PR_KEYWORD:x,PR_LITERAL:A,PR_NOCODE:a,PR_PLAIN:S,PR_PUNCTUATION:P,PR_SOURCE:o,PR_STRING:R,PR_TAG:C,PR_TYPE:k,prettyPrintOne:ce?W.prettyPrintOne=Le:X=Le,prettyPrint:F=ce?W.prettyPrint=Fe:F=Fe},He=W.define;typeof He=="function"&&He.amd&&He("google-code-prettify",[],function(){return Xe})})()},T8No:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return F}),Z.d(ve,"e",function(){return W}),Z.d(ve,"c",function(){return P}),Z.d(ve,"b",function(){return S}),Z.d(ve,"d",function(){return C}),Z.d(ve,"f",function(){return v});var se=Z("MNsG"),Se=Z("N0LK"),ce=Z("Cg/j");let ye=se.k||"";const le=new Map;le.set("false",!1),le.set("true",!0),le.set("isMac",se.f),le.set("isLinux",se.d),le.set("isWindows",se.i),le.set("isWeb",se.h),le.set("isMacNative",se.f&&!se.h),le.set("isEdge",ye.indexOf("Edg/")>=0),le.set("isFirefox",ye.indexOf("Firefox")>=0),le.set("isChrome",ye.indexOf("Chrome")>=0),le.set("isSafari",ye.indexOf("Safari")>=0);const X=Object.prototype.hasOwnProperty;class F{static has(a){return M.create(a)}static equals(a,T){return g.create(a,T)}static regex(a,T){return R.create(a,T)}static not(a){return b.create(a)}static and(...a){return k.create(a,null)}static or(...a){return A.create(a,null,!0)}static deserialize(a,T=!1){return a?this._deserializeOrExpression(a,T):void 0}static _deserializeOrExpression(a,T){let h=a.split("||");return A.create(h.map(n=>this._deserializeAndExpression(n,T)),null,!0)}static _deserializeAndExpression(a,T){let h=a.split("&&");return k.create(h.map(n=>this._deserializeOne(n,T)),null)}static _deserializeOne(a,T){if(a=a.trim(),a.indexOf("!=")>=0){let h=a.split("!=");return m.create(h[0].trim(),this._deserializeValue(h[1],T))}if(a.indexOf("==")>=0){let h=a.split("==");return g.create(h[0].trim(),this._deserializeValue(h[1],T))}if(a.indexOf("=~")>=0){let h=a.split("=~");return R.create(h[0].trim(),this._deserializeRegexValue(h[1],T))}if(a.indexOf(" in ")>=0){let h=a.split(" in ");return p.create(h[0].trim(),h[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(a)){const h=a.split(">=");return f.create(h[0].trim(),h[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(a)){const h=a.split(">");return _.create(h[0].trim(),h[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(a)){const h=a.split("<=");return w.create(h[0].trim(),h[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(a)){const h=a.split("<");return O.create(h[0].trim(),h[1].trim())}return/^\!\s*/.test(a)?b.create(a.substr(1).trim()):M.create(a)}static _deserializeValue(a,T){if(a=a.trim(),a==="true")return!0;if(a==="false")return!1;let h=/^'([^']*)'$/.exec(a);return h?h[1].trim():a}static _deserializeRegexValue(a,T){if(Object(Se.C)(a)){if(T)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let h=a.indexOf("/"),n=a.lastIndexOf("/");if(h===n||h<0){if(T)throw new Error(`bad regexp-value '${a}', missing /-enclosure`);return console.warn(`bad regexp-value '${a}', missing /-enclosure`),null}let N=a.slice(h+1,n),U=a[n+1]==="i"?"i":"";try{return new RegExp(N,U)}catch(j){if(T)throw new Error(`bad regexp-value '${a}', parse error: ${j}`);return console.warn(`bad regexp-value '${a}', parse error: ${j}`),null}}}function W(a,T){const h=a?a.substituteConstants():void 0,n=T?T.substituteConstants():void 0;return!h&&!n?!0:!h||!n?!1:h.equals(n)}function r(a,T){return a.cmp(T)}class H{constructor(){this.type=0}cmp(a){return this.type-a.type}equals(a){return a.type===this.type}substituteConstants(){return this}evaluate(a){return!1}serialize(){return"false"}keys(){return[]}negate(){return D.INSTANCE}}H.INSTANCE=new H;class D{constructor(){this.type=1}cmp(a){return this.type-a.type}equals(a){return a.type===this.type}substituteConstants(){return this}evaluate(a){return!0}serialize(){return"true"}keys(){return[]}negate(){return H.INSTANCE}}D.INSTANCE=new D;class M{constructor(a,T){this.key=a,this.negated=T,this.type=2}static create(a,T=null){const h=le.get(a);return typeof h=="boolean"?h?D.INSTANCE:H.INSTANCE:new M(a,T)}cmp(a){return a.type!==this.type?this.type-a.type:c(this.key,a.key)}equals(a){return a.type===this.type?this.key===a.key:!1}substituteConstants(){const a=le.get(this.key);return typeof a=="boolean"?a?D.INSTANCE:H.INSTANCE:this}evaluate(a){return!!a.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=b.create(this.key,this)),this.negated}}class g{constructor(a,T,h){this.key=a,this.value=T,this.negated=h,this.type=4}static create(a,T,h=null){if(typeof T=="boolean")return T?M.create(a,h):b.create(a,h);const n=le.get(a);if(typeof n=="boolean"){const N=n?"true":"false";return T===N?D.INSTANCE:H.INSTANCE}return new g(a,T,h)}cmp(a){return a.type!==this.type?this.type-a.type:o(this.key,this.value,a.key,a.value)}equals(a){return a.type===this.type?this.key===a.key&&this.value===a.value:!1}substituteConstants(){const a=le.get(this.key);if(typeof a=="boolean"){const T=a?"true":"false";return this.value===T?D.INSTANCE:H.INSTANCE}return this}evaluate(a){return a.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=m.create(this.key,this.value,this)),this.negated}}class p{constructor(a,T){this.key=a,this.valueKey=T,this.type=10,this.negated=null}static create(a,T){return new p(a,T)}cmp(a){return a.type!==this.type?this.type-a.type:o(this.key,this.valueKey,a.key,a.valueKey)}equals(a){return a.type===this.type?this.key===a.key&&this.valueKey===a.valueKey:!1}substituteConstants(){return this}evaluate(a){const T=a.getValue(this.valueKey),h=a.getValue(this.key);return Array.isArray(T)?T.indexOf(h)>=0:typeof h=="string"&&typeof T=="object"&&T!==null?X.call(T,h):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=u.create(this)),this.negated}}class u{constructor(a){this._actual=a,this.type=11}static create(a){return new u(a)}cmp(a){return a.type!==this.type?this.type-a.type:this._actual.cmp(a._actual)}equals(a){return a.type===this.type?this._actual.equals(a._actual):!1}substituteConstants(){return this}evaluate(a){return!this._actual.evaluate(a)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class m{constructor(a,T,h){this.key=a,this.value=T,this.negated=h,this.type=5}static create(a,T,h=null){if(typeof T=="boolean")return T?b.create(a,h):M.create(a,h);const n=le.get(a);if(typeof n=="boolean"){const N=n?"true":"false";return T===N?H.INSTANCE:D.INSTANCE}return new m(a,T,h)}cmp(a){return a.type!==this.type?this.type-a.type:o(this.key,this.value,a.key,a.value)}equals(a){return a.type===this.type?this.key===a.key&&this.value===a.value:!1}substituteConstants(){const a=le.get(this.key);if(typeof a=="boolean"){const T=a?"true":"false";return this.value===T?H.INSTANCE:D.INSTANCE}return this}evaluate(a){return a.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=g.create(this.key,this.value,this)),this.negated}}class b{constructor(a,T){this.key=a,this.negated=T,this.type=3}static create(a,T=null){const h=le.get(a);return typeof h=="boolean"?h?H.INSTANCE:D.INSTANCE:new b(a,T)}cmp(a){return a.type!==this.type?this.type-a.type:c(this.key,a.key)}equals(a){return a.type===this.type?this.key===a.key:!1}substituteConstants(){const a=le.get(this.key);return typeof a=="boolean"?a?H.INSTANCE:D.INSTANCE:this}evaluate(a){return!a.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=M.create(this.key,this)),this.negated}}function E(a,T){if(typeof a=="string"){const h=parseFloat(a);isNaN(h)||(a=h)}return typeof a=="string"||typeof a=="number"?T(a):H.INSTANCE}class _{constructor(a,T,h){this.key=a,this.value=T,this.negated=h,this.type=12}static create(a,T,h=null){return E(T,n=>new _(a,n,h))}cmp(a){return a.type!==this.type?this.type-a.type:o(this.key,this.value,a.key,a.value)}equals(a){return a.type===this.type?this.key===a.key&&this.value===a.value:!1}substituteConstants(){return this}evaluate(a){return typeof this.value=="string"?!1:parseFloat(a.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=w.create(this.key,this.value,this)),this.negated}}class f{constructor(a,T,h){this.key=a,this.value=T,this.negated=h,this.type=13}static create(a,T,h=null){return E(T,n=>new f(a,n,h))}cmp(a){return a.type!==this.type?this.type-a.type:o(this.key,this.value,a.key,a.value)}equals(a){return a.type===this.type?this.key===a.key&&this.value===a.value:!1}substituteConstants(){return this}evaluate(a){return typeof this.value=="string"?!1:parseFloat(a.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 O{constructor(a,T,h){this.key=a,this.value=T,this.negated=h,this.type=14}static create(a,T,h=null){return E(T,n=>new O(a,n,h))}cmp(a){return a.type!==this.type?this.type-a.type:o(this.key,this.value,a.key,a.value)}equals(a){return a.type===this.type?this.key===a.key&&this.value===a.value:!1}substituteConstants(){return this}evaluate(a){return typeof this.value=="string"?!1:parseFloat(a.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 w{constructor(a,T,h){this.key=a,this.value=T,this.negated=h,this.type=15}static create(a,T,h=null){return E(T,n=>new w(a,n,h))}cmp(a){return a.type!==this.type?this.type-a.type:o(this.key,this.value,a.key,a.value)}equals(a){return a.type===this.type?this.key===a.key&&this.value===a.value:!1}substituteConstants(){return this}evaluate(a){return typeof this.value=="string"?!1:parseFloat(a.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=_.create(this.key,this.value,this)),this.negated}}class R{constructor(a,T){this.key=a,this.regexp=T,this.type=7,this.negated=null}static create(a,T){return new R(a,T)}cmp(a){if(a.type!==this.type)return this.type-a.type;if(this.key<a.key)return-1;if(this.key>a.key)return 1;const T=this.regexp?this.regexp.source:"",h=a.regexp?a.regexp.source:"";return T<h?-1:T>h?1:0}equals(a){if(a.type===this.type){const T=this.regexp?this.regexp.source:"",h=a.regexp?a.regexp.source:"";return this.key===a.key&&T===h}return!1}substituteConstants(){return this}evaluate(a){let T=a.getValue(this.key);return this.regexp?this.regexp.test(T):!1}serialize(){const a=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${a}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=x.create(this)),this.negated}}class x{constructor(a){this._actual=a,this.type=8}static create(a){return new x(a)}cmp(a){return a.type!==this.type?this.type-a.type:this._actual.cmp(a._actual)}equals(a){return a.type===this.type?this._actual.equals(a._actual):!1}substituteConstants(){return this}evaluate(a){return!this._actual.evaluate(a)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function I(a){let T=null;for(let h=0,n=a.length;h<n;h++){const N=a[h].substituteConstants();if(a[h]!==N&&T===null){T=[];for(let U=0;U<h;U++)T[U]=a[U]}T!==null&&(T[h]=N)}return T===null?a:T}class k{constructor(a,T){this.expr=a,this.negated=T,this.type=6}static create(a,T){return k._normalizeArr(a,T)}cmp(a){if(a.type!==this.type)return this.type-a.type;if(this.expr.length<a.expr.length)return-1;if(this.expr.length>a.expr.length)return 1;for(let T=0,h=this.expr.length;T<h;T++){const n=r(this.expr[T],a.expr[T]);if(n!==0)return n}return 0}equals(a){if(a.type===this.type){if(this.expr.length!==a.expr.length)return!1;for(let T=0,h=this.expr.length;T<h;T++)if(!this.expr[T].equals(a.expr[T]))return!1;return!0}return!1}substituteConstants(){const a=I(this.expr);return a===this.expr?this:k.create(a,this.negated)}evaluate(a){for(let T=0,h=this.expr.length;T<h;T++)if(!this.expr[T].evaluate(a))return!1;return!0}static _normalizeArr(a,T){const h=[];let n=!1;for(const N of a){if(!N)continue;if(N.type===1){n=!0;continue}if(N.type===0)return H.INSTANCE;if(N.type===6){h.push(...N.expr);continue}h.push(N)}if(h.length===0&&n)return D.INSTANCE;if(h.length===0)return;if(h.length===1)return h[0];h.sort(r);for(let N=1;N<h.length;N++)h[N-1].equals(h[N])&&(h.splice(N,1),N--);if(h.length===1)return h[0];for(;h.length>1;){const N=h[h.length-1];if(N.type!==9)break;h.pop();const U=h.pop(),j=h.length===0,Y=A.create(N.expr.map(J=>k.create([J,U],null)),null,j);Y&&(h.push(Y),h.sort(r))}return h.length===1?h[0]:new k(h,T)}serialize(){return this.expr.map(a=>a.serialize()).join(" && ")}keys(){const a=[];for(let T of this.expr)a.push(...T.keys());return a}negate(){if(!this.negated){const a=[];for(let T of this.expr)a.push(T.negate());this.negated=A.create(a,this,!0)}return this.negated}}class A{constructor(a,T){this.expr=a,this.negated=T,this.type=9}static create(a,T,h){return A._normalizeArr(a,T,h)}cmp(a){if(a.type!==this.type)return this.type-a.type;if(this.expr.length<a.expr.length)return-1;if(this.expr.length>a.expr.length)return 1;for(let T=0,h=this.expr.length;T<h;T++){const n=r(this.expr[T],a.expr[T]);if(n!==0)return n}return 0}equals(a){if(a.type===this.type){if(this.expr.length!==a.expr.length)return!1;for(let T=0,h=this.expr.length;T<h;T++)if(!this.expr[T].equals(a.expr[T]))return!1;return!0}return!1}substituteConstants(){const a=I(this.expr);return a===this.expr?this:A.create(a,this.negated,!1)}evaluate(a){for(let T=0,h=this.expr.length;T<h;T++)if(this.expr[T].evaluate(a))return!0;return!1}static _normalizeArr(a,T,h){let n=[],N=!1;if(a){for(let U=0,j=a.length;U<j;U++){const Y=a[U];if(!Y)continue;if(Y.type===0){N=!0;continue}if(Y.type===1)return D.INSTANCE;if(Y.type===9){n=n.concat(Y.expr);continue}n.push(Y)}if(n.length===0&&N)return H.INSTANCE;n.sort(r)}if(n.length===0)return;if(n.length===1)return n[0];for(let U=1;U<n.length;U++)n[U-1].equals(n[U])&&(n.splice(U,1),U--);if(n.length===1)return n[0];if(h){for(let U=0;U<n.length;U++)for(let j=U+1;j<n.length;j++)v(n[U],n[j])&&(n.splice(j,1),j--);if(n.length===1)return n[0]}return new A(n,T)}serialize(){return this.expr.map(a=>a.serialize()).join(" || ")}keys(){const a=[];for(let T of this.expr)a.push(...T.keys());return a}negate(){if(!this.negated){let a=[];for(let T of this.expr)a.push(T.negate());for(;a.length>1;){const T=a.shift(),h=a.shift(),n=[];for(const U of l(T))for(const j of l(h))n.push(k.create([U,j],null));const N=a.length===0;a.unshift(A.create(n,null,N))}this.negated=a[0]}return this.negated}}class P extends M{constructor(a,T,h){super(a,null);this._defaultValue=T,typeof h=="object"?P._info.push(Object.assign(Object.assign({},h),{key:a})):h!==!0&&P._info.push({key:a,description:h,type:T!=null?typeof T:void 0})}static all(){return P._info.values()}bindTo(a){return a.createKey(this.key,this._defaultValue)}getValue(a){return a.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(a){return g.create(this.key,a)}}P._info=[];const S=Object(ce.c)("contextKeyService"),C="setContext";function c(a,T){return a<T?-1:a>T?1:0}function o(a,T,h,n){return a<h?-1:a>h?1:T<n?-1:T>n?1:0}function v(a,T){if(T.type===6&&a.type!==9&&a.type!==6){for(const N of T.expr)if(a.equals(N))return!0}const h=a.negate(),n=l(h).concat(l(T));n.sort(r);for(let N=0;N<n.length;N++){const U=n[N],j=U.negate();for(let Y=N+1;Y<n.length;Y++){const J=n[Y];if(j.equals(J))return!0}}return!1}function l(a){return a.type===9?a.expr:[a]}},TSYQ:function(at,ve,Z){var se,Se;/*!
|
|
Copyright (c) 2018 Jed Watson.
|
|
Licensed under the MIT License (MIT), see
|
|
http://jedwatson.github.io/classnames
|
|
*/(function(){"use strict";var ce={}.hasOwnProperty,ye="[native code]";function le(){for(var X=[],F=0;F<arguments.length;F++){var W=arguments[F];if(!W)continue;var r=typeof W;if(r==="string"||r==="number")X.push(W);else if(Array.isArray(W)){if(W.length){var H=le.apply(null,W);H&&X.push(H)}}else if(r==="object"){if(W.toString!==Object.prototype.toString&&!W.toString.toString().includes("[native code]")){X.push(W.toString());continue}for(var D in W)ce.call(W,D)&&W[D]&&X.push(D)}}return X.join(" ")}at.exports?(le.default=le,at.exports=le):!(se=[],Se=function(){return le}.apply(ve,se),Se!==void 0&&(at.exports=Se))})()},TXwP:function(at,ve,Z){var se,Se;(function(){var ce;(function(){"use strict";var le=[,,function(r){function H(g){this.__parent=g,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 g=new H(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},H.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},H.prototype.has_match=function(g){for(var p=this.__items.length-1;p>=0;p--)if(this.__items[p].match(g))return!0;return!1},H.prototype.set_indent=function(g,p){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=p||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 g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__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(g){this.__items.push(g);var p=g.lastIndexOf(`
|
|
`);p!==-1?this.__character_count=g.length-p:this.__character_count+=g.length},H.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},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 g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function D(g,p){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),p=p||"",g.indent_level>0&&(p=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=p,this.__base_string_length=p.length}D.prototype.get_indent_size=function(g,p){var u=this.__base_string_length;return p=p||0,g<0&&(u=0),u+=g*this.__indent_size,u+=p,u},D.prototype.get_indent_string=function(g,p){var u=this.__base_string;return p=p||0,g<0&&(g=0,u=""),p+=g*this.__indent_size,this.__ensure_cache(p),u+=this.__cache[p],u},D.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},D.prototype.__add_column=function(){var g=this.__cache.length,p=0,u="";this.__indent_size&&g>=this.__indent_size&&(p=Math.floor(g/this.__indent_size),g-=p*this.__indent_size,u=new Array(p+1).join(this.__indent_string)),g&&(u+=new Array(g+1).join(" ")),this.__cache.push(u)};function M(g,p){this.__indent_cache=new D(g,p),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.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()}M.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},M.prototype.get_line_number=function(){return this.__lines.length},M.prototype.get_indent_string=function(g,p){return this.__indent_cache.get_indent_string(g,p)},M.prototype.get_indent_size=function(g,p){return this.__indent_cache.get_indent_size(g,p)},M.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},M.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},M.prototype.get_code=function(g){this.trim(!0);var p=this.current_line.pop();p&&(p[p.length-1]===`
|
|
`&&(p=p.replace(/\n+$/g,"")),this.current_line.push(p)),this._end_with_newline&&this.__add_outputline();var u=this.__lines.join(`
|
|
`);return g!==`
|
|
`&&(u=u.replace(/[\n]/g,g)),u},M.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},M.prototype.set_indent=function(g,p){return g=g||0,p=p||0,this.next_line.set_indent(g,p),this.__lines.length>1?(this.current_line.set_indent(g,p),!0):(this.current_line.set_indent(),!1)},M.prototype.add_raw_token=function(g){for(var p=0;p<g.newlines;p++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},M.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},M.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(" "))},M.prototype.remove_indent=function(g){for(var p=this.__lines.length;g<p;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},M.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&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},M.prototype.just_added_newline=function(){return this.current_line.is_empty()},M.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},M.prototype.ensure_empty_line_above=function(g,p){for(var u=this.__lines.length-2;u>=0;){var m=this.__lines[u];if(m.is_empty())break;if(m.item(0).indexOf(g)!==0&&m.item(-1)!==p){this.__lines.splice(u+1,0,new H(this)),this.previous_line=this.__lines[this.__lines.length-2];break}u--}},r.exports.Output=M},,,,function(r){function H(g,p){this.raw_options=D(g,p),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(g,p){var u=this.raw_options[g],m=p||[];return typeof u=="object"?u!==null&&typeof u.concat=="function"&&(m=u.concat()):typeof u=="string"&&(m=u.split(/[^a-zA-Z0-9_\/\-]+/)),m},H.prototype._get_boolean=function(g,p){var u=this.raw_options[g],m=u===void 0?!!p:!!u;return m},H.prototype._get_characters=function(g,p){var u=this.raw_options[g],m=p||"";return typeof u=="string"&&(m=u.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),m},H.prototype._get_number=function(g,p){var u=this.raw_options[g];p=parseInt(p,10),isNaN(p)&&(p=0);var m=parseInt(u,10);return isNaN(m)&&(m=p),m},H.prototype._get_selection=function(g,p,u){var m=this._get_selection_list(g,p,u);if(m.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
|
|
`+p+`
|
|
You passed in: '`+this.raw_options[g]+"'");return m[0]},H.prototype._get_selection_list=function(g,p,u){if(!p||p.length===0)throw new Error("Selection list cannot be empty.");if(u=u||[p[0]],!this._is_valid_selection(u,p))throw new Error("Invalid Default Value!");var m=this._get_array(g,u);if(!this._is_valid_selection(m,p))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
|
|
`+p+`
|
|
You passed in: '`+this.raw_options[g]+"'");return m},H.prototype._is_valid_selection=function(g,p){return g.length&&p.length&&!g.some(function(u){return p.indexOf(u)===-1})};function D(g,p){var u={};g=M(g);var m;for(m in g)m!==p&&(u[m]=g[m]);if(p&&g[p])for(m in g[p])u[m]=g[p][m];return u}function M(g){var p={},u;for(u in g){var m=u.replace(/-/g,"_");p[m]=g[u]}return p}r.exports.Options=H,r.exports.normalizeOpts=M,r.exports.mergeOpts=D},,function(r){var H=RegExp.prototype.hasOwnProperty("sticky");function D(M){this.__input=M||"",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 M=null;return this.hasNext()&&(M=this.__input.charAt(this.__position),this.__position+=1),M},D.prototype.peek=function(M){var g=null;return M=M||0,M+=this.__position,M>=0&&M<this.__input_length&&(g=this.__input.charAt(M)),g},D.prototype.__match=function(M,g){M.lastIndex=g;var p=M.exec(this.__input);return p&&!(H&&M.sticky)&&(p.index!==g&&(p=null)),p},D.prototype.test=function(M,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(M,g):!1},D.prototype.testChar=function(M,g){var p=this.peek(g);return M.lastIndex=0,p!==null&&M.test(p)},D.prototype.match=function(M){var g=this.__match(M,this.__position);return g?this.__position+=g[0].length:g=null,g},D.prototype.read=function(M,g,p){var u="",m;return M&&(m=this.match(M),m&&(u+=m[0])),g&&(m||!M)&&(u+=this.readUntil(g,p)),u},D.prototype.readUntil=function(M,g){var p="",u=this.__position;M.lastIndex=this.__position;var m=M.exec(this.__input);return m?(u=m.index,g&&(u+=m[0].length)):u=this.__input_length,p=this.__input.substring(this.__position,u),this.__position=u,p},D.prototype.readUntilAfter=function(M){return this.readUntil(M,!0)},D.prototype.get_regexp=function(M,g){var p=null,u="g";return g&&H&&(u="y"),typeof M=="string"&&M!==""?p=new RegExp(M,u):M&&(p=new RegExp(M.source,u)),p},D.prototype.get_literal_regexp=function(M){return RegExp(M.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},D.prototype.peekUntilAfter=function(M){var g=this.__position,p=this.readUntilAfter(M);return this.__position=g,p},D.prototype.lookBack=function(M){var g=this.__position-1;return g>=M.length&&this.__input.substring(g-M.length,g).toLowerCase()===M},r.exports.InputScanner=D},,,,,function(r){function H(D,M){D=typeof D=="string"?D:D.source,M=typeof M=="string"?M:M.source,this.__directives_block_pattern=new RegExp(D+/ beautify( \w+[:]\w+)+ /.source+M,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(D+/\sbeautify\signore:end\s/.source+M,"g")}H.prototype.get_directives=function(D){if(!D.match(this.__directives_block_pattern))return null;var M={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(D);g;)M[g[1]]=g[2],g=this.__directive_pattern.exec(D);return M},H.prototype.readIgnored=function(D){return D.readUntilAfter(this.__directives_end_ignore_pattern)},r.exports.Directives=H},,function(r,H,D){var M=D(16).Beautifier,g=D(17).Options;function p(u,m){var b=new M(u,m);return b.beautify()}r.exports=p,r.exports.defaultOptions=function(){return new g}},function(r,H,D){var M=D(17).Options,g=D(2).Output,p=D(8).InputScanner,u=D(13).Directives,m=new u(/\/\*/,/\*\//),b=/\r\n|[\r\n]/,E=/\r\n|[\r\n]/g,_=/\s/,f=/(?:\s|\n)+/g,O=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function R(x,I){this._source_text=x||"",this._options=new M(I),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"]}R.prototype.eatString=function(x){var I="";for(this._ch=this._input.next();this._ch;){if(I+=this._ch,this._ch==="\\")I+=this._input.next();else if(x.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return I},R.prototype.eatWhitespace=function(x){for(var I=_.test(this._input.peek()),k=0;_.test(this._input.peek());)this._ch=this._input.next(),x&&this._ch===`
|
|
`&&((k===0||k<this._options.max_preserve_newlines)&&(k++,this._output.add_new_line(!0)));return I},R.prototype.foundNestedPseudoClass=function(){for(var x=0,I=1,k=this._input.peek(I);k;){if(k==="{")return!0;if(k==="(")x+=1;else if(k===")"){if(x===0)return!1;x-=1}else if(k===";"||k==="}")return!1;I++,k=this._input.peek(I)}return!1},R.prototype.print_string=function(x){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(x)},R.prototype.preserveSingleSpace=function(x){x&&(this._output.space_before_token=!0)},R.prototype.indent=function(){this._indentLevel++},R.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},R.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var x=this._source_text,I=this._options.eol;I==="auto"&&(I=`
|
|
`,x&&b.test(x||"")&&(I=x.match(b)[0])),x=x.replace(E,`
|
|
`);var k=x.match(/^[\t ]*/)[0];this._output=new g(this._options,k),this._input=new p(x),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var A=0,P=!1,S=!1,C=!1,c=!1,o=!1,v=!1,l=this._ch,a=!1,T,h,n;T=this._input.read(f),h=T!=="",n=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 N=this._input.read(O),U=m.get_directives(N);U&&U.ignore==="start"&&(N+=m.readIgnored(this._input)),this.print_string(N),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(w)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(h),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var j=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);j.match(/[ :]$/)&&(j=this.eatString(": ").replace(/\s$/,""),this.print_string(j),this._output.space_before_token=!0),j=j.replace(/\s$/,""),j==="extend"?c=!0:j==="import"&&(o=!0),j in this.NESTED_AT_RULE?(this._nestedLevel+=1,j in this.CONDITIONAL_GROUP_RULE&&(C=!0)):!P&&A===0&&j.indexOf(":")!==-1&&(S=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(h),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")S&&(S=!1,this.outdent()),C?(C=!1,P=this._indentLevel>=this._nestedLevel):P=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&P&&(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)):(n==="("?this._output.space_before_token=!1:n!==","&&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(),n==="{"&&this._output.trim(!0),o=!1,c=!1,S&&(this.outdent(),S=!1),this.print_string(this._ch),P=!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 Y=0;Y<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Y++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Y])){a=!0;break}(P||C)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!c&&A===0?(this.print_string(":"),S||(S=!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 J=n==='"'||n==="'";this.preserveSingleSpace(J||h),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")a=!1,A===0?(S&&(this.outdent(),S=!1),c=!1,o=!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(),A++,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(")")),A&&(A--,this.outdent()));else{var ee=!1;this._input.lookBack("with")&&(ee=!0),this.preserveSingleSpace(h||ee),this.print_string(this._ch),S&&n==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),v=!0):(this.eatWhitespace(),A++,this.indent())}else if(this._ch===")")A&&(A--,this.outdent()),v&&this._input.peek()===";"&&this._options.selector_separator_newline&&(v=!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&&(!S||v)&&A===0&&!o&&!c?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!S&&A===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&&_.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(h),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),_.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=n==='"'||n==="'";this.preserveSingleSpace(ie||h),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&a&&this._output.add_new_line()}var re=this._output.get_code(I);return re},r.exports.Beautifier=R},function(r,H,D){var M=D(6).Options;function g(p){M.call(this,p,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var u=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||u;var m=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var b=0;b<m.length;b++)m[b]!=="expand"?this.brace_style="collapse":this.brace_style=m[b]}g.prototype=new M,r.exports.Options=g}],X={};function F(r){var H=X[r];if(H!==void 0)return H.exports;var D=X[r]={exports:{}};return le[r](D,D.exports,F),D.exports}var W=F(15);ce=W})();var ye=ce;!(se=[],Se=function(){return{css_beautify:ye}}.apply(ve,se),Se!==void 0&&(at.exports=Se))})()},U8pU:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return se});function se(Se){return se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ce){return typeof ce}:function(ce){return ce&&typeof Symbol=="function"&&ce.constructor===Symbol&&ce!==Symbol.prototype?"symbol":typeof ce},se(Se)}},VTBJ:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return ce});var se=Z("rePB");function Se(ye,le){var X=Object.keys(ye);if(Object.getOwnPropertySymbols){var F=Object.getOwnPropertySymbols(ye);le&&(F=F.filter(function(W){return Object.getOwnPropertyDescriptor(ye,W).enumerable})),X.push.apply(X,F)}return X}function ce(ye){for(var le=1;le<arguments.length;le++){var X=arguments[le]!=null?arguments[le]:{};le%2?Se(Object(X),!0).forEach(function(F){Object(se.a)(ye,F,X[F])}):Object.getOwnPropertyDescriptors?Object.defineProperties(ye,Object.getOwnPropertyDescriptors(X)):Se(Object(X)).forEach(function(F){Object.defineProperty(ye,F,Object.getOwnPropertyDescriptor(X,F))})}return ye}},Vhoy:function(at,ve,Z){"use strict";Z.d(ve,"d",function(){return ye}),Z.d(ve,"e",function(){return le}),Z.d(ve,"c",function(){return X}),Z.d(ve,"b",function(){return F}),Z.d(ve,"a",function(){return W});var se=Z("MI8n");class Se{constructor(){this._icons=new Map,this._onDidRegister=new se.b}add(r){const H=this._icons.get(r.id);H?r.description?H.description=r.description:console.error(`Duplicate registration of codicon ${r.id}`):(this._icons.set(r.id,r),this._onDidRegister.fire(r))}get(r){return this._icons.get(r)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const ce=new Se,ye=ce;function le(r,H){return new F(r,H)}function X(r){return r?r.replace(/\$\((.*?)\)/g,(H,D)=>` ${D} `).trim():""}class F{constructor(r,H,D){this.id=r,this.definition=H,this.description=D,ce.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var W;(function(r){r.iconNameSegment="[A-Za-z0-9]+",r.iconNameExpression="[A-Za-z0-9\\-]+",r.iconModifierExpression="~[A-Za-z]+";const H=new RegExp(`^(${r.iconNameExpression})(${r.iconModifierExpression})?$`);function D(p){if(p instanceof F)return["codicon","codicon-"+p.id];const u=H.exec(p.id);if(!u)return D(F.error);let[,m,b]=u;const E=["codicon","codicon-"+m];return b&&E.push("codicon-modifier-"+b.substr(1)),E}r.asClassNameArray=D;function M(p){return D(p).join(" ")}r.asClassName=M;function g(p){return"."+D(p).join(".")}r.asCSSSelector=g})(W||(W={})),function(r){r.add=new r("add",{fontCharacter:"\\ea60"}),r.plus=new r("plus",r.add.definition),r.gistNew=new r("gist-new",r.add.definition),r.repoCreate=new r("repo-create",r.add.definition),r.lightbulb=new r("lightbulb",{fontCharacter:"\\ea61"}),r.lightBulb=new r("light-bulb",{fontCharacter:"\\ea61"}),r.repo=new r("repo",{fontCharacter:"\\ea62"}),r.repoDelete=new r("repo-delete",{fontCharacter:"\\ea62"}),r.gistFork=new r("gist-fork",{fontCharacter:"\\ea63"}),r.repoForked=new r("repo-forked",{fontCharacter:"\\ea63"}),r.gitPullRequest=new r("git-pull-request",{fontCharacter:"\\ea64"}),r.gitPullRequestAbandoned=new r("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),r.recordKeys=new r("record-keys",{fontCharacter:"\\ea65"}),r.keyboard=new r("keyboard",{fontCharacter:"\\ea65"}),r.tag=new r("tag",{fontCharacter:"\\ea66"}),r.tagAdd=new r("tag-add",{fontCharacter:"\\ea66"}),r.tagRemove=new r("tag-remove",{fontCharacter:"\\ea66"}),r.person=new r("person",{fontCharacter:"\\ea67"}),r.personFollow=new r("person-follow",{fontCharacter:"\\ea67"}),r.personOutline=new r("person-outline",{fontCharacter:"\\ea67"}),r.personFilled=new r("person-filled",{fontCharacter:"\\ea67"}),r.gitBranch=new r("git-branch",{fontCharacter:"\\ea68"}),r.gitBranchCreate=new r("git-branch-create",{fontCharacter:"\\ea68"}),r.gitBranchDelete=new r("git-branch-delete",{fontCharacter:"\\ea68"}),r.sourceControl=new r("source-control",{fontCharacter:"\\ea68"}),r.mirror=new r("mirror",{fontCharacter:"\\ea69"}),r.mirrorPublic=new r("mirror-public",{fontCharacter:"\\ea69"}),r.star=new r("star",{fontCharacter:"\\ea6a"}),r.starAdd=new r("star-add",{fontCharacter:"\\ea6a"}),r.starDelete=new r("star-delete",{fontCharacter:"\\ea6a"}),r.starEmpty=new r("star-empty",{fontCharacter:"\\ea6a"}),r.comment=new r("comment",{fontCharacter:"\\ea6b"}),r.commentAdd=new r("comment-add",{fontCharacter:"\\ea6b"}),r.alert=new r("alert",{fontCharacter:"\\ea6c"}),r.warning=new r("warning",{fontCharacter:"\\ea6c"}),r.search=new r("search",{fontCharacter:"\\ea6d"}),r.searchSave=new r("search-save",{fontCharacter:"\\ea6d"}),r.logOut=new r("log-out",{fontCharacter:"\\ea6e"}),r.signOut=new r("sign-out",{fontCharacter:"\\ea6e"}),r.logIn=new r("log-in",{fontCharacter:"\\ea6f"}),r.signIn=new r("sign-in",{fontCharacter:"\\ea6f"}),r.eye=new r("eye",{fontCharacter:"\\ea70"}),r.eyeUnwatch=new r("eye-unwatch",{fontCharacter:"\\ea70"}),r.eyeWatch=new r("eye-watch",{fontCharacter:"\\ea70"}),r.circleFilled=new r("circle-filled",{fontCharacter:"\\ea71"}),r.primitiveDot=new r("primitive-dot",{fontCharacter:"\\ea71"}),r.closeDirty=new r("close-dirty",{fontCharacter:"\\ea71"}),r.debugBreakpoint=new r("debug-breakpoint",{fontCharacter:"\\ea71"}),r.debugBreakpointDisabled=new r("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),r.debugHint=new r("debug-hint",{fontCharacter:"\\ea71"}),r.primitiveSquare=new r("primitive-square",{fontCharacter:"\\ea72"}),r.edit=new r("edit",{fontCharacter:"\\ea73"}),r.pencil=new r("pencil",{fontCharacter:"\\ea73"}),r.info=new r("info",{fontCharacter:"\\ea74"}),r.issueOpened=new r("issue-opened",{fontCharacter:"\\ea74"}),r.gistPrivate=new r("gist-private",{fontCharacter:"\\ea75"}),r.gitForkPrivate=new r("git-fork-private",{fontCharacter:"\\ea75"}),r.lock=new r("lock",{fontCharacter:"\\ea75"}),r.mirrorPrivate=new r("mirror-private",{fontCharacter:"\\ea75"}),r.close=new r("close",{fontCharacter:"\\ea76"}),r.removeClose=new r("remove-close",{fontCharacter:"\\ea76"}),r.x=new r("x",{fontCharacter:"\\ea76"}),r.repoSync=new r("repo-sync",{fontCharacter:"\\ea77"}),r.sync=new r("sync",{fontCharacter:"\\ea77"}),r.clone=new r("clone",{fontCharacter:"\\ea78"}),r.desktopDownload=new r("desktop-download",{fontCharacter:"\\ea78"}),r.beaker=new r("beaker",{fontCharacter:"\\ea79"}),r.microscope=new r("microscope",{fontCharacter:"\\ea79"}),r.vm=new r("vm",{fontCharacter:"\\ea7a"}),r.deviceDesktop=new r("device-desktop",{fontCharacter:"\\ea7a"}),r.file=new r("file",{fontCharacter:"\\ea7b"}),r.fileText=new r("file-text",{fontCharacter:"\\ea7b"}),r.more=new r("more",{fontCharacter:"\\ea7c"}),r.ellipsis=new r("ellipsis",{fontCharacter:"\\ea7c"}),r.kebabHorizontal=new r("kebab-horizontal",{fontCharacter:"\\ea7c"}),r.mailReply=new r("mail-reply",{fontCharacter:"\\ea7d"}),r.reply=new r("reply",{fontCharacter:"\\ea7d"}),r.organization=new r("organization",{fontCharacter:"\\ea7e"}),r.organizationFilled=new r("organization-filled",{fontCharacter:"\\ea7e"}),r.organizationOutline=new r("organization-outline",{fontCharacter:"\\ea7e"}),r.newFile=new r("new-file",{fontCharacter:"\\ea7f"}),r.fileAdd=new r("file-add",{fontCharacter:"\\ea7f"}),r.newFolder=new r("new-folder",{fontCharacter:"\\ea80"}),r.fileDirectoryCreate=new r("file-directory-create",{fontCharacter:"\\ea80"}),r.trash=new r("trash",{fontCharacter:"\\ea81"}),r.trashcan=new r("trashcan",{fontCharacter:"\\ea81"}),r.history=new r("history",{fontCharacter:"\\ea82"}),r.clock=new r("clock",{fontCharacter:"\\ea82"}),r.folder=new r("folder",{fontCharacter:"\\ea83"}),r.fileDirectory=new r("file-directory",{fontCharacter:"\\ea83"}),r.symbolFolder=new r("symbol-folder",{fontCharacter:"\\ea83"}),r.logoGithub=new r("logo-github",{fontCharacter:"\\ea84"}),r.markGithub=new r("mark-github",{fontCharacter:"\\ea84"}),r.github=new r("github",{fontCharacter:"\\ea84"}),r.terminal=new r("terminal",{fontCharacter:"\\ea85"}),r.console=new r("console",{fontCharacter:"\\ea85"}),r.repl=new r("repl",{fontCharacter:"\\ea85"}),r.zap=new r("zap",{fontCharacter:"\\ea86"}),r.symbolEvent=new r("symbol-event",{fontCharacter:"\\ea86"}),r.error=new r("error",{fontCharacter:"\\ea87"}),r.stop=new r("stop",{fontCharacter:"\\ea87"}),r.variable=new r("variable",{fontCharacter:"\\ea88"}),r.symbolVariable=new r("symbol-variable",{fontCharacter:"\\ea88"}),r.array=new r("array",{fontCharacter:"\\ea8a"}),r.symbolArray=new r("symbol-array",{fontCharacter:"\\ea8a"}),r.symbolModule=new r("symbol-module",{fontCharacter:"\\ea8b"}),r.symbolPackage=new r("symbol-package",{fontCharacter:"\\ea8b"}),r.symbolNamespace=new r("symbol-namespace",{fontCharacter:"\\ea8b"}),r.symbolObject=new r("symbol-object",{fontCharacter:"\\ea8b"}),r.symbolMethod=new r("symbol-method",{fontCharacter:"\\ea8c"}),r.symbolFunction=new r("symbol-function",{fontCharacter:"\\ea8c"}),r.symbolConstructor=new r("symbol-constructor",{fontCharacter:"\\ea8c"}),r.symbolBoolean=new r("symbol-boolean",{fontCharacter:"\\ea8f"}),r.symbolNull=new r("symbol-null",{fontCharacter:"\\ea8f"}),r.symbolNumeric=new r("symbol-numeric",{fontCharacter:"\\ea90"}),r.symbolNumber=new r("symbol-number",{fontCharacter:"\\ea90"}),r.symbolStructure=new r("symbol-structure",{fontCharacter:"\\ea91"}),r.symbolStruct=new r("symbol-struct",{fontCharacter:"\\ea91"}),r.symbolParameter=new r("symbol-parameter",{fontCharacter:"\\ea92"}),r.symbolTypeParameter=new r("symbol-type-parameter",{fontCharacter:"\\ea92"}),r.symbolKey=new r("symbol-key",{fontCharacter:"\\ea93"}),r.symbolText=new r("symbol-text",{fontCharacter:"\\ea93"}),r.symbolReference=new r("symbol-reference",{fontCharacter:"\\ea94"}),r.goToFile=new r("go-to-file",{fontCharacter:"\\ea94"}),r.symbolEnum=new r("symbol-enum",{fontCharacter:"\\ea95"}),r.symbolValue=new r("symbol-value",{fontCharacter:"\\ea95"}),r.symbolRuler=new r("symbol-ruler",{fontCharacter:"\\ea96"}),r.symbolUnit=new r("symbol-unit",{fontCharacter:"\\ea96"}),r.activateBreakpoints=new r("activate-breakpoints",{fontCharacter:"\\ea97"}),r.archive=new r("archive",{fontCharacter:"\\ea98"}),r.arrowBoth=new r("arrow-both",{fontCharacter:"\\ea99"}),r.arrowDown=new r("arrow-down",{fontCharacter:"\\ea9a"}),r.arrowLeft=new r("arrow-left",{fontCharacter:"\\ea9b"}),r.arrowRight=new r("arrow-right",{fontCharacter:"\\ea9c"}),r.arrowSmallDown=new r("arrow-small-down",{fontCharacter:"\\ea9d"}),r.arrowSmallLeft=new r("arrow-small-left",{fontCharacter:"\\ea9e"}),r.arrowSmallRight=new r("arrow-small-right",{fontCharacter:"\\ea9f"}),r.arrowSmallUp=new r("arrow-small-up",{fontCharacter:"\\eaa0"}),r.arrowUp=new r("arrow-up",{fontCharacter:"\\eaa1"}),r.bell=new r("bell",{fontCharacter:"\\eaa2"}),r.bold=new r("bold",{fontCharacter:"\\eaa3"}),r.book=new r("book",{fontCharacter:"\\eaa4"}),r.bookmark=new r("bookmark",{fontCharacter:"\\eaa5"}),r.debugBreakpointConditionalUnverified=new r("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),r.debugBreakpointConditional=new r("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),r.debugBreakpointConditionalDisabled=new r("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),r.debugBreakpointDataUnverified=new r("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),r.debugBreakpointData=new r("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),r.debugBreakpointDataDisabled=new r("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),r.debugBreakpointLogUnverified=new r("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),r.debugBreakpointLog=new r("debug-breakpoint-log",{fontCharacter:"\\eaab"}),r.debugBreakpointLogDisabled=new r("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),r.briefcase=new r("briefcase",{fontCharacter:"\\eaac"}),r.broadcast=new r("broadcast",{fontCharacter:"\\eaad"}),r.browser=new r("browser",{fontCharacter:"\\eaae"}),r.bug=new r("bug",{fontCharacter:"\\eaaf"}),r.calendar=new r("calendar",{fontCharacter:"\\eab0"}),r.caseSensitive=new r("case-sensitive",{fontCharacter:"\\eab1"}),r.check=new r("check",{fontCharacter:"\\eab2"}),r.checklist=new r("checklist",{fontCharacter:"\\eab3"}),r.chevronDown=new r("chevron-down",{fontCharacter:"\\eab4"}),r.dropDownButton=new r("drop-down-button",r.chevronDown.definition),r.chevronLeft=new r("chevron-left",{fontCharacter:"\\eab5"}),r.chevronRight=new r("chevron-right",{fontCharacter:"\\eab6"}),r.chevronUp=new r("chevron-up",{fontCharacter:"\\eab7"}),r.chromeClose=new r("chrome-close",{fontCharacter:"\\eab8"}),r.chromeMaximize=new r("chrome-maximize",{fontCharacter:"\\eab9"}),r.chromeMinimize=new r("chrome-minimize",{fontCharacter:"\\eaba"}),r.chromeRestore=new r("chrome-restore",{fontCharacter:"\\eabb"}),r.circleOutline=new r("circle-outline",{fontCharacter:"\\eabc"}),r.debugBreakpointUnverified=new r("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),r.circleSlash=new r("circle-slash",{fontCharacter:"\\eabd"}),r.circuitBoard=new r("circuit-board",{fontCharacter:"\\eabe"}),r.clearAll=new r("clear-all",{fontCharacter:"\\eabf"}),r.clippy=new r("clippy",{fontCharacter:"\\eac0"}),r.closeAll=new r("close-all",{fontCharacter:"\\eac1"}),r.cloudDownload=new r("cloud-download",{fontCharacter:"\\eac2"}),r.cloudUpload=new r("cloud-upload",{fontCharacter:"\\eac3"}),r.code=new r("code",{fontCharacter:"\\eac4"}),r.collapseAll=new r("collapse-all",{fontCharacter:"\\eac5"}),r.colorMode=new r("color-mode",{fontCharacter:"\\eac6"}),r.commentDiscussion=new r("comment-discussion",{fontCharacter:"\\eac7"}),r.compareChanges=new r("compare-changes",{fontCharacter:"\\eafd"}),r.creditCard=new r("credit-card",{fontCharacter:"\\eac9"}),r.dash=new r("dash",{fontCharacter:"\\eacc"}),r.dashboard=new r("dashboard",{fontCharacter:"\\eacd"}),r.database=new r("database",{fontCharacter:"\\eace"}),r.debugContinue=new r("debug-continue",{fontCharacter:"\\eacf"}),r.debugDisconnect=new r("debug-disconnect",{fontCharacter:"\\ead0"}),r.debugPause=new r("debug-pause",{fontCharacter:"\\ead1"}),r.debugRestart=new r("debug-restart",{fontCharacter:"\\ead2"}),r.debugStart=new r("debug-start",{fontCharacter:"\\ead3"}),r.debugStepInto=new r("debug-step-into",{fontCharacter:"\\ead4"}),r.debugStepOut=new r("debug-step-out",{fontCharacter:"\\ead5"}),r.debugStepOver=new r("debug-step-over",{fontCharacter:"\\ead6"}),r.debugStop=new r("debug-stop",{fontCharacter:"\\ead7"}),r.debug=new r("debug",{fontCharacter:"\\ead8"}),r.deviceCameraVideo=new r("device-camera-video",{fontCharacter:"\\ead9"}),r.deviceCamera=new r("device-camera",{fontCharacter:"\\eada"}),r.deviceMobile=new r("device-mobile",{fontCharacter:"\\eadb"}),r.diffAdded=new r("diff-added",{fontCharacter:"\\eadc"}),r.diffIgnored=new r("diff-ignored",{fontCharacter:"\\eadd"}),r.diffModified=new r("diff-modified",{fontCharacter:"\\eade"}),r.diffRemoved=new r("diff-removed",{fontCharacter:"\\eadf"}),r.diffRenamed=new r("diff-renamed",{fontCharacter:"\\eae0"}),r.diff=new r("diff",{fontCharacter:"\\eae1"}),r.discard=new r("discard",{fontCharacter:"\\eae2"}),r.editorLayout=new r("editor-layout",{fontCharacter:"\\eae3"}),r.emptyWindow=new r("empty-window",{fontCharacter:"\\eae4"}),r.exclude=new r("exclude",{fontCharacter:"\\eae5"}),r.extensions=new r("extensions",{fontCharacter:"\\eae6"}),r.eyeClosed=new r("eye-closed",{fontCharacter:"\\eae7"}),r.fileBinary=new r("file-binary",{fontCharacter:"\\eae8"}),r.fileCode=new r("file-code",{fontCharacter:"\\eae9"}),r.fileMedia=new r("file-media",{fontCharacter:"\\eaea"}),r.filePdf=new r("file-pdf",{fontCharacter:"\\eaeb"}),r.fileSubmodule=new r("file-submodule",{fontCharacter:"\\eaec"}),r.fileSymlinkDirectory=new r("file-symlink-directory",{fontCharacter:"\\eaed"}),r.fileSymlinkFile=new r("file-symlink-file",{fontCharacter:"\\eaee"}),r.fileZip=new r("file-zip",{fontCharacter:"\\eaef"}),r.files=new r("files",{fontCharacter:"\\eaf0"}),r.filter=new r("filter",{fontCharacter:"\\eaf1"}),r.flame=new r("flame",{fontCharacter:"\\eaf2"}),r.foldDown=new r("fold-down",{fontCharacter:"\\eaf3"}),r.foldUp=new r("fold-up",{fontCharacter:"\\eaf4"}),r.fold=new r("fold",{fontCharacter:"\\eaf5"}),r.folderActive=new r("folder-active",{fontCharacter:"\\eaf6"}),r.folderOpened=new r("folder-opened",{fontCharacter:"\\eaf7"}),r.gear=new r("gear",{fontCharacter:"\\eaf8"}),r.gift=new r("gift",{fontCharacter:"\\eaf9"}),r.gistSecret=new r("gist-secret",{fontCharacter:"\\eafa"}),r.gist=new r("gist",{fontCharacter:"\\eafb"}),r.gitCommit=new r("git-commit",{fontCharacter:"\\eafc"}),r.gitCompare=new r("git-compare",{fontCharacter:"\\eafd"}),r.gitMerge=new r("git-merge",{fontCharacter:"\\eafe"}),r.githubAction=new r("github-action",{fontCharacter:"\\eaff"}),r.githubAlt=new r("github-alt",{fontCharacter:"\\eb00"}),r.globe=new r("globe",{fontCharacter:"\\eb01"}),r.grabber=new r("grabber",{fontCharacter:"\\eb02"}),r.graph=new r("graph",{fontCharacter:"\\eb03"}),r.gripper=new r("gripper",{fontCharacter:"\\eb04"}),r.heart=new r("heart",{fontCharacter:"\\eb05"}),r.home=new r("home",{fontCharacter:"\\eb06"}),r.horizontalRule=new r("horizontal-rule",{fontCharacter:"\\eb07"}),r.hubot=new r("hubot",{fontCharacter:"\\eb08"}),r.inbox=new r("inbox",{fontCharacter:"\\eb09"}),r.issueClosed=new r("issue-closed",{fontCharacter:"\\eba4"}),r.issueReopened=new r("issue-reopened",{fontCharacter:"\\eb0b"}),r.issues=new r("issues",{fontCharacter:"\\eb0c"}),r.italic=new r("italic",{fontCharacter:"\\eb0d"}),r.jersey=new r("jersey",{fontCharacter:"\\eb0e"}),r.json=new r("json",{fontCharacter:"\\eb0f"}),r.kebabVertical=new r("kebab-vertical",{fontCharacter:"\\eb10"}),r.key=new r("key",{fontCharacter:"\\eb11"}),r.law=new r("law",{fontCharacter:"\\eb12"}),r.lightbulbAutofix=new r("lightbulb-autofix",{fontCharacter:"\\eb13"}),r.linkExternal=new r("link-external",{fontCharacter:"\\eb14"}),r.link=new r("link",{fontCharacter:"\\eb15"}),r.listOrdered=new r("list-ordered",{fontCharacter:"\\eb16"}),r.listUnordered=new r("list-unordered",{fontCharacter:"\\eb17"}),r.liveShare=new r("live-share",{fontCharacter:"\\eb18"}),r.loading=new r("loading",{fontCharacter:"\\eb19"}),r.location=new r("location",{fontCharacter:"\\eb1a"}),r.mailRead=new r("mail-read",{fontCharacter:"\\eb1b"}),r.mail=new r("mail",{fontCharacter:"\\eb1c"}),r.markdown=new r("markdown",{fontCharacter:"\\eb1d"}),r.megaphone=new r("megaphone",{fontCharacter:"\\eb1e"}),r.mention=new r("mention",{fontCharacter:"\\eb1f"}),r.milestone=new r("milestone",{fontCharacter:"\\eb20"}),r.mortarBoard=new r("mortar-board",{fontCharacter:"\\eb21"}),r.move=new r("move",{fontCharacter:"\\eb22"}),r.multipleWindows=new r("multiple-windows",{fontCharacter:"\\eb23"}),r.mute=new r("mute",{fontCharacter:"\\eb24"}),r.noNewline=new r("no-newline",{fontCharacter:"\\eb25"}),r.note=new r("note",{fontCharacter:"\\eb26"}),r.octoface=new r("octoface",{fontCharacter:"\\eb27"}),r.openPreview=new r("open-preview",{fontCharacter:"\\eb28"}),r.package_=new r("package",{fontCharacter:"\\eb29"}),r.paintcan=new r("paintcan",{fontCharacter:"\\eb2a"}),r.pin=new r("pin",{fontCharacter:"\\eb2b"}),r.play=new r("play",{fontCharacter:"\\eb2c"}),r.run=new r("run",{fontCharacter:"\\eb2c"}),r.plug=new r("plug",{fontCharacter:"\\eb2d"}),r.preserveCase=new r("preserve-case",{fontCharacter:"\\eb2e"}),r.preview=new r("preview",{fontCharacter:"\\eb2f"}),r.project=new r("project",{fontCharacter:"\\eb30"}),r.pulse=new r("pulse",{fontCharacter:"\\eb31"}),r.question=new r("question",{fontCharacter:"\\eb32"}),r.quote=new r("quote",{fontCharacter:"\\eb33"}),r.radioTower=new r("radio-tower",{fontCharacter:"\\eb34"}),r.reactions=new r("reactions",{fontCharacter:"\\eb35"}),r.references=new r("references",{fontCharacter:"\\eb36"}),r.refresh=new r("refresh",{fontCharacter:"\\eb37"}),r.regex=new r("regex",{fontCharacter:"\\eb38"}),r.remoteExplorer=new r("remote-explorer",{fontCharacter:"\\eb39"}),r.remote=new r("remote",{fontCharacter:"\\eb3a"}),r.remove=new r("remove",{fontCharacter:"\\eb3b"}),r.replaceAll=new r("replace-all",{fontCharacter:"\\eb3c"}),r.replace=new r("replace",{fontCharacter:"\\eb3d"}),r.repoClone=new r("repo-clone",{fontCharacter:"\\eb3e"}),r.repoForcePush=new r("repo-force-push",{fontCharacter:"\\eb3f"}),r.repoPull=new r("repo-pull",{fontCharacter:"\\eb40"}),r.repoPush=new r("repo-push",{fontCharacter:"\\eb41"}),r.report=new r("report",{fontCharacter:"\\eb42"}),r.requestChanges=new r("request-changes",{fontCharacter:"\\eb43"}),r.rocket=new r("rocket",{fontCharacter:"\\eb44"}),r.rootFolderOpened=new r("root-folder-opened",{fontCharacter:"\\eb45"}),r.rootFolder=new r("root-folder",{fontCharacter:"\\eb46"}),r.rss=new r("rss",{fontCharacter:"\\eb47"}),r.ruby=new r("ruby",{fontCharacter:"\\eb48"}),r.saveAll=new r("save-all",{fontCharacter:"\\eb49"}),r.saveAs=new r("save-as",{fontCharacter:"\\eb4a"}),r.save=new r("save",{fontCharacter:"\\eb4b"}),r.screenFull=new r("screen-full",{fontCharacter:"\\eb4c"}),r.screenNormal=new r("screen-normal",{fontCharacter:"\\eb4d"}),r.searchStop=new r("search-stop",{fontCharacter:"\\eb4e"}),r.server=new r("server",{fontCharacter:"\\eb50"}),r.settingsGear=new r("settings-gear",{fontCharacter:"\\eb51"}),r.settings=new r("settings",{fontCharacter:"\\eb52"}),r.shield=new r("shield",{fontCharacter:"\\eb53"}),r.smiley=new r("smiley",{fontCharacter:"\\eb54"}),r.sortPrecedence=new r("sort-precedence",{fontCharacter:"\\eb55"}),r.splitHorizontal=new r("split-horizontal",{fontCharacter:"\\eb56"}),r.splitVertical=new r("split-vertical",{fontCharacter:"\\eb57"}),r.squirrel=new r("squirrel",{fontCharacter:"\\eb58"}),r.starFull=new r("star-full",{fontCharacter:"\\eb59"}),r.starHalf=new r("star-half",{fontCharacter:"\\eb5a"}),r.symbolClass=new r("symbol-class",{fontCharacter:"\\eb5b"}),r.symbolColor=new r("symbol-color",{fontCharacter:"\\eb5c"}),r.symbolConstant=new r("symbol-constant",{fontCharacter:"\\eb5d"}),r.symbolEnumMember=new r("symbol-enum-member",{fontCharacter:"\\eb5e"}),r.symbolField=new r("symbol-field",{fontCharacter:"\\eb5f"}),r.symbolFile=new r("symbol-file",{fontCharacter:"\\eb60"}),r.symbolInterface=new r("symbol-interface",{fontCharacter:"\\eb61"}),r.symbolKeyword=new r("symbol-keyword",{fontCharacter:"\\eb62"}),r.symbolMisc=new r("symbol-misc",{fontCharacter:"\\eb63"}),r.symbolOperator=new r("symbol-operator",{fontCharacter:"\\eb64"}),r.symbolProperty=new r("symbol-property",{fontCharacter:"\\eb65"}),r.wrench=new r("wrench",{fontCharacter:"\\eb65"}),r.wrenchSubaction=new r("wrench-subaction",{fontCharacter:"\\eb65"}),r.symbolSnippet=new r("symbol-snippet",{fontCharacter:"\\eb66"}),r.tasklist=new r("tasklist",{fontCharacter:"\\eb67"}),r.telescope=new r("telescope",{fontCharacter:"\\eb68"}),r.textSize=new r("text-size",{fontCharacter:"\\eb69"}),r.threeBars=new r("three-bars",{fontCharacter:"\\eb6a"}),r.thumbsdown=new r("thumbsdown",{fontCharacter:"\\eb6b"}),r.thumbsup=new r("thumbsup",{fontCharacter:"\\eb6c"}),r.tools=new r("tools",{fontCharacter:"\\eb6d"}),r.triangleDown=new r("triangle-down",{fontCharacter:"\\eb6e"}),r.triangleLeft=new r("triangle-left",{fontCharacter:"\\eb6f"}),r.triangleRight=new r("triangle-right",{fontCharacter:"\\eb70"}),r.triangleUp=new r("triangle-up",{fontCharacter:"\\eb71"}),r.twitter=new r("twitter",{fontCharacter:"\\eb72"}),r.unfold=new r("unfold",{fontCharacter:"\\eb73"}),r.unlock=new r("unlock",{fontCharacter:"\\eb74"}),r.unmute=new r("unmute",{fontCharacter:"\\eb75"}),r.unverified=new r("unverified",{fontCharacter:"\\eb76"}),r.verified=new r("verified",{fontCharacter:"\\eb77"}),r.versions=new r("versions",{fontCharacter:"\\eb78"}),r.vmActive=new r("vm-active",{fontCharacter:"\\eb79"}),r.vmOutline=new r("vm-outline",{fontCharacter:"\\eb7a"}),r.vmRunning=new r("vm-running",{fontCharacter:"\\eb7b"}),r.watch=new r("watch",{fontCharacter:"\\eb7c"}),r.whitespace=new r("whitespace",{fontCharacter:"\\eb7d"}),r.wholeWord=new r("whole-word",{fontCharacter:"\\eb7e"}),r.window=new r("window",{fontCharacter:"\\eb7f"}),r.wordWrap=new r("word-wrap",{fontCharacter:"\\eb80"}),r.zoomIn=new r("zoom-in",{fontCharacter:"\\eb81"}),r.zoomOut=new r("zoom-out",{fontCharacter:"\\eb82"}),r.listFilter=new r("list-filter",{fontCharacter:"\\eb83"}),r.listFlat=new r("list-flat",{fontCharacter:"\\eb84"}),r.listSelection=new r("list-selection",{fontCharacter:"\\eb85"}),r.selection=new r("selection",{fontCharacter:"\\eb85"}),r.listTree=new r("list-tree",{fontCharacter:"\\eb86"}),r.debugBreakpointFunctionUnverified=new r("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),r.debugBreakpointFunction=new r("debug-breakpoint-function",{fontCharacter:"\\eb88"}),r.debugBreakpointFunctionDisabled=new r("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),r.debugStackframeActive=new r("debug-stackframe-active",{fontCharacter:"\\eb89"}),r.debugStackframeDot=new r("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),r.debugStackframe=new r("debug-stackframe",{fontCharacter:"\\eb8b"}),r.debugStackframeFocused=new r("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),r.debugBreakpointUnsupported=new r("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),r.symbolString=new r("symbol-string",{fontCharacter:"\\eb8d"}),r.debugReverseContinue=new r("debug-reverse-continue",{fontCharacter:"\\eb8e"}),r.debugStepBack=new r("debug-step-back",{fontCharacter:"\\eb8f"}),r.debugRestartFrame=new r("debug-restart-frame",{fontCharacter:"\\eb90"}),r.callIncoming=new r("call-incoming",{fontCharacter:"\\eb92"}),r.callOutgoing=new r("call-outgoing",{fontCharacter:"\\eb93"}),r.menu=new r("menu",{fontCharacter:"\\eb94"}),r.expandAll=new r("expand-all",{fontCharacter:"\\eb95"}),r.feedback=new r("feedback",{fontCharacter:"\\eb96"}),r.groupByRefType=new r("group-by-ref-type",{fontCharacter:"\\eb97"}),r.ungroupByRefType=new r("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),r.account=new r("account",{fontCharacter:"\\eb99"}),r.bellDot=new r("bell-dot",{fontCharacter:"\\eb9a"}),r.debugConsole=new r("debug-console",{fontCharacter:"\\eb9b"}),r.library=new r("library",{fontCharacter:"\\eb9c"}),r.output=new r("output",{fontCharacter:"\\eb9d"}),r.runAll=new r("run-all",{fontCharacter:"\\eb9e"}),r.syncIgnored=new r("sync-ignored",{fontCharacter:"\\eb9f"}),r.pinned=new r("pinned",{fontCharacter:"\\eba0"}),r.githubInverted=new r("github-inverted",{fontCharacter:"\\eba1"}),r.debugAlt=new r("debug-alt",{fontCharacter:"\\eb91"}),r.serverProcess=new r("server-process",{fontCharacter:"\\eba2"}),r.serverEnvironment=new r("server-environment",{fontCharacter:"\\eba3"}),r.pass=new r("pass",{fontCharacter:"\\eba4"}),r.stopCircle=new r("stop-circle",{fontCharacter:"\\eba5"}),r.playCircle=new r("play-circle",{fontCharacter:"\\eba6"}),r.record=new r("record",{fontCharacter:"\\eba7"}),r.debugAltSmall=new r("debug-alt-small",{fontCharacter:"\\eba8"}),r.vmConnect=new r("vm-connect",{fontCharacter:"\\eba9"}),r.cloud=new r("cloud",{fontCharacter:"\\ebaa"}),r.merge=new r("merge",{fontCharacter:"\\ebab"}),r.exportIcon=new r("export",{fontCharacter:"\\ebac"}),r.graphLeft=new r("graph-left",{fontCharacter:"\\ebad"}),r.magnet=new r("magnet",{fontCharacter:"\\ebae"}),r.notebook=new r("notebook",{fontCharacter:"\\ebaf"}),r.redo=new r("redo",{fontCharacter:"\\ebb0"}),r.checkAll=new r("check-all",{fontCharacter:"\\ebb1"}),r.pinnedDirty=new r("pinned-dirty",{fontCharacter:"\\ebb2"}),r.passFilled=new r("pass-filled",{fontCharacter:"\\ebb3"}),r.circleLargeFilled=new r("circle-large-filled",{fontCharacter:"\\ebb4"}),r.circleLargeOutline=new r("circle-large-outline",{fontCharacter:"\\ebb5"}),r.combine=new r("combine",{fontCharacter:"\\ebb6"}),r.gather=new r("gather",{fontCharacter:"\\ebb6"}),r.table=new r("table",{fontCharacter:"\\ebb7"}),r.variableGroup=new r("variable-group",{fontCharacter:"\\ebb8"}),r.typeHierarchy=new r("type-hierarchy",{fontCharacter:"\\ebb9"}),r.typeHierarchySub=new r("type-hierarchy-sub",{fontCharacter:"\\ebba"}),r.typeHierarchySuper=new r("type-hierarchy-super",{fontCharacter:"\\ebbb"}),r.gitPullRequestCreate=new r("git-pull-request-create",{fontCharacter:"\\ebbc"}),r.runAbove=new r("run-above",{fontCharacter:"\\ebbd"}),r.runBelow=new r("run-below",{fontCharacter:"\\ebbe"}),r.notebookTemplate=new r("notebook-template",{fontCharacter:"\\ebbf"}),r.debugRerun=new r("debug-rerun",{fontCharacter:"\\ebc0"}),r.workspaceTrusted=new r("workspace-trusted",{fontCharacter:"\\ebc1"}),r.workspaceUntrusted=new r("workspace-untrusted",{fontCharacter:"\\ebc2"}),r.workspaceUnspecified=new r("workspace-unspecified",{fontCharacter:"\\ebc3"}),r.terminalCmd=new r("terminal-cmd",{fontCharacter:"\\ebc4"}),r.terminalDebian=new r("terminal-debian",{fontCharacter:"\\ebc5"}),r.terminalLinux=new r("terminal-linux",{fontCharacter:"\\ebc6"}),r.terminalPowershell=new r("terminal-powershell",{fontCharacter:"\\ebc7"}),r.terminalTmux=new r("terminal-tmux",{fontCharacter:"\\ebc8"}),r.terminalUbuntu=new r("terminal-ubuntu",{fontCharacter:"\\ebc9"}),r.terminalBash=new r("terminal-bash",{fontCharacter:"\\ebca"}),r.arrowSwap=new r("arrow-swap",{fontCharacter:"\\ebcb"}),r.copy=new r("copy",{fontCharacter:"\\ebcc"}),r.personAdd=new r("person-add",{fontCharacter:"\\ebcd"}),r.filterFilled=new r("filter-filled",{fontCharacter:"\\ebce"}),r.wand=new r("wand",{fontCharacter:"\\ebcf"}),r.debugLineByLine=new r("debug-line-by-line",{fontCharacter:"\\ebd0"}),r.inspect=new r("inspect",{fontCharacter:"\\ebd1"}),r.layers=new r("layers",{fontCharacter:"\\ebd2"}),r.layersDot=new r("layers-dot",{fontCharacter:"\\ebd3"}),r.layersActive=new r("layers-active",{fontCharacter:"\\ebd4"}),r.compass=new r("compass",{fontCharacter:"\\ebd5"}),r.compassDot=new r("compass-dot",{fontCharacter:"\\ebd6"}),r.compassActive=new r("compass-active",{fontCharacter:"\\ebd7"}),r.azure=new r("azure",{fontCharacter:"\\ebd8"}),r.issueDraft=new r("issue-draft",{fontCharacter:"\\ebd9"}),r.gitPullRequestClosed=new r("git-pull-request-closed",{fontCharacter:"\\ebda"}),r.gitPullRequestDraft=new r("git-pull-request-draft",{fontCharacter:"\\ebdb"}),r.debugAll=new r("debug-all",{fontCharacter:"\\ebdc"}),r.debugCoverage=new r("debug-coverage",{fontCharacter:"\\ebdd"}),r.runErrors=new r("run-errors",{fontCharacter:"\\ebde"}),r.folderLibrary=new r("folder-library",{fontCharacter:"\\ebdf"}),r.debugContinueSmall=new r("debug-continue-small",{fontCharacter:"\\ebe0"}),r.beakerStop=new r("beaker-stop",{fontCharacter:"\\ebe1"}),r.graphLine=new r("graph-line",{fontCharacter:"\\ebe2"}),r.graphScatter=new r("graph-scatter",{fontCharacter:"\\ebe3"}),r.pieChart=new r("pie-chart",{fontCharacter:"\\ebe4"}),r.bracket=new r("bracket",r.json.definition),r.bracketDot=new r("bracket-dot",{fontCharacter:"\\ebe5"}),r.bracketError=new r("bracket-error",{fontCharacter:"\\ebe6"}),r.lockSmall=new r("lock-small",{fontCharacter:"\\ebe7"}),r.azureDevops=new r("azure-devops",{fontCharacter:"\\ebe8"}),r.verifiedFilled=new r("verified-filled",{fontCharacter:"\\ebe9"})}(F||(F={}))},"VrN/":function(at,ve,Z){(function(se,Se){at.exports=Se()})(this,function(){"use strict";var se=navigator.userAgent,Se=navigator.platform,ce=/gecko\/\d/i.test(se),ye=/MSIE \d/.test(se),le=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(se),X=/Edge\/(\d+)/.exec(se),F=ye||le||X,W=F&&(ye?document.documentMode||6:+(X||le)[1]),r=!X&&/WebKit\//.test(se),H=r&&/Qt\/\d+\.\d+/.test(se),D=!X&&/Chrome\//.test(se),M=/Opera\//.test(se),g=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(se),u=/PhantomJS/.test(se),m=!X&&/AppleWebKit/.test(se)&&/Mobile\/\w+/.test(se),b=/Android/.test(se),E=m||b||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(se),_=m||/Mac/.test(Se),f=/\bCrOS\b/.test(se),O=/win/i.test(Se),w=M&&se.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(M=!1,r=!0);var R=_&&(H||M&&(w==null||w<12.11)),x=ce||F&&W>=9;function I(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var k=function(e,t){var s=e.className,i=I(t).exec(s);if(i){var d=s.slice(i.index+i[0].length);e.className=s.slice(0,i.index)+(d?i[1]+d:"")}};function A(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function P(e,t){return A(e).appendChild(t)}function S(e,t,s,i){var d=document.createElement(e);if(s&&(d.className=s),i&&(d.style.cssText=i),typeof t=="string")d.appendChild(document.createTextNode(t));else if(t)for(var B=0;B<t.length;++B)d.appendChild(t[B]);return d}function C(e,t,s,i){var d=S(e,t,s,i);return d.setAttribute("role","presentation"),d}var c;document.createRange?c=function(e,t,s,i){var d=document.createRange();return d.setEnd(i||e,s),d.setStart(e,t),d}:c=function(e,t,s){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(d){return i}return i.collapse(!0),i.moveEnd("character",s),i.moveStart("character",t),i};function o(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function v(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function l(e,t){var s=e.className;I(t).test(s)||(e.className+=(s?" ":"")+t)}function a(e,t){for(var s=e.split(" "),i=0;i<s.length;i++)s[i]&&!I(s[i]).test(t)&&(t+=" "+s[i]);return t}var T=function(e){e.select()};m?T=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:F&&(T=function(e){try{e.select()}catch(t){}});function h(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function n(e,t,s){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(s!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function N(e,t,s,i,d){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var B=i||0,z=d||0;;){var $=e.indexOf(" ",B);if($<0||$>=t)return z+(t-B);z+=$-B,z+=s-z%s,B=$+1}}var U=function(){this.id=null,this.f=null,this.time=0,this.handler=h(this.onTimeout,this)};U.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},U.prototype.set=function(e,t){this.f=t;var s=+new Date+e;(!this.id||s<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=s)};function j(e,t){for(var s=0;s<e.length;++s)if(e[s]==t)return s;return-1}var Y=50,J={toString:function(){return"CodeMirror.Pass"}},ee={scroll:!1},ie={origin:"*mouse"},re={origin:"+move"};function he(e,t,s){for(var i=0,d=0;;){var B=e.indexOf(" ",i);B==-1&&(B=e.length);var z=B-i;if(B==e.length||d+z>=t)return i+Math.min(z,t-d);if(d+=B-i,d+=s-d%s,i=B+1,d>=t)return i}}var oe=[""];function ae(e){for(;oe.length<=e;)oe.push(Ee(oe)+" ");return oe[e]}function Ee(e){return e[e.length-1]}function Le(e,t){for(var s=[],i=0;i<e.length;i++)s[i]=t(e[i],i);return s}function Fe(e,t,s){for(var i=0,d=s(t);i<e.length&&s(e[i])<=d;)i++;e.splice(i,0,t)}function Xe(){}function He(e,t){var s;return Object.create?s=Object.create(e):(Xe.prototype=e,s=new Xe),t&&n(t,s),s}var Ae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Oe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ae.test(e))}function Ke(e,t){return t?t.source.indexOf("\\w")>-1&&Oe(e)?!0:t.test(e):Oe(e)}function de(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var xe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ie(e){return e.charCodeAt(0)>=768&&xe.test(e)}function De(e,t,s){for(;(s<0?t>0:t<e.length)&&Ie(e.charAt(t));)t+=s;return t}function Be(e,t,s){for(var i=t>s?-1:1;;){if(t==s)return t;var d=(t+s)/2,B=i<0?Math.ceil(d):Math.floor(d);if(B==t)return e(B)?t:s;e(B)?s=B:t=B+i}}function ze(e,t,s,i){if(!e)return i(t,s,"ltr",0);for(var d=!1,B=0;B<e.length;++B){var z=e[B];(z.from<s&&z.to>t||t==s&&z.to==t)&&(i(Math.max(z.from,t),Math.min(z.to,s),z.level==1?"rtl":"ltr",B),d=!0)}d||i(t,s,"ltr")}var Ye=null;function Ze(e,t,s){var i;Ye=null;for(var d=0;d<e.length;++d){var B=e[d];if(B.from<t&&B.to>t)return d;B.to==t&&(B.from!=B.to&&s=="before"?i=d:Ye=d),B.from==t&&(B.from!=B.to&&s!="before"?i=d:Ye=d)}return i!=null?i:Ye}var ut=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function s(te){return te<=247?e.charAt(te):1424<=te&&te<=1524?"R":1536<=te&&te<=1785?t.charAt(te-1536):1774<=te&&te<=2220?"r":8192<=te&&te<=8203?"w":te==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,B=/[LRr]/,z=/[Lb1n]/,$=/[1n]/;function Q(te,ge,be){this.level=te,this.from=ge,this.to=be}return function(te,ge){var be=ge=="ltr"?"L":"R";if(te.length==0||ge=="ltr"&&!i.test(te))return!1;for(var ke=te.length,Re=[],We=0;We<ke;++We)Re.push(s(te.charCodeAt(We)));for(var $e=0,rt=be;$e<ke;++$e){var ot=Re[$e];ot=="m"?Re[$e]=rt:rt=ot}for(var ft=0,lt=be;ft<ke;++ft){var gt=Re[ft];gt=="1"&<=="r"?Re[ft]="n":B.test(gt)&&(lt=gt,gt=="r"&&(Re[ft]="R"))}for(var Tt=1,_t=Re[0];Tt<ke-1;++Tt){var Mt=Re[Tt];Mt=="+"&&_t=="1"&&Re[Tt+1]=="1"?Re[Tt]="1":Mt==","&&_t==Re[Tt+1]&&(_t=="1"||_t=="n")&&(Re[Tt]=_t),_t=Mt}for(var tr=0;tr<ke;++tr){var Cr=Re[tr];if(Cr==",")Re[tr]="N";else if(Cr=="%"){var lr=void 0;for(lr=tr+1;lr<ke&&Re[lr]=="%";++lr);for(var Jr=tr&&Re[tr-1]=="!"||lr<ke&&Re[lr]=="1"?"1":"N",Kr=tr;Kr<lr;++Kr)Re[Kr]=Jr;tr=lr-1}}for(var gr=0,zr=be;gr<ke;++gr){var Lr=Re[gr];zr=="L"&&Lr=="1"?Re[gr]="L":B.test(Lr)&&(zr=Lr)}for(var Er=0;Er<ke;++Er)if(d.test(Re[Er])){var vr=void 0;for(vr=Er+1;vr<ke&&d.test(Re[vr]);++vr);for(var hr=(Er?Re[Er-1]:be)=="L",Vr=(vr<ke?Re[vr]:be)=="L",di=hr==Vr?hr?"L":"R":be,kn=Er;kn<vr;++kn)Re[kn]=di;Er=vr-1}for(var Nr=[],pn,Ar=0;Ar<ke;)if(z.test(Re[Ar])){var Va=Ar;for(++Ar;Ar<ke&&z.test(Re[Ar]);++Ar);Nr.push(new Q(0,Va,Ar))}else{var wn=Ar,Kn=Nr.length,zn=ge=="rtl"?1:0;for(++Ar;Ar<ke&&Re[Ar]!="L";++Ar);for(var Br=wn;Br<Ar;)if($.test(Re[Br])){wn<Br&&(Nr.splice(Kn,0,new Q(1,wn,Br)),Kn+=zn);var ci=Br;for(++Br;Br<Ar&&$.test(Re[Br]);++Br);Nr.splice(Kn,0,new Q(2,ci,Br)),Kn+=zn,wn=Br}else++Br;wn<Ar&&Nr.splice(Kn,0,new Q(1,wn,Ar))}return ge=="ltr"&&(Nr[0].level==1&&(pn=te.match(/^\s+/))&&(Nr[0].from=pn[0].length,Nr.unshift(new Q(0,0,pn[0].length))),Ee(Nr).level==1&&(pn=te.match(/\s+$/))&&(Ee(Nr).to-=pn[0].length,Nr.push(new Q(0,ke-pn[0].length,ke)))),ge=="rtl"?Nr.reverse():Nr}}();function Qe(e,t){var s=e.order;return s==null&&(s=e.order=ut(e.text,t)),s}var st=[],Ne=function(e,t,s){if(e.addEventListener)e.addEventListener(t,s,!1);else if(e.attachEvent)e.attachEvent("on"+t,s);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||st).concat(s)}};function vt(e,t){return e._handlers&&e._handlers[t]||st}function ht(e,t,s){if(e.removeEventListener)e.removeEventListener(t,s,!1);else if(e.detachEvent)e.detachEvent("on"+t,s);else{var i=e._handlers,d=i&&i[t];if(d){var B=j(d,s);B>-1&&(i[t]=d.slice(0,B).concat(d.slice(B+1)))}}}function Ue(e,t){var s=vt(e,t);if(!s.length)return;for(var i=Array.prototype.slice.call(arguments,2),d=0;d<s.length;++d)s[d].apply(null,i)}function Ve(e,t,s){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ue(e,s||t.type,e,t),fe(t)||t.codemirrorIgnore}function Ce(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var s=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)j(s,t[i])==-1&&s.push(t[i])}function _e(e,t){return vt(e,t).length>0}function Te(e){e.prototype.on=function(t,s){Ne(this,t,s)},e.prototype.off=function(t,s){ht(this,t,s)}}function ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ue(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function fe(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function me(e){ne(e),ue(e)}function we(e){return e.target||e.srcElement}function Me(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),_&&e.ctrlKey&&t==1&&(t=3),t}var je=function(){if(F&&W<9)return!1;var e=S("div");return"draggable"in e||"dragDrop"in e}(),qe;function ct(e){if(qe==null){var t=S("span","\u200B");P(e,S("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(qe=t.offsetWidth<=1&&t.offsetHeight>2&&!(F&&W<8))}var s=qe?S("span","\u200B"):S("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return s.setAttribute("cm-text",""),s}var et;function kt(e){if(et!=null)return et;var t=P(e,document.createTextNode("A\u062EA")),s=c(t,0,1).getBoundingClientRect(),i=c(t,1,2).getBoundingClientRect();return A(e),!s||s.left==s.right?!1:et=i.right-s.right<3}var Ct=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,s=[],i=e.length;t<=i;){var d=e.indexOf(`
|
|
`,t);d==-1&&(d=e.length);var B=e.slice(t,e.charAt(d-1)=="\r"?d-1:d),z=B.indexOf("\r");z!=-1?(s.push(B.slice(0,z)),t+=z+1):(s.push(B),t=d+1)}return s}:function(e){return e.split(/\r\n?|\n/)},pt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(s){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Nt=function(){var e=S("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function wt(e){if(Et!=null)return Et;var t=P(e,S("span","x")),s=t.getBoundingClientRect(),i=c(t,0,1).getBoundingClientRect();return Et=Math.abs(s.left-i.left)>1}var Ht={},It={};function rr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ht[e]=t}function Rr(e,t){It[e]=t}function ar(e){if(typeof e=="string"&&It.hasOwnProperty(e))e=It[e];else if(e&&typeof e.name=="string"&&It.hasOwnProperty(e.name)){var t=It[e.name];typeof t=="string"&&(t={name:t}),e=He(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ar("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ar("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function xr(e,t){t=ar(t);var s=Ht[t.name];if(!s)return xr(e,"text/plain");var i=s(e,t);if(tt.hasOwnProperty(t.name)){var d=tt[t.name];for(var B in d){if(!d.hasOwnProperty(B))continue;i.hasOwnProperty(B)&&(i["_"+B]=i[B]),i[B]=d[B]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var z in t.modeProps)i[z]=t.modeProps[z];return i}var tt={};function At(e,t){var s=tt.hasOwnProperty(e)?tt[e]:tt[e]={};n(t,s)}function Lt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var s={};for(var i in t){var d=t[i];d instanceof Array&&(d=d.concat([])),s[i]=d}return s}function Ut(e,t){for(var s;e.innerMode&&!(s=e.innerMode(t),!s||s.mode==e);)t=s.state,e=s.mode;return s||{mode:e,state:t}}function fr(e,t,s){return e.startState?e.startState(t,s):!0}var Yt=function(e,t,s){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=s};Yt.prototype.eol=function(){return this.pos>=this.string.length},Yt.prototype.sol=function(){return this.pos==this.lineStart},Yt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Yt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Yt.prototype.eat=function(e){var t=this.string.charAt(this.pos),s;if(typeof e=="string"?s=t==e:s=t&&(e.test?e.test(t):e(t)),s)return++this.pos,t},Yt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Yt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Yt.prototype.skipToEnd=function(){this.pos=this.string.length},Yt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Yt.prototype.backUp=function(e){this.pos-=e},Yt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=N(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?N(this.string,this.lineStart,this.tabSize):0)},Yt.prototype.indentation=function(){return N(this.string,null,this.tabSize)-(this.lineStart?N(this.string,this.lineStart,this.tabSize):0)},Yt.prototype.match=function(e,t,s){if(typeof e=="string"){var i=function(z){return s?z.toLowerCase():z},d=this.string.substr(this.pos,e.length);if(i(d)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var B=this.string.slice(this.pos).match(e);return B&&B.index>0?null:(B&&t!==!1&&(this.pos+=B[0].length),B)}},Yt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Yt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Yt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Yt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function mt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var s=e;!s.lines;)for(var i=0;;++i){var d=s.children[i],B=d.chunkSize();if(t<B){s=d;break}t-=B}return s.lines[t]}function sr(e,t,s){var i=[],d=t.line;return e.iter(t.line,s.line+1,function(B){var z=B.text;d==s.line&&(z=z.slice(0,s.ch)),d==t.line&&(z=z.slice(t.ch)),i.push(z),++d}),i}function Qt(e,t,s){var i=[];return e.iter(t,s,function(d){i.push(d.text)}),i}function Jt(e,t){var s=t-e.height;if(s)for(var i=e;i;i=i.parent)i.height+=s}function Dt(e){if(e.parent==null)return null;for(var t=e.parent,s=j(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var d=0;!(i.children[d]==t);++d)s+=i.children[d].chunkSize();return s+t.first}function dr(e,t){var s=e.first;e:do{for(var i=0;i<e.children.length;++i){var d=e.children[i],B=d.height;if(t<B){e=d;continue e}t-=B,s+=d.chunkSize()}return s}while(!e.lines);for(var z=0;z<e.lines.length;++z){var $=e.lines[z],Q=$.height;if(t<Q)break;t-=Q}return s+z}function yr(e,t){return t>=e.first&&t<e.first+e.size}function Yr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Je(e,t,s){if(s===void 0&&(s=null),!(this instanceof Je))return new Je(e,t,s);this.line=e,this.ch=t,this.sticky=s}function nt(e,t){return e.line-t.line||e.ch-t.ch}function Ot(e,t){return e.sticky==t.sticky&&nt(e,t)==0}function Kt(e){return Je(e.line,e.ch)}function Pt(e,t){return nt(e,t)<0?t:e}function br(e,t){return nt(e,t)<0?e:t}function Xr(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function St(e,t){if(t.line<e.first)return Je(e.first,0);var s=e.first+e.size-1;return t.line>s?Je(s,mt(e,s).text.length):V(t,mt(e,t.line).text.length)}function V(e,t){var s=e.ch;return s==null||s>t?Je(e.line,t):s<0?Je(e.line,0):e}function y(e,t){for(var s=[],i=0;i<t.length;i++)s[i]=St(e,t[i]);return s}var L=function(e,t){this.state=e,this.lookAhead=t},G=function(e,t,s,i){this.state=t,this.doc=e,this.line=s,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};G.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},G.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},G.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},G.fromSaved=function(e,t,s){return t instanceof L?new G(e,Lt(e.mode,t.state),s,t.lookAhead):new G(e,Lt(e.mode,t),s)},G.prototype.save=function(e){var t=e!==!1?Lt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new L(t,this.maxLookAhead):t};function q(e,t,s,i){var d=[e.state.modeGen],B={};qt(e,t.text,e.doc.mode,s,function(te,ge){return d.push(te,ge)},B,i);for(var z=s.state,$=function(te){s.baseTokens=d;var ge=e.state.overlays[te],be=1,ke=0;s.state=!0,qt(e,t.text,ge.mode,s,function(Re,We){for(var $e=be;ke<Re;){var rt=d[be];rt>Re&&d.splice(be,1,Re,d[be+1],rt),be+=2,ke=Math.min(Re,rt)}if(!We)return;if(ge.opaque)d.splice($e,be-$e,Re,"overlay "+We),be=$e+2;else for(;$e<be;$e+=2){var ot=d[$e+1];d[$e+1]=(ot?ot+" ":"")+"overlay "+We}},B),s.state=z,s.baseTokens=null,s.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)$(Q);return{styles:d,classes:B.bgClass||B.textClass?B:null}}function K(e,t,s){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=pe(e,Dt(t)),d=t.text.length>e.options.maxHighlightLength&&Lt(e.doc.mode,i.state),B=q(e,t,i);d&&(i.state=d),t.stateAfter=i.save(!d),t.styles=B.styles,B.classes?t.styleClasses=B.classes:t.styleClasses&&(t.styleClasses=null),s===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function pe(e,t,s){var i=e.doc,d=e.display;if(!i.mode.startState)return new G(i,!0,t);var B=Zr(e,t,s),z=B>i.first&&mt(i,B-1).stateAfter,$=z?G.fromSaved(i,z,B):new G(i,fr(i.mode),B);return i.iter(B,t,function(Q){Pe(e,Q.text,$);var te=$.line;Q.stateAfter=te==t-1||te%5==0||te>=d.viewFrom&&te<d.viewTo?$.save():null,$.nextLine()}),s&&(i.modeFrontier=$.line),$}function Pe(e,t,s,i){var d=e.doc.mode,B=new Yt(t,e.options.tabSize,s);for(B.start=B.pos=i||0,t==""&&it(d,s.state);!B.eol();)dt(d,B,s.state),B.start=B.pos}function it(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var s=Ut(e,t);if(s.mode.blankLine)return s.mode.blankLine(s.state)}function dt(e,t,s,i){for(var d=0;d<10;d++){i&&(i[0]=Ut(e,s).mode);var B=e.token(t,s);if(t.pos>t.start)return B}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ge=function(e,t,s){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=s};function yt(e,t,s,i){var d=e.doc,B=d.mode,z;t=St(d,t);var $=mt(d,t.line),Q=pe(e,t.line,s),te=new Yt($.text,e.options.tabSize,Q),ge;for(i&&(ge=[]);(i||te.pos<t.ch)&&!te.eol();)te.start=te.pos,z=dt(B,te,Q.state),i&&ge.push(new Ge(te,z,Lt(d.mode,Q.state)));return i?ge:new Ge(te,z,Q.state)}function Ft(e,t){if(e)for(;;){var s=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!s)break;e=e.slice(0,s.index)+e.slice(s.index+s[0].length);var i=s[1]?"bgClass":"textClass";t[i]==null?t[i]=s[2]:new RegExp("(?:^|\\s)"+s[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+s[2])}return e}function qt(e,t,s,i,d,B,z){var $=s.flattenSpans;$==null&&($=e.options.flattenSpans);var Q=0,te=null,ge=new Yt(t,e.options.tabSize,i),be,ke=e.options.addModeClass&&[null];for(t==""&&Ft(it(s,i.state),B);!ge.eol();){if(ge.pos>e.options.maxHighlightLength?($=!1,z&&Pe(e,t,i,ge.pos),ge.pos=t.length,be=null):be=Ft(dt(s,ge,i.state,ke),B),ke){var Re=ke[0].name;Re&&(be="m-"+(be?Re+" "+be:Re))}if(!$||te!=be){for(;Q<ge.start;)Q=Math.min(ge.start,Q+5e3),d(Q,te);te=be}ge.start=ge.pos}for(;Q<ge.pos;){var We=Math.min(ge.pos,Q+5e3);d(We,te),Q=We}}function Zr(e,t,s){for(var i,d,B=e.doc,z=s?-1:t-(e.doc.mode.innerMode?1e3:100),$=t;$>z;--$){if($<=B.first)return B.first;var Q=mt(B,$-1),te=Q.stateAfter;if(te&&(!s||$+(te instanceof L?te.lookAhead:0)<=B.modeFrontier))return $;var ge=N(Q.text,null,e.options.tabSize);(d==null||i>ge)&&(d=$-1,i=ge)}return d}function Fr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var s=e.first,i=t-1;i>s;i--){var d=mt(e,i).stateAfter;if(d&&(!(d instanceof L)||i+d.lookAhead<t)){s=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,s)}var ur=!1,or=!1;function ln(){ur=!0}function Vn(){or=!0}function en(e,t,s){this.marker=e,this.from=t,this.to=s}function kr(e,t){if(e)for(var s=0;s<e.length;++s){var i=e[s];if(i.marker==t)return i}}function Dn(e,t){for(var s,i=0;i<e.length;++i)e[i]!=t&&(s||(s=[])).push(e[i]);return s}function Yn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Xn(e,t,s){var i;if(e)for(var d=0;d<e.length;++d){var B=e[d],z=B.marker,$=B.from==null||(z.inclusiveLeft?B.from<=t:B.from<t);if($||B.from==t&&z.type=="bookmark"&&(!s||!B.marker.insertLeft)){var Q=B.to==null||(z.inclusiveRight?B.to>=t:B.to>t);(i||(i=[])).push(new en(z,B.from,Q?null:B.to))}}return i}function mn(e,t,s){var i;if(e)for(var d=0;d<e.length;++d){var B=e[d],z=B.marker,$=B.to==null||(z.inclusiveRight?B.to>=t:B.to>t);if($||B.from==t&&z.type=="bookmark"&&(!s||B.marker.insertLeft)){var Q=B.from==null||(z.inclusiveLeft?B.from<=t:B.from<t);(i||(i=[])).push(new en(z,Q?null:B.from-t,B.to==null?null:B.to-t))}}return i}function Tn(e,t){if(t.full)return null;var s=yr(e,t.from.line)&&mt(e,t.from.line).markedSpans,i=yr(e,t.to.line)&&mt(e,t.to.line).markedSpans;if(!s&&!i)return null;var d=t.from.ch,B=t.to.ch,z=nt(t.from,t.to)==0,$=Xn(s,d,z),Q=mn(i,B,z),te=t.text.length==1,ge=Ee(t.text).length+(te?d:0);if($)for(var be=0;be<$.length;++be){var ke=$[be];if(ke.to==null){var Re=kr(Q,ke.marker);Re?te&&(ke.to=Re.to==null?null:Re.to+ge):ke.to=d}}if(Q)for(var We=0;We<Q.length;++We){var $e=Q[We];if($e.to!=null&&($e.to+=ge),$e.from==null){var rt=kr($,$e.marker);rt||($e.from=ge,te&&($||($=[])).push($e))}else $e.from+=ge,te&&($||($=[])).push($e)}$&&($=$n($)),Q&&Q!=$&&(Q=$n(Q));var ot=[$];if(!te){var ft=t.text.length-2,lt;if(ft>0&&$)for(var gt=0;gt<$.length;++gt)$[gt].to==null&&(lt||(lt=[])).push(new en($[gt].marker,null,null));for(var Tt=0;Tt<ft;++Tt)ot.push(lt);ot.push(Q)}return ot}function $n(e){for(var t=0;t<e.length;++t){var s=e[t];s.from!=null&&s.from==s.to&&s.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function gn(e,t,s){var i=null;if(e.iter(t.line,s.line+1,function(Re){if(Re.markedSpans)for(var We=0;We<Re.markedSpans.length;++We){var $e=Re.markedSpans[We].marker;$e.readOnly&&(!i||j(i,$e)==-1)&&(i||(i=[])).push($e)}}),!i)return null;for(var d=[{from:t,to:s}],B=0;B<i.length;++B)for(var z=i[B],$=z.find(0),Q=0;Q<d.length;++Q){var te=d[Q];if(nt(te.to,$.from)<0||nt(te.from,$.to)>0)continue;var ge=[Q,1],be=nt(te.from,$.from),ke=nt(te.to,$.to);(be<0||!z.inclusiveLeft&&!be)&&ge.push({from:te.from,to:$.from}),(ke>0||!z.inclusiveRight&&!ke)&&ge.push({from:$.to,to:te.to}),d.splice.apply(d,ge),Q+=ge.length-3}return d}function rn(e){var t=e.markedSpans;if(!t)return;for(var s=0;s<t.length;++s)t[s].marker.detachLine(e);e.markedSpans=null}function un(e,t){if(!t)return;for(var s=0;s<t.length;++s)t[s].marker.attachLine(e);e.markedSpans=t}function vn(e){return e.inclusiveLeft?-1:0}function yn(e){return e.inclusiveRight?1:0}function pr(e,t){var s=e.lines.length-t.lines.length;if(s!=0)return s;var i=e.find(),d=t.find(),B=nt(i.from,d.from)||vn(e)-vn(t);if(B)return-B;var z=nt(i.to,d.to)||yn(e)-yn(t);return z||t.id-e.id}function zt(e,t){var s=or&&e.markedSpans,i;if(s)for(var d=void 0,B=0;B<s.length;++B)d=s[B],d.marker.collapsed&&(t?d.from:d.to)==null&&(!i||pr(i,d.marker)<0)&&(i=d.marker);return i}function mr(e){return zt(e,!0)}function jt(e){return zt(e,!1)}function Or(e,t){var s=or&&e.markedSpans,i;if(s)for(var d=0;d<s.length;++d){var B=s[d];B.marker.collapsed&&(B.from==null||B.from<t)&&(B.to==null||B.to>t)&&(!i||pr(i,B.marker)<0)&&(i=B.marker)}return i}function nr(e,t,s,i,d){var B=mt(e,t),z=or&&B.markedSpans;if(z)for(var $=0;$<z.length;++$){var Q=z[$];if(!Q.marker.collapsed)continue;var te=Q.marker.find(0),ge=nt(te.from,s)||vn(Q.marker)-vn(d),be=nt(te.to,i)||yn(Q.marker)-yn(d);if(ge>=0&&be<=0||ge<=0&&be>=0)continue;if(ge<=0&&(Q.marker.inclusiveRight&&d.inclusiveLeft?nt(te.to,s)>=0:nt(te.to,s)>0)||ge>=0&&(Q.marker.inclusiveRight&&d.inclusiveLeft?nt(te.from,i)<=0:nt(te.from,i)<0))return!0}}function Dr(e){for(var t;t=mr(e);)e=t.find(-1,!0).line;return e}function wr(e){for(var t;t=jt(e);)e=t.find(1,!0).line;return e}function bn(e){for(var t,s;t=jt(e);)e=t.find(1,!0).line,(s||(s=[])).push(e);return s}function Pn(e,t){var s=mt(e,t),i=Dr(s);return s==i?t:Dt(i)}function hn(e,t){if(t>e.lastLine())return t;var s=mt(e,t),i;if(!dn(e,s))return t;for(;i=jt(s);)s=i.find(1,!0).line;return Dt(s)+1}function dn(e,t){var s=or&&t.markedSpans;if(s)for(var i=void 0,d=0;d<s.length;++d){if(i=s[d],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&fi(e,t,i))return!0}}function fi(e,t,s){if(s.to==null){var i=s.marker.find(1,!0);return fi(e,i.line,kr(i.line.markedSpans,s.marker))}if(s.marker.inclusiveRight&&s.to==t.text.length)return!0;for(var d=void 0,B=0;B<t.markedSpans.length;++B)if(d=t.markedSpans[B],d.marker.collapsed&&!d.marker.widgetNode&&d.from==s.to&&(d.to==null||d.to!=s.from)&&(d.marker.inclusiveLeft||s.marker.inclusiveRight)&&fi(e,t,d))return!0}function nn(e){e=Dr(e);for(var t=0,s=e.parent,i=0;i<s.lines.length;++i){var d=s.lines[i];if(d==e)break;t+=d.height}for(var B=s.parent;B;s=B,B=s.parent)for(var z=0;z<B.children.length;++z){var $=B.children[z];if($==s)break;t+=$.height}return t}function pi(e){if(e.height==0)return 0;for(var t=e.text.length,s,i=e;s=mr(i);){var d=s.find(0,!0);i=d.from.line,t+=d.from.ch-d.to.ch}for(i=e;s=jt(i);){var B=s.find(0,!0);t-=i.text.length-B.from.ch,i=B.to.line,t+=i.text.length-B.to.ch}return t}function Hi(e){var t=e.display,s=e.doc;t.maxLine=mt(s,s.first),t.maxLineLength=pi(t.maxLine),t.maxLineChanged=!0,s.iter(function(i){var d=pi(i);d>t.maxLineLength&&(t.maxLineLength=d,t.maxLine=i)})}var Mn=function(e,t,s){this.text=e,un(this,t),this.height=s?s(this):1};Mn.prototype.lineNo=function(){return Dt(this)},Te(Mn);function ua(e,t,s,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),rn(e),un(e,s);var d=i?i(e):1;d!=e.height&&Jt(e,d)}function bt(e){e.parent=null,rn(e)}var Rt={},xt={};function Bt(e,t){if(!e||/^\s*$/.test(e))return null;var s=t.addModeClass?xt:Rt;return s[e]||(s[e]=e.replace(/\S+/g,"cm-$&"))}function Vt(e,t){var s=C("span",null,null,r?"padding-right: .1px":null),i={pre:C("pre",[s],"CodeMirror-line"),content:s,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var d=0;d<=(t.rest?t.rest.length:0);d++){var B=d?t.rest[d-1]:t.line,z=void 0;i.pos=0,i.addToken=Gt,kt(e.display.measure)&&(z=Qe(B,e.doc.direction))&&(i.addToken=Hr(i.addToken,z)),i.map=[];var $=t!=e.display.externalMeasured&&Dt(B);_n(B,i,K(e,B,$)),B.styleClasses&&(B.styleClasses.bgClass&&(i.bgClass=a(B.styleClasses.bgClass,i.bgClass||"")),B.styleClasses.textClass&&(i.textClass=a(B.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(ct(e.display.measure))),d==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(r){var Q=i.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return Ue(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=a(i.pre.className,i.textClass||"")),i}function er(e){var t=S("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Gt(e,t,s,i,d,B,z){if(!t)return;var $=e.splitSpaces?_r(t,e.trailingSpace):t,Q=e.cm.state.specialChars,te=!1,ge;if(!Q.test(t))e.col+=t.length,ge=document.createTextNode($),e.map.push(e.pos,e.pos+t.length,ge),F&&W<9&&(te=!0),e.pos+=t.length;else{ge=document.createDocumentFragment();for(var be=0;;){Q.lastIndex=be;var ke=Q.exec(t),Re=ke?ke.index-be:t.length-be;if(Re){var We=document.createTextNode($.slice(be,be+Re));F&&W<9?ge.appendChild(S("span",[We])):ge.appendChild(We),e.map.push(e.pos,e.pos+Re,We),e.col+=Re,e.pos+=Re}if(!ke)break;be+=Re+1;var $e=void 0;if(ke[0]==" "){var rt=e.cm.options.tabSize,ot=rt-e.col%rt;$e=ge.appendChild(S("span",ae(ot),"cm-tab")),$e.setAttribute("role","presentation"),$e.setAttribute("cm-text"," "),e.col+=ot}else ke[0]=="\r"||ke[0]==`
|
|
`?($e=ge.appendChild(S("span",ke[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),$e.setAttribute("cm-text",ke[0]),e.col+=1):($e=e.cm.options.specialCharPlaceholder(ke[0]),$e.setAttribute("cm-text",ke[0]),F&&W<9?ge.appendChild(S("span",[$e])):ge.appendChild($e),e.col+=1);e.map.push(e.pos,e.pos+1,$e),e.pos++}}if(e.trailingSpace=$.charCodeAt(t.length-1)==32,s||i||d||te||B||z){var ft=s||"";i&&(ft+=i),d&&(ft+=d);var lt=S("span",[ge],ft,B);if(z)for(var gt in z)z.hasOwnProperty(gt)&>!="style"&>!="class"&<.setAttribute(gt,z[gt]);return e.content.appendChild(lt)}e.content.appendChild(ge)}function _r(e,t){if(e.length>1&&!/ /.test(e))return e;for(var s=t,i="",d=0;d<e.length;d++){var B=e.charAt(d);B==" "&&s&&(d==e.length-1||e.charCodeAt(d+1)==32)&&(B="\xA0"),i+=B,s=B==" "}return i}function Hr(e,t){return function(s,i,d,B,z,$,Q){d=d?d+" cm-force-border":"cm-force-border";for(var te=s.pos,ge=te+i.length;;){for(var be=void 0,ke=0;ke<t.length&&!(be=t[ke],be.to>te&&be.from<=te);ke++);if(be.to>=ge)return e(s,i,d,B,z,$,Q);e(s,i.slice(0,be.to-te),d,B,null,$,Q),B=null,i=i.slice(be.to-te),te=be.to}}}function Wt(e,t,s,i){var d=!i&&s.widgetNode;d&&e.map.push(e.pos,e.pos+t,d),!i&&e.cm.display.input.needsContentAttribute&&(d||(d=e.content.appendChild(document.createElement("span"))),d.setAttribute("cm-marker",s.id)),d&&(e.cm.display.input.setUneditable(d),e.content.appendChild(d)),e.pos+=t,e.trailingSpace=!1}function _n(e,t,s){var i=e.markedSpans,d=e.text,B=0;if(!i){for(var z=1;z<s.length;z+=2)t.addToken(t,d.slice(B,B=s[z]),Bt(s[z+1],t.cm.options));return}for(var $=d.length,Q=0,te=1,ge="",be,ke,Re=0,We,$e,rt,ot,ft;;){if(Re==Q){We=$e=rt=ke="",ft=null,ot=null,Re=Infinity;for(var lt=[],gt=void 0,Tt=0;Tt<i.length;++Tt){var _t=i[Tt],Mt=_t.marker;if(Mt.type=="bookmark"&&_t.from==Q&&Mt.widgetNode)lt.push(Mt);else if(_t.from<=Q&&(_t.to==null||_t.to>Q||Mt.collapsed&&_t.to==Q&&_t.from==Q)){if(_t.to!=null&&_t.to!=Q&&Re>_t.to&&(Re=_t.to,$e=""),Mt.className&&(We+=" "+Mt.className),Mt.css&&(ke=(ke?ke+";":"")+Mt.css),Mt.startStyle&&_t.from==Q&&(rt+=" "+Mt.startStyle),Mt.endStyle&&_t.to==Re&&(gt||(gt=[])).push(Mt.endStyle,_t.to),Mt.title&&((ft||(ft={})).title=Mt.title),Mt.attributes)for(var tr in Mt.attributes)(ft||(ft={}))[tr]=Mt.attributes[tr];Mt.collapsed&&(!ot||pr(ot.marker,Mt)<0)&&(ot=_t)}else _t.from>Q&&Re>_t.from&&(Re=_t.from)}if(gt)for(var Cr=0;Cr<gt.length;Cr+=2)gt[Cr+1]==Re&&($e+=" "+gt[Cr]);if(!ot||ot.from==Q)for(var lr=0;lr<lt.length;++lr)Wt(t,0,lt[lr]);if(ot&&(ot.from||0)==Q){if(Wt(t,(ot.to==null?$+1:ot.to)-Q,ot.marker,ot.from==null),ot.to==null)return;ot.to==Q&&(ot=!1)}}if(Q>=$)break;for(var Jr=Math.min($,Re);;){if(ge){var Kr=Q+ge.length;if(!ot){var gr=Kr>Jr?ge.slice(0,Jr-Q):ge;t.addToken(t,gr,be?be+We:We,rt,Q+gr.length==Re?$e:"",ke,ft)}if(Kr>=Jr){ge=ge.slice(Jr-Q),Q=Jr;break}Q=Kr,rt=""}ge=d.slice(B,B=s[te++]),be=Bt(s[te++],t.cm.options)}}}function Xt(e,t,s){this.line=t,this.rest=bn(t),this.size=this.rest?Dt(Ee(this.rest))-s+1:1,this.node=this.text=null,this.hidden=dn(e,t)}function jr(e,t,s){for(var i=[],d,B=t;B<s;B=d){var z=new Xt(e.doc,mt(e.doc,B),B);d=B+z.size,i.push(z)}return i}var Pr=null;function tn(e){Pr?Pr.ops.push(e):e.ownsGroup=Pr={ops:[e],delayedCallbacks:[]}}function Io(e){var t=e.delayedCallbacks,s=0;do{for(;s<t.length;s++)t[s].call(null);for(var i=0;i<e.ops.length;i++){var d=e.ops[i];if(d.cursorActivityHandlers)for(;d.cursorActivityCalled<d.cursorActivityHandlers.length;)d.cursorActivityHandlers[d.cursorActivityCalled++].call(null,d.cm)}}while(s<t.length)}function Lo(e,t){var s=e.ownsGroup;if(!s)return;try{Io(s)}finally{Pr=null,t(s)}}var mi=null;function Ir(e,t){var s=vt(e,t);if(!s.length)return;var i=Array.prototype.slice.call(arguments,2),d;Pr?d=Pr.delayedCallbacks:mi?d=mi:(d=mi=[],setTimeout(ko,0));for(var B=function($){d.push(function(){return s[$].apply(null,i)})},z=0;z<s.length;++z)B(z)}function ko(){var e=mi;mi=null;for(var t=0;t<e.length;++t)e[t]()}function Xa(e,t,s,i){for(var d=0;d<t.changes.length;d++){var B=t.changes[d];B=="text"?Po(e,t):B=="gutter"?Ja(e,t,s,i):B=="class"?ha(e,t):B=="widget"&&Mo(e,t,i)}t.changes=null}function gi(e){return e.node==e.text&&(e.node=S("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),F&&W<8&&(e.node.style.zIndex=2)),e.node}function Do(e,t){var s=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(s&&(s+=" CodeMirror-linebackground"),t.background)s?t.background.className=s:(t.background.parentNode.removeChild(t.background),t.background=null);else if(s){var i=gi(t);t.background=i.insertBefore(S("div",null,s),i.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var s=e.display.externalMeasured;return s&&s.line==t.line?(e.display.externalMeasured=null,t.measure=s.measure,s.built):Vt(e,t)}function Po(e,t){var s=t.text.className,i=$a(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,ha(e,t)):s&&(t.text.className=s)}function ha(e,t){Do(e,t),t.line.wrapClass?gi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var s=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=s||""}function Ja(e,t,s,i){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var d=gi(t);t.gutterBackground=S("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),d.insertBefore(t.gutterBackground,t.text)}var B=t.line.gutterMarkers;if(e.options.lineNumbers||B){var z=gi(t),$=t.gutter=S("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable($),z.insertBefore($,t.text),t.line.gutterClass&&($.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!B||!B["CodeMirror-linenumbers"])&&(t.lineNumber=$.appendChild(S("div",Yr(e.options,s),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),B)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=e.display.gutterSpecs[Q].className,ge=B.hasOwnProperty(te)&&B[te];ge&&$.appendChild(S("div",[ge],"CodeMirror-gutter-elt","left: "+i.gutterLeft[te]+"px; width: "+i.gutterWidth[te]+"px"))}}}function Mo(e,t,s){t.alignable&&(t.alignable=null);for(var i=I("CodeMirror-linewidget"),d=t.node.firstChild,B=void 0;d;d=B)B=d.nextSibling,i.test(d.className)&&t.node.removeChild(d);Za(e,t,s)}function No(e,t,s,i){var d=$a(e,t);return t.text=t.node=d.pre,d.bgClass&&(t.bgClass=d.bgClass),d.textClass&&(t.textClass=d.textClass),ha(e,t),Ja(e,t,s,i),Za(e,t,i),t.node}function Za(e,t,s){if(Qa(e,t.line,t,s,!0),t.rest)for(var i=0;i<t.rest.length;i++)Qa(e,t.rest[i],t,s,!1)}function Qa(e,t,s,i,d){if(!t.widgets)return;for(var B=gi(s),z=0,$=t.widgets;z<$.length;++z){var Q=$[z],te=S("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||te.setAttribute("cm-ignore-events","true"),Fo(Q,te,s,i),e.display.input.setUneditable(te),d&&Q.above?B.insertBefore(te,s.gutter||s.text):B.appendChild(te),Ir(Q,"redraw")}}function Fo(e,t,s,i){if(e.noHScroll){(s.alignable||(s.alignable=[])).push(t);var d=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(d-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=d+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function vi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!o(document.body,e.node)){var s="position: relative;";e.coverGutter&&(s+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(s+="width: "+t.display.wrapper.clientWidth+"px;"),P(t.display.measure,S("div",[e.node],null,s))}return e.height=e.node.parentNode.offsetHeight}function En(e,t){for(var s=we(t);s!=e.wrapper;s=s.parentNode)if(!s||s.nodeType==1&&s.getAttribute("cm-ignore-events")=="true"||s.parentNode==e.sizer&&s!=e.mover)return!0}function ji(e){return e.lineSpace.offsetTop}function da(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=P(e.measure,S("pre","x","CodeMirror-line-like")),s=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(s.paddingLeft),right:parseInt(s.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function cn(e){return Y-e.display.nativeBarWidth}function Nn(e){return e.display.scroller.clientWidth-cn(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-cn(e)-e.display.barHeight}function Uo(e,t,s){var i=e.options.lineWrapping,d=i&&Nn(e);if(!t.measure.heights||i&&t.measure.width!=d){var B=t.measure.heights=[];if(i){t.measure.width=d;for(var z=t.text.firstChild.getClientRects(),$=0;$<z.length-1;$++){var Q=z[$],te=z[$+1];Math.abs(Q.bottom-te.bottom)>2&&B.push((Q.bottom+te.top)/2-s.top)}}B.push(s.bottom-s.top)}}function es(e,t,s){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var d=0;d<e.rest.length;d++)if(Dt(e.rest[d])>s)return{map:e.measure.maps[d],cache:e.measure.caches[d],before:!0}}function Bo(e,t){t=Dr(t);var s=Dt(t),i=e.display.externalMeasured=new Xt(e.doc,t,s);i.lineN=s;var d=i.built=Vt(e,i);return i.text=d.pre,P(e.display.lineMeasure,d.pre),i}function ts(e,t,s,i){return fn(e,Jn(e,t),s,i)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Bn(e,t)];var s=e.display.externalMeasured;if(s&&t>=s.lineN&&t<s.lineN+s.size)return s}function Jn(e,t){var s=Dt(t),i=fa(e,s);i&&!i.text?i=null:i&&i.changes&&(Xa(e,i,s,ba(e)),e.curOp.forceUpdate=!0),i||(i=Bo(e,t));var d=es(i,t,s);return{line:t,view:i,rect:null,map:d.map,cache:d.cache,before:d.before,hasHeights:!1}}function fn(e,t,s,i,d){t.before&&(s=-1);var B=s+(i||""),z;return t.cache.hasOwnProperty(B)?z=t.cache[B]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Uo(e,t.view,t.rect),t.hasHeights=!0),z=jo(e,t,s,i),z.bogus||(t.cache[B]=z)),{left:z.left,right:z.right,top:d?z.rtop:z.top,bottom:d?z.rbottom:z.bottom}}var rs={left:0,right:0,top:0,bottom:0};function ns(e,t,s){for(var i,d,B,z,$,Q,te=0;te<e.length;te+=3)if($=e[te],Q=e[te+1],t<$?(d=0,B=1,z="left"):t<Q?(d=t-$,B=d+1):(te==e.length-3||t==Q&&e[te+3]>t)&&(B=Q-$,d=B-1,t>=Q&&(z="right")),d!=null){if(i=e[te+2],$==Q&&s==(i.insertLeft?"left":"right")&&(z=s),s=="left"&&d==0)for(;te&&e[te-2]==e[te-3]&&e[te-1].insertLeft;)i=e[(te-=3)+2],z="left";if(s=="right"&&d==Q-$)for(;te<e.length-3&&e[te+3]==e[te+4]&&!e[te+5].insertLeft;)i=e[(te+=3)+2],z="right";break}return{node:i,start:d,end:B,collapse:z,coverStart:$,coverEnd:Q}}function Ho(e,t){var s=rs;if(t=="left")for(var i=0;i<e.length&&!((s=e[i]).left!=s.right);i++);else for(var d=e.length-1;d>=0&&!((s=e[d]).left!=s.right);d--);return s}function jo(e,t,s,i){var d=ns(t.map,s,i),B=d.node,z=d.start,$=d.end,Q=d.collapse,te;if(B.nodeType==3){for(var ge=0;ge<4;ge++){for(;z&&Ie(t.line.text.charAt(d.coverStart+z));)--z;for(;d.coverStart+$<d.coverEnd&&Ie(t.line.text.charAt(d.coverStart+$));)++$;if(F&&W<9&&z==0&&$==d.coverEnd-d.coverStart?te=B.parentNode.getBoundingClientRect():te=Ho(c(B,z,$).getClientRects(),i),te.left||te.right||z==0)break;$=z,z=z-1,Q="right"}F&&W<11&&(te=Wo(e.display.measure,te))}else{z>0&&(Q=i="right");var be;e.options.lineWrapping&&(be=B.getClientRects()).length>1?te=be[i=="right"?be.length-1:0]:te=B.getBoundingClientRect()}if(F&&W<9&&!z&&(!te||!te.left&&!te.right)){var ke=B.parentNode.getClientRects()[0];ke?te={left:ke.left,right:ke.left+Qn(e.display),top:ke.top,bottom:ke.bottom}:te=rs}for(var Re=te.top-t.rect.top,We=te.bottom-t.rect.top,$e=(Re+We)/2,rt=t.view.measure.heights,ot=0;ot<rt.length-1&&!($e<rt[ot]);ot++);var ft=ot?rt[ot-1]:0,lt=rt[ot],gt={left:(Q=="right"?te.right:te.left)-t.rect.left,right:(Q=="left"?te.left:te.right)-t.rect.left,top:ft,bottom:lt};return!te.left&&!te.right&&(gt.bogus=!0),e.options.singleCursorHeightPerLine||(gt.rtop=Re,gt.rbottom=We),gt}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!wt(e))return t;var s=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*s,right:t.right*s,top:t.top*i,bottom:t.bottom*i}}function is(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function as(e){e.display.externalMeasure=null,A(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)is(e.display.view[t])}function yi(e){as(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ss(){return D&&b?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return D&&b?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var s=0;s<e.widgets.length;++s)e.widgets[s].above&&(t+=vi(e.widgets[s]));return t}function Wi(e,t,s,i,d){if(!d){var B=pa(t);s.top+=B,s.bottom+=B}if(i=="line")return s;i||(i="local");var z=nn(t);if(i=="local"?z+=ji(e.display):z-=e.display.viewOffset,i=="page"||i=="window"){var $=e.display.lineSpace.getBoundingClientRect();z+=$.top+(i=="window"?0:os());var Q=$.left+(i=="window"?0:ss());s.left+=Q,s.right+=Q}return s.top+=z,s.bottom+=z,s}function ls(e,t,s){if(s=="div")return t;var i=t.left,d=t.top;if(s=="page")i-=ss(),d-=os();else if(s=="local"||!s){var B=e.display.sizer.getBoundingClientRect();i+=B.left,d+=B.top}var z=e.display.lineSpace.getBoundingClientRect();return{left:i-z.left,top:d-z.top}}function ma(e,t,s,i,d){return i||(i=mt(e.doc,t.line)),Wi(e,i,ts(e,i,t.ch,d),s)}function an(e,t,s,i,d,B){i=i||mt(e.doc,t.line),d||(d=Jn(e,i));function z(We,$e){var rt=fn(e,d,We,$e?"right":"left",B);return $e?rt.left=rt.right:rt.right=rt.left,Wi(e,i,rt,s)}var $=Qe(i,e.doc.direction),Q=t.ch,te=t.sticky;if(Q>=i.text.length?(Q=i.text.length,te="before"):Q<=0&&(Q=0,te="after"),!$)return z(te=="before"?Q-1:Q,te=="before");function ge(We,$e,rt){var ot=$[$e],ft=ot.level==1;return z(rt?We-1:We,ft!=rt)}var be=Ze($,Q,te),ke=Ye,Re=ge(Q,be,te=="before");return ke!=null&&(Re.other=ge(Q,ke,te!="before")),Re}function us(e,t){var s=0;t=St(e.doc,t),e.options.lineWrapping||(s=Qn(e.display)*t.ch);var i=mt(e.doc,t.line),d=nn(i)+ji(e.display);return{left:s,right:s,top:d,bottom:d+i.height}}function ga(e,t,s,i,d){var B=Je(e,t,s);return B.xRel=d,i&&(B.outside=i),B}function va(e,t,s){var i=e.doc;if(s+=e.display.viewOffset,s<0)return ga(i.first,0,null,-1,-1);var d=dr(i,s),B=i.first+i.size-1;if(d>B)return ga(i.first+i.size-1,mt(i,B).text.length,null,1,1);t<0&&(t=0);for(var z=mt(i,d);;){var $=Go(e,z,d,t,s),Q=Or(z,$.ch+($.xRel>0||$.outside>0?1:0));if(!Q)return $;var te=Q.find(1);if(te.line==d)return te;z=mt(i,d=te.line)}}function hs(e,t,s,i){i-=pa(t);var d=t.text.length,B=Be(function(z){return fn(e,s,z-1).bottom<=i},d,0);return d=Be(function(z){return fn(e,s,z).top>i},B,d),{begin:B,end:d}}function ds(e,t,s,i){s||(s=Jn(e,t));var d=Wi(e,t,fn(e,s,i),"line").top;return hs(e,t,s,d)}function ya(e,t,s,i){return e.bottom<=s?!1:e.top>s?!0:(i?e.left:e.right)>t}function Go(e,t,s,i,d){d-=nn(t);var B=Jn(e,t),z=pa(t),$=0,Q=t.text.length,te=!0,ge=Qe(t,e.doc.direction);if(ge){var be=(e.options.lineWrapping?zo:Ko)(e,t,s,B,ge,i,d);te=be.level!=1,$=te?be.from:be.to-1,Q=te?be.to:be.from-1}var ke=null,Re=null,We=Be(function(Tt){var _t=fn(e,B,Tt);return _t.top+=z,_t.bottom+=z,ya(_t,i,d,!1)?(_t.top<=d&&_t.left<=i&&(ke=Tt,Re=_t),!0):!1},$,Q),$e,rt,ot=!1;if(Re){var ft=i-Re.left<Re.right-i,lt=ft==te;We=ke+(lt?0:1),rt=lt?"after":"before",$e=ft?Re.left:Re.right}else{!te&&(We==Q||We==$)&&We++,rt=We==0?"after":We==t.text.length?"before":fn(e,B,We-(te?1:0)).bottom+z<=d==te?"after":"before";var gt=an(e,Je(s,We,rt),"line",t,B);$e=gt.left,ot=d<gt.top?-1:d>=gt.bottom?1:0}return We=De(t.text,We,1),ga(s,We,rt,ot,i-$e)}function Ko(e,t,s,i,d,B,z){var $=Be(function(be){var ke=d[be],Re=ke.level!=1;return ya(an(e,Je(s,Re?ke.to:ke.from,Re?"before":"after"),"line",t,i),B,z,!0)},0,d.length-1),Q=d[$];if($>0){var te=Q.level!=1,ge=an(e,Je(s,te?Q.from:Q.to,te?"after":"before"),"line",t,i);ya(ge,B,z,!0)&&ge.top>z&&(Q=d[$-1])}return Q}function zo(e,t,s,i,d,B,z){var $=hs(e,t,i,z),Q=$.begin,te=$.end;/\s/.test(t.text.charAt(te-1))&&te--;for(var ge=null,be=null,ke=0;ke<d.length;ke++){var Re=d[ke];if(Re.from>=te||Re.to<=Q)continue;var We=Re.level!=1,$e=fn(e,i,We?Math.min(te,Re.to)-1:Math.max(Q,Re.from)).right,rt=$e<B?B-$e+1e9:$e-B;(!ge||be>rt)&&(ge=Re,be=rt)}return ge||(ge=d[d.length-1]),ge.from<Q&&(ge={from:Q,to:ge.to,level:ge.level}),ge.to>te&&(ge={from:ge.from,to:te,level:ge.level}),ge}var Fn;function Zn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Fn==null){Fn=S("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Fn.appendChild(document.createTextNode("x")),Fn.appendChild(S("br"));Fn.appendChild(document.createTextNode("x"))}P(e.measure,Fn);var s=Fn.offsetHeight/50;return s>3&&(e.cachedTextHeight=s),A(e.measure),s||1}function Qn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=S("span","xxxxxxxxxx"),s=S("pre",[t],"CodeMirror-line-like");P(e.measure,s);var i=t.getBoundingClientRect(),d=(i.right-i.left)/10;return d>2&&(e.cachedCharWidth=d),d||10}function ba(e){for(var t=e.display,s={},i={},d=t.gutters.clientLeft,B=t.gutters.firstChild,z=0;B;B=B.nextSibling,++z){var $=e.display.gutterSpecs[z].className;s[$]=B.offsetLeft+B.clientLeft+d,i[$]=B.clientWidth}return{fixedPos:_a(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:s,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function _a(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cs(e){var t=Zn(e.display),s=e.options.lineWrapping,i=s&&Math.max(5,e.display.scroller.clientWidth/Qn(e.display)-3);return function(d){if(dn(e.doc,d))return 0;var B=0;if(d.widgets)for(var z=0;z<d.widgets.length;z++)d.widgets[z].height&&(B+=d.widgets[z].height);return s?B+(Math.ceil(d.text.length/i)||1)*t:B+t}}function Ea(e){var t=e.doc,s=cs(e);t.iter(function(i){var d=s(i);d!=i.height&&Jt(i,d)})}function Un(e,t,s,i){var d=e.display;if(!s&&we(t).getAttribute("cm-not-content")=="true")return null;var B,z,$=d.lineSpace.getBoundingClientRect();try{B=t.clientX-$.left,z=t.clientY-$.top}catch(be){return null}var Q=va(e,B,z),te;if(i&&Q.xRel>0&&(te=mt(e.doc,Q.line).text).length==Q.ch){var ge=N(te,te.length,e.options.tabSize)-te.length;Q=Je(Q.line,Math.max(0,Math.round((B-qa(e.display).left)/Qn(e.display))-ge))}return Q}function Bn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var s=e.display.view,i=0;i<s.length;i++)if(t-=s[i].size,t<0)return i}function Wr(e,t,s,i){t==null&&(t=e.doc.first),s==null&&(s=e.doc.first+e.doc.size),i||(i=0);var d=e.display;if(i&&s<d.viewTo&&(d.updateLineNumbers==null||d.updateLineNumbers>t)&&(d.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=d.viewTo)or&&Pn(e.doc,t)<d.viewTo&&Cn(e);else if(s<=d.viewFrom)or&&hn(e.doc,s+i)>d.viewFrom?Cn(e):(d.viewFrom+=i,d.viewTo+=i);else if(t<=d.viewFrom&&s>=d.viewTo)Cn(e);else if(t<=d.viewFrom){var B=Gi(e,s,s+i,1);B?(d.view=d.view.slice(B.index),d.viewFrom=B.lineN,d.viewTo+=i):Cn(e)}else if(s>=d.viewTo){var z=Gi(e,t,t,-1);z?(d.view=d.view.slice(0,z.index),d.viewTo=z.lineN):Cn(e)}else{var $=Gi(e,t,t,-1),Q=Gi(e,s,s+i,1);$&&Q?(d.view=d.view.slice(0,$.index).concat(jr(e,$.lineN,Q.lineN)).concat(d.view.slice(Q.index)),d.viewTo+=i):Cn(e)}var te=d.externalMeasured;te&&(s<te.lineN?te.lineN+=i:t<te.lineN+te.size&&(d.externalMeasured=null))}function Sn(e,t,s){e.curOp.viewChanged=!0;var i=e.display,d=e.display.externalMeasured;if(d&&t>=d.lineN&&t<d.lineN+d.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo)return;var B=i.view[Bn(e,t)];if(B.node==null)return;var z=B.changes||(B.changes=[]);j(z,s)==-1&&z.push(s)}function Cn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gi(e,t,s,i){var d=Bn(e,t),B,z=e.display.view;if(!or||s==e.doc.first+e.doc.size)return{index:d,lineN:s};for(var $=e.display.viewFrom,Q=0;Q<d;Q++)$+=z[Q].size;if($!=t){if(i>0){if(d==z.length-1)return null;B=$+z[d].size-t,d++}else B=$-t;t+=B,s+=B}for(;Pn(e.doc,s)!=s;){if(d==(i<0?0:z.length-1))return null;s+=i*z[d-(i<0?1:0)].size,d+=i}return{index:d,lineN:s}}function Vo(e,t,s){var i=e.display,d=i.view;d.length==0||t>=i.viewTo||s<=i.viewFrom?(i.view=jr(e,t,s),i.viewFrom=t):(i.viewFrom>t?i.view=jr(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(Bn(e,t))),i.viewFrom=t,i.viewTo<s?i.view=i.view.concat(jr(e,i.viewTo,s)):i.viewTo>s&&(i.view=i.view.slice(0,Bn(e,s)))),i.viewTo=s}function fs(e){for(var t=e.display.view,s=0,i=0;i<t.length;i++){var d=t[i];!d.hidden&&(!d.node||d.changes)&&++s}return s}function bi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var s=e.doc,i={},d=i.cursors=document.createDocumentFragment(),B=i.selection=document.createDocumentFragment(),z=0;z<s.sel.ranges.length;z++){if(!t&&z==s.sel.primIndex)continue;var $=s.sel.ranges[z];if($.from().line>=e.display.viewTo||$.to().line<e.display.viewFrom)continue;var Q=$.empty();(Q||e.options.showCursorWhenSelecting)&&ms(e,$.head,d),Q||Yo(e,$,B)}return i}function ms(e,t,s){var i=an(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),d=s.appendChild(S("div","\xA0","CodeMirror-cursor"));if(d.style.left=i.left+"px",d.style.top=i.top+"px",d.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var B=s.appendChild(S("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));B.style.display="",B.style.left=i.other.left+"px",B.style.top=i.other.top+"px",B.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function Ki(e,t){return e.top-t.top||e.left-t.left}function Yo(e,t,s){var i=e.display,d=e.doc,B=document.createDocumentFragment(),z=qa(e.display),$=z.left,Q=Math.max(i.sizerWidth,Nn(e)-i.sizer.offsetLeft)-z.right,te=d.direction=="ltr";function ge(lt,gt,Tt,_t){gt<0&&(gt=0),gt=Math.round(gt),_t=Math.round(_t),B.appendChild(S("div",null,"CodeMirror-selected","position: absolute; left: "+lt+`px;
|
|
top: `+gt+"px; width: "+(Tt==null?Q-lt:Tt)+`px;
|
|
height: `+(_t-gt)+"px"))}function be(lt,gt,Tt){var _t=mt(d,lt),Mt=_t.text.length,tr,Cr;function lr(gr,zr){return ma(e,Je(lt,gr),"div",_t,zr)}function Jr(gr,zr,Lr){var Er=ds(e,_t,null,gr),vr=zr=="ltr"==(Lr=="after")?"left":"right",hr=Lr=="after"?Er.begin:Er.end-(/\s/.test(_t.text.charAt(Er.end-1))?2:1);return lr(hr,vr)[vr]}var Kr=Qe(_t,d.direction);return ze(Kr,gt||0,Tt==null?Mt:Tt,function(gr,zr,Lr,Er){var vr=Lr=="ltr",hr=lr(gr,vr?"left":"right"),Vr=lr(zr-1,vr?"right":"left"),di=gt==null&&gr==0,kn=Tt==null&&zr==Mt,Nr=Er==0,pn=!Kr||Er==Kr.length-1;if(Vr.top-hr.top<=3){var Ar=(te?di:kn)&&Nr,Va=(te?kn:di)&&pn,wn=Ar?$:(vr?hr:Vr).left,Kn=Va?Q:(vr?Vr:hr).right;ge(wn,hr.top,Kn-wn,hr.bottom)}else{var zn,Br,ci,Ya;vr?(zn=te&&di&&Nr?$:hr.left,Br=te?Q:Jr(gr,Lr,"before"),ci=te?$:Jr(zr,Lr,"after"),Ya=te&&kn&&pn?Q:Vr.right):(zn=te?Jr(gr,Lr,"before"):$,Br=!te&&di&&Nr?Q:hr.right,ci=!te&&kn&&pn?$:Vr.left,Ya=te?Jr(zr,Lr,"after"):Q),ge(zn,hr.top,Br-zn,hr.bottom),hr.bottom<Vr.top&&ge($,hr.bottom,null,Vr.top),ge(ci,Vr.top,Ya-ci,Vr.bottom)}(!tr||Ki(hr,tr)<0)&&(tr=hr),Ki(Vr,tr)<0&&(tr=Vr),(!Cr||Ki(hr,Cr)<0)&&(Cr=hr),Ki(Vr,Cr)<0&&(Cr=Vr)}),{start:tr,end:Cr}}var ke=t.from(),Re=t.to();if(ke.line==Re.line)be(ke.line,ke.ch,Re.ch);else{var We=mt(d,ke.line),$e=mt(d,Re.line),rt=Dr(We)==Dr($e),ot=be(ke.line,ke.ch,rt?We.text.length+1:null).end,ft=be(Re.line,rt?0:null,Re.ch).start;rt&&(ot.top<ft.top-2?(ge(ot.right,ot.top,null,ot.bottom),ge($,ft.top,ft.left,ft.bottom)):ge(ot.right,ot.top,ft.left-ot.right,ot.bottom)),ot.bottom<ft.top&&ge($,ot.bottom,null,ft.top)}s.appendChild(B)}function xa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var s=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||qn(e),t.cursorDiv.style.visibility=(s=!s)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function gs(e){e.state.focused||(e.display.input.focus(),wa(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,qn(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ue(e,"focus",e,t),e.state.focused=!0,l(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),r&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function qn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ue(e,"blur",e,t),e.state.focused=!1,k(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function zi(e){for(var t=e.display,s=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var d=t.view[i],B=e.options.lineWrapping,z=void 0,$=0;if(d.hidden)continue;if(F&&W<8){var Q=d.node.offsetTop+d.node.offsetHeight;z=Q-s,s=Q}else{var te=d.node.getBoundingClientRect();z=te.bottom-te.top,!B&&d.text.firstChild&&($=d.text.firstChild.getBoundingClientRect().right-te.left-1)}var ge=d.line.height-z;if((ge>.005||ge<-.005)&&(Jt(d.line,z),ys(d.line),d.rest))for(var be=0;be<d.rest.length;be++)ys(d.rest[be]);if($>e.display.sizerWidth){var ke=Math.ceil($/Qn(e.display));ke>e.display.maxLineLength&&(e.display.maxLineLength=ke,e.display.maxLine=d.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var s=e.widgets[t],i=s.node.parentNode;i&&(s.height=i.offsetHeight)}}function Vi(e,t,s){var i=s&&s.top!=null?Math.max(0,s.top):e.scroller.scrollTop;i=Math.floor(i-ji(e));var d=s&&s.bottom!=null?s.bottom:i+e.wrapper.clientHeight,B=dr(t,i),z=dr(t,d);if(s&&s.ensure){var $=s.ensure.from.line,Q=s.ensure.to.line;$<B?(B=$,z=dr(t,nn(mt(t,$))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=z&&(B=dr(t,nn(mt(t,Q))-e.wrapper.clientHeight),z=Q)}return{from:B,to:Math.max(z,B+1)}}function Xo(e,t){if(Ve(e,"scrollCursorIntoView"))return;var s=e.display,i=s.sizer.getBoundingClientRect(),d=null;if(t.top+i.top<0?d=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(d=!1),d!=null&&!u){var B=S("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-s.viewOffset-ji(e.display))+`px;
|
|
height: `+(t.bottom-t.top+cn(e)+s.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(B),B.scrollIntoView(d),e.display.lineSpace.removeChild(B)}}function $o(e,t,s,i){i==null&&(i=0);var d;!e.options.lineWrapping&&t==s&&(t=t.ch?Je(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,s=t.sticky=="before"?Je(t.line,t.ch+1,"before"):t);for(var B=0;B<5;B++){var z=!1,$=an(e,t),Q=!s||s==t?$:an(e,s);d={left:Math.min($.left,Q.left),top:Math.min($.top,Q.top)-i,right:Math.max($.left,Q.left),bottom:Math.max($.bottom,Q.bottom)+i};var te=Ta(e,d),ge=e.doc.scrollTop,be=e.doc.scrollLeft;if(te.scrollTop!=null&&(Ei(e,te.scrollTop),Math.abs(e.doc.scrollTop-ge)>1&&(z=!0)),te.scrollLeft!=null&&(Hn(e,te.scrollLeft),Math.abs(e.doc.scrollLeft-be)>1&&(z=!0)),!z)break}return d}function Jo(e,t){var s=Ta(e,t);s.scrollTop!=null&&Ei(e,s.scrollTop),s.scrollLeft!=null&&Hn(e,s.scrollLeft)}function Ta(e,t){var s=e.display,i=Zn(e.display);t.top<0&&(t.top=0);var d=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:s.scroller.scrollTop,B=ca(e),z={};t.bottom-t.top>B&&(t.bottom=t.top+B);var $=e.doc.height+da(s),Q=t.top<i,te=t.bottom>$-i;if(t.top<d)z.scrollTop=Q?0:t.top;else if(t.bottom>d+B){var ge=Math.min(t.top,(te?$:t.bottom)-B);ge!=d&&(z.scrollTop=ge)}var be=e.options.fixedGutter?0:s.gutters.offsetWidth,ke=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:s.scroller.scrollLeft-be,Re=Nn(e)-s.gutters.offsetWidth,We=t.right-t.left>Re;return We&&(t.right=t.left+Re),t.left<10?z.scrollLeft=0:t.left<ke?z.scrollLeft=Math.max(0,t.left+be-(We?0:10)):t.right>Re+ke-3&&(z.scrollLeft=t.right+(We?0:10)-Re),z}function Sa(e,t){if(t==null)return;Yi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ei(e){Yi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function _i(e,t,s){(t!=null||s!=null)&&Yi(e),t!=null&&(e.curOp.scrollLeft=t),s!=null&&(e.curOp.scrollTop=s)}function Zo(e,t){Yi(e),e.curOp.scrollToPos=t}function Yi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var s=us(e,t.from),i=us(e,t.to);bs(e,s,i,t.margin)}}function bs(e,t,s,i){var d=Ta(e,{left:Math.min(t.left,s.left),top:Math.min(t.top,s.top)-i,right:Math.max(t.right,s.right),bottom:Math.max(t.bottom,s.bottom)+i});_i(e,d.scrollLeft,d.scrollTop)}function Ei(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;ce||Aa(e,{top:t}),_s(e,t,!0),ce&&Aa(e),Ti(e,100)}function _s(e,t,s){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!s)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Hn(e,t,s,i){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(s?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function xi(e){var t=e.display,s=t.gutters.offsetWidth,i=Math.round(e.doc.height+da(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?s:0,docHeight:i,scrollHeight:i+cn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:s}}var jn=function(e,t,s){this.cm=s;var i=this.vert=S("div",[S("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),d=this.horiz=S("div",[S("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=d.tabIndex=-1,e(i),e(d),Ne(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Ne(d,"scroll",function(){d.clientWidth&&t(d.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,F&&W<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};jn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,s=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(s){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var d=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+d)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=s?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var B=e.viewWidth-e.barLeft-(s?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+B)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(i==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:s?i:0,bottom:t?i:0}},jn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},jn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},jn.prototype.zeroWidthHack=function(){var e=_&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new U,this.disableVert=new U},jn.prototype.enableZeroWidthBar=function(e,t,s){e.style.pointerEvents="auto";function i(){var d=e.getBoundingClientRect(),B=s=="vert"?document.elementFromPoint(d.right-1,(d.top+d.bottom)/2):document.elementFromPoint((d.right+d.left)/2,d.bottom-1);B!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},jn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var wi=function(){};wi.prototype.update=function(){return{bottom:0,right:0}},wi.prototype.setScrollLeft=function(){},wi.prototype.setScrollTop=function(){},wi.prototype.clear=function(){};function ti(e,t){t||(t=xi(e));var s=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var d=0;d<4&&s!=e.display.barWidth||i!=e.display.barHeight;d++)s!=e.display.barWidth&&e.options.lineWrapping&&zi(e),Es(e,xi(e)),s=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var s=e.display,i=s.scrollbars.update(t);s.sizer.style.paddingRight=(s.barWidth=i.right)+"px",s.sizer.style.paddingBottom=(s.barHeight=i.bottom)+"px",s.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(s.scrollbarFiller.style.display="block",s.scrollbarFiller.style.height=i.bottom+"px",s.scrollbarFiller.style.width=i.right+"px"):s.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(s.gutterFiller.style.display="block",s.gutterFiller.style.height=i.bottom+"px",s.gutterFiller.style.width=t.gutterWidth+"px"):s.gutterFiller.style.display=""}var xs={native:jn,null:wi};function ws(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&k(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ne(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,s){s=="horizontal"?Hn(e,t):Ei(e,t)},e),e.display.scrollbars.addClass&&l(e.display.wrapper,e.display.scrollbars.addClass)}var Qo=0;function Wn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qo},tn(e.curOp)}function Gn(e){var t=e.curOp;t&&Lo(t,function(s){for(var i=0;i<s.ops.length;i++)s.ops[i].cm.curOp=null;qo(s)})}function qo(e){for(var t=e.ops,s=0;s<t.length;s++)el(t[s]);for(var i=0;i<t.length;i++)tl(t[i]);for(var d=0;d<t.length;d++)rl(t[d]);for(var B=0;B<t.length;B++)nl(t[B]);for(var z=0;z<t.length;z++)il(t[z])}function el(e){var t=e.cm,s=t.display;sl(t),e.updateMaxLine&&Hi(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<s.viewFrom||e.scrollToPos.to.line>=s.viewTo)||s.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Xi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function rl(e){var t=e.cm,s=t.display;e.updatedDisplay&&zi(t),e.barMeasure=xi(t),s.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(t,s.maxLine,s.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(s.scroller.clientWidth,s.sizer.offsetLeft+e.adjustWidthTo+cn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,s.sizer.offsetLeft+e.adjustWidthTo-Nn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=s.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Hn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var s=e.focus&&e.focus==v();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,s),(e.updatedDisplay||e.startHeight!=t.doc.height)&&ti(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),s&&gs(e.cm)}function il(e){var t=e.cm,s=t.display,i=t.doc;if(e.updatedDisplay&&Ts(t,e.update),s.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(s.wheelStartX=s.wheelStartY=null),e.scrollTop!=null&&_s(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Hn(t,e.scrollLeft,!0,!0),e.scrollToPos){var d=$o(t,St(i,e.scrollToPos.from),St(i,e.scrollToPos.to),e.scrollToPos.margin);Xo(t,d)}var B=e.maybeHiddenMarkers,z=e.maybeUnhiddenMarkers;if(B)for(var $=0;$<B.length;++$)B[$].lines.length||Ue(B[$],"hide");if(z)for(var Q=0;Q<z.length;++Q)z[Q].lines.length&&Ue(z[Q],"unhide");s.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ue(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function $r(e,t){if(e.curOp)return t();Wn(e);try{return t()}finally{Gn(e)}}function Tr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Wn(e);try{return t.apply(e,arguments)}finally{Gn(e)}}}function Ur(e){return function(){if(this.curOp)return e.apply(this,arguments);Wn(this);try{return e.apply(this,arguments)}finally{Gn(this)}}}function Sr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Wn(t);try{return e.apply(this,arguments)}finally{Gn(t)}}}function Ti(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,h(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var s=+new Date+e.options.workTime,i=pe(e,t.highlightFrontier),d=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(B){if(i.line>=e.display.viewFrom){var z=B.styles,$=B.text.length>e.options.maxHighlightLength?Lt(t.mode,i.state):null,Q=q(e,B,i,!0);$&&(i.state=$),B.styles=Q.styles;var te=B.styleClasses,ge=Q.classes;ge?B.styleClasses=ge:te&&(B.styleClasses=null);for(var be=!z||z.length!=B.styles.length||te!=ge&&(!te||!ge||te.bgClass!=ge.bgClass||te.textClass!=ge.textClass),ke=0;!be&&ke<z.length;++ke)be=z[ke]!=B.styles[ke];be&&d.push(i.line),B.stateAfter=i.save(),i.nextLine()}else B.text.length<=e.options.maxHighlightLength&&Pe(e,B.text,i),B.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>s)return Ti(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),d.length&&$r(e,function(){for(var B=0;B<d.length;B++)Sn(e,d[B],"text")})}var Xi=function(e,t,s){var i=e.display;this.viewport=t,this.visible=Vi(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Nn(e),this.force=s,this.dims=ba(e),this.events=[]};Xi.prototype.signal=function(e,t){_e(e,t)&&this.events.push(arguments)},Xi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ue.apply(null,this.events[e])};function sl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=cn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=cn(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=v();if(!t||!o(e.display.lineDiv,t))return null;var s={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&o(e.display.lineDiv,i.anchorNode)&&(s.anchorNode=i.anchorNode,s.anchorOffset=i.anchorOffset,s.focusNode=i.focusNode,s.focusOffset=i.focusOffset)}return s}function ll(e){if(!e||!e.activeElt||e.activeElt==v())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&o(document.body,e.anchorNode)&&o(document.body,e.focusNode)){var t=window.getSelection(),s=document.createRange();s.setEnd(e.anchorNode,e.anchorOffset),s.collapse(!1),t.removeAllRanges(),t.addRange(s),t.extend(e.focusNode,e.focusOffset)}}function Ca(e,t){var s=e.display,i=e.doc;if(t.editorIsHidden)return Cn(e),!1;if(!t.force&&t.visible.from>=s.viewFrom&&t.visible.to<=s.viewTo&&(s.updateLineNumbers==null||s.updateLineNumbers>=s.viewTo)&&s.renderedView==s.view&&fs(e)==0)return!1;Cs(e)&&(Cn(e),t.dims=ba(e));var d=i.first+i.size,B=Math.max(t.visible.from-e.options.viewportMargin,i.first),z=Math.min(d,t.visible.to+e.options.viewportMargin);s.viewFrom<B&&B-s.viewFrom<20&&(B=Math.max(i.first,s.viewFrom)),s.viewTo>z&&s.viewTo-z<20&&(z=Math.min(d,s.viewTo)),or&&(B=Pn(e.doc,B),z=hn(e.doc,z));var $=B!=s.viewFrom||z!=s.viewTo||s.lastWrapHeight!=t.wrapperHeight||s.lastWrapWidth!=t.wrapperWidth;Vo(e,B,z),s.viewOffset=nn(mt(e.doc,s.viewFrom)),e.display.mover.style.top=s.viewOffset+"px";var Q=fs(e);if(!$&&Q==0&&!t.force&&s.renderedView==s.view&&(s.updateLineNumbers==null||s.updateLineNumbers>=s.viewTo))return!1;var te=ol(e);return Q>4&&(s.lineDiv.style.display="none"),ul(e,s.updateLineNumbers,t.dims),Q>4&&(s.lineDiv.style.display=""),s.renderedView=s.view,ll(te),A(s.cursorDiv),A(s.selectionDiv),s.gutters.style.height=s.sizer.style.minHeight=0,$&&(s.lastWrapHeight=t.wrapperHeight,s.lastWrapWidth=t.wrapperWidth,Ti(e,400)),s.updateLineNumbers=null,!0}function Ts(e,t){for(var s=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Nn(e)){if(s&&s.top!=null&&(s={top:Math.min(e.doc.height+da(e.display)-ca(e),s.top)}),t.visible=Vi(e.display,e.doc,s),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Vi(e.display,e.doc,s));if(!Ca(e,t))break;zi(e);var d=xi(e);bi(e),ti(e,d),Oa(e,d),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var s=new Xi(e,t);if(Ca(e,s)){zi(e),Ts(e,s);var i=xi(e);bi(e),ti(e,i),Oa(e,i),s.finish()}}function ul(e,t,s){var i=e.display,d=e.options.lineNumbers,B=i.lineDiv,z=B.firstChild;function $(We){var $e=We.nextSibling;return r&&_&&e.display.currentWheelTarget==We?We.style.display="none":We.parentNode.removeChild(We),$e}for(var Q=i.view,te=i.viewFrom,ge=0;ge<Q.length;ge++){var be=Q[ge];if(!be.hidden)if(!be.node||be.node.parentNode!=B){var ke=No(e,be,te,s);B.insertBefore(ke,z)}else{for(;z!=be.node;)z=$(z);var Re=d&&t!=null&&t<=te&&be.lineNumber;be.changes&&(j(be.changes,"gutter")>-1&&(Re=!1),Xa(e,be,te,s)),Re&&(A(be.lineNumber),be.lineNumber.appendChild(document.createTextNode(Yr(e.options,te)))),z=be.node.nextSibling}te+=be.size}for(;z;)z=$(z)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+cn(e)+"px"}function Ss(e){var t=e.display,s=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=_a(t)-t.scroller.scrollLeft+e.doc.scrollLeft,d=t.gutters.offsetWidth,B=i+"px",z=0;z<s.length;z++)if(!s[z].hidden){e.options.fixedGutter&&(s[z].gutter&&(s[z].gutter.style.left=B),s[z].gutterBackground&&(s[z].gutterBackground.style.left=B));var $=s[z].alignable;if($)for(var Q=0;Q<$.length;Q++)$[Q].style.left=B}e.options.fixedGutter&&(t.gutters.style.left=i+d+"px")}function Cs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,s=Yr(e.options,t.first+t.size-1),i=e.display;if(s.length!=i.lineNumChars){var d=i.measure.appendChild(S("div",[S("div",s)],"CodeMirror-linenumber CodeMirror-gutter-elt")),B=d.firstChild.offsetWidth,z=d.offsetWidth-B;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(B,i.lineGutter.offsetWidth-z)+1,i.lineNumWidth=i.lineNumInnerWidth+z,i.lineNumChars=i.lineNumInnerWidth?s.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Ra(e.display),!0}return!1}function Ia(e,t){for(var s=[],i=!1,d=0;d<e.length;d++){var B=e[d],z=null;if(typeof B!="string"&&(z=B.style,B=B.className),B=="CodeMirror-linenumbers")if(t)i=!0;else continue;s.push({className:B,style:z})}return t&&!i&&s.push({className:"CodeMirror-linenumbers",style:null}),s}function As(e){var t=e.gutters,s=e.gutterSpecs;A(t),e.lineGutter=null;for(var i=0;i<s.length;++i){var d=s[i],B=d.className,z=d.style,$=t.appendChild(S("div",null,"CodeMirror-gutter "+B));z&&($.style.cssText=z),B=="CodeMirror-linenumbers"&&(e.lineGutter=$,$.style.width=(e.lineNumWidth||1)+"px")}t.style.display=s.length?"":"none",Ra(e)}function Si(e){As(e.display),Wr(e),Ss(e)}function hl(e,t,s,i){var d=this;this.input=s,d.scrollbarFiller=S("div",null,"CodeMirror-scrollbar-filler"),d.scrollbarFiller.setAttribute("cm-not-content","true"),d.gutterFiller=S("div",null,"CodeMirror-gutter-filler"),d.gutterFiller.setAttribute("cm-not-content","true"),d.lineDiv=C("div",null,"CodeMirror-code"),d.selectionDiv=S("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=S("div",null,"CodeMirror-cursors"),d.measure=S("div",null,"CodeMirror-measure"),d.lineMeasure=S("div",null,"CodeMirror-measure"),d.lineSpace=C("div",[d.measure,d.lineMeasure,d.selectionDiv,d.cursorDiv,d.lineDiv],null,"position: relative; outline: none");var B=C("div",[d.lineSpace],"CodeMirror-lines");d.mover=S("div",[B],null,"position: relative"),d.sizer=S("div",[d.mover],"CodeMirror-sizer"),d.sizerWidth=null,d.heightForcer=S("div",null,null,"position: absolute; height: "+Y+"px; width: 1px;"),d.gutters=S("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=S("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=S("div",[d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),F&&W<8&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),!r&&!(ce&&E)&&(d.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(d.wrapper):e(d.wrapper)),d.viewFrom=d.viewTo=t.first,d.reportedViewFrom=d.reportedViewTo=t.first,d.view=[],d.renderedView=null,d.externalMeasured=null,d.viewOffset=0,d.lastWrapHeight=d.lastWrapWidth=0,d.updateLineNumbers=null,d.nativeBarWidth=d.barHeight=d.barWidth=0,d.scrollbarsClipped=!1,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.alignWidgets=!1,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1,d.selForContextMenu=null,d.activeTouch=null,d.gutterSpecs=Ia(i.gutters,i.lineNumbers),As(d),s.init(d)}var $i=0,Qr=null;F?Qr=-.53:ce?Qr=15:D?Qr=-.7:g&&(Qr=-1/3);function Rs(e){var t=e.wheelDeltaX,s=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),s==null&&e.detail&&e.axis==e.VERTICAL_AXIS?s=e.detail:s==null&&(s=e.wheelDelta),{x:t,y:s}}function dl(e){var t=Rs(e);return t.x*=Qr,t.y*=Qr,t}function Os(e,t){var s=Rs(t),i=s.x,d=s.y,B=e.display,z=B.scroller,$=z.scrollWidth>z.clientWidth,Q=z.scrollHeight>z.clientHeight;if(!(i&&$||d&&Q))return;if(d&&_&&r){e:for(var te=t.target,ge=B.view;te!=z;te=te.parentNode)for(var be=0;be<ge.length;be++)if(ge[be].node==te){e.display.currentWheelTarget=te;break e}}if(i&&!ce&&!M&&Qr!=null){d&&Q&&Ei(e,Math.max(0,z.scrollTop+d*Qr)),Hn(e,Math.max(0,z.scrollLeft+i*Qr)),(!d||d&&Q)&&ne(t),B.wheelStartX=null;return}if(d&&Qr!=null){var ke=d*Qr,Re=e.doc.scrollTop,We=Re+B.wrapper.clientHeight;ke<0?Re=Math.max(0,Re+ke-50):We=Math.min(e.doc.height,We+ke+50),Aa(e,{top:Re,bottom:We})}$i<20&&(B.wheelStartX==null?(B.wheelStartX=z.scrollLeft,B.wheelStartY=z.scrollTop,B.wheelDX=i,B.wheelDY=d,setTimeout(function(){if(B.wheelStartX==null)return;var $e=z.scrollLeft-B.wheelStartX,rt=z.scrollTop-B.wheelStartY,ot=rt&&B.wheelDY&&rt/B.wheelDY||$e&&B.wheelDX&&$e/B.wheelDX;if(B.wheelStartX=B.wheelStartY=null,!ot)return;Qr=(Qr*$i+ot)/($i+1),++$i},200)):(B.wheelDX+=i,B.wheelDY+=d))}var qr=function(e,t){this.ranges=e,this.primIndex=t};qr.prototype.primary=function(){return this.ranges[this.primIndex]},qr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var s=this.ranges[t],i=e.ranges[t];if(!Ot(s.anchor,i.anchor)||!Ot(s.head,i.head))return!1}return!0},qr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new $t(Kt(this.ranges[t].anchor),Kt(this.ranges[t].head));return new qr(e,this.primIndex)},qr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},qr.prototype.contains=function(e,t){t||(t=e);for(var s=0;s<this.ranges.length;s++){var i=this.ranges[s];if(nt(t,i.from())>=0&&nt(e,i.to())<=0)return s}return-1};var $t=function(e,t){this.anchor=e,this.head=t};$t.prototype.from=function(){return br(this.anchor,this.head)},$t.prototype.to=function(){return Pt(this.anchor,this.head)},$t.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function sn(e,t,s){var i=e&&e.options.selectionsMayTouch,d=t[s];t.sort(function(ke,Re){return nt(ke.from(),Re.from())}),s=j(t,d);for(var B=1;B<t.length;B++){var z=t[B],$=t[B-1],Q=nt($.to(),z.from());if(i&&!z.empty()?Q>0:Q>=0){var te=br($.from(),z.from()),ge=Pt($.to(),z.to()),be=$.empty()?z.from()==z.head:$.from()==$.head;B<=s&&--s,t.splice(--B,2,new $t(be?ge:te,be?te:ge))}}return new qr(t,s)}function An(e,t){return new qr([new $t(e,t||e)],0)}function Rn(e){return e.text?Je(e.from.line+e.text.length-1,Ee(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Is(e,t){if(nt(e,t.from)<0)return e;if(nt(e,t.to)<=0)return Rn(t);var s=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Rn(t).ch-t.to.ch),Je(s,i)}function La(e,t){for(var s=[],i=0;i<e.sel.ranges.length;i++){var d=e.sel.ranges[i];s.push(new $t(Is(d.anchor,t),Is(d.head,t)))}return sn(e.cm,s,e.sel.primIndex)}function Ls(e,t,s){return e.line==t.line?Je(s.line,e.ch-t.ch+s.ch):Je(s.line+(e.line-t.line),e.ch)}function cl(e,t,s){for(var i=[],d=Je(e.first,0),B=d,z=0;z<t.length;z++){var $=t[z],Q=Ls($.from,d,B),te=Ls(Rn($),d,B);if(d=$.to,B=te,s=="around"){var ge=e.sel.ranges[z],be=nt(ge.head,ge.anchor)<0;i[z]=new $t(be?te:Q,be?Q:te)}else i[z]=new $t(Q,Q)}return new qr(i,e.sel.primIndex)}function ka(e){e.doc.mode=xr(e.options,e.doc.modeOption),Ci(e)}function Ci(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Ti(e,100),e.state.modeGen++,e.curOp&&Wr(e)}function ks(e,t){return t.from.ch==0&&t.to.ch==0&&Ee(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Da(e,t,s,i){function d(ft){return s?s[ft]:null}function B(ft,lt,gt){ua(ft,lt,gt,i),Ir(ft,"change",ft,t)}function z(ft,lt){for(var gt=[],Tt=ft;Tt<lt;++Tt)gt.push(new Mn(te[Tt],d(Tt),i));return gt}var $=t.from,Q=t.to,te=t.text,ge=mt(e,$.line),be=mt(e,Q.line),ke=Ee(te),Re=d(te.length-1),We=Q.line-$.line;if(t.full)e.insert(0,z(0,te.length)),e.remove(te.length,e.size-te.length);else if(ks(e,t)){var $e=z(0,te.length-1);B(be,be.text,Re),We&&e.remove($.line,We),$e.length&&e.insert($.line,$e)}else if(ge==be)if(te.length==1)B(ge,ge.text.slice(0,$.ch)+ke+ge.text.slice(Q.ch),Re);else{var rt=z(1,te.length-1);rt.push(new Mn(ke+ge.text.slice(Q.ch),Re,i)),B(ge,ge.text.slice(0,$.ch)+te[0],d(0)),e.insert($.line+1,rt)}else if(te.length==1)B(ge,ge.text.slice(0,$.ch)+te[0]+be.text.slice(Q.ch),d(0)),e.remove($.line+1,We);else{B(ge,ge.text.slice(0,$.ch)+te[0],d(0)),B(be,ke+be.text.slice(Q.ch),Re);var ot=z(1,te.length-1);We>1&&e.remove($.line+1,We-1),e.insert($.line+1,ot)}Ir(e,"change",e,t)}function On(e,t,s){function i(d,B,z){if(d.linked)for(var $=0;$<d.linked.length;++$){var Q=d.linked[$];if(Q.doc==B)continue;var te=z&&Q.sharedHist;if(s&&!te)continue;t(Q.doc,te),i(Q.doc,d,te)}}i(e,null,!0)}function Ds(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),ka(e),Ps(e),e.options.lineWrapping||Hi(e),e.options.mode=t.modeOption,Wr(e)}function Ps(e){(e.doc.direction=="rtl"?l:k)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){$r(e,function(){Ps(e),Wr(e)})}function Ji(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Pa(e,t){var s={from:Kt(t.from),to:Rn(t),text:sr(e,t.from,t.to)};return Fs(e,s,t.from.line,t.to.line+1),On(e,function(i){return Fs(i,s,t.from.line,t.to.line+1)},!0),s}function Ms(e){for(;e.length;){var t=Ee(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ms(e.done),Ee(e.done);if(e.done.length&&!Ee(e.done).ranges)return Ee(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Ee(e.done)}function Ns(e,t,s,i){var d=e.history;d.undone.length=0;var B=+new Date,z,$;if((d.lastOp==i||d.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&d.lastModTime>B-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(z=pl(d,d.lastOp==i)))$=Ee(z.changes),nt(t.from,t.to)==0&&nt(t.from,$.to)==0?$.to=Rn(t):z.changes.push(Pa(e,t));else{var Q=Ee(d.done);for((!Q||!Q.ranges)&&Zi(e.sel,d.done),z={changes:[Pa(e,t)],generation:d.generation},d.done.push(z);d.done.length>d.undoDepth;)d.done.shift(),d.done[0].ranges||d.done.shift()}d.done.push(s),d.generation=++d.maxGeneration,d.lastModTime=d.lastSelTime=B,d.lastOp=d.lastSelOp=i,d.lastOrigin=d.lastSelOrigin=t.origin,$||Ue(e,"historyAdded")}function ml(e,t,s,i){var d=t.charAt(0);return d=="*"||d=="+"&&s.ranges.length==i.ranges.length&&s.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,s,i){var d=e.history,B=i&&i.origin;s==d.lastSelOp||B&&d.lastSelOrigin==B&&(d.lastModTime==d.lastSelTime&&d.lastOrigin==B||ml(e,B,Ee(d.done),t))?d.done[d.done.length-1]=t:Zi(t,d.done),d.lastSelTime=+new Date,d.lastSelOrigin=B,d.lastSelOp=s,i&&i.clearRedo!==!1&&Ms(d.undone)}function Zi(e,t){var s=Ee(t);s&&s.ranges&&s.equals(e)||t.push(e)}function Fs(e,t,s,i){var d=t["spans_"+e.id],B=0;e.iter(Math.max(e.first,s),Math.min(e.first+e.size,i),function(z){z.markedSpans&&((d||(d=t["spans_"+e.id]={}))[B]=z.markedSpans),++B})}function vl(e){if(!e)return null;for(var t,s=0;s<e.length;++s)e[s].marker.explicitlyCleared?t||(t=e.slice(0,s)):t&&t.push(e[s]);return t?t.length?t:null:e}function yl(e,t){var s=t["spans_"+e.id];if(!s)return null;for(var i=[],d=0;d<t.text.length;++d)i.push(vl(s[d]));return i}function Us(e,t){var s=yl(e,t),i=Tn(e,t);if(!s)return i;if(!i)return s;for(var d=0;d<s.length;++d){var B=s[d],z=i[d];if(B&&z){e:for(var $=0;$<z.length;++$){for(var Q=z[$],te=0;te<B.length;++te)if(B[te].marker==Q.marker)continue e;B.push(Q)}}else z&&(s[d]=z)}return s}function ri(e,t,s){for(var i=[],d=0;d<e.length;++d){var B=e[d];if(B.ranges){i.push(s?qr.prototype.deepCopy.call(B):B);continue}var z=B.changes,$=[];i.push({changes:$});for(var Q=0;Q<z.length;++Q){var te=z[Q],ge=void 0;if($.push({from:te.from,to:te.to,text:te.text}),t)for(var be in te)(ge=be.match(/^spans_(\d+)$/))&&(j(t,Number(ge[1]))>-1&&(Ee($)[be]=te[be],delete te[be]))}}return i}function Ma(e,t,s,i){if(i){var d=e.anchor;if(s){var B=nt(t,d)<0;B!=nt(s,d)<0?(d=t,t=s):B!=nt(t,s)<0&&(t=s)}return new $t(d,t)}else return new $t(s||t,t)}function Qi(e,t,s,i,d){d==null&&(d=e.cm&&(e.cm.display.shift||e.extend)),Mr(e,new qr([Ma(e.sel.primary(),t,s,d)],0),i)}function Bs(e,t,s){for(var i=[],d=e.cm&&(e.cm.display.shift||e.extend),B=0;B<e.sel.ranges.length;B++)i[B]=Ma(e.sel.ranges[B],t[B],null,d);var z=sn(e.cm,i,e.sel.primIndex);Mr(e,z,s)}function Na(e,t,s,i){var d=e.sel.ranges.slice(0);d[t]=s,Mr(e,sn(e.cm,d,e.sel.primIndex),i)}function Hs(e,t,s,i){Mr(e,An(t,s),i)}function bl(e,t,s){var i={ranges:t.ranges,update:function(d){this.ranges=[];for(var B=0;B<d.length;B++)this.ranges[B]=new $t(St(e,d[B].anchor),St(e,d[B].head))},origin:s&&s.origin};return Ue(e,"beforeSelectionChange",e,i),e.cm&&Ue(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?sn(e.cm,i.ranges,i.ranges.length-1):t}function js(e,t,s){var i=e.history.done,d=Ee(i);d&&d.ranges?(i[i.length-1]=t,qi(e,t,s)):Mr(e,t,s)}function Mr(e,t,s){qi(e,t,s),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,s)}function qi(e,t,s){(_e(e,"beforeSelectionChange")||e.cm&&_e(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,s));var i=s&&s.bias||(nt(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,Ks(e,t,i,!0)),!(s&&s.scroll===!1)&&e.cm&&ei(e.cm)}function Ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ce(e.cm)),Ir(e,"cursorActivity",e)}function Gs(e){Ws(e,Ks(e,e.sel,null,!1))}function Ks(e,t,s,i){for(var d,B=0;B<t.ranges.length;B++){var z=t.ranges[B],$=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[B],Q=ea(e,z.anchor,$&&$.anchor,s,i),te=ea(e,z.head,$&&$.head,s,i);(d||Q!=z.anchor||te!=z.head)&&(d||(d=t.ranges.slice(0,B)),d[B]=new $t(Q,te))}return d?sn(e.cm,d,t.primIndex):t}function ni(e,t,s,i,d){var B=mt(e,t.line);if(B.markedSpans)for(var z=0;z<B.markedSpans.length;++z){var $=B.markedSpans[z],Q=$.marker,te="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,ge="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if(($.from==null||(te?$.from<=t.ch:$.from<t.ch))&&($.to==null||(ge?$.to>=t.ch:$.to>t.ch))){if(d&&(Ue(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(B.markedSpans){--z;continue}else break;if(!Q.atomic)continue;if(s){var be=Q.find(i<0?1:-1),ke=void 0;if((i<0?ge:te)&&(be=zs(e,be,-i,be&&be.line==t.line?B:null)),be&&be.line==t.line&&(ke=nt(be,s))&&(i<0?ke<0:ke>0))return ni(e,be,t,i,d)}var Re=Q.find(i<0?-1:1);return(i<0?te:ge)&&(Re=zs(e,Re,i,Re.line==t.line?B:null)),Re?ni(e,Re,t,i,d):null}}return t}function ea(e,t,s,i,d){var B=i||1,z=ni(e,t,s,B,d)||!d&&ni(e,t,s,B,!0)||ni(e,t,s,-B,d)||!d&&ni(e,t,s,-B,!0);return z||(e.cantEdit=!0,Je(e.first,0))}function zs(e,t,s,i){return s<0&&t.ch==0?t.line>e.first?St(e,Je(t.line-1)):null:s>0&&t.ch==(i||mt(e,t.line)).text.length?t.line<e.first+e.size-1?Je(t.line+1,0):null:new Je(t.line,t.ch+s)}function Vs(e){e.setSelection(Je(e.firstLine(),0),Je(e.lastLine()),ee)}function Ys(e,t,s){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return s&&(i.update=function(d,B,z,$){d&&(i.from=St(e,d)),B&&(i.to=St(e,B)),z&&(i.text=z),$!==void 0&&(i.origin=$)}),Ue(e,"beforeChange",e,i),e.cm&&Ue(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function ii(e,t,s){if(e.cm){if(!e.cm.curOp)return Tr(e.cm,ii)(e,t,s);if(e.cm.state.suppressEdits)return}if((_e(e,"beforeChange")||e.cm&&_e(e.cm,"beforeChange"))&&(t=Ys(e,t,!0),!t))return;var i=ur&&!s&&gn(e,t.from,t.to);if(i)for(var d=i.length-1;d>=0;--d)Xs(e,{from:i[d].from,to:i[d].to,text:d?[""]:t.text,origin:t.origin});else Xs(e,t)}function Xs(e,t){if(t.text.length==1&&t.text[0]==""&&nt(t.from,t.to)==0)return;var s=La(e,t);Ns(e,t,s,e.cm?e.cm.curOp.id:NaN),Ai(e,t,s,Tn(e,t));var i=[];On(e,function(d,B){!B&&j(i,d.history)==-1&&(Qs(d.history,t),i.push(d.history)),Ai(d,t,null,Tn(d,t))})}function ta(e,t,s){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!s)return;for(var d=e.history,B,z=e.sel,$=t=="undo"?d.done:d.undone,Q=t=="undo"?d.undone:d.done,te=0;te<$.length&&!(B=$[te],s?B.ranges&&!B.equals(e.sel):!B.ranges);te++);if(te==$.length)return;for(d.lastOrigin=d.lastSelOrigin=null;;)if(B=$.pop(),B.ranges){if(Zi(B,Q),s&&!B.equals(e.sel)){Mr(e,B,{clearRedo:!1});return}z=B}else if(i){$.push(B);return}else break;var ge=[];Zi(z,Q),Q.push({changes:ge,generation:d.generation}),d.generation=B.generation||++d.maxGeneration;for(var be=_e(e,"beforeChange")||e.cm&&_e(e.cm,"beforeChange"),ke=function($e){var rt=B.changes[$e];if(rt.origin=t,be&&!Ys(e,rt,!1))return $.length=0,{};ge.push(Pa(e,rt));var ot=$e?La(e,rt):Ee($);Ai(e,rt,ot,Us(e,rt)),!$e&&e.cm&&e.cm.scrollIntoView({from:rt.from,to:Rn(rt)});var ft=[];On(e,function(lt,gt){!gt&&j(ft,lt.history)==-1&&(Qs(lt.history,rt),ft.push(lt.history)),Ai(lt,rt,null,Us(lt,rt))})},Re=B.changes.length-1;Re>=0;--Re){var We=ke(Re);if(We)return We.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new qr(Le(e.sel.ranges,function(d){return new $t(Je(d.anchor.line+t,d.anchor.ch),Je(d.head.line+t,d.head.ch))}),e.sel.primIndex),e.cm){Wr(e.cm,e.first,e.first-t,t);for(var s=e.cm.display,i=s.viewFrom;i<s.viewTo;i++)Sn(e.cm,i,"gutter")}}function Ai(e,t,s,i){if(e.cm&&!e.cm.curOp)return Tr(e.cm,Ai)(e,t,s,i);if(t.to.line<e.first){$s(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var d=t.text.length-1-(e.first-t.from.line);$s(e,d),t={from:Je(e.first,0),to:Je(t.to.line+d,t.to.ch),text:[Ee(t.text)],origin:t.origin}}var B=e.lastLine();t.to.line>B&&(t={from:t.from,to:Je(B,mt(e,B).text.length),text:[t.text[0]],origin:t.origin}),t.removed=sr(e,t.from,t.to),s||(s=La(e,t)),e.cm?_l(e.cm,t,i):Da(e,t,i),qi(e,s,ee),e.cantEdit&&ea(e,Je(e.firstLine(),0))&&(e.cantEdit=!1)}function _l(e,t,s){var i=e.doc,d=e.display,B=t.from,z=t.to,$=!1,Q=B.line;e.options.lineWrapping||(Q=Dt(Dr(mt(i,B.line))),i.iter(Q,z.line+1,function(Re){if(Re==d.maxLine)return $=!0,!0})),i.sel.contains(t.from,t.to)>-1&&Ce(e),Da(i,t,s,cs(e)),e.options.lineWrapping||(i.iter(Q,B.line+t.text.length,function(Re){var We=pi(Re);We>d.maxLineLength&&(d.maxLine=Re,d.maxLineLength=We,d.maxLineChanged=!0,$=!1)}),$&&(e.curOp.updateMaxLine=!0)),Fr(i,B.line),Ti(e,400);var te=t.text.length-(z.line-B.line)-1;t.full?Wr(e):B.line==z.line&&t.text.length==1&&!ks(e.doc,t)?Sn(e,B.line,"text"):Wr(e,B.line,z.line+1,te);var ge=_e(e,"changes"),be=_e(e,"change");if(be||ge){var ke={from:B,to:z,text:t.text,removed:t.removed,origin:t.origin};be&&Ir(e,"change",e,ke),ge&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ke)}e.display.selForContextMenu=null}function ai(e,t,s,i,d){var B;i||(i=s),nt(i,s)<0&&(B=[i,s],s=B[0],i=B[1]),typeof t=="string"&&(t=e.splitLines(t)),ii(e,{from:s,to:i,text:t,origin:d})}function Js(e,t,s,i){s<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Zs(e,t,s,i){for(var d=0;d<e.length;++d){var B=e[d],z=!0;if(B.ranges){B.copied||(B=e[d]=B.deepCopy(),B.copied=!0);for(var $=0;$<B.ranges.length;$++)Js(B.ranges[$].anchor,t,s,i),Js(B.ranges[$].head,t,s,i);continue}for(var Q=0;Q<B.changes.length;++Q){var te=B.changes[Q];if(s<te.from.line)te.from=Je(te.from.line+i,te.from.ch),te.to=Je(te.to.line+i,te.to.ch);else if(t<=te.to.line){z=!1;break}}z||(e.splice(0,d+1),d=0)}}function Qs(e,t){var s=t.from.line,i=t.to.line,d=t.text.length-(i-s)-1;Zs(e.done,s,i,d),Zs(e.undone,s,i,d)}function Ri(e,t,s,i){var d=t,B=t;return typeof t=="number"?B=mt(e,Xr(e,t)):d=Dt(t),d==null?null:(i(B,d)&&e.cm&&Sn(e.cm,d,s),B)}function Oi(e){this.lines=e,this.parent=null;for(var t=0,s=0;s<e.length;++s)e[s].parent=this,t+=e[s].height;this.height=t}Oi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var s=e,i=e+t;s<i;++s){var d=this.lines[s];this.height-=d.height,bt(d),Ir(d,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,s){this.height+=s,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,s){for(var i=e+t;e<i;++e)if(s(this.lines[e]))return!0}};function Ii(e){this.children=e;for(var t=0,s=0,i=0;i<e.length;++i){var d=e[i];t+=d.chunkSize(),s+=d.height,d.parent=this}this.size=t,this.height=s,this.parent=null}Ii.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var s=0;s<this.children.length;++s){var i=this.children[s],d=i.chunkSize();if(e<d){var B=Math.min(t,d-e),z=i.height;if(i.removeInner(e,B),this.height-=z-i.height,d==B&&(this.children.splice(s--,1),i.parent=null),(t-=B)==0)break;e=0}else e-=d}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Oi))){var $=[];this.collapse($),this.children=[new Oi($)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,s){this.size+=t.length,this.height+=s;for(var i=0;i<this.children.length;++i){var d=this.children[i],B=d.chunkSize();if(e<=B){if(d.insertInner(e,t,s),d.lines&&d.lines.length>50){for(var z=d.lines.length%25+25,$=z;$<d.lines.length;){var Q=new Oi(d.lines.slice($,$+=25));d.height-=Q.height,this.children.splice(++i,0,Q),Q.parent=this}d.lines=d.lines.slice(0,z),this.maybeSpill()}break}e-=B}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),s=new Ii(t);if(e.parent){e.size-=s.size,e.height-=s.height;var d=j(e.parent.children,e);e.parent.children.splice(d+1,0,s)}else{var i=new Ii(e.children);i.parent=e,e.children=[i,s],e=i}s.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,s){for(var i=0;i<this.children.length;++i){var d=this.children[i],B=d.chunkSize();if(e<B){var z=Math.min(t,B-e);if(d.iterN(e,z,s))return!0;if((t-=z)==0)break;e=0}else e-=B}}};var Li=function(e,t,s){if(s)for(var i in s)s.hasOwnProperty(i)&&(this[i]=s[i]);this.doc=e,this.node=t};Li.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,s=this.line,i=Dt(s);if(i==null||!t)return;for(var d=0;d<t.length;++d)t[d]==this&&t.splice(d--,1);t.length||(s.widgets=null);var B=vi(this);Jt(s,Math.max(0,s.height-B)),e&&($r(e,function(){qs(e,s,-B),Sn(e,i,"widget")}),Ir(e,"lineWidgetCleared",e,this,i))},Li.prototype.changed=function(){var e=this,t=this.height,s=this.doc.cm,i=this.line;this.height=null;var d=vi(this)-t;if(!d)return;dn(this.doc,i)||Jt(i,i.height+d),s&&$r(s,function(){s.curOp.forceUpdate=!0,qs(s,i,d),Ir(s,"lineWidgetChanged",s,e,Dt(i))})},Te(Li);function qs(e,t,s){nn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,s)}function El(e,t,s,i){var d=new Li(e,s,i),B=e.cm;return B&&d.noHScroll&&(B.display.alignWidgets=!0),Ri(e,t,"widget",function(z){var $=z.widgets||(z.widgets=[]);if(d.insertAt==null?$.push(d):$.splice(Math.min($.length-1,Math.max(0,d.insertAt)),0,d),d.line=z,B&&!dn(e,z)){var Q=nn(z)<e.scrollTop;Jt(z,z.height+vi(d)),Q&&Sa(B,d.height),B.curOp.forceUpdate=!0}return!0}),B&&Ir(B,"lineWidgetAdded",B,d,typeof t=="number"?t:Dt(t)),d}var eo=0,In=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};In.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Wn(e),_e(this,"clear")){var s=this.find();s&&Ir(this,"clear",s.from,s.to)}for(var i=null,d=null,B=0;B<this.lines.length;++B){var z=this.lines[B],$=kr(z.markedSpans,this);e&&!this.collapsed?Sn(e,Dt(z),"text"):e&&($.to!=null&&(d=Dt(z)),$.from!=null&&(i=Dt(z))),z.markedSpans=Dn(z.markedSpans,$),$.from==null&&this.collapsed&&!dn(this.doc,z)&&e&&Jt(z,Zn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var te=Dr(this.lines[Q]),ge=pi(te);ge>e.display.maxLineLength&&(e.display.maxLine=te,e.display.maxLineLength=ge,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&Wr(e,i,d+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&Ir(e,"markerCleared",e,this,i,d),t&&Gn(e),this.parent&&this.parent.clear()},In.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var s,i,d=0;d<this.lines.length;++d){var B=this.lines[d],z=kr(B.markedSpans,this);if(z.from!=null&&(s=Je(t?B:Dt(B),z.from),e==-1))return s;if(z.to!=null&&(i=Je(t?B:Dt(B),z.to),e==1))return i}return s&&{from:s,to:i}},In.prototype.changed=function(){var e=this,t=this.find(-1,!0),s=this,i=this.doc.cm;if(!t||!i)return;$r(i,function(){var d=t.line,B=Dt(t.line),z=fa(i,B);if(z&&(is(z),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!dn(s.doc,d)&&s.height!=null){var $=s.height;s.height=null;var Q=vi(s)-$;Q&&Jt(d,d.height+Q)}Ir(i,"markerChanged",i,e)})},In.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||j(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},In.prototype.detachLine=function(e){if(this.lines.splice(j(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Te(In);function si(e,t,s,i,d){if(i&&i.shared)return xl(e,t,s,i,d);if(e.cm&&!e.cm.curOp)return Tr(e.cm,si)(e,t,s,i,d);var B=new In(e,d),z=nt(t,s);if(i&&n(i,B,!1),z>0||z==0&&B.clearWhenEmpty!==!1)return B;if(B.replacedWith&&(B.collapsed=!0,B.widgetNode=C("span",[B.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||B.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(B.widgetNode.insertLeft=!0)),B.collapsed){if(nr(e,t.line,t,s,B)||t.line!=s.line&&nr(e,s.line,t,s,B))throw new Error("Inserting collapsed marker partially overlapping an existing one");Vn()}B.addToHistory&&Ns(e,{from:t,to:s,origin:"markText"},e.sel,NaN);var $=t.line,Q=e.cm,te;if(e.iter($,s.line+1,function(be){Q&&B.collapsed&&!Q.options.lineWrapping&&Dr(be)==Q.display.maxLine&&(te=!0),B.collapsed&&$!=t.line&&Jt(be,0),Yn(be,new en(B,$==t.line?t.ch:null,$==s.line?s.ch:null)),++$}),B.collapsed&&e.iter(t.line,s.line+1,function(be){dn(e,be)&&Jt(be,0)}),B.clearOnEnter&&Ne(B,"beforeCursorEnter",function(){return B.clear()}),B.readOnly&&(ln(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),B.collapsed&&(B.id=++eo,B.atomic=!0),Q){if(te&&(Q.curOp.updateMaxLine=!0),B.collapsed)Wr(Q,t.line,s.line+1);else if(B.className||B.startStyle||B.endStyle||B.css||B.attributes||B.title)for(var ge=t.line;ge<=s.line;ge++)Sn(Q,ge,"text");B.atomic&&Gs(Q.doc),Ir(Q,"markerAdded",Q,B)}return B}var ki=function(e,t){this.markers=e,this.primary=t;for(var s=0;s<e.length;++s)e[s].parent=this};ki.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Ir(this,"clear")},ki.prototype.find=function(e,t){return this.primary.find(e,t)},Te(ki);function xl(e,t,s,i,d){i=n(i),i.shared=!1;var B=[si(e,t,s,i,d)],z=B[0],$=i.widgetNode;return On(e,function(Q){$&&(i.widgetNode=$.cloneNode(!0)),B.push(si(Q,St(Q,t),St(Q,s),i,d));for(var te=0;te<Q.linked.length;++te)if(Q.linked[te].isParent)return;z=Ee(B)}),new ki(B,z)}function to(e){return e.findMarks(Je(e.first,0),e.clipPos(Je(e.lastLine())),function(t){return t.parent})}function wl(e,t){for(var s=0;s<t.length;s++){var i=t[s],d=i.find(),B=e.clipPos(d.from),z=e.clipPos(d.to);if(nt(B,z)){var $=si(e,B,z,i.primary,i.primary.type);i.markers.push($),$.parent=i}}}function Tl(e){for(var t=function(i){var d=e[i],B=[d.primary.doc];On(d.primary.doc,function(Q){return B.push(Q)});for(var z=0;z<d.markers.length;z++){var $=d.markers[z];j(B,$.doc)==-1&&($.parent=null,d.markers.splice(z--,1))}},s=0;s<e.length;s++)t(s)}var Sl=0,Gr=function(e,t,s,i,d){if(!(this instanceof Gr))return new Gr(e,t,s,i,d);s==null&&(s=0),Ii.call(this,[new Oi([new Mn("",null)])]),this.first=s,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=s;var B=Je(s,0);this.sel=An(B),this.history=new Ji(null),this.id=++Sl,this.modeOption=t,this.lineSep=i,this.direction=d=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Da(this,{from:B,to:B,text:e}),Mr(this,An(B),ee)};Gr.prototype=He(Ii.prototype,{constructor:Gr,iter:function(e,t,s){s?this.iterN(e-this.first,t-e,s):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var s=0,i=0;i<t.length;++i)s+=t[i].height;this.insertInner(e-this.first,t,s)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Qt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Sr(function(e){var t=Je(this.first,0),s=this.first+this.size-1;ii(this,{from:t,to:Je(s,mt(this,s).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&_i(this.cm,0,0),Mr(this,An(t),ee)}),replaceRange:function(e,t,s,i){t=St(this,t),s=s?St(this,s):t,ai(this,e,t,s,i)},getRange:function(e,t,s){var i=sr(this,St(this,e),St(this,t));return s===!1?i:i.join(s||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(yr(this,e))return mt(this,e)},getLineNumber:function(e){return Dt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=mt(this,e)),Dr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return St(this,e)},getCursor:function(e){var t=this.sel.primary(),s;return e==null||e=="head"?s=t.head:e=="anchor"?s=t.anchor:e=="end"||e=="to"||e===!1?s=t.to():s=t.from(),s},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Sr(function(e,t,s){Hs(this,St(this,typeof e=="number"?Je(e,t||0):e),null,s)}),setSelection:Sr(function(e,t,s){Hs(this,St(this,e),St(this,t||e),s)}),extendSelection:Sr(function(e,t,s){Qi(this,St(this,e),t&&St(this,t),s)}),extendSelections:Sr(function(e,t){Bs(this,y(this,e),t)}),extendSelectionsBy:Sr(function(e,t){var s=Le(this.sel.ranges,e);Bs(this,y(this,s),t)}),setSelections:Sr(function(e,t,s){if(!e.length)return;for(var i=[],d=0;d<e.length;d++)i[d]=new $t(St(this,e[d].anchor),St(this,e[d].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Mr(this,sn(this.cm,i,t),s)}),addSelection:Sr(function(e,t,s){var i=this.sel.ranges.slice(0);i.push(new $t(St(this,e),St(this,t||e))),Mr(this,sn(this.cm,i,i.length-1),s)}),getSelection:function(e){for(var t=this.sel.ranges,s,i=0;i<t.length;i++){var d=sr(this,t[i].from(),t[i].to());s=s?s.concat(d):d}return e===!1?s:s.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],s=this.sel.ranges,i=0;i<s.length;i++){var d=sr(this,s[i].from(),s[i].to());e!==!1&&(d=d.join(e||this.lineSeparator())),t[i]=d}return t},replaceSelection:function(e,t,s){for(var i=[],d=0;d<this.sel.ranges.length;d++)i[d]=e;this.replaceSelections(i,t,s||"+input")},replaceSelections:Sr(function(e,t,s){for(var i=[],d=this.sel,B=0;B<d.ranges.length;B++){var z=d.ranges[B];i[B]={from:z.from(),to:z.to(),text:this.splitLines(e[B]),origin:s}}for(var $=t&&t!="end"&&cl(this,i,t),Q=i.length-1;Q>=0;Q--)ii(this,i[Q]);$?js(this,$):this.cm&&ei(this.cm)}),undo:Sr(function(){ta(this,"undo")}),redo:Sr(function(){ta(this,"redo")}),undoSelection:Sr(function(){ta(this,"undo",!0)}),redoSelection:Sr(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,s=0,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var d=0;d<e.undone.length;d++)e.undone[d].ranges||++s;return{undo:t,redo:s}},clearHistory:function(){var e=this;this.history=new Ji(this.history.maxGeneration),On(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:ri(this.history.done),undone:ri(this.history.undone)}},setHistory:function(e){var t=this.history=new Ji(this.history.maxGeneration);t.done=ri(e.done.slice(0),null,!0),t.undone=ri(e.undone.slice(0),null,!0)},setGutterMarker:Sr(function(e,t,s){return Ri(this,e,"gutter",function(i){var d=i.gutterMarkers||(i.gutterMarkers={});return d[t]=s,!s&&de(d)&&(i.gutterMarkers=null),!0})}),clearGutter:Sr(function(e){var t=this;this.iter(function(s){s.gutterMarkers&&s.gutterMarkers[e]&&Ri(t,s,"gutter",function(){return s.gutterMarkers[e]=null,de(s.gutterMarkers)&&(s.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!yr(this,e))return null;if(t=e,e=mt(this,e),!e)return null}else if(t=Dt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Sr(function(e,t,s){return Ri(this,e,t=="gutter"?"gutter":"class",function(i){var d=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[d])i[d]=s;else{if(I(s).test(i[d]))return!1;i[d]+=" "+s}return!0})}),removeLineClass:Sr(function(e,t,s){return Ri(this,e,t=="gutter"?"gutter":"class",function(i){var d=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",B=i[d];if(B)if(s==null)i[d]=null;else{var z=B.match(I(s));if(!z)return!1;var $=z.index+z[0].length;i[d]=B.slice(0,z.index)+(!z.index||$==B.length?"":" ")+B.slice($)||null}else return!1;return!0})}),addLineWidget:Sr(function(e,t,s){return El(this,e,t,s)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,s){return si(this,St(this,e),St(this,t),s,s&&s.type||"range")},setBookmark:function(e,t){var s={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=St(this,e),si(this,e,e,s,"bookmark")},findMarksAt:function(e){e=St(this,e);var t=[],s=mt(this,e.line).markedSpans;if(s)for(var i=0;i<s.length;++i){var d=s[i];(d.from==null||d.from<=e.ch)&&(d.to==null||d.to>=e.ch)&&t.push(d.marker.parent||d.marker)}return t},findMarks:function(e,t,s){e=St(this,e),t=St(this,t);var i=[],d=e.line;return this.iter(e.line,t.line+1,function(B){var z=B.markedSpans;if(z)for(var $=0;$<z.length;$++){var Q=z[$];!(Q.to!=null&&d==e.line&&e.ch>=Q.to||Q.from==null&&d!=e.line||Q.from!=null&&d==t.line&&Q.from>=t.ch)&&(!s||s(Q.marker))&&i.push(Q.marker.parent||Q.marker)}++d}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var s=t.markedSpans;if(s)for(var i=0;i<s.length;++i)s[i].from!=null&&e.push(s[i].marker)}),e},posFromIndex:function(e){var t,s=this.first,i=this.lineSeparator().length;return this.iter(function(d){var B=d.text.length+i;if(B>e)return t=e,!0;e-=B,++s}),St(this,Je(s,t))},indexFromPos:function(e){e=St(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var s=this.lineSeparator().length;return this.iter(this.first,e.line,function(i){t+=i.text.length+s}),t},copy:function(e){var t=new Gr(Qt(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,s=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<s&&(s=e.to);var i=new Gr(Qt(this,t,s),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],wl(i,to(this)),i},unlinkDoc:function(e){if(e instanceof ir&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var s=this.linked[t];if(s.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(to(this));break}if(e.history==this.history){var i=[e.id];On(e,function(d){return i.push(d.id)},!0),e.history=new Ji(null),e.history.done=ri(this.history.done,i),e.history.undone=ri(this.history.undone,i)}},iterLinkedDocs:function(e){On(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ct(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Sr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),Gr.prototype.eachLine=Gr.prototype.iter;var ro=0;function Cl(e){var t=this;if(no(t),Ve(t,e)||En(t.display,e))return;ne(e),F&&(ro=+new Date);var s=Un(t,e,!0),i=e.dataTransfer.files;if(!s||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var d=i.length,B=Array(d),z=0,$=function(){++z==d&&Tr(t,function(){s=St(t.doc,s);var Re={from:s,to:s,text:t.doc.splitLines(B.filter(function(We){return We!=null}).join(t.doc.lineSeparator())),origin:"paste"};ii(t.doc,Re),js(t.doc,An(St(t.doc,s),St(t.doc,Rn(Re))))})()},Q=function(Re,We){if(t.options.allowDropFileTypes&&j(t.options.allowDropFileTypes,Re.type)==-1){$();return}var $e=new FileReader;$e.onerror=function(){return $()},$e.onload=function(){var rt=$e.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(rt)){$();return}B[We]=rt,$()},$e.readAsText(Re)},te=0;te<i.length;te++)Q(i[te],te);else{if(t.state.draggingText&&t.doc.sel.contains(s)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ge=e.dataTransfer.getData("Text");if(ge){var be;if(t.state.draggingText&&!t.state.draggingText.copy&&(be=t.listSelections()),qi(t.doc,An(s,s)),be)for(var ke=0;ke<be.length;++ke)ai(t.doc,"",be[ke].anchor,be[ke].head,"drag");t.replaceSelection(ge,"around","paste"),t.display.input.focus()}}catch(Re){}}}function Al(e,t){if(F&&(!e.state.draggingText||+new Date-ro<100)){me(t);return}if(Ve(e,t)||En(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!g){var s=S("img",null,null,"position: fixed; left: 0; top: 0;");s.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",M&&(s.width=s.height=1,e.display.wrapper.appendChild(s),s._top=s.offsetTop),t.dataTransfer.setDragImage(s,0,0),M&&s.parentNode.removeChild(s)}}function Rl(e,t){var s=Un(e,t);if(!s)return;var i=document.createDocumentFragment();ms(e,s,i),e.display.dragCursor||(e.display.dragCursor=S("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),P(e.display.dragCursor,i)}function no(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function io(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),s=[],i=0;i<t.length;i++){var d=t[i].CodeMirror;d&&s.push(d)}s.length&&s[0].operation(function(){for(var B=0;B<s.length;B++)e(s[B])})}var ao=!1;function Ol(){if(ao)return;Il(),ao=!0}function Il(){var e;Ne(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,io(Ll)},100))}),Ne(window,"blur",function(){return io(qn)})}function Ll(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Ln={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Di=0;Di<10;Di++)Ln[Di+48]=Ln[Di+96]=String(Di);for(var ra=65;ra<=90;ra++)Ln[ra]=String.fromCharCode(ra);for(var Pi=1;Pi<=12;Pi++)Ln[Pi+111]=Ln[Pi+63235]="F"+Pi;var xn={};xn.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},xn.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},xn.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},xn.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},xn.default=_?xn.macDefault:xn.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var s,i,d,B,z=0;z<t.length-1;z++){var $=t[z];if(/^(cmd|meta|m)$/i.test($))B=!0;else if(/^a(lt)?$/i.test($))s=!0;else if(/^(c|ctrl|control)$/i.test($))i=!0;else if(/^s(hift)?$/i.test($))d=!0;else throw new Error("Unrecognized modifier name: "+$)}return s&&(e="Alt-"+e),i&&(e="Ctrl-"+e),B&&(e="Cmd-"+e),d&&(e="Shift-"+e),e}function Dl(e){var t={};for(var s in e)if(e.hasOwnProperty(s)){var i=e[s];if(/^(name|fallthrough|(de|at)tach)$/.test(s))continue;if(i=="..."){delete e[s];continue}for(var d=Le(s.split(" "),kl),B=0;B<d.length;B++){var z=void 0,$=void 0;B==d.length-1?($=d.join(" "),z=i):($=d.slice(0,B+1).join(" "),z="...");var Q=t[$];if(!Q)t[$]=z;else if(Q!=z)throw new Error("Inconsistent bindings for "+$)}delete e[s]}for(var te in t)e[te]=t[te];return e}function oi(e,t,s,i){t=na(t);var d=t.call?t.call(e,i):t[e];if(d===!1)return"nothing";if(d==="...")return"multi";if(d!=null&&s(d))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return oi(e,t.fallthrough,s,i);for(var B=0;B<t.fallthrough.length;B++){var z=oi(e,t.fallthrough[B],s,i);if(z)return z}}}function so(e){var t=typeof e=="string"?e:Ln[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,s){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(R?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(R?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!s&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(M&&e.keyCode==34&&e.char)return!1;var s=Ln[e.keyCode];return s==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(s=e.code),oo(s,e,t))}function na(e){return typeof e=="string"?xn[e]:e}function li(e,t){for(var s=e.doc.sel.ranges,i=[],d=0;d<s.length;d++){for(var B=t(s[d]);i.length&&nt(B.from,Ee(i).to)<=0;){var z=i.pop();if(nt(z.from,B.from)<0){B.from=z.from;break}}i.push(B)}$r(e,function(){for(var $=i.length-1;$>=0;$--)ai(e.doc,"",i[$].from,i[$].to,"+delete");ei(e)})}function Fa(e,t,s){var i=De(e.text,t+s,s);return i<0||i>e.text.length?null:i}function Ua(e,t,s){var i=Fa(e,t.ch,s);return i==null?null:new Je(t.line,i,s<0?"after":"before")}function Ba(e,t,s,i,d){if(e){t.doc.direction=="rtl"&&(d=-d);var B=Qe(s,t.doc.direction);if(B){var z=d<0?Ee(B):B[0],$=d<0==(z.level==1),Q=$?"after":"before",te;if(z.level>0||t.doc.direction=="rtl"){var ge=Jn(t,s);te=d<0?s.text.length-1:0;var be=fn(t,ge,te).top;te=Be(function(ke){return fn(t,ge,ke).top==be},d<0==(z.level==1)?z.from:z.to-1,te),Q=="before"&&(te=Fa(s,te,1))}else te=d<0?z.to:z.from;return new Je(i,te,Q)}}return new Je(i,d<0?s.text.length:0,d<0?"before":"after")}function Pl(e,t,s,i){var d=Qe(t,e.doc.direction);if(!d)return Ua(t,s,i);s.ch>=t.text.length?(s.ch=t.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var B=Ze(d,s.ch,s.sticky),z=d[B];if(e.doc.direction=="ltr"&&z.level%2==0&&(i>0?z.to>s.ch:z.from<s.ch))return Ua(t,s,i);var $=function(ot,ft){return Fa(t,ot instanceof Je?ot.ch:ot,ft)},Q,te=function(ot){return e.options.lineWrapping?(Q=Q||Jn(e,t),ds(e,t,Q,ot)):{begin:0,end:t.text.length}},ge=te(s.sticky=="before"?$(s,-1):s.ch);if(e.doc.direction=="rtl"||z.level==1){var be=z.level==1==i<0,ke=$(s,be?1:-1);if(ke!=null&&(be?ke<=z.to&&ke<=ge.end:ke>=z.from&&ke>=ge.begin)){var Re=be?"before":"after";return new Je(s.line,ke,Re)}}var We=function(ot,ft,lt){for(var gt=function(tr,Cr){return Cr?new Je(s.line,$(tr,1),"before"):new Je(s.line,tr,"after")};ot>=0&&ot<d.length;ot+=ft){var Tt=d[ot],_t=ft>0==(Tt.level!=1),Mt=_t?lt.begin:$(lt.end,-1);if(Tt.from<=Mt&&Mt<Tt.to)return gt(Mt,_t);if(Mt=_t?Tt.from:$(Tt.to,-1),lt.begin<=Mt&&Mt<lt.end)return gt(Mt,_t)}},$e=We(B+i,i,ge);if($e)return $e;var rt=i>0?ge.end:$(ge.begin,-1);return rt!=null&&!(i>0&&rt==t.text.length)&&($e=We(i>0?0:d.length-1,i,te(rt)),$e)?$e:null}var Mi={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ee)},killLine:function(e){return li(e,function(t){if(t.empty()){var s=mt(e.doc,t.head.line).text.length;return t.head.ch==s&&t.head.line<e.lastLine()?{from:t.head,to:Je(t.head.line+1,0)}:{from:t.head,to:Je(t.head.line,s)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return li(e,function(t){return{from:Je(t.from().line,0),to:St(e.doc,Je(t.to().line+1,0))}})},delLineLeft:function(e){return li(e,function(t){return{from:Je(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return li(e,function(t){var s=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:s},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return li(e,function(t){var s=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:s},"div");return{from:t.from(),to:i}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Je(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Je(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ho(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Ml(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var s=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:s},"div")},re)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var s=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:s},"div")},re)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var s=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:s},"div");return i.ch<e.getLine(i.line).search(/\S/)?ho(e,t.head):i},re)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],s=e.listSelections(),i=e.options.tabSize,d=0;d<s.length;d++){var B=s[d].from(),z=N(e.getLine(B.line),B.ch,i);t.push(ae(i-z%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return $r(e,function(){for(var t=e.listSelections(),s=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var d=t[i].head,B=mt(e.doc,d.line).text;if(B){if(d.ch==B.length&&(d=new Je(d.line,d.ch-1)),d.ch>0)d=new Je(d.line,d.ch+1),e.replaceRange(B.charAt(d.ch-1)+B.charAt(d.ch-2),Je(d.line,d.ch-2),d,"+transpose");else if(d.line>e.doc.first){var z=mt(e.doc,d.line-1).text;z&&(d=new Je(d.line,1),e.replaceRange(B.charAt(0)+e.doc.lineSeparator()+z.charAt(z.length-1),Je(d.line-1,z.length-1),d,"+transpose"))}}s.push(new $t(d,d))}e.setSelections(s)})},newlineAndIndent:function(e){return $r(e,function(){for(var t=e.listSelections(),s=t.length-1;s>=0;s--)e.replaceRange(e.doc.lineSeparator(),t[s].anchor,t[s].head,"+input");t=e.listSelections();for(var i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);ei(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var s=mt(e.doc,t),i=Dr(s);return i!=s&&(t=Dt(i)),Ba(!0,e,i,t,1)}function Ml(e,t){var s=mt(e.doc,t),i=wr(s);return i!=s&&(t=Dt(i)),Ba(!0,e,s,t,-1)}function ho(e,t){var s=uo(e,t.line),i=mt(e.doc,s.line),d=Qe(i,e.doc.direction);if(!d||d[0].level==0){var B=Math.max(s.ch,i.text.search(/\S/)),z=t.line==s.line&&t.ch<=B&&t.ch;return Je(s.line,z?0:B,s.sticky)}return s}function ia(e,t,s){if(typeof t=="string"&&(t=Mi[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,d=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),s&&(e.display.shift=!1),d=t(e)!=J}finally{e.display.shift=i,e.state.suppressEdits=!1}return d}function Nl(e,t,s){for(var i=0;i<e.state.keyMaps.length;i++){var d=oi(t,e.state.keyMaps[i],s,e);if(d)return d}return e.options.extraKeys&&oi(t,e.options.extraKeys,s,e)||oi(t,e.options.keyMap,s,e)}var Fl=new U;function Ni(e,t,s,i){var d=e.state.keySeq;if(d){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==d&&(e.state.keySeq=null,e.display.input.reset())}),co(e,d+" "+t,s,i))return!0}return co(e,t,s,i)}function co(e,t,s,i){var d=Nl(e,t,i);return d=="multi"&&(e.state.keySeq=t),d=="handled"&&Ir(e,"keyHandled",e,t,s),(d=="handled"||d=="multi")&&(ne(s),xa(e)),!!d}function fo(e,t){var s=lo(t,!0);return s?t.shiftKey&&!e.state.keySeq?Ni(e,"Shift-"+s,t,function(i){return ia(e,i,!0)})||Ni(e,s,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return ia(e,i)}):Ni(e,s,t,function(i){return ia(e,i)}):!1}function Ul(e,t,s){return Ni(e,"'"+s+"'",t,function(i){return ia(e,i,!0)})}var Ha=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=v(),Ve(t,e))return;F&&W<11&&e.keyCode==27&&(e.returnValue=!1);var s=e.keyCode;t.display.shift=s==16||e.shiftKey;var i=fo(t,e);M&&(Ha=i?s:null,!i&&s==88&&!Nt&&(_?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),ce&&!_&&!i&&s==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),s==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;l(t,"CodeMirror-crosshair");function s(i){(i.keyCode==18||!i.altKey)&&(k(t,"CodeMirror-crosshair"),ht(document,"keyup",s),ht(document,"mouseover",s))}Ne(document,"keyup",s),Ne(document,"mouseover",s)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ve(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(En(t.display,e)||Ve(t,e)||e.ctrlKey&&!e.altKey||_&&e.metaKey)return;var s=e.keyCode,i=e.charCode;if(M&&s==Ha){Ha=null,ne(e);return}if(M&&(!e.which||e.which<10)&&fo(t,e))return;var d=String.fromCharCode(i==null?s:i);if(d=="\b")return;if(Ul(t,e,d))return;t.display.input.onKeyPress(e)}var Hl=400,ja=function(e,t,s){this.time=e,this.pos=t,this.button=s};ja.prototype.compare=function(e,t,s){return this.time+Hl>e&&nt(t,this.pos)==0&&s==this.button};var Fi,Ui;function jl(e,t){var s=+new Date;return Ui&&Ui.compare(s,e,t)?(Fi=Ui=null,"triple"):Fi&&Fi.compare(s,e,t)?(Ui=new ja(s,e,t),Fi=null,"double"):(Fi=new ja(s,e,t),Ui=null,"single")}function vo(e){var t=this,s=t.display;if(Ve(t,e)||s.activeTouch&&s.input.supportsTouch())return;if(s.input.ensurePolled(),s.shift=e.shiftKey,En(s,e)){r||(s.scroller.draggable=!1,setTimeout(function(){return s.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=Un(t,e),d=Me(e),B=i?jl(i,d):"single";if(window.focus(),d==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,d,i,B,e))return;d==1?i?Kl(t,i,B,e):we(e)==s.scroller&&ne(e):d==2?(i&&Qi(t.doc,i),setTimeout(function(){return s.input.focus()},20)):d==3&&(x?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,s,i,d){var B="Click";return i=="double"?B="Double"+B:i=="triple"&&(B="Triple"+B),B=(t==1?"Left":t==2?"Middle":"Right")+B,Ni(e,oo(B,d),d,function(z){if(typeof z=="string"&&(z=Mi[z]),!z)return!1;var $=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),$=z(e,s)!=J}finally{e.state.suppressEdits=!1}return $})}function Gl(e,t,s){var i=e.getOption("configureMouse"),d=i?i(e,t,s):{};if(d.unit==null){var B=f?s.shiftKey&&s.metaKey:s.altKey;d.unit=B?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(d.extend==null||e.doc.extend)&&(d.extend=e.doc.extend||s.shiftKey),d.addNew==null&&(d.addNew=_?s.metaKey:s.ctrlKey),d.moveOnDrag==null&&(d.moveOnDrag=!(_?s.altKey:s.ctrlKey)),d}function Kl(e,t,s,i){F?setTimeout(h(gs,e),0):e.curOp.focus=v();var d=Gl(e,s,i),B=e.doc.sel,z;e.options.dragDrop&&je&&!e.isReadOnly()&&s=="single"&&(z=B.contains(t))>-1&&(nt((z=B.ranges[z]).from(),t)<0||t.xRel>0)&&(nt(z.to(),t)>0||t.xRel<0)?zl(e,i,t,d):Vl(e,i,t,d)}function zl(e,t,s,i){var d=e.display,B=!1,z=Tr(e,function(te){r&&(d.scroller.draggable=!1),e.state.draggingText=!1,ht(d.wrapper.ownerDocument,"mouseup",z),ht(d.wrapper.ownerDocument,"mousemove",$),ht(d.scroller,"dragstart",Q),ht(d.scroller,"drop",z),B||(ne(te),i.addNew||Qi(e.doc,s,null,null,i.extend),r&&!g||F&&W==9?setTimeout(function(){d.wrapper.ownerDocument.body.focus({preventScroll:!0}),d.input.focus()},20):d.input.focus())}),$=function(te){B=B||Math.abs(t.clientX-te.clientX)+Math.abs(t.clientY-te.clientY)>=10},Q=function(){return B=!0};r&&(d.scroller.draggable=!0),e.state.draggingText=z,z.copy=!i.moveOnDrag,d.scroller.dragDrop&&d.scroller.dragDrop(),Ne(d.wrapper.ownerDocument,"mouseup",z),Ne(d.wrapper.ownerDocument,"mousemove",$),Ne(d.scroller,"dragstart",Q),Ne(d.scroller,"drop",z),vs(e),setTimeout(function(){return d.input.focus()},20)}function yo(e,t,s){if(s=="char")return new $t(t,t);if(s=="word")return e.findWordAt(t);if(s=="line")return new $t(Je(t.line,0),St(e.doc,Je(t.line+1,0)));var i=s(e,t);return new $t(i.from,i.to)}function Vl(e,t,s,i){var d=e.display,B=e.doc;ne(t);var z,$,Q=B.sel,te=Q.ranges;if(i.addNew&&!i.extend?($=B.sel.contains(s),$>-1?z=te[$]:z=new $t(s,s)):(z=B.sel.primary(),$=B.sel.primIndex),i.unit=="rectangle")i.addNew||(z=new $t(s,s)),s=Un(e,t,!0,!0),$=-1;else{var ge=yo(e,s,i.unit);i.extend?z=Ma(z,ge.anchor,ge.head,i.extend):z=ge}i.addNew?$==-1?($=te.length,Mr(B,sn(e,te.concat([z]),$),{scroll:!1,origin:"*mouse"})):te.length>1&&te[$].empty()&&i.unit=="char"&&!i.extend?(Mr(B,sn(e,te.slice(0,$).concat(te.slice($+1)),0),{scroll:!1,origin:"*mouse"}),Q=B.sel):Na(B,$,z,ie):($=0,Mr(B,new qr([z],0),ie),Q=B.sel);var be=s;function ke(lt){if(nt(be,lt)==0)return;if(be=lt,i.unit=="rectangle"){for(var gt=[],Tt=e.options.tabSize,_t=N(mt(B,s.line).text,s.ch,Tt),Mt=N(mt(B,lt.line).text,lt.ch,Tt),tr=Math.min(_t,Mt),Cr=Math.max(_t,Mt),lr=Math.min(s.line,lt.line),Jr=Math.min(e.lastLine(),Math.max(s.line,lt.line));lr<=Jr;lr++){var Kr=mt(B,lr).text,gr=he(Kr,tr,Tt);tr==Cr?gt.push(new $t(Je(lr,gr),Je(lr,gr))):Kr.length>gr&>.push(new $t(Je(lr,gr),Je(lr,he(Kr,Cr,Tt))))}gt.length||gt.push(new $t(s,s)),Mr(B,sn(e,Q.ranges.slice(0,$).concat(gt),$),{origin:"*mouse",scroll:!1}),e.scrollIntoView(lt)}else{var zr=z,Lr=yo(e,lt,i.unit),Er=zr.anchor,vr;nt(Lr.anchor,Er)>0?(vr=Lr.head,Er=br(zr.from(),Lr.anchor)):(vr=Lr.anchor,Er=Pt(zr.to(),Lr.head));var hr=Q.ranges.slice(0);hr[$]=Yl(e,new $t(St(B,Er),vr)),Mr(B,sn(e,hr,$),ie)}}var Re=d.wrapper.getBoundingClientRect(),We=0;function $e(lt){var gt=++We,Tt=Un(e,lt,!0,i.unit=="rectangle");if(!Tt)return;if(nt(Tt,be)!=0){e.curOp.focus=v(),ke(Tt);var _t=Vi(d,B);(Tt.line>=_t.to||Tt.line<_t.from)&&setTimeout(Tr(e,function(){We==gt&&$e(lt)}),150)}else{var Mt=lt.clientY<Re.top?-20:lt.clientY>Re.bottom?20:0;Mt&&setTimeout(Tr(e,function(){if(We!=gt)return;d.scroller.scrollTop+=Mt,$e(lt)}),50)}}function rt(lt){e.state.selectingText=!1,We=Infinity,lt&&(ne(lt),d.input.focus()),ht(d.wrapper.ownerDocument,"mousemove",ot),ht(d.wrapper.ownerDocument,"mouseup",ft),B.history.lastSelOrigin=null}var ot=Tr(e,function(lt){lt.buttons===0||!Me(lt)?rt(lt):$e(lt)}),ft=Tr(e,rt);e.state.selectingText=ft,Ne(d.wrapper.ownerDocument,"mousemove",ot),Ne(d.wrapper.ownerDocument,"mouseup",ft)}function Yl(e,t){var s=t.anchor,i=t.head,d=mt(e.doc,s.line);if(nt(s,i)==0&&s.sticky==i.sticky)return t;var B=Qe(d);if(!B)return t;var z=Ze(B,s.ch,s.sticky),$=B[z];if($.from!=s.ch&&$.to!=s.ch)return t;var Q=z+($.from==s.ch==($.level!=1)?0:1);if(Q==0||Q==B.length)return t;var te;if(i.line!=s.line)te=(i.line-s.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ge=Ze(B,i.ch,i.sticky),be=ge-z||(i.ch-s.ch)*($.level==1?-1:1);ge==Q-1||ge==Q?te=be<0:te=be>0}var ke=B[Q+(te?-1:0)],Re=te==(ke.level==1),We=Re?ke.from:ke.to,$e=Re?"after":"before";return s.ch==We&&s.sticky==$e?t:new $t(new Je(s.line,We,$e),i)}function bo(e,t,s,i){var d,B;if(t.touches)d=t.touches[0].clientX,B=t.touches[0].clientY;else try{d=t.clientX,B=t.clientY}catch(ke){return!1}if(d>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&ne(t);var z=e.display,$=z.lineDiv.getBoundingClientRect();if(B>$.bottom||!_e(e,s))return fe(t);B-=$.top-z.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=z.gutters.childNodes[Q];if(te&&te.getBoundingClientRect().right>=d){var ge=dr(e.doc,B),be=e.display.gutterSpecs[Q];return Ue(e,s,e,ge,be.className,t),fe(t)}}}function Wa(e,t){return bo(e,t,"gutterClick",!0)}function _o(e,t){if(En(e.display,t)||Xl(e,t))return;if(Ve(e,t,"contextmenu"))return;x||e.display.input.onContextMenu(t)}function Xl(e,t){return _e(e,"gutterContextMenu")?bo(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yi(e)}var ui={toString:function(){return"CodeMirror.Init"}},xo={},aa={};function $l(e){var t=e.optionHandlers;function s(i,d,B,z){e.defaults[i]=d,B&&(t[i]=z?function($,Q,te){te!=ui&&B($,Q,te)}:B)}e.defineOption=s,e.Init=ui,s("value","",function(i,d){return i.setValue(d)},!0),s("mode",null,function(i,d){i.doc.modeOption=d,ka(i)},!0),s("indentUnit",2,ka,!0),s("indentWithTabs",!1),s("smartIndent",!0),s("tabSize",4,function(i){Ci(i),yi(i),Wr(i)},!0),s("lineSeparator",null,function(i,d){if(i.doc.lineSep=d,!d)return;var B=[],z=i.doc.first;i.doc.iter(function(Q){for(var te=0;;){var ge=Q.text.indexOf(d,te);if(ge==-1)break;te=ge+d.length,B.push(Je(z,ge))}z++});for(var $=B.length-1;$>=0;$--)ai(i.doc,d,B[$],Je(B[$].line,B[$].ch+d.length))}),s("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,d,B){i.state.specialChars=new RegExp(d.source+(d.test(" ")?"":"| "),"g"),B!=ui&&i.refresh()}),s("specialCharPlaceholder",er,function(i){return i.refresh()},!0),s("electricChars",!0),s("inputStyle",E?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),s("spellcheck",!1,function(i,d){return i.getInputField().spellcheck=d},!0),s("autocorrect",!1,function(i,d){return i.getInputField().autocorrect=d},!0),s("autocapitalize",!1,function(i,d){return i.getInputField().autocapitalize=d},!0),s("rtlMoveVisually",!O),s("wholeLineUpdateBefore",!0),s("theme","default",function(i){Eo(i),Si(i)},!0),s("keyMap","default",function(i,d,B){var z=na(d),$=B!=ui&&na(B);$&&$.detach&&$.detach(i,z),z.attach&&z.attach(i,$||null)}),s("extraKeys",null),s("configureMouse",null),s("lineWrapping",!1,Zl,!0),s("gutters",[],function(i,d){i.display.gutterSpecs=Ia(d,i.options.lineNumbers),Si(i)},!0),s("fixedGutter",!0,function(i,d){i.display.gutters.style.left=d?_a(i.display)+"px":"0",i.refresh()},!0),s("coverGutterNextToScrollbar",!1,function(i){return ti(i)},!0),s("scrollbarStyle","native",function(i){ws(i),ti(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),s("lineNumbers",!1,function(i,d){i.display.gutterSpecs=Ia(i.options.gutters,d),Si(i)},!0),s("firstLineNumber",1,Si,!0),s("lineNumberFormatter",function(i){return i},Si,!0),s("showCursorWhenSelecting",!1,bi,!0),s("resetSelectionOnContextMenu",!0),s("lineWiseCopyCut",!0),s("pasteLinesPerSelection",!0),s("selectionsMayTouch",!1),s("readOnly",!1,function(i,d){d=="nocursor"&&(qn(i),i.display.input.blur()),i.display.input.readOnlyChanged(d)}),s("screenReaderLabel",null,function(i,d){d=d===""?null:d,i.display.input.screenReaderLabelChanged(d)}),s("disableInput",!1,function(i,d){d||i.display.input.reset()},!0),s("dragDrop",!0,Jl),s("allowDropFileTypes",null),s("cursorBlinkRate",530),s("cursorScrollMargin",0),s("cursorHeight",1,bi,!0),s("singleCursorHeightPerLine",!0,bi,!0),s("workTime",100),s("workDelay",100),s("flattenSpans",!0,Ci,!0),s("addModeClass",!1,Ci,!0),s("pollInterval",100),s("undoDepth",200,function(i,d){return i.doc.history.undoDepth=d}),s("historyEventDelay",1250),s("viewportMargin",10,function(i){return i.refresh()},!0),s("maxHighlightLength",1e4,Ci,!0),s("moveInputWithCursor",!0,function(i,d){d||i.display.input.resetPosition()}),s("tabindex",null,function(i,d){return i.display.input.getField().tabIndex=d||""}),s("autofocus",null),s("direction","ltr",function(i,d){return i.doc.setDirection(d)},!0),s("phrases",null)}function Jl(e,t,s){var i=s&&s!=ui;if(!t!=!i){var d=e.display.dragFunctions,B=t?Ne:ht;B(e.display.scroller,"dragstart",d.start),B(e.display.scroller,"dragenter",d.enter),B(e.display.scroller,"dragover",d.over),B(e.display.scroller,"dragleave",d.leave),B(e.display.scroller,"drop",d.drop)}}function Zl(e){e.options.lineWrapping?(l(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(k(e.display.wrapper,"CodeMirror-wrap"),Hi(e)),Ea(e),Wr(e),yi(e),setTimeout(function(){return ti(e)},100)}function ir(e,t){var s=this;if(!(this instanceof ir))return new ir(e,t);this.options=t=t?n(t):{},n(xo,t,!1);var i=t.value;typeof i=="string"?i=new Gr(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var d=new ir.inputStyles[t.inputStyle](this),B=this.display=new hl(e,i,d,t);B.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ws(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new U,keySeq:null,specialChars:null},t.autofocus&&!E&&B.input.focus(),F&&W<11&&setTimeout(function(){return s.display.input.reset(!0)},20),Ql(this),Ol(),Wn(this),this.curOp.forceUpdate=!0,Ds(this,i),t.autofocus&&!E||this.hasFocus()?setTimeout(function(){s.hasFocus()&&!s.state.focused&&wa(s)},20):qn(this);for(var z in aa)aa.hasOwnProperty(z)&&aa[z](this,t[z],ui);Cs(this),t.finishInit&&t.finishInit(this);for(var $=0;$<Ga.length;++$)Ga[$](this);Gn(this),r&&t.lineWrapping&&getComputedStyle(B.lineDiv).textRendering=="optimizelegibility"&&(B.lineDiv.style.textRendering="auto")}ir.defaults=xo,ir.optionHandlers=aa;function Ql(e){var t=e.display;Ne(t.scroller,"mousedown",Tr(e,vo)),F&&W<11?Ne(t.scroller,"dblclick",Tr(e,function(Q){if(Ve(e,Q))return;var te=Un(e,Q);if(!te||Wa(e,Q)||En(e.display,Q))return;ne(Q);var ge=e.findWordAt(te);Qi(e.doc,ge.anchor,ge.head)})):Ne(t.scroller,"dblclick",function(Q){return Ve(e,Q)||ne(Q)}),Ne(t.scroller,"contextmenu",function(Q){return _o(e,Q)}),Ne(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||_o(e,Q)});var s,i={end:0};function d(){t.activeTouch&&(s=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function B(Q){if(Q.touches.length!=1)return!1;var te=Q.touches[0];return te.radiusX<=1&&te.radiusY<=1}function z(Q,te){if(te.left==null)return!0;var ge=te.left-Q.left,be=te.top-Q.top;return ge*ge+be*be>20*20}Ne(t.scroller,"touchstart",function(Q){if(!Ve(e,Q)&&!B(Q)&&!Wa(e,Q)){t.input.ensurePolled(),clearTimeout(s);var te=+new Date;t.activeTouch={start:te,moved:!1,prev:te-i.end<=300?i:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Ne(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ne(t.scroller,"touchend",function(Q){var te=t.activeTouch;if(te&&!En(t,Q)&&te.left!=null&&!te.moved&&new Date-te.start<300){var ge=e.coordsChar(t.activeTouch,"page"),be;!te.prev||z(te,te.prev)?be=new $t(ge,ge):!te.prev.prev||z(te,te.prev.prev)?be=e.findWordAt(ge):be=new $t(Je(ge.line,0),St(e.doc,Je(ge.line+1,0))),e.setSelection(be.anchor,be.head),e.focus(),ne(Q)}d()}),Ne(t.scroller,"touchcancel",d),Ne(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ei(e,t.scroller.scrollTop),Hn(e,t.scroller.scrollLeft,!0),Ue(e,"scroll",e))}),Ne(t.scroller,"mousewheel",function(Q){return Os(e,Q)}),Ne(t.scroller,"DOMMouseScroll",function(Q){return Os(e,Q)}),Ne(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){Ve(e,Q)||me(Q)},over:function(Q){Ve(e,Q)||(Rl(e,Q),me(Q))},start:function(Q){return Al(e,Q)},drop:Tr(e,Cl),leave:function(Q){Ve(e,Q)||no(e)}};var $=t.input.getField();Ne($,"keyup",function(Q){return mo.call(e,Q)}),Ne($,"keydown",Tr(e,po)),Ne($,"keypress",Tr(e,go)),Ne($,"focus",function(Q){return wa(e,Q)}),Ne($,"blur",function(Q){return qn(e,Q)})}var Ga=[];ir.defineInitHook=function(e){return Ga.push(e)};function Bi(e,t,s,i){var d=e.doc,B;s==null&&(s="add"),s=="smart"&&(d.mode.indent?B=pe(e,t).state:s="prev");var z=e.options.tabSize,$=mt(d,t),Q=N($.text,null,z);$.stateAfter&&($.stateAfter=null);var te=$.text.match(/^\s*/)[0],ge;if(!i&&!/\S/.test($.text))ge=0,s="not";else if(s=="smart"&&(ge=d.mode.indent(B,$.text.slice(te.length),$.text),ge==J||ge>150)){if(!i)return;s="prev"}s=="prev"?t>d.first?ge=N(mt(d,t-1).text,null,z):ge=0:s=="add"?ge=Q+e.options.indentUnit:s=="subtract"?ge=Q-e.options.indentUnit:typeof s=="number"&&(ge=Q+s),ge=Math.max(0,ge);var be="",ke=0;if(e.options.indentWithTabs)for(var Re=Math.floor(ge/z);Re;--Re)ke+=z,be+=" ";if(ke<ge&&(be+=ae(ge-ke)),be!=te)return ai(d,be,Je(t,0),Je(t,te.length),"+input"),$.stateAfter=null,!0;for(var We=0;We<d.sel.ranges.length;We++){var $e=d.sel.ranges[We];if($e.head.line==t&&$e.head.ch<te.length){var rt=Je(t,te.length);Na(d,We,new $t(rt,rt));break}}}var on=null;function sa(e){on=e}function Ka(e,t,s,i,d){var B=e.doc;e.display.shift=!1,i||(i=B.sel);var z=+new Date-200,$=d=="paste"||e.state.pasteIncoming>z,Q=Ct(t),te=null;if($&&i.ranges.length>1)if(on&&on.text.join(`
|
|
`)==t){if(i.ranges.length%on.text.length==0){te=[];for(var ge=0;ge<on.text.length;ge++)te.push(B.splitLines(on.text[ge]))}}else Q.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(te=Le(Q,function(ot){return[ot]}));for(var be=e.curOp.updateInput,ke=i.ranges.length-1;ke>=0;ke--){var Re=i.ranges[ke],We=Re.from(),$e=Re.to();Re.empty()&&(s&&s>0?We=Je(We.line,We.ch-s):e.state.overwrite&&!$?$e=Je($e.line,Math.min(mt(B,$e.line).text.length,$e.ch+Ee(Q).length)):$&&on&&on.lineWise&&on.text.join(`
|
|
`)==Q.join(`
|
|
`)&&(We=$e=Je(We.line,0)));var rt={from:We,to:$e,text:te?te[ke%te.length]:Q,origin:d||($?"paste":e.state.cutIncoming>z?"cut":"+input")};ii(e.doc,rt),Ir(e,"inputRead",e,rt)}t&&!$&&To(e,t),ei(e),e.curOp.updateInput<2&&(e.curOp.updateInput=be),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function wo(e,t){var s=e.clipboardData&&e.clipboardData.getData("Text");if(s)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&$r(t,function(){return Ka(t,s,0,null,"paste")}),!0}function To(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var s=e.doc.sel,i=s.ranges.length-1;i>=0;i--){var d=s.ranges[i];if(d.head.ch>100||i&&s.ranges[i-1].head.line==d.head.line)continue;var B=e.getModeAt(d.head),z=!1;if(B.electricChars){for(var $=0;$<B.electricChars.length;$++)if(t.indexOf(B.electricChars.charAt($))>-1){z=Bi(e,d.head.line,"smart");break}}else B.electricInput&&(B.electricInput.test(mt(e.doc,d.head.line).text.slice(0,d.head.ch))&&(z=Bi(e,d.head.line,"smart")));z&&Ir(e,"electricInput",e,d.head.line)}}function So(e){for(var t=[],s=[],i=0;i<e.doc.sel.ranges.length;i++){var d=e.doc.sel.ranges[i].head.line,B={anchor:Je(d,0),head:Je(d+1,0)};s.push(B),t.push(e.getRange(B.anchor,B.head))}return{text:t,ranges:s}}function Co(e,t,s,i){e.setAttribute("autocorrect",s?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function Ao(){var e=S("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=S("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return r?e.style.width="1000px":e.setAttribute("wrap","off"),m&&(e.style.border="1px solid black"),Co(e),t}function ql(e){var t=e.optionHandlers,s=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(i,d){var B=this.options,z=B[i];if(B[i]==d&&i!="mode")return;B[i]=d,t.hasOwnProperty(i)&&Tr(this,t[i])(this,d,z),Ue(this,"optionChange",this,i)},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,d){this.state.keyMaps[d?"push":"unshift"](na(i))},removeKeyMap:function(i){for(var d=this.state.keyMaps,B=0;B<d.length;++B)if(d[B]==i||d[B].name==i)return d.splice(B,1),!0},addOverlay:Ur(function(i,d){var B=i.token?i:e.getMode(this.options,i);if(B.startState)throw new Error("Overlays may not be stateful.");Fe(this.state.overlays,{mode:B,modeSpec:i,opaque:d&&d.opaque,priority:d&&d.priority||0},function(z){return z.priority}),this.state.modeGen++,Wr(this)}),removeOverlay:Ur(function(i){for(var d=this.state.overlays,B=0;B<d.length;++B){var z=d[B].modeSpec;if(z==i||typeof i=="string"&&z.name==i){d.splice(B,1),this.state.modeGen++,Wr(this);return}}}),indentLine:Ur(function(i,d,B){typeof d!="string"&&typeof d!="number"&&(d==null?d=this.options.smartIndent?"smart":"prev":d=d?"add":"subtract"),yr(this.doc,i)&&Bi(this,i,d,B)}),indentSelection:Ur(function(i){for(var d=this.doc.sel.ranges,B=-1,z=0;z<d.length;z++){var $=d[z];if($.empty())$.head.line>B&&(Bi(this,$.head.line,i,!0),B=$.head.line,z==this.doc.sel.primIndex&&ei(this));else{var Q=$.from(),te=$.to(),ge=Math.max(B,Q.line);B=Math.min(this.lastLine(),te.line-(te.ch?0:1))+1;for(var be=ge;be<B;++be)Bi(this,be,i);var ke=this.doc.sel.ranges;Q.ch==0&&d.length==ke.length&&ke[z].from().ch>0&&Na(this.doc,z,new $t(Q,ke[z].to()),ee)}}}),getTokenAt:function(i,d){return yt(this,i,d)},getLineTokens:function(i,d){return yt(this,Je(i),d,!0)},getTokenTypeAt:function(i){i=St(this.doc,i);var d=K(this,mt(this.doc,i.line)),B=0,z=(d.length-1)/2,$=i.ch,Q;if($==0)Q=d[2];else for(;;){var te=B+z>>1;if((te?d[te*2-1]:0)>=$)z=te;else if(d[te*2+1]<$)B=te+1;else{Q=d[te*2+2];break}}var ge=Q?Q.indexOf("overlay "):-1;return ge<0?Q:ge==0?null:Q.slice(0,ge-1)},getModeAt:function(i){var d=this.doc.mode;return d.innerMode?e.innerMode(d,this.getTokenAt(i).state).mode:d},getHelper:function(i,d){return this.getHelpers(i,d)[0]},getHelpers:function(i,d){var B=[];if(!s.hasOwnProperty(d))return B;var z=s[d],$=this.getModeAt(i);if(typeof $[d]=="string")z[$[d]]&&B.push(z[$[d]]);else if($[d])for(var Q=0;Q<$[d].length;Q++){var te=z[$[d][Q]];te&&B.push(te)}else $.helperType&&z[$.helperType]?B.push(z[$.helperType]):z[$.name]&&B.push(z[$.name]);for(var ge=0;ge<z._global.length;ge++){var be=z._global[ge];be.pred($,this)&&j(B,be.val)==-1&&B.push(be.val)}return B},getStateAfter:function(i,d){var B=this.doc;return i=Xr(B,i==null?B.first+B.size-1:i),pe(this,i+1,d).state},cursorCoords:function(i,d){var B,z=this.doc.sel.primary();return i==null?B=z.head:typeof i=="object"?B=St(this.doc,i):B=i?z.from():z.to(),an(this,B,d||"page")},charCoords:function(i,d){return ma(this,St(this.doc,i),d||"page")},coordsChar:function(i,d){return i=ls(this,i,d||"page"),va(this,i.left,i.top)},lineAtHeight:function(i,d){return i=ls(this,{top:i,left:0},d||"page").top,dr(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,d,B){var z=!1,$;if(typeof i=="number"){var Q=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>Q&&(i=Q,z=!0),$=mt(this.doc,i)}else $=i;return Wi(this,$,{top:0,left:0},d||"page",B||z).top+(z?this.doc.height-nn($):0)},defaultTextHeight:function(){return Zn(this.display)},defaultCharWidth:function(){return Qn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,d,B,z,$){var Q=this.display;i=an(this,St(this.doc,i));var te=i.bottom,ge=i.left;if(d.style.position="absolute",d.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(d),Q.sizer.appendChild(d),z=="over")te=i.top;else if(z=="above"||z=="near"){var be=Math.max(Q.wrapper.clientHeight,this.doc.height),ke=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(z=="above"||i.bottom+d.offsetHeight>be)&&i.top>d.offsetHeight?te=i.top-d.offsetHeight:i.bottom+d.offsetHeight<=be&&(te=i.bottom),ge+d.offsetWidth>ke&&(ge=ke-d.offsetWidth)}d.style.top=te+"px",d.style.left=d.style.right="",$=="right"?(ge=Q.sizer.clientWidth-d.offsetWidth,d.style.right="0px"):($=="left"?ge=0:$=="middle"&&(ge=(Q.sizer.clientWidth-d.offsetWidth)/2),d.style.left=ge+"px"),B&&Jo(this,{left:ge,top:te,right:ge+d.offsetWidth,bottom:te+d.offsetHeight})},triggerOnKeyDown:Ur(po),triggerOnKeyPress:Ur(go),triggerOnKeyUp:mo,triggerOnMouseDown:Ur(vo),execCommand:function(i){if(Mi.hasOwnProperty(i))return Mi[i].call(null,this)},triggerElectric:Ur(function(i){To(this,i)}),findPosH:function(i,d,B,z){var $=1;d<0&&($=-1,d=-d);for(var Q=St(this.doc,i),te=0;te<d&&!(Q=za(this.doc,Q,$,B,z),Q.hitSide);++te);return Q},moveH:Ur(function(i,d){var B=this;this.extendSelectionsBy(function(z){return B.display.shift||B.doc.extend||z.empty()?za(B.doc,z.head,i,d,B.options.rtlMoveVisually):i<0?z.from():z.to()},re)}),deleteH:Ur(function(i,d){var B=this.doc.sel,z=this.doc;B.somethingSelected()?z.replaceSelection("",null,"+delete"):li(this,function($){var Q=za(z,$.head,i,d,!1);return i<0?{from:Q,to:$.head}:{from:$.head,to:Q}})}),findPosV:function(i,d,B,z){var $=1,Q=z;d<0&&($=-1,d=-d);for(var te=St(this.doc,i),ge=0;ge<d;++ge){var be=an(this,te,"div");if(Q==null?Q=be.left:be.left=Q,te=Ro(this,be,$,B),te.hitSide)break}return te},moveV:Ur(function(i,d){var B=this,z=this.doc,$=[],Q=!this.display.shift&&!z.extend&&z.sel.somethingSelected();if(z.extendSelectionsBy(function(ge){if(Q)return i<0?ge.from():ge.to();var be=an(B,ge.head,"div");ge.goalColumn!=null&&(be.left=ge.goalColumn),$.push(be.left);var ke=Ro(B,be,i,d);return d=="page"&&ge==z.sel.primary()&&Sa(B,ma(B,ke,"div").top-be.top),ke},re),$.length)for(var te=0;te<z.sel.ranges.length;te++)z.sel.ranges[te].goalColumn=$[te]}),findWordAt:function(i){var d=this.doc,B=mt(d,i.line).text,z=i.ch,$=i.ch;if(B){var Q=this.getHelper(i,"wordChars");(i.sticky=="before"||$==B.length)&&z?--z:++$;for(var te=B.charAt(z),ge=Ke(te,Q)?function(be){return Ke(be,Q)}:/\s/.test(te)?function(be){return/\s/.test(be)}:function(be){return!/\s/.test(be)&&!Ke(be)};z>0&&ge(B.charAt(z-1));)--z;for(;$<B.length&&ge(B.charAt($));)++$}return new $t(Je(i.line,z),Je(i.line,$))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?l(this.display.cursorDiv,"CodeMirror-overwrite"):k(this.display.cursorDiv,"CodeMirror-overwrite"),Ue(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==v()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Ur(function(i,d){_i(this,i,d)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-cn(this)-this.display.barHeight,width:i.scrollWidth-cn(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Nn(this)}},scrollIntoView:Ur(function(i,d){i==null?(i={from:this.doc.sel.primary().head,to:null},d==null&&(d=this.options.cursorScrollMargin)):typeof i=="number"?i={from:Je(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=d||0,i.from.line!=null?Zo(this,i):bs(this,i.from,i.to,i.margin)}),setSize:Ur(function(i,d){var B=this,z=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};i!=null&&(this.display.wrapper.style.width=z(i)),d!=null&&(this.display.wrapper.style.height=z(d)),this.options.lineWrapping&&as(this);var $=this.display.viewFrom;this.doc.iter($,this.display.viewTo,function(Q){if(Q.widgets){for(var te=0;te<Q.widgets.length;te++)if(Q.widgets[te].noHScroll){Sn(B,$,"widget");break}}++$}),this.curOp.forceUpdate=!0,Ue(this,"refresh",this)}),operation:function(i){return $r(this,i)},startOperation:function(){return Wn(this)},endOperation:function(){return Gn(this)},refresh:Ur(function(){var i=this.display.cachedTextHeight;Wr(this),this.curOp.forceUpdate=!0,yi(this),_i(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(i==null||Math.abs(i-Zn(this.display))>.5||this.options.lineWrapping)&&Ea(this),Ue(this,"refresh",this)}),swapDoc:Ur(function(i){var d=this.doc;return d.cm=null,this.state.selectingText&&this.state.selectingText(),Ds(this,i),yi(this),this.display.input.reset(),_i(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,Ir(this,"swapDoc",this,d),d}),phrase:function(i){var d=this.options.phrases;return d&&Object.prototype.hasOwnProperty.call(d,i)?d[i]:i},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Te(e),e.registerHelper=function(i,d,B){s.hasOwnProperty(i)||(s[i]=e[i]={_global:[]}),s[i][d]=B},e.registerGlobalHelper=function(i,d,B,z){e.registerHelper(i,d,z),s[i]._global.push({pred:B,val:z})}}function za(e,t,s,i,d){var B=t,z=s,$=mt(e,t.line),Q=d&&e.direction=="rtl"?-s:s;function te(){var ft=t.line+Q;return ft<e.first||ft>=e.first+e.size?!1:(t=new Je(ft,t.ch,t.sticky),$=mt(e,ft))}function ge(ft){var lt;if(i=="codepoint"){var gt=$.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(gt)?lt=null:lt=new Je(t.line,Math.max(0,Math.min($.text.length,t.ch+s*(gt>=55296&><56320?2:1))),-s)}else d?lt=Pl(e.cm,$,t,s):lt=Ua($,t,s);if(lt==null)if(!ft&&te())t=Ba(d,e.cm,$,t.line,Q);else return!1;else t=lt;return!0}if(i=="char"||i=="codepoint")ge();else if(i=="column")ge(!0);else if(i=="word"||i=="group")for(var be=null,ke=i=="group",Re=e.cm&&e.cm.getHelper(t,"wordChars"),We=!0;!(s<0&&!ge(!We));We=!1){var $e=$.text.charAt(t.ch)||`
|
|
`,rt=Ke($e,Re)?"w":ke&&$e==`
|
|
`?"n":!ke||/\s/.test($e)?null:"p";if(ke&&!We&&!rt&&(rt="s"),be&&be!=rt){s<0&&(s=1,ge(),t.sticky="after");break}if(rt&&(be=rt),s>0&&!ge(!We))break}var ot=ea(e,t,B,z,!0);return Ot(B,ot)&&(ot.hitSide=!0),ot}function Ro(e,t,s,i){var d=e.doc,B=t.left,z;if(i=="page"){var $=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max($-.5*Zn(e.display),3);z=(s>0?t.bottom:t.top)+s*Q}else i=="line"&&(z=s>0?t.bottom+3:t.top-3);for(var te;!(te=va(e,B,z),!te.outside);){if(s<0?z<=0:z>=d.height){te.hitSide=!0;break}z+=s*5}return te}var Zt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new U,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Zt.prototype.init=function(e){var t=this,s=this,i=s.cm,d=s.div=e.lineDiv;Co(d,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function B($){for(var Q=$.target;Q;Q=Q.parentNode){if(Q==d)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Ne(d,"paste",function($){if(!B($)||Ve(i,$)||wo($,i))return;W<=11&&setTimeout(Tr(i,function(){return t.updateFromDOM()}),20)}),Ne(d,"compositionstart",function($){t.composing={data:$.data,done:!1}}),Ne(d,"compositionupdate",function($){t.composing||(t.composing={data:$.data,done:!1})}),Ne(d,"compositionend",function($){t.composing&&($.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ne(d,"touchstart",function(){return s.forceCompositionEnd()}),Ne(d,"input",function(){t.composing||t.readFromDOMSoon()});function z($){if(!B($)||Ve(i,$))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()}),$.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var Q=So(i);sa({lineWise:!0,text:Q.text}),$.type=="cut"&&i.operation(function(){i.setSelections(Q.ranges,0,ee),i.replaceSelection("",null,"cut")})}else return;if($.clipboardData){$.clipboardData.clearData();var te=on.text.join(`
|
|
`);if($.clipboardData.setData("Text",te),$.clipboardData.getData("Text")==te){$.preventDefault();return}}var ge=Ao(),be=ge.firstChild;i.display.lineSpace.insertBefore(ge,i.display.lineSpace.firstChild),be.value=on.text.join(`
|
|
`);var ke=document.activeElement;T(be),setTimeout(function(){i.display.lineSpace.removeChild(ge),ke.focus(),ke==d&&s.showPrimarySelection()},50)}Ne(d,"copy",z),Ne(d,"cut",z)},Zt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Zt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Zt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Zt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Zt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,s=t.doc.sel.primary(),i=s.from(),d=s.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||d.line<t.display.viewFrom){e.removeAllRanges();return}var B=oa(t,e.anchorNode,e.anchorOffset),z=oa(t,e.focusNode,e.focusOffset);if(B&&!B.bad&&z&&!z.bad&&nt(br(B,z),i)==0&&nt(Pt(B,z),d)==0)return;var $=t.display.view,Q=i.line>=t.display.viewFrom&&Oo(t,i)||{node:$[0].measure.map[2],offset:0},te=d.line<t.display.viewTo&&Oo(t,d);if(!te){var ge=$[$.length-1].measure,be=ge.maps?ge.maps[ge.maps.length-1]:ge.map;te={node:be[be.length-1],offset:be[be.length-2]-be[be.length-3]}}if(!Q||!te){e.removeAllRanges();return}var ke=e.rangeCount&&e.getRangeAt(0),Re;try{Re=c(Q.node,Q.offset,te.offset,te.node)}catch(We){}Re&&(!ce&&t.state.focused?(e.collapse(Q.node,Q.offset),Re.collapsed||(e.removeAllRanges(),e.addRange(Re))):(e.removeAllRanges(),e.addRange(Re)),ke&&e.anchorNode==null?e.addRange(ke):ce&&this.startGracePeriod()),this.rememberSelection()},Zt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Zt.prototype.showMultipleSelections=function(e){P(this.cm.display.cursorDiv,e.cursors),P(this.cm.display.selectionDiv,e.selection)},Zt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Zt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return o(this.div,t)},Zt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Zt.prototype.blur=function(){this.div.blur()},Zt.prototype.getField=function(){return this.div},Zt.prototype.supportsTouch=function(){return!0},Zt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():$r(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Zt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Zt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(b&&D&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var s=oa(t,e.anchorNode,e.anchorOffset),i=oa(t,e.focusNode,e.focusOffset);s&&i&&$r(t,function(){Mr(t.doc,An(s,i),ee),(s.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},Zt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,s=e.doc.sel.primary(),i=s.from(),d=s.to();if(i.ch==0&&i.line>e.firstLine()&&(i=Je(i.line-1,mt(e.doc,i.line-1).length)),d.ch==mt(e.doc,d.line).text.length&&d.line<e.lastLine()&&(d=Je(d.line+1,0)),i.line<t.viewFrom||d.line>t.viewTo-1)return!1;var B,z,$;i.line==t.viewFrom||(B=Bn(e,i.line))==0?(z=Dt(t.view[0].line),$=t.view[0].node):(z=Dt(t.view[B].line),$=t.view[B-1].node.nextSibling);var Q=Bn(e,d.line),te,ge;if(Q==t.view.length-1?(te=t.viewTo-1,ge=t.lineDiv.lastChild):(te=Dt(t.view[Q+1].line)-1,ge=t.view[Q+1].node.previousSibling),!$)return!1;for(var be=e.doc.splitLines(tu(e,$,ge,z,te)),ke=sr(e.doc,Je(z,0),Je(te,mt(e.doc,te).text.length));be.length>1&&ke.length>1;)if(Ee(be)==Ee(ke))be.pop(),ke.pop(),te--;else if(be[0]==ke[0])be.shift(),ke.shift(),z++;else break;for(var Re=0,We=0,$e=be[0],rt=ke[0],ot=Math.min($e.length,rt.length);Re<ot&&$e.charCodeAt(Re)==rt.charCodeAt(Re);)++Re;for(var ft=Ee(be),lt=Ee(ke),gt=Math.min(ft.length-(be.length==1?Re:0),lt.length-(ke.length==1?Re:0));We<gt&&ft.charCodeAt(ft.length-We-1)==lt.charCodeAt(lt.length-We-1);)++We;if(be.length==1&&ke.length==1&&z==i.line)for(;Re&&Re>i.ch&&ft.charCodeAt(ft.length-We-1)==lt.charCodeAt(lt.length-We-1);)Re--,We++;be[be.length-1]=ft.slice(0,ft.length-We).replace(/^\u200b+/,""),be[0]=be[0].slice(Re).replace(/\u200b+$/,"");var Tt=Je(z,Re),_t=Je(te,ke.length?Ee(ke).length-We:0);if(be.length>1||be[0]||nt(Tt,_t))return ai(e.doc,be,Tt,_t,"+input"),!0},Zt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Zt.prototype.reset=function(){this.forceCompositionEnd()},Zt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Zt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Zt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&$r(this.cm,function(){return Wr(e.cm)})},Zt.prototype.setUneditable=function(e){e.contentEditable="false"},Zt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Tr(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Zt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Zt.prototype.onContextMenu=function(){},Zt.prototype.resetPosition=function(){},Zt.prototype.needsContentAttribute=!0;function Oo(e,t){var s=fa(e,t.line);if(!s||s.hidden)return null;var i=mt(e.doc,t.line),d=es(s,i,t.line),B=Qe(i,e.doc.direction),z="left";if(B){var $=Ze(B,t.ch);z=$%2?"right":"left"}var Q=ns(d.map,t.ch,z);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function hi(e,t){return t&&(e.bad=!0),e}function tu(e,t,s,i,d){var B="",z=!1,$=e.doc.lineSeparator(),Q=!1;function te(Re){return function(We){return We.id==Re}}function ge(){z&&(B+=$,Q&&(B+=$),z=Q=!1)}function be(Re){Re&&(ge(),B+=Re)}function ke(Re){if(Re.nodeType==1){var We=Re.getAttribute("cm-text");if(We){be(We);return}var $e=Re.getAttribute("cm-marker"),rt;if($e){var ot=e.findMarks(Je(i,0),Je(d+1,0),te(+$e));ot.length&&(rt=ot[0].find(0))&&be(sr(e.doc,rt.from,rt.to).join($));return}if(Re.getAttribute("contenteditable")=="false")return;var ft=/^(pre|div|p|li|table|br)$/i.test(Re.nodeName);if(!/^br$/i.test(Re.nodeName)&&Re.textContent.length==0)return;ft&&ge();for(var lt=0;lt<Re.childNodes.length;lt++)ke(Re.childNodes[lt]);/^(pre|p)$/i.test(Re.nodeName)&&(Q=!0),ft&&(z=!0)}else Re.nodeType==3&&be(Re.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ke(t),t==s);)t=t.nextSibling,Q=!1;return B}function oa(e,t,s){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[s],!i)return hi(e.clipPos(Je(e.display.viewTo-1)),!0);t=null,s=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var d=0;d<e.display.view.length;d++){var B=e.display.view[d];if(B.node==i)return ru(B,t,s)}}function ru(e,t,s){var i=e.text.firstChild,d=!1;if(!t||!o(i,t))return hi(Je(Dt(e.line),0),!0);if(t==i&&(d=!0,t=i.childNodes[s],s=0,!t)){var B=e.rest?Ee(e.rest):e.line;return hi(Je(Dt(B),B.text.length),d)}var z=t.nodeType==3?t:null,$=t;for(!z&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(z=t.firstChild,s&&(s=z.nodeValue.length));$.parentNode!=i;)$=$.parentNode;var Q=e.measure,te=Q.maps;function ge(rt,ot,ft){for(var lt=-1;lt<(te?te.length:0);lt++)for(var gt=lt<0?Q.map:te[lt],Tt=0;Tt<gt.length;Tt+=3){var _t=gt[Tt+2];if(_t==rt||_t==ot){var Mt=Dt(lt<0?e.line:e.rest[lt]),tr=gt[Tt]+ft;return(ft<0||_t!=rt)&&(tr=gt[Tt+(ft?1:0)]),Je(Mt,tr)}}}var be=ge(z,$,s);if(be)return hi(be,d);for(var ke=$.nextSibling,Re=z?z.nodeValue.length-s:0;ke;ke=ke.nextSibling){if(be=ge(ke,ke.firstChild,0),be)return hi(Je(be.line,be.ch-Re),d);Re+=ke.textContent.length}for(var We=$.previousSibling,$e=s;We;We=We.previousSibling){if(be=ge(We,We.firstChild,-1),be)return hi(Je(be.line,be.ch+$e),d);$e+=We.textContent.length}}var cr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new U,this.hasSelection=!1,this.composing=null};cr.prototype.init=function(e){var t=this,s=this,i=this.cm;this.createField(e);var d=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),m&&(d.style.width="0px"),Ne(d,"input",function(){F&&W>=9&&t.hasSelection&&(t.hasSelection=null),s.poll()}),Ne(d,"paste",function(z){if(Ve(i,z)||wo(z,i))return;i.state.pasteIncoming=+new Date,s.fastPoll()});function B(z){if(Ve(i,z))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var $=So(i);sa({lineWise:!0,text:$.text}),z.type=="cut"?i.setSelections($.ranges,null,ee):(s.prevInput="",d.value=$.text.join(`
|
|
`),T(d))}else return;z.type=="cut"&&(i.state.cutIncoming=+new Date)}Ne(d,"cut",B),Ne(d,"copy",B),Ne(e.scroller,"paste",function(z){if(En(e,z)||Ve(i,z))return;if(!d.dispatchEvent){i.state.pasteIncoming=+new Date,s.focus();return}var $=new Event("paste");$.clipboardData=z.clipboardData,d.dispatchEvent($)}),Ne(e.lineSpace,"selectstart",function(z){En(e,z)||ne(z)}),Ne(d,"compositionstart",function(){var z=i.getCursor("from");s.composing&&s.composing.range.clear(),s.composing={start:z,range:i.markText(z,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Ne(d,"compositionend",function(){s.composing&&(s.poll(),s.composing.range.clear(),s.composing=null)})},cr.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},cr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},cr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,s=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var d=an(e,s.sel.primary().head,"div"),B=t.wrapper.getBoundingClientRect(),z=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,d.top+z.top-B.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,d.left+z.left-B.left))}return i},cr.prototype.showSelection=function(e){var t=this.cm,s=t.display;P(s.cursorDiv,e.cursors),P(s.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},cr.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var s=t.getSelection();this.textarea.value=s,t.state.focused&&T(this.textarea),F&&W>=9&&(this.hasSelection=s)}else e||(this.prevInput=this.textarea.value="",F&&W>=9&&(this.hasSelection=null))},cr.prototype.getField=function(){return this.textarea},cr.prototype.supportsTouch=function(){return!1},cr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!E||v()!=this.textarea))try{this.textarea.focus()}catch(e){}},cr.prototype.blur=function(){this.textarea.blur()},cr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},cr.prototype.receivedFocus=function(){this.slowPoll()},cr.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},cr.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function s(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,s)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,s)},cr.prototype.poll=function(){var e=this,t=this.cm,s=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||pt(s)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var d=s.value;if(d==i&&!t.somethingSelected())return!1;if(F&&W>=9&&this.hasSelection===d||_&&/[\uf700-\uf7ff]/.test(d))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var B=d.charCodeAt(0);if(B==8203&&!i&&(i="\u200B"),B==8666)return this.reset(),this.cm.execCommand("undo")}for(var z=0,$=Math.min(i.length,d.length);z<$&&i.charCodeAt(z)==d.charCodeAt(z);)++z;return $r(t,function(){Ka(t,d.slice(z),i.length-z,null,e.composing?"*compose":null),d.length>1e3||d.indexOf(`
|
|
`)>-1?s.value=e.prevInput="":e.prevInput=d,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},cr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},cr.prototype.onKeyPress=function(){F&&W>=9&&(this.hasSelection=null),this.fastPoll()},cr.prototype.onContextMenu=function(e){var t=this,s=t.cm,i=s.display,d=t.textarea;t.contextMenuPending&&t.contextMenuPending();var B=Un(s,e),z=i.scroller.scrollTop;if(!B||M)return;var $=s.options.resetSelectionOnContextMenu;$&&s.doc.sel.contains(B)==-1&&Tr(s,Mr)(s.doc,An(B),ee);var Q=d.style.cssText,te=t.wrapper.style.cssText,ge=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",d.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ge.top-5)+"px; left: "+(e.clientX-ge.left-5)+`px;
|
|
z-index: 1000; background: `+(F?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var be;r&&(be=window.scrollY),i.input.focus(),r&&window.scrollTo(null,be),i.input.reset(),s.somethingSelected()||(d.value=t.prevInput=" "),t.contextMenuPending=Re,i.selForContextMenu=s.doc.sel,clearTimeout(i.detectingSelectAll);function ke(){if(d.selectionStart!=null){var $e=s.somethingSelected(),rt="\u200B"+($e?d.value:"");d.value="\u21DA",d.value=rt,t.prevInput=$e?"":"\u200B",d.selectionStart=1,d.selectionEnd=rt.length,i.selForContextMenu=s.doc.sel}}function Re(){if(t.contextMenuPending!=Re)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=te,d.style.cssText=Q,F&&W<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=z),d.selectionStart!=null){(!F||F&&W<9)&&ke();var $e=0,rt=function(){i.selForContextMenu==s.doc.sel&&d.selectionStart==0&&d.selectionEnd>0&&t.prevInput=="\u200B"?Tr(s,Vs)(s):$e++<10?i.detectingSelectAll=setTimeout(rt,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(rt,200)}}if(F&&W>=9&&ke(),x){me(e);var We=function(){ht(window,"mouseup",We),setTimeout(Re,20)};Ne(window,"mouseup",We)}else setTimeout(Re,50)},cr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},cr.prototype.setUneditable=function(){},cr.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?n(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var s=v();t.autofocus=s==e||e.getAttribute("autofocus")!=null&&s==document.body}function i(){e.value=$.getValue()}var d;if(e.form&&(Ne(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var B=e.form;d=B.submit;try{var z=B.submit=function(){i(),B.submit=d,B.submit(),B.submit=z}}catch(Q){}}t.finishInit=function(Q){Q.save=i,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,i(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(ht(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=d))}},e.style.display="none";var $=ir(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return $}function iu(e){e.off=ht,e.on=Ne,e.wheelEventPixels=dl,e.Doc=Gr,e.splitLines=Ct,e.countColumn=N,e.findColumn=he,e.isWordChar=Oe,e.Pass=J,e.signal=Ue,e.Line=Mn,e.changeEnd=Rn,e.scrollbarModel=xs,e.Pos=Je,e.cmpPos=nt,e.modes=Ht,e.mimeModes=It,e.resolveMode=ar,e.getMode=xr,e.modeExtensions=tt,e.extendMode=At,e.copyState=Lt,e.startState=fr,e.innerMode=Ut,e.commands=Mi,e.keyMap=xn,e.keyName=lo,e.isModifierKey=so,e.lookupKey=oi,e.normalizeKeyMap=Dl,e.StringStream=Yt,e.SharedTextMarker=ki,e.TextMarker=In,e.LineWidget=Li,e.e_preventDefault=ne,e.e_stopPropagation=ue,e.e_stop=me,e.addClass=l,e.contains=o,e.rmClass=k,e.keyNames=Ln}$l(ir),ql(ir);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Gr.prototype)Gr.prototype.hasOwnProperty(la)&&j(au,la)<0&&(ir.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Gr.prototype[la]));return Te(Gr),ir.inputStyles={textarea:cr,contenteditable:Zt},ir.defineMode=function(e){!ir.defaults.mode&&e!="null"&&(ir.defaults.mode=e),rr.apply(this,arguments)},ir.defineMIME=Rr,ir.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ir.defineMIME("text/plain","null"),ir.defineExtension=function(e,t){ir.prototype[e]=t},ir.defineDocExtension=function(e,t){Gr.prototype[e]=t},ir.fromTextArea=nu,iu(ir),ir.version="5.58.2",ir})},ZW9T:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return h});var se=Z("YaWb"),Se=Z("nc60"),ce=Z("8OG5"),ye=Z("mgsT"),le=Z("sh+1"),X=Z("Hqw+"),F=Z("ftSv"),W=Z("T/Jt"),r=Z.n(W),H=Z("bdgK"),D=Z("IYef"),M=Z("XXmO"),g=Z.n(M),p={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"]},u={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"]},m={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(`
|
|
`)}]},b={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},E=Z("5VLF"),_=Z.n(E),f={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},O=function(N,U){return U.map(function(j){return{label:j,kind:N.languages.CompletionItemKind.Keyword,insertText:j}})},w=function(N){return Object.keys(f.tables).map(function(U){return{label:U,kind:N.languages.CompletionItemKind.Variable,insertText:U}})},R=function(N,U){var j=f.tables[N];return j?j.map(function(Y){return{label:Y,kind:U.languages.CompletionItemKind.Field,insertText:Y}}):[]};function x(n,N,U,j,Y){var J=N.getWordUntilPosition(U),ee={startLineNumber:U.lineNumber,endLineNumber:U.lineNumber,startColumn:J.startColumn,endColumn:J.endColumn},ie=j.map(function(re){return{label:re,kind:n.languages.CompletionItemKind.Keyword,insertText:re,insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ee}});return Y.map(function(re){ie.push(Object(se.a)(Object(se.a)({},re),{},{range:ee}))}),ie}var I=function(n){f.languages.map(function(Y){return n.languages.registerDocumentFormattingEditProvider(Y,{provideDocumentFormattingEdits:function(ee,ie,re){return Object(D.a)(g.a.mark(function he(){var oe;return g.a.wrap(function(Ee){for(;;)switch(Ee.prev=Ee.next){case 0:return oe=_()(ee.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}),Ee.abrupt("return",[{range:ee.getFullModelRange(),text:oe}]);case 2:case"end":return Ee.stop()}},he)}))()}}),Y});var N=m.quickKey.map(function(Y){return{label:Y.label,kind:n.languages.CompletionItemKind.Method,insertText:Y.content,insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),U=b.quickKey.map(function(Y){return{label:Y.label,kind:n.languages.CompletionItemKind.Method,insertText:Y.content,insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),j=u.quickKey.map(function(Y){return{label:Y.label,kind:n.languages.CompletionItemKind.Method,insertText:Y.content,insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet}});n.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(J,ee){var ie=J.getWordUntilPosition(ee),re={startLineNumber:ee.lineNumber,endLineNumber:ee.lineNumber,startColumn:ie.startColumn,endColumn:ie.endColumn},he=J.getLineContent(ee.lineNumber).substring(ie.startColumn-2,ie.endColumn);return{suggestions:[].concat(Object(Se.a)(m.keywords.map(function(oe){return{label:oe,kind:n.languages.CompletionItemKind.Function,documentation:oe,insertText:oe,insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:re}})),Object(Se.a)(m.quickKey.map(function(oe){return{label:oe.label,kind:n.languages.CompletionItemKind.Function,documentation:oe.content,insertText:he.startsWith("#")?oe.content.replace(/#/,""):oe.content,insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:re}})))}}}),n.languages.registerCompletionItemProvider("c",{provideCompletionItems:function(J,ee){var ie=J.getWordUntilPosition(ee),re={startLineNumber:ee.lineNumber,endLineNumber:ee.lineNumber,startColumn:ie.startColumn,endColumn:ie.endColumn};return{suggestions:Object(Se.a)(p.keywords.map(function(he){return{label:he,kind:n.languages.CompletionItemKind.Function,documentation:he,insertText:he,insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:re}}))}}}),n.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(J,ee){var ie=J.getWordUntilPosition(ee),re={startLineNumber:ee.lineNumber,endLineNumber:ee.lineNumber,startColumn:ie.startColumn,endColumn:ie.endColumn},he=J.getLineContent(ee.lineNumber).substring(ie.startColumn-2,ie.endColumn);return{suggestions:[].concat(Object(Se.a)(u.keywords.map(function(oe){return{label:oe,kind:n.languages.CompletionItemKind.Function,documentation:oe,insertText:oe,insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:re}})),Object(Se.a)(u.quickKey.map(function(oe){return{label:oe.label,kind:n.languages.CompletionItemKind.Function,documentation:oe.content,insertText:he.startsWith("#")?oe.content.replace(/#/,""):oe.content,insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:re}})))}}}),n.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(J,ee){var ie=J.getWordUntilPosition(ee),re={startLineNumber:ee.lineNumber,endLineNumber:ee.lineNumber,startColumn:ie.startColumn,endColumn:ie.endColumn},he=J.getLineContent(ee.lineNumber).substring(ie.startColumn-2,ie.endColumn);return{suggestions:[].concat(Object(Se.a)(b.keywords.map(function(oe){return{label:oe,kind:n.languages.CompletionItemKind.Function,documentation:oe,insertText:oe,insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:re}})),Object(Se.a)(b.quickKey.map(function(oe){return{label:oe.label,kind:n.languages.CompletionItemKind.Function,documentation:oe.content,insertText:he.startsWith("#")?oe.content.replace(/#/,""):oe.content,insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:re}})))}}})},k="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",A=Z("fjLI"),P=Z("LvDl"),S=Z("+ua5");function C(n){return/^\d+$/.test(n)?"".concat(n,"px"):n}function c(){}var o=!1,v={"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 n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],N=n;if(Array.isArray(n)){for(var U=0;U<n.length;U++){var j=v[n[U]];if(j)return j}return N[0]}return v[N]||N}var a=null,T=ve.b=function(n){var N=n.width,U=N===void 0?"100%":N,j=n.height,Y=j===void 0?"100%":j,J=n.value,ee=n.language,ie=ee===void 0?"javascript":ee,re=n.style,he=re===void 0?{}:re,oe=n.options,ae=oe===void 0?{}:oe,Ee=n.overrideServices,Le=Ee===void 0?{}:Ee,Fe=n.theme,Xe=Fe===void 0?"vs-dark":Fe,He=n.onEditBlur,Ae=n.onSave,Oe=n.autoHeight,Ke=Oe===void 0?!1:Oe,de=n.forbidCopy,xe=de===void 0?!1:de,Ie=n.onChange,De=Ie===void 0?c:Ie,Be=n.editorDidMount,ze=Be===void 0?c:Be,Ye=n.onFocus,Ze=Ye===void 0?c:Ye,ut=n.filename,Qe=ut===void 0?"educoder.txt":ut,st=n.errorLine,Ne=n.errorContent,vt=Ne===void 0?"":Ne,ht=Object(F.a)(n,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Ue=Object(W.useRef)(),Ve=Object(W.useRef)({}),Ce=Object(W.useRef)(),_e=Object(W.useRef)(),Te=Object(W.useRef)(!1),ne=Object(W.useRef)(),ue=Object(W.useState)(!1),fe=Object(X.a)(ue,2),me=fe[0],we=fe[1];function Me(){var tt;return Ue.current&&(tt=new H.a(function(At){var Lt=Object(le.a)(At),Ut;try{for(Lt.s();!(Ut=Lt.n()).done;){var fr=Ut.value;(fr.target.offsetHeight>0||fr.target.offsetWidth>0)&&Ve.current.instance.layout()}}catch(Yt){Lt.e(Yt)}finally{Lt.f()}}),tt.observe(Ue.current)),tt}function je(){ye.b.warn(decodeURIComponent(k))}var qe=function(){var At=Ve.current.instance;if(J!=null&&At&&me){var Lt=At.getModel();Lt&&J!==Lt.getValue()&&(o=!0,Lt.setValue(J),At.layout(),o=!1)}};Object(W.useEffect)(function(){_e.current&&clearTimeout(_e.current),_e.current=setTimeout(function(){qe()},500)},[J,me,Ve.current]),Object(W.useEffect)(function(){if(st&&Ve.current&&Ve.current.instance){var tt=Ve.current.instance;tt.changeViewZones(function(Lt){var Ut=document.createElement("div");Ut.style.padding="10px 20px",Ut.style.width="calc(100% - 20px)",Ut.className="my-error-line-wrp",Ut.innerHTML=vt,Lt.addZone({afterLineNumber:st||11,heightInLines:3,domNode:Ut})});var At={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}};tt.addOverlayWidget(At),tt.revealPositionInCenter({lineNumber:20,column:1})}},[st,Ve.current,me]);function ct(){var tt=Ve.current.instance;if(tt){var At=tt.getSelection(),Lt=Ve.current.pastePos||{},Ut=new a.Range(Lt.startLineNumber||At.endLineNumber,Lt.startColumn||At.endColumn,Lt.endLineNumber||At.endLineNumber,Lt.endColumn||At.endColumn);setTimeout(function(){tt.executeEdits("",[{range:Ut,text:""}])},300)}}function et(tt){(window.navigator.platform.match("Mac")?tt.metaKey:tt.ctrlKey)&&tt.keyCode==83&&(tt.preventDefault(),Ae())}var kt=function(){if(Ke&&Ve.current.instance){var At=Ve.current.instance.getContentHeight();ar(At<Y?Y:At)}else ar(Y)};function Ct(tt){var At=document.createEvent("MouseEvents");At.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),tt.dispatchEvent(At)}function pt(tt,At){var Lt=window.URL||window.webkitURL||window,Ut=new Blob([At]),fr=document.createElementNS("http://www.w3.org/1999/xhtml","a");fr.href=Lt.createObjectURL(Ut),fr.download=tt,Ct(fr)}Object(W.useEffect)(function(){kt()},[kt]),Object(W.useEffect)(function(){Ue.current&&!me&&Z.e(26).then(Z.t.bind(null,"M/lh",7)).then(function(tt){try{a=tt,Ve.current.instance=a.editor.create(Ue.current,{value:J,language:l(ie),theme:Xe,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},Le);var At=Ve.current.instance,Lt=A.d._menuItems,Ut=Object(Se.a)(Lt).find(function(Qt){return Qt[0]._debugName=="EditorContext"}),fr=Ut[1],Yt=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],mt=function(Jt,Dt){var dr=Jt._first;do{var yr,Yr,Je=Dt.includes((yr=dr.element)===null||yr===void 0||((Yr=yr.command)===null||Yr===void 0)?void 0:Yr.id);Je&&Jt._remove(dr)}while(dr=dr.next)};if(ze(At,a),setTimeout(function(){kt(),Ve.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){pt(Qe||"educoder.txt",At.getValue())}}),At.getDomNode().addEventListener("input",function(){Ce.current.autoFormat&&At.getAction("editor.action.formatDocument").run()})},500),Ve.current.subscription=At.onDidChangeModelContent(function(Qt){Te.current?clearTimeout(ne.current):(kt(),De(At.getValue(),Qt)),ne.current=setTimeout(function(){Te.current=!1},500)}),window.Monaco||I(a,l(ie)),xe&&(mt(fr,Yt),Ue.current.classList.add("noCopyPaste"),At.onKeyDown(function(Qt){var Jt=Qt.keyCode,Dt=Qt.ctrlKey,dr=Qt.metaKey;(Jt===33||Jt===52)&&(dr||Dt)&&(je(),Qt.preventDefault())})),window.Monaco=a,He&&At.onDidBlurEditorWidget(function(){He(At.getValue())}),Ze&&At.onDidFocusEditorText(function(){Ze(At.getValue())}),xe){At.addCommand(a.KeyMod.CtrlCmd|a.KeyCode.KEY_V,function(){return je(),null}),At.onDidPaste(function(Qt){Ve.current.pastePos=Qt});try{window.addEventListener("paste",ct)}catch(Qt){}}var sr=Me();return we(!0),function(){var Qt=Ve.current.instance;Qt.dispose();var Jt=Qt.getModel();Jt&&Jt.dispose(),Ve.current.subscription&&Ve.current.subscription.dispose(),xe&&window.removeEventListener("paste",ct),sr.unobserve(Ue.current)}}catch(Qt){}})},[]),Object(W.useEffect)(function(){var tt=Ve.current.instance;if(tt&&me)return document.addEventListener("keydown",et,!1),function(){document.removeEventListener("keydown",et)}},[Ae,me]),Object(W.useEffect)(function(){var tt=Ve.current.instance;if(tt&&me){var At=l(ie);a.editor.setModelLanguage(tt.getModel(),At),console.log("language:",ie,tt.getModel(),At)}},[ie,me]),Object(W.useEffect)(function(){var tt=Ve.current.instance;tt&&me&&a.editor.setTheme(Xe)},[Xe,me]),Object(W.useEffect)(function(){var tt=Ve.current.instance;Ce.current=ae,tt&&me&&(tt.updateOptions(Object(se.a)({},ae)),setTimeout(function(){tt.getModel().updateOptions(Object(se.a)({},ae))},200))},[JSON.stringify(ae),me]),Object(W.useEffect)(function(){var tt=Ve.current.instance;tt&&me&&tt.layout()},[U,Y,me]);var Nt=Object(W.useState)(C(U)),Et=Object(X.a)(Nt,2),wt=Et[0],Ht=Et[1],It=Object(W.useState)(C(Y)),rr=Object(X.a)(It,2),Rr=rr[0],ar=rr[1],xr=Object(se.a)(Object(se.a)({},he),{},{width:wt,height:Rr});return r.a.createElement("div",{className:"my-monaco-editor",ref:Ue,style:xr})};function h(n){var N=n.width,U=N===void 0?"100%":N,j=n.height,Y=j===void 0?"100%":j,J=n.original,ee=n.modified,ie=n.language,re=n.options,he=re===void 0?{}:re,oe=Object(W.useRef)(),ae=Object(W.useState)(null),Ee=Object(X.a)(ae,2),Le=Ee[0],Fe=Ee[1];function Xe(Ke){var de;return oe.current&&(de=new H.a(function(xe){var Ie=Object(le.a)(xe),De;try{for(Ie.s();!(De=Ie.n()).done;){var Be=De.value;(Be.target.offsetHeight>0||Be.target.offsetWidth>0)&&Ke.layout()}}catch(ze){Ie.e(ze)}finally{Ie.f()}}),de.observe(oe.current)),de}Object(W.useEffect)(function(){oe.current&&Z.e(26).then(Z.t.bind(null,"M/lh",7)).then(function(Ke){a=Ke;var de=a.editor.createDiffEditor(oe.current,Object(se.a)(Object(se.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},he),{},{wordWrap:!0}));Fe(de);var xe=Xe(de);return function(){de.dispose();var Ie=de.getModel();Ie&&Ie.dispose(),xe.unobserve(oe.current)}})},[]),Object(W.useEffect)(function(){Le&&Le.setModel({original:a.editor.createModel(J,ie),modified:a.editor.createModel(ee,ie)})},[J,ee,ie,Le]);var He=C(U),Ae=C(Y),Oe={width:He,height:Ae};return r.a.createElement("div",{className:"my-diff-editor",ref:oe,style:Oe})}},a3WO:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return se});function se(Se,ce){(ce==null||ce>Se.length)&&(ce=Se.length);for(var ye=0,le=new Array(ce);ye<ce;ye++)le[ye]=Se[ye];return le}},b3aT:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return se}),Z.d(ve,"b",function(){return le}),Z.d(ve,"c",function(){return X}),Z.d(ve,"d",function(){return F});function se(W,r){ce(W)&&(W="100%");var H=ye(W);return W=r===360?W:Math.min(r,Math.max(0,parseFloat(W))),H&&(W=parseInt(String(W*r),10)/100),Math.abs(W-r)<1e-6?1:(r===360?W=(W<0?W%r+r:W%r)/parseFloat(String(r)):W=W%r/parseFloat(String(r)),W)}function Se(W){return Math.min(1,Math.max(0,W))}function ce(W){return typeof W=="string"&&W.indexOf(".")!==-1&&parseFloat(W)===1}function ye(W){return typeof W=="string"&&W.indexOf("%")!==-1}function le(W){return W=parseFloat(W),(isNaN(W)||W<0||W>1)&&(W=1),W}function X(W){return W<=1?"".concat(Number(W)*100,"%"):W}function F(W){return W.length===1?"0"+W:String(W)}},bdgK:function(at,ve,Z){"use strict";(function(se){var Se=function(){if(typeof Map!="undefined")return Map;function c(o,v){var l=-1;return o.some(function(a,T){return a[0]===v?(l=T,!0):!1}),l}return function(){function o(){this.__entries__=[]}return Object.defineProperty(o.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),o.prototype.get=function(v){var l=c(this.__entries__,v),a=this.__entries__[l];return a&&a[1]},o.prototype.set=function(v,l){var a=c(this.__entries__,v);~a?this.__entries__[a][1]=l:this.__entries__.push([v,l])},o.prototype.delete=function(v){var l=this.__entries__,a=c(l,v);~a&&l.splice(a,1)},o.prototype.has=function(v){return!!~c(this.__entries__,v)},o.prototype.clear=function(){this.__entries__.splice(0)},o.prototype.forEach=function(v,l){l===void 0&&(l=null);for(var a=0,T=this.__entries__;a<T.length;a++){var h=T[a];v.call(l,h[1],h[0])}},o}()}(),ce=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,ye=function(){return typeof se!="undefined"&&se.Math===Math?se:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),le=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(ye):function(c){return setTimeout(function(){return c(Date.now())},1e3/60)}}(),X=2;function F(c,o){var v=!1,l=!1,a=0;function T(){v&&(v=!1,c()),l&&n()}function h(){le(T)}function n(){var N=Date.now();if(v){if(N-a<X)return;l=!0}else v=!0,l=!1,setTimeout(h,o);a=N}return n}var W=20,r=["top","right","bottom","left","width","height","size","weight"],H=typeof MutationObserver!="undefined",D=function(){function c(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=F(this.refresh.bind(this),W)}return c.prototype.addObserver=function(o){~this.observers_.indexOf(o)||this.observers_.push(o),this.connected_||this.connect_()},c.prototype.removeObserver=function(o){var v=this.observers_,l=v.indexOf(o);~l&&v.splice(l,1),!v.length&&this.connected_&&this.disconnect_()},c.prototype.refresh=function(){var o=this.updateObservers_();o&&this.refresh()},c.prototype.updateObservers_=function(){var o=this.observers_.filter(function(v){return v.gatherActive(),v.hasActive()});return o.forEach(function(v){return v.broadcastActive()}),o.length>0},c.prototype.connect_=function(){if(!ce||this.connected_)return;document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),H?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0},c.prototype.disconnect_=function(){if(!ce||!this.connected_)return;document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1},c.prototype.onTransitionEnd_=function(o){var v=o.propertyName,l=v===void 0?"":v,a=r.some(function(T){return!!~l.indexOf(T)});a&&this.refresh()},c.getInstance=function(){return this.instance_||(this.instance_=new c),this.instance_},c.instance_=null,c}(),M=function(c,o){for(var v=0,l=Object.keys(o);v<l.length;v++){var a=l[v];Object.defineProperty(c,a,{value:o[a],enumerable:!1,writable:!1,configurable:!0})}return c},g=function(c){var o=c&&c.ownerDocument&&c.ownerDocument.defaultView;return o||ye},p=x(0,0,0,0);function u(c){return parseFloat(c)||0}function m(c){for(var o=[],v=1;v<arguments.length;v++)o[v-1]=arguments[v];return o.reduce(function(l,a){var T=c["border-"+a+"-width"];return l+u(T)},0)}function b(c){for(var o=["top","right","bottom","left"],v={},l=0,a=o;l<a.length;l++){var T=a[l],h=c["padding-"+T];v[T]=u(h)}return v}function E(c){var o=c.getBBox();return x(0,0,o.width,o.height)}function _(c){var o=c.clientWidth,v=c.clientHeight;if(!o&&!v)return p;var l=g(c).getComputedStyle(c),a=b(l),T=a.left+a.right,h=a.top+a.bottom,n=u(l.width),N=u(l.height);if(l.boxSizing==="border-box"&&(Math.round(n+T)!==o&&(n-=m(l,"left","right")+T),Math.round(N+h)!==v&&(N-=m(l,"top","bottom")+h)),!O(c)){var U=Math.round(n+T)-o,j=Math.round(N+h)-v;Math.abs(U)!==1&&(n-=U),Math.abs(j)!==1&&(N-=j)}return x(a.left,a.top,n,N)}var f=function(){return typeof SVGGraphicsElement!="undefined"?function(c){return c instanceof g(c).SVGGraphicsElement}:function(c){return c instanceof g(c).SVGElement&&typeof c.getBBox=="function"}}();function O(c){return c===g(c).document.documentElement}function w(c){return ce?f(c)?E(c):_(c):p}function R(c){var o=c.x,v=c.y,l=c.width,a=c.height,T=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,h=Object.create(T.prototype);return M(h,{x:o,y:v,width:l,height:a,top:v,right:o+l,bottom:a+v,left:o}),h}function x(c,o,v,l){return{x:c,y:o,width:v,height:l}}var I=function(){function c(o){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=x(0,0,0,0),this.target=o}return c.prototype.isActive=function(){var o=w(this.target);return this.contentRect_=o,o.width!==this.broadcastWidth||o.height!==this.broadcastHeight},c.prototype.broadcastRect=function(){var o=this.contentRect_;return this.broadcastWidth=o.width,this.broadcastHeight=o.height,o},c}(),k=function(){function c(o,v){var l=R(v);M(this,{target:o,contentRect:l})}return c}(),A=function(){function c(o,v,l){if(this.activeObservations_=[],this.observations_=new Se,typeof o!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=o,this.controller_=v,this.callbackCtx_=l}return c.prototype.observe=function(o){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(typeof Element=="undefined"||!(Element instanceof Object))return;if(!(o instanceof g(o).Element))throw new TypeError('parameter 1 is not of type "Element".');var v=this.observations_;if(v.has(o))return;v.set(o,new I(o)),this.controller_.addObserver(this),this.controller_.refresh()},c.prototype.unobserve=function(o){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(typeof Element=="undefined"||!(Element instanceof Object))return;if(!(o instanceof g(o).Element))throw new TypeError('parameter 1 is not of type "Element".');var v=this.observations_;if(!v.has(o))return;v.delete(o),v.size||this.controller_.removeObserver(this)},c.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},c.prototype.gatherActive=function(){var o=this;this.clearActive(),this.observations_.forEach(function(v){v.isActive()&&o.activeObservations_.push(v)})},c.prototype.broadcastActive=function(){if(!this.hasActive())return;var o=this.callbackCtx_,v=this.activeObservations_.map(function(l){return new k(l.target,l.broadcastRect())});this.callback_.call(o,v,o),this.clearActive()},c.prototype.clearActive=function(){this.activeObservations_.splice(0)},c.prototype.hasActive=function(){return this.activeObservations_.length>0},c}(),P=typeof WeakMap!="undefined"?new WeakMap:new Se,S=function(){function c(o){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var v=D.getInstance(),l=new A(o,v,this);P.set(this,l)}return c}();["observe","unobserve","disconnect"].forEach(function(c){S.prototype[c]=function(){var o;return(o=P.get(this))[c].apply(o,arguments)}});var C=function(){return typeof ye.ResizeObserver!="undefined"?ye.ResizeObserver:S}();ve.a=C}).call(this,Z("IGO8"))},c5Ni:function(at,ve,Z){},dejd:function(at,ve,Z){},fjLI:function(at,ve,Z){"use strict";Z.d(ve,"f",function(){return g}),Z.d(ve,"b",function(){return p}),Z.d(ve,"a",function(){return u}),Z.d(ve,"d",function(){return m}),Z.d(ve,"e",function(){return b}),Z.d(ve,"c",function(){return E});var se=Z("8HAY"),Se=Z("Vhoy"),ce=Z("MI8n"),ye=Z("JYp7"),le=Z("pmY6"),X=Z("24hK"),F=Z("nnTU"),W=Z("T8No"),r=Z("Cg/j"),H=Z("t9D7"),D=function(_,f,O,w){var R=arguments.length,x=R<3?f:w===null?w=Object.getOwnPropertyDescriptor(f,O):w,I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(_,f,O,w);else for(var k=_.length-1;k>=0;k--)(I=_[k])&&(x=(R<3?I(x):R>3?I(f,O,x):I(f,O))||x);return R>3&&x&&Object.defineProperty(f,O,x),x},M=function(_,f){return function(O,w){f(O,w,_)}};function g(_){return _.command!==void 0}class p{constructor(_){this.id=p._idPool++,this._debugName=_}}p._idPool=0,p.CommandPalette=new p("CommandPalette"),p.EditorContext=new p("EditorContext"),p.SimpleEditorContext=new p("SimpleEditorContext"),p.EditorContextCopy=new p("EditorContextCopy"),p.EditorContextPeek=new p("EditorContextPeek"),p.MenubarEditMenu=new p("MenubarEditMenu"),p.MenubarCopy=new p("MenubarCopy"),p.MenubarGoMenu=new p("MenubarGoMenu"),p.MenubarSelectionMenu=new p("MenubarSelectionMenu"),p.InlineCompletionsActions=new p("InlineCompletionsActions");const u=Object(r.c)("menuService"),m=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new ce.b,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:_=>_===p.CommandPalette}}addCommand(_){return this.addCommands(ye.a.single(_))}addCommands(_){for(const f of _)this._commands.set(f.id,f);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),Object(le.i)(()=>{let f=!1;for(const O of _)f=this._commands.delete(O.id)||f;f&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(_){return this._commands.get(_)}getCommands(){const _=new Map;return this._commands.forEach((f,O)=>_.set(O,f)),_}appendMenuItem(_,f){return this.appendMenuItems(ye.a.single({id:_,item:f}))}appendMenuItems(_){const f=new Set,O=new X.a;for(const{id:w,item:R}of _){let x=this._menuItems.get(w);x||(x=new X.a,this._menuItems.set(w,x)),O.push(x.push(R)),f.add(w)}return this._onDidChangeMenu.fire(f),Object(le.i)(()=>{if(O.size>0){for(let w of O)w();this._onDidChangeMenu.fire(f),O.clear()}})}getMenuItems(_){let f;return this._menuItems.has(_)?f=[...this._menuItems.get(_)]:f=[],_===p.CommandPalette&&this._appendImplicitItems(f),f}_appendImplicitItems(_){const f=new Set;for(const O of _)g(O)&&(f.add(O.command.id),O.alt&&f.add(O.alt.id));this._commands.forEach((O,w)=>{f.has(w)||_.push({command:O})})}};class b extends se.e{constructor(_,f,O,w){super(`submenuitem.${_.submenu.id}`,typeof _.title=="string"?_.title:_.title.value,[],"submenu");this.item=_,this._menuService=f,this._contextKeyService=O,this._options=w}get actions(){const _=[],f=this._menuService.createMenu(this.item.submenu,this._contextKeyService),O=f.getActions(this._options);f.dispose();for(const[,w]of O)w.length>0&&(_.push(...w),_.push(new se.d));return _.length&&_.pop(),_}}let E=class _{constructor(f,O,w,R,x){var I,k;if(this._commandService=x,this.id=f.id,this.label=(w==null?void 0:w.renderShortTitle)&&f.shortTitle?typeof f.shortTitle=="string"?f.shortTitle:f.shortTitle.value:typeof f.title=="string"?f.title:f.title.value,this.tooltip=(k=typeof f.tooltip=="string"?f.tooltip:(I=f.tooltip)===null||I===void 0?void 0:I.value)!==null&&k!==void 0?k:"",this.enabled=!f.precondition||R.contextMatchesRules(f.precondition),this.checked=void 0,f.toggled){const A=f.toggled.condition?f.toggled:{condition:f.toggled};this.checked=R.contextMatchesRules(A.condition),this.checked&&A.tooltip&&(this.tooltip=typeof A.tooltip=="string"?A.tooltip:A.tooltip.value),A.title&&(this.label=typeof A.title=="string"?A.title:A.title.value)}this.item=f,this.alt=O?new _(O,void 0,w,R,x):void 0,this._options=w,H.d.isThemeIcon(f.icon)&&(this.class=Se.a.asClassName(f.icon))}dispose(){}run(...f){var O,w;let R=[];return((O=this._options)===null||O===void 0?void 0:O.arg)&&(R=[...R,this._options.arg]),((w=this._options)===null||w===void 0?void 0:w.shouldForwardArgs)&&(R=[...R,...f]),this._commandService.executeCommand(this.id,...R)}};E=D([M(3,W.b),M(4,F.b)],E)},gkVt:function(at,ve,Z){"use strict";Z.r(ve);var se=Z("sOWs"),Se=Z("jDAR"),ce=Z("dLI4"),ye=Z("4d5L"),le=Z("8OG5"),X=Z("mgsT"),F=Z("IYef"),W=Z("Hqw+"),r=Z("XXmO"),H=Z.n(r),D=Z("T/Jt"),M=Z.n(D),g=Z("47JS"),p=Z("TOZL"),u=Z("Ot1p"),m=Z("ErOA");function b(P){var S=P.setIscreate,C=P.init,c=P.UpdateItem,o=Object(D.useState)(""),v=Object(W.a)(o,2),l=v[0],a=v[1],T=Object(D.useState)(""),h=Object(W.a)(T,2),n=h[0],N=h[1];Object(D.useEffect)(function(){if(!c)return;a(c&&c.name),N(c&&c.description)},[c]);function U(){return j.apply(this,arguments)}function j(){return j=Object(F.a)(H.a.mark(function ee(){var ie;return H.a.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:if(l){he.next=3;break}return X.b.info("\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A"),he.abrupt("return");case 3:if(n){he.next=6;break}return X.b.info("\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A"),he.abrupt("return");case 6:if(!c){he.next=9;break}return Y(),he.abrupt("return");case 9:return he.next=11,Object(m.a)("/api/hpc_courses.json",{method:"post",body:{name:l,description:n,container_type:window.location.pathname.split("/")[1]}});case 11:ie=he.sent,ie&&(X.b.info("\u521B\u5EFA\u6210\u529F"),S(!1),C("add"));case 13:case"end":return he.stop()}},ee)})),j.apply(this,arguments)}function Y(){return J.apply(this,arguments)}function J(){return J=Object(F.a)(H.a.mark(function ee(){var ie;return H.a.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:return he.next=2,Object(m.a)("/api/hpc_courses/".concat(c.id,".json"),{method:"put",body:{name:l,description:n,container_type:window.location.pathname.split("/")[1]}});case 2:ie=he.sent,ie&&(X.b.info("\u7F16\u8F91\u6210\u529F"),S(!1),C(""));case 4:case"end":return he.stop()}},ee)})),J.apply(this,arguments)}return M.a.createElement("div",null,M.a.createElement(p.a,{style:{marginBottom:"20px"},placeholder:"\u8BF7\u8F93\u5165\u6807\u9898",value:l,maxLength:60,addonAfter:String(l.length)+"/60",onChange:function(ie){return a(ie.target.value)}}),M.a.createElement(u.a,{id:"courseContentMD",defaultValue:n,onChange:function(ie){return N(ie)}}),M.a.createElement("div",{className:"clearfix mt30 mb30"},M.a.createElement(ye.a,{type:"primary",onClick:function(){return U()},className:"defalutSubmitbtn fl mr20"},"\u63D0\u4EA4"),M.a.createElement("a",{className:"defalutCancelbtn fl",onClick:function(){return S(!1)}},"\u53D6\u6D88")))}var E=b,_=Z("9Bee");function f(P){var S=P.CourseItem,C=P.userId,c=P.init,o=P.ItemUpdate,v=P.setSee,l=P.UserInfo;function a(){return T.apply(this,arguments)}function T(){return T=Object(F.a)(H.a.mark(function n(){var N;return H.a.wrap(function(j){for(;;)switch(j.prev=j.next){case 0:return j.next=2,Object(m.a)("/api/hpc_courses/".concat(S.id,".json"),{method:"delete"});case 2:N=j.sent,N&&(X.b.info("\u5220\u9664\u6210\u529F"),c("delete"),v(!1));case 4:case"end":return j.stop()}},n)})),T.apply(this,arguments)}function h(){o(S)}return M.a.createElement("div",null,C===299635||C===301458||l!=null&&l.admin||l!=null&&l.business?M.a.createElement("div",{style:{textAlign:"right"}},M.a.createElement(ye.a,{onClick:function(){return h()}},"\u7F16\u8F91"),M.a.createElement(ye.a,{onClick:function(){return a()},style:{marginLeft:"30px"}},"\u5220\u9664")):null,M.a.createElement("h1",null,S==null?void 0:S.name),M.a.createElement(_.a,{value:S==null?void 0:S.description}))}var O=f,w=Z("9ivq"),R=Z("m3rI"),x=Z("3ptp"),I=Z("9kvl");function k(P){var S,C,c,o,v,l,a,T,h,n=P.user,N=P.dispatch,U=Object(D.useState)(1),j=Object(W.a)(U,2),Y=j[0],J=j[1],ee=Object(D.useState)(100),ie=Object(W.a)(ee,2),re=ie[0],he=ie[1],oe=Object(D.useState)([]),ae=Object(W.a)(oe,2),Ee=ae[0],Le=ae[1],Fe=Object(D.useState)(!1),Xe=Object(W.a)(Fe,2),He=Xe[0],Ae=Xe[1],Oe=Object(D.useState)(!1),Ke=Object(W.a)(Oe,2),de=Ke[0],xe=Ke[1],Ie=Object(D.useState)(""),De=Object(W.a)(Ie,2),Be=De[0],ze=De[1],Ye=Object(D.useState)(""),Ze=Object(W.a)(Ye,2),ut=Ze[0],Qe=Ze[1],st=Object(D.useState)(""),Ne=Object(W.a)(st,2),vt=Ne[0],ht=Ne[1],Ue=Object(x.i)(),Ve=Ue.itemname,Ce=Object(D.useState)(""),_e=Object(W.a)(Ce,2),Te=_e[0],ne=_e[1];Object(D.useEffect)(function(){N({type:"globalSetting/headerToggle",payload:!1}),Y&&ue("")},[Y]);function ue(qe){return fe.apply(this,arguments)}function fe(){return fe=Object(F.a)(H.a.mark(function qe(ct){var et,kt,Ct,pt,Nt;return H.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:return wt.next=2,Object(m.a)("/api/hpc_courses.json",{method:"get",params:{page:Y,per_page:re,container_type:window.location.pathname.split("/")[1]}});case 2:if(et=wt.sent,!et){wt.next=24;break}if(kt=et.data.hpc_courses.length,Le(et.data.hpc_courses),ht(et.data.file_url),Qe(""),kt){wt.next=10;break}return wt.abrupt("return");case 10:if(Te){wt.next=14;break}Ve?(Nt=0,et==null||((Ct=et.data)===null||Ct===void 0||((pt=Ct.hpc_courses)===null||pt===void 0))||pt.map(function(Ht,It){var rr;(Ve==null?void 0:Ve.toLocaleLowerCase())===(Ht==null||((rr=Ht.name)===null||rr===void 0)?void 0:rr.toLocaleLowerCase())&&(Nt=It)}),ze(et.data.hpc_courses[Nt]),xe(!0),ne(et.data.hpc_courses[Nt].id),(Ve==null?void 0:Ve.toLocaleLowerCase())==="resources"&&(ze(et.data.hpc_courses.filter(function(Ht){return Ht.id===15})[0]),xe(!0),ne(15))):(ze(et.data.hpc_courses[0]),xe(!0),ne(et.data.hpc_courses[0].id)),wt.next=24;break;case 14:if(!(ct==="delete")){wt.next=23;break}if(!(kt===0)){wt.next=18;break}return xe(!1),wt.abrupt("return");case 18:ze(et.data.hpc_courses[0]),xe(!0),ne(et.data.hpc_courses[0].id),wt.next=24;break;case 23:ct==="add"?(ze(et.data.hpc_courses[kt-1]),xe(!0),ne(et.data.hpc_courses[kt-1].id)):(ze(et.data.hpc_courses.filter(function(Ht){return Ht.id===Te})[0]),xe(!0),ne(Te));case 24:case"end":return wt.stop()}},qe)})),fe.apply(this,arguments)}function me(qe){Ae(!1),xe(!0),ze(qe),ne(qe.id)}function we(qe){Qe(qe),Ae(!0),xe(!1)}function Me(){Qe(""),Ae(!0),xe(!1)}var je={name:"file",multiple:!0,action:"https://www.educoder.net/api/hpc_courses/upload_file.json",data:{container_type:window.location.pathname.split("/")[1]},onChange:function(ct){var et=ct.file.status;et!=="uploading",et==="done"?(X.b.success("".concat(ct.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")),ue("")):et==="error"&&X.b.error("".concat(ct.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(ct){var et=ct.size/1024/1024<150;return et||X.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),et}};return M.a.createElement("div",{style:{marginBottom:"40px"}},M.a.createElement("div",{className:"bannterdiv",style:{background:"url(".concat(R.a.IMG_SERVER+"/".concat(vt),")")}}),M.a.createElement("img",{style:{width:"100%"},src:R.a.IMG_SERVER+"/".concat(vt)}),M.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},M.a.createElement("div",{style:{flex:"1",marginTop:"17px"}},Ee&&Ee.map(function(qe,ct){return M.a.createElement("p",{key:ct,onClick:function(){return me(qe)},className:Te===qe.id?"menuitemselect":"menuitem task-hide"},qe.name)}),(n==null||((S=n.userInfo)===null||S===void 0)?void 0:S.user_id)===299635||(n==null||((C=n.userInfo)===null||C===void 0)?void 0:C.user_id)===301458||n!=null&&(c=n.userInfo)!==null&&c!==void 0&&c.admin||n!=null&&(o=n.userInfo)!==null&&o!==void 0&&o.business?M.a.createElement("p",{onClick:function(){return Me()},className:"menuadd",style:{fontSize:"24px",paddingLeft:"10px"}},M.a.createElement("span",{style:{fontSize:"16px",marginLeft:"5px"}},"Last updated")):null),M.a.createElement("div",{className:"rightcount",style:{flex:"6",background:"#ffffff",padding:"20px",marginLeft:"30px",marginTop:"24px"}},He?M.a.createElement(E,{UpdateItem:ut,setIscreate:Ae,init:ue}):null,de?M.a.createElement(O,{UserInfo:n==null?void 0:n.userInfo,setSee:xe,userId:n==null||((v=n.userInfo)===null||v===void 0)?void 0:v.user_id,ItemUpdate:we,CourseItem:Be,init:ue}):null)),(n==null||((l=n.userInfo)===null||l===void 0)?void 0:l.user_id)===299635||(n==null||((a=n.userInfo)===null||a===void 0)?void 0:a.user_id)===301458||n!=null&&(T=n.userInfo)!==null&&T!==void 0&&T.admin||n!=null&&(h=n.userInfo)!==null&&h!==void 0&&h.business?M.a.createElement(Se.a,je,M.a.createElement(ye.a,{className:"menuadd",style:{paddingLeft:"10px",marginLeft:"20px"}},"\u4E0A\u4F20\u9996\u9875\u56FE\u7247")):null)}var A=ve.default=Object(I.a)(function(P){var S=P.user;return{user:S}})(k)},hkPH:function(at,ve,Z){"use strict";var se=Z("yuO0"),Se=Z("XjgL"),ce=Z("kxoy"),ye=Z("36hc"),le=Z("fNpE"),X=Z("T/Jt"),F=Z("27eb"),W=Z.n(F),r=Z("sg8A"),H=Z("s7W6"),D=Z("Eiay"),M=Z("eA01"),g=Z("fXDJ");function p(){return typeof BigInt=="function"}function u(N){var U=N.trim(),j=U.startsWith("-");j&&(U=U.slice(1)),U=U.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),U.startsWith(".")&&(U="0".concat(U));var Y=U||"0",J=Y.split("."),ee=J[0]||"0",ie=J[1]||"0";ee==="0"&&ie==="0"&&(j=!1);var re=j?"-":"";return{negative:j,negativeStr:re,trimStr:Y,integerStr:ee,decimalStr:ie,fullStr:"".concat(re).concat(Y)}}function m(N){var U=String(N);return!Number.isNaN(Number(U))&&U.includes("e")}function b(N){var U=String(N);if(m(N)){var j=Number(U.slice(U.indexOf("e-")+2)),Y=U.match(/\.(\d+)/);return(Y==null?void 0:Y[1])&&(j+=Y[1].length),j}return U.includes(".")&&_(U)?U.length-U.indexOf(".")-1:0}function E(N){var U=String(N);if(m(N)){if(N>Number.MAX_SAFE_INTEGER)return String(p()?BigInt(N).toString():Number.MAX_SAFE_INTEGER);if(N<Number.MIN_SAFE_INTEGER)return String(p()?BigInt(N).toString():Number.MIN_SAFE_INTEGER);U=N.toFixed(b(U))}return u(U).fullStr}function _(N){return typeof N=="number"?!Number.isNaN(N):N?/^\s*-?\d+(\.\d+)?\s*$/.test(N)||/^\s*-?\d+\.\s*$/.test(N)||/^\s*-?\.\d+\s*$/.test(N):!1}function f(N){var U=typeof N=="number"?E(N):u(N).fullStr,j=U.includes(".");return j?u(U.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:N+"0"}var O=function(){function N(U){if(Object(M.a)(this,N),this.origin="",this.number=void 0,this.empty=void 0,!U&&U!==0||!String(U).trim()){this.empty=!0;return}this.origin=String(U),this.number=Number(U)}return Object(g.a)(N,[{key:"negate",value:function(){return new N(-this.toNumber())}},{key:"add",value:function(j){if(this.isInvalidate())return new N(j);var Y=Number(j);if(Number.isNaN(Y))return this;var J=this.number+Y;if(J>Number.MAX_SAFE_INTEGER)return new N(Number.MAX_SAFE_INTEGER);if(J<Number.MIN_SAFE_INTEGER)return new N(Number.MIN_SAFE_INTEGER);var ee=Math.max(b(this.number),b(Y));return new N(J.toFixed(ee))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return Number.isNaN(this.number)}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(j){return this.toNumber()===(j==null?void 0:j.toNumber())}},{key:"lessEquals",value:function(j){return this.add(j.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return j?this.isInvalidate()?"":E(this.number):this.origin}}]),N}(),w=function(){function N(U){if(Object(M.a)(this,N),this.origin="",this.negative=void 0,this.integer=void 0,this.decimal=void 0,this.decimalLen=void 0,this.empty=void 0,this.nan=void 0,!U&&U!==0||!String(U).trim()){this.empty=!0;return}if(this.origin=String(U),U==="-"){this.nan=!0;return}var j=U;if(m(j)&&(j=Number(j)),j=typeof j=="string"?j:E(j),_(j)){var Y=u(j);this.negative=Y.negative;var J=Y.trimStr.split(".");this.integer=BigInt(J[0]);var ee=J[1]||"0";this.decimal=BigInt(ee),this.decimalLen=ee.length}else this.nan=!0}return Object(g.a)(N,[{key:"getMark",value:function(){return this.negative?"-":""}},{key:"getIntegerStr",value:function(){return this.integer.toString()}},{key:"getDecimalStr",value:function(){return this.decimal.toString().padStart(this.decimalLen,"0")}},{key:"alignDecimal",value:function(j){var Y="".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(j,"0"));return BigInt(Y)}},{key:"negate",value:function(){var j=new N(this.toString());return j.negative=!j.negative,j}},{key:"add",value:function(j){if(this.isInvalidate())return new N(j);var Y=new N(j);if(Y.isInvalidate())return this;var J=Math.max(this.getDecimalStr().length,Y.getDecimalStr().length),ee=this.alignDecimal(J),ie=Y.alignDecimal(J),re=(ee+ie).toString(),he=u(re),oe=he.negativeStr,ae=he.trimStr,Ee="".concat(oe).concat(ae.padStart(J+1,"0"));return new N("".concat(Ee.slice(0,-J),".").concat(Ee.slice(-J)))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return this.nan}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(j){return this.toString()===(j==null?void 0:j.toString())}},{key:"lessEquals",value:function(j){return this.add(j.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return j?this.isInvalidate()?"":u("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),N}();function R(N){return p()?new w(N):new O(N)}function x(N,U,j){var Y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(N==="")return"";var J=u(N),ee=J.negativeStr,ie=J.integerStr,re=J.decimalStr,he="".concat(U).concat(re),oe="".concat(ee).concat(ie);if(j>=0){var ae=Number(re[j]);if(ae>=5&&!Y){var Ee=R(N).add("".concat(ee,"0.").concat("0".repeat(j)).concat(10-ae));return x(Ee.toString(),U,j,Y)}return j===0?oe:"".concat(oe).concat(U).concat(re.padEnd(j,"0").slice(0,j))}return he===".0"?oe:"".concat(oe).concat(he)}var I=Z("EOd9"),k=200,A=600;function P(N){var U=N.prefixCls,j=N.upNode,Y=N.downNode,J=N.upDisabled,ee=N.downDisabled,ie=N.onStep,re=X.useRef(),he=X.useRef();he.current=ie;var oe=function(Ae,Oe){Ae.preventDefault(),he.current(Oe);function Ke(){he.current(Oe),re.current=setTimeout(Ke,k)}re.current=setTimeout(Ke,A)},ae=function(){clearTimeout(re.current)};if(X.useEffect(function(){return ae},[]),Object(I.a)())return null;var Ee="".concat(U,"-handler"),Le=W()(Ee,"".concat(Ee,"-up"),Object(Se.a)({},"".concat(Ee,"-up-disabled"),J)),Fe=W()(Ee,"".concat(Ee,"-down"),Object(Se.a)({},"".concat(Ee,"-down-disabled"),ee)),Xe={unselectable:"on",role:"button",onMouseUp:ae,onMouseLeave:ae};return X.createElement("div",{className:"".concat(Ee,"-wrap")},X.createElement("span",Object(se.a)({},Xe,{onMouseDown:function(Ae){oe(Ae,!0)},"aria-label":"Increase Value","aria-disabled":J,className:Le}),j||X.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner")})),X.createElement("span",Object(se.a)({},Xe,{onMouseDown:function(Ae){oe(Ae,!1)},"aria-label":"Decrease Value","aria-disabled":ee,className:Fe}),Y||X.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner")})))}var S=Z("B/uU");function C(N,U){var j=Object(X.useRef)(null);function Y(){try{var ee=N.selectionStart,ie=N.selectionEnd,re=N.value,he=re.substring(0,ee),oe=re.substring(ie);j.current={start:ee,end:ie,value:re,beforeTxt:he,afterTxt:oe}}catch(ae){}}function J(){if(N&&j.current&&U)try{var ee=N.value,ie=j.current,re=ie.beforeTxt,he=ie.afterTxt,oe=ie.start,ae=ee.length;if(ee.endsWith(he))ae=ee.length-j.current.afterTxt.length;else if(ee.startsWith(re))ae=re.length;else{var Ee=re[oe-1],Le=ee.indexOf(Ee,oe-1);Le!==-1&&(ae=Le+1)}N.setSelectionRange(ae,ae)}catch(Fe){Object(S.a)(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(Fe.message))}}return[Y,J]}var c=Z("IRwA"),o=function(){var N=Object(X.useRef)(0),U=function(){c.a.cancel(N.current)};return Object(X.useEffect)(function(){return U},[]),function(j){U(),N.current=Object(c.a)(function(){j()})}},v=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","controls","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep"],l=function(U,j){return U||j.isEmpty()?j.toString():j.toNumber()},a=function(U){var j=R(U);return j.isInvalidate()?null:j},T=X.forwardRef(function(N,U){var j,Y=N.prefixCls,J=Y===void 0?"rc-input-number":Y,ee=N.className,ie=N.style,re=N.min,he=N.max,oe=N.step,ae=oe===void 0?1:oe,Ee=N.defaultValue,Le=N.value,Fe=N.disabled,Xe=N.readOnly,He=N.upHandler,Ae=N.downHandler,Oe=N.keyboard,Ke=N.controls,de=Ke===void 0?!0:Ke,xe=N.stringMode,Ie=N.parser,De=N.formatter,Be=N.precision,ze=N.decimalSeparator,Ye=N.onChange,Ze=N.onInput,ut=N.onPressEnter,Qe=N.onStep,st=Object(le.a)(N,v),Ne="".concat(J,"-input"),vt=X.useRef(null),ht=X.useState(!1),Ue=Object(ye.a)(ht,2),Ve=Ue[0],Ce=Ue[1],_e=X.useRef(!1),Te=X.useRef(!1),ne=X.useRef(!1),ue=X.useState(function(){return R(Le!=null?Le:Ee)}),fe=Object(ye.a)(ue,2),me=fe[0],we=fe[1];function Me(nt){Le===void 0&&we(nt)}var je=X.useCallback(function(nt,Ot){return Ot?void 0:Be>=0?Be:Math.max(b(nt),b(ae))},[Be,ae]),qe=X.useCallback(function(nt){var Ot=String(nt);if(Ie)return Ie(Ot);var Kt=Ot;return ze&&(Kt=Kt.replace(ze,".")),Kt.replace(/[^\w.-]+/g,"")},[Ie,ze]),ct=X.useRef(""),et=X.useCallback(function(nt,Ot){if(De)return De(nt,{userTyping:Ot,input:String(ct.current)});var Kt=typeof nt=="number"?E(nt):nt;if(!Ot){var Pt=je(Kt,Ot);if(_(Kt)&&(ze||Pt>=0)){var br=ze||".";Kt=x(Kt,br,Pt)}}return Kt},[De,je,ze]),kt=X.useState(function(){var nt=Ee!=null?Ee:Le;return me.isInvalidate()&&["string","number"].includes(Object(ce.a)(nt))?Number.isNaN(nt)?"":nt:et(me.toString(),!1)}),Ct=Object(ye.a)(kt,2),pt=Ct[0],Nt=Ct[1];ct.current=pt;function Et(nt,Ot){Nt(et(nt.isInvalidate()?nt.toString(!1):nt.toString(!Ot),Ot))}var wt=X.useMemo(function(){return a(he)},[he,Be]),Ht=X.useMemo(function(){return a(re)},[re,Be]),It=X.useMemo(function(){return!wt||!me||me.isInvalidate()?!1:wt.lessEquals(me)},[wt,me]),rr=X.useMemo(function(){return!Ht||!me||me.isInvalidate()?!1:me.lessEquals(Ht)},[Ht,me]),Rr=C(vt.current,Ve),ar=Object(ye.a)(Rr,2),xr=ar[0],tt=ar[1],At=function(Ot){return wt&&!Ot.lessEquals(wt)?wt:Ht&&!Ht.lessEquals(Ot)?Ht:null},Lt=function(Ot){return!At(Ot)},Ut=function(Ot,Kt){var Pt=Ot,br=Lt(Pt)||Pt.isEmpty();if(!Pt.isEmpty()&&!Kt&&(Pt=At(Pt)||Pt,br=!0),!Xe&&!Fe&&br){var Xr=Pt.toString(),St=je(Xr,Kt);return St>=0&&(Pt=R(x(Xr,".",St)),Lt(Pt)||(Pt=R(x(Xr,".",St,!0)))),Pt.equals(me)||(Me(Pt),Ye==null||Ye(Pt.isEmpty()?null:l(xe,Pt)),Le===void 0&&Et(Pt,Kt)),Pt}return me},fr=o(),Yt=function nt(Ot){if(xr(),Nt(Ot),!Te.current){var Kt=qe(Ot),Pt=R(Kt);Pt.isNaN()||Ut(Pt,!0)}Ze==null||Ze(Ot),fr(function(){var br=Ot;Ie||(br=Ot.replace(/。/g,".")),br!==Ot&&nt(br)})},mt=function(){Te.current=!0},sr=function(){Te.current=!1,Yt(vt.current.value)},Qt=function(Ot){Yt(Ot.target.value)},Jt=function(Ot){var Kt;if(Ot&&It||!Ot&&rr)return;_e.current=!1;var Pt=R(ne.current?f(ae):ae);Ot||(Pt=Pt.negate());var br=(me||R(0)).add(Pt.toString()),Xr=Ut(br,!1);Qe==null||Qe(l(xe,Xr),{offset:ne.current?f(ae):ae,type:Ot?"up":"down"}),(Kt=vt.current)===null||Kt===void 0||Kt.focus()},Dt=function(Ot){var Kt=R(qe(pt)),Pt=Kt;Kt.isNaN()?Pt=me:Pt=Ut(Kt,Ot),Le!==void 0?Et(me,!1):Pt.isNaN()||Et(Pt,!1)},dr=function(){_e.current=!0},yr=function(Ot){var Kt=Ot.which,Pt=Ot.shiftKey;if(_e.current=!0,Pt?ne.current=!0:ne.current=!1,Kt===r.a.ENTER&&(Te.current||(_e.current=!1),Dt(!1),ut==null||ut(Ot)),Oe===!1)return;!Te.current&&[r.a.UP,r.a.DOWN].includes(Kt)&&(Jt(r.a.UP===Kt),Ot.preventDefault())},Yr=function(){_e.current=!1,ne.current=!1},Je=function(){Dt(!1),Ce(!1),_e.current=!1};return Object(H.b)(function(){me.isInvalidate()||Et(me,!1)},[Be]),Object(H.b)(function(){var nt=R(Le);we(nt);var Ot=R(qe(pt));(!nt.equals(Ot)||!_e.current||De)&&Et(nt,_e.current)},[Le]),Object(H.b)(function(){De&&tt()},[pt]),X.createElement("div",{className:W()(J,ee,(j={},Object(Se.a)(j,"".concat(J,"-focused"),Ve),Object(Se.a)(j,"".concat(J,"-disabled"),Fe),Object(Se.a)(j,"".concat(J,"-readonly"),Xe),Object(Se.a)(j,"".concat(J,"-not-a-number"),me.isNaN()),Object(Se.a)(j,"".concat(J,"-out-of-range"),!me.isInvalidate()&&!Lt(me)),j)),style:ie,onFocus:function(){Ce(!0)},onBlur:Je,onKeyDown:yr,onKeyUp:Yr,onCompositionStart:mt,onCompositionEnd:sr,onBeforeInput:dr},de&&X.createElement(P,{prefixCls:J,upNode:He,downNode:Ae,upDisabled:It,downDisabled:rr,onStep:Jt}),X.createElement("div",{className:"".concat(Ne,"-wrap")},X.createElement("input",Object(se.a)({autoComplete:"off",role:"spinbutton","aria-valuemin":re,"aria-valuemax":he,"aria-valuenow":me.isInvalidate()?null:me.toString(),step:ae},st,{ref:Object(D.a)(vt,U),className:Ne,value:pt,onChange:Qt,disabled:Fe,readOnly:Xe}))))});T.displayName="InputNumber";var h=T,n=ve.a=h},ic2d:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return ye});var se=Z("FWmy"),Se=Z("746U");class ce{constructor(){this.data=new Map}add(le,X){se.a(Se.l(le)),se.a(Se.k(X)),se.a(!this.data.has(le),"There is already an extension with this id"),this.data.set(le,X)}as(le){return this.data.get(le)||null}}const ye=new ce},kSUc:function(at,ve,Z){},lZu9:function(at,ve,Z){(function(se){se(Z("VrN/"),Z("1eCo"),Z("8EBN"))})(function(se){"use strict";se.defineMode("markdown",function(Se,ce){var ye=se.getMode(Se,"text/html"),le=ye.name=="null";function X(h){if(se.findModeByName){var n=se.findModeByName(h);n&&(h=n.mime||n.mimes[0])}var N=se.getMode(Se,h);return N.name=="null"?null:N}ce.highlightFormatting===void 0&&(ce.highlightFormatting=!1),ce.maxBlockquoteDepth===void 0&&(ce.maxBlockquoteDepth=0),ce.taskLists===void 0&&(ce.taskLists=!1),ce.strikethrough===void 0&&(ce.strikethrough=!1),ce.emoji===void 0&&(ce.emoji=!1),ce.fencedCodeBlockHighlighting===void 0&&(ce.fencedCodeBlockHighlighting=!0),ce.fencedCodeBlockDefaultMode===void 0&&(ce.fencedCodeBlockDefaultMode="text/plain"),ce.xml===void 0&&(ce.xml=!0),ce.tokenTypeOverrides===void 0&&(ce.tokenTypeOverrides={});var F={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var W in F)F.hasOwnProperty(W)&&ce.tokenTypeOverrides[W]&&(F[W]=ce.tokenTypeOverrides[W]);var r=/^([*\-_])(?:\s*\1){2,}\s*$/,H=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,D=/^\[(x| )\](?=\s)/i,M=ce.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,g=/^ {0,3}(?:\={1,}|-{2,})\s*$/,p=/^[^#!\[\]*_\\<>` "'(~:]+/,u=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,m=/^\s*\[[^\]]+?\]:.*$/,b=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,E=" ";function _(h,n,N){return n.f=n.inline=N,N(h,n)}function f(h,n,N){return n.f=n.block=N,N(h,n)}function O(h){return!h||!/\S/.test(h.string)}function w(h){if(h.linkTitle=!1,h.linkHref=!1,h.linkText=!1,h.em=!1,h.strong=!1,h.strikethrough=!1,h.quote=0,h.indentedCode=!1,h.f==x){var n=le;if(!n){var N=se.innerMode(ye,h.htmlState);n=N.mode.name=="xml"&&N.state.tagStart===null&&!N.state.context&&N.state.tokenize.isInText}n&&(h.f=P,h.block=R,h.htmlState=null)}return h.trailingSpace=0,h.trailingSpaceNewLine=!1,h.prevLine=h.thisLine,h.thisLine={stream:null},null}function R(h,n){var N=h.column()===n.indentation,U=O(n.prevLine.stream),j=n.indentedCode,Y=n.prevLine.hr,J=n.list!==!1,ee=(n.listStack[n.listStack.length-1]||0)+3;n.indentedCode=!1;var ie=n.indentation;if(n.indentationDiff===null&&(n.indentationDiff=n.indentation,J)){for(n.list=null;ie<n.listStack[n.listStack.length-1];)n.listStack.pop(),n.listStack.length?n.indentation=n.listStack[n.listStack.length-1]:n.list=!1;n.list!==!1&&(n.indentationDiff=ie-n.listStack[n.listStack.length-1])}var re=!U&&!Y&&!n.prevLine.header&&(!J||!j)&&!n.prevLine.fencedCodeEnd,he=(n.list===!1||Y||U)&&n.indentation<=ee&&h.match(r),oe=null;if(n.indentationDiff>=4&&(j||n.prevLine.fencedCodeEnd||n.prevLine.header||U))return h.skipToEnd(),n.indentedCode=!0,F.code;if(h.eatSpace())return null;if(N&&n.indentation<=ee&&(oe=h.match(M))&&oe[1].length<=6)return n.quote=0,n.header=oe[1].length,n.thisLine.header=!0,ce.highlightFormatting&&(n.formatting="header"),n.f=n.inline,k(n);if(n.indentation<=ee&&h.eat(">"))return n.quote=N?1:n.quote+1,ce.highlightFormatting&&(n.formatting="quote"),h.eatSpace(),k(n);if(!he&&!n.setext&&N&&n.indentation<=ee&&(oe=h.match(H))){var ae=oe[1]?"ol":"ul";return n.indentation=ie+h.current().length,n.list=!0,n.quote=0,n.listStack.push(n.indentation),n.em=!1,n.strong=!1,n.code=!1,n.strikethrough=!1,ce.taskLists&&h.match(D,!1)&&(n.taskList=!0),n.f=n.inline,ce.highlightFormatting&&(n.formatting=["list","list-"+ae]),k(n)}else{if(N&&n.indentation<=ee&&(oe=h.match(u,!0)))return n.quote=0,n.fencedEndRE=new RegExp(oe[1]+"+ *$"),n.localMode=ce.fencedCodeBlockHighlighting&&X(oe[2]||ce.fencedCodeBlockDefaultMode),n.localMode&&(n.localState=se.startState(n.localMode)),n.f=n.block=I,ce.highlightFormatting&&(n.formatting="code-block"),n.code=-1,k(n);if(n.setext||(!re||!J)&&!n.quote&&n.list===!1&&!n.code&&!he&&!m.test(h.string)&&(oe=h.lookAhead(1))&&(oe=oe.match(g)))return n.setext?(n.header=n.setext,n.setext=0,h.skipToEnd(),ce.highlightFormatting&&(n.formatting="header")):(n.header=oe[0].charAt(0)=="="?1:2,n.setext=n.header),n.thisLine.header=!0,n.f=n.inline,k(n);if(he)return h.skipToEnd(),n.hr=!0,n.thisLine.hr=!0,F.hr;if(h.peek()==="[")return _(h,n,v)}return _(h,n,n.inline)}function x(h,n){var N=ye.token(h,n.htmlState);if(!le){var U=se.innerMode(ye,n.htmlState);(U.mode.name=="xml"&&U.state.tagStart===null&&!U.state.context&&U.state.tokenize.isInText||n.md_inside&&h.current().indexOf(">")>-1)&&(n.f=P,n.block=R,n.htmlState=null)}return N}function I(h,n){var N=n.listStack[n.listStack.length-1]||0,U=n.indentation<N,j=N+3;if(n.fencedEndRE&&n.indentation<=j&&(U||h.match(n.fencedEndRE))){ce.highlightFormatting&&(n.formatting="code-block");var Y;return U||(Y=k(n)),n.localMode=n.localState=null,n.block=R,n.f=P,n.fencedEndRE=null,n.code=0,n.thisLine.fencedCodeEnd=!0,U?f(h,n,n.block):Y}else return n.localMode?n.localMode.token(h,n.localState):(h.skipToEnd(),F.code)}function k(h){var n=[];if(h.formatting){n.push(F.formatting),typeof h.formatting=="string"&&(h.formatting=[h.formatting]);for(var N=0;N<h.formatting.length;N++)n.push(F.formatting+"-"+h.formatting[N]),h.formatting[N]==="header"&&n.push(F.formatting+"-"+h.formatting[N]+"-"+h.header),h.formatting[N]==="quote"&&(!ce.maxBlockquoteDepth||ce.maxBlockquoteDepth>=h.quote?n.push(F.formatting+"-"+h.formatting[N]+"-"+h.quote):n.push("error"))}if(h.taskOpen)return n.push("meta"),n.length?n.join(" "):null;if(h.taskClosed)return n.push("property"),n.length?n.join(" "):null;if(h.linkHref?n.push(F.linkHref,"url"):(h.strong&&n.push(F.strong),h.em&&n.push(F.em),h.strikethrough&&n.push(F.strikethrough),h.emoji&&n.push(F.emoji),h.linkText&&n.push(F.linkText),h.code&&n.push(F.code),h.image&&n.push(F.image),h.imageAltText&&n.push(F.imageAltText,"link"),h.imageMarker&&n.push(F.imageMarker)),h.header&&n.push(F.header,F.header+"-"+h.header),h.quote&&(n.push(F.quote),!ce.maxBlockquoteDepth||ce.maxBlockquoteDepth>=h.quote?n.push(F.quote+"-"+h.quote):n.push(F.quote+"-"+ce.maxBlockquoteDepth)),h.list!==!1){var U=(h.listStack.length-1)%3;U?U===1?n.push(F.list2):n.push(F.list3):n.push(F.list1)}return h.trailingSpaceNewLine?n.push("trailing-space-new-line"):h.trailingSpace&&n.push("trailing-space-"+(h.trailingSpace%2?"a":"b")),n.length?n.join(" "):null}function A(h,n){return h.match(p,!0)?k(n):void 0}function P(h,n){var N=n.text(h,n);if(typeof N!="undefined")return N;if(n.list)return n.list=null,k(n);if(n.taskList){var U=h.match(D,!0)[1]===" ";return U?n.taskOpen=!0:n.taskClosed=!0,ce.highlightFormatting&&(n.formatting="task"),n.taskList=!1,k(n)}if(n.taskOpen=!1,n.taskClosed=!1,n.header&&h.match(/^#+$/,!0))return ce.highlightFormatting&&(n.formatting="header"),k(n);var j=h.next();if(n.linkTitle){n.linkTitle=!1;var Y=j;j==="("&&(Y=")"),Y=(Y+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var J="^\\s*(?:[^"+Y+"\\\\]+|\\\\\\\\|\\\\.)"+Y;if(h.match(new RegExp(J),!0))return F.linkHref}if(j==="`"){var ee=n.formatting;ce.highlightFormatting&&(n.formatting="code"),h.eatWhile("`");var ie=h.current().length;if(n.code==0&&(!n.quote||ie==1))return n.code=ie,k(n);if(ie==n.code){var re=k(n);return n.code=0,re}else return n.formatting=ee,k(n)}else if(n.code)return k(n);if(j==="\\"&&(h.next(),ce.highlightFormatting)){var he=k(n),oe=F.formatting+"-escape";return he?he+" "+oe:oe}if(j==="!"&&h.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return n.imageMarker=!0,n.image=!0,ce.highlightFormatting&&(n.formatting="image"),k(n);if(j==="["&&n.imageMarker&&h.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return n.imageMarker=!1,n.imageAltText=!0,ce.highlightFormatting&&(n.formatting="image"),k(n);if(j==="]"&&n.imageAltText){ce.highlightFormatting&&(n.formatting="image");var he=k(n);return n.imageAltText=!1,n.image=!1,n.inline=n.f=C,he}if(j==="["&&!n.image)return n.linkText&&h.match(/^.*?\]/)||(n.linkText=!0,ce.highlightFormatting&&(n.formatting="link")),k(n);if(j==="]"&&n.linkText){ce.highlightFormatting&&(n.formatting="link");var he=k(n);return n.linkText=!1,n.inline=n.f=h.match(/\(.*?\)| ?\[.*?\]/,!1)?C:P,he}if(j==="<"&&h.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=S,ce.highlightFormatting&&(n.formatting="link");var he=k(n);return he?he+=" ":he="",he+F.linkInline}if(j==="<"&&h.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=S,ce.highlightFormatting&&(n.formatting="link");var he=k(n);return he?he+=" ":he="",he+F.linkEmail}if(ce.xml&&j==="<"&&h.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ae=h.string.indexOf(">",h.pos);if(ae!=-1){var Ee=h.string.substring(h.start,ae);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ee)&&(n.md_inside=!0)}return h.backUp(1),n.htmlState=se.startState(ye),f(h,n,x)}if(ce.xml&&j==="<"&&h.match(/^\/\w*?>/))return n.md_inside=!1,"tag";if(j==="*"||j==="_"){for(var Le=1,Fe=h.pos==1?" ":h.string.charAt(h.pos-2);Le<3&&h.eat(j);)Le++;var Xe=h.peek()||" ",He=!/\s/.test(Xe)&&(!b.test(Xe)||/\s/.test(Fe)||b.test(Fe)),Ae=!/\s/.test(Fe)&&(!b.test(Fe)||/\s/.test(Xe)||b.test(Xe)),Oe=null,Ke=null;if(Le%2&&(!n.em&&He&&(j==="*"||!Ae||b.test(Fe))?Oe=!0:n.em==j&&Ae&&(j==="*"||!He||b.test(Xe))&&(Oe=!1)),Le>1&&(!n.strong&&He&&(j==="*"||!Ae||b.test(Fe))?Ke=!0:n.strong==j&&Ae&&(j==="*"||!He||b.test(Xe))&&(Ke=!1)),Ke!=null||Oe!=null){ce.highlightFormatting&&(n.formatting=Oe==null?"strong":Ke==null?"em":"strong em"),Oe===!0&&(n.em=j),Ke===!0&&(n.strong=j);var re=k(n);return Oe===!1&&(n.em=!1),Ke===!1&&(n.strong=!1),re}}else if(j===" "&&(h.eat("*")||h.eat("_"))){if(h.peek()===" ")return k(n);h.backUp(1)}if(ce.strikethrough){if(j==="~"&&h.eatWhile(j)){if(n.strikethrough){ce.highlightFormatting&&(n.formatting="strikethrough");var re=k(n);return n.strikethrough=!1,re}else if(h.match(/^[^\s]/,!1))return n.strikethrough=!0,ce.highlightFormatting&&(n.formatting="strikethrough"),k(n)}else if(j===" "&&h.match(/^~~/,!0)){if(h.peek()===" ")return k(n);h.backUp(2)}}if(ce.emoji&&j===":"&&h.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){n.emoji=!0,ce.highlightFormatting&&(n.formatting="emoji");var de=k(n);return n.emoji=!1,de}return j===" "&&(h.match(/^ +$/,!1)?n.trailingSpace++:n.trailingSpace&&(n.trailingSpaceNewLine=!0)),k(n)}function S(h,n){var N=h.next();if(N===">"){n.f=n.inline=P,ce.highlightFormatting&&(n.formatting="link");var U=k(n);return U?U+=" ":U="",U+F.linkInline}return h.match(/^[^>]+/,!0),F.linkInline}function C(h,n){if(h.eatSpace())return null;var N=h.next();return N==="("||N==="["?(n.f=n.inline=o(N==="("?")":"]"),ce.highlightFormatting&&(n.formatting="link-string"),n.linkHref=!0,k(n)):"error"}var c={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function o(h){return function(n,N){var U=n.next();if(U===h){N.f=N.inline=P,ce.highlightFormatting&&(N.formatting="link-string");var j=k(N);return N.linkHref=!1,j}return n.match(c[h]),N.linkHref=!0,k(N)}}function v(h,n){return h.match(/^([^\]\\]|\\.)*\]:/,!1)?(n.f=l,h.next(),ce.highlightFormatting&&(n.formatting="link"),n.linkText=!0,k(n)):_(h,n,P)}function l(h,n){if(h.match(/^\]:/,!0)){n.f=n.inline=a,ce.highlightFormatting&&(n.formatting="link");var N=k(n);return n.linkText=!1,N}return h.match(/^([^\]\\]|\\.)+/,!0),F.linkText}function a(h,n){return h.eatSpace()?null:(h.match(/^[^\s]+/,!0),h.peek()===void 0?n.linkTitle=!0:h.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),n.f=n.inline=P,F.linkHref+" url")}var T={startState:function(){return{f:R,prevLine:{stream:null},thisLine:{stream:null},block:R,htmlState:null,indentation:0,inline:P,text:A,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(h){return{f:h.f,prevLine:h.prevLine,thisLine:h.thisLine,block:h.block,htmlState:h.htmlState&&se.copyState(ye,h.htmlState),indentation:h.indentation,localMode:h.localMode,localState:h.localMode?se.copyState(h.localMode,h.localState):null,inline:h.inline,text:h.text,formatting:!1,linkText:h.linkText,linkTitle:h.linkTitle,linkHref:h.linkHref,code:h.code,em:h.em,strong:h.strong,strikethrough:h.strikethrough,emoji:h.emoji,header:h.header,setext:h.setext,hr:h.hr,taskList:h.taskList,list:h.list,listStack:h.listStack.slice(0),quote:h.quote,indentedCode:h.indentedCode,trailingSpace:h.trailingSpace,trailingSpaceNewLine:h.trailingSpaceNewLine,md_inside:h.md_inside,fencedEndRE:h.fencedEndRE}},token:function(h,n){if(n.formatting=!1,h!=n.thisLine.stream){if(n.header=0,n.hr=!1,h.match(/^\s*$/,!0))return w(n),null;if(n.prevLine=n.thisLine,n.thisLine={stream:h},n.taskList=!1,n.trailingSpace=0,n.trailingSpaceNewLine=!1,!n.localState&&(n.f=n.block,n.f!=x)){var N=h.match(/^\s*/,!0)[0].replace(/\t/g,E).length;if(n.indentation=N,n.indentationDiff=null,N>0)return null}}return n.f(h,n)},innerMode:function(h){return h.block==x?{state:h.htmlState,mode:ye}:h.localState?{state:h.localState,mode:h.localMode}:{state:h,mode:T}},indent:function(h,n,N){return h.block==x&&ye.indent?ye.indent(h.htmlState,n,N):h.localState&&h.localMode.indent?h.localMode.indent(h.localState,n,N):se.Pass},blankLine:w,getType:k,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return T},"xml"),se.defineMIME("text/markdown","markdown"),se.defineMIME("text/x-markdown","markdown")})},nEHx:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return se});var se;(function(Se){Se.DARK="dark",Se.LIGHT="light",Se.HIGH_CONTRAST="hc"})(se||(se={}))},nnTU:function(at,ve,Z){"use strict";Z.d(ve,"b",function(){return F}),Z.d(ve,"a",function(){return W});var se=Z("MI8n"),Se=Z("JYp7"),ce=Z("pmY6"),ye=Z("24hK"),le=Z("746U"),X=Z("Cg/j");const F=Object(X.c)("commandService"),W=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new se.b,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(r,H){if(!r)throw new Error("invalid command");if(typeof r=="string"){if(!H)throw new Error("invalid command");return this.registerCommand({id:r,handler:H})}if(r.description){const u=[];for(let b of r.description.args)u.push(b.constraint);const m=r.handler;r.handler=function(b,...E){return Object(le.o)(E,u),m(b,...E)}}const{id:D}=r;let M=this._commands.get(D);M||(M=new ye.a,this._commands.set(D,M));let g=M.unshift(r),p=Object(ce.i)(()=>{g();const u=this._commands.get(D);(u==null?void 0:u.isEmpty())&&this._commands.delete(D)});return this._onDidRegisterCommand.fire(D),p}registerCommandAlias(r,H){return W.registerCommand(r,(D,...M)=>D.get(F).executeCommand(H,...M))}getCommand(r){const H=this._commands.get(r);return!H||H.isEmpty()?void 0:Se.a.first(H)}getCommands(){const r=new Map;for(const H of this._commands.keys()){const D=this.getCommand(H);D&&r.set(H,D)}return r}};W.registerCommand("noop",()=>{})},o46R:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return ce});var se=Z("U8pU");function Se(ye,le){if(Object(se.a)(ye)!=="object"||ye===null)return ye;var X=ye[Symbol.toPrimitive];if(X!==void 0){var F=X.call(ye,le||"default");if(Object(se.a)(F)!=="object")return F;throw new TypeError("@@toPrimitive must return a primitive value.")}return(le==="string"?String:Number)(ye)}function ce(ye){var le=Se(ye,"string");return Object(se.a)(le)==="symbol"?le:String(le)}},osHv:function(at,ve,Z){(function(se){se(Z("VrN/"))})(function(se){"use strict";var Se=se.Pos;function ce(b,E){return b.line-E.line||b.ch-E.ch}var ye="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",le=ye+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",X=new RegExp("<(/?)(["+ye+"]["+le+"]*)","g");function F(b,E,_,f){this.line=E,this.ch=_,this.cm=b,this.text=b.getLine(E),this.min=f?Math.max(f.from,b.firstLine()):b.firstLine(),this.max=f?Math.min(f.to-1,b.lastLine()):b.lastLine()}function W(b,E){var _=b.cm.getTokenTypeAt(Se(b.line,E));return _&&/\btag\b/.test(_)}function r(b){return b.line>=b.max?void 0:(b.ch=0,b.text=b.cm.getLine(++b.line),!0)}function H(b){return b.line<=b.min?void 0:(b.text=b.cm.getLine(--b.line),b.ch=b.text.length,!0)}function D(b){for(;;){var E=b.text.indexOf(">",b.ch);if(E==-1){if(r(b))continue;return}if(!W(b,E+1)){b.ch=E+1;continue}var _=b.text.lastIndexOf("/",E),f=_>-1&&!/\S/.test(b.text.slice(_+1,E));return b.ch=E+1,f?"selfClose":"regular"}}function M(b){for(;;){var E=b.ch?b.text.lastIndexOf("<",b.ch-1):-1;if(E==-1){if(H(b))continue;return}if(!W(b,E+1)){b.ch=E;continue}X.lastIndex=E,b.ch=E;var _=X.exec(b.text);if(_&&_.index==E)return _}}function g(b){for(;;){X.lastIndex=b.ch;var E=X.exec(b.text);if(!E){if(r(b))continue;return}if(!W(b,E.index+1)){b.ch=E.index+1;continue}return b.ch=E.index+E[0].length,E}}function p(b){for(;;){var E=b.ch?b.text.lastIndexOf(">",b.ch-1):-1;if(E==-1){if(H(b))continue;return}if(!W(b,E+1)){b.ch=E;continue}var _=b.text.lastIndexOf("/",E),f=_>-1&&!/\S/.test(b.text.slice(_+1,E));return b.ch=E+1,f?"selfClose":"regular"}}function u(b,E){for(var _=[];;){var f=g(b),O,w=b.line,R=b.ch-(f?f[0].length:0);if(!f||!(O=D(b)))return;if(O=="selfClose")continue;if(f[1]){for(var x=_.length-1;x>=0;--x)if(_[x]==f[2]){_.length=x;break}if(x<0&&(!E||E==f[2]))return{tag:f[2],from:Se(w,R),to:Se(b.line,b.ch)}}else _.push(f[2])}}function m(b,E){for(var _=[];;){var f=p(b);if(!f)return;if(f=="selfClose"){M(b);continue}var O=b.line,w=b.ch,R=M(b);if(!R)return;if(R[1])_.push(R[2]);else{for(var x=_.length-1;x>=0;--x)if(_[x]==R[2]){_.length=x;break}if(x<0&&(!E||E==R[2]))return{tag:R[2],from:Se(b.line,b.ch),to:Se(O,w)}}}}se.registerHelper("fold","xml",function(b,E){for(var _=new F(b,E.line,0);;){var f=g(_);if(!f||_.line!=E.line)return;var O=D(_);if(!O)return;if(!f[1]&&O!="selfClose"){var w=Se(_.line,_.ch),R=u(_,f[2]);return R&&ce(R.from,w)>0?{from:w,to:R.from}:null}}}),se.findMatchingTag=function(b,E,_){var f=new F(b,E.line,E.ch,_);if(f.text.indexOf(">")==-1&&f.text.indexOf("<")==-1)return;var O=D(f),w=O&&Se(f.line,f.ch),R=O&&M(f);if(!O||!R||ce(f,E)>0)return;var x={from:Se(f.line,f.ch),to:w,tag:R[2]};return O=="selfClose"?{open:x,close:null,at:"open"}:R[1]?{open:m(f,R[2]),close:x,at:"close"}:(f=new F(b,w.line,w.ch,_),{open:x,close:u(f,R[2]),at:"open"})},se.findEnclosingTag=function(b,E,_,f){for(var O=new F(b,E.line,E.ch,_);;){var w=m(O,f);if(!w)break;var R=new F(b,E.line,E.ch,_),x=u(R,w.tag);if(x)return{open:w,close:x}}},se.scanForClosingTag=function(b,E,_,f){var O=new F(b,E.line,E.ch,f?{from:0,to:f}:null);return u(O,_)}})},p5ED:function(at,ve,Z){"use strict";var se=Z("dLI4"),Se=Z("4d5L"),ce=Z("YfA7"),ye=Z("e4Gi"),le=Z("YaWb"),X=Z("IYef"),F=Z("Hqw+"),W=Z("XXmO"),r=Z.n(W),H=Z("T/Jt"),D=Z.n(H),M=Z("vHTk"),g=Z.n(M),p=Z("yEEn"),u=Z("ZW9T"),m=Z("1vsH"),b=Z("V0Rq"),E=Z("m3rI");ve.a=function(_){var f,O,w,R,x,I,k,A=_.editOffice,P=A===void 0?"view":A,S=_.data,C=_.theme,c=_.type,o=_.filename,v=_.monacoEditor,l=_.className,a=_.style,T=_.close,h=_.onClose,n=_.hasMask,N=_.disabledDownload,U=Object(H.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),j=Object(F.a)(U,2),Y=j[0],J=j[1],ee=Object(H.useState)(""),ie=Object(F.a)(ee,2),re=ie[0],he=ie[1],oe=Object(H.useState)(),ae=Object(F.a)(oe,2),Ee=ae[0],Le=ae[1],Fe=window.ENV==="build"?"/react/build":"",Xe=E.a.PROXY_SERVER||location.origin,He,Ae=1024*1024,Oe=10*Ae,Ke=Object(H.useRef)();(f=S)!==null&&f!==void 0&&f.startsWith("/api")&&c!=="txt"&&(S=E.a.API_SERVER+S),c==="office"&&(He=Object(m.U)(S).filesize,He>Oe&&(c="other")),o&&v&&(v.filename=o),Object(H.useEffect)(function(){var De,Be,ze=(De=document.cookie)===null||De===void 0||((Be=De.replace(/\s/g,""))===null||Be===void 0)?void 0:Be.split(";");ze==null||ze.map(function(Ye){var Ze=Ye.split("=");Ze[0]==="_educoder_session"&&he(Ze[1])})},[]),Object(H.useEffect)(function(){c==="office"&&de()},[c,S]);var de=function(){var De=Object(X.a)(r.a.mark(function Be(){var ze,Ye,Ze;return r.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:return console.log("data:",S),ze=S,S.startsWith("http")||(ze=location.origin+ze),Ye=new URL(ze).pathname.split("/").pop(),Qe.next=6,Object(b.V)({attachment_id:Ye});case 6:Ze=Qe.sent,Le(Ze);case 8:case"end":return Qe.stop()}},Be)}));return function(){return De.apply(this,arguments)}}(),xe=function(){if(S.startsWith("http")||S.startsWith("blob:")){Ie();return}Object(m.z)(o||"educoder",S,o)},Ie=function(){Object(m.x)(o||"educoder",decodeURIComponent(S))};return D.a.createElement("div",{style:Object(le.a)({},a||{}),className:"".concat(n&&g.a.bgBlack," ").concat(c?g.a.wrp:"hide")},T&&D.a.createElement("div",{className:g.a.close,ref:Ke},!N&&D.a.createElement(ye.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Ke.current}},D.a.createElement("span",{onClick:Ie},D.a.createElement("i",{className:"icon-quxiaozhiding"}))),D.a.createElement(ye.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Ke.current}},D.a.createElement("span",{className:"",onClick:h},D.a.createElement("i",{className:"icon-guanbi1"})))),D.a.createElement("div",{className:"".concat(g.a[l]," ").concat(l," ").concat(g.a.monaco," ").concat(c==="txt"?"show":"hide")},c==="txt"&&D.a.createElement(u.b,v)),c==="audio"&&D.a.createElement("audio",{src:"".concat(((O=S)===null||O===void 0?void 0:O.indexOf("http://"))>-1||((w=S)===null||w===void 0?void 0:w.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(S),autoPlay:!0}),c==="video"&&D.a.createElement(D.a.Fragment,null,((R=S)===null||R===void 0?void 0:R.indexOf("http"))>-1?D.a.createElement("video",{controls:!0,src:"".concat(S),autoPlay:!0}):D.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(S),autoPlay:!0})),c==="office"&&Ee&&D.a.createElement("iframe",{src:"".concat(Fe,"/office.html?key=").concat(Ee.key,"&url=").concat(Xe+Ee.url,"&callbackUrl=").concat(Xe+Ee.callbackUrl,"&fileType=").concat(Ee.fileType,"&title=").concat(Ee.title,"&model=").concat(P,"&officeServer=").concat(E.a.OFFICE_SERVER,"&disabledDownload=").concat(!!N)}),c==="html"&&D.a.createElement("iframe",{src:S+"&disposition=inline"}),c==="pdf"&&D.a.createElement("iframe",{src:"".concat(Fe,"/js/pdfview/index.html?url=").concat(S,"&disabledDownload=").concat(!!N)}),c==="image"&&D.a.createElement("img",{src:"".concat(((x=S)===null||x===void 0?void 0:x.indexOf("http://"))>-1||((I=S)===null||I===void 0?void 0:I.indexOf("https://"))>-1||(k=S)!==null&&k!==void 0&&k.startsWith("/api")?"":"data:image/png;base64,").concat(S)}),c==="other"&&D.a.createElement("div",null,D.a.createElement(Se.a,{type:"primary",size:"large",onClick:xe},D.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),c==="download"&&D.a.createElement(Se.a,{type:"primary",size:"large",onClick:xe},D.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(at,ve,Z){},pmY6:function(at,ve,Z){"use strict";Z.d(ve,"h",function(){return H}),Z.d(ve,"g",function(){return M}),Z.d(ve,"f",function(){return g}),Z.d(ve,"e",function(){return p}),Z.d(ve,"i",function(){return u}),Z.d(ve,"b",function(){return m}),Z.d(ve,"a",function(){return b}),Z.d(ve,"d",function(){return E}),Z.d(ve,"c",function(){return _});var se=Z("C/vA"),Se=Z("JYp7");const ce=!1;let ye=null;function le(f){ye=f}if(ce){const f="__is_disposable_tracked__";le(new class{trackDisposable(O){const w=new Error("Potentially leaked disposable").stack;setTimeout(()=>{O[f]||console.log(w)},3e3)}setParent(O,w){if(O&&O!==b.None)try{O[f]=!0}catch(R){}}markAsDisposed(O){if(O&&O!==b.None)try{O[f]=!0}catch(w){}}markAsSingleton(O){}})}function X(f){return ye==null||ye.trackDisposable(f),f}function F(f){ye==null||ye.markAsDisposed(f)}function W(f,O){ye==null||ye.setParent(f,O)}function r(f,O){if(!ye)return;for(const w of f)ye.setParent(w,O)}function H(f){return ye==null||ye.markAsSingleton(f),f}class D extends Error{constructor(f){super(`Encountered errors while disposing of store. Errors: [${f.join(", ")}]`);this.errors=f}}function M(f){return typeof f.dispose=="function"&&f.dispose.length===0}function g(f){if(Se.a.is(f)){let O=[];for(const w of f)if(w)try{w.dispose()}catch(R){O.push(R)}if(O.length===1)throw O[0];if(O.length>1)throw new D(O);return Array.isArray(f)?[]:f}else if(f)return f.dispose(),f}function p(...f){const O=u(()=>g(f));return r(f,O),O}function u(f){const O=X({dispose:Object(se.a)(()=>{F(O),f()})});return O}class m{constructor(){this._toDispose=new Set,this._isDisposed=!1,X(this)}dispose(){if(this._isDisposed)return;F(this),this._isDisposed=!0,this.clear()}clear(){try{g(this._toDispose.values())}finally{this._toDispose.clear()}}add(f){if(!f)return f;if(f===this)throw new Error("Cannot register a disposable on itself!");return W(f,this),this._isDisposed?m.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(f),f}}m.DISABLE_DISPOSED_WARNING=!1;class b{constructor(){this._store=new m,X(this),W(this._store,this)}dispose(){F(this),this._store.dispose()}_register(f){if(f===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(f)}}b.None=Object.freeze({dispose(){}});class E{constructor(){this._isDisposed=!1,X(this)}get value(){return this._isDisposed?void 0:this._value}set value(f){var O;if(this._isDisposed||f===this._value)return;(O=this._value)===null||O===void 0||O.dispose(),f&&W(f,this),this._value=f}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,F(this),(f=this._value)===null||f===void 0||f.dispose(),this._value=void 0}clearAndLeak(){const f=this._value;return this._value=void 0,f&&W(f,null),f}}class _{constructor(f){this.object=f}dispose(){}}},psGv:function(at,ve,Z){var se,Se;(function(){var ce;(function(){"use strict";var F=[,,function(D){function M(u){this.__parent=u,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=[]}M.prototype.clone_empty=function(){var u=new M(this.__parent);return u.set_indent(this.__indent_count,this.__alignment_count),u},M.prototype.item=function(u){return u<0?this.__items[this.__items.length+u]:this.__items[u]},M.prototype.has_match=function(u){for(var m=this.__items.length-1;m>=0;m--)if(this.__items[m].match(u))return!0;return!1},M.prototype.set_indent=function(u,m){this.is_empty()&&(this.__indent_count=u||0,this.__alignment_count=m||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},M.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)},M.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},M.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var u=this.__parent.current_line;return u.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),u.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),u.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,u.__items[0]===" "&&(u.__items.splice(0,1),u.__character_count-=1),!0}return!1},M.prototype.is_empty=function(){return this.__items.length===0},M.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},M.prototype.push=function(u){this.__items.push(u);var m=u.lastIndexOf(`
|
|
`);m!==-1?this.__character_count=u.length-m:this.__character_count+=u.length},M.prototype.pop=function(){var u=null;return this.is_empty()||(u=this.__items.pop(),this.__character_count-=u.length),u},M.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},M.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},M.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},M.prototype.toString=function(){var u="";return this.is_empty()?this.__parent.indent_empty_lines&&(u=this.__parent.get_indent_string(this.__indent_count)):(u=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),u+=this.__items.join("")),u};function g(u,m){this.__cache=[""],this.__indent_size=u.indent_size,this.__indent_string=u.indent_char,u.indent_with_tabs||(this.__indent_string=new Array(u.indent_size+1).join(u.indent_char)),m=m||"",u.indent_level>0&&(m=new Array(u.indent_level+1).join(this.__indent_string)),this.__base_string=m,this.__base_string_length=m.length}g.prototype.get_indent_size=function(u,m){var b=this.__base_string_length;return m=m||0,u<0&&(b=0),b+=u*this.__indent_size,b+=m,b},g.prototype.get_indent_string=function(u,m){var b=this.__base_string;return m=m||0,u<0&&(u=0,b=""),m+=u*this.__indent_size,this.__ensure_cache(m),b+=this.__cache[m],b},g.prototype.__ensure_cache=function(u){for(;u>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var u=this.__cache.length,m=0,b="";this.__indent_size&&u>=this.__indent_size&&(m=Math.floor(u/this.__indent_size),u-=m*this.__indent_size,b=new Array(m+1).join(this.__indent_string)),u&&(b+=new Array(u+1).join(" ")),this.__cache.push(b)};function p(u,m){this.__indent_cache=new g(u,m),this.raw=!1,this._end_with_newline=u.end_with_newline,this.indent_size=u.indent_size,this.wrap_line_length=u.wrap_line_length,this.indent_empty_lines=u.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new M(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(u,m){return this.__indent_cache.get_indent_string(u,m)},p.prototype.get_indent_size=function(u,m){return this.__indent_cache.get_indent_size(u,m)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(u){return this.is_empty()||!u&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(u){this.trim(!0);var m=this.current_line.pop();m&&(m[m.length-1]===`
|
|
`&&(m=m.replace(/\n+$/g,"")),this.current_line.push(m)),this._end_with_newline&&this.__add_outputline();var b=this.__lines.join(`
|
|
`);return u!==`
|
|
`&&(b=b.replace(/[\n]/g,u)),b},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(u,m){return u=u||0,m=m||0,this.next_line.set_indent(u,m),this.__lines.length>1?(this.current_line.set_indent(u,m),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(u){for(var m=0;m<u.newlines;m++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(u.whitespace_before),this.current_line.push(u.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(u){this.__add_space_before_token(),this.current_line.push(u),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(u){for(var m=this.__lines.length;u<m;)this.__lines[u]._remove_indent(),u++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(u){for(u=u===void 0?!1:u,this.current_line.trim();u&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(u,m){for(var b=this.__lines.length-2;b>=0;){var E=this.__lines[b];if(E.is_empty())break;if(E.item(0).indexOf(u)!==0&&E.item(-1)!==m){this.__lines.splice(b+1,0,new M(this)),this.previous_line=this.__lines[this.__lines.length-2];break}b--}},D.exports.Output=p},function(D){function M(g,p,u,m){this.type=g,this.text=p,this.comments_before=null,this.newlines=u||0,this.whitespace_before=m||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}D.exports.Token=M},,,function(D){function M(u,m){this.raw_options=g(u,m),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"])}M.prototype._get_array=function(u,m){var b=this.raw_options[u],E=m||[];return typeof b=="object"?b!==null&&typeof b.concat=="function"&&(E=b.concat()):typeof b=="string"&&(E=b.split(/[^a-zA-Z0-9_\/\-]+/)),E},M.prototype._get_boolean=function(u,m){var b=this.raw_options[u],E=b===void 0?!!m:!!b;return E},M.prototype._get_characters=function(u,m){var b=this.raw_options[u],E=m||"";return typeof b=="string"&&(E=b.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),E},M.prototype._get_number=function(u,m){var b=this.raw_options[u];m=parseInt(m,10),isNaN(m)&&(m=0);var E=parseInt(b,10);return isNaN(E)&&(E=m),E},M.prototype._get_selection=function(u,m,b){var E=this._get_selection_list(u,m,b);if(E.length!==1)throw new Error("Invalid Option Value: The option '"+u+`' can only be one of the following values:
|
|
`+m+`
|
|
You passed in: '`+this.raw_options[u]+"'");return E[0]},M.prototype._get_selection_list=function(u,m,b){if(!m||m.length===0)throw new Error("Selection list cannot be empty.");if(b=b||[m[0]],!this._is_valid_selection(b,m))throw new Error("Invalid Default Value!");var E=this._get_array(u,b);if(!this._is_valid_selection(E,m))throw new Error("Invalid Option Value: The option '"+u+`' can contain only the following values:
|
|
`+m+`
|
|
You passed in: '`+this.raw_options[u]+"'");return E},M.prototype._is_valid_selection=function(u,m){return u.length&&m.length&&!u.some(function(b){return m.indexOf(b)===-1})};function g(u,m){var b={};u=p(u);var E;for(E in u)E!==m&&(b[E]=u[E]);if(m&&u[m])for(E in u[m])b[E]=u[m][E];return b}function p(u){var m={},b;for(b in u){var E=b.replace(/-/g,"_");m[E]=u[b]}return m}D.exports.Options=M,D.exports.normalizeOpts=p,D.exports.mergeOpts=g},,function(D){var M=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},g.prototype.peek=function(p){var u=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(u=this.__input.charAt(p)),u},g.prototype.__match=function(p,u){p.lastIndex=u;var m=p.exec(this.__input);return m&&!(M&&p.sticky)&&(m.index!==u&&(m=null)),m},g.prototype.test=function(p,u){return u=u||0,u+=this.__position,u>=0&&u<this.__input_length?!!this.__match(p,u):!1},g.prototype.testChar=function(p,u){var m=this.peek(u);return p.lastIndex=0,m!==null&&p.test(m)},g.prototype.match=function(p){var u=this.__match(p,this.__position);return u?this.__position+=u[0].length:u=null,u},g.prototype.read=function(p,u,m){var b="",E;return p&&(E=this.match(p),E&&(b+=E[0])),u&&(E||!p)&&(b+=this.readUntil(u,m)),b},g.prototype.readUntil=function(p,u){var m="",b=this.__position;p.lastIndex=this.__position;var E=p.exec(this.__input);return E?(b=E.index,u&&(b+=E[0].length)):b=this.__input_length,m=this.__input.substring(this.__position,b),this.__position=b,m},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,u){var m=null,b="g";return u&&M&&(b="y"),typeof p=="string"&&p!==""?m=new RegExp(p,b):p&&(m=new RegExp(p.source,b)),m},g.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(p){var u=this.__position,m=this.readUntilAfter(p);return this.__position=u,m},g.prototype.lookBack=function(p){var u=this.__position-1;return u>=p.length&&this.__input.substring(u-p.length,u).toLowerCase()===p},D.exports.InputScanner=g},function(D,M,g){var p=g(8).InputScanner,u=g(3).Token,m=g(10).TokenStream,b=g(11).WhitespacePattern,E={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},_=function(f,O){this._input=new p(f),this._options=O||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new b(this._input)};_.prototype.tokenize=function(){this._input.restart(),this.__tokens=new m,this._reset();for(var f,O=new u(E.START,""),w=null,R=[],x=new m;O.type!==E.EOF;){for(f=this._get_next_token(O,w);this._is_comment(f);)x.add(f),f=this._get_next_token(O,w);x.isEmpty()||(f.comments_before=x,x=new m),f.parent=w,this._is_opening(f)?(R.push(w),w=f):w&&this._is_closing(f,w)&&(f.opened=w,w.closed=f,w=R.pop(),f.parent=w),f.previous=O,O.next=f,this.__tokens.add(f),O=f}return this.__tokens},_.prototype._is_first_token=function(){return this.__tokens.isEmpty()},_.prototype._reset=function(){},_.prototype._get_next_token=function(f,O){this._readWhitespace();var w=this._input.read(/.+/g);return w?this._create_token(E.RAW,w):this._create_token(E.EOF,"")},_.prototype._is_comment=function(f){return!1},_.prototype._is_opening=function(f){return!1},_.prototype._is_closing=function(f,O){return!1},_.prototype._create_token=function(f,O){var w=new u(f,O,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},_.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},D.exports.Tokenizer=_,D.exports.TOKEN=E},function(D){function M(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}M.prototype.restart=function(){this.__position=0},M.prototype.isEmpty=function(){return this.__tokens_length===0},M.prototype.hasNext=function(){return this.__position<this.__tokens_length},M.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__tokens[this.__position],this.__position+=1),g},M.prototype.peek=function(g){var p=null;return g=g||0,g+=this.__position,g>=0&&g<this.__tokens_length&&(p=this.__tokens[g]),p},M.prototype.add=function(g){this.__parent_token&&(g.parent=this.__parent_token),this.__tokens.push(g),this.__tokens_length+=1},D.exports.TokenStream=M},function(D,M,g){var p=g(12).Pattern;function u(m,b){p.call(this,m,b),b?this._line_regexp=this._input.get_regexp(b._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}u.prototype=new p,u.prototype.__set_whitespace_patterns=function(m,b){m+="\\t ",b+="\\n\\r",this._match_pattern=this._input.get_regexp("["+m+b+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+b+"]")},u.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var m=this._input.read(this._match_pattern);if(m===" ")this.whitespace_before_token=" ";else if(m){var b=this.__split(this._newline_regexp,m);this.newline_count=b.length-1,this.whitespace_before_token=b[this.newline_count]}return m},u.prototype.matching=function(m,b){var E=this._create();return E.__set_whitespace_patterns(m,b),E._update(),E},u.prototype._create=function(){return new u(this._input,this)},u.prototype.__split=function(m,b){m.lastIndex=0;for(var E=0,_=[],f=m.exec(b);f;)_.push(b.substring(E,f.index)),E=f.index+f[0].length,f=m.exec(b);return E<b.length?_.push(b.substring(E,b.length)):_.push(""),_},D.exports.WhitespacePattern=u},function(D){function M(g,p){this._input=g,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,p&&(this._starting_pattern=this._input.get_regexp(p._starting_pattern,!0),this._match_pattern=this._input.get_regexp(p._match_pattern,!0),this._until_pattern=this._input.get_regexp(p._until_pattern),this._until_after=p._until_after)}M.prototype.read=function(){var g=this._input.read(this._starting_pattern);return(!this._starting_pattern||g)&&(g+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),g},M.prototype.read_match=function(){return this._input.match(this._match_pattern)},M.prototype.until_after=function(g){var p=this._create();return p._until_after=!0,p._until_pattern=this._input.get_regexp(g),p._update(),p},M.prototype.until=function(g){var p=this._create();return p._until_after=!1,p._until_pattern=this._input.get_regexp(g),p._update(),p},M.prototype.starting_with=function(g){var p=this._create();return p._starting_pattern=this._input.get_regexp(g,!0),p._update(),p},M.prototype.matching=function(g){var p=this._create();return p._match_pattern=this._input.get_regexp(g,!0),p._update(),p},M.prototype._create=function(){return new M(this._input,this)},M.prototype._update=function(){},D.exports.Pattern=M},function(D){function M(g,p){g=typeof g=="string"?g:g.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+p,"g")}M.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var u=this.__directive_pattern.exec(g);u;)p[u[1]]=u[2],u=this.__directive_pattern.exec(g);return p},M.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},D.exports.Directives=M},function(D,M,g){var p=g(12).Pattern,u={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function m(b,E){p.call(this,b,E),this.__template_pattern=null,this._disabled=Object.assign({},u),this._excluded=Object.assign({},u),E&&(this.__template_pattern=this._input.get_regexp(E.__template_pattern),this._excluded=Object.assign(this._excluded,E._excluded),this._disabled=Object.assign(this._disabled,E._disabled));var _=new p(b);this.__patterns={handlebars_comment:_.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:_.starting_with(/{{{/).until_after(/}}}/),handlebars:_.starting_with(/{{/).until_after(/}}/),php:_.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:_.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:_.starting_with(/{%/).until_after(/%}/),django_value:_.starting_with(/{{/).until_after(/}}/),django_comment:_.starting_with(/{#/).until_after(/#}/),smarty:_.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:_.starting_with(/{\*/).until_after(/\*}/),smarty_literal:_.starting_with(/{literal}/).until_after(/{\/literal}/)}}m.prototype=new p,m.prototype._create=function(){return new m(this._input,this)},m.prototype._update=function(){this.__set_templated_pattern()},m.prototype.disable=function(b){var E=this._create();return E._disabled[b]=!0,E._update(),E},m.prototype.read_options=function(b){var E=this._create();for(var _ in u)E._disabled[_]=b.templating.indexOf(_)===-1;return E._update(),E},m.prototype.exclude=function(b){var E=this._create();return E._excluded[b]=!0,E._update(),E},m.prototype.read=function(){var b="";this._match_pattern?b=this._input.read(this._starting_pattern):b=this._input.read(this._starting_pattern,this.__template_pattern);for(var E=this._read_template();E;)this._match_pattern?E+=this._input.read(this._match_pattern):E+=this._input.readUntil(this.__template_pattern),b+=E,E=this._read_template();return this._until_after&&(b+=this._input.readUntilAfter(this._until_pattern)),b},m.prototype.__set_templated_pattern=function(){var b=[];this._disabled.php||b.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||b.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||b.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(b.push(this.__patterns.django._starting_pattern.source),b.push(this.__patterns.django_value._starting_pattern.source),b.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||b.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&b.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+b.join("|")+")")},m.prototype._read_template=function(){var b="",E=this._input.peek();if(E==="<"){var _=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&_==="?"&&(b=b||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&_==="%"&&(b=b||this.__patterns.erb.read())}else E==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(b=b||this.__patterns.handlebars_comment.read(),b=b||this.__patterns.handlebars_unescaped.read(),b=b||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(b=b||this.__patterns.django_value.read()),this._excluded.django||(b=b||this.__patterns.django_comment.read(),b=b||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(b=b||this.__patterns.smarty_comment.read(),b=b||this.__patterns.smarty_literal.read(),b=b||this.__patterns.smarty.read()));return b},D.exports.TemplatablePattern=m},,,,function(D,M,g){var p=g(19).Beautifier,u=g(20).Options;function m(b,E,_,f){var O=new p(b,E,_,f);return O.beautify()}D.exports=m,D.exports.defaultOptions=function(){return new u}},function(D,M,g){var p=g(20).Options,u=g(2).Output,m=g(21).Tokenizer,b=g(21).TOKEN,E=/\r\n|[\r\n]/,_=/\r\n|[\r\n]/g,f=function(C,c){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=C.max_preserve_newlines,this.preserve_newlines=C.preserve_newlines,this._output=new u(C,c)};f.prototype.current_line_has_match=function(C){return this._output.current_line.has_match(C)},f.prototype.set_space_before_token=function(C,c){this._output.space_before_token=C,this._output.non_breaking_space=c},f.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},f.prototype.add_raw_token=function(C){this._output.add_raw_token(C)},f.prototype.print_preserved_newlines=function(C){var c=0;C.type!==b.TEXT&&C.previous.type!==b.TEXT&&(c=C.newlines?1:0),this.preserve_newlines&&(c=C.newlines<this.max_preserve_newlines+1?C.newlines:this.max_preserve_newlines+1);for(var o=0;o<c;o++)this.print_newline(o>0);return c!==0},f.prototype.traverse_whitespace=function(C){return C.whitespace_before||C.newlines?(this.print_preserved_newlines(C)||(this._output.space_before_token=!0),!0):!1},f.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},f.prototype.print_newline=function(C){this._output.add_new_line(C)},f.prototype.print_token=function(C){C.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(C.text))},f.prototype.indent=function(){this.indent_level++},f.prototype.get_full_indent=function(C){return C=this.indent_level+(C||0),C<1?"":this._output.get_indent_string(C)};var O=function(C){for(var c=null,o=C.next;o.type!==b.EOF&&C.closed!==o;){if(o.type===b.ATTRIBUTE&&o.text==="type"){o.next&&o.next.type===b.EQUALS&&o.next.next&&o.next.next.type===b.VALUE&&(c=o.next.next.text);break}o=o.next}return c},w=function(C,c){var o=null,v=null;return c.closed?(C==="script"?o="text/javascript":C==="style"&&(o="text/css"),o=O(c)||o,o.search("text/css")>-1?v="css":o.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?v="javascript":o.search(/(text|application|dojo)\/(x-)?(html)/)>-1?v="html":o.search(/test\/null/)>-1&&(v="null"),v):null};function R(C,c){return c.indexOf(C)!==-1}function x(C,c,o){this.parent=C||null,this.tag=c?c.tag_name:"",this.indent_level=o||0,this.parser_token=c||null}function I(C){this._printer=C,this._current_frame=null}I.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},I.prototype.record_tag=function(C){var c=new x(this._current_frame,C,this._printer.indent_level);this._current_frame=c},I.prototype._try_pop_frame=function(C){var c=null;return C&&(c=C.parser_token,this._printer.indent_level=C.indent_level,this._current_frame=C.parent),c},I.prototype._get_frame=function(C,c){for(var o=this._current_frame;o&&!(C.indexOf(o.tag)!==-1);){if(c&&c.indexOf(o.tag)!==-1){o=null;break}o=o.parent}return o},I.prototype.try_pop=function(C,c){var o=this._get_frame([C],c);return this._try_pop_frame(o)},I.prototype.indent_to_tag=function(C){var c=this._get_frame(C);c&&(this._printer.indent_level=c.indent_level)};function k(C,c,o,v){this._source_text=C||"",c=c||{},this._js_beautify=o,this._css_beautify=v,this._tag_stack=null;var l=new p(c,"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"}k.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var C=this._source_text,c=this._options.eol;this._options.eol==="auto"&&(c=`
|
|
`,C&&E.test(C)&&(c=C.match(E)[0])),C=C.replace(_,`
|
|
`);var o=C.match(/^[\t ]*/)[0],v={text:"",type:""},l=new A,a=new f(this._options,o),T=new m(C,this._options).tokenize();this._tag_stack=new I(a);for(var h=null,n=T.next();n.type!==b.EOF;)n.type===b.TAG_OPEN||n.type===b.COMMENT?(h=this._handle_tag_open(a,n,l,v),l=h):n.type===b.ATTRIBUTE||n.type===b.EQUALS||n.type===b.VALUE||n.type===b.TEXT&&!l.tag_complete?h=this._handle_inside_tag(a,n,l,T):n.type===b.TAG_CLOSE?h=this._handle_tag_close(a,n,l):n.type===b.TEXT?h=this._handle_text(a,n,l):a.add_raw_token(n),v=h,n=T.next();var N=a._output.get_code(c);return N},k.prototype._handle_tag_close=function(C,c,o){var v={text:c.text,type:c.type};return C.alignment_size=0,o.tag_complete=!0,C.set_space_before_token(c.newlines||c.whitespace_before!=="",!0),o.is_unformatted?C.add_raw_token(c):(o.tag_start_char==="<"&&(C.set_space_before_token(c.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&o.has_wrapped_attrs&&C.print_newline(!1)),C.print_token(c)),o.indent_content&&!(o.is_unformatted||o.is_content_unformatted)&&(C.indent(),o.indent_content=!1),!o.is_inline_element&&!(o.is_unformatted||o.is_content_unformatted)&&C.set_wrap_point(),v},k.prototype._handle_inside_tag=function(C,c,o,v){var l=o.has_wrapped_attrs,a={text:c.text,type:c.type};if(C.set_space_before_token(c.newlines||c.whitespace_before!=="",!0),o.is_unformatted)C.add_raw_token(c);else if(o.tag_start_char==="{"&&c.type===b.TEXT)C.print_preserved_newlines(c)?(c.newlines=0,C.add_raw_token(c)):C.print_token(c);else{if(c.type===b.ATTRIBUTE?(C.set_space_before_token(!0),o.attr_count+=1):(c.type===b.EQUALS||c.type===b.VALUE&&c.previous.type===b.EQUALS)&&C.set_space_before_token(!1),c.type===b.ATTRIBUTE&&o.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(C.traverse_whitespace(c),l=l||c.newlines!==0),this._is_wrap_attributes_force)){var T=o.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&o.attr_count===1){var h=!0,n=0,N;do{if(N=v.peek(n),N.type===b.ATTRIBUTE){h=!1;break}n+=1}while(n<4&&N.type!==b.EOF&&N.type!==b.TAG_CLOSE);T=!h}T&&(C.print_newline(!1),l=!0)}C.print_token(c),l=l||C.previous_token_wrapped(),o.has_wrapped_attrs=l}return a},k.prototype._handle_text=function(C,c,o){var v={text:c.text,type:"TK_CONTENT"};return o.custom_beautifier_name?this._print_custom_beatifier_text(C,c,o):o.is_unformatted||o.is_content_unformatted?C.add_raw_token(c):(C.traverse_whitespace(c),C.print_token(c)),v},k.prototype._print_custom_beatifier_text=function(C,c,o){var v=this;if(c.text!==""){var l=c.text,a,T=1,h="",n="";o.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?a=this._js_beautify:o.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?a=this._css_beautify:o.custom_beautifier_name==="html"&&(a=function(ee,ie){var re=new k(ee,ie,v._js_beautify,v._css_beautify);return re.beautify()}),this._options.indent_scripts==="keep"?T=0:this._options.indent_scripts==="separate"&&(T=-C.indent_level);var N=C.get_full_indent(T);if(l=l.replace(/\n[ \t]*$/,""),o.custom_beautifier_name!=="html"&&l[0]==="<"&&l.match(/^(<!--|<!\[CDATA\[)/)){var U=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(l);if(!U){C.add_raw_token(c);return}h=N+U[1]+`
|
|
`,l=U[4],U[5]&&(n=N+U[5]),l=l.replace(/\n[ \t]*$/,""),(U[2]||U[3].indexOf(`
|
|
`)!==-1)&&(U=U[3].match(/[ \t]+$/),U&&(c.whitespace_before=U[0]))}if(l)if(a){var j=function(){this.eol=`
|
|
`};j.prototype=this._options.raw_options;var Y=new j;l=a(N+l,Y)}else{var J=c.whitespace_before;J&&(l=l.replace(new RegExp(`
|
|
(`+J+")?","g"),`
|
|
`)),l=N+l.replace(/\n/g,`
|
|
`+N)}h&&(l?l=h+l+`
|
|
`+n:l=h+n),C.print_newline(!1),l&&(c.text=l,c.whitespace_before="",c.newlines=0,C.add_raw_token(c),C.print_newline(!0))}},k.prototype._handle_tag_open=function(C,c,o,v){var l=this._get_tag_open_token(c);return(o.is_unformatted||o.is_content_unformatted)&&!o.is_empty_element&&c.type===b.TAG_OPEN&&c.text.indexOf("</")===0?(C.add_raw_token(c),l.start_tag_token=this._tag_stack.try_pop(l.tag_name)):(C.traverse_whitespace(c),this._set_tag_position(C,c,l,o,v),l.is_inline_element||C.set_wrap_point(),C.print_token(c)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(l.alignment_size=c.text.length+1),!l.tag_complete&&!l.is_unformatted&&(C.alignment_size=l.alignment_size),l};var A=function(C,c){if(this.parent=C||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="",!c)this.tag_complete=!0;else{var o;this.tag_start_char=c.text[0],this.text=c.text,this.tag_start_char==="<"?(o=c.text.match(/^<([^\s>]*)/),this.tag_check=o?o[1]:""):(o=c.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=o?o[1]:"",(c.text.startsWith("{{#>")||c.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&c.next!==null?this.tag_check=c.next.text.split(" ")[0]:this.tag_check=c.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),c.type===b.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||c.closed&&c.closed.text==="/>";var v=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(v=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(v)))}};k.prototype._get_tag_open_token=function(C){var c=new A(this._tag_stack.get_parser_token(),C);return c.alignment_size=this._options.wrap_attributes_indent_size,c.is_end_tag=c.is_end_tag||R(c.tag_check,this._options.void_elements),c.is_empty_element=c.tag_complete||c.is_start_tag&&c.is_end_tag,c.is_unformatted=!c.tag_complete&&R(c.tag_check,this._options.unformatted),c.is_content_unformatted=!c.is_empty_element&&R(c.tag_check,this._options.content_unformatted),c.is_inline_element=R(c.tag_name,this._options.inline)||c.tag_name.includes("-")||c.tag_start_char==="{",c},k.prototype._set_tag_position=function(C,c,o,v,l){if(o.is_empty_element||(o.is_end_tag?o.start_tag_token=this._tag_stack.try_pop(o.tag_name):(this._do_optional_end_element(o)&&(o.is_inline_element||C.print_newline(!1)),this._tag_stack.record_tag(o),(o.tag_name==="script"||o.tag_name==="style")&&!(o.is_unformatted||o.is_content_unformatted)&&(o.custom_beautifier_name=w(o.tag_check,c)))),R(o.tag_check,this._options.extra_liners)&&(C.print_newline(!1),C._output.just_added_blankline()||C.print_newline(!0)),o.is_empty_element){if(o.tag_start_char==="{"&&o.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),o.indent_content=!0;var a=C.current_line_has_match(/{{#if/);a||C.print_newline(!1)}o.tag_name==="!--"&&l.type===b.TAG_CLOSE&&v.is_end_tag&&o.text.indexOf(`
|
|
`)===-1||(o.is_inline_element||o.is_unformatted||C.print_newline(!1),this._calcluate_parent_multiline(C,o))}else if(o.is_end_tag){var T=!1;T=o.start_tag_token&&o.start_tag_token.multiline_content,T=T||!o.is_inline_element&&!(v.is_inline_element||v.is_unformatted)&&!(l.type===b.TAG_CLOSE&&o.start_tag_token===v)&&l.type!=="TK_CONTENT",(o.is_content_unformatted||o.is_unformatted)&&(T=!1),T&&C.print_newline(!1)}else o.indent_content=!o.custom_beautifier_name,o.tag_start_char==="<"&&(o.tag_name==="html"?o.indent_content=this._options.indent_inner_html:o.tag_name==="head"?o.indent_content=this._options.indent_head_inner_html:o.tag_name==="body"&&(o.indent_content=this._options.indent_body_inner_html)),!(o.is_inline_element||o.is_unformatted)&&(l.type!=="TK_CONTENT"||o.is_content_unformatted)&&C.print_newline(!1),this._calcluate_parent_multiline(C,o)},k.prototype._calcluate_parent_multiline=function(C,c){c.parent&&C._output.just_added_newline()&&!((c.is_inline_element||c.is_unformatted)&&c.parent.is_inline_element)&&(c.parent.multiline_content=!0)};var P=["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"],S=["a","audio","del","ins","map","noscript","video"];k.prototype._do_optional_end_element=function(C){var c=null;if(C.is_empty_element||!C.is_start_tag||!C.parent)return;if(C.tag_name==="body")c=c||this._tag_stack.try_pop("head");else if(C.tag_name==="li")c=c||this._tag_stack.try_pop("li",["ol","ul"]);else if(C.tag_name==="dd"||C.tag_name==="dt")c=c||this._tag_stack.try_pop("dt",["dl"]),c=c||this._tag_stack.try_pop("dd",["dl"]);else if(C.parent.tag_name==="p"&&P.indexOf(C.tag_name)!==-1){var o=C.parent.parent;(!o||S.indexOf(o.tag_name)===-1)&&(c=c||this._tag_stack.try_pop("p"))}else C.tag_name==="rp"||C.tag_name==="rt"?(c=c||this._tag_stack.try_pop("rt",["ruby","rtc"]),c=c||this._tag_stack.try_pop("rp",["ruby","rtc"])):C.tag_name==="optgroup"?c=c||this._tag_stack.try_pop("optgroup",["select"]):C.tag_name==="option"?c=c||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):C.tag_name==="colgroup"?c=c||this._tag_stack.try_pop("caption",["table"]):C.tag_name==="thead"?(c=c||this._tag_stack.try_pop("caption",["table"]),c=c||this._tag_stack.try_pop("colgroup",["table"])):C.tag_name==="tbody"||C.tag_name==="tfoot"?(c=c||this._tag_stack.try_pop("caption",["table"]),c=c||this._tag_stack.try_pop("colgroup",["table"]),c=c||this._tag_stack.try_pop("thead",["table"]),c=c||this._tag_stack.try_pop("tbody",["table"])):C.tag_name==="tr"?(c=c||this._tag_stack.try_pop("caption",["table"]),c=c||this._tag_stack.try_pop("colgroup",["table"]),c=c||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(C.tag_name==="th"||C.tag_name==="td")&&(c=c||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),c=c||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return C.parent=this._tag_stack.get_parser_token(),c},D.exports.Beautifier=k},function(D,M,g){var p=g(6).Options;function u(m){p.call(this,m,"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"])}u.prototype=new p,D.exports.Options=u},function(D,M,g){var p=g(9).Tokenizer,u=g(9).TOKEN,m=g(13).Directives,b=g(14).TemplatablePattern,E=g(12).Pattern,_={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:u.START,RAW:u.RAW,EOF:u.EOF},f=new m(/<\!--/,/-->/),O=function(w,R){p.call(this,w,R),this._current_tag_name="";var x=new b(this._input).read_options(this._options),I=new E(this._input);if(this.__patterns={word:x.until(/[\n\r\t <]/),single_quote:x.until_after(/'/),double_quote:x.until_after(/"/),attribute:x.until(/[\n\r\t =>]|\/>/),element_name:x.until(/[\n\r\t >\/]/),handlebars_comment:I.starting_with(/{{!--/).until_after(/--}}/),handlebars:I.starting_with(/{{/).until_after(/}}/),handlebars_open:I.until(/[\n\r\t }]/),handlebars_raw_close:I.until(/}}/),comment:I.starting_with(/<!--/).until_after(/-->/),cdata:I.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:I.starting_with(/<!\[/).until_after(/]>/),processing:I.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 k=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=I.matching(k).until_after(k)}};O.prototype=new p,O.prototype._is_comment=function(w){return!1},O.prototype._is_opening=function(w){return w.type===_.TAG_OPEN},O.prototype._is_closing=function(w,R){return w.type===_.TAG_CLOSE&&R&&((w.text===">"||w.text==="/>")&&R.text[0]==="<"||w.text==="}}"&&R.text[0]==="{"&&R.text[1]==="{")},O.prototype._reset=function(){this._current_tag_name=""},O.prototype._get_next_token=function(w,R){var x=null;this._readWhitespace();var I=this._input.peek();return I===null?this._create_token(_.EOF,""):(x=x||this._read_open_handlebars(I,R),x=x||this._read_attribute(I,w,R),x=x||this._read_close(I,R),x=x||this._read_raw_content(I,w,R),x=x||this._read_content_word(I),x=x||this._read_comment_or_cdata(I),x=x||this._read_processing(I),x=x||this._read_open(I,R),x=x||this._create_token(_.UNKNOWN,this._input.next()),x)},O.prototype._read_comment_or_cdata=function(w){var R=null,x=null,I=null;if(w==="<"){var k=this._input.peek(1);k==="!"&&(x=this.__patterns.comment.read(),x?(I=f.get_directives(x),I&&I.ignore==="start"&&(x+=f.readIgnored(this._input))):x=this.__patterns.cdata.read()),x&&(R=this._create_token(_.COMMENT,x),R.directives=I)}return R},O.prototype._read_processing=function(w){var R=null,x=null,I=null;if(w==="<"){var k=this._input.peek(1);(k==="!"||k==="?")&&(x=this.__patterns.conditional_comment.read(),x=x||this.__patterns.processing.read()),x&&(R=this._create_token(_.COMMENT,x),R.directives=I)}return R},O.prototype._read_open=function(w,R){var x=null,I=null;return R||w==="<"&&(x=this._input.next(),this._input.peek()==="/"&&(x+=this._input.next()),x+=this.__patterns.element_name.read(),I=this._create_token(_.TAG_OPEN,x)),I},O.prototype._read_open_handlebars=function(w,R){var x=null,I=null;return R||this._options.indent_handlebars&&w==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(x=this.__patterns.handlebars_comment.read(),x=x||this.__patterns.handlebars.read(),I=this._create_token(_.COMMENT,x)):(x=this.__patterns.handlebars_open.read(),I=this._create_token(_.TAG_OPEN,x))),I},O.prototype._read_close=function(w,R){var x=null,I=null;return R&&(R.text[0]==="<"&&(w===">"||w==="/"&&this._input.peek(1)===">")?(x=this._input.next(),w==="/"&&(x+=this._input.next()),I=this._create_token(_.TAG_CLOSE,x)):R.text[0]==="{"&&w==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),I=this._create_token(_.TAG_CLOSE,"}}"))),I},O.prototype._read_attribute=function(w,R,x){var I=null,k="";if(x&&x.text[0]==="<")if(w==="=")I=this._create_token(_.EQUALS,this._input.next());else if(w==='"'||w==="'"){var A=this._input.next();w==='"'?A+=this.__patterns.double_quote.read():A+=this.__patterns.single_quote.read(),I=this._create_token(_.VALUE,A)}else k=this.__patterns.attribute.read(),k&&(R.type===_.EQUALS?I=this._create_token(_.VALUE,k):I=this._create_token(_.ATTRIBUTE,k));return I},O.prototype._is_content_unformatted=function(w){return this._options.void_elements.indexOf(w)===-1&&(this._options.content_unformatted.indexOf(w)!==-1||this._options.unformatted.indexOf(w)!==-1)},O.prototype._read_raw_content=function(w,R,x){var I="";if(x&&x.text[0]==="{")I=this.__patterns.handlebars_raw_close.read();else if(R.type===_.TAG_CLOSE&&R.opened.text[0]==="<"&&R.text[0]!=="/"){var k=R.opened.text.substr(1).toLowerCase();if(k==="script"||k==="style"){var A=this._read_comment_or_cdata(w);if(A)return A.type=_.TEXT,A;I=this._input.readUntil(new RegExp("</"+k+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(k)&&(I=this._input.readUntil(new RegExp("</"+k+"[\\n\\r\\t ]*?>","ig")))}return I?this._create_token(_.TEXT,I):null},O.prototype._read_content_word=function(w){var R="";if(this._options.unformatted_content_delimiter&&(w===this._options.unformatted_content_delimiter[0]&&(R=this.__patterns.unformatted_content_delimiter.read())),R||(R=this.__patterns.word.read()),R)return this._create_token(_.TEXT,R)},D.exports.Tokenizer=O,D.exports.TOKEN=_}],W={};function r(D){var M=W[D];if(M!==void 0)return M.exports;var g=W[D]={exports:{}};return F[D](g,g.exports,r),g.exports}var H=r(18);ce=H})();var ye=ce;if(!0)!(se=[Z,Z("6UM0"),Z("TXwP")],Se=function(F){var W=Z("6UM0"),r=Z("TXwP");return{html_beautify:function(H,D){return ye(H,D,W.js_beautify,r.css_beautify)}}}.apply(ve,se),Se!==void 0&&(at.exports=Se));else var le,X})()},rePB:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return Se});var se=Z("o46R");function Se(ce,ye,le){return ye=Object(se.a)(ye),ye in ce?Object.defineProperty(ce,ye,{value:le,enumerable:!0,configurable:!0,writable:!0}):ce[ye]=le,ce}},"sh+1":function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return Se});var se=Z("a247");function Se(ce,ye){var le;if(typeof Symbol=="undefined"||ce[Symbol.iterator]==null){if(Array.isArray(ce)||(le=Object(se.a)(ce))||ye&&ce&&typeof ce.length=="number"){le&&(ce=le);var X=0,F=function(){};return{s:F,n:function(){return X>=ce.length?{done:!0}:{done:!1,value:ce[X++]}},e:function(M){throw M},f:F}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var W=!0,r=!1,H;return{s:function(){le=ce[Symbol.iterator]()},n:function(){var M=le.next();return W=M.done,M},e:function(M){r=!0,H=M},f:function(){try{!W&&le.return!=null&&le.return()}finally{if(r)throw H}}}}},t9D7:function(at,ve,Z){"use strict";Z.d(ve,"b",function(){return F}),Z.d(ve,"g",function(){return r}),Z.d(ve,"d",function(){return H}),Z.d(ve,"e",function(){return D}),Z.d(ve,"a",function(){return M}),Z.d(ve,"f",function(){return u}),Z.d(ve,"c",function(){return m});var se=Z("Vhoy"),Se=Z("MI8n"),ce=Z("pmY6"),ye=Z("Cg/j"),le=Z("ic2d"),X=Z("nEHx");const F=Object(ye.c)("themeService");var W;(function(b){function E(_){return _&&typeof _=="object"&&typeof _.id=="string"}b.isThemeColor=E})(W||(W={}));function r(b){return{id:b}}var H;(function(b){function E(x){return x&&typeof x=="object"&&typeof x.id=="string"&&(typeof x.color=="undefined"||W.isThemeColor(x.color))}b.isThemeIcon=E;const _=new RegExp(`^\\$\\((${se.a.iconNameExpression}(?:${se.a.iconModifierExpression})?)\\)$`);function f(x){const I=_.exec(x);if(!I)return;let[,k]=I;return{id:k}}b.fromString=f;function O(x,I){let k=x.id;const A=k.lastIndexOf("~");return A!==-1&&(k=k.substring(0,A)),I&&(k=`${k}~${I}`),{id:k}}b.modify=O;function w(x,I){var k,A;return x.id===I.id&&((k=x.color)===null||k===void 0?void 0:k.id)===((A=I.color)===null||A===void 0?void 0:A.id)}b.isEqual=w;function R(x,I){return{id:x.id,color:I?r(I):void 0}}b.asThemeIcon=R,b.asClassNameArray=se.a.asClassNameArray,b.asClassName=se.a.asClassName,b.asCSSSelector=se.a.asCSSSelector})(H||(H={}));function D(b){switch(b){case X.a.DARK:return"vs-dark";case X.a.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const M={ThemingContribution:"base.contributions.theming"};class g{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new Se.b}onColorThemeChange(b){return this.themingParticipants.push(b),this.onThemingParticipantAddedEmitter.fire(b),Object(ce.i)(()=>{const E=this.themingParticipants.indexOf(b);this.themingParticipants.splice(E,1)})}getThemingParticipants(){return this.themingParticipants}}let p=new g;le.a.add(M.ThemingContribution,p);function u(b){return p.onColorThemeChange(b)}class m extends ce.a{constructor(b){super();this.themeService=b,this.theme=b.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(E=>this.onThemeChange(E)))}onThemeChange(b){this.theme=b,this.updateStyles()}updateStyles(){}}},ulZh:function(at,ve,Z){typeof window!="undefined"&&function(Se,ce){at.exports=ce()}(this,()=>(()=>{var se={"./src/config.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{enableStreamingMode:()=>v,hlsDefaultConfig:()=>C,mergeConfig:()=>o});var W=F("./src/controller/abr-controller.ts"),r=F("./src/controller/audio-stream-controller.ts"),H=F("./src/controller/audio-track-controller.ts"),D=F("./src/controller/subtitle-stream-controller.ts"),M=F("./src/controller/subtitle-track-controller.ts"),g=F("./src/controller/buffer-controller.ts"),p=F("./src/controller/timeline-controller.ts"),u=F("./src/controller/cap-level-controller.ts"),m=F("./src/controller/fps-controller.ts"),b=F("./src/controller/eme-controller.ts"),E=F("./src/controller/cmcd-controller.ts"),_=F("./src/utils/xhr-loader.ts"),f=F("./src/utils/fetch-loader.ts"),O=F("./src/utils/cues.ts"),w=F("./src/utils/mediakeys-helper.ts"),R=F("./src/utils/logger.ts");function x(){return x=Object.assign?Object.assign.bind():function(l){for(var a=1;a<arguments.length;a++){var T=arguments[a];for(var h in T)Object.prototype.hasOwnProperty.call(T,h)&&(l[h]=T[h])}return l},x.apply(this,arguments)}function I(l,a){var T=Object.keys(l);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(l);a&&(h=h.filter(function(n){return Object.getOwnPropertyDescriptor(l,n).enumerable})),T.push.apply(T,h)}return T}function k(l){for(var a=1;a<arguments.length;a++){var T=arguments[a]!=null?arguments[a]:{};a%2?I(Object(T),!0).forEach(function(h){A(l,h,T[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(T)):I(Object(T)).forEach(function(h){Object.defineProperty(l,h,Object.getOwnPropertyDescriptor(T,h))})}return l}function A(l,a,T){return a=P(a),a in l?Object.defineProperty(l,a,{value:T,enumerable:!0,configurable:!0,writable:!0}):l[a]=T,l}function P(l){var a=S(l,"string");return typeof a=="symbol"?a:String(a)}function S(l,a){if(typeof l!="object"||l===null)return l;var T=l[Symbol.toPrimitive];if(T!==void 0){var h=T.call(l,a||"default");if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(l)}var C=k(k({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!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:_.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:W.default,bufferController:g.default,capLevelController:u.default,fpsController:m.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,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:w.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0},c()),{},{subtitleStreamController:D.SubtitleStreamController,subtitleTrackController:M.default,timelineController:p.TimelineController,audioStreamController:r.default,audioTrackController:H.default,emeController:b.default,cmcdController:E.default});function c(){return{cueHandler:O.default,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function o(l,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return x({},l,a)}function v(l){var a=l.loader;if(a!==f.default&&a!==_.default)R.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var T=(0,f.fetchSupported)();T&&(l.loader=f.default,l.progressive=!0,l.enableSoftwareAES=!0,R.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>_});var W=F("./src/polyfills/number.ts"),r=F("./src/utils/ewma-bandwidth-estimator.ts"),H=F("./src/events.ts"),D=F("./src/errors.ts"),M=F("./src/types/loader.ts"),g=F("./src/utils/logger.ts");function p(f,O){for(var w=0;w<O.length;w++){var R=O[w];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(f,m(R.key),R)}}function u(f,O,w){return O&&p(f.prototype,O),w&&p(f,w),Object.defineProperty(f,"prototype",{writable:!1}),f}function m(f){var O=b(f,"string");return typeof O=="symbol"?O:String(O)}function b(f,O){if(typeof f!="object"||f===null)return f;var w=f[Symbol.toPrimitive];if(w!==void 0){var R=w.call(f,O||"default");if(typeof R!="object")return R;throw new TypeError("@@toPrimitive must return a primitive value.")}return(O==="string"?String:Number)(f)}var E=function(){function f(w){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=w;var R=w.config;this.bwEstimator=new r.default(R.abrEwmaSlowVoD,R.abrEwmaFastVoD,R.abrEwmaDefaultEstimate),this.registerListeners()}var O=f.prototype;return O.registerListeners=function(){var R=this.hls;R.on(H.Events.FRAG_LOADING,this.onFragLoading,this),R.on(H.Events.FRAG_LOADED,this.onFragLoaded,this),R.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.on(H.Events.ERROR,this.onError,this)},O.unregisterListeners=function(){var R=this.hls;R.off(H.Events.FRAG_LOADING,this.onFragLoading,this),R.off(H.Events.FRAG_LOADED,this.onFragLoaded,this),R.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.off(H.Events.ERROR,this.onError,this)},O.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},O.onFragLoading=function(R,x){var I=x.frag;if(I.type===M.PlaylistLevelType.MAIN&&!this.timer){var k;this.fragCurrent=I,this.partCurrent=(k=x.part)!=null?k:null,this.timer=self.setInterval(this.onCheck,100)}},O.onLevelLoaded=function(R,x){var I=this.hls.config;x.details.live?this.bwEstimator.update(I.abrEwmaSlowLive,I.abrEwmaFastLive):this.bwEstimator.update(I.abrEwmaSlowVoD,I.abrEwmaFastVoD)},O._abandonRulesCheck=function(){var R=this.fragCurrent,x=this.partCurrent,I=this.hls,k=I.autoLevelEnabled,A=I.media;if(!R||!A)return;var P=x?x.stats:R.stats,S=x?x.duration:R.duration;if(P.aborted||P.loaded&&P.loaded===P.total||R.level===0){this.clearTimer(),this._nextAutoLevel=-1;return}if(!k||A.paused||!A.playbackRate||!A.readyState)return;var C=I.mainForwardBufferInfo;if(C===null)return;var c=performance.now()-P.loading.start,o=Math.abs(A.playbackRate);if(c<=500*S/o)return;var v=P.loaded&&P.loading.first,l=this.bwEstimator.getEstimate(),a=I.levels,T=I.minAutoLevel,h=a[R.level],n=P.total||Math.max(P.loaded,Math.round(S*h.maxBitrate/8)),N=v?P.loaded*1e3/c:0,U=N?(n-P.loaded)/N:n*8/l,j=C.len/o;if(U<=j)return;var Y=Number.POSITIVE_INFINITY,J;for(J=R.level-1;J>T;J--){var ee=a[J].maxBitrate;if(Y=N?S*ee/(8*.8*N):S*ee/l,Y<j)break}if(Y>=U)return;g.logger.warn("Fragment "+R.sn+(x?" part "+x.index:"")+" of level "+R.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+J+`
|
|
Current BW estimate: `+((0,W.isFiniteNumber)(l)?(l/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+U.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+Y.toFixed(3)+` s
|
|
Time to underbuffer: `+j.toFixed(3)+" s"),I.nextLoadLevel=J,v&&this.bwEstimator.sample(c,P.loaded),this.clearTimer(),(R.loader||R.keyLoader)&&(this.fragCurrent=this.partCurrent=null,R.abortRequests()),I.trigger(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:R,part:x,stats:P})},O.onFragLoaded=function(R,x){var I=x.frag,k=x.part;if(I.type===M.PlaylistLevelType.MAIN&&(0,W.isFiniteNumber)(I.sn)){var A=k?k.stats:I.stats,P=k?k.duration:I.duration;if(this.clearTimer(),this.lastLoadedFragLevel=I.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var S=this.hls.levels[I.level],C=(S.loaded?S.loaded.bytes:0)+A.loaded,c=(S.loaded?S.loaded.duration:0)+P;S.loaded={bytes:C,duration:c},S.realBitrate=Math.round(8*C/c)}if(I.bitrateTest){var o={stats:A,frag:I,part:k,id:I.type};this.onFragBuffered(H.Events.FRAG_BUFFERED,o)}}},O.onFragBuffered=function(R,x){var I=x.frag,k=x.part,A=k?k.stats:I.stats;if(A.aborted)return;if(I.type!==M.PlaylistLevelType.MAIN||I.sn==="initSegment")return;var P=A.parsing.end-A.loading.start;this.bwEstimator.sample(P,A.loaded),A.bwEstimate=this.bwEstimator.getEstimate(),I.bitrateTest?this.bitrateTestDelay=P/1e3:this.bitrateTestDelay=0},O.onError=function(R,x){var I;if(((I=x.frag)===null||I===void 0?void 0:I.type)===M.PlaylistLevelType.MAIN){if(x.type===D.ErrorTypes.KEY_SYSTEM_ERROR){this.clearTimer();return}switch(x.details){case D.ErrorDetails.FRAG_LOAD_ERROR:case D.ErrorDetails.FRAG_LOAD_TIMEOUT:case D.ErrorDetails.KEY_LOAD_ERROR:case D.ErrorDetails.KEY_LOAD_TIMEOUT:this.clearTimer();break;default:break}}},O.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},O.getNextABRAutoLevel=function(){var R=this.fragCurrent,x=this.partCurrent,I=this.hls,k=I.maxAutoLevel,A=I.config,P=I.minAutoLevel,S=I.media,C=x?x.duration:R?R.duration:0,c=S&&S.playbackRate!==0?Math.abs(S.playbackRate):1,o=this.bwEstimator?this.bwEstimator.getEstimate():A.abrEwmaDefaultEstimate,v=I.mainForwardBufferInfo,l=(v?v.len:0)/c,a=this.findBestLevel(o,P,k,l,A.abrBandWidthFactor,A.abrBandWidthUpFactor);if(a>=0)return a;g.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var T=C?Math.min(C,A.maxStarvationDelay):A.maxStarvationDelay,h=A.abrBandWidthFactor,n=A.abrBandWidthUpFactor;if(!l){var N=this.bitrateTestDelay;if(N){var U=C?Math.min(C,A.maxLoadingDelay):A.maxLoadingDelay;T=U-N,g.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*T)+" ms"),h=n=1}}return a=this.findBestLevel(o,P,k,l+T,h,n),Math.max(a,0)},O.findBestLevel=function(R,x,I,k,A,P){for(var S,C=this.fragCurrent,c=this.partCurrent,o=this.lastLoadedFragLevel,v=this.hls.levels,l=v[o],a=!!(l!=null&&(S=l.details)!==null&&S!==void 0&&S.live),T=l==null?void 0:l.codecSet,h=c?c.duration:C?C.duration:0,n=I;n>=x;n--){var N=v[n];if(!N||T&&N.codecSet!==T)continue;var U=N.details,j=(c?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||h,Y=void 0;n<=o?Y=A*R:Y=P*R;var J=v[n].maxBitrate,ee=J*j/Y;if(g.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+n+"/"+Math.round(Y)+"/"+J+"/"+j+"/"+k+"/"+ee),Y>J&&(ee===0||!(0,W.isFiniteNumber)(ee)||a&&!this.bitrateTestDelay||ee<k))return n}return-1},u(f,[{key:"nextAutoLevel",get:function(){var R=this._nextAutoLevel,x=this.bwEstimator;if(R!==-1&&!x.canEstimate())return R;var I=this.getNextABRAutoLevel();return R!==-1&&this.hls.levels[I].loadError?R:(R!==-1&&(I=Math.min(R,I)),I)},set:function(R){this._nextAutoLevel=R}}]),f}();const _=E},"./src/controller/audio-stream-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>A});var W=F("./src/polyfills/number.ts"),r=F("./src/controller/base-stream-controller.ts"),H=F("./src/events.ts"),D=F("./src/utils/buffer-helper.ts"),M=F("./src/controller/fragment-tracker.ts"),g=F("./src/types/level.ts"),p=F("./src/types/loader.ts"),u=F("./src/loader/fragment.ts"),m=F("./src/demux/chunk-cache.ts"),b=F("./src/demux/transmuxer-interface.ts"),E=F("./src/types/transmuxer.ts"),_=F("./src/controller/fragment-finders.ts"),f=F("./src/utils/discontinuities.ts"),O=F("./src/errors.ts");function w(){return w=Object.assign?Object.assign.bind():function(P){for(var S=1;S<arguments.length;S++){var C=arguments[S];for(var c in C)Object.prototype.hasOwnProperty.call(C,c)&&(P[c]=C[c])}return P},w.apply(this,arguments)}function R(P,S){P.prototype=Object.create(S.prototype),P.prototype.constructor=P,x(P,S)}function x(P,S){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(c,o){return c.__proto__=o,c},x(P,S)}var I=100,k=function(P){R(S,P);function S(c,o,v){var l;return l=P.call(this,c,o,v,"[audio-stream-controller]")||this,l.videoBuffer=null,l.videoTrackCC=-1,l.waitingVideoCC=-1,l.audioSwitch=!1,l.trackId=-1,l.waitingData=null,l.mainDetails=null,l.bufferFlushed=!1,l.cachedTrackLoadedData=null,l._registerListeners(),l}var C=S.prototype;return C.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},C._registerListeners=function(){var o=this.hls;o.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(H.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.on(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.on(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(H.Events.ERROR,this.onError,this),o.on(H.Events.BUFFER_RESET,this.onBufferReset,this),o.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this),o.on(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.on(H.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var o=this.hls;o.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(H.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.off(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.off(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(H.Events.ERROR,this.onError,this),o.off(H.Events.BUFFER_RESET,this.onBufferReset,this),o.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),o.off(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.off(H.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onInitPtsFound=function(o,v){var l=v.frag,a=v.id,T=v.initPTS;if(a==="main"){var h=l.cc;this.initPTS[l.cc]=T,this.log("InitPTS for cc: "+h+" found from main: "+T),this.videoTrackCC=h,this.state===r.State.WAITING_INIT_PTS&&this.tick()}},C.startLoad=function(o){if(!this.levels){this.startPosition=o,this.state=r.State.STOPPED;return}var v=this.lastCurrentTime;this.stopLoad(),this.setInterval(I),this.fragLoadError=0,v>0&&o===-1?(this.log("Override startPosition with lastCurrentTime @"+v.toFixed(3)),o=v,this.state=r.State.IDLE):(this.loadedmetadata=!1,this.state=r.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=o,this.tick()},C.doTick=function(){switch(this.state){case r.State.IDLE:this.doTickIdle();break;case r.State.WAITING_TRACK:{var o,v=this.levels,l=this.trackId,a=v==null||((o=v[l])===null||o===void 0)?void 0:o.details;if(a){if(this.waitForCdnTuneIn(a))break;this.state=r.State.WAITING_INIT_PTS}break}case r.State.FRAG_LOADING_WAITING_RETRY:{var T,h=performance.now(),n=this.retryDate;(!n||h>=n||(T=this.media)!==null&&T!==void 0&&T.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=r.State.IDLE);break}case r.State.WAITING_INIT_PTS:{var N=this.waitingData;if(N){var U=N.frag,j=N.part,Y=N.cache,J=N.complete;if(this.initPTS[U.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=r.State.FRAG_LOADING;var ee=Y.flush(),ie={frag:U,part:j,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(ie),J&&P.prototype._handleFragmentLoadComplete.call(this,ie)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+U.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var re=this.getLoadPosition(),he=D.BufferHelper.bufferInfo(this.mediaBuffer,re,this.config.maxBufferHole),oe=(0,_.fragmentWithinToleranceTest)(he.end,this.config.maxFragLookUpTolerance,U);oe<0&&(this.log("Waiting fragment cc ("+U.cc+") @ "+U.start+" cancelled because another fragment at "+he.end+" is needed"),this.clearWaitingFragment())}}else this.state=r.State.IDLE}}this.onTickEnd()},C.clearWaitingFragment=function(){var o=this.waitingData;o&&(this.fragmentTracker.removeFragment(o.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=r.State.IDLE)},C.resetLoadingState=function(){this.clearWaitingFragment(),P.prototype.resetLoadingState.call(this)},C.onTickEnd=function(){var o=this.media;if(!o||!o.readyState)return;this.lastCurrentTime=o.currentTime},C.doTickIdle=function(){var o=this.hls,v=this.levels,l=this.media,a=this.trackId,T=o.config;if(!v||!v[a])return;if(!l&&(this.startFragRequested||!T.startFragPrefetch))return;var h=v[a],n=h.details;if(!n||n.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(n)){this.state=r.State.WAITING_TRACK;return}var N=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&N&&(this.bufferFlushed=!1,this.afterBufferFlushed(N,u.ElementaryStreamTypes.AUDIO,p.PlaylistLevelType.AUDIO));var U=this.getFwdBufferInfo(N,p.PlaylistLevelType.AUDIO);if(U===null)return;var j=this.audioSwitch;if(!j&&this._streamEnded(U,n)){o.trigger(H.Events.BUFFER_EOS,{type:"audio"}),this.state=r.State.ENDED;return}var Y=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,p.PlaylistLevelType.MAIN),J=U.len,ee=this.getMaxBufferLength(Y==null?void 0:Y.len);if(J>=ee&&!j)return;var ie=n.fragments,re=ie[0].start,he=U.end;if(j&&l){var oe=this.getLoadPosition();he=oe,n.PTSKnown&&oe<re&&((U.end>re||U.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),l.currentTime=re+.05))}if(Y&&he>Y.end+n.targetduration)return;if((!Y||!Y.len)&&U.len)return;var ae=this.getNextFragment(he,n);if(!ae){this.bufferFlushed=!0;return}this.loadFragment(ae,n,he)},C.getMaxBufferLength=function(o){var v=P.prototype.getMaxBufferLength.call(this);return o?Math.max(v,o):v},C.onMediaDetaching=function(){this.videoBuffer=null,P.prototype.onMediaDetaching.call(this)},C.onAudioTracksUpdated=function(o,v){var l=v.audioTracks;this.resetTransmuxer(),this.levels=l.map(function(a){return new g.Level(a)})},C.onAudioTrackSwitching=function(o,v){var l=!!v.url;this.trackId=v.id;var a=this.fragCurrent;a&&a.abortRequests(),this.fragCurrent=null,this.clearWaitingFragment(),l?this.setInterval(I):this.resetTransmuxer(),l?(this.audioSwitch=!0,this.state=r.State.IDLE):this.state=r.State.STOPPED,this.tick()},C.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},C.onLevelLoaded=function(o,v){this.mainDetails=v.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(H.Events.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},C.onAudioTrackLoaded=function(o,v){var l;if(this.mainDetails==null){this.cachedTrackLoadedData=v;return}var a=this.levels,T=v.details,h=v.id;if(!a){this.warn("Audio tracks were reset while loading level "+h);return}this.log("Track "+h+" loaded ["+T.startSN+","+T.endSN+"],duration:"+T.totalduration);var n=a[h],N=0;if(T.live||(l=n.details)!==null&&l!==void 0&&l.live){var U=this.mainDetails;if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed||!U)return;!n.details&&T.hasProgramDateTime&&U.hasProgramDateTime?((0,f.alignMediaPlaylistByPDT)(T,U),N=T.fragments[0].start):N=this.alignPlaylists(T,n.details)}n.details=T,this.levelLastLoaded=h,!this.startFragRequested&&(this.mainDetails||!T.live)&&this.setStartPosition(n.details,N),this.state===r.State.WAITING_TRACK&&!this.waitForCdnTuneIn(T)&&(this.state=r.State.IDLE),this.tick()},C._handleFragmentLoadProgress=function(o){var v,l=o.frag,a=o.part,T=o.payload,h=this.config,n=this.trackId,N=this.levels;if(!N){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered");return}var U=N[n];console.assert(U,"Audio track is defined on fragment load progress");var j=U.details;console.assert(j,"Audio track details are defined on fragment load progress");var Y=h.defaultAudioCodec||U.audioCodec||"mp4a.40.2",J=this.transmuxer;J||(J=this.transmuxer=new b.default(this.hls,p.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[l.cc],ie=(v=l.initSegment)===null||v===void 0?void 0:v.data;if(ee!==void 0){var re=!1,he=a?a.index:-1,oe=he!==-1,ae=new E.ChunkMetadata(l.level,l.sn,l.stats.chunkCount,T.byteLength,he,oe);J.push(T,ie,Y,"",l,a,j.totalduration,re,ae,ee)}else{this.log("Unknown video PTS for cc "+l.cc+", waiting for video PTS before demuxing audio frag "+l.sn+" of ["+j.startSN+" ,"+j.endSN+"],track "+n);var Ee=this.waitingData=this.waitingData||{frag:l,part:a,cache:new m.default,complete:!1},Le=Ee.cache;Le.push(new Uint8Array(T)),this.waitingVideoCC=this.videoTrackCC,this.state=r.State.WAITING_INIT_PTS}},C._handleFragmentLoadComplete=function(o){if(this.waitingData){this.waitingData.complete=!0;return}P.prototype._handleFragmentLoadComplete.call(this,o)},C.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},C.onBufferCreated=function(o,v){var l=v.tracks.audio;l&&(this.mediaBuffer=l.buffer||null),v.tracks.video&&(this.videoBuffer=v.tracks.video.buffer||null)},C.onFragBuffered=function(o,v){var l=v.frag,a=v.part;if(l.type!==p.PlaylistLevelType.AUDIO){if(!this.loadedmetadata&&l.type===p.PlaylistLevelType.MAIN){var T;(T=this.videoBuffer||this.media)!==null&&T!==void 0&&T.buffered.length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(l)){this.warn("Fragment "+l.sn+(a?" p: "+a.index:"")+" of level "+l.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}l.sn!=="initSegment"&&(this.fragPrevious=l,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(l,a)},C.onError=function(o,v){if(v.type===O.ErrorTypes.KEY_SYSTEM_ERROR){this.onFragmentOrKeyLoadError(p.PlaylistLevelType.AUDIO,v);return}switch(v.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.FRAG_PARSING_ERROR:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(p.PlaylistLevelType.AUDIO,v);break;case O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==r.State.ERROR&&this.state!==r.State.STOPPED&&(this.state=v.fatal?r.State.ERROR:r.State.IDLE,this.warn(v.details+" while loading frag, switching to "+this.state+" state"));break;case O.ErrorDetails.BUFFER_FULL_ERROR:if(v.parent==="audio"&&(this.state===r.State.PARSING||this.state===r.State.PARSED)){var l=!0,a=this.getFwdBufferInfo(this.mediaBuffer,p.PlaylistLevelType.AUDIO);a&&a.len>.5&&(l=!this.reduceMaxBufferLength(a.len)),l&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,P.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},C.onBufferFlushed=function(o,v){var l=v.type;l===u.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0,this.state===r.State.ENDED&&(this.state=r.State.IDLE))},C._handleTransmuxComplete=function(o){var v,l="audio",a=this.hls,T=o.remuxResult,h=o.chunkMeta,n=this.getCurrentContext(h);if(!n){this.warn("The loading context changed while buffering fragment "+h.sn+" of level "+h.level+". This chunk will not be buffered."),this.resetStartWhenNotLoaded(h.level);return}var N=n.frag,U=n.part,j=n.level.details,Y=T.audio,J=T.text,ee=T.id3,ie=T.initSegment;if(this.fragContextChanged(N)||!j)return;if(this.state=r.State.PARSING,this.audioSwitch&&Y&&this.completeAudioSwitch(),ie!=null&&ie.tracks&&(this._bufferInitSegment(ie.tracks,N,h),a.trigger(H.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:l,tracks:ie.tracks})),Y){var re=Y.startPTS,he=Y.endPTS,oe=Y.startDTS,ae=Y.endDTS;U&&(U.elementaryStreams[u.ElementaryStreamTypes.AUDIO]={startPTS:re,endPTS:he,startDTS:oe,endDTS:ae}),N.setElementaryStreamInfo(u.ElementaryStreamTypes.AUDIO,re,he,oe,ae),this.bufferFragmentData(Y,N,U,h)}if(ee!=null&&(v=ee.samples)!==null&&v!==void 0&&v.length){var Ee=w({id:l,frag:N,details:j},ee);a.trigger(H.Events.FRAG_PARSING_METADATA,Ee)}if(J){var Le=w({id:l,frag:N,details:j},J);a.trigger(H.Events.FRAG_PARSING_USERDATA,Le)}},C._bufferInitSegment=function(o,v,l){if(this.state!==r.State.PARSING)return;o.video&&delete o.video;var a=o.audio;if(!a)return;a.levelCodec=a.codec,a.id="audio",this.log("Init audio buffer, container:"+a.container+", codecs[parsed]=["+a.codec+"]"),this.hls.trigger(H.Events.BUFFER_CODECS,o);var T=a.initSegment;if(T!=null&&T.byteLength){var h={type:"audio",frag:v,part:null,chunkMeta:l,parent:v.type,data:T};this.hls.trigger(H.Events.BUFFER_APPENDING,h)}this.tick()},C.loadFragment=function(o,v,l){var a=this.fragmentTracker.getState(o);this.fragCurrent=o,(this.audioSwitch||a===M.FragmentState.NOT_LOADED||a===M.FragmentState.PARTIAL)&&(o.sn==="initSegment"?this._loadInitSegment(o,v):v.live&&!(0,W.isFiniteNumber)(this.initPTS[o.cc])?(this.log("Waiting for video PTS in continuity counter "+o.cc+" of live stream before loading audio fragment "+o.sn+" of level "+this.trackId),this.state=r.State.WAITING_INIT_PTS):(this.startFragRequested=!0,P.prototype.loadFragment.call(this,o,v,l)))},C.completeAudioSwitch=function(){var o=this.hls,v=this.media,l=this.trackId;v&&(this.log("Switching audio track : flushing all audio"),P.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,o.trigger(H.Events.AUDIO_TRACK_SWITCHED,{id:l})},S}(r.default);const A=k},"./src/controller/audio-track-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>_});var W=F("./src/events.ts"),r=F("./src/errors.ts"),H=F("./src/controller/base-playlist-controller.ts"),D=F("./src/types/loader.ts");function M(f,O){for(var w=0;w<O.length;w++){var R=O[w];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(f,p(R.key),R)}}function g(f,O,w){return O&&M(f.prototype,O),w&&M(f,w),Object.defineProperty(f,"prototype",{writable:!1}),f}function p(f){var O=u(f,"string");return typeof O=="symbol"?O:String(O)}function u(f,O){if(typeof f!="object"||f===null)return f;var w=f[Symbol.toPrimitive];if(w!==void 0){var R=w.call(f,O||"default");if(typeof R!="object")return R;throw new TypeError("@@toPrimitive must return a primitive value.")}return(O==="string"?String:Number)(f)}function m(f,O){f.prototype=Object.create(O.prototype),f.prototype.constructor=f,b(f,O)}function b(f,O){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(R,x){return R.__proto__=x,R},b(f,O)}var E=function(f){m(O,f);function O(R){var x;return x=f.call(this,R,"[audio-track-controller]")||this,x.tracks=[],x.groupId=null,x.tracksInGroup=[],x.trackId=-1,x.trackName="",x.selectDefaultTrack=!0,x.registerListeners(),x}var w=O.prototype;return w.registerListeners=function(){var x=this.hls;x.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),x.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),x.on(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),x.on(W.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var x=this.hls;x.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),x.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),x.off(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),x.off(W.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,f.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(x,I){this.tracks=I.audioTracks||[]},w.onAudioTrackLoaded=function(x,I){var k=I.id,A=I.details,P=this.tracksInGroup[k];if(!P){this.warn("Invalid audio track id "+k);return}var S=P.details;P.details=I.details,this.log("audioTrack "+k+" loaded ["+A.startSN+"-"+A.endSN+"]"),k===this.trackId&&(this.retryCount=0,this.playlistLoaded(k,I,S))},w.onLevelLoading=function(x,I){this.switchLevel(I.level)},w.onLevelSwitching=function(x,I){this.switchLevel(I.level)},w.switchLevel=function(x){var I=this.hls.levels[x];if(!(I!=null&&I.audioGroupIds))return;var k=I.audioGroupIds[I.urlId];if(this.groupId!==k){this.groupId=k;var A=this.tracks.filter(function(S){return!k||S.groupId===k});this.selectDefaultTrack&&!A.some(function(S){return S.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=A;var P={audioTracks:A};this.log("Updating audio tracks, "+A.length+' track(s) found in "'+k+'" group-id'),this.hls.trigger(W.Events.AUDIO_TRACKS_UPDATED,P),this.selectInitialTrack()}},w.onError=function(x,I){if(f.prototype.onError.call(this,x,I),I.fatal||!I.context)return;I.context.type===D.PlaylistContextType.AUDIO_TRACK&&I.context.id===this.trackId&&I.context.groupId===this.groupId&&this.retryLoadingOrFail(I)},w.setAudioTrack=function(x){var I=this.tracksInGroup;if(x<0||x>=I.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var k=I[this.trackId];this.log("Now switching to audio-track index "+x);var A=I[x],P=A.id,S=A.groupId,C=S===void 0?"":S,c=A.name,o=A.type,v=A.url;if(this.trackId=x,this.trackName=c,this.selectDefaultTrack=!1,this.hls.trigger(W.Events.AUDIO_TRACK_SWITCHING,{id:P,groupId:C,name:c,type:o,url:v}),A.details&&!A.details.live)return;var l=this.switchParams(A.url,k==null?void 0:k.details);this.loadPlaylist(l)},w.selectInitialTrack=function(){var x=this.tracksInGroup;console.assert(x.length,"Initial audio track should be selected when tracks are known");var I=this.trackName,k=this.findTrackId(I)||this.findTrackId();k!==-1?this.setAudioTrack(k):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(W.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(x){for(var I=this.tracksInGroup,k=0;k<I.length;k++){var A=I[k];if((!this.selectDefaultTrack||A.default)&&(!x||x===A.name))return A.id}return-1},w.loadPlaylist=function(x){f.prototype.loadPlaylist.call(this);var I=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(I)){var k=I.id,A=I.groupId,P=I.url;if(x)try{P=x.addDirectives(P)}catch(S){this.warn("Could not construct new URL with HLS Delivery Directives: "+S)}this.log("loading audio-track playlist for id: "+k),this.clearTimer(),this.hls.trigger(W.Events.AUDIO_TRACK_LOADING,{url:P,id:k,groupId:A,deliveryDirectives:x||null})}},g(O,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(x){this.selectDefaultTrack=!1,this.setAudioTrack(x)}}]),O}(H.default);const _=E},"./src/controller/base-playlist-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>M});var W=F("./src/types/level.ts"),r=F("./src/controller/level-helper.ts"),H=F("./src/utils/logger.ts"),D=F("./src/errors.ts"),M=function(){function g(u,m){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=H.logger.log.bind(H.logger,m+":"),this.warn=H.logger.warn.bind(H.logger,m+":"),this.hls=u}var p=g.prototype;return p.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},p.onError=function(m,b){b.fatal&&(b.type===D.ErrorTypes.NETWORK_ERROR||b.type===D.ErrorTypes.KEY_SYSTEM_ERROR)&&this.stopLoad()},p.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},p.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.requestScheduled=-1,this.loadPlaylist()},p.stopLoad=function(){this.canLoad=!1,this.clearTimer()},p.switchParams=function(m,b){var E=b==null?void 0:b.renditionReports;if(E)for(var _=0;_<E.length;_++){var f=E[_],O=void 0;try{O=new self.URL(f.URI,b.url).href}catch(I){H.logger.warn("Could not construct new URL for Rendition Report: "+I),O=f.URI||""}if(O===m.slice(-O.length)){var w=parseInt(f["LAST-MSN"])||(b==null?void 0:b.lastPartSn),R=parseInt(f["LAST-PART"])||(b==null?void 0:b.lastPartIndex);if(this.hls.config.lowLatencyMode){var x=Math.min(b.age-b.partTarget,b.targetduration);R>=0&&x>b.partTarget&&(R+=1)}return new W.HlsUrlParameters(w,R>=0?R:void 0,W.HlsSkip.No)}}},p.loadPlaylist=function(m){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())},p.shouldLoadTrack=function(m){return this.canLoad&&m&&!!m.url&&(!m.details||m.details.live)},p.playlistLoaded=function(m,b,E){var _=this,f=b.details,O=b.stats,w=self.performance.now(),R=O.loading.first?Math.max(0,w-O.loading.first):0;if(f.advancedDateTime=Date.now()-R,f.live||E!=null&&E.live){if(f.reloaded(E),E&&this.log("live playlist "+m+" "+(f.advanced?"REFRESHED "+f.lastPartSn+"-"+f.lastPartIndex:"MISSED")),E&&f.fragments.length>0&&(0,r.mergeDetails)(E,f),!this.canLoad||!f.live)return;var x,I=void 0,k=void 0;if(f.canBlockReload&&f.endSN&&f.advanced){var A=this.hls.config.lowLatencyMode,P=f.lastPartSn,S=f.endSN,C=f.lastPartIndex,c=C!==-1,o=P===S,v=A?0:C;c?(I=o?S+1:P,k=o?v:C+1):I=S+1;var l=f.age,a=l+f.ageHeader,T=Math.min(a-f.partTarget,f.targetduration*1.5);if(T>0){if(E&&T>E.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+E.tuneInGoal+" to: "+T+" with playlist age: "+f.age),T=0;else{var h=Math.floor(T/f.targetduration);if(I+=h,k!==void 0){var n=Math.round(T%f.targetduration/f.partTarget);k+=n}this.log("CDN Tune-in age: "+f.ageHeader+"s last advanced "+l.toFixed(2)+"s goal: "+T+" skip sn "+h+" to part "+k)}f.tuneInGoal=T}if(x=this.getDeliveryDirectives(f,b.deliveryDirectives,I,k),A||!o){this.loadPlaylist(x);return}}else x=this.getDeliveryDirectives(f,b.deliveryDirectives,I,k);var N=this.hls.mainForwardBufferInfo,U=N?N.end-N.len:0,j=(f.edge-U)*1e3,Y=(0,r.computeReloadInterval)(f,j);f.updated?w>this.requestScheduled+Y&&(this.requestScheduled=O.loading.start):this.requestScheduled=-1,I!==void 0&&f.canBlockReload?this.requestScheduled=O.loading.first+Y-(f.partTarget*1e3||1e3):this.requestScheduled=(this.requestScheduled===-1?w:this.requestScheduled)+Y;var J=this.requestScheduled-w;J=Math.max(0,J),this.log("reload live playlist "+m+" in "+Math.round(J)+" ms"),this.timer=self.setTimeout(function(){return _.loadPlaylist(x)},J)}else this.clearTimer()},p.getDeliveryDirectives=function(m,b,E,_){var f=(0,W.getSkipValue)(m,E);return b!=null&&b.skip&&m.deltaUpdateFailed&&(E=b.msn,_=b.part,f=W.HlsSkip.No),new W.HlsUrlParameters(E,_,f)},p.retryLoadingOrFail=function(m){var b=this,E=this.hls.config,_=this.retryCount<E.levelLoadingMaxRetry;if(_){var f;if(this.requestScheduled=-1,this.retryCount++,m.details.indexOf("LoadTimeOut")>-1&&(f=m.context)!==null&&f!==void 0&&f.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+m.details+'"'),this.loadPlaylist();else{var O=Math.min(Math.pow(2,this.retryCount)*E.levelLoadingRetryDelay,E.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return b.loadPlaylist()},O),this.warn("retry playlist loading #"+this.retryCount+" in "+O+' ms after "'+m.details+'"')}}else this.warn('cannot recover from error "'+m.details+'"'),this.clearTimer(),m.fatal=!0;return _},g}()},"./src/controller/base-stream-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{State:()=>c,default:()=>o});var W=F("./src/polyfills/number.ts"),r=F("./src/task-loop.ts"),H=F("./src/controller/fragment-tracker.ts"),D=F("./src/utils/buffer-helper.ts"),M=F("./src/utils/logger.ts"),g=F("./src/events.ts"),p=F("./src/errors.ts"),u=F("./src/types/transmuxer.ts"),m=F("./src/utils/mp4-tools.ts"),b=F("./src/utils/discontinuities.ts"),E=F("./src/controller/fragment-finders.ts"),_=F("./src/controller/level-helper.ts"),f=F("./src/loader/fragment-loader.ts"),O=F("./src/crypt/decrypter.ts"),w=F("./src/utils/time-ranges.ts"),R=F("./src/types/loader.ts");function x(v,l){for(var a=0;a<l.length;a++){var T=l[a];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(v,k(T.key),T)}}function I(v,l,a){return l&&x(v.prototype,l),a&&x(v,a),Object.defineProperty(v,"prototype",{writable:!1}),v}function k(v){var l=A(v,"string");return typeof l=="symbol"?l:String(l)}function A(v,l){if(typeof v!="object"||v===null)return v;var a=v[Symbol.toPrimitive];if(a!==void 0){var T=a.call(v,l||"default");if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(v)}function P(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function S(v,l){v.prototype=Object.create(l.prototype),v.prototype.constructor=v,C(v,l)}function C(v,l){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(T,h){return T.__proto__=h,T},C(v,l)}var c={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",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},o=function(v){S(l,v);function l(T,h,n,N){var U;return U=v.call(this)||this,U.hls=void 0,U.fragPrevious=null,U.fragCurrent=null,U.fragmentTracker=void 0,U.transmuxer=null,U._state=c.STOPPED,U.media=null,U.mediaBuffer=null,U.config=void 0,U.bitrateTest=!1,U.lastCurrentTime=0,U.nextLoadPosition=0,U.startPosition=0,U.loadedmetadata=!1,U.fragLoadError=0,U.retryDate=0,U.levels=null,U.fragmentLoader=void 0,U.keyLoader=void 0,U.levelLastLoaded=null,U.startFragRequested=!1,U.decrypter=void 0,U.initPTS=[],U.onvseeking=null,U.onvended=null,U.logPrefix="",U.log=void 0,U.warn=void 0,U.logPrefix=N,U.log=M.logger.log.bind(M.logger,N+":"),U.warn=M.logger.warn.bind(M.logger,N+":"),U.hls=T,U.fragmentLoader=new f.default(T.config),U.keyLoader=n,U.fragmentTracker=h,U.config=T.config,U.decrypter=new O.default(T.config),T.on(g.Events.LEVEL_SWITCHING,U.onLevelSwitching,P(U)),U}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(h){},a.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort();var h=this.fragCurrent;h&&(h.abortRequests(),this.fragmentTracker.removeFragment(h)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=c.STOPPED},a._streamEnded=function(h,n){if(n.live||h.nextStart||!h.end||!this.media)return!1;var N=n.partList;if(N!=null&&N.length){var U=N[N.length-1],j=D.BufferHelper.isBuffered(this.media,U.start+U.duration/2);return j}var Y=n.fragments[n.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(Y)},a.getLevelDetails=function(){if(this.levels&&this.levelLastLoaded!==null){var h;return(h=this.levels[this.levelLastLoaded])===null||h===void 0?void 0:h.details}},a.onMediaAttached=function(h,n){var N=this.media=this.mediaBuffer=n.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===c.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var h=this.media;h!=null&&h.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),h&&this.onvseeking&&this.onvended&&(h.removeEventListener("seeking",this.onvseeking),h.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var h=this.config,n=this.fragCurrent,N=this.media,U=this.mediaBuffer,j=this.state,Y=N?N.currentTime:0,J=D.BufferHelper.bufferInfo(U||N,Y,h.maxBufferHole);if(this.log("media seeking to "+((0,W.isFiniteNumber)(Y)?Y.toFixed(3):Y)+", state: "+j),this.state===c.ENDED)this.resetLoadingState();else if(n){var ee=h.maxFragLookUpTolerance,ie=n.start-ee,re=n.start+n.duration+ee;if(!J.len||re<J.start||ie>J.end){var he=Y>re;(Y<ie||he)&&(he&&n.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),n.abortRequests()),this.resetLoadingState())}}N&&(this.lastCurrentTime=Y),!this.loadedmetadata&&!J.len&&(this.nextLoadPosition=this.startPosition=Y),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onLevelSwitching=function(h,n){this.fragLoadError=0},a.onHandlerDestroying=function(){this.stopLoad(),v.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=c.STOPPED,this.hls.off(g.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,v.prototype.onHandlerDestroyed.call(this)},a.loadFragment=function(h,n,N){this._loadFragForPlayback(h,n,N)},a._loadFragForPlayback=function(h,n,N){var U=this,j=function(J){if(U.fragContextChanged(h)){U.warn("Fragment "+h.sn+(J.part?" p: "+J.part.index:"")+" of level "+h.level+" was dropped during download."),U.fragmentTracker.removeFragment(h);return}h.stats.chunkCount++,U._handleFragmentLoadProgress(J)};this._doFragLoad(h,n,N,j).then(function(Y){if(!Y)return;U.fragLoadError=0;var J=U.state;if(U.fragContextChanged(h)){(J===c.FRAG_LOADING||!U.fragCurrent&&J===c.PARSING)&&(U.fragmentTracker.removeFragment(h),U.state=c.IDLE);return}"payload"in Y&&(U.log("Loaded fragment "+h.sn+" of level "+h.level),U.hls.trigger(g.Events.FRAG_LOADED,Y)),U._handleFragmentLoadComplete(Y)}).catch(function(Y){if(U.state===c.STOPPED||U.state===c.ERROR)return;U.warn(Y),U.resetFragmentLoading(h)})},a.flushMainBuffer=function(h,n,N){if(N===void 0&&(N=null),!(h-n))return;var U={startOffset:h,endOffset:n,type:N};this.fragLoadError=0,this.hls.trigger(g.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(h,n){var N=this;this._doFragLoad(h,n).then(function(U){if(!U||N.fragContextChanged(h)||!N.levels)throw new Error("init load aborted");return U}).then(function(U){var j=N.hls,Y=U.payload,J=h.decryptdata;if(Y&&Y.byteLength>0&&J&&J.key&&J.iv&&J.method==="AES-128"){var ee=self.performance.now();return N.decrypter.decrypt(new Uint8Array(Y),J.key.buffer,J.iv.buffer).then(function(ie){var re=self.performance.now();return j.trigger(g.Events.FRAG_DECRYPTED,{frag:h,payload:ie,stats:{tstart:ee,tdecrypt:re}}),U.payload=ie,U})}return U}).then(function(U){var j=N.fragCurrent,Y=N.hls,J=N.levels;if(!J)throw new Error("init load aborted, missing levels");var ee=J[h.level].details;console.assert(ee,"Level details are defined when init segment is loaded");var ie=h.stats;N.state=c.IDLE,N.fragLoadError=0,h.data=new Uint8Array(U.payload),ie.parsing.start=ie.buffering.start=self.performance.now(),ie.parsing.end=ie.buffering.end=self.performance.now(),U.frag===j&&Y.trigger(g.Events.FRAG_BUFFERED,{stats:ie,frag:j,part:null,id:h.type}),N.tick()}).catch(function(U){if(N.state===c.STOPPED||N.state===c.ERROR)return;N.warn(U),N.resetFragmentLoading(h)})},a.fragContextChanged=function(h){var n=this.fragCurrent;return!h||!n||h.level!==n.level||h.sn!==n.sn||h.urlId!==n.urlId},a.fragBufferedComplete=function(h,n){var N,U,j,Y,J=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log("Buffered "+h.type+" sn: "+h.sn+(n?" part: "+n.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+h.level+" (frag:["+((N=h.startPTS)!=null?N:NaN).toFixed(3)+"-"+((U=h.endPTS)!=null?U:NaN).toFixed(3)+"] > buffer:"+(J?w.default.toString(D.BufferHelper.getBuffered(J)):"(detached)")+")"),this.state=c.IDLE,!J)return;!this.loadedmetadata&&h.type==R.PlaylistLevelType.MAIN&&J.buffered.length&&((j=this.fragCurrent)===null||j===void 0?void 0:j.sn)===((Y=this.fragPrevious)===null||Y===void 0?void 0:Y.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick()},a.seekToStartPos=function(){},a._handleFragmentLoadComplete=function(h){var n=this.transmuxer;if(!n)return;var N=h.frag,U=h.part,j=h.partsLoaded,Y=!j||j.length===0||j.some(function(ee){return!ee}),J=new u.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,U?U.index:-1,!Y);n.flush(J)},a._handleFragmentLoadProgress=function(h){},a._doFragLoad=function(h,n,N,U){var j,Y=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");var J=null;if(h.encrypted&&!((j=h.decryptdata)!==null&&j!==void 0&&j.key)?(this.log("Loading key for "+h.sn+" of ["+n.startSN+"-"+n.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+h.level),this.state=c.KEY_LOADING,this.fragCurrent=h,J=this.keyLoader.load(h).then(function(oe){if(!Y.fragContextChanged(oe.frag))return Y.hls.trigger(g.Events.KEY_LOADED,oe),Y.state===c.KEY_LOADING&&(Y.state=c.IDLE),oe}),this.hls.trigger(g.Events.KEY_LOADING,{frag:h}),this.throwIfFragContextChanged("KEY_LOADING")):!h.encrypted&&n.encryptedFragments.length&&this.keyLoader.loadClear(h,n.encryptedFragments),N=Math.max(h.start,N||0),this.config.lowLatencyMode&&n){var ee=n.partList;if(ee&&U){N>h.end&&n.fragmentHint&&(h=n.fragmentHint);var ie=this.getNextPart(ee,h,N);if(ie>-1){var re=ee[ie];return this.log("Loading part sn: "+h.sn+" p: "+re.index+" cc: "+h.cc+" of playlist ["+n.startSN+"-"+n.endSN+"] parts [0-"+ie+"-"+(ee.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+h.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=re.start+re.duration,this.state=c.FRAG_LOADING,this.hls.trigger(g.Events.FRAG_LOADING,{frag:h,part:ee[ie],targetBufferTime:N}),this.throwIfFragContextChanged("FRAG_LOADING parts"),J?J.then(function(oe){return!oe||Y.fragContextChanged(oe.frag)?null:Y.doFragPartsLoad(h,ee,ie,U)}).catch(function(oe){return Y.handleFragLoadError(oe)}):this.doFragPartsLoad(h,ee,ie,U).catch(function(oe){return Y.handleFragLoadError(oe)})}else if(!h.url||this.loadedEndOfParts(ee,N))return Promise.resolve(null)}}this.log("Loading fragment "+h.sn+" cc: "+h.cc+" "+(n?"of ["+n.startSN+"-"+n.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+h.level+", target: "+parseFloat(N.toFixed(3))),(0,W.isFiniteNumber)(h.sn)&&!this.bitrateTest&&(this.nextLoadPosition=h.start+h.duration),this.state=c.FRAG_LOADING,this.hls.trigger(g.Events.FRAG_LOADING,{frag:h,targetBufferTime:N}),this.throwIfFragContextChanged("FRAG_LOADING");var he=this.config.progressive;return he&&J?J.then(function(oe){return!oe||Y.fragContextChanged(oe==null?void 0:oe.frag)?null:Y.fragmentLoader.load(h,U)}).catch(function(oe){return Y.handleFragLoadError(oe)}):Promise.all([this.fragmentLoader.load(h,he?U:void 0),J]).then(function(oe){var ae=oe[0];return!he&&ae&&U&&U(ae),ae}).catch(function(oe){return Y.handleFragLoadError(oe)})},a.throwIfFragContextChanged=function(h){if(this.fragCurrent===null)throw new Error("frag load aborted, context changed in "+h)},a.doFragPartsLoad=function(h,n,N,U){var j=this;return new Promise(function(Y,J){var ee=[],ie=function re(he){var oe=n[he];j.fragmentLoader.loadPart(h,oe,U).then(function(ae){ee[oe.index]=ae;var Ee=ae.part;j.hls.trigger(g.Events.FRAG_LOADED,ae);var Le=n[he+1];if(Le&&Le.fragment===h)re(he+1);else return Y({frag:h,part:Ee,partsLoaded:ee})}).catch(J)};ie(N)})},a.handleFragLoadError=function(h){if("data"in h){var n=h.data;h.data&&n.details===p.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(n.frag,n.part):this.hls.trigger(g.Events.ERROR,n)}else this.hls.trigger(g.Events.ERROR,{type:p.ErrorTypes.OTHER_ERROR,details:p.ErrorDetails.INTERNAL_EXCEPTION,err:h,fatal:!0});return null},a._handleTransmuxerFlush=function(h){var n=this.getCurrentContext(h);if(!n||this.state!==c.PARSING){!this.fragCurrent&&this.state!==c.STOPPED&&this.state!==c.ERROR&&(this.state=c.IDLE);return}var N=n.frag,U=n.part,j=n.level,Y=self.performance.now();N.stats.parsing.end=Y,U&&(U.stats.parsing.end=Y),this.updateLevelTiming(N,U,j,h.partial)},a.getCurrentContext=function(h){var n=this.levels,N=h.level,U=h.sn,j=h.part;if(!n||!n[N])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+N+". The current chunk will not be buffered."),null;var Y=n[N],J=j>-1?(0,_.getPartWith)(Y,U,j):null,ee=J?J.fragment:(0,_.getFragmentWithSN)(Y,U,this.fragCurrent);return ee?{frag:ee,part:J,level:Y}:null},a.bufferFragmentData=function(h,n,N,U){if(!h||this.state!==c.PARSING)return;var j=h.data1,Y=h.data2,J=j;if(j&&Y&&(J=(0,m.appendUint8Array)(j,Y)),!J||!J.length)return;var ee={type:h.type,frag:n,part:N,chunkMeta:U,parent:n.type,data:J};this.hls.trigger(g.Events.BUFFER_APPENDING,ee),h.dropped&&h.independent&&!N&&this.flushBufferGap(n)},a.flushBufferGap=function(h){var n=this.media;if(!n)return;if(!D.BufferHelper.isBuffered(n,n.currentTime)){this.flushMainBuffer(0,h.start);return}var N=n.currentTime,U=D.BufferHelper.bufferInfo(n,N,0),j=h.duration,Y=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),J=Math.max(Math.min(h.start-Y,U.end-Y),N+Y);h.start-J>Y&&this.flushMainBuffer(J,h.start)},a.getFwdBufferInfo=function(h,n){var N=this.config,U=this.getLoadPosition();if(!(0,W.isFiniteNumber)(U))return null;var j=D.BufferHelper.bufferInfo(h,U,N.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var Y=this.fragmentTracker.getBufferedFrag(U,n);if(Y&&j.nextStart<Y.end)return D.BufferHelper.bufferInfo(h,U,Math.max(j.nextStart,N.maxBufferHole))}return j},a.getMaxBufferLength=function(h){var n=this.config,N;return h?N=Math.max(8*n.maxBufferSize/h,n.maxBufferLength):N=n.maxBufferLength,Math.min(N,n.maxMaxBufferLength)},a.reduceMaxBufferLength=function(h){var n=this.config,N=h||n.maxBufferLength;return n.maxMaxBufferLength>=N?(n.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+n.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(h,n){var N=n.fragments,U=N.length;if(!U)return null;var j=this.config,Y=N[0].start,J;if(n.live){var ee=j.initialLiveManifestSize;if(U<ee)return this.warn("Not enough fragments to start playback (have: "+U+", need: "+ee+")"),null;!n.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(J=this.getInitialLiveFragment(n,N),this.startPosition=J?this.hls.liveSyncPosition||J.start:h)}else h<=Y&&(J=N[0]);if(!J){var ie=j.lowLatencyMode?n.partEnd:n.fragmentEnd;J=this.getFragmentAtPosition(h,ie,n)}return this.mapToInitFragWhenRequired(J)},a.mapToInitFragWhenRequired=function(h){return h!=null&&h.initSegment&&!(h!=null&&h.initSegment.data)&&!this.bitrateTest?h.initSegment:h},a.getNextPart=function(h,n,N){for(var U=-1,j=!1,Y=!0,J=0,ee=h.length;J<ee;J++){var ie=h[J];if(Y=Y&&!ie.independent,U>-1&&N<ie.start)break;var re=ie.loaded;re?U=-1:(j||ie.independent||Y)&&ie.fragment===n&&(U=J),j=re}return U},a.loadedEndOfParts=function(h,n){var N=h[h.length-1];return N&&n>N.start&&N.loaded},a.getInitialLiveFragment=function(h,n){var N=this.fragPrevious,U=null;if(N){if(h.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),U=(0,E.findFragmentByPDT)(n,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var j=N.sn+1;if(j>=h.startSN&&j<=h.endSN){var Y=n[j-h.startSN];N.cc===Y.cc&&(U=Y,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=(0,E.findFragWithCC)(n,N.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var J=this.hls.liveSyncPosition;J!==null&&(U=this.getFragmentAtPosition(J,this.bitrateTest?h.fragmentEnd:h.edge,h))}return U},a.getFragmentAtPosition=function(h,n,N){var U=this.config,j=this.fragPrevious,Y=N.fragments,J=N.endSN,ee=N.fragmentHint,ie=U.maxFragLookUpTolerance,re=!!(U.lowLatencyMode&&N.partList&&ee);re&&ee&&!this.bitrateTest&&(Y=Y.concat(ee),J=ee.sn);var he;if(h<n){var oe=h>n-ie?0:ie;he=(0,E.findFragmentByPTS)(j,Y,h,oe)}else he=Y[Y.length-1];if(he){var ae=he.sn-N.startSN;if(this.fragmentTracker.getState(he)===H.FragmentState.OK&&(j=he),j&&he.sn===j.sn&&!re){var Ee=j&&he.level===j.level;if(Ee){var Le=Y[ae+1];he.sn<J&&this.fragmentTracker.getState(Le)!==H.FragmentState.OK?(this.log("SN "+he.sn+" just loaded, load next one: "+Le.sn),he=Le):he=null}}}return he},a.synchronizeToLiveEdge=function(h){var n=this.config,N=this.media;if(!N)return;var U=this.hls.liveSyncPosition,j=N.currentTime,Y=h.fragments[0].start,J=h.edge,ee=j>=Y-n.maxFragLookUpTolerance&&j<=J;if(U!==null&&N.duration>U&&(j<U||!ee)){var ie=n.liveMaxLatencyDuration!==void 0?n.liveMaxLatencyDuration:n.liveMaxLatencyDurationCount*h.targetduration;(!ee&&N.readyState<4||j<J-ie)&&(this.loadedmetadata||(this.nextLoadPosition=U),N.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+J+", reset currentTime to : "+U.toFixed(3)),N.currentTime=U))}},a.alignPlaylists=function(h,n){var N=this.levels,U=this.levelLastLoaded,j=this.fragPrevious,Y=U!==null?N[U]:null,J=h.fragments.length;if(!J)return this.warn("No fragments in live playlist"),0;var ee=h.fragments[0].start,ie=!n,re=h.alignedSliding&&(0,W.isFiniteNumber)(ee);if(ie||!re&&!ee){(0,b.alignStream)(j,Y,h);var he=h.fragments[0].start;return this.log("Live playlist sliding: "+he.toFixed(2)+" start-sn: "+(n?n.startSN:"na")+"->"+h.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+J),he}return ee},a.waitForCdnTuneIn=function(h){var n=3;return h.live&&h.canBlockReload&&h.partTarget&&h.tuneInGoal>Math.max(h.partHoldBack,h.partTarget*n)},a.setStartPosition=function(h,n){var N=this.startPosition;if(N<n&&(N=-1),N===-1||this.lastCurrentTime===-1){var U=h.startTimeOffset;(0,W.isFiniteNumber)(U)?(N=n+U,U<0&&(N+=h.totalduration),N=Math.min(Math.max(n,N),n+h.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+N),this.startPosition=N):h.live?N=this.hls.liveSyncPosition||n:this.startPosition=N=0,this.lastCurrentTime=N}this.nextLoadPosition=N},a.getLoadPosition=function(){var h=this.media,n=0;return this.loadedmetadata&&h?n=h.currentTime:this.nextLoadPosition&&(n=this.nextLoadPosition),n},a.handleFragLoadAborted=function(h,n){this.transmuxer&&h.sn!=="initSegment"&&h.stats.aborted&&(this.warn("Fragment "+h.sn+(n?" part"+n.index:"")+" of level "+h.level+" was aborted"),this.resetFragmentLoading(h))},a.resetFragmentLoading=function(h){(!this.fragCurrent||!this.fragContextChanged(h)&&this.state!==c.FRAG_LOADING_WAITING_RETRY)&&(this.state=c.IDLE)},a.onFragmentOrKeyLoadError=function(h,n){if(n.fatal){this.stopLoad(),this.state=c.ERROR;return}var N=this.config;if(n.chunkMeta){var U=this.getCurrentContext(n.chunkMeta);U&&(n.frag=U.frag,n.levelRetry=!0,this.fragLoadError=N.fragLoadingMaxRetry)}var j=n.frag;if(!j||j.type!==h)return;var Y=this.fragCurrent;if(console.assert(Y&&j.sn===Y.sn&&j.level===Y.level&&j.urlId===Y.urlId,"Frag load error must match current frag to retry"),this.fragLoadError+1<=N.fragLoadingMaxRetry){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var J=Math.min(Math.pow(2,this.fragLoadError)*N.fragLoadingRetryDelay,N.fragLoadingMaxRetryTimeout);this.warn("Fragment "+j.sn+" of "+h+" "+j.level+" failed to load, retrying in "+J+"ms"),this.retryDate=self.performance.now()+J,this.fragLoadError++,this.state=c.FRAG_LOADING_WAITING_RETRY}else n.levelRetry?(h===R.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=c.IDLE):(M.logger.error(n.details+" reaches max retry, redispatch as fatal ..."),n.fatal=!0,this.hls.stopLoad(),this.state=c.ERROR)},a.afterBufferFlushed=function(h,n,N){if(!h)return;var U=D.BufferHelper.getBuffered(h);this.fragmentTracker.detectEvictedFragments(n,U,N),this.state===c.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=c.IDLE},a.resetStartWhenNotLoaded=function(h){if(!this.loadedmetadata){this.startFragRequested=!1;var n=this.levels?this.levels[h].details:null;n!=null&&n.live?(this.startPosition=-1,this.setStartPosition(n,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},a.updateLevelTiming=function(h,n,N,U){var j=this,Y=N.details;console.assert(!!Y,"level.details must be defined");var J=Object.keys(h.elementaryStreams).reduce(function(ee,ie){var re=h.elementaryStreams[ie];if(re){var he=re.endPTS-re.startPTS;if(he<=0)return j.warn("Could not parse fragment "+h.sn+" "+ie+" duration reliably ("+he+")"),ee||!1;var oe=U?0:(0,_.updateFragPTSDTS)(Y,h,re.startPTS,re.endPTS,re.startDTS,re.endDTS);return j.hls.trigger(g.Events.LEVEL_PTS_UPDATED,{details:Y,level:N,drift:oe,type:ie,frag:h,start:re.startPTS,end:re.endPTS}),!0}return ee},!1);J||(this.warn("Found no media in fragment "+h.sn+" of level "+N.id+" resetting transmuxer to fallback to playlist timing"),this.resetTransmuxer()),this.state=c.PARSED,this.hls.trigger(g.Events.FRAG_PARSED,{frag:h,part:n})},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},I(l,[{key:"state",get:function(){return this._state},set:function(h){var n=this._state;n!==h&&(this._state=h,this.log(n+"->"+h))}}]),l}(r.default)},"./src/controller/buffer-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>E});var W=F("./src/polyfills/number.ts"),r=F("./src/events.ts"),H=F("./src/utils/logger.ts"),D=F("./src/errors.ts"),M=F("./src/utils/buffer-helper.ts"),g=F("./src/utils/mediasource-helper.ts"),p=F("./src/loader/fragment.ts"),u=F("./src/controller/buffer-operation-queue.ts"),m=(0,g.getMediaSource)(),b=/([ha]vc.)(?:\.[^.,]+)+/,E=function(){function _(O){var w=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.lastMpegAudioChunk=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var R=w.media,x=w.mediaSource;H.logger.log("[buffer-controller]: Media source opened"),R&&(R.removeEventListener("emptied",w._onMediaEmptied),w.updateMediaElementDuration(),w.hls.trigger(r.Events.MEDIA_ATTACHED,{media:R})),x&&x.removeEventListener("sourceopen",w._onMediaSourceOpen),w.checkPendingTracks()},this._onMediaSourceClose=function(){H.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){H.logger.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=function(){var R=w.media,x=w._objectUrl;R&&R.src!==x&&H.logger.error("Media element src was set while attaching MediaSource ("+x+" > "+R.src+")")},this.hls=O,this._initSourceBuffer(),this.registerListeners()}var f=_.prototype;return f.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},f.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null},f.registerListeners=function(){var w=this.hls;w.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),w.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),w.on(r.Events.BUFFER_RESET,this.onBufferReset,this),w.on(r.Events.BUFFER_APPENDING,this.onBufferAppending,this),w.on(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),w.on(r.Events.BUFFER_EOS,this.onBufferEos,this),w.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),w.on(r.Events.LEVEL_UPDATED,this.onLevelUpdated,this),w.on(r.Events.FRAG_PARSED,this.onFragParsed,this),w.on(r.Events.FRAG_CHANGED,this.onFragChanged,this)},f.unregisterListeners=function(){var w=this.hls;w.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),w.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),w.off(r.Events.BUFFER_RESET,this.onBufferReset,this),w.off(r.Events.BUFFER_APPENDING,this.onBufferAppending,this),w.off(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),w.off(r.Events.BUFFER_EOS,this.onBufferEos,this),w.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),w.off(r.Events.LEVEL_UPDATED,this.onLevelUpdated,this),w.off(r.Events.FRAG_PARSED,this.onFragParsed,this),w.off(r.Events.FRAG_CHANGED,this.onFragChanged,this)},f._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new u.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null},f.onManifestParsed=function(w,R){var x=2;(R.audio&&!R.video||!R.altAudio)&&(x=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=x,this.details=null,H.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},f.onMediaAttaching=function(w,R){var x=this.media=R.media;if(x&&m){var I=this.mediaSource=new m;I.addEventListener("sourceopen",this._onMediaSourceOpen),I.addEventListener("sourceended",this._onMediaSourceEnded),I.addEventListener("sourceclose",this._onMediaSourceClose),x.src=self.URL.createObjectURL(I),this._objectUrl=x.src,x.addEventListener("emptied",this._onMediaEmptied)}},f.onMediaDetaching=function(){var w=this.media,R=this.mediaSource,x=this._objectUrl;if(R){if(H.logger.log("[buffer-controller]: media source detaching"),R.readyState==="open")try{R.endOfStream()}catch(I){H.logger.warn("[buffer-controller]: onMediaDetaching: "+I.message+" while calling endOfStream")}this.onBufferReset(),R.removeEventListener("sourceopen",this._onMediaSourceOpen),R.removeEventListener("sourceended",this._onMediaSourceEnded),R.removeEventListener("sourceclose",this._onMediaSourceClose),w&&(w.removeEventListener("emptied",this._onMediaEmptied),x&&self.URL.revokeObjectURL(x),w.src===x?(w.removeAttribute("src"),w.load()):H.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(r.Events.MEDIA_DETACHED,void 0)},f.onBufferReset=function(){var w=this;this.getSourceBufferTypes().forEach(function(R){var x=w.sourceBuffer[R];try{x&&(w.removeBufferListeners(R),w.mediaSource&&w.mediaSource.removeSourceBuffer(x),w.sourceBuffer[R]=void 0)}catch(I){H.logger.warn("[buffer-controller]: Failed to reset the "+R+" buffer",I)}}),this._initSourceBuffer()},f.onBufferCodecs=function(w,R){var x=this,I=this.getSourceBufferTypes().length;if(Object.keys(R).forEach(function(k){if(I){var A=x.tracks[k];if(A&&typeof A.buffer.changeType=="function"){var P=R[k],S=P.id,C=P.codec,c=P.levelCodec,o=P.container,v=P.metadata,l=(A.levelCodec||A.codec).replace(b,"$1"),a=(c||C).replace(b,"$1");if(l!==a){var T=o+";codecs="+(c||C);x.appendChangeType(k,T),H.logger.log("[buffer-controller]: switching codec "+l+" to "+a),x.tracks[k]={buffer:A.buffer,codec:C,container:o,levelCodec:c,metadata:v,id:S}}}}else x.pendingTracks[k]=R[k]}),I)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},f.appendChangeType=function(w,R){var x=this,I=this.operationQueue,k={execute:function(){var P=x.sourceBuffer[w];P&&(H.logger.log("[buffer-controller]: changing "+w+" sourceBuffer type to "+R),P.changeType(R)),I.shiftAndExecuteNext(w)},onStart:function(){},onComplete:function(){},onError:function(P){H.logger.warn("[buffer-controller]: Failed to change "+w+" SourceBuffer type",P)}};I.append(k,w)},f.onBufferAppending=function(w,R){var x=this,I=this.hls,k=this.operationQueue,A=this.tracks,P=R.data,S=R.type,C=R.frag,c=R.part,o=R.chunkMeta,v=o.buffering[S],l=self.performance.now();v.start=l;var a=C.stats.buffering,T=c?c.stats.buffering:null;a.start===0&&(a.start=l),T&&T.start===0&&(T.start=l);var h=A.audio,n=!1;S==="audio"&&(h==null?void 0:h.container)==="audio/mpeg"&&(n=!this.lastMpegAudioChunk||o.id===1||this.lastMpegAudioChunk.sn!==o.sn,this.lastMpegAudioChunk=o);var N=C.start,U={execute:function(){if(v.executeStart=self.performance.now(),n){var Y=x.sourceBuffer[S];if(Y){var J=N-Y.timestampOffset;Math.abs(J)>=.1&&(H.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+N+" (delta: "+J+") sn: "+C.sn+")"),Y.timestampOffset=N)}}x.appendExecutor(P,S)},onStart:function(){},onComplete:function(){var Y=self.performance.now();v.executeEnd=v.end=Y,a.first===0&&(a.first=Y),T&&T.first===0&&(T.first=Y);var J=x.sourceBuffer,ee={};for(var ie in J)ee[ie]=M.BufferHelper.getBuffered(J[ie]);x.appendError=0,x.hls.trigger(r.Events.BUFFER_APPENDED,{type:S,frag:C,part:c,chunkMeta:o,parent:C.type,timeRanges:ee})},onError:function(Y){H.logger.error("[buffer-controller]: Error encountered while trying to append to the "+S+" SourceBuffer",Y);var J={type:D.ErrorTypes.MEDIA_ERROR,parent:C.type,details:D.ErrorDetails.BUFFER_APPEND_ERROR,err:Y,fatal:!1};Y.code===DOMException.QUOTA_EXCEEDED_ERR?J.details=D.ErrorDetails.BUFFER_FULL_ERROR:(x.appendError++,J.details=D.ErrorDetails.BUFFER_APPEND_ERROR,x.appendError>I.config.appendErrorMaxRetry&&(H.logger.error("[buffer-controller]: Failed "+I.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),J.fatal=!0,I.stopLoad())),I.trigger(r.Events.ERROR,J)}};k.append(U,S)},f.onBufferFlushing=function(w,R){var x=this,I=this.operationQueue,k=function(P){return{execute:x.removeExecutor.bind(x,P,R.startOffset,R.endOffset),onStart:function(){},onComplete:function(){x.hls.trigger(r.Events.BUFFER_FLUSHED,{type:P})},onError:function(C){H.logger.warn("[buffer-controller]: Failed to remove from "+P+" SourceBuffer",C)}}};R.type?I.append(k(R.type),R.type):this.getSourceBufferTypes().forEach(function(A){I.append(k(A),A)})},f.onFragParsed=function(w,R){var x=this,I=R.frag,k=R.part,A=[],P=k?k.elementaryStreams:I.elementaryStreams;P[p.ElementaryStreamTypes.AUDIOVIDEO]?A.push("audiovideo"):(P[p.ElementaryStreamTypes.AUDIO]&&A.push("audio"),P[p.ElementaryStreamTypes.VIDEO]&&A.push("video"));var S=function(){var c=self.performance.now();I.stats.buffering.end=c,k&&(k.stats.buffering.end=c);var o=k?k.stats:I.stats;x.hls.trigger(r.Events.FRAG_BUFFERED,{frag:I,part:k,stats:o,id:I.type})};A.length===0&&H.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+I.type+" level: "+I.level+" sn: "+I.sn),this.blockBuffers(S,A)},f.onFragChanged=function(w,R){this.flushBackBuffer()},f.onBufferEos=function(w,R){var x=this,I=this.getSourceBufferTypes().reduce(function(k,A){var P=x.sourceBuffer[A];return P&&(!R.type||R.type===A)&&(P.ending=!0,P.ended||(P.ended=!0,H.logger.log("[buffer-controller]: "+A+" sourceBuffer now EOS"))),k&&!!(!P||P.ended)},!0);I&&(H.logger.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){x.getSourceBufferTypes().forEach(function(A){var P=x.sourceBuffer[A];P&&(P.ending=!1)});var k=x.mediaSource;if(!k||k.readyState!=="open"){k&&H.logger.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+k.readyState);return}H.logger.log("[buffer-controller]: Calling mediaSource.endOfStream()"),k.endOfStream()}))},f.onLevelUpdated=function(w,R){var x=R.details;if(!x.fragments.length)return;this.details=x,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},f.flushBackBuffer=function(){var w=this.hls,R=this.details,x=this.media,I=this.sourceBuffer;if(!x||R===null)return;var k=this.getSourceBufferTypes();if(!k.length)return;var A=R.live&&w.config.liveBackBufferLength!==null?w.config.liveBackBufferLength:w.config.backBufferLength;if(!(0,W.isFiniteNumber)(A)||A<0)return;var P=x.currentTime,S=R.levelTargetDuration,C=Math.max(A,S),c=Math.floor(P/S)*S-C;k.forEach(function(o){var v=I[o];if(v){var l=M.BufferHelper.getBuffered(v);if(l.length>0&&c>l.start(0)){if(w.trigger(r.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),R.live)w.trigger(r.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c});else if(v.ended&&l.end(l.length-1)-P<S*2){H.logger.info("[buffer-controller]: Cannot flush "+o+" back buffer while SourceBuffer is in ended state");return}w.trigger(r.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:o})}}})},f.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var w=this.details,R=this.hls,x=this.media,I=this.mediaSource,k=w.fragments[0].start+w.totalduration,A=x.duration,P=(0,W.isFiniteNumber)(I.duration)?I.duration:0;w.live&&R.config.liveDurationInfinity?(H.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),I.duration=Infinity,this.updateSeekableRange(w)):(k>P&&k>A||!(0,W.isFiniteNumber)(A))&&(H.logger.log("[buffer-controller]: Updating Media Source duration to "+k.toFixed(3)),I.duration=k)},f.updateSeekableRange=function(w){var R=this.mediaSource,x=w.fragments,I=x.length;if(I&&w.live&&R!==null&&R!==void 0&&R.setLiveSeekableRange){var k=Math.max(0,x[0].start),A=Math.max(k,k+w.totalduration);R.setLiveSeekableRange(k,A)}},f.checkPendingTracks=function(){var w=this.bufferCodecEventsExpected,R=this.operationQueue,x=this.pendingTracks,I=Object.keys(x).length;if(I&&!w||I===2){this.createSourceBuffers(x),this.pendingTracks={};var k=this.getSourceBufferTypes();if(k.length===0){this.hls.trigger(r.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}k.forEach(function(A){R.executeNext(A)})}},f.createSourceBuffers=function(w){var R=this.sourceBuffer,x=this.mediaSource;if(!x)throw Error("createSourceBuffers called when mediaSource was null");var I=0;for(var k in w)if(!R[k]){var A=w[k];if(!A)throw Error("source buffer exists for track "+k+", however track does not");var P=A.levelCodec||A.codec,S=A.container+";codecs="+P;H.logger.log("[buffer-controller]: creating sourceBuffer("+S+")");try{var C=R[k]=x.addSourceBuffer(S),c=k;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[k]={buffer:C,codec:P,container:A.container,levelCodec:A.levelCodec,metadata:A.metadata,id:A.id},I++}catch(o){H.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+o.message),this.hls.trigger(r.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:o,mimeType:S})}}I&&this.hls.trigger(r.Events.BUFFER_CREATED,{tracks:this.tracks})},f._onSBUpdateStart=function(w){var R=this.operationQueue,x=R.current(w);x.onStart()},f._onSBUpdateEnd=function(w){var R=this.operationQueue,x=R.current(w);x.onComplete(),R.shiftAndExecuteNext(w)},f._onSBUpdateError=function(w,R){H.logger.error("[buffer-controller]: "+w+" SourceBuffer error",R),this.hls.trigger(r.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var x=this.operationQueue.current(w);x&&x.onError(R)},f.removeExecutor=function(w,R,x){var I=this.media,k=this.mediaSource,A=this.operationQueue,P=this.sourceBuffer,S=P[w];if(!I||!k||!S){H.logger.warn("[buffer-controller]: Attempting to remove from the "+w+" SourceBuffer, but it does not exist"),A.shiftAndExecuteNext(w);return}var C=(0,W.isFiniteNumber)(I.duration)?I.duration:Infinity,c=(0,W.isFiniteNumber)(k.duration)?k.duration:Infinity,o=Math.max(0,R),v=Math.min(x,C,c);v>o&&!S.ending?(S.ended=!1,H.logger.log("[buffer-controller]: Removing ["+o+","+v+"] from the "+w+" SourceBuffer"),console.assert(!S.updating,w+" sourceBuffer must not be updating"),S.remove(o,v)):A.shiftAndExecuteNext(w)},f.appendExecutor=function(w,R){var x=this.operationQueue,I=this.sourceBuffer,k=I[R];if(!k){H.logger.warn("[buffer-controller]: Attempting to append to the "+R+" SourceBuffer, but it does not exist"),x.shiftAndExecuteNext(R);return}k.ended=!1,console.assert(!k.updating,R+" sourceBuffer must not be updating"),k.appendBuffer(w)},f.blockBuffers=function(w,R){var x=this;if(R===void 0&&(R=this.getSourceBufferTypes()),!R.length){H.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(w);return}var I=this.operationQueue,k=R.map(function(A){return I.appendBlocker(A)});Promise.all(k).then(function(){w(),R.forEach(function(A){var P=x.sourceBuffer[A];(!P||!P.updating)&&I.shiftAndExecuteNext(A)})})},f.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},f.addBufferListener=function(w,R,x){var I=this.sourceBuffer[w];if(!I)return;var k=x.bind(this,w);this.listeners[w].push({event:R,listener:k}),I.addEventListener(R,k)},f.removeBufferListeners=function(w){var R=this.sourceBuffer[w];if(!R)return;this.listeners[w].forEach(function(x){R.removeEventListener(x.event,x.listener)})},_}()},"./src/controller/buffer-operation-queue.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>r});var W=F("./src/utils/logger.ts"),r=function(){function H(M){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=M}var D=H.prototype;return D.append=function(g,p){var u=this.queues[p];u.push(g),u.length===1&&this.buffers[p]&&this.executeNext(p)},D.insertAbort=function(g,p){var u=this.queues[p];u.unshift(g),this.executeNext(p)},D.appendBlocker=function(g){var p,u=new Promise(function(b){p=b}),m={execute:p,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(m,g),u},D.executeNext=function(g){var p=this.buffers,u=this.queues,m=p[g],b=u[g];if(b.length){var E=b[0];try{E.execute()}catch(_){W.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),E.onError(_),(!m||!m.updating)&&(b.shift(),this.executeNext(g))}}},D.shiftAndExecuteNext=function(g){this.queues[g].shift(),this.executeNext(g)},D.current=function(g){return this.queues[g][0]},H}()},"./src/controller/cap-level-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>p});var W=F("./src/events.ts");function r(u,m){for(var b=0;b<m.length;b++){var E=m[b];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(u,D(E.key),E)}}function H(u,m,b){return m&&r(u.prototype,m),b&&r(u,b),Object.defineProperty(u,"prototype",{writable:!1}),u}function D(u){var m=M(u,"string");return typeof m=="symbol"?m:String(m)}function M(u,m){if(typeof u!="object"||u===null)return u;var b=u[Symbol.toPrimitive];if(b!==void 0){var E=b.call(u,m||"default");if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return(m==="string"?String:Number)(u)}var g=function(){function u(b){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=b,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var m=u.prototype;return m.setStreamController=function(E){this.streamController=E},m.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},m.registerListeners=function(){var E=this.hls;E.on(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},m.unregisterListener=function(){var E=this.hls;E.off(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},m.onFpsDropLevelCapping=function(E,_){u.isLevelAllowed(_.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(_.droppedLevel)},m.onMediaAttaching=function(E,_){this.media=_.media instanceof HTMLVideoElement?_.media:null,this.clientRect=null},m.onManifestParsed=function(E,_){var f=this.hls;this.restrictedLevels=[],this.firstLevel=_.firstLevel,f.config.capLevelToPlayerSize&&_.video&&this.startCapping()},m.onBufferCodecs=function(E,_){var f=this.hls;f.config.capLevelToPlayerSize&&_.video&&this.startCapping()},m.onMediaDetaching=function(){this.stopCapping()},m.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var _=this.hls;_.autoLevelCapping=this.getMaxLevel(E.length-1),_.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=_.autoLevelCapping}}},m.getMaxLevel=function(E){var _=this,f=this.hls.levels;if(!f.length)return-1;var O=f.filter(function(w,R){return u.isLevelAllowed(R,_.restrictedLevels)&&R<=E});return this.clientRect=null,u.getMaxLevelByMediaSize(O,this.mediaWidth,this.mediaHeight)},m.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},m.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},m.getDimensions=function(){if(this.clientRect)return this.clientRect;var E=this.media,_={width:0,height:0};if(E){var f=E.getBoundingClientRect();_.width=f.width,_.height=f.height,!_.width&&!_.height&&(_.width=f.right-f.left||E.width||0,_.height=f.bottom-f.top||E.height||0)}return this.clientRect=_,_},u.isLevelAllowed=function(E,_){return _===void 0&&(_=[]),_.indexOf(E)===-1},u.getMaxLevelByMediaSize=function(E,_,f){if(!E||!E.length)return-1;for(var O=function(k,A){return A?k.width!==A.width||k.height!==A.height:!0},w=E.length-1,R=0;R<E.length;R+=1){var x=E[R];if((x.width>=_||x.height>=f)&&O(x,E[R+1])){w=R;break}}return w},H(u,[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var E=1;if(!this.hls.config.ignoreDevicePixelRatio)try{E=self.devicePixelRatio}catch(_){}return E}}]),u}();const p=g},"./src/controller/cmcd-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>f});var W=F("./src/events.ts"),r=F("./src/types/cmcd.ts"),H=F("./src/utils/buffer-helper.ts"),D=F("./src/utils/logger.ts");function M(O,w){for(var R=0;R<w.length;R++){var x=w[R];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(O,p(x.key),x)}}function g(O,w,R){return w&&M(O.prototype,w),R&&M(O,R),Object.defineProperty(O,"prototype",{writable:!1}),O}function p(O){var w=u(O,"string");return typeof w=="symbol"?w:String(w)}function u(O,w){if(typeof O!="object"||O===null)return O;var R=O[Symbol.toPrimitive];if(R!==void 0){var x=R.call(O,w||"default");if(typeof x!="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return(w==="string"?String:Number)(O)}function m(O,w){var R=typeof Symbol!="undefined"&&O[Symbol.iterator]||O["@@iterator"];if(R)return(R=R.call(O)).next.bind(R);if(Array.isArray(O)||(R=b(O))||w&&O&&typeof O.length=="number"){R&&(O=R);var x=0;return function(){return x>=O.length?{done:!0}:{done:!1,value:O[x++]}}}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 b(O,w){if(!O)return;if(typeof O=="string")return E(O,w);var R=Object.prototype.toString.call(O).slice(8,-1);if(R==="Object"&&O.constructor&&(R=O.constructor.name),R==="Map"||R==="Set")return Array.from(O);if(R==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(R))return E(O,w)}function E(O,w){(w==null||w>O.length)&&(w=O.length);for(var R=0,x=new Array(w);R<w;R++)x[R]=O[R];return x}function _(){return _=Object.assign?Object.assign.bind():function(O){for(var w=1;w<arguments.length;w++){var R=arguments[w];for(var x in R)Object.prototype.hasOwnProperty.call(R,x)&&(O[x]=R[x])}return O},_.apply(this,arguments)}var f=function(){function O(R){var x=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(){x.initialized&&(x.starved=!0),x.buffering=!0},this.onPlaying=function(){x.initialized||(x.initialized=!0),x.buffering=!1},this.applyPlaylistData=function(A){try{x.apply(A,{ot:r.CMCDObjectType.MANIFEST,su:!x.initialized})}catch(P){D.logger.warn("Could not generate manifest CMCD data.",P)}},this.applyFragmentData=function(A){try{var P=A.frag,S=x.hls.levels[P.level],C=x.getObjectType(P),c={d:P.duration*1e3,ot:C};(C===r.CMCDObjectType.VIDEO||C===r.CMCDObjectType.AUDIO||C==r.CMCDObjectType.MUXED)&&(c.br=S.bitrate/1e3,c.tb=x.getTopBandwidth(C)/1e3,c.bl=x.getBufferLength(C)),x.apply(A,c)}catch(o){D.logger.warn("Could not generate segment CMCD data.",o)}},this.hls=R;var I=this.config=R.config,k=I.cmcd;k!=null&&(I.pLoader=this.createPlaylistLoader(),I.fLoader=this.createFragmentLoader(),this.sid=k.sessionId||O.uuid(),this.cid=k.contentId,this.useHeaders=k.useHeaders===!0,this.registerListeners())}var w=O.prototype;return w.registerListeners=function(){var x=this.hls;x.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),x.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this)},w.unregisterListeners=function(){var x=this.hls;x.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),x.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},w.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},w.onMediaAttached=function(x,I){this.media=I.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},w.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},w.onBufferCreated=function(x,I){var k,A;this.audioBuffer=(k=I.tracks.audio)===null||k===void 0?void 0:k.buffer,this.videoBuffer=(A=I.tracks.video)===null||A===void 0?void 0:A.buffer},w.createData=function(){var x;return{v:r.CMCDVersion,sf:r.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(x=this.media)===null||x===void 0?void 0:x.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},w.apply=function(x,I){I===void 0&&(I={}),_(I,this.createData());var k=I.ot===r.CMCDObjectType.INIT||I.ot===r.CMCDObjectType.VIDEO||I.ot===r.CMCDObjectType.MUXED;if(this.starved&&k&&(I.bs=!0,I.su=!0,this.starved=!1),I.su==null&&(I.su=this.buffering),this.useHeaders){var A=O.toHeaders(I);if(!Object.keys(A).length)return;x.headers||(x.headers={}),_(x.headers,A)}else{var P=O.toQuery(I);if(!P)return;x.url=O.appendQueryToUri(x.url,P)}},w.getObjectType=function(x){var I=x.type;return I==="subtitle"?r.CMCDObjectType.TIMED_TEXT:x.sn==="initSegment"?r.CMCDObjectType.INIT:I==="audio"?r.CMCDObjectType.AUDIO:I==="main"?this.hls.audioTracks.length?r.CMCDObjectType.VIDEO:r.CMCDObjectType.MUXED:void 0},w.getTopBandwidth=function(x){var I=0,k,A=this.hls;if(x===r.CMCDObjectType.AUDIO)k=A.audioTracks;else{var P=A.maxAutoLevel,S=P>-1?P+1:A.levels.length;k=A.levels.slice(0,S)}for(var C=m(k),c;!(c=C()).done;){var o=c.value;o.bitrate>I&&(I=o.bitrate)}return I>0?I:NaN},w.getBufferLength=function(x){var I=this.hls.media,k=x===r.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!k||!I)return NaN;var A=H.BufferHelper.bufferInfo(k,I.currentTime,this.config.maxBufferHole);return A.len*1e3},w.createPlaylistLoader=function(){var x=this.config.pLoader,I=this.applyPlaylistData,k=x||this.config.loader;return function(){function A(S){this.loader=void 0,this.loader=new k(S)}var P=A.prototype;return P.destroy=function(){this.loader.destroy()},P.abort=function(){this.loader.abort()},P.load=function(C,c,o){I(C),this.loader.load(C,c,o)},g(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},w.createFragmentLoader=function(){var x=this.config.fLoader,I=this.applyFragmentData,k=x||this.config.loader;return function(){function A(S){this.loader=void 0,this.loader=new k(S)}var P=A.prototype;return P.destroy=function(){this.loader.destroy()},P.abort=function(){this.loader.abort()},P.load=function(C,c,o){I(C),this.loader.load(C,c,o)},g(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},O.uuid=function(){var x=URL.createObjectURL(new Blob),I=x.toString();return URL.revokeObjectURL(x),I.slice(I.lastIndexOf("/")+1)},O.serialize=function(x){for(var I=[],k=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},A=function(U){return Math.round(U)},P=function(U){return A(U/100)*100},S=function(U){return encodeURIComponent(U)},C={br:A,d:A,bl:P,dl:P,mtp:P,nor:S,rtp:P,tb:A},c=Object.keys(x||{}).sort(),o=m(c),v;!(v=o()).done;){var l=v.value,a=x[l];if(!k(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var T=C[l];T&&(a=T(a));var h=typeof a,n=void 0;l==="ot"||l==="sf"||l==="st"?n=l+"="+a:h==="boolean"?n=l:h==="number"?n=l+"="+a:n=l+"="+JSON.stringify(a),I.push(n)}return I.join(",")},O.toHeaders=function(x){for(var I=Object.keys(x),k={},A=["Object","Request","Session","Status"],P=[{},{},{},{}],S={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},C=0,c=I;C<c.length;C++){var o=c[C],v=S[o]!=null?S[o]:1;P[v][o]=x[o]}for(var l=0;l<P.length;l++){var a=O.serialize(P[l]);a&&(k["CMCD-"+A[l]]=a)}return k},O.toQuery=function(x){return"CMCD="+encodeURIComponent(O.serialize(x))},O.appendQueryToUri=function(x,I){if(!I)return x;var k=x.includes("?")?"&":"?";return""+x+k+I},O}()},"./src/controller/eme-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>C});var W=F("./src/events.ts"),r=F("./src/errors.ts"),H=F("./src/utils/logger.ts"),D=F("./src/utils/mediakeys-helper.ts"),M=F("./src/utils/keysystem-util.ts"),g=F("./src/utils/numeric-encoding-utils.ts"),p=F("./src/loader/level-key.ts"),u=F("./src/utils/hex.ts"),m=F("./src/utils/mp4-tools.ts"),b=F("./node_modules/eventemitter3/index.js"),E=F.n(b);function _(c,o){c.prototype=Object.create(o.prototype),c.prototype.constructor=c,x(c,o)}function f(c){var o=typeof Map=="function"?new Map:void 0;return f=function(l){if(l===null||!R(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(l))return o.get(l);o.set(l,a)}function a(){return O(l,arguments,I(this).constructor)}return a.prototype=Object.create(l.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),x(a,l)},f(c)}function O(c,o,v){return w()?O=Reflect.construct.bind():O=function(a,T,h){var n=[null];n.push.apply(n,T);var N=Function.bind.apply(a,n),U=new N;return h&&x(U,h.prototype),U},O.apply(null,arguments)}function w(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(c){return!1}}function R(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function x(c,o){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,a){return l.__proto__=a,l},x(c,o)}function I(c){return I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(v){return v.__proto__||Object.getPrototypeOf(v)},I(c)}var k=3,A="[eme]",P=function(){function c(v){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=c.CDMCleanupPromise?[c.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=H.logger.debug.bind(H.logger,A),this.log=H.logger.log.bind(H.logger,A),this.warn=H.logger.warn.bind(H.logger,A),this.error=H.logger.error.bind(H.logger,A),this.hls=v,this.config=v.config,this.registerListeners()}var o=c.prototype;return o.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null},o.registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(W.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},o.unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(W.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},o.getLicenseServerUrl=function(l){var a=this.config,T=a.drmSystems,h=a.widevineLicenseUrl,n=T[l];if(n)return n.licenseUrl;if(l===D.KeySystems.WIDEVINE&&h)return h;throw new Error('no license server URL configured for key-system "'+l+'"')},o.getServerCertificateUrl=function(l){var a=this.config.drmSystems,T=a[l];if(T)return T.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+l+'"]')},o.attemptKeySystemAccess=function(l){var a=this,T=this.hls.levels,h=function(j,Y,J){return!!j&&J.indexOf(j)===Y},n=T.map(function(U){return U.audioCodec}).filter(h),N=T.map(function(U){return U.videoCodec}).filter(h);return n.length+N.length===0&&N.push("avc1.42e01e"),new Promise(function(U,j){var Y=function J(ee){var ie=ee.shift();a.getMediaKeysPromise(ie,n,N).then(function(re){return U({keySystem:ie,mediaKeys:re})}).catch(function(re){ee.length?J(ee):re instanceof S?j(re):j(new S({type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_NO_ACCESS,error:re,fatal:!0},re.message))})};Y(l)})},o.requestMediaKeySystemAccess=function(l,a){var T=this.config.requestMediaKeySystemAccessFunc;if(!(typeof T=="function")){var h="Configured requestMediaKeySystemAccess is not a function "+T;return D.requestMediaKeySystemAccess===null&&self.location.protocol==="http:"&&(h="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(h))}return T(l,a)},o.getMediaKeysPromise=function(l,a,T){var h=this,n=(0,D.getSupportedMediaKeySystemConfigurations)(l,a,T,this.config.drmSystemOptions),N=this.keySystemAccessPromises[l],U=N==null?void 0:N.keySystemAccess;if(!U){this.log('Requesting encrypted media "'+l+'" key-system access with config: '+JSON.stringify(n)),U=this.requestMediaKeySystemAccess(l,n);var j=this.keySystemAccessPromises[l]={keySystemAccess:U};return U.catch(function(Y){h.log('Failed to obtain access to key-system "'+l+'": '+Y)}),U.then(function(Y){h.log('Access for key-system "'+Y.keySystem+'" obtained');var J=h.fetchServerCertificate(l);return h.log('Create media-keys for "'+l+'"'),j.mediaKeys=Y.createMediaKeys().then(function(ee){return h.log('Media-keys created for "'+l+'"'),J.then(function(ie){return ie?h.setMediaKeysServerCertificate(ee,l,ie):ee})}),j.mediaKeys.catch(function(ee){h.error('Failed to create media-keys for "'+l+'"}: '+ee)}),j.mediaKeys})}return U.then(function(){return N.mediaKeys})},o.createMediaKeySessionContext=function(l){var a=l.decryptdata,T=l.keySystem,h=l.mediaKeys;console.assert(!!h,"mediaKeys is defined"),this.log('Creating key-system session "'+T+'" keyId: '+u.default.hexDump(a.keyId||[]));var n=h.createSession(),N={decryptdata:a,keySystem:T,mediaKeys:h,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(N),N},o.renewKeySession=function(l){var a=l.decryptdata;if(a.pssh){var T=this.createMediaKeySessionContext(l),h=this.getKeyIdString(a),n="cenc";this.keyIdToKeySessionPromise[h]=this.generateRequestWithPreferredKeySession(T,n,a.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(l)},o.getKeyIdString=function(l){if(!l)throw new Error("Could not read keyId of undefined decryptdata");if(l.keyId===null)throw new Error("keyId is null");return u.default.hexDump(l.keyId)},o.updateKeySession=function(l,a){var T,h=l.mediaKeysSession;return this.log('Updating key-session "'+h.sessionId+'" for keyID '+u.default.hexDump(((T=l.decryptdata)===null||T===void 0?void 0:T.keyId)||[])+`
|
|
} (data length: `+(a&&a.byteLength)+")"),h.update(a)},o.selectKeySystemFormat=function(l){var a=Object.keys(l.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+l.sn+" "+l.type+": "+l.level+") key formats "+a.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(a)),this.keyFormatPromise},o.getKeyFormatPromise=function(l){var a=this;return new Promise(function(T,h){var n=(0,D.getKeySystemsForConfig)(a.config),N=l.map(D.keySystemFormatToKeySystemDomain).filter(function(U){return!!U&&n.indexOf(U)!==-1});return a.getKeySystemSelectionPromise(N).then(function(U){var j=U.keySystem,Y=(0,D.keySystemDomainToKeySystemFormat)(j);Y?T(Y):h(new Error('Unable to find format for key-system "'+j+'"'))}).catch(h)})},o.loadKey=function(l){var a=this,T=l.keyInfo.decryptdata,h=this.getKeyIdString(T),n="(keyId: "+h+' format: "'+T.keyFormat+'" method: '+T.method+" uri: "+T.uri+")";this.log("Starting session for key "+n);var N=this.keyIdToKeySessionPromise[h];return N||(N=this.keyIdToKeySessionPromise[h]=this.getKeySystemForKeyPromise(T).then(function(U){var j=U.keySystem,Y=U.mediaKeys;return a.throwIfDestroyed(),a.log("Handle encrypted media sn: "+l.frag.sn+" "+l.frag.type+": "+l.frag.level+" using key "+n),a.attemptSetMediaKeys(j,Y).then(function(){a.throwIfDestroyed();var J=a.createMediaKeySessionContext({keySystem:j,mediaKeys:Y,decryptdata:T}),ee="cenc";return a.generateRequestWithPreferredKeySession(J,ee,T.pssh,"playlist-key")})}),N.catch(function(U){return a.handleError(U)})),N},o.throwIfDestroyed=function(l){if(l===void 0&&(l="Invalid state"),!this.hls)throw new Error("invalid state")},o.handleError=function(l){if(!this.hls)return;this.error(l.message),l instanceof S?this.hls.trigger(W.Events.ERROR,l.data):this.hls.trigger(W.Events.ERROR,{type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_NO_KEYS,error:l,fatal:!0})},o.getKeySystemForKeyPromise=function(l){var a=this.getKeyIdString(l),T=this.keyIdToKeySessionPromise[a];if(!T){var h=(0,D.keySystemFormatToKeySystemDomain)(l.keyFormat),n=h?[h]:(0,D.getKeySystemsForConfig)(this.config);return this.attemptKeySystemAccess(n)}return T},o.getKeySystemSelectionPromise=function(l){if(l.length||(l=(0,D.getKeySystemsForConfig)(this.config)),l.length===0)throw new S({type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(l)},o._onMediaEncrypted=function(l){var a=this,T=l.initDataType,h=l.initData;if(this.debug('"'+l.type+'" event: init data type: "'+T+'"'),h===null)return;var n,N;if(T==="sinf"&&this.config.drmSystems[D.KeySystems.FAIRPLAY]){var U=(0,m.bin2str)(new Uint8Array(h));try{var j=(0,g.base64Decode)(JSON.parse(U).sinf),Y=(0,m.parseSinf)(new Uint8Array(j));if(!Y)return;n=Y.subarray(8,24),N=D.KeySystems.FAIRPLAY}catch(Le){this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{var J=(0,m.parsePssh)(h);if(J===null)return;J.version===0&&J.systemId===D.KeySystemIds.WIDEVINE&&J.data&&(n=J.data.subarray(8,24)),N=(0,D.keySystemIdToKeySystemDomain)(J.systemId)}if(!N||!n)return;for(var ee=u.default.hexDump(n),ie=this.keyIdToKeySessionPromise,re=this.mediaKeySessions,he=ie[ee],oe=function(Fe){var Xe=re[Fe],He=Xe.decryptdata;if(He.pssh||!He.keyId)return"continue";var Ae=u.default.hexDump(He.keyId);if(ee===Ae||He.uri.replace(/-/g,"").indexOf(ee)!==-1)return he=ie[Ae],delete ie[Ae],He.pssh=new Uint8Array(h),He.keyId=n,he=ie[ee]=he.then(function(){return a.generateRequestWithPreferredKeySession(Xe,T,h,"encrypted-event-key-match")}),"break"},ae=0;ae<re.length;ae++){var Ee=oe(ae);if(Ee==="continue")continue;if(Ee==="break")break}he||(he=ie[ee]=this.getKeySystemSelectionPromise([N]).then(function(Le){var Fe,Xe=Le.keySystem,He=Le.mediaKeys;a.throwIfDestroyed();var Ae=new p.LevelKey("ISO-23001-7",ee,(Fe=(0,D.keySystemDomainToKeySystemFormat)(Xe))!=null?Fe:"");return Ae.pssh=new Uint8Array(h),Ae.keyId=n,a.attemptSetMediaKeys(Xe,He).then(function(){a.throwIfDestroyed();var Oe=a.createMediaKeySessionContext({decryptdata:Ae,keySystem:Xe,mediaKeys:He});return a.generateRequestWithPreferredKeySession(Oe,T,h,"encrypted-event-no-match")})})),he.catch(function(Le){return a.handleError(Le)})},o._onWaitingForKey=function(l){this.log('"'+l.type+'" event')},o.attemptSetMediaKeys=function(l,a){var T=this,h=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+l+'"');var n=Promise.all(h).then(function(){if(!T.media)throw new Error("Attempted to set mediaKeys without media element attached");return T.media.setMediaKeys(a)});return this.setMediaKeysQueue.push(n),n.then(function(){T.log('Media-keys set for "'+l+'"'),h.push(n),T.setMediaKeysQueue=T.setMediaKeysQueue.filter(function(N){return h.indexOf(N)===-1})})},o.generateRequestWithPreferredKeySession=function(l,a,T,h){var n,N,U=this,j=(n=this.config.drmSystems)===null||n===void 0||((N=n[l.keySystem])===null||N===void 0)?void 0:N.generateRequest;if(j)try{var Y=j.call(this.hls,a,T,l);if(!Y)throw new Error("Invalid response from configured generateRequest filter");a=Y.initDataType,T=l.decryptdata.pssh=Y.initData?new Uint8Array(Y.initData):null}catch(he){var J;if(this.warn(he.message),(J=this.hls)!==null&&J!==void 0&&J.config.debug)throw he}if(T===null)return this.log('Skipping key-session request for "'+h+'" (no initData)'),Promise.resolve(l);var ee=this.getKeyIdString(l.decryptdata);this.log('Generating key-session request for "'+h+'": '+ee+" (init data type: "+a+" length: "+(T?T.byteLength:null)+")");var ie=new(E());l.mediaKeysSession.onmessage=function(he){var oe=l.mediaKeysSession;if(!oe){ie.emit("error",new Error("invalid state"));return}var ae=he.messageType,Ee=he.message;U.log('"'+ae+'" message event for session "'+oe.sessionId+'" message size: '+Ee.byteLength),ae==="license-request"||ae==="license-renewal"?U.renewLicense(l,Ee).catch(function(Le){U.handleError(Le),ie.emit("error",Le)}):ae==="license-release"?l.keySystem===D.KeySystems.FAIRPLAY&&(U.updateKeySession(l,(0,M.strToUtf8array)("acknowledged")),U.removeSession(l)):U.warn('unhandled media key message type "'+ae+'"')},l.mediaKeysSession.onkeystatuseschange=function(he){var oe=l.mediaKeysSession;if(!oe){ie.emit("error",new Error("invalid state"));return}U.onKeyStatusChange(l);var ae=l.keyStatus;ie.emit("keyStatus",ae),ae==="expired"&&(U.warn(l.keySystem+" expired for key "+ee),U.renewKeySession(l))};var re=new Promise(function(he,oe){ie.on("error",oe),ie.on("keyStatus",function(ae){ae.startsWith("usable")?he():ae==="output-restricted"?oe(new S({type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):ae==="internal-error"?oe(new S({type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+ae+'"')):ae==="expired"?oe(new Error("key expired while generating request")):U.warn('unhandled key status change "'+ae+'"')})});return l.mediaKeysSession.generateRequest(a,T).then(function(){var he;U.log('Request generated for key-session "'+((he=l.mediaKeysSession)===null||he===void 0?void 0:he.sessionId)+'" keyId: '+ee)}).catch(function(he){throw new S({type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_NO_SESSION,error:he,fatal:!1},"Error generating key-session request: "+he)}).then(function(){return re}).catch(function(he){throw ie.removeAllListeners(),U.removeSession(l),he}).then(function(){return ie.removeAllListeners(),l})},o.onKeyStatusChange=function(l){var a=this;l.mediaKeysSession.keyStatuses.forEach(function(T,h){a.log('key status change "'+T+'" for keyStatuses keyId: '+u.default.hexDump("buffer"in h?new Uint8Array(h.buffer,h.byteOffset,h.byteLength):new Uint8Array(h))+" session keyId: "+u.default.hexDump(new Uint8Array(l.decryptdata.keyId||[]))+" uri: "+l.decryptdata.uri),l.keyStatus=T})},o.fetchServerCertificate=function(l){var a=this;return new Promise(function(T,h){var n=a.getServerCertificateUrl(l);if(!n)return T();a.log('Fetching serverCertificate for "'+l+'"');var N=new XMLHttpRequest;N.open("GET",n,!0),N.responseType="arraybuffer",N.onreadystatechange=function(){N.readyState===XMLHttpRequest.DONE&&(N.status===200?T(N.response):h(new S({type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:N},'"'+l+'" certificate request XHR failed ('+n+"). Status: "+N.status+" ("+N.statusText+")")))},N.send()})},o.setMediaKeysServerCertificate=function(l,a,T){var h=this;return new Promise(function(n,N){l.setServerCertificate(T).then(function(U){h.log("setServerCertificate "+(U?"success":"not supported by CDM")+" ("+(T==null?void 0:T.byteLength)+') on "'+a+'"'),n(l)}).catch(function(U){N(new S({type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:U,fatal:!0},U.message))})})},o.renewLicense=function(l,a){var T=this;return this.requestLicense(l,new Uint8Array(a)).then(function(h){return T.updateKeySession(l,new Uint8Array(h)).catch(function(n){throw new S({type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:n,fatal:!0},n.message)})})},o.setupLicenseXHR=function(l,a,T,h){var n=this,N=this.config.licenseXhrSetup;return N?Promise.resolve().then(function(){if(!T.decryptdata)throw new Error("Key removed");return N.call(n.hls,l,a,T,h)}).catch(function(U){if(!T.decryptdata)throw U;return l.open("POST",a,!0),N.call(n.hls,l,a,T,h)}).then(function(U){l.readyState||l.open("POST",a,!0);var j=U||h;return{xhr:l,licenseChallenge:j}}):(l.open("POST",a,!0),Promise.resolve({xhr:l,licenseChallenge:h}))},o.requestLicense=function(l,a){var T=this;return new Promise(function(h,n){var N=T.getLicenseServerUrl(l.keySystem);T.log("Sending license request to URL: "+N);var U=new XMLHttpRequest;U.responseType="arraybuffer",U.onreadystatechange=function(){if(!T.hls||!l.mediaKeysSession)return n(new Error("invalid state"));if(U.readyState===4)if(U.status===200){T._requestLicenseFailureCount=0;var j=U.response;T.log("License received "+(j instanceof ArrayBuffer?j.byteLength:j));var Y=T.config.licenseResponseCallback;if(Y)try{j=Y.call(T.hls,U,N,l)}catch(ee){T.error(ee)}h(j)}else if(T._requestLicenseFailureCount++,T._requestLicenseFailureCount>k||U.status>=400&&U.status<500)n(new S({type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:U},"License Request XHR failed ("+N+"). Status: "+U.status+" ("+U.statusText+")"));else{var J=k-T._requestLicenseFailureCount+1;T.warn("Retrying license request, "+J+" attempts left"),T.requestLicense(l,a).then(h,n)}},l.licenseXhr&&l.licenseXhr.readyState!==XMLHttpRequest.DONE&&l.licenseXhr.abort(),l.licenseXhr=U,T.setupLicenseXHR(U,N,l,a).then(function(j){var Y=j.xhr,J=j.licenseChallenge;Y.send(J)})})},o.onMediaAttached=function(l,a){if(!this.config.emeEnabled)return;var T=a.media;this.media=T,T.addEventListener("encrypted",this.onMediaEncrypted),T.addEventListener("waitingforkey",this.onWaitingForKey)},o.onMediaDetached=function(){var l=this,a=this.media,T=this.mediaKeySessions;a&&(a.removeEventListener("encrypted",this.onMediaEncrypted),a.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},p.LevelKey.clearKeyUriToKeyIdMap();var h=T.length;c.CDMCleanupPromise=Promise.all(T.map(function(n){return l.removeSession(n)}).concat(a==null?void 0:a.setMediaKeys(null).catch(function(n){l.log("Could not clear media keys: "+n+". media.src: "+(a==null?void 0:a.src))}))).then(function(){h&&(l.log("finished closing key sessions and clearing media keys"),T.length=0)}).catch(function(n){l.log("Could not close sessions and clear media keys: "+n+". media.src: "+(a==null?void 0:a.src))})},o.onManifestLoaded=function(l,a){var T=a.sessionKeys;if(!T||!this.config.emeEnabled)return;if(!this.keyFormatPromise){var h=T.reduce(function(n,N){return n.indexOf(N.keyFormat)===-1&&n.push(N.keyFormat),n},[]);this.log("Selecting key-system from session-keys "+h.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(h)}},o.removeSession=function(l){var a=this,T=l.mediaKeysSession,h=l.licenseXhr;if(T){this.log("Remove licenses and keys and close session "+T.sessionId),T.onmessage=null,T.onkeystatuseschange=null,h&&h.readyState!==XMLHttpRequest.DONE&&h.abort(),l.mediaKeysSession=l.decryptdata=l.licenseXhr=void 0;var n=this.mediaKeySessions.indexOf(l);return n>-1&&this.mediaKeySessions.splice(n,1),T.remove().catch(function(N){a.log("Could not remove session: "+N)}).then(function(){return T.close()}).catch(function(N){a.log("Could not close session: "+N)})}},c}();P.CDMCleanupPromise=void 0;var S=function(c){_(o,c);function o(v,l){var a;return a=c.call(this,l)||this,a.data=void 0,a.data=v,v.err=v.error,a}return o}(f(Error));const C=P},"./src/controller/fps-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>D});var W=F("./src/events.ts"),r=F("./src/utils/logger.ts"),H=function(){function M(p){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=p,this.registerListeners()}var g=M.prototype;return g.setStreamController=function(u){this.streamController=u},g.registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},g.unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching)},g.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},g.onMediaAttaching=function(u,m){var b=this.hls.config;if(b.capLevelOnFPSDrop){var E=m.media instanceof self.HTMLVideoElement?m.media:null;this.media=E,E&&typeof E.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),b.fpsDroppedMonitoringPeriod)}},g.checkFPS=function(u,m,b){var E=performance.now();if(m){if(this.lastTime){var _=E-this.lastTime,f=b-this.lastDroppedFrames,O=m-this.lastDecodedFrames,w=1e3*f/_,R=this.hls;if(R.trigger(W.Events.FPS_DROP,{currentDropped:f,currentDecoded:O,totalDroppedFrames:b}),w>0&&f>R.config.fpsDroppedMonitoringThreshold*O){var x=R.currentLevel;r.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+x),x>0&&(R.autoLevelCapping===-1||R.autoLevelCapping>=x)&&(x=x-1,R.trigger(W.Events.FPS_DROP_LEVEL_CAPPING,{level:x,droppedLevel:R.currentLevel}),R.autoLevelCapping=x,this.streamController.nextLevelSwitch())}}this.lastTime=E,this.lastDroppedFrames=b,this.lastDecodedFrames=m}},g.checkFPSInterval=function(){var u=this.media;if(u)if(this.isVideoPlaybackQualityAvailable){var m=u.getVideoPlaybackQuality();this.checkFPS(u,m.totalVideoFrames,m.droppedVideoFrames)}else this.checkFPS(u,u.webkitDecodedFrameCount,u.webkitDroppedFrameCount)},M}();const D=H},"./src/controller/fragment-finders.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{findFragWithCC:()=>p,findFragmentByPDT:()=>H,findFragmentByPTS:()=>D,fragmentWithinToleranceTest:()=>M,pdtWithinToleranceTest:()=>g});var W=F("./src/polyfills/number.ts"),r=F("./src/utils/binary-search.ts");function H(u,m,b){if(m===null||!Array.isArray(u)||!u.length||!(0,W.isFiniteNumber)(m))return null;var E=u[0].programDateTime;if(m<(E||0))return null;var _=u[u.length-1].endProgramDateTime;if(m>=(_||0))return null;b=b||0;for(var f=0;f<u.length;++f){var O=u[f];if(g(m,b,O))return O}return null}function D(u,m,b,E){b===void 0&&(b=0),E===void 0&&(E=0);var _=null;if(u?_=m[u.sn-m[0].sn+1]||null:b===0&&m[0].start===0&&(_=m[0]),_&&M(b,E,_)===0)return _;var f=r.default.search(m,M.bind(null,b,E));return f&&(f!==u||!_)?f:_}function M(u,m,b){if(u===void 0&&(u=0),m===void 0&&(m=0),b.start<=u&&b.start+b.duration>u)return 0;var E=Math.min(m,b.duration+(b.deltaPTS?b.deltaPTS:0));return b.start+b.duration-E<=u?1:b.start-E>u&&b.start?-1:0}function g(u,m,b){var E=Math.min(m,b.duration+(b.deltaPTS?b.deltaPTS:0))*1e3,_=b.endProgramDateTime||0;return _-E>u}function p(u,m){return r.default.search(u,function(b){return b.cc<m?1:b.cc>m?-1:0})}},"./src/controller/fragment-tracker.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{FragmentState:()=>H,FragmentTracker:()=>D});var W=F("./src/events.ts"),r=F("./src/types/loader.ts"),H;(function(p){p.NOT_LOADED="NOT_LOADED",p.APPENDING="APPENDING",p.PARTIAL="PARTIAL",p.OK="OK"})(H||(H={}));var D=function(){function p(m){this.activeFragment=null,this.activeParts=null,this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=m,this._registerListeners()}var u=p.prototype;return u._registerListeners=function(){var b=this.hls;b.on(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),b.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),b.on(W.Events.FRAG_LOADED,this.onFragLoaded,this)},u._unregisterListeners=function(){var b=this.hls;b.off(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),b.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),b.off(W.Events.FRAG_LOADED,this.onFragLoaded,this)},u.destroy=function(){this._unregisterListeners(),this.fragments=this.endListFragments=this.timeRanges=this.activeFragment=this.activeParts=null},u.getAppendedFrag=function(b,E){if(E===r.PlaylistLevelType.MAIN){var _=this.activeFragment,f=this.activeParts;if(!_)return null;if(f)for(var O=f.length;O--;){var w=f[O],R=w?w.end:_.appendedPTS;if(w.start<=b&&R!==void 0&&b<=R)return O>9&&(this.activeParts=f.slice(O-9)),w}else if(_.start<=b&&_.appendedPTS!==void 0&&b<=_.appendedPTS)return _}return this.getBufferedFrag(b,E)},u.getBufferedFrag=function(b,E){for(var _=this.fragments,f=Object.keys(_),O=f.length;O--;){var w=_[f[O]];if((w==null?void 0:w.body.type)===E&&w.buffered){var R=w.body;if(R.start<=b&&b<=R.end)return R}}return null},u.detectEvictedFragments=function(b,E,_){var f=this;this.timeRanges&&(this.timeRanges[b]=E),Object.keys(this.fragments).forEach(function(O){var w=f.fragments[O];if(!w)return;if(!w.buffered&&!w.loaded){w.body.type===_&&f.removeFragment(w.body);return}var R=w.range[b];if(!R)return;R.time.some(function(x){var I=!f.isTimeBuffered(x.startPTS,x.endPTS,E);return I&&f.removeFragment(w.body),I})})},u.detectPartialFragments=function(b){var E=this,_=this.timeRanges,f=b.frag,O=b.part;if(!_||f.sn==="initSegment")return;var w=g(f),R=this.fragments[w];if(!R)return;Object.keys(_).forEach(function(x){var I=f.elementaryStreams[x];if(!I)return;var k=_[x],A=O!==null||I.partial===!0;R.range[x]=E.getBufferedTimes(f,O,A,k)}),R.loaded=null,Object.keys(R.range).length?(R.buffered=!0,R.body.endList&&(this.endListFragments[R.body.type]=R)):this.removeFragment(R.body)},u.fragBuffered=function(b){var E=g(b),_=this.fragments[E];_&&(_.loaded=null,_.buffered=!0)},u.getBufferedTimes=function(b,E,_,f){for(var O={time:[],partial:_},w=E?E.start:b.start,R=E?E.end:b.end,x=b.minEndPTS||R,I=b.maxStartPTS||w,k=0;k<f.length;k++){var A=f.start(k)-this.bufferPadding,P=f.end(k)+this.bufferPadding;if(I>=A&&x<=P){O.time.push({startPTS:Math.max(w,f.start(k)),endPTS:Math.min(R,f.end(k))});break}else if(w<P&&R>A)O.partial=!0,O.time.push({startPTS:Math.max(w,f.start(k)),endPTS:Math.min(R,f.end(k))});else if(R<=A)break}return O},u.getPartialFragment=function(b){var E=null,_,f,O,w=0,R=this.bufferPadding,x=this.fragments;return Object.keys(x).forEach(function(I){var k=x[I];if(!k)return;M(k)&&(f=k.body.start-R,O=k.body.end+R,b>=f&&b<=O&&(_=Math.min(b-f,O-b),w<=_&&(E=k.body,w=_)))}),E},u.isEndListAppended=function(b){var E=this.endListFragments[b];return E!==void 0&&(E.buffered||M(E))},u.getState=function(b){var E=g(b),_=this.fragments[E];return _?_.buffered?M(_)?H.PARTIAL:H.OK:H.APPENDING:H.NOT_LOADED},u.isTimeBuffered=function(b,E,_){for(var f,O,w=0;w<_.length;w++){if(f=_.start(w)-this.bufferPadding,O=_.end(w)+this.bufferPadding,b>=f&&E<=O)return!0;if(E<=f)return!1}return!1},u.onFragLoaded=function(b,E){var _=E.frag,f=E.part;if(_.sn==="initSegment"||_.bitrateTest||f)return;var O=g(_);this.fragments[O]={body:_,loaded:E,buffered:!1,range:Object.create(null)}},u.onBufferAppended=function(b,E){var _=this,f=E.frag,O=E.part,w=E.timeRanges;if(f.type===r.PlaylistLevelType.MAIN)if(this.activeFragment!==f&&(this.activeFragment=f,f.appendedPTS=void 0),O){var R=this.activeParts;R||(this.activeParts=R=[]),R.push(O)}else this.activeParts=null;this.timeRanges=w,Object.keys(w).forEach(function(x){var I=w[x];if(_.detectEvictedFragments(x,I),!O&&f.type===r.PlaylistLevelType.MAIN){var k=f.elementaryStreams[x];if(!k)return;for(var A=0;A<I.length;A++){var P=I.end(A);P<=k.endPTS&&P>k.startPTS?f.appendedPTS=Math.max(P,f.appendedPTS||0):f.appendedPTS=k.endPTS}}})},u.onFragBuffered=function(b,E){this.detectPartialFragments(E)},u.hasFragment=function(b){var E=g(b);return!!this.fragments[E]},u.removeFragmentsInRange=function(b,E,_){var f=this;Object.keys(this.fragments).forEach(function(O){var w=f.fragments[O];if(!w)return;if(w.buffered){var R=w.body;R.type===_&&R.start<E&&R.end>b&&f.removeFragment(R)}})},u.removeFragment=function(b){var E=g(b);b.stats.loaded=0,b.clearElementaryStreamInfo(),b.appendedPTS=void 0,delete this.fragments[E],b.endList&&delete this.endListFragments[b.type]},u.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activeFragment=null,this.activeParts=null},p}();function M(p){var u,m;return p.buffered&&(((u=p.range.video)===null||u===void 0?void 0:u.partial)||((m=p.range.audio)===null||m===void 0?void 0:m.partial))}function g(p){return p.type+"_"+p.level+"_"+p.urlId+"_"+p.sn}},"./src/controller/gap-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{MAX_START_GAP_JUMP:()=>g,SKIP_BUFFER_HOLE_STEP_SECONDS:()=>p,SKIP_BUFFER_RANGE_START:()=>u,STALL_MINIMUM_DURATION_MS:()=>M,default:()=>m});var W=F("./src/utils/buffer-helper.ts"),r=F("./src/errors.ts"),H=F("./src/events.ts"),D=F("./src/utils/logger.ts"),M=250,g=2,p=.1,u=.05,m=function(){function b(_,f,O,w){this.config=void 0,this.media=null,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=_,this.media=f,this.fragmentTracker=O,this.hls=w}var E=b.prototype;return E.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},E.poll=function(f,O){var w=this.config,R=this.media,x=this.stalled;if(R===null)return;var I=R.currentTime,k=R.seeking,A=this.seeking&&!k,P=!this.seeking&&k;if(this.seeking=k,I!==f){if(this.moved=!0,x!==null){if(this.stallReported){var S=self.performance.now()-x;D.logger.warn("playback not stuck anymore @"+I+", after "+Math.round(S)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((P||A)&&(this.stalled=null),R.paused&&!k||R.ended||R.playbackRate===0||!W.BufferHelper.getBuffered(R).length)return;var C=W.BufferHelper.bufferInfo(R,I,0),c=C.len>0,o=C.nextStart||0;if(!c&&!o)return;if(k){var v=C.len>g,l=!o||O&&O.start<=I||o-I>g&&!this.fragmentTracker.getPartialFragment(I);if(v||l)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var a,T=Math.max(o,C.start||0)-I,h=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,n=h==null||((a=h.details)===null||a===void 0)?void 0:a.live,N=n?h.details.targetduration*2:g;if(T>0&&T<=N){this._trySkipBufferHole(null);return}}var U=self.performance.now();if(x===null){this.stalled=U;return}var j=U-x;if(!k&&j>=M&&(this._reportStall(C),!this.media))return;var Y=W.BufferHelper.bufferInfo(R,I,w.maxBufferHole);this._tryFixBufferStall(Y,j)},E._tryFixBufferStall=function(f,O){var w=this.config,R=this.fragmentTracker,x=this.media;if(x===null)return;var I=x.currentTime,k=R.getPartialFragment(I);if(k){var A=this._trySkipBufferHole(k);if(A||!this.media)return}f.len>w.maxBufferHole&&O>w.highBufferWatchdogPeriod*1e3&&(D.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},E._reportStall=function(f){var O=this.hls,w=this.media,R=this.stallReported;!R&&w&&(this.stallReported=!0,D.logger.warn("Playback stalling at @"+w.currentTime+" due to low buffer ("+JSON.stringify(f)+")"),O.trigger(H.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:f.len}))},E._trySkipBufferHole=function(f){var O=this.config,w=this.hls,R=this.media;if(R===null)return 0;for(var x=R.currentTime,I=0,k=W.BufferHelper.getBuffered(R),A=0;A<k.length;A++){var P=k.start(A);if(x+O.maxBufferHole>=I&&x<P){var S=Math.max(P+u,R.currentTime+p);return D.logger.warn("skipping hole, adjusting currentTime from "+x+" to "+S),this.moved=!0,this.stalled=null,R.currentTime=S,f&&w.trigger(H.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+x+" to "+S,frag:f}),S}I=k.end(A)}return 0},E._tryNudgeBuffer=function(){var f=this.config,O=this.hls,w=this.media,R=this.nudgeRetry;if(w===null)return;var x=w.currentTime;if(this.nudgeRetry++,R<f.nudgeMaxRetry){var I=x+(R+1)*f.nudgeOffset;D.logger.warn("Nudging 'currentTime' from "+x+" to "+I),w.currentTime=I,O.trigger(H.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else D.logger.error("Playhead still not moving while enough data buffered @"+x+" after "+f.nudgeMaxRetry+" nudges"),O.trigger(H.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},b}()},"./src/controller/id3-track-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>f});var W=F("./src/polyfills/number.ts"),r=F("./src/events.ts"),H=F("./src/utils/texttrack-utils.ts"),D=F("./src/demux/id3.ts"),M=F("./src/loader/date-range.ts"),g=F("./src/types/demuxer.ts"),p=.25;function u(){return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var m=function(){var O=u();try{new O(0,Number.POSITIVE_INFINITY,"")}catch(w){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function b(O,w){return O.getTime()/1e3-w}function E(O){return Uint8Array.from(O.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}var _=function(){function O(R){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=R,this._registerListeners()}var w=O.prototype;return w.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},w._registerListeners=function(){var x=this.hls;x.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.on(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),x.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),x.on(r.Events.LEVEL_UPDATED,this.onLevelUpdated,this)},w._unregisterListeners=function(){var x=this.hls;x.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.off(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),x.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),x.off(r.Events.LEVEL_UPDATED,this.onLevelUpdated,this)},w.onMediaAttached=function(x,I){this.media=I.media},w.onMediaDetaching=function(){if(!this.id3Track)return;(0,H.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={}},w.onManifestLoading=function(){this.dateRangeCuesAppended={}},w.createTrack=function(x){var I=this.getID3Track(x.textTracks);return I.mode="hidden",I},w.getID3Track=function(x){if(!this.media)return;for(var I=0;I<x.length;I++){var k=x[I];if(k.kind==="metadata"&&k.label==="id3")return(0,H.sendAddTrackEvent)(k,this.media),k}return this.media.addTextTrack("metadata","id3")},w.onFragParsingMetadata=function(x,I){if(!this.media)return;var k=this.hls.config,A=k.enableEmsgMetadataCues,P=k.enableID3MetadataCues;if(!A&&!P)return;var S=I.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var C=u(),c=0;c<S.length;c++){var o=S[c].type;if(o===g.MetadataSchema.emsg&&!A||!P)continue;var v=D.getID3Frames(S[c].data);if(v){var l=S[c].pts,a=l+S[c].duration;a>m&&(a=m);var T=a-l;T<=0&&(a=l+p);for(var h=0;h<v.length;h++){var n=v[h];if(!D.isTimeStampFrame(n)){this.updateId3CueEnds(l);var N=new C(l,a,"");N.value=n,o&&(N.type=o),this.id3Track.addCue(N)}}}}},w.updateId3CueEnds=function(x){var I,k=(I=this.id3Track)===null||I===void 0?void 0:I.cues;if(k)for(var A=k.length;A--;){var P=k[A];P.startTime<x&&P.endTime===m&&(P.endTime=x)}},w.onBufferFlushing=function(x,I){var k=I.startOffset,A=I.endOffset,P=I.type,S=this.id3Track,C=this.hls;if(!C)return;var c=C.config,o=c.enableEmsgMetadataCues,v=c.enableID3MetadataCues;if(S&&(o||v)){var l;P==="audio"?l=function(T){return T.type===g.MetadataSchema.audioId3&&v}:P==="video"?l=function(T){return T.type===g.MetadataSchema.emsg&&o}:l=function(T){return T.type===g.MetadataSchema.audioId3&&v||T.type===g.MetadataSchema.emsg&&o},(0,H.removeCuesInRange)(S,k,A,l)}},w.onLevelUpdated=function(x,I){var k=this,A=I.details;if(!this.media||!A.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;var P=this.dateRangeCuesAppended,S=this.id3Track,C=A.dateRanges,c=Object.keys(C);if(S)for(var o=Object.keys(P).filter(function(U){return!c.includes(U)}),v=function(j){var Y=o[j];Object.keys(P[Y].cues).forEach(function(J){S.removeCue(P[Y].cues[J])}),delete P[Y]},l=o.length;l--;)v(l);var a=A.fragments[A.fragments.length-1];if(c.length===0||!(0,W.isFiniteNumber)(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var T=a.programDateTime/1e3-a.start,h=u(),n=function(j){var Y=c[j],J=C[Y],ee=P[Y],ie=(ee==null?void 0:ee.cues)||{},re=(ee==null?void 0:ee.durationKnown)||!1,he=b(J.startDate,T),oe=m,ae=J.endDate;if(ae)oe=b(ae,T),re=!0;else if(J.endOnNext&&!re){var Ee=c.reduce(function(Oe,Ke){var de=C[Ke];return de.class===J.class&&de.id!==Ke&&de.startDate>J.startDate&&Oe.push(de),Oe},[]).sort(function(Oe,Ke){return Oe.startDate.getTime()-Ke.startDate.getTime()})[0];Ee&&(oe=b(Ee.startDate,T),re=!0)}for(var Le=Object.keys(J.attr),Fe=0;Fe<Le.length;Fe++){var Xe=Le[Fe];if(Xe===M.DateRangeAttribute.ID||Xe===M.DateRangeAttribute.CLASS||Xe===M.DateRangeAttribute.START_DATE||Xe===M.DateRangeAttribute.DURATION||Xe===M.DateRangeAttribute.END_DATE||Xe===M.DateRangeAttribute.END_ON_NEXT)continue;var He=ie[Xe];if(He)re&&!ee.durationKnown&&(He.endTime=oe);else{var Ae=J.attr[Xe];He=new h(he,oe,""),(Xe===M.DateRangeAttribute.SCTE35_OUT||Xe===M.DateRangeAttribute.SCTE35_IN)&&(Ae=E(Ae)),He.value={key:Xe,data:Ae},He.type=g.MetadataSchema.dateRange,k.id3Track.addCue(He),ie[Xe]=He}}P[Y]={cues:ie,dateRange:J,durationKnown:re}},N=0;N<c.length;N++)n(N)},O}();const f=_},"./src/controller/latency-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>u});var W=F("./src/errors.ts"),r=F("./src/events.ts"),H=F("./src/utils/logger.ts");function D(m,b){for(var E=0;E<b.length;E++){var _=b[E];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,g(_.key),_)}}function M(m,b,E){return b&&D(m.prototype,b),E&&D(m,E),Object.defineProperty(m,"prototype",{writable:!1}),m}function g(m){var b=p(m,"string");return typeof b=="symbol"?b:String(b)}function p(m,b){if(typeof m!="object"||m===null)return m;var E=m[Symbol.toPrimitive];if(E!==void 0){var _=E.call(m,b||"default");if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(m)}var u=function(){function m(E){var _=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 _.timeupdate()},this.hls=E,this.config=E.config,this.registerListeners()}var b=m.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.registerListeners=function(){this.hls.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(r.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(r.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(r.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(r.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(r.Events.ERROR,this.onError)},b.onMediaAttached=function(_,f){this.media=f.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},b.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},b.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},b.onLevelUpdated=function(_,f){var O=f.details;this.levelDetails=O,O.advanced&&this.timeupdate(),!O.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(_,f){if(f.details!==W.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,H.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var _=this.media,f=this.levelDetails;if(!_||!f)return;this.currentTime=_.currentTime;var O=this.computeLatency();if(O===null)return;this._latency=O;var w=this.config,R=w.lowLatencyMode,x=w.maxLiveSyncPlaybackRate;if(!R||x===1)return;var I=this.targetLatency;if(I===null)return;var k=O-I,A=Math.min(this.maxLatency,I+f.targetduration),P=k<A;if(f.live&&P&&k>.05&&this.forwardBufferLength>1){var S=Math.min(2,Math.max(1,x)),C=Math.round(2/(1+Math.exp(-.75*k-this.edgeStalled))*20)/20;_.playbackRate=Math.min(S,Math.max(1,C))}else _.playbackRate!==1&&_.playbackRate!==0&&(_.playbackRate=1)},b.estimateLiveEdge=function(){var _=this.levelDetails;return _===null?null:_.edge+_.age},b.computeLatency=function(){var _=this.estimateLiveEdge();return _===null?null:_-this.currentTime},M(m,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var _=this.config,f=this.levelDetails;return _.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:f?_.liveMaxLatencyDurationCount*f.targetduration:0}},{key:"targetLatency",get:function(){var _=this.levelDetails;if(_===null)return null;var f=_.holdBack,O=_.partHoldBack,w=_.targetduration,R=this.config,x=R.liveSyncDuration,I=R.liveSyncDurationCount,k=R.lowLatencyMode,A=this.hls.userConfig,P=k&&O||f;(A.liveSyncDuration||A.liveSyncDurationCount||P===0)&&(P=x!==void 0?x:I*w);var S=w,C=1;return P+Math.min(this.stallCount*C,S)}},{key:"liveSyncPosition",get:function(){var _=this.estimateLiveEdge(),f=this.targetLatency,O=this.levelDetails;if(_===null||f===null||O===null)return null;var w=O.edge,R=_-f-this.edgeStalled,x=w-O.totalduration,I=w-(this.config.lowLatencyMode&&O.partTarget||O.targetduration);return Math.min(Math.max(x,R),I)}},{key:"drift",get:function(){var _=this.levelDetails;return _===null?1:_.drift}},{key:"edgeStalled",get:function(){var _=this.levelDetails;if(_===null)return 0;var f=(this.config.lowLatencyMode&&_.partTarget||_.targetduration)*3;return Math.max(_.age-f,0)}},{key:"forwardBufferLength",get:function(){var _=this.media,f=this.levelDetails;if(!_||!f)return 0;var O=_.buffered.length;return(O?_.buffered.end(O-1):f.edge)-this.currentTime}}]),m}()},"./src/controller/level-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>R});var W=F("./src/types/level.ts"),r=F("./src/events.ts"),H=F("./src/errors.ts"),D=F("./src/utils/codecs.ts"),M=F("./src/controller/level-helper.ts"),g=F("./src/controller/base-playlist-controller.ts"),p=F("./src/types/loader.ts");function u(){return u=Object.assign?Object.assign.bind():function(x){for(var I=1;I<arguments.length;I++){var k=arguments[I];for(var A in k)Object.prototype.hasOwnProperty.call(k,A)&&(x[A]=k[A])}return x},u.apply(this,arguments)}function m(x,I){for(var k=0;k<I.length;k++){var A=I[k];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(x,E(A.key),A)}}function b(x,I,k){return I&&m(x.prototype,I),k&&m(x,k),Object.defineProperty(x,"prototype",{writable:!1}),x}function E(x){var I=_(x,"string");return typeof I=="symbol"?I:String(I)}function _(x,I){if(typeof x!="object"||x===null)return x;var k=x[Symbol.toPrimitive];if(k!==void 0){var A=k.call(x,I||"default");if(typeof A!="object")return A;throw new TypeError("@@toPrimitive must return a primitive value.")}return(I==="string"?String:Number)(x)}function f(x,I){x.prototype=Object.create(I.prototype),x.prototype.constructor=x,O(x,I)}function O(x,I){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,P){return A.__proto__=P,A},O(x,I)}var w=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),R=function(x){f(I,x);function I(A){var P;return P=x.call(this,A,"[level-controller]")||this,P._levels=[],P._firstLevel=-1,P._startLevel=void 0,P.currentLevelIndex=-1,P.manualLevelIndex=-1,P.onParsedComplete=void 0,P._registerListeners(),P}var k=I.prototype;return k._registerListeners=function(){var P=this.hls;P.on(r.Events.MANIFEST_LOADED,this.onManifestLoaded,this),P.on(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),P.on(r.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),P.on(r.Events.FRAG_LOADED,this.onFragLoaded,this),P.on(r.Events.ERROR,this.onError,this)},k._unregisterListeners=function(){var P=this.hls;P.off(r.Events.MANIFEST_LOADED,this.onManifestLoaded,this),P.off(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),P.off(r.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),P.off(r.Events.FRAG_LOADED,this.onFragLoaded,this),P.off(r.Events.ERROR,this.onError,this)},k.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,x.prototype.destroy.call(this)},k.startLoad=function(){var P=this._levels;P.forEach(function(S){S.loadError=0}),x.prototype.startLoad.call(this)},k.onManifestLoaded=function(P,S){var C=[],c=[],o=[],v,l={},a,T=!1,h=!1,n=!1;if(S.levels.forEach(function(Y){var J=Y.attrs;T=T||!!(Y.width&&Y.height),h=h||!!Y.videoCodec,n=n||!!Y.audioCodec,w&&Y.audioCodec&&Y.audioCodec.indexOf("mp4a.40.34")!==-1&&(Y.audioCodec=void 0);var ee=Y.bitrate+"-"+Y.attrs.RESOLUTION+"-"+Y.attrs.CODECS;a=l[ee],a?a.url.push(Y.url):(a=new W.Level(Y),l[ee]=a,C.push(a)),J&&(J.AUDIO&&(0,M.addGroupId)(a,"audio",J.AUDIO),J.SUBTITLES&&(0,M.addGroupId)(a,"text",J.SUBTITLES))}),(T||h)&&n&&(C=C.filter(function(Y){var J=Y.videoCodec,ee=Y.width,ie=Y.height;return!!J||!!(ee&&ie)})),C=C.filter(function(Y){var J=Y.audioCodec,ee=Y.videoCodec;return(!J||(0,D.isCodecSupportedInMp4)(J,"audio"))&&(!ee||(0,D.isCodecSupportedInMp4)(ee,"video"))}),S.audioTracks&&(c=S.audioTracks.filter(function(Y){return!Y.audioCodec||(0,D.isCodecSupportedInMp4)(Y.audioCodec,"audio")}),(0,M.assignTrackIdsByGroup)(c)),S.subtitles&&(o=S.subtitles,(0,M.assignTrackIdsByGroup)(o)),C.length>0){v=C[0].bitrate,C.sort(function(Y,J){return Y.attrs["HDCP-LEVEL"]!==J.attrs["HDCP-LEVEL"]?(Y.attrs["HDCP-LEVEL"]||"")>(J.attrs["HDCP-LEVEL"]||"")?1:-1:Y.bitrate!==J.bitrate?Y.bitrate-J.bitrate:Y.attrs.SCORE!==J.attrs.SCORE?Y.attrs.decimalFloatingPoint("SCORE")-J.attrs.decimalFloatingPoint("SCORE"):T&&Y.height!==J.height?Y.height-J.height:0}),this._levels=C;for(var N=0;N<C.length;N++)if(C[N].bitrate===v){this._firstLevel=N,this.log("manifest loaded, "+C.length+" level(s) found, first bitrate: "+v);break}var U=n&&!h,j={levels:C,audioTracks:c,subtitleTracks:o,sessionData:S.sessionData,sessionKeys:S.sessionKeys,firstLevel:this._firstLevel,stats:S.stats,audio:n,video:h,altAudio:!U&&c.some(function(Y){return!!Y.url})};this.hls.trigger(r.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(r.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:S.url,reason:"no level with compatible codecs found in manifest"})},k.onError=function(P,S){var C,c;if(x.prototype.onError.call(this,P,S),S.fatal)return;var o=S.context,v=this._levels[this.currentLevelIndex];if(o&&(o.type===p.PlaylistContextType.AUDIO_TRACK&&v.audioGroupIds&&o.groupId===v.audioGroupIds[v.urlId]||o.type===p.PlaylistContextType.SUBTITLE_TRACK&&v.textGroupIds&&o.groupId===v.textGroupIds[v.urlId])){this.redundantFailover(this.currentLevelIndex);return}var l=!1,a=!0,T;switch(S.details){case H.ErrorDetails.FRAG_LOAD_ERROR:case H.ErrorDetails.FRAG_LOAD_TIMEOUT:case H.ErrorDetails.KEY_LOAD_ERROR:case H.ErrorDetails.KEY_LOAD_TIMEOUT:if(S.frag){var h=S.frag.type===p.PlaylistLevelType.MAIN?S.frag.level:this.currentLevelIndex,n=this._levels[h];n?(n.fragmentError++,n.fragmentError>this.hls.config.fragLoadingMaxRetry&&(T=h)):T=h}break;case H.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{var N=v.attrs["HDCP-LEVEL"];N&&(this.hls.maxHdcpLevel=W.HdcpLevels[W.HdcpLevels.indexOf(N)-1],this.warn('Restricting playback to HDCP-LEVEL of "'+this.hls.maxHdcpLevel+'" or lower'))}case H.ErrorDetails.FRAG_PARSING_ERROR:case H.ErrorDetails.KEY_SYSTEM_NO_SESSION:T=((C=S.frag)===null||C===void 0?void 0:C.type)===p.PlaylistLevelType.MAIN?S.frag.level:this.currentLevelIndex,S.levelRetry=!1;break;case H.ErrorDetails.LEVEL_LOAD_ERROR:case H.ErrorDetails.LEVEL_LOAD_TIMEOUT:o&&(o.deliveryDirectives&&(a=!1),T=o.level),l=!0;break;case H.ErrorDetails.REMUX_ALLOC_ERROR:T=(c=S.level)!=null?c:this.currentLevelIndex,l=!0;break}T!==void 0&&this.recoverLevel(S,T,l,a)},k.recoverLevel=function(P,S,C,c){var o=P.details,v=this._levels[S];if(v.loadError++,C){var l=this.retryLoadingOrFail(P);if(l)P.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(c){var a=v.url.length;if(a>1&&v.loadError<a)P.levelRetry=!0,this.redundantFailover(S);else if(this.manualLevelIndex===-1){for(var T=-1,h=this._levels,n=h.length;n--;){var N=(n+this.currentLevelIndex)%h.length;if(N!==this.currentLevelIndex&&h[N].loadError===0){T=N;break}}T>-1&&this.currentLevelIndex!==T?(this.warn(o+": switch to "+T),P.levelRetry=!0,this.hls.nextAutoLevel=T):P.levelRetry===!1&&(P.fatal=!0)}}},k.redundantFailover=function(P){var S=this._levels[P],C=S.url.length;if(C>1){var c=(S.urlId+1)%C;this.warn("Switching to redundant URL-id "+c),this._levels.forEach(function(o){o.urlId=c}),this.level=P}},k.onFragLoaded=function(P,S){var C=S.frag;if(C!==void 0&&C.type===p.PlaylistLevelType.MAIN){var c=this._levels[C.level];c!==void 0&&(c.fragmentError=0,c.loadError=0)}},k.onLevelLoaded=function(P,S){var C,c=S.level,o=S.details,v=this._levels[c];if(!v){var l;this.warn("Invalid level index "+c),(l=S.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(o.deltaUpdateFailed=!0);return}c===this.currentLevelIndex?(v.fragmentError===0&&(v.loadError=0,this.retryCount=0),this.playlistLoaded(c,S,v.details)):(C=S.deliveryDirectives)!==null&&C!==void 0&&C.skip&&(o.deltaUpdateFailed=!0)},k.onAudioTrackSwitched=function(P,S){var C=this.hls.levels[this.currentLevelIndex];if(!C)return;if(C.audioGroupIds){for(var c=-1,o=this.hls.audioTracks[S.id].groupId,v=0;v<C.audioGroupIds.length;v++)if(C.audioGroupIds[v]===o){c=v;break}c!==C.urlId&&(C.urlId=c,this.startLoad())}},k.loadPlaylist=function(P){x.prototype.loadPlaylist.call(this);var S=this.currentLevelIndex,C=this._levels[S];if(this.canLoad&&C&&C.url.length>0){var c=C.urlId,o=C.url[c];if(P)try{o=P.addDirectives(o)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Attempt loading level index "+S+((P==null?void 0:P.msn)!==void 0?" at sn "+P.msn+" part "+P.part:"")+" with URL-id "+c+" "+o),this.clearTimer(),this.hls.trigger(r.Events.LEVEL_LOADING,{url:o,level:S,id:c,deliveryDirectives:P||null})}},k.removeLevel=function(P,S){var C=function(v,l){return l!==S},c=this._levels.filter(function(o,v){return v!==P?!0:o.url.length>1&&S!==void 0?(o.url=o.url.filter(C),o.audioGroupIds&&(o.audioGroupIds=o.audioGroupIds.filter(C)),o.textGroupIds&&(o.textGroupIds=o.textGroupIds.filter(C)),o.urlId=0,!0):!1}).map(function(o,v){var l=o.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=v}),o});this._levels=c,this.hls.trigger(r.Events.LEVELS_UPDATED,{levels:c})},b(I,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(P){var S,C=this._levels;if(C.length===0)return;if(this.currentLevelIndex===P&&(S=C[P])!==null&&S!==void 0&&S.details)return;if(P<0||P>=C.length){var c=P<0;if(this.hls.trigger(r.Events.ERROR,{type:H.ErrorTypes.OTHER_ERROR,details:H.ErrorDetails.LEVEL_SWITCH_ERROR,level:P,fatal:c,reason:"invalid level idx"}),c)return;P=Math.min(P,C.length-1)}this.clearTimer();var o=this.currentLevelIndex,v=C[o],l=C[P];this.log("switching to level "+P+" from "+o),this.currentLevelIndex=P;var a=u({},l,{level:P,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(r.Events.LEVEL_SWITCHING,a);var T=l.details;if(!T||T.live){var h=this.switchParams(l.uri,v==null?void 0:v.details);this.loadPlaylist(h)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(P){this.manualLevelIndex=P,this._startLevel===void 0&&(this._startLevel=P),P!==-1&&(this.level=P)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(P){this._firstLevel=P}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var P=this.hls.config.startLevel;return P!==void 0?P:this._firstLevel}else return this._startLevel},set:function(P){this._startLevel=P}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(P){this.level=P,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=P)}}]),I}(g.default)},"./src/controller/level-helper.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{addGroupId:()=>M,addSliding:()=>w,adjustSliding:()=>O,assignTrackIdsByGroup:()=>g,computeReloadInterval:()=>R,getFragmentWithSN:()=>x,getPartWith:()=>I,mapFragmentIntersection:()=>f,mapPartIntersection:()=>_,mergeDetails:()=>b,updateFragPTSDTS:()=>m,updatePTS:()=>p});var W=F("./src/polyfills/number.ts"),r=F("./src/utils/logger.ts"),H=F("./src/loader/date-range.ts");function D(){return D=Object.assign?Object.assign.bind():function(k){for(var A=1;A<arguments.length;A++){var P=arguments[A];for(var S in P)Object.prototype.hasOwnProperty.call(P,S)&&(k[S]=P[S])}return k},D.apply(this,arguments)}function M(k,A,P){switch(A){case"audio":k.audioGroupIds||(k.audioGroupIds=[]),k.audioGroupIds.push(P);break;case"text":k.textGroupIds||(k.textGroupIds=[]),k.textGroupIds.push(P);break}}function g(k){var A={};k.forEach(function(P){var S=P.groupId||"";P.id=A[S]=A[S]||0,A[S]++})}function p(k,A,P){var S=k[A],C=k[P];u(S,C)}function u(k,A){var P=A.startPTS;if((0,W.isFiniteNumber)(P)){var S=0,C;A.sn>k.sn?(S=P-k.start,C=k):(S=k.start-P,C=A),C.duration!==S&&(C.duration=S)}else if(A.sn>k.sn){var c=k.cc===A.cc;c&&k.minEndPTS?A.start=k.start+(k.minEndPTS-k.start):A.start=k.start+k.duration}else A.start=Math.max(k.start-A.duration,0)}function m(k,A,P,S,C,c){var o=S-P;o<=0&&(r.logger.warn("Fragment should have a positive duration",A),S=P+A.duration,c=C+A.duration);var v=P,l=S,a=A.startPTS,T=A.endPTS;if((0,W.isFiniteNumber)(a)){var h=Math.abs(a-P);(0,W.isFiniteNumber)(A.deltaPTS)?A.deltaPTS=Math.max(h,A.deltaPTS):A.deltaPTS=h,v=Math.max(P,a),P=Math.min(P,a),C=Math.min(C,A.startDTS),l=Math.min(S,T),S=Math.max(S,T),c=Math.max(c,A.endDTS)}A.duration=S-P;var n=P-A.start;A.start=A.startPTS=P,A.maxStartPTS=v,A.startDTS=C,A.endPTS=S,A.minEndPTS=l,A.endDTS=c;var N=A.sn;if(!k||N<k.startSN||N>k.endSN)return 0;var U,j=N-k.startSN,Y=k.fragments;for(Y[j]=A,U=j;U>0;U--)u(Y[U],Y[U-1]);for(U=j;U<Y.length-1;U++)u(Y[U],Y[U+1]);return k.fragmentHint&&u(Y[Y.length-1],k.fragmentHint),k.PTSKnown=k.alignedSliding=!0,n}function b(k,A){for(var P=null,S=k.fragments,C=S.length-1;C>=0;C--){var c=S[C].initSegment;if(c){P=c;break}}k.fragmentHint&&delete k.fragmentHint.endPTS;var o=0,v;if(f(k,A,function(U,j){U.relurl&&(o=U.cc-j.cc),(0,W.isFiniteNumber)(U.startPTS)&&(0,W.isFiniteNumber)(U.endPTS)&&(j.start=j.startPTS=U.startPTS,j.startDTS=U.startDTS,j.appendedPTS=U.appendedPTS,j.maxStartPTS=U.maxStartPTS,j.endPTS=U.endPTS,j.endDTS=U.endDTS,j.minEndPTS=U.minEndPTS,j.duration=U.endPTS-U.startPTS,j.duration&&(v=j),A.PTSKnown=A.alignedSliding=!0),j.elementaryStreams=U.elementaryStreams,j.loader=U.loader,j.stats=U.stats,j.urlId=U.urlId,U.initSegment&&(j.initSegment=U.initSegment,P=U.initSegment)}),P){var l=A.fragmentHint?A.fragments.concat(A.fragmentHint):A.fragments;l.forEach(function(U){var j;(!U.initSegment||U.initSegment.relurl===((j=P)===null||j===void 0?void 0:j.relurl))&&(U.initSegment=P)})}if(A.skippedSegments)if(A.deltaUpdateFailed=A.fragments.some(function(U){return!U}),A.deltaUpdateFailed){r.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var a=A.skippedSegments;a--;)A.fragments.shift();A.startSN=A.fragments[0].sn,A.startCC=A.fragments[0].cc}else A.canSkipDateRanges&&(A.dateRanges=E(k.dateRanges,A.dateRanges,A.recentlyRemovedDateranges));var T=A.fragments;if(o){r.logger.warn("discontinuity sliding from playlist, take drift into account");for(var h=0;h<T.length;h++)T[h].cc+=o}A.skippedSegments&&(A.startCC=A.fragments[0].cc),_(k.partList,A.partList,function(U,j){j.elementaryStreams=U.elementaryStreams,j.stats=U.stats}),v?m(A,v,v.startPTS,v.endPTS,v.startDTS,v.endDTS):O(k,A),T.length&&(A.totalduration=A.edge-T[0].start),A.driftStartTime=k.driftStartTime,A.driftStart=k.driftStart;var n=A.advancedDateTime;if(A.advanced&&n){var N=A.edge;A.driftStart||(A.driftStartTime=n,A.driftStart=N),A.driftEndTime=n,A.driftEnd=N}else A.driftEndTime=k.driftEndTime,A.driftEnd=k.driftEnd,A.advancedDateTime=k.advancedDateTime}function E(k,A,P){var S=D({},k);return P&&P.forEach(function(C){delete S[C]}),Object.keys(A).forEach(function(C){var c=new H.DateRange(A[C].attr,S[C]);c.isValid?S[C]=c:r.logger.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(A[C].attr)+'"')}),S}function _(k,A,P){if(k&&A)for(var S=0,C=0,c=k.length;C<=c;C++){var o=k[C],v=A[C+S];o&&v&&o.index===v.index&&o.fragment.sn===v.fragment.sn?P(o,v):S--}}function f(k,A,P){for(var S=A.skippedSegments,C=Math.max(k.startSN,A.startSN)-A.startSN,c=(k.fragmentHint?1:0)+(S?A.endSN:Math.min(k.endSN,A.endSN))-A.startSN,o=A.startSN-k.startSN,v=A.fragmentHint?A.fragments.concat(A.fragmentHint):A.fragments,l=k.fragmentHint?k.fragments.concat(k.fragmentHint):k.fragments,a=C;a<=c;a++){var T=l[o+a],h=v[a];S&&!h&&a<S&&(h=A.fragments[a]=T),T&&h&&P(T,h)}}function O(k,A){var P=A.startSN+A.skippedSegments-k.startSN,S=k.fragments;if(P<0||P>=S.length)return;w(A,S[P].start)}function w(k,A){if(A){for(var P=k.fragments,S=k.skippedSegments;S<P.length;S++)P[S].start+=A;k.fragmentHint&&(k.fragmentHint.start+=A)}}function R(k,A){A===void 0&&(A=Infinity);var P=1e3*k.targetduration;if(k.updated){var S=k.fragments,C=4;if(S.length&&P*C>A){var c=S[S.length-1].duration*1e3;c<P&&(P=c)}}else P/=2;return Math.round(P)}function x(k,A,P){if(!k||!k.details)return null;var S=k.details,C=S.fragments[A-S.startSN];return C||(C=S.fragmentHint,C&&C.sn===A?C:A<S.startSN&&P&&P.sn===A?P:null)}function I(k,A,P){if(!k||!k.details)return null;var S=k.details.partList;if(S)for(var C=S.length;C--;){var c=S[C];if(c.index===P&&c.fragment.sn===A)return c}return null}},"./src/controller/stream-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>A});var W=F("./src/polyfills/number.ts"),r=F("./src/controller/base-stream-controller.ts"),H=F("./src/is-supported.ts"),D=F("./src/events.ts"),M=F("./src/utils/buffer-helper.ts"),g=F("./src/controller/fragment-tracker.ts"),p=F("./src/types/loader.ts"),u=F("./src/loader/fragment.ts"),m=F("./src/demux/transmuxer-interface.ts"),b=F("./src/types/transmuxer.ts"),E=F("./src/controller/gap-controller.ts"),_=F("./src/errors.ts");function f(P,S){for(var C=0;C<S.length;C++){var c=S[C];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(P,w(c.key),c)}}function O(P,S,C){return S&&f(P.prototype,S),C&&f(P,C),Object.defineProperty(P,"prototype",{writable:!1}),P}function w(P){var S=R(P,"string");return typeof S=="symbol"?S:String(S)}function R(P,S){if(typeof P!="object"||P===null)return P;var C=P[Symbol.toPrimitive];if(C!==void 0){var c=C.call(P,S||"default");if(typeof c!="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(P)}function x(P,S){P.prototype=Object.create(S.prototype),P.prototype.constructor=P,I(P,S)}function I(P,S){return I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(c,o){return c.__proto__=o,c},I(P,S)}var k=100,A=function(P){x(S,P);function S(c,o,v){var l;return l=P.call(this,c,o,v,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.couldBacktrack=!1,l.backtrackFragment=null,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var C=S.prototype;return C._registerListeners=function(){var o=this.hls;o.on(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(D.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(D.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(D.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),o.on(D.Events.ERROR,this.onError,this),o.on(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.on(D.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),o.on(D.Events.BUFFER_CREATED,this.onBufferCreated,this),o.on(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.on(D.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),o.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var o=this.hls;o.off(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(D.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(D.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),o.off(D.Events.ERROR,this.onError,this),o.off(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.off(D.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),o.off(D.Events.BUFFER_CREATED,this.onBufferCreated,this),o.off(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.off(D.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),o.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},C.startLoad=function(o){if(this.levels){var v=this.lastCurrentTime,l=this.hls;if(this.stopLoad(),this.setInterval(k),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var a=l.startLevel;a===-1&&(l.config.testBandwidth&&this.levels.length>1?(a=0,this.bitrateTest=!0):a=l.nextAutoLevel),this.level=l.nextLoadLevel=a,this.loadedmetadata=!1}v>0&&o===-1&&(this.log("Override startPosition with lastCurrentTime @"+v.toFixed(3)),o=v),this.state=r.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=o,this.tick()}else this._forceStartLoad=!0,this.state=r.State.STOPPED},C.stopLoad=function(){this._forceStartLoad=!1,P.prototype.stopLoad.call(this)},C.doTick=function(){switch(this.state){case r.State.IDLE:this.doTickIdle();break;case r.State.WAITING_LEVEL:{var o,v=this.levels,l=this.level,a=v==null||((o=v[l])===null||o===void 0)?void 0:o.details;if(a&&(!a.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(a))break;this.state=r.State.IDLE;break}break}case r.State.FRAG_LOADING_WAITING_RETRY:{var T,h=self.performance.now(),n=this.retryDate;(!n||h>=n||(T=this.media)!==null&&T!==void 0&&T.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.level),this.state=r.State.IDLE)}break;default:break}this.onTickEnd()},C.onTickEnd=function(){P.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},C.doTickIdle=function(){var o=this.hls,v=this.levelLastLoaded,l=this.levels,a=this.media,T=o.config,h=o.nextLoadLevel;if(v===null||!a&&(this.startFragRequested||!T.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!l||!l[h])return;var n=l[h],N=this.getMainFwdBufferInfo();if(N===null)return;var U=this.getLevelDetails();if(U&&this._streamEnded(N,U)){var j={};this.altAudio&&(j.type="video"),this.hls.trigger(D.Events.BUFFER_EOS,j),this.state=r.State.ENDED;return}this.level=o.nextLoadLevel=h;var Y=n.details;if(!Y||this.state===r.State.WAITING_LEVEL||Y.live&&this.levelLastLoaded!==h){this.level=h,this.state=r.State.WAITING_LEVEL;return}var J=N.len,ee=this.getMaxBufferLength(n.maxBitrate);if(J>=ee)return;this.backtrackFragment&&this.backtrackFragment.start>N.end&&(this.backtrackFragment=null);var ie=this.backtrackFragment?this.backtrackFragment.start:N.end,re=this.getNextFragment(ie,Y);if(this.couldBacktrack&&!this.fragPrevious&&re&&re.sn!=="initSegment"&&this.fragmentTracker.getState(re)!==g.FragmentState.OK){var he,oe=((he=this.backtrackFragment)!=null?he:re).sn,ae=oe-Y.startSN,Ee=Y.fragments[ae-1];Ee&&re.cc===Ee.cc&&(re=Ee,this.fragmentTracker.removeFragment(Ee))}else this.backtrackFragment&&N.len&&(this.backtrackFragment=null);if(re&&this.fragmentTracker.getState(re)===g.FragmentState.OK&&this.nextLoadPosition>ie){var Le=this.audioOnly&&!this.altAudio?u.ElementaryStreamTypes.AUDIO:u.ElementaryStreamTypes.VIDEO,Fe=(Le===u.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;Fe&&this.afterBufferFlushed(Fe,Le,p.PlaylistLevelType.MAIN),re=this.getNextFragment(this.nextLoadPosition,Y)}if(!re)return;re.initSegment&&!re.initSegment.data&&!this.bitrateTest&&(re=re.initSegment),this.loadFragment(re,Y,ie)},C.loadFragment=function(o,v,l){var a,T=this.fragmentTracker.getState(o);this.fragCurrent=o,T===g.FragmentState.NOT_LOADED?o.sn==="initSegment"?this._loadInitSegment(o,v):this.bitrateTest?(this.log("Fragment "+o.sn+" of level "+o.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(o,v)):(this.startFragRequested=!0,P.prototype.loadFragment.call(this,o,v,l)):T===g.FragmentState.APPENDING?this.reduceMaxBufferLength(o.duration)&&this.fragmentTracker.removeFragment(o):((a=this.media)===null||a===void 0?void 0:a.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},C.getAppendedFrag=function(o){var v=this.fragmentTracker.getAppendedFrag(o,p.PlaylistLevelType.MAIN);return v&&"fragment"in v?v.fragment:v},C.getBufferedFrag=function(o){return this.fragmentTracker.getBufferedFrag(o,p.PlaylistLevelType.MAIN)},C.followingBufferedFrag=function(o){return o?this.getBufferedFrag(o.end+.5):null},C.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},C.nextLevelSwitch=function(){var o=this.levels,v=this.media;if(v!=null&&v.readyState){var l,a=this.getAppendedFrag(v.currentTime);if(a&&a.start>1&&this.flushMainBuffer(0,a.start-1),!v.paused&&o){var T=this.hls.nextLoadLevel,h=o[T],n=this.fragLastKbps;n&&this.fragCurrent?l=this.fragCurrent.duration*h.maxBitrate/(1e3*n)+1:l=0}else l=0;var N=this.getBufferedFrag(v.currentTime+l);if(N){var U=this.followingBufferedFrag(N);if(U){this.abortCurrentFrag();var j=U.maxStartPTS?U.maxStartPTS:U.start,Y=U.duration,J=Math.max(N.end,j+Math.min(Math.max(Y-this.config.maxFragLookUpTolerance,Y*.5),Y*.75));this.flushMainBuffer(J,Number.POSITIVE_INFINITY)}}}},C.abortCurrentFrag=function(){var o=this.fragCurrent;this.fragCurrent=null,this.backtrackFragment=null,o&&o.abortRequests();switch(this.state){case r.State.KEY_LOADING:case r.State.FRAG_LOADING:case r.State.FRAG_LOADING_WAITING_RETRY:case r.State.PARSING:case r.State.PARSED:this.state=r.State.IDLE;break}this.nextLoadPosition=this.getLoadPosition()},C.flushMainBuffer=function(o,v){P.prototype.flushMainBuffer.call(this,o,v,this.altAudio?"video":null)},C.onMediaAttached=function(o,v){P.prototype.onMediaAttached.call(this,o,v);var l=v.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),l.addEventListener("playing",this.onvplaying),l.addEventListener("seeked",this.onvseeked),this.gapController=new E.default(this.config,l,this.fragmentTracker,this.hls)},C.onMediaDetaching=function(){var o=this.media;o&&this.onvplaying&&this.onvseeked&&(o.removeEventListener("playing",this.onvplaying),o.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)},C.onMediaPlaying=function(){this.tick()},C.onMediaSeeked=function(){var o=this.media,v=o?o.currentTime:null;(0,W.isFiniteNumber)(v)&&this.log("Media seeked to "+v.toFixed(3)),this.tick()},C.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(D.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null,this.backtrackFragment=null},C.onManifestParsed=function(o,v){var l=!1,a=!1,T;v.levels.forEach(function(h){T=h.audioCodec,T&&(T.indexOf("mp4a.40.2")!==-1&&(l=!0),T.indexOf("mp4a.40.5")!==-1&&(a=!0))}),this.audioCodecSwitch=l&&a&&!(0,H.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=v.levels,this.startFragRequested=!1},C.onLevelLoading=function(o,v){var l=this.levels;if(!l||this.state!==r.State.IDLE)return;var a=l[v.level];(!a.details||a.details.live&&this.levelLastLoaded!==v.level||this.waitForCdnTuneIn(a.details))&&(this.state=r.State.WAITING_LEVEL)},C.onLevelLoaded=function(o,v){var l,a=this.levels,T=v.level,h=v.details,n=h.totalduration;if(!a){this.warn("Levels were reset while loading level "+T);return}this.log("Level "+T+" loaded ["+h.startSN+","+h.endSN+"], cc ["+h.startCC+", "+h.endCC+"] duration:"+n);var N=this.fragCurrent;N&&(this.state===r.State.FRAG_LOADING||this.state===r.State.FRAG_LOADING_WAITING_RETRY)&&(N.level!==v.level&&N.loader&&(this.state=r.State.IDLE,this.backtrackFragment=null,N.abortRequests()));var U=a[T],j=0;if(h.live||(l=U.details)!==null&&l!==void 0&&l.live){if(h.fragments[0]||(h.deltaUpdateFailed=!0),h.deltaUpdateFailed)return;j=this.alignPlaylists(h,U.details)}if(U.details=h,this.levelLastLoaded=T,this.hls.trigger(D.Events.LEVEL_UPDATED,{details:h,level:T}),this.state===r.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(h))return;this.state=r.State.IDLE}this.startFragRequested?h.live&&this.synchronizeToLiveEdge(h):this.setStartPosition(h,j),this.tick()},C._handleFragmentLoadProgress=function(o){var v,l=o.frag,a=o.part,T=o.payload,h=this.levels;if(!h){this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered");return}var n=h[l.level],N=n.details;if(!N){this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset");return}var U=n.videoCodec,j=N.PTSKnown||!N.live,Y=(v=l.initSegment)===null||v===void 0?void 0:v.data,J=this._getAudioCodec(n),ee=this.transmuxer=this.transmuxer||new m.default(this.hls,p.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ie=a?a.index:-1,re=ie!==-1,he=new b.ChunkMetadata(l.level,l.sn,l.stats.chunkCount,T.byteLength,ie,re),oe=this.initPTS[l.cc];ee.push(T,Y,J,U,l,a,N.totalduration,j,he,oe)},C.onAudioTrackSwitching=function(o,v){var l=this.altAudio,a=!!v.url,T=v.id;if(!a){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var h=this.fragCurrent;h&&(this.log("Switching to main audio track, cancel main fragment load"),h.abortRequests()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var n=this.hls;l&&n.trigger(D.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),n.trigger(D.Events.AUDIO_TRACK_SWITCHED,{id:T})}},C.onAudioTrackSwitched=function(o,v){var l=v.id,a=!!this.hls.audioTracks[l].url;if(a){var T=this.videoBuffer;T&&this.mediaBuffer!==T&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=T)}this.altAudio=a,this.tick()},C.onBufferCreated=function(o,v){var l=v.tracks,a,T,h=!1;for(var n in l){var N=l[n];if(N.id==="main"){if(T=n,a=N,n==="video"){var U=l[n];U&&(this.videoBuffer=U.buffer)}}else h=!0}h&&a?(this.log("Alternate track found, use "+T+".buffered to schedule main fragment loading"),this.mediaBuffer=a.buffer):this.mediaBuffer=this.media},C.onFragBuffered=function(o,v){var l=v.frag,a=v.part;if(l&&l.type!==p.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(l)){this.warn("Fragment "+l.sn+(a?" p: "+a.index:"")+" of level "+l.level+" finished buffering, but was aborted. state: "+this.state),this.state===r.State.PARSED&&(this.state=r.State.IDLE);return}var T=a?a.stats:l.stats;this.fragLastKbps=Math.round(8*T.total/(T.buffering.end-T.loading.first)),l.sn!=="initSegment"&&(this.fragPrevious=l),this.fragBufferedComplete(l,a)},C.onError=function(o,v){if(v.type===_.ErrorTypes.KEY_SYSTEM_ERROR){this.onFragmentOrKeyLoadError(p.PlaylistLevelType.MAIN,v);return}switch(v.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:case _.ErrorDetails.FRAG_PARSING_ERROR:case _.ErrorDetails.KEY_LOAD_ERROR:case _.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(p.PlaylistLevelType.MAIN,v);break;case _.ErrorDetails.LEVEL_LOAD_ERROR:case _.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==r.State.ERROR&&(v.fatal?(this.warn(""+v.details),this.state=r.State.ERROR):!v.levelRetry&&this.state===r.State.WAITING_LEVEL&&(this.state=r.State.IDLE));break;case _.ErrorDetails.BUFFER_FULL_ERROR:if(v.parent==="main"&&(this.state===r.State.PARSING||this.state===r.State.PARSED)){var l=!0,a=this.getFwdBufferInfo(this.media,p.PlaylistLevelType.MAIN);a&&a.len>.5&&(l=!this.reduceMaxBufferLength(a.len)),l&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},C.checkBuffer=function(){var o=this.media,v=this.gapController;if(!o||!v||!o.readyState)return;if(this.loadedmetadata||!M.BufferHelper.getBuffered(o).length){var l=this.state!==r.State.IDLE?this.fragCurrent:null;v.poll(this.lastCurrentTime,l)}this.lastCurrentTime=o.currentTime},C.onFragLoadEmergencyAborted=function(){this.state=r.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},C.onBufferFlushed=function(o,v){var l=v.type;if(l!==u.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var a=(l===u.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(a,l,p.PlaylistLevelType.MAIN)}},C.onLevelsUpdated=function(o,v){this.levels=v.levels},C.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},C.seekToStartPos=function(){var o=this.media;if(!o)return;var v=o.currentTime,l=this.startPosition;if(l>=0&&v<l){if(o.seeking){this.log("could not seek to "+l+", already seeking at "+v);return}var a=M.BufferHelper.getBuffered(o),T=a.length?a.start(0):0,h=T-l;h>0&&(h<this.config.maxBufferHole||h<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+h+" to match buffer start"),l+=h,this.startPosition=l),this.log("seek to target start position "+l+" from current time "+v),o.currentTime=l}},C._getAudioCodec=function(o){var v=this.config.defaultAudioCodec||o.audioCodec;return this.audioCodecSwap&&v&&(this.log("Swapping audio codec"),v.indexOf("mp4a.40.5")!==-1?v="mp4a.40.2":v="mp4a.40.5"),v},C._loadBitrateTestFrag=function(o,v){var l=this;o.bitrateTest=!0,this._doFragLoad(o,v).then(function(a){var T=l.hls;if(!a||l.fragContextChanged(o))return;l.fragLoadError=0,l.state=r.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var h=o.stats;h.parsing.start=h.parsing.end=h.buffering.start=h.buffering.end=self.performance.now(),T.trigger(D.Events.FRAG_LOADED,a),o.bitrateTest=!1})},C._handleTransmuxComplete=function(o){var v,l="main",a=this.hls,T=o.remuxResult,h=o.chunkMeta,n=this.getCurrentContext(h);if(!n){this.warn("The loading context changed while buffering fragment "+h.sn+" of level "+h.level+". This chunk will not be buffered."),this.resetStartWhenNotLoaded(h.level);return}var N=n.frag,U=n.part,j=n.level,Y=T.video,J=T.text,ee=T.id3,ie=T.initSegment,re=j.details,he=this.altAudio?void 0:T.audio;if(this.fragContextChanged(N))return;if(this.state=r.State.PARSING,ie){ie.tracks&&(this._bufferInitSegment(j,ie.tracks,N,h),a.trigger(D.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:l,tracks:ie.tracks}));var oe=ie.initPTS,ae=ie.timescale;(0,W.isFiniteNumber)(oe)&&(this.initPTS[N.cc]=oe,a.trigger(D.Events.INIT_PTS_FOUND,{frag:N,id:l,initPTS:oe,timescale:ae}))}if(Y&&T.independent!==!1){if(re){var Ee=Y.startPTS,Le=Y.endPTS,Fe=Y.startDTS,Xe=Y.endDTS;if(U)U.elementaryStreams[Y.type]={startPTS:Ee,endPTS:Le,startDTS:Fe,endDTS:Xe};else if(Y.firstKeyFrame&&Y.independent&&h.id===1&&(this.couldBacktrack=!0),Y.dropped&&Y.independent){var He=this.getMainFwdBufferInfo(),Ae=(He?He.end:this.getLoadPosition())+this.config.maxBufferHole,Oe=Y.firstKeyFramePTS?Y.firstKeyFramePTS:Ee;if(Ae<Oe-this.config.maxBufferHole){this.backtrack(N);return}N.setElementaryStreamInfo(Y.type,N.start,Le,N.start,Xe,!0)}N.setElementaryStreamInfo(Y.type,Ee,Le,Fe,Xe),this.backtrackFragment&&(this.backtrackFragment=N),this.bufferFragmentData(Y,N,U,h)}}else if(T.independent===!1){this.backtrack(N);return}if(he){var Ke=he.startPTS,de=he.endPTS,xe=he.startDTS,Ie=he.endDTS;U&&(U.elementaryStreams[u.ElementaryStreamTypes.AUDIO]={startPTS:Ke,endPTS:de,startDTS:xe,endDTS:Ie}),N.setElementaryStreamInfo(u.ElementaryStreamTypes.AUDIO,Ke,de,xe,Ie),this.bufferFragmentData(he,N,U,h)}if(re&&ee!==null&&ee!==void 0&&(v=ee.samples)!==null&&v!==void 0&&v.length){var De={id:l,frag:N,details:re,samples:ee.samples};a.trigger(D.Events.FRAG_PARSING_METADATA,De)}if(re&&J){var Be={id:l,frag:N,details:re,samples:J.samples};a.trigger(D.Events.FRAG_PARSING_USERDATA,Be)}},C._bufferInitSegment=function(o,v,l,a){var T=this;if(this.state!==r.State.PARSING)return;this.audioOnly=!!v.audio&&!v.video,this.altAudio&&!this.audioOnly&&delete v.audio;var h=v.audio,n=v.video,N=v.audiovideo;if(h){var U=o.audioCodec,j=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(U&&(U.indexOf("mp4a.40.5")!==-1?U="mp4a.40.2":U="mp4a.40.5"),h.metadata.channelCount!==1&&j.indexOf("firefox")===-1&&(U="mp4a.40.5")),j.indexOf("android")!==-1&&h.container!=="audio/mpeg"&&(U="mp4a.40.2",this.log("Android: force audio codec to "+U)),o.audioCodec&&o.audioCodec!==U&&this.log('Swapping manifest audio codec "'+o.audioCodec+'" for "'+U+'"'),h.levelCodec=U,h.id="main",this.log("Init audio buffer, container:"+h.container+", codecs[selected/level/parsed]=["+(U||"")+"/"+(o.audioCodec||"")+"/"+h.codec+"]")}n&&(n.levelCodec=o.videoCodec,n.id="main",this.log("Init video buffer, container:"+n.container+", codecs[level/parsed]=["+(o.videoCodec||"")+"/"+n.codec+"]")),N&&this.log("Init audiovideo buffer, container:"+N.container+", codecs[level/parsed]=["+(o.attrs.CODECS||"")+"/"+N.codec+"]"),this.hls.trigger(D.Events.BUFFER_CODECS,v),Object.keys(v).forEach(function(Y){var J=v[Y],ee=J.initSegment;ee!=null&&ee.byteLength&&T.hls.trigger(D.Events.BUFFER_APPENDING,{type:Y,data:ee,frag:l,part:null,chunkMeta:a,parent:l.type})}),this.tick()},C.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,p.PlaylistLevelType.MAIN)},C.backtrack=function(o){this.couldBacktrack=!0,this.backtrackFragment=o,this.resetTransmuxer(),this.flushBufferGap(o),this.fragmentTracker.removeFragment(o),this.fragPrevious=null,this.nextLoadPosition=o.start,this.state=r.State.IDLE},C.checkFragmentChanged=function(){var o=this.media,v=null;if(o&&o.readyState>1&&o.seeking===!1){var l=o.currentTime;if(M.BufferHelper.isBuffered(o,l)?v=this.getAppendedFrag(l):M.BufferHelper.isBuffered(o,l+.1)&&(v=this.getAppendedFrag(l+.1)),v){this.backtrackFragment=null;var a=this.fragPlaying,T=v.level;(!a||v.sn!==a.sn||a.level!==T||v.urlId!==a.urlId)&&(this.fragPlaying=v,this.hls.trigger(D.Events.FRAG_CHANGED,{frag:v}),(!a||a.level!==T)&&this.hls.trigger(D.Events.LEVEL_SWITCHED,{level:T}))}}},O(S,[{key:"nextLevel",get:function(){var o=this.nextBufferedFrag;return o?o.level:-1}},{key:"currentFrag",get:function(){var o=this.media;return o?this.fragPlaying||this.getAppendedFrag(o.currentTime):null}},{key:"currentProgramDateTime",get:function(){var o=this.media;if(o){var v=o.currentTime,l=this.currentFrag;if(l&&(0,W.isFiniteNumber)(v)&&(0,W.isFiniteNumber)(l.programDateTime)){var a=l.programDateTime+(v-l.start)*1e3;return new Date(a)}}return null}},{key:"currentLevel",get:function(){var o=this.currentFrag;return o?o.level:-1}},{key:"nextBufferedFrag",get:function(){var o=this.currentFrag;return o?this.followingBufferedFrag(o):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),S}(r.default)},"./src/controller/subtitle-stream-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{SubtitleStreamController:()=>x});var W=F("./src/events.ts"),r=F("./src/utils/buffer-helper.ts"),H=F("./src/controller/fragment-finders.ts"),D=F("./src/utils/discontinuities.ts"),M=F("./src/controller/level-helper.ts"),g=F("./src/controller/fragment-tracker.ts"),p=F("./src/controller/base-stream-controller.ts"),u=F("./src/types/loader.ts"),m=F("./src/types/level.ts");function b(k,A){for(var P=0;P<A.length;P++){var S=A[P];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(k,_(S.key),S)}}function E(k,A,P){return A&&b(k.prototype,A),P&&b(k,P),Object.defineProperty(k,"prototype",{writable:!1}),k}function _(k){var A=f(k,"string");return typeof A=="symbol"?A:String(A)}function f(k,A){if(typeof k!="object"||k===null)return k;var P=k[Symbol.toPrimitive];if(P!==void 0){var S=P.call(k,A||"default");if(typeof S!="object")return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return(A==="string"?String:Number)(k)}function O(k,A){k.prototype=Object.create(A.prototype),k.prototype.constructor=k,w(k,A)}function w(k,A){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(S,C){return S.__proto__=C,S},w(k,A)}var R=500,x=function(k){O(A,k);function A(S,C,c){var o;return o=k.call(this,S,C,c,"[subtitle-stream-controller]")||this,o.levels=[],o.currentTrackId=-1,o.tracksBuffered=[],o.mainDetails=null,o._registerListeners(),o}var P=A.prototype;return P.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},P._registerListeners=function(){var C=this.hls;C.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.on(W.Events.ERROR,this.onError,this),C.on(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.on(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.on(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),C.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},P._unregisterListeners=function(){var C=this.hls;C.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.off(W.Events.ERROR,this.onError,this),C.off(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.off(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.off(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),C.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},P.startLoad=function(C){this.stopLoad(),this.state=p.State.IDLE,this.setInterval(R),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=C,this.tick()},P.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},P.onLevelLoaded=function(C,c){this.mainDetails=c.details},P.onSubtitleFragProcessed=function(C,c){var o=c.frag,v=c.success;if(this.fragPrevious=o,this.state=p.State.IDLE,!v)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,T=o.start,h=0;h<l.length;h++)if(T>=l[h].start&&T<=l[h].end){a=l[h];break}var n=o.start+o.duration;a?a.end=n:(a={start:T,end:n},l.push(a)),this.fragmentTracker.fragBuffered(o)},P.onBufferFlushing=function(C,c){var o=c.startOffset,v=c.endOffset;if(o===0&&v!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var T=a[l].details,h=T.targetduration,n=v-h;if(n<=0)return;c.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(function(N){for(var U=0;U<N.length;){if(N[U].end<=n){N.shift();continue}else if(N[U].start<n)N[U].start=n;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(o,n,u.PlaylistLevelType.SUBTITLE)}},P.onFragBuffered=function(C,c){if(!this.loadedmetadata&&c.frag.type===u.PlaylistLevelType.MAIN){var o;(o=this.media)!==null&&o!==void 0&&o.buffered.length&&(this.loadedmetadata=!0)}},P.onError=function(C,c){var o=c.frag;if(!o||o.type!==u.PlaylistLevelType.SUBTITLE)return;this.fragCurrent&&this.fragCurrent.abortRequests(),this.state=p.State.IDLE},P.onSubtitleTracksUpdated=function(C,c){var o=this,v=c.subtitleTracks;this.tracksBuffered=[],this.levels=v.map(function(l){return new m.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){o.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},P.onSubtitleTrackSwitch=function(C,c){if(this.currentTrackId=c.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var o=this.levels[this.currentTrackId];o!=null&&o.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,o&&this.setInterval(R)},P.onSubtitleTrackLoaded=function(C,c){var o,v=c.details,l=c.id,a=this.currentTrackId,T=this.levels;if(!T.length)return;var h=T[a];if(l>=T.length||l!==a||!h)return;this.mediaBuffer=this.mediaBufferTimeRanges;var n=0;if(v.live||(o=h.details)!==null&&o!==void 0&&o.live){var N=this.mainDetails;if(v.deltaUpdateFailed||!N)return;var U=N.fragments[0];h.details?(n=this.alignPlaylists(v,h.details),n===0&&U&&(n=U.start,(0,M.addSliding)(v,n))):v.hasProgramDateTime&&N.hasProgramDateTime?((0,D.alignMediaPlaylistByPDT)(v,N),n=v.fragments[0].start):U&&(n=U.start,(0,M.addSliding)(v,n))}if(h.details=v,this.levelLastLoaded=l,!this.startFragRequested&&(this.mainDetails||!v.live)&&this.setStartPosition(h.details,n),this.tick(),v.live&&!this.fragCurrent&&this.media&&this.state===p.State.IDLE){var j=(0,H.findFragmentByPTS)(null,v.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),h.details=void 0)}},P._handleFragmentLoadComplete=function(C){var c=this,o=C.frag,v=C.payload,l=o.decryptdata,a=this.hls;if(this.fragContextChanged(o))return;if(v&&v.byteLength>0&&l&&l.key&&l.iv&&l.method==="AES-128"){var T=performance.now();this.decrypter.decrypt(new Uint8Array(v),l.key.buffer,l.iv.buffer).then(function(h){var n=performance.now();a.trigger(W.Events.FRAG_DECRYPTED,{frag:o,payload:h,stats:{tstart:T,tdecrypt:n}})}).catch(function(h){c.warn(h.name+": "+h.message),c.state=p.State.IDLE})}},P.doTick=function(){if(!this.media){this.state=p.State.IDLE;return}if(this.state===p.State.IDLE){var C=this.currentTrackId,c=this.levels;if(!c.length||!c[C]||!c[C].details)return;var o=c[C].details,v=o.targetduration,l=this.config,a=this.getLoadPosition(),T=r.BufferHelper.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],a-v,l.maxBufferHole),h=T.end,n=T.len,N=this.getFwdBufferInfo(this.media,u.PlaylistLevelType.MAIN),U=this.getMaxBufferLength(N==null?void 0:N.len)+v;if(n>U)return;console.assert(o,"Subtitle track details are defined on idle subtitle stream controller tick");var j=o.fragments,Y=j.length,J=o.edge,ee=null,ie=this.fragPrevious;if(h<J){var re=l.maxFragLookUpTolerance;ee=(0,H.findFragmentByPTS)(ie,j,Math.max(j[0].start,h),re),!ee&&ie&&ie.start<j[0].start&&(ee=j[0])}else ee=j[Y-1];if(!ee)return;ee=this.mapToInitFragWhenRequired(ee),this.fragmentTracker.getState(ee)===g.FragmentState.NOT_LOADED&&this.loadFragment(ee,o,h)}},P.getMaxBufferLength=function(C){var c=k.prototype.getMaxBufferLength.call(this);return C?Math.max(c,C):c},P.loadFragment=function(C,c,o){this.fragCurrent=C,C.sn==="initSegment"?this._loadInitSegment(C,c):(this.startFragRequested=!0,k.prototype.loadFragment.call(this,C,c,o))},E(A,[{key:"mediaBufferTimeRanges",get:function(){return new I(this.tracksBuffered[this.currentTrackId]||[])}}]),A}(p.default),I=function(A){this.buffered=void 0;var P=function(C,c,o){if(c=c>>>0,c>o-1)throw new DOMException("Failed to execute '"+C+"' on 'TimeRanges': The index provided ("+c+") is greater than the maximum bound ("+o+")");return A[c][C]};this.buffered={get length(){return A.length},end:function(C){return P("end",C,A.length)},start:function(C){return P("start",C,A.length)}}}},"./src/controller/subtitle-track-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>f});var W=F("./src/events.ts"),r=F("./src/utils/texttrack-utils.ts"),H=F("./src/controller/base-playlist-controller.ts"),D=F("./src/types/loader.ts");function M(O,w){for(var R=0;R<w.length;R++){var x=w[R];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(O,p(x.key),x)}}function g(O,w,R){return w&&M(O.prototype,w),R&&M(O,R),Object.defineProperty(O,"prototype",{writable:!1}),O}function p(O){var w=u(O,"string");return typeof w=="symbol"?w:String(w)}function u(O,w){if(typeof O!="object"||O===null)return O;var R=O[Symbol.toPrimitive];if(R!==void 0){var x=R.call(O,w||"default");if(typeof x!="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return(w==="string"?String:Number)(O)}function m(O,w){O.prototype=Object.create(w.prototype),O.prototype.constructor=O,b(O,w)}function b(O,w){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,I){return x.__proto__=I,x},b(O,w)}var E=function(O){m(w,O);function w(x){var I;return I=O.call(this,x,"[subtitle-track-controller]")||this,I.media=null,I.tracks=[],I.groupId=null,I.tracksInGroup=[],I.trackId=-1,I.selectDefaultTrack=!0,I.queuedDefaultTrack=-1,I.trackChangeListener=function(){return I.onTextTracksChanged()},I.asyncPollTrackChange=function(){return I.pollTrackChange(0)},I.useTextTrackPolling=!1,I.subtitlePollingInterval=-1,I._subtitleDisplay=!0,I.registerListeners(),I}var R=w.prototype;return R.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,O.prototype.destroy.call(this)},R.registerListeners=function(){var I=this.hls;I.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),I.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),I.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),I.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),I.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),I.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),I.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),I.on(W.Events.ERROR,this.onError,this)},R.unregisterListeners=function(){var I=this.hls;I.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),I.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),I.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),I.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),I.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),I.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),I.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),I.off(W.Events.ERROR,this.onError,this)},R.onMediaAttached=function(I,k){if(this.media=k.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)},R.pollTrackChange=function(I){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,I)},R.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 I=_(this.media.textTracks);I.forEach(function(k){(0,r.clearCurrentCues)(k)}),this.subtitleTrack=-1,this.media=null},R.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},R.onManifestParsed=function(I,k){this.tracks=k.subtitleTracks},R.onSubtitleTrackLoaded=function(I,k){var A=k.id,P=k.details,S=this.trackId,C=this.tracksInGroup[S];if(!C){this.warn("Invalid subtitle track id "+A);return}var c=C.details;C.details=k.details,this.log("subtitle track "+A+" loaded ["+P.startSN+"-"+P.endSN+"]"),A===this.trackId&&(this.retryCount=0,this.playlistLoaded(A,k,c))},R.onLevelLoading=function(I,k){this.switchLevel(k.level)},R.onLevelSwitching=function(I,k){this.switchLevel(k.level)},R.switchLevel=function(I){var k=this.hls.levels[I];if(!(k!=null&&k.textGroupIds))return;var A=k.textGroupIds[k.urlId];if(this.groupId!==A){var P=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,S=this.tracks.filter(function(o){return!A||o.groupId===A});this.tracksInGroup=S;var C=this.findTrackId(P==null?void 0:P.name)||this.findTrackId();this.groupId=A;var c={subtitleTracks:S};this.log("Updating subtitle tracks, "+S.length+' track(s) found in "'+A+'" group-id'),this.hls.trigger(W.Events.SUBTITLE_TRACKS_UPDATED,c),C!==-1&&this.setSubtitleTrack(C,P)}},R.findTrackId=function(I){for(var k=this.tracksInGroup,A=0;A<k.length;A++){var P=k[A];if((!this.selectDefaultTrack||P.default)&&(!I||I===P.name))return P.id}return-1},R.onError=function(I,k){if(O.prototype.onError.call(this,I,k),k.fatal||!k.context)return;k.context.type===D.PlaylistContextType.SUBTITLE_TRACK&&k.context.id===this.trackId&&k.context.groupId===this.groupId&&this.retryLoadingOrFail(k)},R.loadPlaylist=function(I){O.prototype.loadPlaylist.call(this);var k=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(k)){var A=k.id,P=k.groupId,S=k.url;if(I)try{S=I.addDirectives(S)}catch(C){this.warn("Could not construct new URL with HLS Delivery Directives: "+C)}this.log("Loading subtitle playlist for id "+A),this.hls.trigger(W.Events.SUBTITLE_TRACK_LOADING,{url:S,id:A,groupId:P,deliveryDirectives:I||null})}},R.toggleTrackModes=function(I){var k=this,A=this.media,P=this.trackId;if(!A)return;var S=_(A.textTracks),C=S.filter(function(v){return v.groupId===k.groupId});if(I===-1)[].slice.call(S).forEach(function(v){v.mode="disabled"});else{var c=C[P];c&&(c.mode="disabled")}var o=C[I];o&&(o.mode=this.subtitleDisplay?"showing":"hidden")},R.setSubtitleTrack=function(I,k){var A,P=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=I;return}if(this.trackId!==I&&this.toggleTrackModes(I),this.trackId===I&&(I===-1||(A=P[I])!==null&&A!==void 0&&A.details)||I<-1||I>=P.length)return;this.clearTimer();var S=P[I];if(this.log("Switching to subtitle track "+I),this.trackId=I,S){var C=S.id,c=S.groupId,o=c===void 0?"":c,v=S.name,l=S.type,a=S.url;this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:C,groupId:o,name:v,type:l,url:a});var T=this.switchParams(S.url,k==null?void 0:k.details);this.loadPlaylist(T)}else this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:I})},R.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var I=-1,k=_(this.media.textTracks),A=0;A<k.length;A++)if(k[A].mode==="hidden")I=A;else if(k[A].mode==="showing"){I=A;break}this.subtitleTrack!==I&&(this.subtitleTrack=I)},g(w,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(I){this._subtitleDisplay=I,this.trackId>-1&&this.toggleTrackModes(this.trackId)}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(I){this.selectDefaultTrack=!1;var k=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(I,k)}}]),w}(H.default);function _(O){for(var w=[],R=0;R<O.length;R++){var x=O[R];(x.kind==="subtitles"||x.kind==="captions")&&x.label&&w.push(O[R])}return w}const f=E},"./src/controller/timeline-controller.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{TimelineController:()=>E});var W=F("./src/polyfills/number.ts"),r=F("./src/events.ts"),H=F("./src/utils/cea-608-parser.ts"),D=F("./src/utils/output-filter.ts"),M=F("./src/utils/webvtt-parser.ts"),g=F("./src/utils/texttrack-utils.ts"),p=F("./src/utils/imsc1-ttml-parser.ts"),u=F("./src/utils/mp4-tools.ts"),m=F("./src/types/loader.ts"),b=F("./src/utils/logger.ts"),E=function(){function w(x){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=O(),this.captionsProperties=void 0,this.hls=x,this.config=x.config,this.Cues=x.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 I=new D.default(this,"textTrack1"),k=new D.default(this,"textTrack2"),A=new D.default(this,"textTrack3"),P=new D.default(this,"textTrack4");this.cea608Parser1=new H.default(1,I,k),this.cea608Parser2=new H.default(3,A,P)}x.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.on(r.Events.MANIFEST_LOADED,this.onManifestLoaded,this),x.on(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),x.on(r.Events.FRAG_LOADING,this.onFragLoading,this),x.on(r.Events.FRAG_LOADED,this.onFragLoaded,this),x.on(r.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),x.on(r.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),x.on(r.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),x.on(r.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),x.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var R=w.prototype;return R.destroy=function(){var I=this.hls;I.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),I.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),I.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),I.off(r.Events.MANIFEST_LOADED,this.onManifestLoaded,this),I.off(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),I.off(r.Events.FRAG_LOADING,this.onFragLoading,this),I.off(r.Events.FRAG_LOADED,this.onFragLoaded,this),I.off(r.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),I.off(r.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),I.off(r.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),I.off(r.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),I.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},R.addCues=function(I,k,A,P,S){for(var C=!1,c=S.length;c--;){var o=S[c],v=f(o[0],o[1],k,A);if(v>=0&&(o[0]=Math.min(o[0],k),o[1]=Math.max(o[1],A),C=!0,v/(A-k)>.5))return}if(C||S.push([k,A]),this.config.renderTextTracksNatively){var l=this.captionsTracks[I];this.Cues.newCue(l,k,A,P)}else{var a=this.Cues.newCue(null,k,A,P);this.hls.trigger(r.Events.CUES_PARSED,{type:"captions",cues:a,track:I})}},R.onInitPtsFound=function(I,k){var A=this,P=k.frag,S=k.id,C=k.initPTS,c=k.timescale,o=this.unparsedVttFrags;S==="main"&&(this.initPTS[P.cc]=C,this.timescale[P.cc]=c),o.length&&(this.unparsedVttFrags=[],o.forEach(function(v){A.onFragLoaded(r.Events.FRAG_LOADED,v)}))},R.getExistingTrack=function(I){var k=this.media;if(k)for(var A=0;A<k.textTracks.length;A++){var P=k.textTracks[A];if(P[I])return P}return null},R.createCaptionsTrack=function(I){this.config.renderTextTracksNatively?this.createNativeTrack(I):this.createNonNativeTrack(I)},R.createNativeTrack=function(I){if(this.captionsTracks[I])return;var k=this.captionsProperties,A=this.captionsTracks,P=this.media,S=k[I],C=S.label,c=S.languageCode,o=this.getExistingTrack(I);if(o)A[I]=o,(0,g.clearCurrentCues)(A[I]),(0,g.sendAddTrackEvent)(A[I],P);else{var v=this.createTextTrack("captions",C,c);v&&(v[I]=!0,A[I]=v)}},R.createNonNativeTrack=function(I){if(this.nonNativeCaptionsTracks[I])return;var k=this.captionsProperties[I];if(!k)return;var A=k.label,P={_id:I,label:A,kind:"captions",default:k.media?!!k.media.default:!1,closedCaptions:k.media};this.nonNativeCaptionsTracks[I]=P,this.hls.trigger(r.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[P]})},R.createTextTrack=function(I,k,A){var P=this.media;return P?P.addTextTrack(I,k,A):void 0},R.onMediaAttaching=function(I,k){this.media=k.media,this._cleanTracks()},R.onMediaDetaching=function(){var I=this.captionsTracks;Object.keys(I).forEach(function(k){(0,g.clearCurrentCues)(I[k]),delete I[k]}),this.nonNativeCaptionsTracks={}},R.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=O(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},R._cleanTracks=function(){var I=this.media;if(!I)return;var k=I.textTracks;if(k)for(var A=0;A<k.length;A++)(0,g.clearCurrentCues)(k[A])},R.onSubtitleTracksUpdated=function(I,k){var A=this;this.textTracks=[];var P=k.subtitleTracks||[],S=P.some(function(v){return v.textCodec===p.IMSC1_CODEC});if(this.config.enableWebVTT||S&&this.config.enableIMSC1){var C=this.tracks&&P&&this.tracks.length===P.length;if(this.tracks=P||[],this.config.renderTextTracksNatively){var c=this.media?this.media.textTracks:[];this.tracks.forEach(function(v,l){var a;if(l<c.length){for(var T=null,h=0;h<c.length;h++)if(_(c[h],v)){T=c[h];break}T&&(a=T)}if(a)(0,g.clearCurrentCues)(a);else{var n=A._captionsOrSubtitlesFromCharacteristics(v);a=A.createTextTrack(n,v.name,v.lang),a&&(a.mode="disabled")}a&&(a.groupId=v.groupId,A.textTracks.push(a))})}else if(!C&&this.tracks&&this.tracks.length){var o=this.tracks.map(function(v){return{label:v.name,kind:v.type.toLowerCase(),default:v.default,subtitleTrack:v}});this.hls.trigger(r.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}},R._captionsOrSubtitlesFromCharacteristics=function(I){var k;if((k=I.attrs)!==null&&k!==void 0&&k.CHARACTERISTICS){var A=/transcribes-spoken-dialog/gi.test(I.attrs.CHARACTERISTICS),P=/describes-music-and-sound/gi.test(I.attrs.CHARACTERISTICS);if(A&&P)return"captions"}return"subtitles"},R.onManifestLoaded=function(I,k){var A=this;this.config.enableCEA708Captions&&k.captions&&k.captions.forEach(function(P){var S=/(?:CC|SERVICE)([1-4])/.exec(P.instreamId);if(!S)return;var C="textTrack"+S[1],c=A.captionsProperties[C];if(!c)return;c.label=P.name,P.lang&&(c.languageCode=P.lang),c.media=P})},R.closedCaptionsForLevel=function(I){var k=this.hls.levels[I.level];return k==null?void 0:k.attrs["CLOSED-CAPTIONS"]},R.onFragLoading=function(I,k){var A=this.cea608Parser1,P=this.cea608Parser2,S=this.lastSn,C=this.lastPartIndex;if(!this.enabled||!(A&&P))return;if(k.frag.type===m.PlaylistLevelType.MAIN){var c,o,v=k.frag.sn,l=(c=k==null||((o=k.part)===null||o===void 0)?void 0:o.index)!=null?c:-1;v===S+1||v===S&&l===C+1||(A.reset(),P.reset()),this.lastSn=v,this.lastPartIndex=l}},R.onFragLoaded=function(I,k){var A=k.frag,P=k.payload,S=this.initPTS,C=this.unparsedVttFrags;if(A.type===m.PlaylistLevelType.SUBTITLE)if(P.byteLength){if(!(0,W.isFiniteNumber)(S[A.cc])){C.push(k),S.length&&this.hls.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:A,error:new Error("Missing initial subtitle PTS")});return}var c=A.decryptdata,o="stats"in k;if(c==null||!c.encrypted||o){var v=this.tracks[A.level],l=this.vttCCs;l[A.cc]||(l[A.cc]={start:A.start,prevCC:this.prevCC,new:!0},this.prevCC=A.cc),v&&v.textCodec===p.IMSC1_CODEC?this._parseIMSC1(A,P):this._parseVTTs(A,P,l)}}else this.hls.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:A,error:new Error("Empty subtitle payload")})},R._parseIMSC1=function(I,k){var A=this,P=this.hls;(0,p.parseIMSC1)(k,this.initPTS[I.cc],this.timescale[I.cc],function(S){A._appendCues(S,I.level),P.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:I})},function(S){b.logger.log("Failed to parse IMSC1: "+S),P.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:I,error:S})})},R._parseVTTs=function(I,k,A){var P,S=this,C=this.hls,c=(P=I.initSegment)!==null&&P!==void 0&&P.data?(0,u.appendUint8Array)(I.initSegment.data,new Uint8Array(k)):k;(0,M.parseWebVTT)(c,this.initPTS[I.cc],this.timescale[I.cc],A,I.cc,I.start,function(o){S._appendCues(o,I.level),C.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:I})},function(o){S._fallbackToIMSC1(I,k),b.logger.log("Failed to parse VTT cue: "+o),C.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:I,error:o})})},R._fallbackToIMSC1=function(I,k){var A=this,P=this.tracks[I.level];P.textCodec||(0,p.parseIMSC1)(k,this.initPTS[I.cc],this.timescale[I.cc],function(){P.textCodec=p.IMSC1_CODEC,A._parseIMSC1(I,k)},function(){P.textCodec="wvtt"})},R._appendCues=function(I,k){var A=this.hls;if(this.config.renderTextTracksNatively){var P=this.textTracks[k];if(!P||P.mode==="disabled")return;I.forEach(function(c){return(0,g.addCueToTrack)(P,c)})}else{var S=this.tracks[k];if(!S)return;var C=S.default?"default":"subtitles"+k;A.trigger(r.Events.CUES_PARSED,{type:"subtitles",cues:I,track:C})}},R.onFragDecrypted=function(I,k){var A=k.frag;if(A.type===m.PlaylistLevelType.SUBTITLE){if(!(0,W.isFiniteNumber)(this.initPTS[A.cc])){this.unparsedVttFrags.push(k);return}this.onFragLoaded(r.Events.FRAG_LOADED,k)}},R.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},R.onFragParsingUserdata=function(I,k){var A=this.cea608Parser1,P=this.cea608Parser2;if(!this.enabled||!(A&&P))return;var S=k.frag,C=k.samples;if(S.type===m.PlaylistLevelType.MAIN&&this.closedCaptionsForLevel(S)==="NONE")return;for(var c=0;c<C.length;c++){var o=C[c].bytes;if(o){var v=this.extractCea608Data(o);A.addData(C[c].pts,v[0]),P.addData(C[c].pts,v[1])}}},R.onBufferFlushing=function(I,k){var A=k.startOffset,P=k.endOffset,S=k.endOffsetSubtitles,C=k.type,c=this.media;if(!c||c.currentTime<P)return;if(!C||C==="video"){var o=this.captionsTracks;Object.keys(o).forEach(function(l){return(0,g.removeCuesInRange)(o[l],A,P)})}if(this.config.renderTextTracksNatively&&(A===0&&S!==void 0)){var v=this.textTracks;Object.keys(v).forEach(function(l){return(0,g.removeCuesInRange)(v[l],A,S)})}},R.extractCea608Data=function(I){for(var k=[[],[]],A=I[0]&31,P=2,S=0;S<A;S++){var C=I[P++],c=127&I[P++],o=127&I[P++];if(c===0&&o===0)continue;var v=(4&C)!==0;if(v){var l=3&C;(l===0||l===1)&&(k[l].push(c),k[l].push(o))}}return k},w}();function _(w,R){return w&&w.label===R.name&&!(w.textTrack1||w.textTrack2)}function f(w,R,x,I){return Math.min(R,I)-Math.max(w,x)}function O(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}},"./src/crypt/aes-crypto.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>W});var W=function(){function r(D,M){this.subtle=void 0,this.aesIV=void 0,this.subtle=D,this.aesIV=M}var H=r.prototype;return H.decrypt=function(M,g){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},g,M)},r}()},"./src/crypt/aes-decryptor.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>H,removePadding:()=>r});var W=F("./src/utils/typed-array.ts");function r(D){var M=D.byteLength,g=M&&new DataView(D.buffer).getUint8(M-1);return g?(0,W.sliceUint8)(D,0,M-g):D}var H=function(){function D(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var M=D.prototype;return M.uint8ArrayToUint32Array_=function(p){for(var u=new DataView(p),m=new Uint32Array(4),b=0;b<4;b++)m[b]=u.getUint32(b*4);return m},M.initTable=function(){var p=this.sBox,u=this.invSBox,m=this.subMix,b=m[0],E=m[1],_=m[2],f=m[3],O=this.invSubMix,w=O[0],R=O[1],x=O[2],I=O[3],k=new Uint32Array(256),A=0,P=0,S=0;for(S=0;S<256;S++)S<128?k[S]=S<<1:k[S]=S<<1^283;for(S=0;S<256;S++){var C=P^P<<1^P<<2^P<<3^P<<4;C=C>>>8^C&255^99,p[A]=C,u[C]=A;var c=k[A],o=k[c],v=k[o],l=k[C]*257^C*16843008;b[A]=l<<24|l>>>8,E[A]=l<<16|l>>>16,_[A]=l<<8|l>>>24,f[A]=l,l=v*16843009^o*65537^c*257^A*16843008,w[C]=l<<24|l>>>8,R[C]=l<<16|l>>>16,x[C]=l<<8|l>>>24,I[C]=l,A?(A=c^k[k[k[v^c]]],P^=k[k[P]]):A=P=1}},M.expandKey=function(p){for(var u=this.uint8ArrayToUint32Array_(p),m=!0,b=0;b<u.length&&m;)m=u[b]===this.key[b],b++;if(m)return;this.key=u;var E=this.keySize=u.length;if(E!==4&&E!==6&&E!==8)throw new Error("Invalid aes key size="+E);var _=this.ksRows=(E+6+1)*4,f,O,w=this.keySchedule=new Uint32Array(_),R=this.invKeySchedule=new Uint32Array(_),x=this.sBox,I=this.rcon,k=this.invSubMix,A=k[0],P=k[1],S=k[2],C=k[3],c,o;for(f=0;f<_;f++){if(f<E){c=w[f]=u[f];continue}o=c,f%E===0?(o=o<<8|o>>>24,o=x[o>>>24]<<24|x[o>>>16&255]<<16|x[o>>>8&255]<<8|x[o&255],o^=I[f/E|0]<<24):E>6&&f%E===4&&(o=x[o>>>24]<<24|x[o>>>16&255]<<16|x[o>>>8&255]<<8|x[o&255]),w[f]=c=(w[f-E]^o)>>>0}for(O=0;O<_;O++)f=_-O,O&3?o=w[f]:o=w[f-4],O<4||f<=4?R[O]=o:R[O]=A[x[o>>>24]]^P[x[o>>>16&255]]^S[x[o>>>8&255]]^C[x[o&255]],R[O]=R[O]>>>0},M.networkToHostOrderSwap=function(p){return p<<24|(p&65280)<<8|(p&16711680)>>8|p>>>24},M.decrypt=function(p,u,m){for(var b=this.keySize+6,E=this.invKeySchedule,_=this.invSBox,f=this.invSubMix,O=f[0],w=f[1],R=f[2],x=f[3],I=this.uint8ArrayToUint32Array_(m),k=I[0],A=I[1],P=I[2],S=I[3],C=new Int32Array(p),c=new Int32Array(C.length),o,v,l,a,T,h,n,N,U,j,Y,J,ee,ie,re=this.networkToHostOrderSwap;u<C.length;){for(U=re(C[u]),j=re(C[u+1]),Y=re(C[u+2]),J=re(C[u+3]),T=U^E[0],h=J^E[1],n=Y^E[2],N=j^E[3],ee=4,ie=1;ie<b;ie++)o=O[T>>>24]^w[h>>16&255]^R[n>>8&255]^x[N&255]^E[ee],v=O[h>>>24]^w[n>>16&255]^R[N>>8&255]^x[T&255]^E[ee+1],l=O[n>>>24]^w[N>>16&255]^R[T>>8&255]^x[h&255]^E[ee+2],a=O[N>>>24]^w[T>>16&255]^R[h>>8&255]^x[n&255]^E[ee+3],T=o,h=v,n=l,N=a,ee=ee+4;o=_[T>>>24]<<24^_[h>>16&255]<<16^_[n>>8&255]<<8^_[N&255]^E[ee],v=_[h>>>24]<<24^_[n>>16&255]<<16^_[N>>8&255]<<8^_[T&255]^E[ee+1],l=_[n>>>24]<<24^_[N>>16&255]<<16^_[T>>8&255]<<8^_[h&255]^E[ee+2],a=_[N>>>24]<<24^_[T>>16&255]<<16^_[h>>8&255]<<8^_[n&255]^E[ee+3],c[u]=re(o^k),c[u+1]=re(a^A),c[u+2]=re(l^P),c[u+3]=re(v^S),k=U,A=j,P=Y,S=J,u=u+4}return c.buffer},D}()},"./src/crypt/decrypter.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>u});var W=F("./src/crypt/aes-crypto.ts"),r=F("./src/crypt/fast-aes-key.ts"),H=F("./src/crypt/aes-decryptor.ts"),D=F("./src/utils/logger.ts"),M=F("./src/utils/mp4-tools.ts"),g=F("./src/utils/typed-array.ts"),p=16,u=function(){function m(E,_){var f=_===void 0?{}:_,O=f.removePKCS7Padding,w=O===void 0?!0:O;if(this.logEnabled=!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.useSoftware=void 0,this.useSoftware=E.enableSoftwareAES,this.removePKCS7Padding=w,w)try{var R=self.crypto;R&&(this.subtle=R.subtle||R.webkitSubtle)}catch(x){}this.subtle===null&&(this.useSoftware=!0)}var b=m.prototype;return b.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},b.isSync=function(){return this.useSoftware},b.flush=function(){var _=this.currentResult,f=this.remainderData;if(!_||f)return this.reset(),null;var O=new Uint8Array(_);return this.reset(),this.removePKCS7Padding?(0,H.removePadding)(O):O},b.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},b.decrypt=function(_,f,O){var w=this;return this.useSoftware?new Promise(function(R,x){w.softwareDecrypt(new Uint8Array(_),f,O);var I=w.flush();I?R(I.buffer):x(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(_),f,O)},b.softwareDecrypt=function(_,f,O){var w=this.currentIV,R=this.currentResult,x=this.remainderData;this.logOnce("JS AES decrypt"),x&&(_=(0,M.appendUint8Array)(x,_),this.remainderData=null);var I=this.getValidChunk(_);if(!I.length)return null;w&&(O=w);var k=this.softwareDecrypter;k||(k=this.softwareDecrypter=new H.default),k.expandKey(f);var A=R;return this.currentResult=k.decrypt(I.buffer,0,O),this.currentIV=(0,g.sliceUint8)(I,-16).buffer,A||null},b.webCryptoDecrypt=function(_,f,O){var w=this,R=this.subtle;return(this.key!==f||!this.fastAesKey)&&(this.key=f,this.fastAesKey=new r.default(R,f)),this.fastAesKey.expandKey().then(function(x){if(!R)return Promise.reject(new Error("web crypto not initialized"));w.logOnce("WebCrypto AES decrypt");var I=new W.default(R,new Uint8Array(O));return I.decrypt(_.buffer,x)}).catch(function(x){return D.logger.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+x.name+": "+x.message),w.onWebCryptoError(_,f,O)})},b.onWebCryptoError=function(_,f,O){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(_,f,O);var w=this.flush();if(w)return w.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")},b.getValidChunk=function(_){var f=_,O=_.length-_.length%p;return O!==_.length&&(f=(0,g.sliceUint8)(_,0,O),this.remainderData=(0,g.sliceUint8)(_,O)),f},b.logOnce=function(_){if(!this.logEnabled)return;D.logger.log("[decrypter]: "+_),this.logEnabled=!1},m}()},"./src/crypt/fast-aes-key.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>W});var W=function(){function r(D,M){this.subtle=void 0,this.key=void 0,this.subtle=D,this.key=M}var H=r.prototype;return H.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},r}()},"./src/demux/aacdemuxer.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>u});var W=F("./src/demux/base-audio-demuxer.ts"),r=F("./src/demux/adts.ts"),H=F("./src/utils/logger.ts"),D=F("./src/demux/id3.ts");function M(m,b){m.prototype=Object.create(b.prototype),m.prototype.constructor=m,g(m,b)}function g(m,b){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(_,f){return _.__proto__=f,_},g(m,b)}var p=function(m){M(b,m);function b(_,f){var O;return O=m.call(this)||this,O.observer=void 0,O.config=void 0,O.observer=_,O.config=f,O}var E=b.prototype;return E.resetInitSegment=function(f,O,w,R){m.prototype.resetInitSegment.call(this,f,O,w,R),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:O,duration:R,inputTimeScale:9e4,dropped:0}},b.probe=function(f){if(!f)return!1;for(var O=D.getID3Data(f,0)||[],w=O.length,R=f.length;w<R;w++)if(r.probe(f,w))return H.logger.log("ADTS sync word found !"),!0;return!1},E.canParse=function(f,O){return r.canParse(f,O)},E.appendFrame=function(f,O,w){r.initTrackConfig(f,this.observer,O,w,f.manifestCodec);var R=r.appendFrame(f,O,w,this.basePTS,this.frameIndex);if(R&&R.missing===0)return R},b}(W.default);const u=p},"./src/demux/adts.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{appendFrame:()=>w,canGetFrameLength:()=>u,canParse:()=>b,getAudioConfig:()=>D,getFrameDuration:()=>f,getFullFrameLength:()=>p,getHeaderLength:()=>g,initTrackConfig:()=>_,isHeader:()=>m,isHeaderPattern:()=>M,parseFrameHeader:()=>O,probe:()=>E});var W=F("./src/utils/logger.ts"),r=F("./src/errors.ts"),H=F("./src/events.ts");function D(R,x,I,k){var A,P,S,C,c=navigator.userAgent.toLowerCase(),o=k,v=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];A=((x[I+2]&192)>>>6)+1;var l=(x[I+2]&60)>>>2;if(l>v.length-1){R.trigger(H.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+l});return}return S=(x[I+2]&1)<<2,S|=(x[I+3]&192)>>>6,W.logger.log("manifest codec:"+k+", ADTS type:"+A+", samplingIndex:"+l),/firefox/i.test(c)?l>=6?(A=5,C=new Array(4),P=l-3):(A=2,C=new Array(2),P=l):c.indexOf("android")!==-1?(A=2,C=new Array(2),P=l):(A=5,C=new Array(4),k&&(k.indexOf("mp4a.40.29")!==-1||k.indexOf("mp4a.40.5")!==-1)||!k&&l>=6?P=l-3:((k&&k.indexOf("mp4a.40.2")!==-1&&(l>=6&&S===1||/vivaldi/i.test(c))||!k&&S===1)&&(A=2,C=new Array(2)),P=l)),C[0]=A<<3,C[0]|=(l&14)>>1,C[1]|=(l&1)<<7,C[1]|=S<<3,A===5&&(C[1]|=(P&14)>>1,C[2]=(P&1)<<7,C[2]|=2<<2,C[3]=0),{config:C,samplerate:v[l],channelCount:S,codec:"mp4a.40."+A,manifestCodec:o}}function M(R,x){return R[x]===255&&(R[x+1]&246)===240}function g(R,x){return R[x+1]&1?7:9}function p(R,x){return(R[x+3]&3)<<11|R[x+4]<<3|(R[x+5]&224)>>>5}function u(R,x){return x+5<R.length}function m(R,x){return x+1<R.length&&M(R,x)}function b(R,x){return u(R,x)&&M(R,x)&&p(R,x)<=R.length-x}function E(R,x){if(m(R,x)){var I=g(R,x);if(x+I>=R.length)return!1;var k=p(R,x);if(k<=I)return!1;var A=x+k;return A===R.length||m(R,A)}return!1}function _(R,x,I,k,A){if(!R.samplerate){var P=D(x,I,k,A);if(!P)return;R.config=P.config,R.samplerate=P.samplerate,R.channelCount=P.channelCount,R.codec=P.codec,R.manifestCodec=P.manifestCodec,W.logger.log("parsed codec:"+R.codec+", rate:"+P.samplerate+", channels:"+P.channelCount)}}function f(R){return 1024*9e4/R}function O(R,x){var I=g(R,x);if(x+I<=R.length){var k=p(R,x)-I;if(k>0)return{headerLength:I,frameLength:k}}}function w(R,x,I,k,A){var P=f(R.samplerate),S=k+A*P,C=O(x,I),c;if(C){var o=C.frameLength,v=C.headerLength,l=v+o,a=Math.max(0,I+l-x.length);a?(c=new Uint8Array(l-v),c.set(x.subarray(I+v,x.length),0)):c=x.subarray(I+v,I+l);var T={unit:c,pts:S};return a||R.samples.push(T),{sample:T,length:l,missing:a}}var h=x.length-I;c=new Uint8Array(h),c.set(x.subarray(I,x.length),0);var n={unit:c,pts:S};return{sample:n,length:h,missing:-1}}},"./src/demux/base-audio-demuxer.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>m,initPTSFn:()=>u});var W=F("./src/polyfills/number.ts"),r=F("./src/demux/id3.ts"),H=F("./src/types/demuxer.ts"),D=F("./src/demux/dummy-demuxed-track.ts"),M=F("./src/utils/mp4-tools.ts"),g=F("./src/utils/typed-array.ts"),p=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var E=b.prototype;return E.resetInitSegment=function(f,O,w,R){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},E.resetTimeStamp=function(f){this.initPTS=f,this.resetContiguity()},E.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},E.canParse=function(f,O){return!1},E.appendFrame=function(f,O,w){},E.demux=function(f,O){this.cachedData&&(f=(0,M.appendUint8Array)(this.cachedData,f),this.cachedData=null);var w=r.getID3Data(f,0),R=w?w.length:0,x,I=this._audioTrack,k=this._id3Track,A=w?r.getTimeStamp(w):void 0,P=f.length;for((this.basePTS===null||this.frameIndex===0&&(0,W.isFiniteNumber)(A))&&(this.basePTS=u(A,O,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),w&&w.length>0&&k.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:w,type:H.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});R<P;){if(this.canParse(f,R)){var S=this.appendFrame(I,f,R);S?(this.frameIndex++,this.lastPTS=S.sample.pts,R+=S.length,x=R):R=P}else r.canParse(f,R)?(w=r.getID3Data(f,R),k.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:w,type:H.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY}),R+=w.length,x=R):R++;if(R===P&&x!==P){var C=(0,g.sliceUint8)(f,x);this.cachedData?this.cachedData=(0,M.appendUint8Array)(this.cachedData,C):this.cachedData=C}}return{audioTrack:I,videoTrack:(0,D.dummyTrack)(),id3Track:k,textTrack:(0,D.dummyTrack)()}},E.demuxSampleAes=function(f,O,w){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},E.flush=function(f){var O=this.cachedData;return O&&(this.cachedData=null,this.demux(O,0)),{audioTrack:this._audioTrack,videoTrack:(0,D.dummyTrack)(),id3Track:this._id3Track,textTrack:(0,D.dummyTrack)()}},E.destroy=function(){},b}(),u=function(E,_,f){return(0,W.isFiniteNumber)(E)?E*90:_*9e4+(f||0)};const m=p},"./src/demux/chunk-cache.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>W});var W=function(){function H(){this.chunks=[],this.dataLength=0}var D=H.prototype;return D.push=function(g){this.chunks.push(g),this.dataLength+=g.length},D.flush=function(){var g=this.chunks,p=this.dataLength,u;if(g.length)g.length===1?u=g[0]:u=r(g,p);else return new Uint8Array(0);return this.reset(),u},D.reset=function(){this.chunks.length=0,this.dataLength=0},H}();function r(H,D){for(var M=new Uint8Array(D),g=0,p=0;p<H.length;p++){var u=H[p];M.set(u,g),g+=u.length}return M}},"./src/demux/dummy-demuxed-track.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{dummyTrack:()=>W});function W(r,H){return r===void 0&&(r=""),H===void 0&&(H=9e4),{type:r,id:-1,pid:-1,inputTimeScale:H,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>H});var W=F("./src/utils/logger.ts"),r=function(){function D(g){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=g,this.bytesAvailable=g.byteLength,this.word=0,this.bitsAvailable=0}var M=D.prototype;return M.loadWord=function(){var p=this.data,u=this.bytesAvailable,m=p.byteLength-u,b=new Uint8Array(4),E=Math.min(4,u);if(E===0)throw new Error("no bytes available");b.set(p.subarray(m,m+E)),this.word=new DataView(b.buffer).getUint32(0),this.bitsAvailable=E*8,this.bytesAvailable-=E},M.skipBits=function(p){var u;p=Math.min(p,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>p?(this.word<<=p,this.bitsAvailable-=p):(p-=this.bitsAvailable,u=p>>3,p-=u<<3,this.bytesAvailable-=u,this.loadWord(),this.word<<=p,this.bitsAvailable-=p)},M.readBits=function(p){var u=Math.min(this.bitsAvailable,p),m=this.word>>>32-u;if(p>32&&W.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=u,this.bitsAvailable>0)this.word<<=u;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return u=p-u,u>0&&this.bitsAvailable?m<<u|this.readBits(u):m},M.skipLZ=function(){var p;for(p=0;p<this.bitsAvailable;++p)if((this.word&2147483648>>>p)!==0)return this.word<<=p,this.bitsAvailable-=p,p;return this.loadWord(),p+this.skipLZ()},M.skipUEG=function(){this.skipBits(1+this.skipLZ())},M.skipEG=function(){this.skipBits(1+this.skipLZ())},M.readUEG=function(){var p=this.skipLZ();return this.readBits(p+1)-1},M.readEG=function(){var p=this.readUEG();return 1&p?1+p>>>1:-1*(p>>>1)},M.readBoolean=function(){return this.readBits(1)===1},M.readUByte=function(){return this.readBits(8)},M.readUShort=function(){return this.readBits(16)},M.readUInt=function(){return this.readBits(32)},M.skipScalingList=function(p){for(var u=8,m=8,b,E=0;E<p;E++)m!==0&&(b=this.readEG(),m=(u+b+256)%256),u=m===0?u:m},M.readSPS=function(){var p=0,u=0,m=0,b=0,E,_,f,O=this.readUByte.bind(this),w=this.readBits.bind(this),R=this.readUEG.bind(this),x=this.readBoolean.bind(this),I=this.skipBits.bind(this),k=this.skipEG.bind(this),A=this.skipUEG.bind(this),P=this.skipScalingList.bind(this);O();var S=O();if(w(5),I(3),O(),A(),S===100||S===110||S===122||S===244||S===44||S===83||S===86||S===118||S===128){var C=R();if(C===3&&I(1),A(),A(),I(1),x())for(_=C!==3?8:12,f=0;f<_;f++)x()&&(f<6?P(16):P(64))}A();var c=R();if(c===0)R();else if(c===1)for(I(1),k(),k(),E=R(),f=0;f<E;f++)k();A(),I(1);var o=R(),v=R(),l=w(1);l===0&&I(1),I(1),x()&&(p=R(),u=R(),m=R(),b=R());var a=[1,1];if(x()&&x()){var T=O();switch(T){case 1:a=[1,1];break;case 2:a=[12,11];break;case 3:a=[10,11];break;case 4:a=[16,11];break;case 5:a=[40,33];break;case 6:a=[24,11];break;case 7:a=[20,11];break;case 8:a=[32,11];break;case 9:a=[80,33];break;case 10:a=[18,11];break;case 11:a=[15,11];break;case 12:a=[64,33];break;case 13:a=[160,99];break;case 14:a=[4,3];break;case 15:a=[3,2];break;case 16:a=[2,1];break;case 255:{a=[O()<<8|O(),O()<<8|O()];break}}}return{width:Math.ceil((o+1)*16-p*2-u*2),height:(2-l)*(v+1)*16-(l?2:4)*(m+b),pixelRatio:a}},M.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},D}();const H=r},"./src/demux/id3.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{canParse:()=>M,decodeFrame:()=>b,getID3Data:()=>H,getID3Frames:()=>m,getTimeStamp:()=>g,isFooter:()=>r,isHeader:()=>W,isTimeStampFrame:()=>p,testables:()=>R,utf8ArrayToStr:()=>w});var W=function(A,P){return P+10<=A.length&&(A[P]===73&&A[P+1]===68&&A[P+2]===51&&(A[P+3]<255&&A[P+4]<255&&(A[P+6]<128&&A[P+7]<128&&A[P+8]<128&&A[P+9]<128)))},r=function(A,P){return P+10<=A.length&&(A[P]===51&&A[P+1]===68&&A[P+2]===73&&(A[P+3]<255&&A[P+4]<255&&(A[P+6]<128&&A[P+7]<128&&A[P+8]<128&&A[P+9]<128)))},H=function(A,P){for(var S=P,C=0;W(A,P);){C+=10;var c=D(A,P+6);C+=c,r(A,P+10)&&(C+=10),P+=C}return C>0?A.subarray(S,S+C):void 0},D=function(A,P){var S=0;return S=(A[P]&127)<<21,S|=(A[P+1]&127)<<14,S|=(A[P+2]&127)<<7,S|=A[P+3]&127,S},M=function(A,P){return W(A,P)&&D(A,P+6)+10<=A.length-P},g=function(A){for(var P=m(A),S=0;S<P.length;S++){var C=P[S];if(p(C))return O(C)}return},p=function(A){return A&&A.key==="PRIV"&&A.info==="com.apple.streaming.transportStreamTimestamp"},u=function(A){var P=String.fromCharCode(A[0],A[1],A[2],A[3]),S=D(A,4),C=10;return{type:P,size:S,data:A.subarray(C,C+S)}},m=function(A){for(var P=0,S=[];W(A,P);){var C=D(A,P+6);P+=10;for(var c=P+C;P+8<c;){var o=u(A.subarray(P)),v=b(o);v&&S.push(v),P+=o.size+10}r(A,P)&&(P+=10)}return S},b=function(A){return A.type==="PRIV"?E(A):A.type[0]==="W"?f(A):_(A)},E=function(A){if(A.size<2)return;var P=w(A.data,!0),S=new Uint8Array(A.data.subarray(P.length+1));return{key:A.type,info:P,data:S.buffer}},_=function(A){if(A.size<2)return;if(A.type==="TXXX"){var P=1,S=w(A.data.subarray(P),!0);P+=S.length+1;var C=w(A.data.subarray(P));return{key:A.type,info:S,data:C}}var c=w(A.data.subarray(1));return{key:A.type,data:c}},f=function(A){if(A.type==="WXXX"){if(A.size<2)return;var P=1,S=w(A.data.subarray(P),!0);P+=S.length+1;var C=w(A.data.subarray(P));return{key:A.type,info:S,data:C}}var c=w(A.data);return{key:A.type,data:c}},O=function(A){if(A.data.byteLength===8){var P=new Uint8Array(A.data),S=P[3]&1,C=(P[4]<<23)+(P[5]<<15)+(P[6]<<7)+P[7];return C/=45,S&&(C+=4772185884e-2),Math.round(C)}return},w=function(A,P){P===void 0&&(P=!1);var S=I();if(S){var C=S.decode(A);if(P){var c=C.indexOf("\0");return c!==-1?C.substring(0,c):C}return C.replace(/\0/g,"")}for(var o=A.length,v,l,a,T="",h=0;h<o;){if(v=A[h++],v===0&&P)return T;if(v===0||v===3)continue;switch(v>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:T+=String.fromCharCode(v);break;case 12:case 13:l=A[h++],T+=String.fromCharCode((v&31)<<6|l&63);break;case 14:l=A[h++],a=A[h++],T+=String.fromCharCode((v&15)<<12|(l&63)<<6|(a&63)<<0);break;default:}}return T},R={decodeTextFrame:_},x;function I(){return!x&&typeof self.TextDecoder!="undefined"&&(x=new self.TextDecoder("utf-8")),x}},"./src/demux/mp3demuxer.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>u});var W=F("./src/demux/base-audio-demuxer.ts"),r=F("./src/demux/id3.ts"),H=F("./src/utils/logger.ts"),D=F("./src/demux/mpegaudio.ts");function M(m,b){m.prototype=Object.create(b.prototype),m.prototype.constructor=m,g(m,b)}function g(m,b){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(_,f){return _.__proto__=f,_},g(m,b)}var p=function(m){M(b,m);function b(){return m.apply(this,arguments)||this}var E=b.prototype;return E.resetInitSegment=function(f,O,w,R){m.prototype.resetInitSegment.call(this,f,O,w,R),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:O,duration:R,inputTimeScale:9e4,dropped:0}},b.probe=function(f){if(!f)return!1;for(var O=r.getID3Data(f,0)||[],w=O.length,R=f.length;w<R;w++)if(D.probe(f,w))return H.logger.log("MPEG Audio sync word found !"),!0;return!1},E.canParse=function(f,O){return D.canParse(f,O)},E.appendFrame=function(f,O,w){return this.basePTS===null?void 0:D.appendFrame(f,O,w,this.basePTS,this.frameIndex)},b}(W.default);const u=p},"./src/demux/mp4demuxer.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>p});var W=F("./src/polyfills/number.ts"),r=F("./src/types/demuxer.ts"),H=F("./src/utils/mp4-tools.ts"),D=F("./src/demux/dummy-demuxed-track.ts"),M=/\/emsg[-/]ID3/i,g=function(){function u(b,E){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=E}var m=u.prototype;return m.resetTimeStamp=function(){},m.resetInitSegment=function(E,_,f,O){var w=this.videoTrack=(0,D.dummyTrack)("video",1),R=this.audioTrack=(0,D.dummyTrack)("audio",1),x=this.txtTrack=(0,D.dummyTrack)("text",1);if(this.id3Track=(0,D.dummyTrack)("id3",1),this.timeOffset=0,!E||!E.byteLength)return;var I=(0,H.parseInitSegment)(E);if(I.video){var k=I.video,A=k.id,P=k.timescale,S=k.codec;w.id=A,w.timescale=x.timescale=P,w.codec=S}if(I.audio){var C=I.audio,c=C.id,o=C.timescale,v=C.codec;R.id=c,R.timescale=o,R.codec=v}x.id=H.RemuxerTrackIdConfig.text,w.sampleDuration=0,w.duration=R.duration=O},m.resetContiguity=function(){},u.probe=function(E){return E=E.length>16384?E.subarray(0,16384):E,(0,H.findBox)(E,["moof"]).length>0},m.demux=function(E,_){this.timeOffset=_;var f=E,O=this.videoTrack,w=this.txtTrack;if(this.config.progressive){this.remainderData&&(f=(0,H.appendUint8Array)(this.remainderData,E));var R=(0,H.segmentValidRange)(f);this.remainderData=R.remainder,O.samples=R.valid||new Uint8Array}else O.samples=f;var x=this.extractID3Track(O,_);return w.samples=(0,H.parseSamples)(_,O),{videoTrack:O,audioTrack:this.audioTrack,id3Track:x,textTrack:this.txtTrack}},m.flush=function(){var E=this.timeOffset,_=this.videoTrack,f=this.txtTrack;_.samples=this.remainderData||new Uint8Array,this.remainderData=null;var O=this.extractID3Track(_,this.timeOffset);return f.samples=(0,H.parseSamples)(E,_),{videoTrack:_,audioTrack:(0,D.dummyTrack)(),id3Track:O,textTrack:(0,D.dummyTrack)()}},m.extractID3Track=function(E,_){var f=this.id3Track;if(E.samples.length){var O=(0,H.findBox)(E.samples,["emsg"]);O&&O.forEach(function(w){var R=(0,H.parseEmsg)(w);if(M.test(R.schemeIdUri)){var x=(0,W.isFiniteNumber)(R.presentationTime)?R.presentationTime/R.timeScale:_+R.presentationTimeDelta/R.timeScale,I=R.eventDuration===4294967295?Number.POSITIVE_INFINITY:R.eventDuration/R.timeScale;I<=.001&&(I=Number.POSITIVE_INFINITY);var k=R.payload;f.samples.push({data:k,len:k.byteLength,dts:x,pts:x,type:r.MetadataSchema.emsg,duration:I})}})}return f},m.demuxSampleAes=function(E,_,f){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},m.destroy=function(){},u}();const p=g},"./src/demux/mpegaudio.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{appendFrame:()=>g,canParse:()=>b,isHeader:()=>m,isHeaderPattern:()=>u,parseHeader:()=>p,probe:()=>E});var W=null,r=[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],H=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],D=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],M=[0,1,1,4];function g(_,f,O,w,R){if(O+24>f.length)return;var x=p(f,O);if(x&&O+x.frameLength<=f.length){var I=x.samplesPerFrame*9e4/x.sampleRate,k=w+R*I,A={unit:f.subarray(O,O+x.frameLength),pts:k,dts:k};return _.config=[],_.channelCount=x.channelCount,_.samplerate=x.sampleRate,_.samples.push(A),{sample:A,length:x.frameLength,missing:0}}}function p(_,f){var O=_[f+1]>>3&3,w=_[f+1]>>1&3,R=_[f+2]>>4&15,x=_[f+2]>>2&3;if(O!==1&&R!==0&&R!==15&&x!==3){var I=_[f+2]>>1&1,k=_[f+3]>>6,A=O===3?3-w:w===3?3:4,P=r[A*14+R-1]*1e3,S=O===3?0:O===2?1:2,C=H[S*3+x],c=k===3?1:2,o=D[O][w],v=M[w],l=o*8*v,a=Math.floor(o*P/C+I)*v;if(W===null){var T=navigator.userAgent||"",h=T.match(/Chrome\/(\d+)/i);W=h?parseInt(h[1]):0}var n=!!W&&W<=87;return n&&w===2&&P>=224e3&&k===0&&(_[f+3]=_[f+3]|128),{sampleRate:C,channelCount:c,frameLength:a,samplesPerFrame:l}}}function u(_,f){return _[f]===255&&(_[f+1]&224)===224&&(_[f+1]&6)!==0}function m(_,f){return f+1<_.length&&u(_,f)}function b(_,f){var O=4;return u(_,f)&&O<=_.length-f}function E(_,f){if(f+1<_.length&&u(_,f)){var O=4,w=p(_,f),R=O;w!=null&&w.frameLength&&(R=w.frameLength);var x=f+R;return x===_.length||m(_,x)}return!1}},"./src/demux/sample-aes.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>D});var W=F("./src/crypt/decrypter.ts"),r=F("./src/utils/mp4-tools.ts"),H=function(){function M(p,u,m){this.keyData=void 0,this.decrypter=void 0,this.keyData=m,this.decrypter=new W.default(u,{removePKCS7Padding:!1})}var g=M.prototype;return g.decryptBuffer=function(u){return this.decrypter.decrypt(u,this.keyData.key.buffer,this.keyData.iv.buffer)},g.decryptAacSample=function(u,m,b){var E=this,_=u[m].unit;if(_.length<=16)return;var f=_.subarray(16,_.length-_.length%16),O=f.buffer.slice(f.byteOffset,f.byteOffset+f.length);this.decryptBuffer(O).then(function(w){var R=new Uint8Array(w);_.set(R,16),E.decrypter.isSync()||E.decryptAacSamples(u,m+1,b)})},g.decryptAacSamples=function(u,m,b){for(;;m++){if(m>=u.length){b();return}if(u[m].unit.length<32)continue;if(this.decryptAacSample(u,m,b),!this.decrypter.isSync())return}},g.getAvcEncryptedData=function(u){for(var m=Math.floor((u.length-48)/160)*16+16,b=new Int8Array(m),E=0,_=32;_<u.length-16;_+=160,E+=16)b.set(u.subarray(_,_+16),E);return b},g.getAvcDecryptedUnit=function(u,m){for(var b=new Uint8Array(m),E=0,_=32;_<u.length-16;_+=160,E+=16)u.set(b.subarray(E,E+16),_);return u},g.decryptAvcSample=function(u,m,b,E,_){var f=this,O=(0,r.discardEPB)(_.data),w=this.getAvcEncryptedData(O);this.decryptBuffer(w.buffer).then(function(R){_.data=f.getAvcDecryptedUnit(O,R),f.decrypter.isSync()||f.decryptAvcSamples(u,m,b+1,E)})},g.decryptAvcSamples=function(u,m,b,E){if(u instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;m++,b=0){if(m>=u.length){E();return}for(var _=u[m].units;!(b>=_.length);b++){var f=_[b];if(f.data.length<=48||f.type!==1&&f.type!==5)continue;if(this.decryptAvcSample(u,m,b,E,f),!this.decrypter.isSync())return}}},M}();const D=H},"./src/demux/transmuxer-interface.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>b});var W=F("./src/demux/webworkify-webpack.js"),r=F("./src/events.ts"),H=F("./src/demux/transmuxer.ts"),D=F("./src/utils/logger.ts"),M=F("./src/errors.ts"),g=F("./src/utils/mediasource-helper.ts"),p=F("./node_modules/eventemitter3/index.js"),u=F.n(p),m=(0,g.getMediaSource)()||{isTypeSupported:function(){return!1}},b=function(){function E(f,O,w,R){var x=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;var I=f.config;this.hls=f,this.id=O,this.useWorker=!!I.enableWorker,this.onTransmuxComplete=w,this.onFlush=R;var k=function(c,o){o=o||{},o.frag=x.frag,o.id=x.id,x.hls.trigger(c,o)};this.observer=new p.EventEmitter,this.observer.on(r.Events.FRAG_DECRYPTED,k),this.observer.on(r.Events.ERROR,k);var A={mp4:m.isTypeSupported("video/mp4"),mpeg:m.isTypeSupported("audio/mpeg"),mp3:m.isTypeSupported('audio/mp4; codecs="mp3"')},P=navigator.vendor;if(this.useWorker&&typeof Worker!="undefined"){D.logger.log("demuxing in webworker");var S;try{S=this.worker=(0,W.default)("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),S.addEventListener("message",this.onwmsg),S.onerror=function(C){x.useWorker=!1,D.logger.warn("Exception in webworker, fallback to inline"),x.hls.trigger(r.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:new Error(C.message+" ("+C.filename+":"+C.lineno+")")})},S.postMessage({cmd:"init",typeSupported:A,vendor:P,id:O,config:JSON.stringify(I)})}catch(C){D.logger.warn("Error in worker:",C),D.logger.error("Error while initializing DemuxerWorker, fallback to inline"),S&&self.URL.revokeObjectURL(S.objectURL),this.transmuxer=new H.default(this.observer,A,I,P,O),this.worker=null}}else this.transmuxer=new H.default(this.observer,A,I,P,O)}var _=E.prototype;return _.destroy=function(){var O=this.worker;if(O)O.removeEventListener("message",this.onwmsg),O.terminate(),this.worker=null,this.onwmsg=void 0;else{var w=this.transmuxer;w&&(w.destroy(),this.transmuxer=null)}var R=this.observer;R&&R.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},_.push=function(O,w,R,x,I,k,A,P,S,C){var c,o,v=this;S.transmuxing.start=self.performance.now();var l=this.transmuxer,a=this.worker,T=k?k.start:I.start,h=I.decryptdata,n=this.frag,N=!(n&&I.cc===n.cc),U=!(n&&S.level===n.level),j=n?S.sn-n.sn:-1,Y=this.part?S.part-this.part.index:-1,J=j===0&&S.id>1&&S.id===(n==null?void 0:n.stats.chunkCount),ee=!U&&(j===1||j===0&&(Y===1||J&&Y<=0)),ie=self.performance.now();(U||j||I.stats.parsing.start===0)&&(I.stats.parsing.start=ie),k&&(Y||!ee)&&(k.stats.parsing.start=ie);var re=!(n&&((c=I.initSegment)===null||c===void 0?void 0:c.url)===((o=n.initSegment)===null||o===void 0?void 0:o.url)),he=new H.TransmuxState(N,ee,P,U,T,re);if(!ee||N||re){D.logger.log("[transmuxer-interface, "+I.type+"]: Starting new transmux session for sn: "+S.sn+" p: "+S.part+" level: "+S.level+" id: "+S.id+`
|
|
discontinuity: `+N+`
|
|
trackSwitch: `+U+`
|
|
contiguous: `+ee+`
|
|
accurateTimeOffset: `+P+`
|
|
timeOffset: `+T+`
|
|
initSegmentChange: `+re);var oe=new H.TransmuxConfig(R,x,w,A,C);this.configureTransmuxer(oe)}if(this.frag=I,this.part=k,a)a.postMessage({cmd:"demux",data:O,decryptdata:h,chunkMeta:S,state:he},O instanceof ArrayBuffer?[O]:[]);else if(l){var ae=l.push(O,h,S,he);(0,H.isPromise)(ae)?(l.async=!0,ae.then(function(Ee){v.handleTransmuxComplete(Ee)}).catch(function(Ee){v.transmuxerError(Ee,S,"transmuxer-interface push error")})):(l.async=!1,this.handleTransmuxComplete(ae))}},_.flush=function(O){var w=this;O.transmuxing.start=self.performance.now();var R=this.transmuxer,x=this.worker;if(x)x.postMessage({cmd:"flush",chunkMeta:O});else if(R){var I=R.flush(O),k=(0,H.isPromise)(I);k||R.async?((0,H.isPromise)(I)||(I=Promise.resolve(I)),I.then(function(A){w.handleFlushResult(A,O)}).catch(function(A){w.transmuxerError(A,O,"transmuxer-interface flush error")})):this.handleFlushResult(I,O)}},_.transmuxerError=function(O,w,R){if(!this.hls)return;this.hls.trigger(r.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:w,fatal:!1,error:O,err:O,reason:R})},_.handleFlushResult=function(O,w){var R=this;O.forEach(function(x){R.handleTransmuxComplete(x)}),this.onFlush(w)},_.onWorkerMessage=function(O){var w=O.data,R=this.hls;switch(w.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(w.data);break}case"flush":{this.onFlush(w.data);break}case"workerLog":D.logger[w.data.logType]&&D.logger[w.data.logType](w.data.message);break;default:{w.data=w.data||{},w.data.frag=this.frag,w.data.id=this.id,R.trigger(w.event,w.data);break}}},_.configureTransmuxer=function(O){var w=this.worker,R=this.transmuxer;w?w.postMessage({cmd:"configure",config:O}):R&&R.configure(O)},_.handleTransmuxComplete=function(O){O.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(O)},E}()},"./src/demux/transmuxer-worker.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>p});var W=F("./src/demux/transmuxer.ts"),r=F("./src/events.ts"),H=F("./src/utils/logger.ts"),D=F("./node_modules/eventemitter3/index.js"),M=F.n(D),g=F("./src/errors.ts");function p(_){var f=new D.EventEmitter,O=function(x,I){_.postMessage({event:x,data:I})};f.on(r.Events.FRAG_DECRYPTED,O),f.on(r.Events.ERROR,O);var w=function(){var x=function(A){var P=function(C){O("workerLog",{logType:A,message:C})};H.logger[A]=P};for(var I in H.logger)x(I)};_.addEventListener("message",function(R){var x=R.data;switch(x.cmd){case"init":{var I=JSON.parse(x.config);_.transmuxer=new W.default(f,x.typeSupported,I,x.vendor,x.id),(0,H.enableLogs)(I.debug,x.id),w(),O("init",null);break}case"configure":{_.transmuxer.configure(x.config);break}case"demux":{var k=_.transmuxer.push(x.data,x.decryptdata,x.chunkMeta,x.state);(0,W.isPromise)(k)?(_.transmuxer.async=!0,k.then(function(C){u(_,C)}).catch(function(C){O(r.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:x.chunkMeta,fatal:!1,error:C,err:C,reason:"transmuxer-worker push error"})})):(_.transmuxer.async=!1,u(_,k));break}case"flush":{var A=x.chunkMeta,P=_.transmuxer.flush(A),S=(0,W.isPromise)(P);S||_.transmuxer.async?((0,W.isPromise)(P)||(P=Promise.resolve(P)),P.then(function(C){b(_,C,A)}).catch(function(C){O(r.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:x.chunkMeta,fatal:!1,error:C,err:C,reason:"transmuxer-worker flush error"})})):b(_,P,A);break}default:break}})}function u(_,f){if(E(f.remuxResult))return!1;var O=[],w=f.remuxResult,R=w.audio,x=w.video;return R&&m(O,R),x&&m(O,x),_.postMessage({event:"transmuxComplete",data:f},O),!0}function m(_,f){f.data1&&_.push(f.data1.buffer),f.data2&&_.push(f.data2.buffer)}function b(_,f,O){var w=f.reduce(function(R,x){return u(_,x)||R},!1);w||_.postMessage({event:"transmuxComplete",data:f[0]}),_.postMessage({event:"flush",data:O})}function E(_){return!_.audio&&!_.video&&!_.text&&!_.id3&&!_.initSegment}},"./src/demux/transmuxer.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{TransmuxConfig:()=>x,TransmuxState:()=>I,default:()=>f,isPromise:()=>R});var W=F("./src/events.ts"),r=F("./src/errors.ts"),H=F("./src/crypt/decrypter.ts"),D=F("./src/demux/aacdemuxer.ts"),M=F("./src/demux/mp4demuxer.ts"),g=F("./src/demux/tsdemuxer.ts"),p=F("./src/demux/mp3demuxer.ts"),u=F("./src/remux/mp4-remuxer.ts"),m=F("./src/remux/passthrough-remuxer.ts"),b=F("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(k){b.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var _=[{demux:M.default,remux:m.default},{demux:g.default,remux:u.default},{demux:D.default,remux:u.default},{demux:p.default,remux:u.default}],f=function(){function k(P,S,C,c,o){this.async=!1,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.observer=P,this.typeSupported=S,this.config=C,this.vendor=c,this.id=o}var A=k.prototype;return A.configure=function(S){this.transmuxConfig=S,this.decrypter&&this.decrypter.reset()},A.push=function(S,C,c,o){var v=this,l=c.transmuxing;l.executeStart=E();var a=new Uint8Array(S),T=this.currentTransmuxState,h=this.transmuxConfig;o&&(this.currentTransmuxState=o);var n=o||T,N=n.contiguous,U=n.discontinuity,j=n.trackSwitch,Y=n.accurateTimeOffset,J=n.timeOffset,ee=n.initSegmentChange,ie=h.audioCodec,re=h.videoCodec,he=h.defaultInitPts,oe=h.duration,ae=h.initSegmentData,Ee=O(a,C);if(Ee&&Ee.method==="AES-128"){var Le=this.getDecrypter();if(Le.isSync()){var Fe=Le.softwareDecrypt(a,Ee.key.buffer,Ee.iv.buffer),Xe=c.part>-1;if(Xe&&(Fe=Le.flush()),!Fe)return l.executeEnd=E(),w(c);a=new Uint8Array(Fe)}else return this.decryptionPromise=Le.webCryptoDecrypt(a,Ee.key.buffer,Ee.iv.buffer).then(function(Ke){var de=v.push(Ke,null,c);return v.decryptionPromise=null,de}),this.decryptionPromise}var He=this.needsProbing(U,j);He&&this.configureTransmuxer(a),(U||j||ee||He)&&this.resetInitSegment(ae,ie,re,oe,C),(U||ee||He)&&this.resetInitialTimestamp(he),N||this.resetContiguity();var Ae=this.transmux(a,Ee,J,Y,c),Oe=this.currentTransmuxState;return Oe.contiguous=!0,Oe.discontinuity=!1,Oe.trackSwitch=!1,l.executeEnd=E(),Ae},A.flush=function(S){var C=this,c=S.transmuxing;c.executeStart=E();var o=this.decrypter,v=this.currentTransmuxState,l=this.decryptionPromise;if(l)return l.then(function(){return C.flush(S)});var a=[],T=v.timeOffset;if(o){var h=o.flush();h&&a.push(this.push(h,null,S))}var n=this.demuxer,N=this.remuxer;if(!n||!N)return this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),c.executeEnd=E(),[w(S)];var U=n.flush(T);return R(U)?U.then(function(j){return C.flushRemux(a,j,S),a}):(this.flushRemux(a,U,S),a)},A.flushRemux=function(S,C,c){var o=C.audioTrack,v=C.videoTrack,l=C.id3Track,a=C.textTrack,T=this.currentTransmuxState,h=T.accurateTimeOffset,n=T.timeOffset;b.logger.log("[transmuxer.ts]: Flushed fragment "+c.sn+(c.part>-1?" p: "+c.part:"")+" of level "+c.level);var N=this.remuxer.remux(o,v,l,a,n,h,!0,this.id);S.push({remuxResult:N,chunkMeta:c}),c.transmuxing.executeEnd=E()},A.resetInitialTimestamp=function(S){var C=this.demuxer,c=this.remuxer;if(!C||!c)return;C.resetTimeStamp(S),c.resetTimeStamp(S)},A.resetContiguity=function(){var S=this.demuxer,C=this.remuxer;if(!S||!C)return;S.resetContiguity(),C.resetNextTimestamp()},A.resetInitSegment=function(S,C,c,o,v){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetInitSegment(S,C,c,o),a.resetInitSegment(S,C,c,v)},A.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},A.transmux=function(S,C,c,o,v){var l;return C&&C.method==="SAMPLE-AES"?l=this.transmuxSampleAes(S,C,c,o,v):l=this.transmuxUnencrypted(S,c,o,v),l},A.transmuxUnencrypted=function(S,C,c,o){var v=this.demuxer.demux(S,C,!1,!this.config.progressive),l=v.audioTrack,a=v.videoTrack,T=v.id3Track,h=v.textTrack,n=this.remuxer.remux(l,a,T,h,C,c,!1,this.id);return{remuxResult:n,chunkMeta:o}},A.transmuxSampleAes=function(S,C,c,o,v){var l=this;return this.demuxer.demuxSampleAes(S,C,c).then(function(a){var T=l.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,c,o,!1,l.id);return{remuxResult:T,chunkMeta:v}})},A.configureTransmuxer=function(S){for(var C=this.config,c=this.observer,o=this.typeSupported,v=this.vendor,l,a=0,T=_.length;a<T;a++)if(_[a].demux.probe(S)){l=_[a];break}l||(b.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),l={demux:M.default,remux:m.default});var h=this.demuxer,n=this.remuxer,N=l.remux,U=l.demux;(!n||!(n instanceof N))&&(this.remuxer=new N(c,C,o,v)),(!h||!(h instanceof U))&&(this.demuxer=new U(c,C,o),this.probe=U.probe)},A.needsProbing=function(S,C){return!this.demuxer||!this.remuxer||S||C},A.getDecrypter=function(){var S=this.decrypter;return S||(S=this.decrypter=new H.default(this.config)),S},k}();function O(k,A){var P=null;return k.byteLength>0&&A!=null&&A.key!=null&&A.iv!==null&&A.method!=null&&(P=A),P}var w=function(A){return{remuxResult:{},chunkMeta:A}};function R(k){return"then"in k&&k.then instanceof Function}var x=function(A,P,S,C,c){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=A,this.videoCodec=P,this.initSegmentData=S,this.duration=C,this.defaultInitPts=c},I=function(A,P,S,C,c,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=A,this.contiguous=P,this.accurateTimeOffset=S,this.trackSwitch=C,this.timeOffset=c,this.initSegmentChange=o}},"./src/demux/tsdemuxer.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>k});var W=F("./src/demux/adts.ts"),r=F("./src/demux/mpegaudio.ts"),H=F("./src/demux/exp-golomb.ts"),D=F("./src/demux/sample-aes.ts"),M=F("./src/events.ts"),g=F("./src/utils/mp4-tools.ts"),p=F("./src/utils/logger.ts"),u=F("./src/errors.ts"),m=F("./src/types/demuxer.ts");function b(){return b=Object.assign?Object.assign.bind():function(A){for(var P=1;P<arguments.length;P++){var S=arguments[P];for(var C in S)Object.prototype.hasOwnProperty.call(S,C)&&(A[C]=S[C])}return A},b.apply(this,arguments)}var E=188,_=function(){function A(S,C,c){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._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=S,this.config=C,this.typeSupported=c}A.probe=function(C){var c=A.syncOffset(C);return c>0&&p.logger.warn("MPEG2-TS detected but first sync word found @ offset "+c),c!==-1},A.syncOffset=function(C){for(var c=C.length,o=Math.min(E*5,C.length-E)+1,v=0;v<o;){for(var l=!1,a=v;a<c&&C[a]===71;a+=E)if(!l&&O(C,a)===0&&(l=!0),l&&a+E>o)return v;v++}return-1},A.createTrack=function(C,c){return{container:C==="video"||C==="audio"?"video/mp2t":void 0,type:C,id:g.RemuxerTrackIdConfig[C],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:C==="audio"?c:void 0}};var P=A.prototype;return P.resetInitSegment=function(C,c,o,v){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=A.createTrack("video"),this._audioTrack=A.createTrack("audio",v),this._id3Track=A.createTrack("id3"),this._txtTrack=A.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=c,this.videoCodec=o,this._duration=v},P.resetTimeStamp=function(){},P.resetContiguity=function(){var C=this._audioTrack,c=this._avcTrack,o=this._id3Track;C&&(C.pesData=null),c&&(c.pesData=null),o&&(o.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null},P.demux=function(C,c,o,v){o===void 0&&(o=!1),v===void 0&&(v=!1),o||(this.sampleAes=null);var l,a=this._avcTrack,T=this._audioTrack,h=this._id3Track,n=this._txtTrack,N=a.pid,U=a.pesData,j=T.pid,Y=h.pid,J=T.pesData,ee=h.pesData,ie=null,re=this.pmtParsed,he=this._pmtId,oe=C.length;if(this.remainderData&&(C=(0,g.appendUint8Array)(this.remainderData,C),oe=C.length,this.remainderData=null),oe<E&&!v)return this.remainderData=C,{audioTrack:T,videoTrack:a,id3Track:h,textTrack:n};var ae=Math.max(0,A.syncOffset(C));oe-=(oe-ae)%E,oe<C.byteLength&&!v&&(this.remainderData=new Uint8Array(C.buffer,oe,C.buffer.byteLength-oe));for(var Ee=0,Le=ae;Le<oe;Le+=E)if(C[Le]===71){var Fe=!!(C[Le+1]&64),Xe=O(C,Le),He=(C[Le+3]&48)>>4,Ae=void 0;if(He>1){if(Ae=Le+5+C[Le+4],Ae===Le+E)continue}else Ae=Le+4;switch(Xe){case N:Fe&&(U&&(l=x(U))&&this.parseAVCPES(a,n,l,!1),U={data:[],size:0}),U&&(U.data.push(C.subarray(Ae,Le+E)),U.size+=Le+E-Ae);break;case j:if(Fe){if(J&&(l=x(J)))switch(T.segmentCodec){case"aac":this.parseAACPES(T,l);break;case"mp3":this.parseMPEGPES(T,l);break}J={data:[],size:0}}J&&(J.data.push(C.subarray(Ae,Le+E)),J.size+=Le+E-Ae);break;case Y:Fe&&(ee&&(l=x(ee))&&this.parseID3PES(h,l),ee={data:[],size:0}),ee&&(ee.data.push(C.subarray(Ae,Le+E)),ee.size+=Le+E-Ae);break;case 0:Fe&&(Ae+=C[Ae]+1),he=this._pmtId=w(C,Ae);break;case he:{Fe&&(Ae+=C[Ae]+1);var Oe=R(C,Ae,this.typeSupported,o);N=Oe.avc,N>0&&(a.pid=N),j=Oe.audio,j>0&&(T.pid=j,T.segmentCodec=Oe.segmentCodec),Y=Oe.id3,Y>0&&(h.pid=Y),ie!==null&&!re&&(p.logger.warn("MPEG-TS PMT found at "+Le+" after unknown PID '"+ie+"'. Backtracking to sync byte @"+ae+" to parse all TS packets."),ie=null,Le=ae-188),re=this.pmtParsed=!0;break}case 17:case 8191:break;default:ie=Xe;break}}else Ee++;Ee>0&&this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+Ee+" TS packet/s that do not start with 0x47"}),a.pesData=U,T.pesData=J,h.pesData=ee;var Ke={audioTrack:T,videoTrack:a,id3Track:h,textTrack:n};return v&&this.extractRemainingSamples(Ke),Ke},P.flush=function(){var C=this.remainderData;this.remainderData=null;var c;return C?c=this.demux(C,-1,!1,!0):c={videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},P.extractRemainingSamples=function(C){var c=C.audioTrack,o=C.videoTrack,v=C.id3Track,l=C.textTrack,a=o.pesData,T=c.pesData,h=v.pesData,n;if(a&&(n=x(a))?(this.parseAVCPES(o,l,n,!0),o.pesData=null):o.pesData=a,T&&(n=x(T))){switch(c.segmentCodec){case"aac":this.parseAACPES(c,n);break;case"mp3":this.parseMPEGPES(c,n);break}c.pesData=null}else T!=null&&T.size&&p.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=T;h&&(n=x(h))?(this.parseID3PES(v,n),v.pesData=null):v.pesData=h},P.demuxSampleAes=function(C,c,o){var v=this.demux(C,o,!0,!this.config.progressive),l=this.sampleAes=new D.default(this.observer,this.config,c);return this.decrypt(v,l)},P.decrypt=function(C,c){return new Promise(function(o){var v=C.audioTrack,l=C.videoTrack;v.samples&&v.segmentCodec==="aac"?c.decryptAacSamples(v.samples,0,function(){l.samples?c.decryptAvcSamples(l.samples,0,0,function(){o(C)}):o(C)}):l.samples&&c.decryptAvcSamples(l.samples,0,0,function(){o(C)})})},P.destroy=function(){this._duration=0},P.parseAVCPES=function(C,c,o,v){var l=this,a=this.parseAVCNALu(C,o.data),T=!1,h=this.avcSample,n,N=!1;o.data=null,h&&a.length&&!C.audFound&&(I(h,C),h=this.avcSample=f(!1,o.pts,o.dts,"")),a.forEach(function(U){switch(U.type){case 1:{n=!0,h||(h=l.avcSample=f(!0,o.pts,o.dts,"")),T&&(h.debug+="NDR "),h.frame=!0;var j=U.data;if(N&&j.length>4){var Y=new H.default(j).readSliceType();(Y===2||Y===4||Y===7||Y===9)&&(h.key=!0)}break}case 5:n=!0,h||(h=l.avcSample=f(!0,o.pts,o.dts,"")),T&&(h.debug+="IDR "),h.key=!0,h.frame=!0;break;case 6:{n=!0,T&&h&&(h.debug+="SEI "),(0,g.parseSEIMessageFromNALu)(U.data,1,o.pts,c.samples);break}case 7:if(n=!0,N=!0,T&&h&&(h.debug+="SPS "),!C.sps){var J=new H.default(U.data),ee=J.readSPS();C.width=ee.width,C.height=ee.height,C.pixelRatio=ee.pixelRatio,C.sps=[U.data],C.duration=l._duration;for(var ie=U.data.subarray(1,4),re="avc1.",he=0;he<3;he++){var oe=ie[he].toString(16);oe.length<2&&(oe="0"+oe),re+=oe}C.codec=re}break;case 8:n=!0,T&&h&&(h.debug+="PPS "),C.pps||(C.pps=[U.data]);break;case 9:n=!1,C.audFound=!0,h&&I(h,C),h=l.avcSample=f(!1,o.pts,o.dts,T?"AUD ":"");break;case 12:n=!0;break;default:n=!1,h&&(h.debug+="unknown NAL "+U.type+" ");break}if(h&&n){var ae=h.units;ae.push(U)}}),v&&h&&(I(h,C),this.avcSample=null)},P.getLastNalUnit=function(C){var c,o=this.avcSample,v;if((!o||o.units.length===0)&&(o=C[C.length-1]),(c=o)!==null&&c!==void 0&&c.units){var l=o.units;v=l[l.length-1]}return v},P.parseAVCNALu=function(C,c){var o=c.byteLength,v=C.naluState||0,l=v,a=[],T=0,h,n,N,U=-1,j=0;for(v===-1&&(U=0,j=c[0]&31,v=0,T=1);T<o;){if(h=c[T++],!v){v=h?0:1;continue}if(v===1){v=h?0:2;continue}if(!h)v=3;else if(h===1){if(U>=0){var Y={data:c.subarray(U,T-v-1),type:j};a.push(Y)}else{var J=this.getLastNalUnit(C.samples);if(J&&(l&&T<=4-l&&(J.state&&(J.data=J.data.subarray(0,J.data.byteLength-l))),n=T-v-1,n>0)){var ee=new Uint8Array(J.data.byteLength+n);ee.set(J.data,0),ee.set(c.subarray(0,n),J.data.byteLength),J.data=ee,J.state=0}}T<o?(N=c[T]&31,U=T,j=N,v=0):v=-1}else v=0}if(U>=0&&v>=0){var ie={data:c.subarray(U,o),type:j,state:v};a.push(ie)}if(a.length===0){var re=this.getLastNalUnit(C.samples);if(re){var he=new Uint8Array(re.data.byteLength+c.byteLength);he.set(re.data,0),he.set(c,re.data.byteLength),re.data=he}}return C.naluState=v,a},P.parseAACPES=function(C,c){var o=0,v=this.aacOverFlow,l=c.data;if(v){this.aacOverFlow=null;var a=v.missing,T=v.sample.unit.byteLength;if(a===-1){var h=new Uint8Array(T+l.byteLength);h.set(v.sample.unit,0),h.set(l,T),l=h}else{var n=T-a;v.sample.unit.set(l.subarray(0,a),n),C.samples.push(v.sample),o=v.missing}}var N,U;for(N=o,U=l.length;N<U-1&&!W.isHeader(l,N);N++);if(N!==o){var j,Y;if(N<U-1?(j="AAC PES did not start with ADTS header,offset:"+N,Y=!1):(j="no ADTS header found in AAC PES",Y=!0),p.logger.warn("parsing error:"+j),this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.FRAG_PARSING_ERROR,fatal:Y,reason:j}),Y)return}W.initTrackConfig(C,this.observer,l,N,this.audioCodec);var J;if(c.pts!==void 0)J=c.pts;else if(v){var ee=W.getFrameDuration(C.samplerate);J=v.sample.pts+ee}else{p.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var ie=0,re;N<U;)if(re=W.appendFrame(C,l,N,J,ie),N+=re.length,re.missing){this.aacOverFlow=re;break}else for(ie++;N<U-1&&!W.isHeader(l,N);N++);},P.parseMPEGPES=function(C,c){var o=c.data,v=o.length,l=0,a=0,T=c.pts;if(T===void 0){p.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<v;)if(r.isHeader(o,a)){var h=r.appendFrame(C,o,a,T,l);if(h)a+=h.length,l++;else break}else a++},P.parseID3PES=function(C,c){if(c.pts===void 0){p.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}var o=b({},c,{type:this._avcTrack?m.MetadataSchema.emsg:m.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});C.samples.push(o)},A}();function f(A,P,S,C){return{key:A,frame:!1,pts:P,dts:S,units:[],debug:C,length:0}}function O(A,P){return((A[P+1]&31)<<8)+A[P+2]}function w(A,P){return(A[P+10]&31)<<8|A[P+11]}function R(A,P,S,C){var c={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},o=(A[P+1]&15)<<8|A[P+2],v=P+3+o-4,l=(A[P+10]&15)<<8|A[P+11];for(P+=12+l;P<v;){var a=O(A,P);switch(A[P]){case 207:if(!C){p.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=a);break;case 21:c.id3===-1&&(c.id3=a);break;case 219:if(!C){p.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=a);break;case 3:case 4:S.mpeg!==!0&&S.mp3!==!0?p.logger.log("MPEG audio found, not supported in this browser"):c.audio===-1&&(c.audio=a,c.segmentCodec="mp3");break;case 36:p.logger.warn("Unsupported HEVC stream type found");break;default:break}P+=((A[P+3]&15)<<8|A[P+4])+5}return c}function x(A){var P=0,S,C,c,o,v,l=A.data;if(!A||A.size===0)return null;for(;l[0].length<19&&l.length>1;){var a=new Uint8Array(l[0].length+l[1].length);a.set(l[0]),a.set(l[1],l[0].length),l[0]=a,l.splice(1,1)}S=l[0];var T=(S[0]<<16)+(S[1]<<8)+S[2];if(T===1){if(C=(S[4]<<8)+S[5],C&&C>A.size-6)return null;var h=S[7];h&192&&(o=(S[9]&14)*536870912+(S[10]&255)*4194304+(S[11]&254)*16384+(S[12]&255)*128+(S[13]&254)/2,h&64?(v=(S[14]&14)*536870912+(S[15]&255)*4194304+(S[16]&254)*16384+(S[17]&255)*128+(S[18]&254)/2,o-v>60*9e4&&(p.logger.warn(Math.round((o-v)/9e4)+"s delta between PTS and DTS, align them"),o=v)):v=o),c=S[8];var n=c+9;if(A.size<=n)return null;A.size-=n;for(var N=new Uint8Array(A.size),U=0,j=l.length;U<j;U++){S=l[U];var Y=S.byteLength;if(n)if(n>Y){n-=Y;continue}else S=S.subarray(n),Y-=n,n=0;N.set(S,P),P+=Y}return C&&(C-=c+3),{data:N,pts:o,dts:v,len:C}}return null}function I(A,P){if(A.units.length&&A.frame){if(A.pts===void 0){var S=P.samples,C=S.length;if(C){var c=S[C-1];A.pts=c.pts,A.dts=c.dts}else{P.dropped++;return}}P.samples.push(A)}A.debug.length&&p.logger.log(A.pts+"/"+A.dts+":"+A.debug)}const k=_},"./src/demux/webworkify-webpack.js":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>E});var W=function(){var f=ENTRY_MODULE,O={},w=function x(I){var k=O[I];if(k!==void 0)return k.exports;var A=O[I]={exports:{}};return f[I].call(A.exports,A,A.exports,x),A.exports};w.m=f,function(){w.n=function(x){var I=x&&x.__esModule?function(){return x.default}:function(){return x};return w.d(I,{a:I}),I}}(),function(){w.d=function(x,I){for(var k in I)w.o(I,k)&&!w.o(x,k)&&Object.defineProperty(x,k,{enumerable:!0,get:I[k]})}}(),function(){w.o=function(x,I){return Object.prototype.hasOwnProperty.call(x,I)}}(),function(){w.r=function(x){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(x,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(x,"__esModule",{value:!0})}}();var R=w(ENTRY_MODULE);return R.default||R},r=W.toString().split("ENTRY_MODULE"),H="[\\.|\\-|\\+|\\w|/|@]+",D="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+H+").*?\\)";function M(_){return(_+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function g(_){return!isNaN(1*_)}function p(_,f,O){var w={};w[O]=[];var R=f.toString().replace(/^"[^"]+"/,"function"),x=R.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/)||R.match(/^\(\w+,\s*\w+,\s*(\w+)\)\s?\=\s?\>/);if(!x)return w;for(var I=x[1],k=new RegExp("(\\\\n|\\W)"+M(I)+D,"g"),A;A=k.exec(R);){if(A[3]==="dll-reference")continue;w[O].push(A[3])}for(k=new RegExp("\\("+M(I)+'\\("(dll-reference\\s('+H+'))"\\)\\)'+D,"g");A=k.exec(R);)_[A[2]]||(w[O].push(A[1]),_[A[2]]=F(A[1]).m),w[A[2]]=w[A[2]]||[],w[A[2]].push(A[4]);for(var P=Object.keys(w),S=0;S<P.length;S++)for(var C=0;C<w[P[S]].length;C++)g(w[P[S]][C])&&(w[P[S]][C]=1*w[P[S]][C]);return w}function u(_){var f=Object.keys(_);return f.reduce(function(O,w){return O||_[w].length>0},!1)}function m(_,f){for(var O={main:[f]},w={main:[]},R={main:{}};u(O);)for(var x=Object.keys(O),I=0;I<x.length;I++){var k=x[I],A=O[k],P=A.pop();if(R[k]=R[k]||{},R[k][P]||!_[k][P])continue;R[k][P]=!0,w[k]=w[k]||[],w[k].push(P);for(var S=p(_,_[k][P],k),C=Object.keys(S),c=0;c<C.length;c++)O[C[c]]=O[C[c]]||[],O[C[c]]=O[C[c]].concat(S[C[c]])}return w}function b(_,f,O,w){var R=_[w].map(function(x){return'"'+x+'": '+f[w][x].toString().replace(/^"[^"]+"/,"function")}).join(",");return r[0]+"{"+R+"}"+r[1]+'"'+O+'"'+r[2]}function E(_,f){f=f||{};var O={main:F.m},w=f.all?{main:Object.keys(O.main)}:m(O,_),R="";Object.keys(w).filter(function(P){return P!=="main"}).forEach(function(P){for(var S=0;w[P][S];)S++;w[P].push(S),O[P][S]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",R=R+("var "+P+" = ("+b(w,O,S,modules)+`)();
|
|
`)}),R=R+("new (("+b(w,O,_,"main")+")())(self);");var x=new window.Blob([R],{type:"text/javascript"}),I=window.URL||window.webkitURL||window.mozURL||window.msURL,k=I.createObjectURL(x),A=new window.Worker(k);return A.objectURL=k,A}},"./src/errors.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{ErrorDetails:()=>r,ErrorTypes:()=>W});var W;(function(H){H.NETWORK_ERROR="networkError",H.MEDIA_ERROR="mediaError",H.KEY_SYSTEM_ERROR="keySystemError",H.MUX_ERROR="muxError",H.OTHER_ERROR="otherError"})(W||(W={}));var r;(function(H){H.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",H.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",H.KEY_SYSTEM_NO_SESSION="keySystemNoSession",H.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",H.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",H.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",H.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",H.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",H.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",H.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",H.MANIFEST_LOAD_ERROR="manifestLoadError",H.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",H.MANIFEST_PARSING_ERROR="manifestParsingError",H.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",H.LEVEL_EMPTY_ERROR="levelEmptyError",H.LEVEL_LOAD_ERROR="levelLoadError",H.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",H.LEVEL_SWITCH_ERROR="levelSwitchError",H.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",H.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",H.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",H.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",H.FRAG_LOAD_ERROR="fragLoadError",H.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",H.FRAG_DECRYPT_ERROR="fragDecryptError",H.FRAG_PARSING_ERROR="fragParsingError",H.REMUX_ALLOC_ERROR="remuxAllocError",H.KEY_LOAD_ERROR="keyLoadError",H.KEY_LOAD_TIMEOUT="keyLoadTimeOut",H.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",H.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",H.BUFFER_APPEND_ERROR="bufferAppendError",H.BUFFER_APPENDING_ERROR="bufferAppendingError",H.BUFFER_STALLED_ERROR="bufferStalledError",H.BUFFER_FULL_ERROR="bufferFullError",H.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",H.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",H.INTERNAL_EXCEPTION="internalException",H.INTERNAL_ABORTED="aborted",H.UNKNOWN="unknown"})(r||(r={}))},"./src/events.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{Events:()=>W});var W;(function(r){r.MEDIA_ATTACHING="hlsMediaAttaching",r.MEDIA_ATTACHED="hlsMediaAttached",r.MEDIA_DETACHING="hlsMediaDetaching",r.MEDIA_DETACHED="hlsMediaDetached",r.BUFFER_RESET="hlsBufferReset",r.BUFFER_CODECS="hlsBufferCodecs",r.BUFFER_CREATED="hlsBufferCreated",r.BUFFER_APPENDING="hlsBufferAppending",r.BUFFER_APPENDED="hlsBufferAppended",r.BUFFER_EOS="hlsBufferEos",r.BUFFER_FLUSHING="hlsBufferFlushing",r.BUFFER_FLUSHED="hlsBufferFlushed",r.MANIFEST_LOADING="hlsManifestLoading",r.MANIFEST_LOADED="hlsManifestLoaded",r.MANIFEST_PARSED="hlsManifestParsed",r.LEVEL_SWITCHING="hlsLevelSwitching",r.LEVEL_SWITCHED="hlsLevelSwitched",r.LEVEL_LOADING="hlsLevelLoading",r.LEVEL_LOADED="hlsLevelLoaded",r.LEVEL_UPDATED="hlsLevelUpdated",r.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",r.LEVELS_UPDATED="hlsLevelsUpdated",r.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",r.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",r.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",r.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",r.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",r.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",r.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",r.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",r.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",r.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",r.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",r.CUES_PARSED="hlsCuesParsed",r.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",r.INIT_PTS_FOUND="hlsInitPtsFound",r.FRAG_LOADING="hlsFragLoading",r.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",r.FRAG_LOADED="hlsFragLoaded",r.FRAG_DECRYPTED="hlsFragDecrypted",r.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",r.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",r.FRAG_PARSING_METADATA="hlsFragParsingMetadata",r.FRAG_PARSED="hlsFragParsed",r.FRAG_BUFFERED="hlsFragBuffered",r.FRAG_CHANGED="hlsFragChanged",r.FPS_DROP="hlsFpsDrop",r.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",r.ERROR="hlsError",r.DESTROYING="hlsDestroying",r.KEY_LOADING="hlsKeyLoading",r.KEY_LOADED="hlsKeyLoaded",r.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",r.BACK_BUFFER_REACHED="hlsBackBufferReached"})(W||(W={}))},"./src/hls.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>S});var W=F("./node_modules/url-toolkit/src/url-toolkit.js"),r=F.n(W),H=F("./src/loader/playlist-loader.ts"),D=F("./src/controller/id3-track-controller.ts"),M=F("./src/controller/latency-controller.ts"),g=F("./src/controller/level-controller.ts"),p=F("./src/controller/fragment-tracker.ts"),u=F("./src/loader/key-loader.ts"),m=F("./src/controller/stream-controller.ts"),b=F("./src/is-supported.ts"),E=F("./src/utils/logger.ts"),_=F("./src/config.ts"),f=F("./node_modules/eventemitter3/index.js"),O=F.n(f),w=F("./src/events.ts"),R=F("./src/errors.ts"),x=F("./src/types/level.ts");function I(C,c){for(var o=0;o<c.length;o++){var v=c[o];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(C,A(v.key),v)}}function k(C,c,o){return c&&I(C.prototype,c),o&&I(C,o),Object.defineProperty(C,"prototype",{writable:!1}),C}function A(C){var c=P(C,"string");return typeof c=="symbol"?c:String(c)}function P(C,c){if(typeof C!="object"||C===null)return C;var o=C[Symbol.toPrimitive];if(o!==void 0){var v=o.call(C,c||"default");if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(C)}var S=function(){C.isSupported=function(){return(0,b.isSupported)()};function C(o){o===void 0&&(o={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new f.EventEmitter,this._autoLevelCapping=void 0,this._maxHdcpLevel=null,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 v=this.config=(0,_.mergeConfig)(C.DefaultConfig,o);this.userConfig=o,(0,E.enableLogs)(v.debug,"Hls instance"),this._autoLevelCapping=-1,v.progressive&&(0,_.enableStreamingMode)(v);var l=v.abrController,a=v.bufferController,T=v.capLevelController,h=v.fpsController,n=this.abrController=new l(this),N=this.bufferController=new a(this),U=this.capLevelController=new T(this),j=new h(this),Y=new H.default(this),J=new D.default(this),ee=this.levelController=new g.default(this),ie=new p.FragmentTracker(this),re=new u.default(this.config),he=this.streamController=new m.default(this,ie,re);U.setStreamController(he),j.setStreamController(he);var oe=[Y,ee,he];this.networkControllers=oe;var ae=[n,N,U,j,J,ie];this.audioTrackController=this.createController(v.audioTrackController,oe);var Ee=v.audioStreamController;Ee&&oe.push(new Ee(this,ie,re)),this.subtitleTrackController=this.createController(v.subtitleTrackController,oe);var Le=v.subtitleStreamController;Le&&oe.push(new Le(this,ie,re)),this.createController(v.timelineController,ae),re.emeController=this.emeController=this.createController(v.emeController,ae),this.cmcdController=this.createController(v.cmcdController,ae),this.latencyController=this.createController(M.default,ae),this.coreComponents=ae}var c=C.prototype;return c.createController=function(v,l){if(v){var a=new v(this);return l&&l.push(a),a}return null},c.on=function(v,l,a){a===void 0&&(a=this),this._emitter.on(v,l,a)},c.once=function(v,l,a){a===void 0&&(a=this),this._emitter.once(v,l,a)},c.removeAllListeners=function(v){this._emitter.removeAllListeners(v)},c.off=function(v,l,a,T){a===void 0&&(a=this),this._emitter.off(v,l,a,T)},c.listeners=function(v){return this._emitter.listeners(v)},c.emit=function(v,l,a){return this._emitter.emit(v,l,a)},c.trigger=function(v,l){if(this.config.debug)return this.emit(v,v,l);try{return this.emit(v,v,l)}catch(a){E.logger.error("An internal error happened while handling event "+v+'. Error message: "'+a.message+'". Here is a stacktrace:',a),this.trigger(w.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:v,error:a})}return!1},c.listenerCount=function(v){return this._emitter.listenerCount(v)},c.destroy=function(){E.logger.log("destroy"),this.trigger(w.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(v){return v.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(v){return v.destroy()}),this.coreComponents.length=0},c.attachMedia=function(v){E.logger.log("attachMedia"),this._media=v,this.trigger(w.Events.MEDIA_ATTACHING,{media:v})},c.detachMedia=function(){E.logger.log("detachMedia"),this.trigger(w.Events.MEDIA_DETACHING,void 0),this._media=null},c.loadSource=function(v){this.stopLoad();var l=this.media,a=this.url,T=this.url=W.buildAbsoluteURL(self.location.href,v,{alwaysNormalize:!0});E.logger.log("loadSource:"+T),l&&a&&a!==T&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(l)),this.trigger(w.Events.MANIFEST_LOADING,{url:v})},c.startLoad=function(v){v===void 0&&(v=-1),E.logger.log("startLoad("+v+")"),this.networkControllers.forEach(function(l){l.startLoad(v)})},c.stopLoad=function(){E.logger.log("stopLoad"),this.networkControllers.forEach(function(v){v.stopLoad()})},c.swapAudioCodec=function(){E.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},c.recoverMediaError=function(){E.logger.log("recoverMediaError");var v=this._media;this.detachMedia(),v&&this.attachMedia(v)},c.removeLevel=function(v,l){l===void 0&&(l=0),this.levelController.removeLevel(v,l)},k(C,[{key:"levels",get:function(){var v=this.levelController.levels;return v||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(v){E.logger.log("set currentLevel:"+v),this.loadLevel=v,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(v){E.logger.log("set nextLevel:"+v),this.levelController.manualLevel=v,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(v){E.logger.log("set loadLevel:"+v),this.levelController.manualLevel=v}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(v){this.levelController.nextLoadLevel=v}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(v){E.logger.log("set firstLevel:"+v),this.levelController.firstLevel=v}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(v){E.logger.log("set startLevel:"+v),v!==-1&&(v=Math.max(v,this.minAutoLevel)),this.levelController.startLevel=v}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(v){var l=!!v;l!==this.config.capLevelToPlayerSize&&(l?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=l)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(v){this._autoLevelCapping!==v&&(E.logger.log("set autoLevelCapping:"+v),this._autoLevelCapping=v)}},{key:"bandwidthEstimate",get:function(){var v=this.abrController.bwEstimator;return v?v.getEstimate():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(v){x.HdcpLevels.indexOf(v)>-1&&(this._maxHdcpLevel=v)}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var v=this.levels,l=this.config.minAutoBitrate;if(!v)return 0;for(var a=v.length,T=0;T<a;T++)if(v[T].maxBitrate>=l)return T;return 0}},{key:"maxAutoLevel",get:function(){var v=this.levels,l=this.autoLevelCapping,a=this.maxHdcpLevel,T;if(l===-1&&v&&v.length?T=v.length-1:T=l,a)for(var h=T;h--;){var n=v[h].attrs["HDCP-LEVEL"];if(n&&n<=a)return h}return T}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(v){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,v)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var v=this.audioTrackController;return v?v.audioTracks:[]}},{key:"audioTrack",get:function(){var v=this.audioTrackController;return v?v.audioTrack:-1},set:function(v){var l=this.audioTrackController;l&&(l.audioTrack=v)}},{key:"subtitleTracks",get:function(){var v=this.subtitleTrackController;return v?v.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var v=this.subtitleTrackController;return v?v.subtitleTrack:-1},set:function(v){var l=this.subtitleTrackController;l&&(l.subtitleTrack=v)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var v=this.subtitleTrackController;return v?v.subtitleDisplay:!1},set:function(v){var l=this.subtitleTrackController;l&&(l.subtitleDisplay=v)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(v){this.config.lowLatencyMode=v}},{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.3.5"}},{key:"Events",get:function(){return w.Events}},{key:"ErrorTypes",get:function(){return R.ErrorTypes}},{key:"ErrorDetails",get:function(){return R.ErrorDetails}},{key:"DefaultConfig",get:function(){return C.defaultConfig?C.defaultConfig:_.hlsDefaultConfig},set:function(v){C.defaultConfig=v}}]),C}();S.defaultConfig=void 0},"./src/is-supported.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{changeTypeSupported:()=>D,isSupported:()=>H});var W=F("./src/utils/mediasource-helper.ts");function r(){return self.SourceBuffer||self.WebKitSourceBuffer}function H(){var M=(0,W.getMediaSource)();if(!M)return!1;var g=r(),p=M&&typeof M.isTypeSupported=="function"&&M.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),u=!g||g.prototype&&typeof g.prototype.appendBuffer=="function"&&typeof g.prototype.remove=="function";return!!p&&!!u}function D(){var M,g=r();return typeof(g==null||((M=g.prototype)===null||M===void 0)?void 0:M.changeType)=="function"}},"./src/loader/date-range.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{DateRange:()=>b,DateRangeAttribute:()=>m});var W=F("./src/polyfills/number.ts"),r=F("./src/utils/attr-list.ts"),H=F("./src/utils/logger.ts");function D(){return D=Object.assign?Object.assign.bind():function(E){for(var _=1;_<arguments.length;_++){var f=arguments[_];for(var O in f)Object.prototype.hasOwnProperty.call(f,O)&&(E[O]=f[O])}return E},D.apply(this,arguments)}function M(E,_){for(var f=0;f<_.length;f++){var O=_[f];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(E,p(O.key),O)}}function g(E,_,f){return _&&M(E.prototype,_),f&&M(E,f),Object.defineProperty(E,"prototype",{writable:!1}),E}function p(E){var _=u(E,"string");return typeof _=="symbol"?_:String(_)}function u(E,_){if(typeof E!="object"||E===null)return E;var f=E[Symbol.toPrimitive];if(f!==void 0){var O=f.call(E,_||"default");if(typeof O!="object")return O;throw new TypeError("@@toPrimitive must return a primitive value.")}return(_==="string"?String:Number)(E)}var m;(function(E){E.ID="ID",E.CLASS="CLASS",E.START_DATE="START-DATE",E.DURATION="DURATION",E.END_DATE="END-DATE",E.END_ON_NEXT="END-ON-NEXT",E.PLANNED_DURATION="PLANNED-DURATION",E.SCTE35_OUT="SCTE35-OUT",E.SCTE35_IN="SCTE35-IN"})(m||(m={}));var b=function(){function E(_,f){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,f){var O=f.attr;for(var w in O)if(Object.prototype.hasOwnProperty.call(_,w)&&_[w]!==O[w]){H.logger.warn('DATERANGE tag attribute: "'+w+'" does not match for tags with ID: "'+_.ID+'"'),this._badValueForSameId=w;break}_=D(new r.AttrList({}),O,_)}if(this.attr=_,this._startDate=new Date(_[m.START_DATE]),m.END_DATE in this.attr){var R=new Date(this.attr[m.END_DATE]);(0,W.isFiniteNumber)(R.getTime())&&(this._endDate=R)}}return g(E,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){if(this._endDate)return this._endDate;var f=this.duration;return f!==null?new Date(this._startDate.getTime()+f*1e3):null}},{key:"duration",get:function(){if(m.DURATION in this.attr){var f=this.attr.decimalFloatingPoint(m.DURATION);if((0,W.isFiniteNumber)(f))return f}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return m.PLANNED_DURATION in this.attr?this.attr.decimalFloatingPoint(m.PLANNED_DURATION):null}},{key:"endOnNext",get:function(){return this.attr.bool(m.END_ON_NEXT)}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&(0,W.isFiniteNumber)(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),E}()},"./src/loader/fragment-loader.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{LoadError:()=>f,default:()=>E});var W=F("./src/polyfills/number.ts"),r=F("./src/errors.ts");function H(O,w){O.prototype=Object.create(w.prototype),O.prototype.constructor=O,u(O,w)}function D(O){var w=typeof Map=="function"?new Map:void 0;return D=function(x){if(x===null||!p(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(x))return w.get(x);w.set(x,I)}function I(){return M(x,arguments,m(this).constructor)}return I.prototype=Object.create(x.prototype,{constructor:{value:I,enumerable:!1,writable:!0,configurable:!0}}),u(I,x)},D(O)}function M(O,w,R){return g()?M=Reflect.construct.bind():M=function(I,k,A){var P=[null];P.push.apply(P,k);var S=Function.bind.apply(I,P),C=new S;return A&&u(C,A.prototype),C},M.apply(null,arguments)}function g(){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(O){return!1}}function p(O){return Function.toString.call(O).indexOf("[native code]")!==-1}function u(O,w){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,I){return x.__proto__=I,x},u(O,w)}function m(O){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(R){return R.__proto__||Object.getPrototypeOf(R)},m(O)}var b=Math.pow(2,17),E=function(){function O(R){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=R}var w=O.prototype;return w.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},w.abort=function(){this.loader&&this.loader.abort()},w.load=function(x,I){var k=this,A=x.url;if(!A)return Promise.reject(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:x,networkDetails:null},"Fragment does not have a "+(A?"part list":"url")));this.abort();var P=this.config,S=P.fLoader,C=P.loader;return new Promise(function(c,o){k.loader&&k.loader.destroy();var v=k.loader=x.loader=S?new S(P):new C(P),l=_(x),a={timeout:P.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:P.fragLoadingMaxRetryTimeout,highWaterMark:x.sn==="initSegment"?Infinity:b};x.stats=v.stats,v.load(l,a,{onSuccess:function(h,n,N,U){k.resetLoader(x,v);var j=h.data;N.resetIV&&x.decryptdata&&(x.decryptdata.iv=new Uint8Array(j.slice(0,16)),j=j.slice(16)),c({frag:x,part:null,payload:j,networkDetails:U})},onError:function(h,n,N){k.resetLoader(x,v),o(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:x,response:h,networkDetails:N}))},onAbort:function(h,n,N){k.resetLoader(x,v),o(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:x,networkDetails:N}))},onTimeout:function(h,n,N){k.resetLoader(x,v),o(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:x,networkDetails:N}))},onProgress:function(h,n,N,U){I&&I({frag:x,part:null,payload:N,networkDetails:U})}})})},w.loadPart=function(x,I,k){var A=this;this.abort();var P=this.config,S=P.fLoader,C=P.loader;return new Promise(function(c,o){A.loader&&A.loader.destroy();var v=A.loader=x.loader=S?new S(P):new C(P),l=_(x,I),a={timeout:P.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:P.fragLoadingMaxRetryTimeout,highWaterMark:b};I.stats=v.stats,v.load(l,a,{onSuccess:function(h,n,N,U){A.resetLoader(x,v),A.updateStatsFromPart(x,I);var j={frag:x,part:I,payload:h.data,networkDetails:U};k(j),c(j)},onError:function(h,n,N){A.resetLoader(x,v),o(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:x,part:I,response:h,networkDetails:N}))},onAbort:function(h,n,N){x.stats.aborted=I.stats.aborted,A.resetLoader(x,v),o(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:x,part:I,networkDetails:N}))},onTimeout:function(h,n,N){A.resetLoader(x,v),o(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:x,part:I,networkDetails:N}))}})})},w.updateStatsFromPart=function(x,I){var k=x.stats,A=I.stats,P=A.total;if(k.loaded+=A.loaded,P){var S=Math.round(x.duration/I.duration),C=Math.min(Math.round(k.loaded/P),S),c=S-C,o=c*Math.round(k.loaded/C);k.total=k.loaded+o}else k.total=Math.max(k.loaded,k.total);var v=k.loading,l=A.loading;v.start?v.first+=l.first-l.start:(v.start=l.start,v.first=l.first),v.end=l.end},w.resetLoader=function(x,I){x.loader=null,this.loader===I&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),I.destroy()},O}();function _(O,w){w===void 0&&(w=null);var R=w||O,x={frag:O,part:w,responseType:"arraybuffer",url:R.url,headers:{},rangeStart:0,rangeEnd:0},I=R.byteRangeStartOffset,k=R.byteRangeEndOffset;if((0,W.isFiniteNumber)(I)&&(0,W.isFiniteNumber)(k)){var A,P=I,S=k;if(O.sn==="initSegment"&&((A=O.decryptdata)===null||A===void 0?void 0:A.method)==="AES-128"){var C=k-I;C%16&&(S=k+(16-C%16)),I!==0&&(x.resetIV=!0,P=I-16)}x.rangeStart=P,x.rangeEnd=S}return x}var f=function(O){H(w,O);function w(R){for(var x,I=arguments.length,k=new Array(I>1?I-1:0),A=1;A<I;A++)k[A-1]=arguments[A];return x=O.call.apply(O,[this].concat(k))||this,x.data=void 0,x.data=R,x}return w}(D(Error))},"./src/loader/fragment.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{BaseSegment:()=>_,ElementaryStreamTypes:()=>E,Fragment:()=>f,Part:()=>O});var W=F("./src/polyfills/number.ts"),r=F("./node_modules/url-toolkit/src/url-toolkit.js"),H=F.n(r),D=F("./src/loader/load-stats.ts");function M(w,R){w.prototype=Object.create(R.prototype),w.prototype.constructor=w,g(w,R)}function g(w,R){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(I,k){return I.__proto__=k,I},g(w,R)}function p(w,R){for(var x=0;x<R.length;x++){var I=R[x];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(w,m(I.key),I)}}function u(w,R,x){return R&&p(w.prototype,R),x&&p(w,x),Object.defineProperty(w,"prototype",{writable:!1}),w}function m(w){var R=b(w,"string");return typeof R=="symbol"?R:String(R)}function b(w,R){if(typeof w!="object"||w===null)return w;var x=w[Symbol.toPrimitive];if(x!==void 0){var I=x.call(w,R||"default");if(typeof I!="object")return I;throw new TypeError("@@toPrimitive must return a primitive value.")}return(R==="string"?String:Number)(w)}var E;(function(w){w.AUDIO="audio",w.VIDEO="video",w.AUDIOVIDEO="audiovideo"})(E||(E={}));var _=function(){function w(x){var I;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(I={},I[E.AUDIO]=null,I[E.VIDEO]=null,I[E.AUDIOVIDEO]=null,I),this.baseurl=x}var R=w.prototype;return R.setByteRange=function(I,k){var A=I.split("@",2),P=[];A.length===1?P[0]=k?k.byteRangeEndOffset:0:P[0]=parseInt(A[1]),P[1]=parseInt(A[0])+P[0],this._byteRange=P},u(w,[{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=(0,r.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(I){this._url=I}}]),w}(),f=function(w){M(R,w);function R(I,k){var A;return A=w.call(this,k)||this,A._decryptdata=null,A.rawProgramDateTime=null,A.programDateTime=null,A.tagList=[],A.duration=0,A.sn=0,A.levelkeys=void 0,A.type=void 0,A.loader=null,A.keyLoader=null,A.level=-1,A.cc=0,A.startPTS=void 0,A.endPTS=void 0,A.appendedPTS=void 0,A.startDTS=void 0,A.endDTS=void 0,A.start=0,A.deltaPTS=void 0,A.maxStartPTS=void 0,A.minEndPTS=void 0,A.stats=new D.LoadStats,A.urlId=0,A.data=void 0,A.bitrateTest=!1,A.title=null,A.initSegment=null,A.endList=void 0,A.type=I,A}var x=R.prototype;return x.setKeyFormat=function(k){if(this.levelkeys){var A=this.levelkeys[k];A&&!this._decryptdata&&(this._decryptdata=A.getDecryptData(this.sn))}},x.abortRequests=function(){var k,A;(k=this.loader)===null||k===void 0||k.abort(),(A=this.keyLoader)===null||A===void 0||A.abort()},x.setElementaryStreamInfo=function(k,A,P,S,C,c){c===void 0&&(c=!1);var o=this.elementaryStreams,v=o[k];if(!v){o[k]={startPTS:A,endPTS:P,startDTS:S,endDTS:C,partial:c};return}v.startPTS=Math.min(v.startPTS,A),v.endPTS=Math.max(v.endPTS,P),v.startDTS=Math.min(v.startDTS,S),v.endDTS=Math.max(v.endDTS,C)},x.clearElementaryStreamInfo=function(){var k=this.elementaryStreams;k[E.AUDIO]=null,k[E.VIDEO]=null,k[E.AUDIOVIDEO]=null},u(R,[{key:"decryptdata",get:function(){var k=this.levelkeys;if(!k&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var A=this.levelkeys.identity;if(A)this._decryptdata=A.getDecryptData(this.sn);else{var P=Object.keys(this.levelkeys);if(P.length===1)return this._decryptdata=this.levelkeys[P[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!(0,W.isFiniteNumber)(this.programDateTime))return null;var k=(0,W.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+k*1e3}},{key:"encrypted",get:function(){var k;if((k=this._decryptdata)!==null&&k!==void 0&&k.encrypted)return!0;if(this.levelkeys){var A=Object.keys(this.levelkeys),P=A.length;if(P>1||P===1&&this.levelkeys[A[0]].encrypted)return!0}return!1}}]),R}(_),O=function(w){M(R,w);function R(x,I,k,A,P){var S;S=w.call(this,k)||this,S.fragOffset=0,S.duration=0,S.gap=!1,S.independent=!1,S.relurl=void 0,S.fragment=void 0,S.index=void 0,S.stats=new D.LoadStats,S.duration=x.decimalFloatingPoint("DURATION"),S.gap=x.bool("GAP"),S.independent=x.bool("INDEPENDENT"),S.relurl=x.enumeratedString("URI"),S.fragment=I,S.index=A;var C=x.enumeratedString("BYTERANGE");return C&&S.setByteRange(C,P),P&&(S.fragOffset=P.fragOffset+P.duration),S}return u(R,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var I=this.elementaryStreams;return!!(I.audio||I.video||I.audiovideo)}}]),R}(_)},"./src/loader/key-loader.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>H});var W=F("./src/errors.ts"),r=F("./src/loader/fragment-loader.ts"),H=function(){function D(g){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=g}var M=D.prototype;return M.abort=function(){for(var p in this.keyUriToKeyInfo){var u=this.keyUriToKeyInfo[p].loader;u&&u.abort()}},M.detach=function(){for(var p in this.keyUriToKeyInfo){var u=this.keyUriToKeyInfo[p];(u.mediaKeySessionContext||u.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[p]}},M.destroy=function(){this.detach();for(var p in this.keyUriToKeyInfo){var u=this.keyUriToKeyInfo[p].loader;u&&u.destroy()}this.keyUriToKeyInfo={}},M.createKeyLoadError=function(p,u,m,b){return u===void 0&&(u=W.ErrorDetails.KEY_LOAD_ERROR),new r.LoadError({type:W.ErrorTypes.NETWORK_ERROR,details:u,fatal:!1,frag:p,networkDetails:m})},M.loadClear=function(p,u){var m=this;if(this.emeController&&this.config.emeEnabled)for(var b=p.sn,E=p.cc,_=function(R){var x=u[R];if(E<=x.cc&&(b==="initSegment"||b<x.sn))return m.emeController.selectKeySystemFormat(x).then(function(I){x.setKeyFormat(I)}),"break"},f=0;f<u.length;f++){var O=_(f);if(O==="break")break}},M.load=function(p){var u=this;return!p.decryptdata&&p.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(p).then(function(m){return u.loadInternal(p,m)}):this.loadInternal(p)},M.loadInternal=function(p,u){var m,b;u&&p.setKeyFormat(u);var E=p.decryptdata;if(!E){var _=u?"Expected frag.decryptdata to be defined after setting format "+u:"Missing decryption data on fragment in onKeyLoading";return Promise.reject(this.createKeyLoadError(p,W.ErrorDetails.KEY_LOAD_ERROR,null,_))}var f=E.uri;if(!f)return Promise.reject(this.createKeyLoadError(p,W.ErrorDetails.KEY_LOAD_ERROR,null,'Invalid key URI: "'+f+'"'));var O=this.keyUriToKeyInfo[f];if((m=O)!==null&&m!==void 0&&m.decryptdata.key)return E.key=O.decryptdata.key,Promise.resolve({frag:p,keyInfo:O});if((b=O)!==null&&b!==void 0&&b.keyLoadPromise){var w;switch((w=O.mediaKeySessionContext)===null||w===void 0?void 0:w.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return O.keyLoadPromise.then(function(R){return E.key=R.keyInfo.decryptdata.key,{frag:p,keyInfo:O}})}}O=this.keyUriToKeyInfo[f]={decryptdata:E,keyLoadPromise:null,loader:null,mediaKeySessionContext:null};switch(E.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return E.keyFormat==="identity"?this.loadKeyHTTP(O,p):this.loadKeyEME(O,p);case"AES-128":return this.loadKeyHTTP(O,p);default:return Promise.reject(this.createKeyLoadError(p,W.ErrorDetails.KEY_LOAD_ERROR,null,'Key supplied with unsupported METHOD: "'+E.method+'"'))}},M.loadKeyEME=function(p,u){var m={frag:u,keyInfo:p};if(this.emeController&&this.config.emeEnabled){var b=this.emeController.loadKey(m);if(b)return(p.keyLoadPromise=b.then(function(E){return p.mediaKeySessionContext=E,m})).catch(function(E){throw p.keyLoadPromise=null,E})}return Promise.resolve(m)},M.loadKeyHTTP=function(p,u){var m=this,b=this.config,E=b.loader,_=new E(b);return u.keyLoader=p.loader=_,p.keyLoadPromise=new Promise(function(f,O){var w={keyInfo:p,frag:u,responseType:"arraybuffer",url:p.decryptdata.uri},R={timeout:b.fragLoadingTimeOut,maxRetry:0,retryDelay:b.fragLoadingRetryDelay,maxRetryDelay:b.fragLoadingMaxRetryTimeout,highWaterMark:0},x={onSuccess:function(k,A,P,S){var C=P.frag,c=P.keyInfo,o=P.url;if(!C.decryptdata||c!==m.keyUriToKeyInfo[o])return O(m.createKeyLoadError(C,W.ErrorDetails.KEY_LOAD_ERROR,S,"after key load, decryptdata unset or changed"));c.decryptdata.key=C.decryptdata.key=new Uint8Array(k.data),C.keyLoader=null,c.loader=null,f({frag:C,keyInfo:c})},onError:function(k,A,P){m.resetLoader(A),O(m.createKeyLoadError(u,W.ErrorDetails.KEY_LOAD_ERROR,P))},onTimeout:function(k,A,P){m.resetLoader(A),O(m.createKeyLoadError(u,W.ErrorDetails.KEY_LOAD_TIMEOUT,P))},onAbort:function(k,A,P){m.resetLoader(A),O(m.createKeyLoadError(u,W.ErrorDetails.INTERNAL_ABORTED,P))}};_.load(w,R,x)})},M.resetLoader=function(p){var u=p.frag,m=p.keyInfo,b=p.url,E=m.loader;u.keyLoader===E&&(u.keyLoader=null,m.loader=null),delete this.keyUriToKeyInfo[b],E&&E.destroy()},D}()},"./src/loader/level-details.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{LevelDetails:()=>p});var W=F("./src/polyfills/number.ts");function r(u,m){for(var b=0;b<m.length;b++){var E=m[b];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(u,D(E.key),E)}}function H(u,m,b){return m&&r(u.prototype,m),b&&r(u,b),Object.defineProperty(u,"prototype",{writable:!1}),u}function D(u){var m=M(u,"string");return typeof m=="symbol"?m:String(m)}function M(u,m){if(typeof u!="object"||u===null)return u;var b=u[Symbol.toPrimitive];if(b!==void 0){var E=b.call(u,m||"default");if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return(m==="string"?String:Number)(u)}var g=10,p=function(){function u(b){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.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,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.encryptedFragments=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=b}var m=u.prototype;return m.reloaded=function(E){if(!E){this.advanced=!0,this.updated=!0;return}var _=this.lastPartSn-E.lastPartSn,f=this.lastPartIndex-E.lastPartIndex;this.updated=this.endSN!==E.endSN||!!f||!!_,this.advanced=this.endSN>E.endSN||_>0||_===0&&f>0,this.updated||this.advanced?this.misses=Math.floor(E.misses*.6):this.misses=E.misses+1,this.availabilityDelay=E.availabilityDelay},H(u,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?(0,W.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||g}},{key:"drift",get:function(){var E=this.driftEndTime-this.driftStartTime;if(E>0){var _=this.driftEnd-this.driftStart;return _*1e3/E}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var E;return(E=this.partList)!==null&&E!==void 0&&E.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var E;return(E=this.fragments)!==null&&E!==void 0&&E.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 E;return(E=this.partList)!==null&&E!==void 0&&E.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var E;return(E=this.partList)!==null&&E!==void 0&&E.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),u}()},"./src/loader/level-key.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{LevelKey:()=>p});var W=F("./src/utils/keysystem-util.ts"),r=F("./src/utils/mediakeys-helper.ts"),H=F("./src/utils/mp4-tools.ts"),D=F("./src/utils/logger.ts"),M=F("./src/utils/numeric-encoding-utils.ts"),g={},p=function(){m.clearKeyUriToKeyIdMap=function(){g={}};function m(E,_,f,O,w){O===void 0&&(O=[1]),w===void 0&&(w=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=E,this.uri=_,this.keyFormat=f,this.keyFormatVersions=O,this.iv=w,this.encrypted=E?E!=="NONE":!1,this.isCommonEncryption=this.encrypted&&E!=="AES-128"}var b=m.prototype;return b.isSupported=function(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;switch(this.keyFormat){case"identity":return this.method==="SAMPLE-AES";case r.KeySystemFormats.FAIRPLAY:case r.KeySystemFormats.WIDEVINE:case r.KeySystemFormats.PLAYREADY:case r.KeySystemFormats.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1},b.getDecryptData=function(_){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof _!="number"&&(this.method==="AES-128"&&!this.iv&&D.logger.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),_=0);var f=u(_),O=new m(this.method,this.uri,"identity",this.keyFormatVersions,f);return O}var w=(0,W.convertDataUriToArrayBytes)(this.uri);if(w)switch(this.keyFormat){case r.KeySystemFormats.WIDEVINE:this.pssh=w,w.length>=22&&(this.keyId=w.subarray(w.length-22,w.length-6));break;case r.KeySystemFormats.PLAYREADY:{var R=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=(0,H.mp4pssh)(R,null,w);var x=new Uint16Array(w.buffer,w.byteOffset,w.byteLength/2),I=String.fromCharCode.apply(null,Array.from(x)),k=I.substring(I.indexOf("<"),I.length),A=new DOMParser,P=A.parseFromString(k,"text/xml"),S=P.getElementsByTagName("KID")[0];if(S){var C=S.childNodes[0]?S.childNodes[0].nodeValue:S.getAttribute("VALUE");if(C){var c=(0,M.base64Decode)(C).subarray(0,16);(0,W.changeEndianness)(c),this.keyId=c}}break}default:{var o=w.subarray(0,16);if(o.length!==16){var v=new Uint8Array(16);v.set(o,16-o.length),o=v}this.keyId=o;break}}if(!this.keyId||this.keyId.byteLength!==16){var l=g[this.uri];if(!l){var a=Object.keys(g).length%Number.MAX_SAFE_INTEGER;l=new Uint8Array(16);var T=new DataView(l.buffer,12,4);T.setUint32(0,a),g[this.uri]=l}this.keyId=l}return this},m}();function u(m){for(var b=new Uint8Array(16),E=12;E<16;E++)b[E]=m>>8*(15-E)&255;return b}},"./src/loader/load-stats.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{LoadStats:()=>W});var W=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":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>R});var W=F("./src/polyfills/number.ts"),r=F("./node_modules/url-toolkit/src/url-toolkit.js"),H=F.n(r),D=F("./src/loader/date-range.ts"),M=F("./src/loader/fragment.ts"),g=F("./src/loader/level-details.ts"),p=F("./src/loader/level-key.ts"),u=F("./src/utils/attr-list.ts"),m=F("./src/utils/logger.ts"),b=F("./src/utils/codecs.ts");function E(){return E=Object.assign?Object.assign.bind():function(c){for(var o=1;o<arguments.length;o++){var v=arguments[o];for(var l in v)Object.prototype.hasOwnProperty.call(v,l)&&(c[l]=v[l])}return c},E.apply(this,arguments)}var _=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+|#EXT-X-SESSION-KEY:([^\n\r]*)[\r\n]+/g,f=/#EXT-X-MEDIA:(.*)/g,O=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),w=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),R=function(){function c(){}return c.findGroup=function(v,l){for(var a=0;a<v.length;a++){var T=v[a];if(T.id===l)return T}},c.convertAVC1ToAVCOTI=function(v){var l=v.split(".");if(l.length>2){var a=l.shift()+".";return a+=parseInt(l.shift()).toString(16),a+=("000"+parseInt(l.shift()).toString(16)).slice(-4),a}return v},c.resolve=function(v,l){return(0,r.buildAbsoluteURL)(l,v,{alwaysNormalize:!0})},c.parseMasterPlaylist=function(v,l){var a=[],T=[],h={},n=[],N=!1;_.lastIndex=0;for(var U;(U=_.exec(v))!=null;)if(U[1]){var j,Y=new u.AttrList(U[1]),J={attrs:Y,bitrate:Y.decimalInteger("AVERAGE-BANDWIDTH")||Y.decimalInteger("BANDWIDTH"),name:Y.NAME,url:c.resolve(U[2],l)},ee=Y.decimalResolution("RESOLUTION");ee&&(J.width=ee.width,J.height=ee.height),I((Y.CODECS||"").split(/[ ,]+/).filter(function(ae){return ae}),J),J.videoCodec&&J.videoCodec.indexOf("avc1")!==-1&&(J.videoCodec=c.convertAVC1ToAVCOTI(J.videoCodec)),(j=J.unknownCodecs)!==null&&j!==void 0&&j.length||T.push(J),a.push(J)}else if(U[3]){var ie=new u.AttrList(U[3]);ie["DATA-ID"]&&(N=!0,h[ie["DATA-ID"]]=ie)}else if(U[4]){var re=U[4],he=x(re,l);he.encrypted&&he.isSupported()?n.push(he):m.logger.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+re+'"')}var oe=T.length>0&&T.length<a.length;return{levels:oe?T:a,sessionData:N?h:null,sessionKeys:n.length?n:null}},c.parseMasterPlaylistMedia=function(v,l,a,T){T===void 0&&(T=[]);var h,n=[],N=0;for(f.lastIndex=0;(h=f.exec(v))!==null;){var U=new u.AttrList(h[1]);if(U.TYPE===a){var j={attrs:U,bitrate:0,id:N++,groupId:U["GROUP-ID"],instreamId:U["INSTREAM-ID"],name:U.NAME||U.LANGUAGE||"",type:a,default:U.bool("DEFAULT"),autoselect:U.bool("AUTOSELECT"),forced:U.bool("FORCED"),lang:U.LANGUAGE,url:U.URI?c.resolve(U.URI,l):""};if(T.length){var Y=c.findGroup(T,j.groupId)||T[0];k(j,Y,"audioCodec"),k(j,Y,"textCodec")}n.push(j)}}return n},c.parseLevelPlaylist=function(v,l,a,T,h){var n=new g.LevelDetails(l),N=n.fragments,U=null,j=0,Y=0,J=0,ee=0,ie=null,re=new M.Fragment(T,l),he,oe,ae,Ee=-1,Le=!1;for(O.lastIndex=0,n.m3u8=v;(he=O.exec(v))!==null;){Le&&(Le=!1,re=new M.Fragment(T,l),re.start=J,re.sn=j,re.cc=ee,re.level=a,U&&(re.initSegment=U,re.rawProgramDateTime=U.rawProgramDateTime,U.rawProgramDateTime=null));var Fe=he[1];if(Fe){re.duration=parseFloat(Fe);var Xe=(" "+he[2]).slice(1);re.title=Xe||null,re.tagList.push(Xe?["INF",Fe,Xe]:["INF",Fe])}else if(he[3])(0,W.isFiniteNumber)(re.duration)&&(re.start=J,ae&&C(re,ae,n),re.sn=j,re.level=a,re.cc=ee,re.urlId=h,N.push(re),re.relurl=(" "+he[3]).slice(1),P(re,ie),ie=re,J+=re.duration,j++,Y=0,Le=!0);else if(he[4]){var He=(" "+he[4]).slice(1);ie?re.setByteRange(He,ie):re.setByteRange(He)}else if(he[5])re.rawProgramDateTime=(" "+he[5]).slice(1),re.tagList.push(["PROGRAM-DATE-TIME",re.rawProgramDateTime]),Ee===-1&&(Ee=N.length);else{if(he=he[0].match(w),!he){m.logger.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<he.length&&!(typeof he[oe]!="undefined");oe++);var Ae=(" "+he[oe]).slice(1),Oe=(" "+he[oe+1]).slice(1),Ke=he[oe+2]?(" "+he[oe+2]).slice(1):"";switch(Ae){case"PLAYLIST-TYPE":n.type=Oe.toUpperCase();break;case"MEDIA-SEQUENCE":j=n.startSN=parseInt(Oe);break;case"SKIP":{var de=new u.AttrList(Oe),xe=de.decimalInteger("SKIPPED-SEGMENTS");if((0,W.isFiniteNumber)(xe)){n.skippedSegments=xe;for(var Ie=xe;Ie--;)N.unshift(null);j+=xe}var De=de.enumeratedString("RECENTLY-REMOVED-DATERANGES");De&&(n.recentlyRemovedDateranges=De.split(" "));break}case"TARGETDURATION":n.targetduration=parseFloat(Oe);break;case"VERSION":n.version=parseInt(Oe);break;case"EXTM3U":break;case"ENDLIST":n.live=!1;break;case"#":(Oe||Ke)&&re.tagList.push(Ke?[Oe,Ke]:[Oe]);break;case"DISCONTINUITY":ee++,re.tagList.push(["DIS"]);break;case"GAP":re.tagList.push([Ae]);break;case"BITRATE":re.tagList.push([Ae,Oe]);break;case"DATERANGE":{var Be=new u.AttrList(Oe),ze=new D.DateRange(Be,n.dateRanges[Be.ID]);ze.isValid||n.skippedSegments?n.dateRanges[ze.id]=ze:m.logger.warn('Ignoring invalid DATERANGE tag: "'+Oe+'"'),re.tagList.push(["EXT-X-DATERANGE",Oe]);break}case"DISCONTINUITY-SEQUENCE":ee=parseInt(Oe);break;case"KEY":{var Ye=x(Oe,l);if(Ye.isSupported()){if(Ye.method==="NONE"){ae=void 0;break}ae||(ae={}),ae[Ye.keyFormat]&&(ae=E({},ae)),ae[Ye.keyFormat]=Ye}else m.logger.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+Oe+'"');break}case"START":{var Ze=new u.AttrList(Oe),ut=Ze.decimalFloatingPoint("TIME-OFFSET");(0,W.isFiniteNumber)(ut)&&(n.startTimeOffset=ut);break}case"MAP":{var Qe=new u.AttrList(Oe);if(re.duration){var st=new M.Fragment(T,l);S(st,Qe,a,ae),U=st,re.initSegment=U,U.rawProgramDateTime&&!re.rawProgramDateTime&&(re.rawProgramDateTime=U.rawProgramDateTime)}else S(re,Qe,a,ae),U=re,Le=!0;break}case"SERVER-CONTROL":{var Ne=new u.AttrList(Oe);n.canBlockReload=Ne.bool("CAN-BLOCK-RELOAD"),n.canSkipUntil=Ne.optionalFloat("CAN-SKIP-UNTIL",0),n.canSkipDateRanges=n.canSkipUntil>0&&Ne.bool("CAN-SKIP-DATERANGES"),n.partHoldBack=Ne.optionalFloat("PART-HOLD-BACK",0),n.holdBack=Ne.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var vt=new u.AttrList(Oe);n.partTarget=vt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ht=n.partList;ht||(ht=n.partList=[]);var Ue=Y>0?ht[ht.length-1]:void 0,Ve=Y++,Ce=new M.Part(new u.AttrList(Oe),re,l,Ve,Ue);ht.push(Ce),re.duration+=Ce.duration;break}case"PRELOAD-HINT":{var _e=new u.AttrList(Oe);n.preloadHint=_e;break}case"RENDITION-REPORT":{var Te=new u.AttrList(Oe);n.renditionReports=n.renditionReports||[],n.renditionReports.push(Te);break}default:m.logger.warn("line parsed but not handled: "+he);break}}}ie&&!ie.relurl?(N.pop(),J-=ie.duration,n.partList&&(n.fragmentHint=ie)):n.partList&&(P(re,ie),re.cc=ee,n.fragmentHint=re,ae&&C(re,ae,n));var ne=N.length,ue=N[0],fe=N[ne-1];if(J+=n.skippedSegments*n.targetduration,J>0&&ne&&fe){n.averagetargetduration=J/ne;var me=fe.sn;n.endSN=me!=="initSegment"?me:0,n.live||(fe.endList=!0),ue&&(n.startCC=ue.cc)}else n.endSN=0,n.startCC=0;return n.fragmentHint&&(J+=n.fragmentHint.duration),n.totalduration=J,n.endCC=ee,Ee>0&&A(N,Ee),n},c}();function x(c,o){var v,l,a=new u.AttrList(c),T=(v=a.enumeratedString("METHOD"))!=null?v:"",h=a.URI,n=a.hexadecimalInteger("IV"),N=a.enumeratedString("KEYFORMATVERSIONS"),U=(l=a.enumeratedString("KEYFORMAT"))!=null?l:"identity";h&&a.IV&&!n&&m.logger.error("Invalid IV: "+a.IV);var j=h?R.resolve(h,o):"",Y=(N||"1").split("/").map(Number).filter(Number.isFinite);return new p.LevelKey(T,j,U,Y,n)}function I(c,o){["video","audio","text"].forEach(function(v){var l=c.filter(function(T){return(0,b.isCodecType)(T,v)});if(l.length){var a=l.filter(function(T){return T.lastIndexOf("avc1",0)===0||T.lastIndexOf("mp4a",0)===0});o[v+"Codec"]=a.length>0?a[0]:l[0],c=c.filter(function(T){return l.indexOf(T)===-1})}}),o.unknownCodecs=c}function k(c,o,v){var l=o[v];l&&(c[v]=l)}function A(c,o){for(var v=c[o],l=o;l--;){var a=c[l];if(!a)return;a.programDateTime=v.programDateTime-a.duration*1e3,v=a}}function P(c,o){c.rawProgramDateTime?c.programDateTime=Date.parse(c.rawProgramDateTime):o!=null&&o.programDateTime&&(c.programDateTime=o.endProgramDateTime),(0,W.isFiniteNumber)(c.programDateTime)||(c.programDateTime=null,c.rawProgramDateTime=null)}function S(c,o,v,l){c.relurl=o.URI,o.BYTERANGE&&c.setByteRange(o.BYTERANGE),c.level=v,c.sn="initSegment",l&&(c.levelkeys=l),c.initSegment=null}function C(c,o,v){c.levelkeys=o;var l=v.encryptedFragments;(!l.length||l[l.length-1].levelkeys!==o)&&Object.keys(o).some(function(a){return o[a].isCommonEncryption})&&l.push(c)}},"./src/loader/playlist-loader.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>E});var W=F("./src/polyfills/number.ts"),r=F("./src/events.ts"),H=F("./src/errors.ts"),D=F("./src/utils/logger.ts"),M=F("./src/loader/m3u8-parser.ts"),g=F("./src/types/loader.ts"),p=F("./src/utils/attr-list.ts");function u(_){var f=_.type;switch(f){case g.PlaylistContextType.AUDIO_TRACK:return g.PlaylistLevelType.AUDIO;case g.PlaylistContextType.SUBTITLE_TRACK:return g.PlaylistLevelType.SUBTITLE;default:return g.PlaylistLevelType.MAIN}}function m(_,f){var O=_.url;return(O===void 0||O.indexOf("data:")===0)&&(O=f.url),O}var b=function(){function _(O){this.hls=void 0,this.loaders=Object.create(null),this.hls=O,this.registerListeners()}var f=_.prototype;return f.startLoad=function(w){},f.stopLoad=function(){this.destroyInternalLoaders()},f.registerListeners=function(){var w=this.hls;w.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(r.Events.LEVEL_LOADING,this.onLevelLoading,this),w.on(r.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),w.on(r.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},f.unregisterListeners=function(){var w=this.hls;w.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(r.Events.LEVEL_LOADING,this.onLevelLoading,this),w.off(r.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),w.off(r.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},f.createInternalLoader=function(w){var R=this.hls.config,x=R.pLoader,I=R.loader,k=x||I,A=new k(R);return w.loader=A,this.loaders[w.type]=A,A},f.getInternalLoader=function(w){return this.loaders[w.type]},f.resetInternalLoader=function(w){this.loaders[w]&&delete this.loaders[w]},f.destroyInternalLoaders=function(){for(var w in this.loaders){var R=this.loaders[w];R&&R.destroy(),this.resetInternalLoader(w)}},f.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},f.onManifestLoading=function(w,R){var x=R.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:g.PlaylistContextType.MANIFEST,url:x,deliveryDirectives:null})},f.onLevelLoading=function(w,R){var x=R.id,I=R.level,k=R.url,A=R.deliveryDirectives;this.load({id:x,groupId:null,level:I,responseType:"text",type:g.PlaylistContextType.LEVEL,url:k,deliveryDirectives:A})},f.onAudioTrackLoading=function(w,R){var x=R.id,I=R.groupId,k=R.url,A=R.deliveryDirectives;this.load({id:x,groupId:I,level:null,responseType:"text",type:g.PlaylistContextType.AUDIO_TRACK,url:k,deliveryDirectives:A})},f.onSubtitleTrackLoading=function(w,R){var x=R.id,I=R.groupId,k=R.url,A=R.deliveryDirectives;this.load({id:x,groupId:I,level:null,responseType:"text",type:g.PlaylistContextType.SUBTITLE_TRACK,url:k,deliveryDirectives:A})},f.load=function(w){var R,x=this.hls.config,I=this.getInternalLoader(w);if(I){var k=I.context;if(k&&k.url===w.url){D.logger.trace("[playlist-loader]: playlist request ongoing");return}D.logger.log("[playlist-loader]: aborting previous loader for type: "+w.type),I.abort()}var A,P,S,C;switch(w.type){case g.PlaylistContextType.MANIFEST:A=x.manifestLoadingMaxRetry,P=x.manifestLoadingTimeOut,S=x.manifestLoadingRetryDelay,C=x.manifestLoadingMaxRetryTimeout;break;case g.PlaylistContextType.LEVEL:case g.PlaylistContextType.AUDIO_TRACK:case g.PlaylistContextType.SUBTITLE_TRACK:A=0,P=x.levelLoadingTimeOut;break;default:A=x.levelLoadingMaxRetry,P=x.levelLoadingTimeOut,S=x.levelLoadingRetryDelay,C=x.levelLoadingMaxRetryTimeout;break}if(I=this.createInternalLoader(w),(R=w.deliveryDirectives)!==null&&R!==void 0&&R.part){var c;if(w.type===g.PlaylistContextType.LEVEL&&w.level!==null?c=this.hls.levels[w.level].details:w.type===g.PlaylistContextType.AUDIO_TRACK&&w.id!==null?c=this.hls.audioTracks[w.id].details:w.type===g.PlaylistContextType.SUBTITLE_TRACK&&w.id!==null&&(c=this.hls.subtitleTracks[w.id].details),c){var o=c.partTarget,v=c.targetduration;o&&v&&(P=Math.min(Math.max(o*3,v*.8)*1e3,P))}}var l={timeout:P,maxRetry:A,retryDelay:S,maxRetryDelay:C,highWaterMark:0},a={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};I.load(w,l,a)},f.loadsuccess=function(w,R,x,I){I===void 0&&(I=null),this.resetInternalLoader(x.type);var k=w.data;if(k.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(w,x,"no EXTM3U delimiter",I);return}R.parsing.start=performance.now(),k.indexOf("#EXTINF:")>0||k.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(w,R,x,I):this.handleMasterPlaylist(w,R,x,I)},f.loaderror=function(w,R,x){x===void 0&&(x=null),this.handleNetworkError(R,x,!1,w)},f.loadtimeout=function(w,R,x){x===void 0&&(x=null),this.handleNetworkError(R,x,!0)},f.handleMasterPlaylist=function(w,R,x,I){var k=this.hls,A=w.data,P=m(w,x),S=M.default.parseMasterPlaylist(A,P),C=S.levels,c=S.sessionData,o=S.sessionKeys;if(!C.length){this.handleManifestParsingError(w,x,"no level found in manifest",I);return}var v=C.map(function(N){return{id:N.attrs.AUDIO,audioCodec:N.audioCodec}}),l=C.map(function(N){return{id:N.attrs.SUBTITLES,textCodec:N.textCodec}}),a=M.default.parseMasterPlaylistMedia(A,P,"AUDIO",v),T=M.default.parseMasterPlaylistMedia(A,P,"SUBTITLES",l),h=M.default.parseMasterPlaylistMedia(A,P,"CLOSED-CAPTIONS");if(a.length){var n=a.some(function(N){return!N.url});!n&&C[0].audioCodec&&!C[0].attrs.AUDIO&&(D.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),a.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new p.AttrList({}),bitrate:0,url:""}))}k.trigger(r.Events.MANIFEST_LOADED,{levels:C,audioTracks:a,subtitles:T,captions:h,url:P,stats:R,networkDetails:I,sessionData:c,sessionKeys:o})},f.handleTrackOrLevelPlaylist=function(w,R,x,I){var k=this.hls,A=x.id,P=x.level,S=x.type,C=m(w,x),c=(0,W.isFiniteNumber)(A)?A:0,o=(0,W.isFiniteNumber)(P)?P:c,v=u(x),l=M.default.parseLevelPlaylist(w.data,C,o,v,c);if(!l.fragments.length){k.trigger(r.Events.ERROR,{type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:C,reason:"no fragments found in level",level:typeof x.level=="number"?x.level:void 0});return}if(S===g.PlaylistContextType.MANIFEST){var a={attrs:new p.AttrList({}),bitrate:0,details:l,name:"",url:C};k.trigger(r.Events.MANIFEST_LOADED,{levels:[a],audioTracks:[],url:C,stats:R,networkDetails:I,sessionData:null,sessionKeys:null})}R.parsing.end=performance.now(),x.levelDetails=l,this.handlePlaylistLoaded(w,R,x,I)},f.handleManifestParsingError=function(w,R,x,I){this.hls.trigger(r.Events.ERROR,{type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:R.type===g.PlaylistContextType.MANIFEST,url:w.url,reason:x,response:w,context:R,networkDetails:I})},f.handleNetworkError=function(w,R,x,I){x===void 0&&(x=!1),D.logger.warn("[playlist-loader]: A network "+(x?"timeout":"error")+" occurred while loading "+w.type+" level: "+w.level+" id: "+w.id+' group-id: "'+w.groupId+'"');var k=H.ErrorDetails.UNKNOWN,A=!1,P=this.getInternalLoader(w);switch(w.type){case g.PlaylistContextType.MANIFEST:k=x?H.ErrorDetails.MANIFEST_LOAD_TIMEOUT:H.ErrorDetails.MANIFEST_LOAD_ERROR,A=!0;break;case g.PlaylistContextType.LEVEL:k=x?H.ErrorDetails.LEVEL_LOAD_TIMEOUT:H.ErrorDetails.LEVEL_LOAD_ERROR,A=!1;break;case g.PlaylistContextType.AUDIO_TRACK:k=x?H.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:H.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,A=!1;break;case g.PlaylistContextType.SUBTITLE_TRACK:k=x?H.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:H.ErrorDetails.SUBTITLE_LOAD_ERROR,A=!1;break}P&&this.resetInternalLoader(w.type);var S={type:H.ErrorTypes.NETWORK_ERROR,details:k,fatal:A,url:w.url,loader:P,context:w,networkDetails:R};I&&(S.response=I),this.hls.trigger(r.Events.ERROR,S)},f.handlePlaylistLoaded=function(w,R,x,I){var k=x.type,A=x.level,P=x.id,S=x.groupId,C=x.loader,c=x.levelDetails,o=x.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(w,x,"invalid target duration",I);return}if(!C)return;c.live&&(C.getCacheAge&&(c.ageHeader=C.getCacheAge()||0),(!C.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(k){case g.PlaylistContextType.MANIFEST:case g.PlaylistContextType.LEVEL:this.hls.trigger(r.Events.LEVEL_LOADED,{details:c,level:A||0,id:P||0,stats:R,networkDetails:I,deliveryDirectives:o});break;case g.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(r.Events.AUDIO_TRACK_LOADED,{details:c,id:P||0,groupId:S||"",stats:R,networkDetails:I,deliveryDirectives:o});break;case g.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(r.Events.SUBTITLE_TRACK_LOADED,{details:c,id:P||0,groupId:S||"",stats:R,networkDetails:I,deliveryDirectives:o});break}},_}();const E=b},"./src/polyfills/number.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{MAX_SAFE_INTEGER:()=>r,isFiniteNumber:()=>W});var W=Number.isFinite||function(H){return typeof H=="number"&&isFinite(H)},r=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>r});var W=function(){function H(){}return H.getSilentFrame=function(M,g){switch(M){case"mp4a.40.2":if(g===1)return new Uint8Array([0,200,0,128,35,128]);if(g===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(g===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(g===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(g===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(g===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(g===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(g===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(g===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},H}();const r=W},"./src/remux/mp4-generator.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>H});var W=Math.pow(2,32)-1,r=function(){function D(){}return D.init=function(){D.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var g;for(g in D.types)D.types.hasOwnProperty(g)&&(D.types[g]=[g.charCodeAt(0),g.charCodeAt(1),g.charCodeAt(2),g.charCodeAt(3)]);var p=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]),u=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]);D.HDLR_TYPES={video:p,audio:u};var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),b=new Uint8Array([0,0,0,0,0,0,0,0]);D.STTS=D.STSC=D.STCO=b,D.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),D.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),D.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),D.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var E=new Uint8Array([105,115,111,109]),_=new Uint8Array([97,118,99,49]),f=new Uint8Array([0,0,0,1]);D.FTYP=D.box(D.types.ftyp,E,f,E,_),D.DINF=D.box(D.types.dinf,D.box(D.types.dref,m))},D.box=function(g){for(var p=8,u=arguments.length,m=new Array(u>1?u-1:0),b=1;b<u;b++)m[b-1]=arguments[b];for(var E=m.length,_=E;E--;)p+=m[E].byteLength;var f=new Uint8Array(p);for(f[0]=p>>24&255,f[1]=p>>16&255,f[2]=p>>8&255,f[3]=p&255,f.set(g,4),E=0,p=8;E<_;E++)f.set(m[E],p),p+=m[E].byteLength;return f},D.hdlr=function(g){return D.box(D.types.hdlr,D.HDLR_TYPES[g])},D.mdat=function(g){return D.box(D.types.mdat,g)},D.mdhd=function(g,p){p*=g;var u=Math.floor(p/(W+1)),m=Math.floor(p%(W+1));return D.box(D.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,g>>24&255,g>>16&255,g>>8&255,g&255,u>>24,u>>16&255,u>>8&255,u&255,m>>24,m>>16&255,m>>8&255,m&255,85,196,0,0]))},D.mdia=function(g){return D.box(D.types.mdia,D.mdhd(g.timescale,g.duration),D.hdlr(g.type),D.minf(g))},D.mfhd=function(g){return D.box(D.types.mfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255]))},D.minf=function(g){return g.type==="audio"?D.box(D.types.minf,D.box(D.types.smhd,D.SMHD),D.DINF,D.stbl(g)):D.box(D.types.minf,D.box(D.types.vmhd,D.VMHD),D.DINF,D.stbl(g))},D.moof=function(g,p,u){return D.box(D.types.moof,D.mfhd(g),D.traf(u,p))},D.moov=function(g){for(var p=g.length,u=[];p--;)u[p]=D.trak(g[p]);return D.box.apply(null,[D.types.moov,D.mvhd(g[0].timescale,g[0].duration)].concat(u).concat(D.mvex(g)))},D.mvex=function(g){for(var p=g.length,u=[];p--;)u[p]=D.trex(g[p]);return D.box.apply(null,[D.types.mvex].concat(u))},D.mvhd=function(g,p){p*=g;var u=Math.floor(p/(W+1)),m=Math.floor(p%(W+1)),b=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,g>>24&255,g>>16&255,g>>8&255,g&255,u>>24,u>>16&255,u>>8&255,u&255,m>>24,m>>16&255,m>>8&255,m&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return D.box(D.types.mvhd,b)},D.sdtp=function(g){var p=g.samples||[],u=new Uint8Array(4+p.length),m,b;for(m=0;m<p.length;m++)b=p[m].flags,u[m+4]=b.dependsOn<<4|b.isDependedOn<<2|b.hasRedundancy;return D.box(D.types.sdtp,u)},D.stbl=function(g){return D.box(D.types.stbl,D.stsd(g),D.box(D.types.stts,D.STTS),D.box(D.types.stsc,D.STSC),D.box(D.types.stsz,D.STSZ),D.box(D.types.stco,D.STCO))},D.avc1=function(g){var p=[],u=[],m,b,E;for(m=0;m<g.sps.length;m++)b=g.sps[m],E=b.byteLength,p.push(E>>>8&255),p.push(E&255),p=p.concat(Array.prototype.slice.call(b));for(m=0;m<g.pps.length;m++)b=g.pps[m],E=b.byteLength,u.push(E>>>8&255),u.push(E&255),u=u.concat(Array.prototype.slice.call(b));var _=D.box(D.types.avcC,new Uint8Array([1,p[3],p[4],p[5],252|3,224|g.sps.length].concat(p).concat([g.pps.length]).concat(u))),f=g.width,O=g.height,w=g.pixelRatio[0],R=g.pixelRatio[1];return D.box(D.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,f>>8&255,f&255,O>>8&255,O&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),_,D.box(D.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),D.box(D.types.pasp,new Uint8Array([w>>24,w>>16&255,w>>8&255,w&255,R>>24,R>>16&255,R>>8&255,R&255])))},D.esds=function(g){var p=g.config.length;return new Uint8Array([0,0,0,0,3,23+p,0,1,0,4,15+p,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([p]).concat(g.config).concat([6,1,2]))},D.mp4a=function(g){var p=g.samplerate;return D.box(D.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,g.channelCount,0,16,0,0,0,0,p>>8&255,p&255,0,0]),D.box(D.types.esds,D.esds(g)))},D.mp3=function(g){var p=g.samplerate;return D.box(D.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,g.channelCount,0,16,0,0,0,0,p>>8&255,p&255,0,0]))},D.stsd=function(g){return g.type==="audio"?g.segmentCodec==="mp3"&&g.codec==="mp3"?D.box(D.types.stsd,D.STSD,D.mp3(g)):D.box(D.types.stsd,D.STSD,D.mp4a(g)):D.box(D.types.stsd,D.STSD,D.avc1(g))},D.tkhd=function(g){var p=g.id,u=g.duration*g.timescale,m=g.width,b=g.height,E=Math.floor(u/(W+1)),_=Math.floor(u%(W+1));return D.box(D.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,p>>24&255,p>>16&255,p>>8&255,p&255,0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255,_>>24,_>>16&255,_>>8&255,_&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,m>>8&255,m&255,0,0,b>>8&255,b&255,0,0]))},D.traf=function(g,p){var u=D.sdtp(g),m=g.id,b=Math.floor(p/(W+1)),E=Math.floor(p%(W+1));return D.box(D.types.traf,D.box(D.types.tfhd,new Uint8Array([0,0,0,0,m>>24,m>>16&255,m>>8&255,m&255])),D.box(D.types.tfdt,new Uint8Array([1,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,E>>24,E>>16&255,E>>8&255,E&255])),D.trun(g,u.length+16+20+8+16+8+8),u)},D.trak=function(g){return g.duration=g.duration||4294967295,D.box(D.types.trak,D.tkhd(g),D.mdia(g))},D.trex=function(g){var p=g.id;return D.box(D.types.trex,new Uint8Array([0,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},D.trun=function(g,p){var u=g.samples||[],m=u.length,b=12+16*m,E=new Uint8Array(b),_,f,O,w,R,x;for(p+=8+b,E.set([g.type==="video"?1:0,0,15,1,m>>>24&255,m>>>16&255,m>>>8&255,m&255,p>>>24&255,p>>>16&255,p>>>8&255,p&255],0),_=0;_<m;_++)f=u[_],O=f.duration,w=f.size,R=f.flags,x=f.cts,E.set([O>>>24&255,O>>>16&255,O>>>8&255,O&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255,R.isLeading<<2|R.dependsOn,R.isDependedOn<<6|R.hasRedundancy<<4|R.paddingValue<<1|R.isNonSync,R.degradPrio&240<<8,R.degradPrio&15,x>>>24&255,x>>>16&255,x>>>8&255,x&255],12+16*_);return D.box(D.types.trun,E)},D.initSegment=function(g){D.types||D.init();var p=D.moov(g),u=new Uint8Array(D.FTYP.byteLength+p.byteLength);return u.set(D.FTYP),u.set(p,D.FTYP.byteLength),u},D}();r.types=void 0,r.HDLR_TYPES=void 0,r.STTS=void 0,r.STSC=void 0,r.STCO=void 0,r.STSZ=void 0,r.VMHD=void 0,r.SMHD=void 0,r.STSD=void 0,r.FTYP=void 0,r.DINF=void 0;const H=r},"./src/remux/mp4-remuxer.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>w,flushTextTrackMetadataCueSamples:()=>I,flushTextTrackUserdataCueSamples:()=>k,normalizePts:()=>R});var W=F("./src/polyfills/number.ts"),r=F("./src/remux/aac-helper.ts"),H=F("./src/remux/mp4-generator.ts"),D=F("./src/events.ts"),M=F("./src/errors.ts"),g=F("./src/utils/logger.ts"),p=F("./src/types/loader.ts"),u=F("./src/utils/timescale-conversion.ts");function m(){return m=Object.assign?Object.assign.bind():function(S){for(var C=1;C<arguments.length;C++){var c=arguments[C];for(var o in c)Object.prototype.hasOwnProperty.call(c,o)&&(S[o]=c[o])}return S},m.apply(this,arguments)}var b=10*1e3,E=1024,_=1152,f=null,O=null,w=function(){function S(c,o,v,l){if(l===void 0&&(l=""),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.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=c,this.config=o,this.typeSupported=v,this.ISGenerated=!1,f===null){var a=navigator.userAgent||"",T=a.match(/Chrome\/(\d+)/i);f=T?parseInt(T[1]):0}if(O===null){var h=navigator.userAgent.match(/Safari\/(\d+)/i);O=h?parseInt(h[1]):0}}var C=S.prototype;return C.destroy=function(){},C.resetTimeStamp=function(o){g.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=o},C.resetNextTimestamp=function(){g.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},C.resetInitSegment=function(){g.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},C.getVideoStartPts=function(o){var v=!1,l=o.reduce(function(a,T){var h=T.pts-a;return h<-4294967296?(v=!0,R(a,T.pts)):h>0?a:T.pts},o[0].pts);return v&&g.logger.debug("PTS rollover detected"),l},C.remux=function(o,v,l,a,T,h,n,N){var U,j,Y,J,ee,ie,re=T,he=T,oe=o.pid>-1,ae=v.pid>-1,Ee=v.samples.length,Le=o.samples.length>0,Fe=n&&Ee>0||Ee>1,Xe=(!oe||Le)&&(!ae||Fe)||this.ISGenerated||n;if(Xe){this.ISGenerated||(Y=this.generateIS(o,v,T));var He=this.isVideoContiguous,Ae=-1,Oe;if(Fe&&(Ae=x(v.samples),!He&&this.config.forceKeyFrameOnDiscontinuity))if(ie=!0,Ae>0){g.logger.warn("[mp4-remuxer]: Dropped "+Ae+" out of "+Ee+" video samples due to a missing keyframe");var Ke=this.getVideoStartPts(v.samples);v.samples=v.samples.slice(Ae),v.dropped+=Ae,he+=(v.samples[0].pts-Ke)/v.inputTimeScale,Oe=he}else Ae===-1&&(g.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ee+" video samples"),ie=!1);if(this.ISGenerated){if(Le&&Fe){var de=this.getVideoStartPts(v.samples),xe=R(o.samples[0].pts,de)-de,Ie=xe/v.inputTimeScale;re+=Math.max(0,Ie),he+=Math.max(0,-Ie)}if(Le){if(o.samplerate||(g.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),Y=this.generateIS(o,v,T)),j=this.remuxAudio(o,re,this.isAudioContiguous,h,ae||Fe||N===p.PlaylistLevelType.AUDIO?he:void 0),Fe){var De=j?j.endPTS-j.startPTS:0;v.inputTimeScale||(g.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),Y=this.generateIS(o,v,T)),U=this.remuxVideo(v,he,He,De)}}else Fe&&(U=this.remuxVideo(v,he,He,0));U&&(U.firstKeyFrame=Ae,U.independent=Ae!==-1,U.firstKeyFramePTS=Oe)}}return this.ISGenerated&&(l.samples.length&&(ee=I(l,T,this._initPTS,this._initDTS)),a.samples.length&&(J=k(a,T,this._initPTS))),{audio:j,video:U,initSegment:Y,independent:ie,text:J,id3:ee}},C.generateIS=function(o,v,l){var a=o.samples,T=v.samples,h=this.typeSupported,n={},N=!(0,W.isFiniteNumber)(this._initPTS),U="audio/mp4",j,Y,J;if(N&&(j=Y=Infinity),o.config&&a.length){o.timescale=o.samplerate;switch(o.segmentCodec){case"mp3":h.mpeg?(U="audio/mpeg",o.codec=""):h.mp3&&(o.codec="mp3");break}n.audio={id:"audio",container:U,codec:o.codec,initSegment:o.segmentCodec==="mp3"&&h.mpeg?new Uint8Array(0):H.default.initSegment([o]),metadata:{channelCount:o.channelCount}},N&&(J=o.inputTimeScale,j=Y=a[0].pts-Math.round(J*l))}if(v.sps&&v.pps&&T.length&&(v.timescale=v.inputTimeScale,n.video={id:"main",container:"video/mp4",codec:v.codec,initSegment:H.default.initSegment([v]),metadata:{width:v.width,height:v.height}},N)){J=v.inputTimeScale;var ee=this.getVideoStartPts(T),ie=Math.round(J*l);Y=Math.min(Y,R(T[0].dts,ee)-ie),j=Math.min(j,ee-ie)}if(Object.keys(n).length)return this.ISGenerated=!0,N&&(this._initPTS=j,this._initDTS=Y),{tracks:n,initPTS:j,timescale:J}},C.remuxVideo=function(o,v,l,a){var T=o.inputTimeScale,h=o.samples,n=[],N=h.length,U=this._initPTS,j=this.nextAvcDts,Y=8,J=this.videoSampleDuration,ee,ie,re=Number.POSITIVE_INFINITY,he=Number.NEGATIVE_INFINITY,oe=!1;if(!l||j===null){var ae=v*T,Ee=h[0].pts-R(h[0].dts,h[0].pts);j=ae-Ee}for(var Le=0;Le<N;Le++){var Fe=h[Le];Fe.pts=R(Fe.pts-U,j),Fe.dts=R(Fe.dts-U,j),Fe.dts<h[Le>0?Le-1:Le].dts&&(oe=!0)}oe&&h.sort(function(At,Lt){var Ut=At.dts-Lt.dts,fr=At.pts-Lt.pts;return Ut||fr}),ee=h[0].dts,ie=h[h.length-1].dts;var Xe=ie-ee,He=Xe?Math.round(Xe/(N-1)):J||o.inputTimeScale/30;if(l){var Ae=ee-j,Oe=Ae>He,Ke=Ae<-1;if((Oe||Ke)&&(Oe?g.logger.warn("AVC: "+(0,u.toMsFromMpegTsClock)(Ae,!0)+" ms ("+Ae+"dts) hole between fragments detected, filling it"):g.logger.warn("AVC: "+(0,u.toMsFromMpegTsClock)(-Ae,!0)+" ms ("+Ae+"dts) overlapping between fragments detected"),!Ke||j>h[0].pts)){ee=j;var de=h[0].pts-Ae;h[0].dts=ee,h[0].pts=de,g.logger.log("Video: First PTS/DTS adjusted: "+(0,u.toMsFromMpegTsClock)(de,!0)+"/"+(0,u.toMsFromMpegTsClock)(ee,!0)+", delta: "+(0,u.toMsFromMpegTsClock)(Ae,!0)+" ms")}}ee=Math.max(0,ee);for(var xe=0,Ie=0,De=0;De<N;De++){for(var Be=h[De],ze=Be.units,Ye=ze.length,Ze=0,ut=0;ut<Ye;ut++)Ze+=ze[ut].data.length;Ie+=Ze,xe+=Ye,Be.length=Ze,Be.dts=Math.max(Be.dts,ee),re=Math.min(Be.pts,re),he=Math.max(Be.pts,he)}ie=h[N-1].dts;var Qe=Ie+4*xe+8,st;try{st=new Uint8Array(Qe)}catch(At){this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Qe,reason:"fail allocating video mdat "+Qe});return}var Ne=new DataView(st.buffer);Ne.setUint32(0,Qe),st.set(H.default.types.mdat,4);for(var vt=!1,ht=Number.POSITIVE_INFINITY,Ue=Number.POSITIVE_INFINITY,Ve=Number.NEGATIVE_INFINITY,Ce=Number.NEGATIVE_INFINITY,_e=0;_e<N;_e++){for(var Te=h[_e],ne=Te.units,ue=0,fe=0,me=ne.length;fe<me;fe++){var we=ne[fe],Me=we.data,je=we.data.byteLength;Ne.setUint32(Y,je),Y+=4,st.set(Me,Y),Y+=je,ue+=4+je}var qe=void 0;if(_e<N-1)J=h[_e+1].dts-Te.dts,qe=h[_e+1].pts-Te.pts;else{var ct=this.config,et=_e>0?Te.dts-h[_e-1].dts:He;if(qe=_e>0?Te.pts-h[_e-1].pts:He,ct.stretchShortVideoTrack&&this.nextAudioPts!==null){var kt=Math.floor(ct.maxBufferHole*T),Ct=(a?re+a*T:this.nextAudioPts)-Te.pts;Ct>kt?(J=Ct-et,J<0?J=et:vt=!0,g.logger.log("[mp4-remuxer]: It is approximately "+Ct/90+" ms to the next segment; using duration "+J/90+" ms for the last video frame.")):J=et}else J=et}var pt=Math.round(Te.pts-Te.dts);ht=Math.min(ht,J),Ve=Math.max(Ve,J),Ue=Math.min(Ue,qe),Ce=Math.max(Ce,qe),n.push(new A(Te.key,J,ue,pt))}if(n.length){if(f){if(f<70){var Nt=n[0].flags;Nt.dependsOn=2,Nt.isNonSync=0}}else if(O&&(Ce-Ue<Ve-ht&&He/Ve<.025&&n[0].cts===0)){g.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var Et=ee,wt=0,Ht=n.length;wt<Ht;wt++){var It=Et+n[wt].duration,rr=Et+n[wt].cts;if(wt<Ht-1){var Rr=It+n[wt+1].cts;n[wt].duration=Rr-rr}else n[wt].duration=wt?n[wt-1].duration:He;n[wt].cts=0,Et=It}}}console.assert(J!==null,"mp4SampleDuration must be computed"),J=vt||!J?He:J,this.nextAvcDts=j=ie+J,this.videoSampleDuration=J,this.isVideoContiguous=!0;var ar=H.default.moof(o.sequenceNumber++,ee,m({},o,{samples:n})),xr="video",tt={data1:ar,data2:st,startPTS:re/T,endPTS:(he+J)/T,startDTS:ee/T,endDTS:j/T,type:xr,hasAudio:!1,hasVideo:!0,nb:n.length,dropped:o.dropped};return o.samples=[],o.dropped=0,console.assert(st.length,"MDAT length must not be zero"),tt},C.remuxAudio=function(o,v,l,a,T){var h=o.inputTimeScale,n=o.samplerate?o.samplerate:h,N=h/n,U=o.segmentCodec==="aac"?E:_,j=U*N,Y=this._initPTS,J=o.segmentCodec==="mp3"&&this.typeSupported.mpeg,ee=[],ie=T!==void 0,re=o.samples,he=J?0:8,oe=this.nextAudioPts||-1,ae=v*h;if(this.isAudioContiguous=l=l||re.length&&oe>0&&(a&&Math.abs(ae-oe)<9e3||Math.abs(R(re[0].pts-Y,ae)-oe)<20*j),re.forEach(function(we){we.pts=R(we.pts-Y,ae)}),!l||oe<0){if(re=re.filter(function(we){return we.pts>=0}),!re.length)return;T===0?oe=0:a&&!ie?oe=Math.max(0,ae):oe=re[0].pts}if(o.segmentCodec==="aac")for(var Ee=this.config.maxAudioFramesDrift,Le=0,Fe=oe;Le<re.length;Le++){var Xe=re[Le],He=Xe.pts,Ae=He-Fe,Oe=Math.abs(1e3*Ae/h);if(Ae<=-Ee*j&&ie)Le===0&&(g.logger.warn("Audio frame @ "+(He/h).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Ae/h)+" ms."),this.nextAudioPts=oe=Fe=He);else if(Ae>=Ee*j&&Oe<b&&ie){var Ke=Math.round(Ae/j);Fe=He-Ke*j,Fe<0&&(Ke--,Fe+=j),Le===0&&(this.nextAudioPts=oe=Fe),g.logger.warn("[mp4-remuxer]: Injecting "+Ke+" audio frame @ "+(Fe/h).toFixed(3)+"s due to "+Math.round(1e3*Ae/h)+" ms gap.");for(var de=0;de<Ke;de++){var xe=Math.max(Fe,0),Ie=r.default.getSilentFrame(o.manifestCodec||o.codec,o.channelCount);Ie||(g.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ie=Xe.unit.subarray()),re.splice(Le,0,{unit:Ie,pts:xe}),Fe+=j,Le++}}Xe.pts=Fe,Fe+=j}for(var De=null,Be=null,ze,Ye=0,Ze=re.length;Ze--;)Ye+=re[Ze].unit.byteLength;for(var ut=0,Qe=re.length;ut<Qe;ut++){var st=re[ut],Ne=st.unit,vt=st.pts;if(Be!==null){var ht=ee[ut-1];ht.duration=Math.round((vt-Be)/N)}else if(l&&o.segmentCodec==="aac"&&(vt=oe),De=vt,Ye>0){Ye+=he;try{ze=new Uint8Array(Ye)}catch(we){this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ye,reason:"fail allocating audio mdat "+Ye});return}if(!J){var Ue=new DataView(ze.buffer);Ue.setUint32(0,Ye),ze.set(H.default.types.mdat,4)}}else return;ze.set(Ne,he);var Ve=Ne.byteLength;he+=Ve,ee.push(new A(!0,U,Ve,0)),Be=vt}var Ce=ee.length;if(!Ce)return;var _e=ee[ee.length-1];this.nextAudioPts=oe=Be+N*_e.duration;var Te=J?new Uint8Array(0):H.default.moof(o.sequenceNumber++,De/N,m({},o,{samples:ee}));o.samples=[];var ne=De/h,ue=oe/h,fe="audio",me={data1:Te,data2:ze,startPTS:ne,endPTS:ue,startDTS:ne,endDTS:ue,type:fe,hasAudio:!0,hasVideo:!1,nb:Ce};return this.isAudioContiguous=!0,console.assert(ze.length,"MDAT length must not be zero"),me},C.remuxEmptyAudio=function(o,v,l,a){var T=o.inputTimeScale,h=o.samplerate?o.samplerate:T,n=T/h,N=this.nextAudioPts,U=(N!==null?N:a.startDTS*T)+this._initDTS,j=a.endDTS*T+this._initDTS,Y=n*E,J=Math.ceil((j-U)/Y),ee=r.default.getSilentFrame(o.manifestCodec||o.codec,o.channelCount);if(g.logger.warn("[mp4-remuxer]: remux empty Audio"),!ee){g.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ie=[],re=0;re<J;re++){var he=U+re*Y;ie.push({unit:ee,pts:he,dts:he})}return o.samples=ie,this.remuxAudio(o,v,l,!1)},S}();function R(S,C){var c;if(C===null)return S;for(C<S?c=-8589934592:c=8589934592;Math.abs(S-C)>4294967296;)S+=c;return S}function x(S){for(var C=0;C<S.length;C++)if(S[C].key)return C;return-1}function I(S,C,c,o){var v=S.samples.length;if(!v)return;for(var l=S.inputTimeScale,a=0;a<v;a++){var T=S.samples[a];T.pts=R(T.pts-c,C*l)/l,T.dts=R(T.dts-o,C*l)/l}var h=S.samples;return S.samples=[],{samples:h}}function k(S,C,c){var o=S.samples.length;if(!o)return;for(var v=S.inputTimeScale,l=0;l<o;l++){var a=S.samples[l];a.pts=R(a.pts-c,C*v)/v}S.samples.sort(function(h,n){return h.pts-n.pts});var T=S.samples;return S.samples=[],{samples:T}}var A=function(C,c,o,v){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=c,this.size=o,this.cts=v,this.flags=new P(C)},P=function(C){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=C?2:1,this.isNonSync=C?0:1}},"./src/remux/passthrough-remuxer.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>u});var W=F("./src/polyfills/number.ts"),r=F("./src/remux/mp4-remuxer.ts"),H=F("./src/utils/mp4-tools.ts"),D=F("./src/loader/fragment.ts"),M=F("./src/utils/logger.ts"),g=function(){function m(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndTime=null}var b=m.prototype;return b.destroy=function(){},b.resetTimeStamp=function(_){this.initPTS=_,this.lastEndTime=null},b.resetNextTimestamp=function(){this.lastEndTime=null},b.resetInitSegment=function(_,f,O,w){this.audioCodec=f,this.videoCodec=O,this.generateInitSegment((0,H.patchEncyptionData)(_,w)),this.emitInitSegment=!0},b.generateInitSegment=function(_){var f=this.audioCodec,O=this.videoCodec;if(!_||!_.byteLength){this.initTracks=void 0,this.initData=void 0;return}var w=this.initData=(0,H.parseInitSegment)(_);f||(f=p(w.audio,D.ElementaryStreamTypes.AUDIO)),O||(O=p(w.video,D.ElementaryStreamTypes.VIDEO));var R={};w.audio&&w.video?R.audiovideo={container:"video/mp4",codec:f+","+O,initSegment:_,id:"main"}:w.audio?R.audio={container:"audio/mp4",codec:f,initSegment:_,id:"audio"}:w.video?R.video={container:"video/mp4",codec:O,initSegment:_,id:"main"}:M.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=R},b.remux=function(_,f,O,w,R){var x,I=this.initPTS,k=this.lastEndTime,A={audio:void 0,video:void 0,text:w,id3:O,initSegment:void 0};(0,W.isFiniteNumber)(k)||(k=this.lastEndTime=R||0);var P=f.samples;if(!P||!P.length)return A;var S={initPTS:void 0,timescale:1},C=this.initData;if((!C||!C.length)&&(this.generateInitSegment(P),C=this.initData),!C||!C.length)return M.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),A;this.emitInitSegment&&(S.tracks=this.initTracks,this.emitInitSegment=!1);var c=(0,H.getStartDTS)(C,P);(0,W.isFiniteNumber)(I)||(this.initPTS=S.initPTS=I=c-R);var o=(0,H.getDuration)(P,C),v=_?c-I:k,l=v+o;(0,H.offsetStartDTS)(C,P,I),o>0?this.lastEndTime=l:(M.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var a=!!C.audio,T=!!C.video,h="";a&&(h+="audio"),T&&(h+="video");var n={data1:P,startPTS:v,startDTS:v,endPTS:l,endDTS:l,type:h,hasAudio:a,hasVideo:T,nb:1,dropped:0};A.audio=n.type==="audio"?n:void 0,A.video=n.type!=="audio"?n:void 0,A.initSegment=S;var N=(x=this.initPTS)!=null?x:0;return A.id3=(0,r.flushTextTrackMetadataCueSamples)(O,R,N,N),w.samples.length&&(A.text=(0,r.flushTextTrackUserdataCueSamples)(w,R,N)),A},m}();function p(m,b){var E=m==null?void 0:m.codec;return E&&E.length>4?E:E==="hvc1"||E==="hev1"?"hvc1.1.c.L120.90":E==="av01"?"av01.0.04M.08":E==="avc1"||b===D.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}const u=g},"./src/task-loop.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>W});var W=function(){function r(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var H=r.prototype;return H.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},H.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},H.onHandlerDestroyed=function(){},H.hasInterval=function(){return!!this._tickInterval},H.hasNextTick=function(){return!!this._tickTimer},H.setInterval=function(M){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,M),!0)},H.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},H.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},H.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},H.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},H.doTick=function(){},r}()},"./src/types/cmcd.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{CMCDObjectType:()=>r,CMCDStreamType:()=>D,CMCDStreamingFormat:()=>H,CMCDVersion:()=>W});var W=1,r;(function(M){M.MANIFEST="m",M.AUDIO="a",M.VIDEO="v",M.MUXED="av",M.INIT="i",M.CAPTION="c",M.TIMED_TEXT="tt",M.KEY="k",M.OTHER="o"})(r||(r={}));var H;(function(M){M.DASH="d",M.HLS="h",M.SMOOTH="s",M.OTHER="o"})(H||(H={}));var D;(function(M){M.VOD="v",M.LIVE="l"})(D||(D={}))},"./src/types/demuxer.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{MetadataSchema:()=>W});var W;(function(r){r.audioId3="org.id3",r.dateRange="com.apple.quicktime.HLS",r.emsg="https://aomedia.org/emsg/ID3"})(W||(W={}))},"./src/types/level.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{HdcpLevels:()=>M,HlsSkip:()=>g,HlsUrlParameters:()=>u,Level:()=>m,getSkipValue:()=>p});function W(b,E){for(var _=0;_<E.length;_++){var f=E[_];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(b,H(f.key),f)}}function r(b,E,_){return E&&W(b.prototype,E),_&&W(b,_),Object.defineProperty(b,"prototype",{writable:!1}),b}function H(b){var E=D(b,"string");return typeof E=="symbol"?E:String(E)}function D(b,E){if(typeof b!="object"||b===null)return b;var _=b[Symbol.toPrimitive];if(_!==void 0){var f=_.call(b,E||"default");if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(b)}var M=["NONE","TYPE-0","TYPE-1","TYPE-2",null],g;(function(b){b.No="",b.Yes="YES",b.v2="v2"})(g||(g={}));function p(b,E){var _=b.canSkipUntil,f=b.canSkipDateRanges,O=b.endSN,w=E!==void 0?E-O:0;return _&&w<_?f?g.v2:g.Yes:g.No}var u=function(){function b(_,f,O){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=_,this.part=f,this.skip=O}var E=b.prototype;return E.addDirectives=function(f){var O=new self.URL(f);return this.msn!==void 0&&O.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&O.searchParams.set("_HLS_part",this.part.toString()),this.skip&&O.searchParams.set("_HLS_skip",this.skip),O.href},b}(),m=function(){function b(E){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=[E.url],this.attrs=E.attrs,this.bitrate=E.bitrate,E.details&&(this.details=E.details),this.id=E.id||0,this.name=E.name,this.width=E.width||0,this.height=E.height||0,this.audioCodec=E.audioCodec,this.videoCodec=E.videoCodec,this.unknownCodecs=E.unknownCodecs,this.codecSet=[E.videoCodec,E.audioCodec].filter(function(_){return _}).join(",").replace(/\.[^.,]+/g,"")}return r(b,[{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(_){var f=_%this.url.length;this._urlId!==f&&(this.details=void 0,this._urlId=f)}}]),b}()},"./src/types/loader.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{PlaylistContextType:()=>W,PlaylistLevelType:()=>r});var W;(function(H){H.MANIFEST="manifest",H.LEVEL="level",H.AUDIO_TRACK="audioTrack",H.SUBTITLE_TRACK="subtitleTrack"})(W||(W={}));var r;(function(H){H.MAIN="main",H.AUDIO="audio",H.SUBTITLE="subtitle"})(r||(r={}))},"./src/types/transmuxer.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{ChunkMetadata:()=>W});var W=function(D,M,g,p,u,m){p===void 0&&(p=0),u===void 0&&(u=-1),m===void 0&&(m=!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=r(),this.buffering={audio:r(),video:r(),audiovideo:r()},this.level=D,this.sn=M,this.id=g,this.size=p,this.part=u,this.partial=m};function r(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{AttrList:()=>H});var W=/^(\d+)x(\d+)$/,r=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,H=function(){function D(g){typeof g=="string"&&(g=D.parseAttrList(g));for(var p in g)g.hasOwnProperty(p)&&(this[p]=g[p])}var M=D.prototype;return M.decimalInteger=function(p){var u=parseInt(this[p],10);return u>Number.MAX_SAFE_INTEGER?Infinity:u},M.hexadecimalInteger=function(p){if(this[p]){var u=(this[p]||"0x").slice(2);u=(u.length&1?"0":"")+u;for(var m=new Uint8Array(u.length/2),b=0;b<u.length/2;b++)m[b]=parseInt(u.slice(b*2,b*2+2),16);return m}else return null},M.hexadecimalIntegerAsNumber=function(p){var u=parseInt(this[p],16);return u>Number.MAX_SAFE_INTEGER?Infinity:u},M.decimalFloatingPoint=function(p){return parseFloat(this[p])},M.optionalFloat=function(p,u){var m=this[p];return m?parseFloat(m):u},M.enumeratedString=function(p){return this[p]},M.bool=function(p){return this[p]==="YES"},M.decimalResolution=function(p){var u=W.exec(this[p]);return u===null?void 0:{width:parseInt(u[1],10),height:parseInt(u[2],10)}},D.parseAttrList=function(p){var u,m={},b='"';for(r.lastIndex=0;(u=r.exec(p))!==null;){var E=u[2];E.indexOf(b)===0&&E.lastIndexOf(b)===E.length-1&&(E=E.slice(1,-1)),m[u[1]]=E}return m},D}()},"./src/utils/binary-search.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>r});var W={search:function(D,M){for(var g=0,p=D.length-1,u=null,m=null;g<=p;){u=(g+p)/2|0,m=D[u];var b=M(m);if(b>0)g=u+1;else if(b<0)p=u-1;else return m}return null}};const r=W},"./src/utils/buffer-helper.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{BufferHelper:()=>H});var W=F("./src/utils/logger.ts"),r={length:0,start:function(){return 0},end:function(){return 0}},H=function(){function D(){}return D.isBuffered=function(g,p){try{if(g){for(var u=D.getBuffered(g),m=0;m<u.length;m++)if(p>=u.start(m)&&p<=u.end(m))return!0}}catch(b){}return!1},D.bufferInfo=function(g,p,u){try{if(g){var m=D.getBuffered(g),b=[],E;for(E=0;E<m.length;E++)b.push({start:m.start(E),end:m.end(E)});return this.bufferedInfo(b,p,u)}}catch(_){}return{len:0,start:p,end:p,nextStart:void 0}},D.bufferedInfo=function(g,p,u){p=Math.max(0,p),g.sort(function(A,P){var S=A.start-P.start;return S||P.end-A.end});var m=[];if(u)for(var b=0;b<g.length;b++){var E=m.length;if(E){var _=m[E-1].end;g[b].start-_<u?g[b].end>_&&(m[E-1].end=g[b].end):m.push(g[b])}else m.push(g[b])}else m=g;for(var f=0,O,w=p,R=p,x=0;x<m.length;x++){var I=m[x].start,k=m[x].end;if(p+u>=I&&p<k)w=I,R=k,f=R-p;else if(p+u<I){O=I;break}}return{len:f,start:w||0,end:R||0,nextStart:O}},D.getBuffered=function(g){try{return g.buffered}catch(p){return W.logger.log("failed to get media.buffered",p),r}},D}()},"./src/utils/cea-608-parser.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{CaptionScreen:()=>x,Row:()=>R,default:()=>C});var W=F("./src/utils/logger.ts"),r={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},H=function(o){var v=o;return r.hasOwnProperty(o)&&(v=r[o]),String.fromCharCode(v)},D=15,M=100,g={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},p={17:2,18:4,21:6,22:8,23:10,19:13,20:15},u={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},m={25:2,26:4,29:6,30:8,31:10,27:13,28:15},b=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],E;(function(c){c[c.ERROR=0]="ERROR",c[c.TEXT=1]="TEXT",c[c.WARNING=2]="WARNING",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c[c.DATA=3]="DATA"})(E||(E={}));var _=function(){function c(){this.time=null,this.verboseLevel=E.ERROR}var o=c.prototype;return o.log=function(l,a){if(this.verboseLevel>=l){var T=typeof a=="function"?a():a;W.logger.log(this.time+" ["+l+"] "+T)}},c}(),f=function(o){for(var v=[],l=0;l<o.length;l++)v.push(o[l].toString(16));return v},O=function(){function c(v,l,a,T,h){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=v||"white",this.underline=l||!1,this.italics=a||!1,this.background=T||"black",this.flash=h||!1}var o=c.prototype;return o.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},o.setStyles=function(l){for(var a=["foreground","underline","italics","background","flash"],T=0;T<a.length;T++){var h=a[T];l.hasOwnProperty(h)&&(this[h]=l[h])}},o.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},o.equals=function(l){return this.foreground===l.foreground&&this.underline===l.underline&&this.italics===l.italics&&this.background===l.background&&this.flash===l.flash},o.copy=function(l){this.foreground=l.foreground,this.underline=l.underline,this.italics=l.italics,this.background=l.background,this.flash=l.flash},o.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},c}(),w=function(){function c(v,l,a,T,h,n){this.uchar=void 0,this.penState=void 0,this.uchar=v||" ",this.penState=new O(l,a,T,h,n)}var o=c.prototype;return o.reset=function(){this.uchar=" ",this.penState.reset()},o.setChar=function(l,a){this.uchar=l,this.penState.copy(a)},o.setPenState=function(l){this.penState.copy(l)},o.equals=function(l){return this.uchar===l.uchar&&this.penState.equals(l.penState)},o.copy=function(l){this.uchar=l.uchar,this.penState.copy(l.penState)},o.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},c}(),R=function(){function c(v){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var l=0;l<M;l++)this.chars.push(new w);this.logger=v,this.pos=0,this.currPenState=new O}var o=c.prototype;return o.equals=function(l){for(var a=!0,T=0;T<M;T++)if(!this.chars[T].equals(l.chars[T])){a=!1;break}return a},o.copy=function(l){for(var a=0;a<M;a++)this.chars[a].copy(l.chars[a])},o.isEmpty=function(){for(var l=!0,a=0;a<M;a++)if(!this.chars[a].isEmpty()){l=!1;break}return l},o.setCursor=function(l){this.pos!==l&&(this.pos=l),this.pos<0?(this.logger.log(E.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>M&&(this.logger.log(E.DEBUG,"Too large cursor position "+this.pos),this.pos=M)},o.moveCursor=function(l){var a=this.pos+l;if(l>1)for(var T=this.pos+1;T<a+1;T++)this.chars[T].setPenState(this.currPenState);this.setCursor(a)},o.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},o.insertChar=function(l){var a=this;l>=144&&this.backSpace();var T=H(l);if(this.pos>=M){this.logger.log(E.ERROR,function(){return"Cannot insert "+l.toString(16)+" ("+T+") at position "+a.pos+". Skipping it!"});return}this.chars[this.pos].setChar(T,this.currPenState),this.moveCursor(1)},o.clearFromPos=function(l){var a;for(a=l;a<M;a++)this.chars[a].reset()},o.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},o.clearToEndOfRow=function(){this.clearFromPos(this.pos)},o.getTextString=function(){for(var l=[],a=!0,T=0;T<M;T++){var h=this.chars[T].uchar;h!==" "&&(a=!1),l.push(h)}return a?"":l.join("")},o.setPenStyles=function(l){this.currPenState.setStyles(l);var a=this.chars[this.pos];a.setPenState(this.currPenState)},c}(),x=function(){function c(v){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var l=0;l<D;l++)this.rows.push(new R(v));this.logger=v,this.currRow=D-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var o=c.prototype;return o.reset=function(){for(var l=0;l<D;l++)this.rows[l].clear();this.currRow=D-1},o.equals=function(l){for(var a=!0,T=0;T<D;T++)if(!this.rows[T].equals(l.rows[T])){a=!1;break}return a},o.copy=function(l){for(var a=0;a<D;a++)this.rows[a].copy(l.rows[a])},o.isEmpty=function(){for(var l=!0,a=0;a<D;a++)if(!this.rows[a].isEmpty()){l=!1;break}return l},o.backSpace=function(){var l=this.rows[this.currRow];l.backSpace()},o.clearToEndOfRow=function(){var l=this.rows[this.currRow];l.clearToEndOfRow()},o.insertChar=function(l){var a=this.rows[this.currRow];a.insertChar(l)},o.setPen=function(l){var a=this.rows[this.currRow];a.setPenStyles(l)},o.moveCursor=function(l){var a=this.rows[this.currRow];a.moveCursor(l)},o.setCursor=function(l){this.logger.log(E.INFO,"setCursor: "+l);var a=this.rows[this.currRow];a.setCursor(l)},o.setPAC=function(l){this.logger.log(E.INFO,function(){return"pacData = "+JSON.stringify(l)});var a=l.row-1;if(this.nrRollUpRows&&a<this.nrRollUpRows-1&&(a=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==a){for(var T=0;T<D;T++)this.rows[T].clear();var h=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){var N=n.rows[h].cueStartTime,U=this.logger.time;if(N&&U!==null&&N<U)for(var j=0;j<this.nrRollUpRows;j++)this.rows[a-this.nrRollUpRows+j+1].copy(n.rows[h+j])}}this.currRow=a;var Y=this.rows[this.currRow];if(l.indent!==null){var J=l.indent,ee=Math.max(J-1,0);Y.setCursor(l.indent),l.color=Y.chars[ee].penState.foreground}var ie={foreground:l.color,underline:l.underline,italics:l.italics,background:"black",flash:!1};this.setPen(ie)},o.setBkgData=function(l){this.logger.log(E.INFO,function(){return"bkgData = "+JSON.stringify(l)}),this.backSpace(),this.setPen(l),this.insertChar(32)},o.setRollUpRows=function(l){this.nrRollUpRows=l},o.rollUp=function(){var l=this;if(this.nrRollUpRows===null){this.logger.log(E.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(E.TEXT,function(){return l.getDisplayText()});var a=this.currRow+1-this.nrRollUpRows,T=this.rows.splice(a,1)[0];T.clear(),this.rows.splice(this.currRow,0,T),this.logger.log(E.INFO,"Rolling up")},o.getDisplayText=function(l){l=l||!1;for(var a=[],T="",h=-1,n=0;n<D;n++){var N=this.rows[n].getTextString();N&&(h=n+1,l?a.push("Row "+h+": '"+N+"'"):a.push(N.trim()))}return a.length>0&&(l?T="["+a.join(" | ")+"]":T=a.join(`
|
|
`)),T},o.getTextAndFormat=function(){return this.rows},c}(),I=function(){function c(v,l,a){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=v,this.outputFilter=l,this.mode=null,this.verbose=0,this.displayedMemory=new x(a),this.nonDisplayedMemory=new x(a),this.lastOutputScreen=new x(a),this.currRollUpRow=this.displayedMemory.rows[D-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=a}var o=c.prototype;return o.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[D-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},o.getHandler=function(){return this.outputFilter},o.setHandler=function(l){this.outputFilter=l},o.setPAC=function(l){this.writeScreen.setPAC(l)},o.setBkgData=function(l){this.writeScreen.setBkgData(l)},o.setMode=function(l){if(l===this.mode)return;this.mode=l,this.logger.log(E.INFO,function(){return"MODE="+l}),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=l},o.insertChars=function(l){for(var a=this,T=0;T<l.length;T++)this.writeScreen.insertChar(l[T]);var h=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(E.INFO,function(){return h+": "+a.writeScreen.getDisplayText(!0)}),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(E.TEXT,function(){return"DISPLAYED: "+a.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())},o.ccRCL=function(){this.logger.log(E.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},o.ccBS=function(){if(this.logger.log(E.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},o.ccAOF=function(){},o.ccAON=function(){},o.ccDER=function(){this.logger.log(E.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},o.ccRU=function(l){this.logger.log(E.INFO,"RU("+l+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(l)},o.ccFON=function(){this.logger.log(E.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},o.ccRDC=function(){this.logger.log(E.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},o.ccTR=function(){this.logger.log(E.INFO,"TR"),this.setMode("MODE_TEXT")},o.ccRTD=function(){this.logger.log(E.INFO,"RTD"),this.setMode("MODE_TEXT")},o.ccEDM=function(){this.logger.log(E.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},o.ccCR=function(){this.logger.log(E.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},o.ccENM=function(){this.logger.log(E.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},o.ccEOC=function(){var l=this;if(this.logger.log(E.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(E.TEXT,function(){return"DISP: "+l.displayedMemory.getDisplayText()})}this.outputDataUpdate(!0)},o.ccTO=function(l){this.logger.log(E.INFO,"TO("+l+") - Tab Offset"),this.writeScreen.moveCursor(l)},o.ccMIDROW=function(l){var a={flash:!1};if(a.underline=l%2===1,a.italics=l>=46,a.italics)a.foreground="white";else{var T=Math.floor(l/2)-16,h=["white","green","blue","cyan","red","yellow","magenta"];a.foreground=h[T]}this.logger.log(E.INFO,"MIDROW: "+JSON.stringify(a)),this.writeScreen.setPen(a)},o.outputDataUpdate=function(l){l===void 0&&(l=!1);var a=this.logger.time;if(a===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=a:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,a,this.lastOutputScreen),l&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:a),this.lastOutputScreen.copy(this.displayedMemory))},o.cueSplitAtTime=function(l){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,l,this.displayedMemory),this.cueStartTime=l))},c}(),k=function(){function c(v,l,a){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var T=new _;this.channels=[null,new I(v,l,T),new I(v+1,a,T)],this.cmdHistory=S(),this.logger=T}var o=c.prototype;return o.getHandler=function(l){return this.channels[l].getHandler()},o.setHandler=function(l,a){this.channels[l].setHandler(a)},o.addData=function(l,a){var T,h,n,N=!1;this.logger.time=l;for(var U=0;U<a.length;U+=2){if(h=a[U]&127,n=a[U+1]&127,h===0&&n===0)continue;if(this.logger.log(E.DATA,"["+f([a[U],a[U+1]])+"] -> ("+f([h,n])+")"),T=this.parseCmd(h,n),T||(T=this.parseMidrow(h,n)),T||(T=this.parsePAC(h,n)),T||(T=this.parseBackgroundAttributes(h,n)),!T&&(N=this.parseChars(h,n),N)){var j=this.currentChannel;if(j&&j>0){var Y=this.channels[j];Y.insertChars(N)}else this.logger.log(E.WARNING,"No channel found yet. TEXT-MODE?")}!T&&!N&&this.logger.log(E.WARNING,"Couldn't parse cleaned data "+f([h,n])+" orig: "+f([a[U],a[U+1]]))}},o.parseCmd=function(l,a){var T=this.cmdHistory,h=(l===20||l===28||l===21||l===29)&&a>=32&&a<=47,n=(l===23||l===31)&&a>=33&&a<=35;if(!(h||n))return!1;if(P(l,a,T))return A(null,null,T),this.logger.log(E.DEBUG,"Repeated command ("+f([l,a])+") is dropped"),!0;var N=l===20||l===21||l===23?1:2,U=this.channels[N];return l===20||l===21||l===28||l===29?a===32?U.ccRCL():a===33?U.ccBS():a===34?U.ccAOF():a===35?U.ccAON():a===36?U.ccDER():a===37?U.ccRU(2):a===38?U.ccRU(3):a===39?U.ccRU(4):a===40?U.ccFON():a===41?U.ccRDC():a===42?U.ccTR():a===43?U.ccRTD():a===44?U.ccEDM():a===45?U.ccCR():a===46?U.ccENM():a===47&&U.ccEOC():U.ccTO(a-32),A(l,a,T),this.currentChannel=N,!0},o.parseMidrow=function(l,a){var T=0;if((l===17||l===25)&&a>=32&&a<=47){if(l===17?T=1:T=2,T!==this.currentChannel)return this.logger.log(E.ERROR,"Mismatch channel in midrow parsing"),!1;var h=this.channels[T];return h?(h.ccMIDROW(a),this.logger.log(E.DEBUG,"MIDROW ("+f([l,a])+")"),!0):!1}return!1},o.parsePAC=function(l,a){var T,h=this.cmdHistory,n=(l>=17&&l<=23||l>=25&&l<=31)&&a>=64&&a<=127,N=(l===16||l===24)&&a>=64&&a<=95;if(!(n||N))return!1;if(P(l,a,h))return A(null,null,h),!0;var U=l<=23?1:2;a>=64&&a<=95?T=U===1?g[l]:u[l]:T=U===1?p[l]:m[l];var j=this.channels[U];return j?(j.setPAC(this.interpretPAC(T,a)),A(l,a,h),this.currentChannel=U,!0):!1},o.interpretPAC=function(l,a){var T,h={color:null,italics:!1,indent:null,underline:!1,row:l};return a>95?T=a-96:T=a-64,h.underline=(T&1)===1,T<=13?h.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(T/2)]:T<=15?(h.italics=!0,h.color="white"):h.indent=Math.floor((T-16)/2)*4,h},o.parseChars=function(l,a){var T,h=null,n=null;if(l>=25?(T=2,n=l-8):(T=1,n=l),n>=17&&n<=19){var N;n===17?N=a+80:n===18?N=a+112:N=a+144,this.logger.log(E.INFO,"Special char '"+H(N)+"' in channel "+T),h=[N]}else l>=32&&l<=127&&(h=a===0?[l]:[l,a]);if(h){var U=f(h);this.logger.log(E.DEBUG,"Char codes = "+U.join(",")),A(l,a,this.cmdHistory)}return h},o.parseBackgroundAttributes=function(l,a){var T=(l===16||l===24)&&a>=32&&a<=47,h=(l===23||l===31)&&a>=45&&a<=47;if(!(T||h))return!1;var n,N={};l===16||l===24?(n=Math.floor((a-32)/2),N.background=b[n],a%2===1&&(N.background=N.background+"_semi")):a===45?N.background="transparent":(N.foreground="black",a===47&&(N.underline=!0));var U=l<=23?1:2,j=this.channels[U];return j.setBkgData(N),A(l,a,this.cmdHistory),!0},o.reset=function(){for(var l=0;l<Object.keys(this.channels).length;l++){var a=this.channels[l];a&&a.reset()}this.cmdHistory=S()},o.cueSplitAtTime=function(l){for(var a=0;a<this.channels.length;a++){var T=this.channels[a];T&&T.cueSplitAtTime(l)}},c}();function A(c,o,v){v.a=c,v.b=o}function P(c,o,v){return v.a===c&&v.b===o}function S(){return{a:null,b:null}}const C=k},"./src/utils/codecs.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{isCodecSupportedInMp4:()=>H,isCodecType:()=>r});var W={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,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,dva1:!0,dvav:!0,dvh1:!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 r(D,M){var g=W[M];return!!g&&g[D.slice(0,4)]===!0}function H(D,M){return MediaSource.isTypeSupported((M||"video")+'/mp4;codecs="'+D+'"')}},"./src/utils/cues.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>g});var W=F("./src/utils/vttparser.ts"),r=F("./src/utils/webvtt-parser.ts"),H=F("./src/utils/texttrack-utils.ts"),D=/\s/,M={newCue:function(u,m,b,E){for(var _=[],f,O,w,R,x,I=self.VTTCue||self.TextTrackCue,k=0;k<E.rows.length;k++)if(f=E.rows[k],w=!0,R=0,x="",!f.isEmpty()){for(var A=0;A<f.chars.length;A++)D.test(f.chars[A].uchar)&&w?R++:(x+=f.chars[A].uchar,w=!1);f.cueStartTime=m,m===b&&(b+=1e-4),R>=16?R--:R++;var P=(0,W.fixLineBreaks)(x.trim()),S=(0,r.generateCueId)(m,b,P);(!u||!u.cues||!u.cues.getCueById(S))&&(O=new I(m,b,P),O.id=S,O.line=k+1,O.align="left",O.position=10+Math.min(80,Math.floor(R*8/32)*10),_.push(O))}return u&&_.length&&(_.sort(function(C,c){return C.line==="auto"||c.line==="auto"?0:C.line>8&&c.line>8?c.line-C.line:C.line-c.line}),_.forEach(function(C){return(0,H.addCueToTrack)(u,C)})),_}};const g=M},"./src/utils/discontinuities.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{adjustSlidingStart:()=>u,alignMediaPlaylistByPDT:()=>_,alignPDT:()=>E,alignStream:()=>m,findDiscontinuousReferenceFrag:()=>g,findFirstFragWithCC:()=>D,shouldAlignOnDiscontinuities:()=>M});var W=F("./src/polyfills/number.ts"),r=F("./src/utils/logger.ts"),H=F("./src/controller/level-helper.ts");function D(f,O){for(var w=null,R=0,x=f.length;R<x;R++){var I=f[R];if(I&&I.cc===O){w=I;break}}return w}function M(f,O,w){return!!(O.details&&(w.endCC>w.startCC||f&&f.cc<w.startCC))}function g(f,O,w){w===void 0&&(w=0);var R=f.fragments,x=O.fragments;if(!x.length||!R.length){r.logger.log("No fragments to align");return}var I=D(R,x[0].cc);if(!I||I&&!I.startPTS){r.logger.log("No frag in previous level to align on");return}return I}function p(f,O){if(f){var w=f.start+O;f.start=f.startPTS=w,f.endPTS=w+f.duration}}function u(f,O){for(var w=O.fragments,R=0,x=w.length;R<x;R++)p(w[R],f);O.fragmentHint&&p(O.fragmentHint,f),O.alignedSliding=!0}function m(f,O,w){if(!O)return;b(f,w,O),!w.alignedSliding&&O.details&&E(w,O.details),!w.alignedSliding&&O.details&&!w.skippedSegments&&(0,H.adjustSliding)(O.details,w)}function b(f,O,w){if(M(f,w,O)){var R=g(w.details,O);R&&(0,W.isFiniteNumber)(R.start)&&(r.logger.log("Adjusting PTS using last level due to CC increase within current level "+O.url),u(R.start,O))}}function E(f,O){if(!O.fragments.length||!f.hasProgramDateTime||!O.hasProgramDateTime)return;var w=O.fragments[0].programDateTime,R=f.fragments[0].programDateTime,x=(R-w)/1e3+O.fragments[0].start;x&&(0,W.isFiniteNumber)(x)&&(r.logger.log("Adjusting PTS using programDateTime delta "+(R-w)+"ms, sliding:"+x.toFixed(3)+" "+f.url+" "),u(x,f))}function _(f,O){if(!f.hasProgramDateTime||!O.hasProgramDateTime)return;var w=f.fragments,R=O.fragments;if(!w.length||!R.length)return;var x=Math.round(R.length/2)-1,I=R[x],k=D(w,I.cc)||w[Math.round(w.length/2)-1],A=I.programDateTime,P=k.programDateTime;if(A===null||P===null)return;var S=(P-A)/1e3-(k.start-I.start);u(S,f)}},"./src/utils/ewma-bandwidth-estimator.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>H});var W=F("./src/utils/ewma.ts"),r=function(){function D(g,p,u){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=u,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new W.default(g),this.fast_=new W.default(p)}var M=D.prototype;return M.update=function(p,u){var m=this.slow_,b=this.fast_;this.slow_.halfLife!==p&&(this.slow_=new W.default(p,m.getEstimate(),m.getTotalWeight())),this.fast_.halfLife!==u&&(this.fast_=new W.default(u,b.getEstimate(),b.getTotalWeight()))},M.sample=function(p,u){p=Math.max(p,this.minDelayMs_);var m=8*u,b=p/1e3,E=m/b;this.fast_.sample(b,E),this.slow_.sample(b,E)},M.canEstimate=function(){var p=this.fast_;return p&&p.getTotalWeight()>=this.minWeight_},M.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},M.destroy=function(){},D}();const H=r},"./src/utils/ewma.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>r});var W=function(){function H(M,g,p){g===void 0&&(g=0),p===void 0&&(p=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=M,this.alpha_=M?Math.exp(Math.log(.5)/M):0,this.estimate_=g,this.totalWeight_=p}var D=H.prototype;return D.sample=function(g,p){var u=Math.pow(this.alpha_,g);this.estimate_=p*(1-u)+u*this.estimate_,this.totalWeight_+=g},D.getTotalWeight=function(){return this.totalWeight_},D.getEstimate=function(){if(this.alpha_){var g=1-Math.pow(this.alpha_,this.totalWeight_);if(g)return this.estimate_/g}return this.estimate_},H}();const r=W},"./src/utils/fetch-loader.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>x,fetchSupported:()=>_});var W=F("./src/polyfills/number.ts"),r=F("./src/loader/load-stats.ts"),H=F("./src/demux/chunk-cache.ts");function D(I,k){I.prototype=Object.create(k.prototype),I.prototype.constructor=I,m(I,k)}function M(I){var k=typeof Map=="function"?new Map:void 0;return M=function(P){if(P===null||!u(P))return P;if(typeof P!="function")throw new TypeError("Super expression must either be null or a function");if(typeof k!="undefined"){if(k.has(P))return k.get(P);k.set(P,S)}function S(){return g(P,arguments,b(this).constructor)}return S.prototype=Object.create(P.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),m(S,P)},M(I)}function g(I,k,A){return p()?g=Reflect.construct.bind():g=function(S,C,c){var o=[null];o.push.apply(o,C);var v=Function.bind.apply(S,o),l=new v;return c&&m(l,c.prototype),l},g.apply(null,arguments)}function p(){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(I){return!1}}function u(I){return Function.toString.call(I).indexOf("[native code]")!==-1}function m(I,k){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(P,S){return P.__proto__=S,P},m(I,k)}function b(I){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},b(I)}function E(){return E=Object.assign?Object.assign.bind():function(I){for(var k=1;k<arguments.length;k++){var A=arguments[k];for(var P in A)Object.prototype.hasOwnProperty.call(A,P)&&(I[P]=A[P])}return I},E.apply(this,arguments)}function _(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(I){}return!1}var f=function(){function I(A){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=A.fetchSetup||w,this.controller=new self.AbortController,this.stats=new r.LoadStats}var k=I.prototype;return k.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},k.abortInternal=function(){var P=this.response;(!P||!P.ok)&&(this.stats.aborted=!0,this.controller.abort())},k.abort=function(){var P;this.abortInternal(),(P=this.callbacks)!==null&&P!==void 0&&P.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},k.load=function(P,S,C){var c=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var v=O(P,this.controller.signal),l=C.onProgress,a=P.responseType==="arraybuffer",T=a?"byteLength":"length";this.context=P,this.config=S,this.callbacks=C,this.request=this.fetchSetup(P,v),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){c.abortInternal(),C.onTimeout(o,P,c.response)},S.timeout),self.fetch(this.request).then(function(h){if(c.response=c.loader=h,!h.ok){var n=h.status,N=h.statusText;throw new R(N||"fetch, bad network response",n,h)}return o.loading.first=Math.max(self.performance.now(),o.loading.start),o.total=parseInt(h.headers.get("Content-Length")||"0"),l&&(0,W.isFiniteNumber)(S.highWaterMark)?c.loadProgressively(h,o,P,S.highWaterMark,l):a?h.arrayBuffer():h.text()}).then(function(h){var n=c.response;self.clearTimeout(c.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first);var N=h[T];N&&(o.loaded=o.total=N);var U={url:n.url,data:h};l&&!(0,W.isFiniteNumber)(S.highWaterMark)&&l(o,P,h,n),C.onSuccess(U,o,P,n)}).catch(function(h){if(self.clearTimeout(c.requestTimeout),o.aborted)return;var n=h&&h.code||0,N=h?h.message:null;C.onError({code:n,text:N},P,h?h.details:null)})},k.getCacheAge=function(){var P=null;if(this.response){var S=this.response.headers.get("age");P=S?parseFloat(S):null}return P},k.loadProgressively=function(P,S,C,c,o){c===void 0&&(c=0);var v=new H.default,l=P.body.getReader(),a=function T(){return l.read().then(function(h){if(h.done)return v.dataLength&&o(S,C,v.flush(),P),Promise.resolve(new ArrayBuffer(0));var n=h.value,N=n.length;return S.loaded+=N,N<c||v.dataLength?(v.push(n),v.dataLength>=c&&o(S,C,v.flush(),P)):o(S,C,n,P),T()}).catch(function(){return Promise.reject()})};return a()},I}();function O(I,k){var A={method:"GET",mode:"cors",credentials:"same-origin",signal:k,headers:new self.Headers(E({},I.headers))};return I.rangeEnd&&A.headers.set("Range","bytes="+I.rangeStart+"-"+String(I.rangeEnd-1)),A}function w(I,k){return new self.Request(I.url,k)}var R=function(I){D(k,I);function k(A,P,S){var C;return C=I.call(this,A)||this,C.code=void 0,C.details=void 0,C.code=P,C.details=S,C}return k}(M(Error));const x=f},"./src/utils/hex.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>r});var W={hexDump:function(D){for(var M="",g=0;g<D.length;g++){var p=D[g].toString(16);p.length<2&&(p="0"+p),M+=p}return M}};const r=W},"./src/utils/imsc1-ttml-parser.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{IMSC1_CODEC:()=>u,parseIMSC1:()=>_});var W=F("./src/utils/mp4-tools.ts"),r=F("./src/utils/vttparser.ts"),H=F("./src/utils/vttcue.ts"),D=F("./src/demux/id3.ts"),M=F("./src/utils/timescale-conversion.ts"),g=F("./src/utils/webvtt-parser.ts");function p(){return p=Object.assign?Object.assign.bind():function(C){for(var c=1;c<arguments.length;c++){var o=arguments[c];for(var v in o)Object.prototype.hasOwnProperty.call(o,v)&&(C[v]=o[v])}return C},p.apply(this,arguments)}var u="stpp.ttml.im1t",m=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,b=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,E={left:"start",center:"center",right:"end",start:"start",end:"end"};function _(C,c,o,v,l){var a=(0,W.findBox)(new Uint8Array(C),["mdat"]);if(a.length===0){l(new Error("Could not parse IMSC1 mdat"));return}var T=a.map(function(n){return(0,D.utf8ArrayToStr)(n)}),h=(0,M.toTimescaleFromScale)(c,1,o);try{T.forEach(function(n){return v(f(n,h))})}catch(n){l(n)}}function f(C,c){var o=new DOMParser,v=o.parseFromString(C,"text/xml"),l=v.getElementsByTagName("tt")[0];if(!l)throw new Error("Invalid ttml");var a={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},T=Object.keys(a).reduce(function(j,Y){return j[Y]=l.getAttribute("ttp:"+Y)||a[Y],j},{}),h=l.getAttribute("xml:space")!=="preserve",n=w(O(l,"styling","style")),N=w(O(l,"layout","region")),U=O(l,"body","[begin]");return[].map.call(U,function(j){var Y=R(j,h);if(!Y||!j.hasAttribute("begin"))return null;var J=A(j.getAttribute("begin"),T),ee=A(j.getAttribute("dur"),T),ie=A(j.getAttribute("end"),T);if(J===null)throw k(j);if(ie===null){if(ee===null)throw k(j);ie=J+ee}var re=new H.default(J-c,ie-c,Y);re.id=(0,g.generateCueId)(re.startTime,re.endTime,re.text);var he=N[j.getAttribute("region")],oe=n[j.getAttribute("style")],ae=x(he,oe,n),Ee=ae.textAlign;if(Ee){var Le=E[Ee];Le&&(re.lineAlign=Le),re.align=Ee}return p(re,ae),re}).filter(function(j){return j!==null})}function O(C,c,o){var v=C.getElementsByTagName(c)[0];return v?[].slice.call(v.querySelectorAll(o)):[]}function w(C){return C.reduce(function(c,o){var v=o.getAttribute("xml:id");return v&&(c[v]=o),c},{})}function R(C,c){return[].slice.call(C.childNodes).reduce(function(o,v,l){var a;return v.nodeName==="br"&&l?o+`
|
|
`:(a=v.childNodes)!==null&&a!==void 0&&a.length?R(v,c):c?o+v.textContent.trim().replace(/\s+/g," "):o+v.textContent},"")}function x(C,c,o){var v="http://www.w3.org/ns/ttml#styling",l=null,a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],T=C!=null&&C.hasAttribute("style")?C.getAttribute("style"):null;return T&&o.hasOwnProperty(T)&&(l=o[T]),a.reduce(function(h,n){var N=I(c,v,n)||I(C,v,n)||I(l,v,n);return N&&(h[n]=N),h},{})}function I(C,c,o){return C&&C.hasAttributeNS(c,o)?C.getAttributeNS(c,o):null}function k(C){return new Error("Could not parse ttml timestamp "+C)}function A(C,c){if(!C)return null;var o=(0,r.parseTimeStamp)(C);return o===null&&(m.test(C)?o=P(C,c):b.test(C)&&(o=S(C,c))),o}function P(C,c){var o=m.exec(C),v=(o[4]|0)+(o[5]|0)/c.subFrameRate;return(o[1]|0)*3600+(o[2]|0)*60+(o[3]|0)+v/c.frameRate}function S(C,c){var o=b.exec(C),v=Number(o[1]),l=o[2];switch(l){case"h":return v*3600;case"m":return v*60;case"ms":return v*1e3;case"f":return v/c.frameRate;case"t":return v/c.tickRate}return v}},"./src/utils/keysystem-util.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{changeEndianness:()=>H,convertDataUriToArrayBytes:()=>D,strToUtf8array:()=>M});var W=F("./src/utils/numeric-encoding-utils.ts");function r(g){var p=M(g).subarray(0,16),u=new Uint8Array(16);return u.set(p,16-p.length),u}function H(g){var p=function(m,b,E){var _=m[b];m[b]=m[E],m[E]=_};p(g,0,3),p(g,1,2),p(g,4,5),p(g,6,7)}function D(g){var p=g.split(":"),u=null;if(p[0]==="data"&&p.length===2){var m=p[1].split(";"),b=m[m.length-1].split(",");if(b.length===2){var E=b[0]==="base64",_=b[1];E?(m.splice(-1,1),u=(0,W.base64Decode)(_)):u=r(_)}}return u}function M(g){return Uint8Array.from(unescape(encodeURIComponent(g)),function(p){return p.charCodeAt(0)})}},"./src/utils/logger.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{enableLogs:()=>g,logger:()=>p});var W=function(){},r={trace:W,debug:W,log:W,warn:W,info:W,error:W},H=r;function D(u){var m=self.console[u];return m?m.bind(self.console,"["+u+"] >"):W}function M(u){for(var m=arguments.length,b=new Array(m>1?m-1:0),E=1;E<m;E++)b[E-1]=arguments[E];b.forEach(function(_){H[_]=u[_]?u[_].bind(u):D(_)})}function g(u,m){if(self.console&&u===!0||typeof u=="object"){M(u,"debug","log","info","warn","error");try{H.log('Debug logs enabled for "'+m+'"')}catch(b){H=r}}else H=r}var p=H},"./src/utils/mediakeys-helper.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{KeySystemFormats:()=>r,KeySystemIds:()=>D,KeySystems:()=>W,getKeySystemsForConfig:()=>p,getSupportedMediaKeySystemConfigurations:()=>m,keySystemDomainToKeySystemFormat:()=>g,keySystemFormatToKeySystemDomain:()=>H,keySystemIdToKeySystemDomain:()=>M,requestMediaKeySystemAccess:()=>u});var W;(function(E){E.CLEARKEY="org.w3.clearkey",E.FAIRPLAY="com.apple.fps",E.PLAYREADY="com.microsoft.playready",E.WIDEVINE="com.widevine.alpha"})(W||(W={}));var r;(function(E){E.CLEARKEY="org.w3.clearkey",E.FAIRPLAY="com.apple.streamingkeydelivery",E.PLAYREADY="com.microsoft.playready",E.WIDEVINE="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"})(r||(r={}));function H(E){switch(E){case r.FAIRPLAY:return W.FAIRPLAY;case r.PLAYREADY:return W.PLAYREADY;case r.WIDEVINE:return W.WIDEVINE;case r.CLEARKEY:return W.CLEARKEY}}var D;(function(E){E.WIDEVINE="edef8ba979d64acea3c827dcd51d21ed"})(D||(D={}));function M(E){if(E===D.WIDEVINE)return W.WIDEVINE}function g(E){switch(E){case W.FAIRPLAY:return r.FAIRPLAY;case W.PLAYREADY:return r.PLAYREADY;case W.WIDEVINE:return r.WIDEVINE;case W.CLEARKEY:return r.CLEARKEY}}function p(E){var _=E.drmSystems,f=E.widevineLicenseUrl,O=_?[W.FAIRPLAY,W.WIDEVINE,W.PLAYREADY,W.CLEARKEY].filter(function(w){return!!_[w]}):[];return!O[W.WIDEVINE]&&f&&O.push(W.WIDEVINE),O}var u=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function m(E,_,f,O){var w;switch(E){case W.FAIRPLAY:w=["cenc","sinf"];break;case W.WIDEVINE:case W.PLAYREADY:w=["cenc"];break;case W.CLEARKEY:w=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+E)}return b(w,_,f,O)}function b(E,_,f,O){var w={initDataTypes:E,persistentState:O.persistentState||"not-allowed",distinctiveIdentifier:O.distinctiveIdentifier||"not-allowed",sessionTypes:O.sessionTypes||[O.sessionType||"temporary"],audioCapabilities:_.map(function(R){return{contentType:'audio/mp4; codecs="'+R+'"',robustness:O.audioRobustness||"",encryptionScheme:O.audioEncryptionScheme||null}}),videoCapabilities:f.map(function(R){return{contentType:'video/mp4; codecs="'+R+'"',robustness:O.videoRobustness||"",encryptionScheme:O.videoEncryptionScheme||null}})};return[w]}},"./src/utils/mediasource-helper.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{getMediaSource:()=>W});function W(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{RemuxerTrackIdConfig:()=>u,appendUint8Array:()=>c,bin2str:()=>m,computeRawDurationFromSamples:()=>P,discardEPB:()=>T,findBox:()=>O,getDuration:()=>A,getStartDTS:()=>k,mp4Box:()=>n,mp4pssh:()=>N,offsetStartDTS:()=>S,parseEmsg:()=>h,parseInitSegment:()=>R,parsePssh:()=>U,parseSEIMessageFromNALu:()=>a,parseSamples:()=>o,parseSegmentIndex:()=>w,parseSinf:()=>I,patchEncyptionData:()=>x,readSint32:()=>_,readUint16:()=>b,readUint32:()=>E,segmentValidRange:()=>C,writeUint32:()=>f});var W=F("./src/loader/fragment.ts"),r=F("./src/utils/typed-array.ts"),H=F("./src/demux/id3.ts"),D=F("./src/utils/logger.ts"),M=F("./src/utils/hex.ts"),g=Math.pow(2,32)-1,p=[].push,u={video:1,audio:2,id3:3,text:4};function m(j){return String.fromCharCode.apply(null,j)}function b(j,Y){var J=j[Y]<<8|j[Y+1];return J<0?65536+J:J}function E(j,Y){var J=_(j,Y);return J<0?4294967296+J:J}function _(j,Y){return j[Y]<<24|j[Y+1]<<16|j[Y+2]<<8|j[Y+3]}function f(j,Y,J){j[Y]=J>>24,j[Y+1]=J>>16&255,j[Y+2]=J>>8&255,j[Y+3]=J&255}function O(j,Y){var J=[];if(!Y.length)return J;for(var ee=j.byteLength,ie=0;ie<ee;){var re=E(j,ie),he=m(j.subarray(ie+4,ie+8)),oe=re>1?ie+re:ee;if(he===Y[0])if(Y.length===1)J.push(j.subarray(ie+8,oe));else{var ae=O(j.subarray(ie+8,oe),Y.slice(1));ae.length&&p.apply(J,ae)}ie=oe}return J}function w(j){var Y=[],J=j[0],ee=8,ie=E(j,ee);ee+=4;var re=0,he=0;J===0?ee+=8:ee+=16,ee+=2;var oe=j.length+he,ae=b(j,ee);ee+=2;for(var Ee=0;Ee<ae;Ee++){var Le=ee,Fe=E(j,Le);Le+=4;var Xe=Fe&2147483647,He=(Fe&2147483648)>>>31;if(He===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Ae=E(j,Le);Le+=4,Y.push({referenceSize:Xe,subsegmentDuration:Ae,info:{duration:Ae/ie,start:oe,end:oe+Xe-1}}),oe+=Xe,Le+=4,ee=Le}return{earliestPresentationTime:re,timescale:ie,version:J,referencesCount:ae,references:Y}}function R(j){for(var Y=[],J=O(j,["moov","trak"]),ee=0;ee<J.length;ee++){var ie=J[ee],re=O(ie,["tkhd"])[0];if(re){var he=re[0],oe=he===0?12:20,ae=E(re,oe),Ee=O(ie,["mdia","mdhd"])[0];if(Ee){he=Ee[0],oe=he===0?12:20;var Le=E(Ee,oe),Fe=O(ie,["mdia","hdlr"])[0];if(Fe){var Xe=m(Fe.subarray(8,12)),He={soun:W.ElementaryStreamTypes.AUDIO,vide:W.ElementaryStreamTypes.VIDEO}[Xe];if(He){var Ae=O(ie,["mdia","minf","stbl","stsd"])[0],Oe=void 0;Ae&&(Oe=m(Ae.subarray(12,16))),Y[ae]={timescale:Le,type:He},Y[He]={timescale:Le,id:ae,codec:Oe}}}}}}var Ke=O(j,["moov","mvex","trex"]);return Ke.forEach(function(de){var xe=E(de,4),Ie=Y[xe];Ie&&(Ie.default={duration:E(de,12),flags:E(de,20)})}),Y}function x(j,Y){if(!j||!Y)return j;var J=Y.keyId;if(J&&Y.isCommonEncryption){var ee=O(j,["moov","trak"]);ee.forEach(function(ie){var re=O(ie,["mdia","minf","stbl","stsd"])[0],he=re.subarray(8),oe=O(he,["enca"]),ae=oe.length>0;ae||(oe=O(he,["encv"])),oe.forEach(function(Ee){var Le=ae?Ee.subarray(28):Ee.subarray(78),Fe=O(Le,["sinf"]);Fe.forEach(function(Xe){var He=I(Xe);if(He){var Ae=He.subarray(8,24);Ae.some(function(Oe){return Oe!==0})||(D.logger.log("[eme] Patching keyId in 'enc"+(ae?"a":"v")+">sinf>>tenc' box: "+M.default.hexDump(Ae)+" -> "+M.default.hexDump(J)),He.set(J,8))}})})})}return j}function I(j){var Y=O(j,["schm"])[0];if(Y){var J=m(Y.subarray(4,8));if(J==="cbcs"||J==="cenc")return O(j,["schi","tenc"])[0]}return D.logger.error("[eme] missing 'schm' box"),null}function k(j,Y){return O(Y,["moof","traf"]).reduce(function(J,ee){var ie=O(ee,["tfdt"])[0],re=ie[0],he=O(ee,["tfhd"]).reduce(function(oe,ae){var Ee=E(ae,4),Le=j[Ee];if(Le){var Fe=E(ie,4);re===1&&(Fe*=Math.pow(2,32),Fe+=E(ie,8));var Xe=Le.timescale||9e4,He=Fe/Xe;if(isFinite(He)&&(oe===null||He<oe))return He}return oe},null);return he!==null&&isFinite(he)&&(J===null||he<J)?he:J},null)||0}function A(j,Y){for(var J=0,ee=0,ie=0,re=O(j,["moof","traf"]),he=0;he<re.length;he++){var oe=re[he],ae=O(oe,["tfhd"])[0],Ee=E(ae,4),Le=Y[Ee];if(!Le)continue;var Fe=Le.default,Xe=E(ae,0)|(Fe==null?void 0:Fe.flags),He=Fe==null?void 0:Fe.duration;Xe&8&&(Xe&2?He=E(ae,12):He=E(ae,8));for(var Ae=Le.timescale||9e4,Oe=O(oe,["trun"]),Ke=0;Ke<Oe.length;Ke++){if(J=P(Oe[Ke]),!J&&He){var de=E(Oe[Ke],4);J=He*de}Le.type===W.ElementaryStreamTypes.VIDEO?ee+=J/Ae:Le.type===W.ElementaryStreamTypes.AUDIO&&(ie+=J/Ae)}}if(ee===0&&ie===0){for(var xe=0,Ie=O(j,["sidx"]),De=0;De<Ie.length;De++){var Be=w(Ie[De]);Be!=null&&Be.references&&(xe+=Be.references.reduce(function(ze,Ye){return ze+Ye.info.duration||0},0))}return xe}return ee||ie}function P(j){var Y=E(j,0),J=8;Y&1&&(J+=4),Y&4&&(J+=4);for(var ee=0,ie=E(j,4),re=0;re<ie;re++){if(Y&256){var he=E(j,J);ee+=he,J+=4}Y&512&&(J+=4),Y&1024&&(J+=4),Y&2048&&(J+=4)}return ee}function S(j,Y,J){O(Y,["moof","traf"]).forEach(function(ee){O(ee,["tfhd"]).forEach(function(ie){var re=E(ie,4),he=j[re];if(!he)return;var oe=he.timescale||9e4;O(ee,["tfdt"]).forEach(function(ae){var Ee=ae[0],Le=E(ae,4);if(Ee===0)Le-=J*oe,Le=Math.max(Le,0),f(ae,4,Le);else{Le*=Math.pow(2,32),Le+=E(ae,8),Le-=J*oe,Le=Math.max(Le,0);var Fe=Math.floor(Le/(g+1)),Xe=Math.floor(Le%(g+1));f(ae,4,Fe),f(ae,8,Xe)}})})})}function C(j){var Y={valid:null,remainder:null},J=O(j,["moof"]);if(J){if(J.length<2)return Y.remainder=j,Y}else return Y;var ee=J[J.length-1];return Y.valid=(0,r.sliceUint8)(j,0,ee.byteOffset-8),Y.remainder=(0,r.sliceUint8)(j,ee.byteOffset-8),Y}function c(j,Y){var J=new Uint8Array(j.length+Y.length);return J.set(j),J.set(Y,j.length),J}function o(j,Y){var J=[],ee=Y.samples,ie=Y.timescale,re=Y.id,he=!1,oe=O(ee,["moof"]);return oe.map(function(ae){var Ee=ae.byteOffset-8,Le=O(ae,["traf"]);Le.map(function(Fe){var Xe=O(Fe,["tfdt"]).map(function(He){var Ae=He[0],Oe=E(He,4);return Ae===1&&(Oe*=Math.pow(2,32),Oe+=E(He,8)),Oe/ie})[0];return Xe!==void 0&&(j=Xe),O(Fe,["tfhd"]).map(function(He){var Ae=E(He,4),Oe=E(He,0)&16777215,Ke=(Oe&1)!==0,de=(Oe&2)!==0,xe=(Oe&8)!==0,Ie=0,De=(Oe&16)!==0,Be=0,ze=(Oe&32)!==0,Ye=8;Ae===re&&(Ke&&(Ye+=8),de&&(Ye+=4),xe&&(Ie=E(He,Ye),Ye+=4),De&&(Be=E(He,Ye),Ye+=4),ze&&(Ye+=4),Y.type==="video"&&(he=v(Y.codec)),O(Fe,["trun"]).map(function(Ze){var ut=Ze[0],Qe=E(Ze,0)&16777215,st=(Qe&1)!==0,Ne=0,vt=(Qe&4)!==0,ht=(Qe&256)!==0,Ue=0,Ve=(Qe&512)!==0,Ce=0,_e=(Qe&1024)!==0,Te=(Qe&2048)!==0,ne=0,ue=E(Ze,4),fe=8;st&&(Ne=E(Ze,fe),fe+=4),vt&&(fe+=4);for(var me=Ne+Ee,we=0;we<ue;we++){if(ht?(Ue=E(Ze,fe),fe+=4):Ue=Ie,Ve?(Ce=E(Ze,fe),fe+=4):Ce=Be,_e&&(fe+=4),Te&&(ut===0?ne=E(Ze,fe):ne=_(Ze,fe),fe+=4),Y.type===W.ElementaryStreamTypes.VIDEO)for(var Me=0;Me<Ce;){var je=E(ee,me);if(me+=4,l(he,ee[me])){var qe=ee.subarray(me,me+je);a(qe,he?2:1,j+ne/ie,J)}me+=je,Me+=je+4}j+=Ue/ie}}))})})}),J}function v(j){if(!j)return!1;var Y=j.indexOf("."),J=Y<0?j:j.substring(0,Y);return J==="hvc1"||J==="hev1"||J==="dvh1"||J==="dvhe"}function l(j,Y){if(j){var J=Y>>1&63;return J===39||J===40}else{var ee=Y&31;return ee===6}}function a(j,Y,J,ee){var ie=T(j),re=0;re+=Y;for(var he=0,oe=0,ae=!1,Ee=0;re<ie.length;){he=0;do{if(re>=ie.length)break;Ee=ie[re++],he+=Ee}while(Ee===255);oe=0;do{if(re>=ie.length)break;Ee=ie[re++],oe+=Ee}while(Ee===255);var Le=ie.length-re;if(!ae&&he===4&&re<ie.length){ae=!0;var Fe=ie[re++];if(Fe===181){var Xe=b(ie,re);if(re+=2,Xe===49){var He=E(ie,re);if(re+=4,He===1195456820){var Ae=ie[re++];if(Ae===3){var Oe=ie[re++],Ke=31&Oe,de=64&Oe,xe=de?2+Ke*3:0,Ie=new Uint8Array(xe);if(de){Ie[0]=Oe;for(var De=1;De<xe;De++)Ie[De]=ie[re++]}ee.push({type:Ae,payloadType:he,pts:J,bytes:Ie})}}}}}else if(he===5&&oe<Le){if(ae=!0,oe>16){for(var Be=[],ze=0;ze<16;ze++){var Ye=ie[re++].toString(16);Be.push(Ye.length==1?"0"+Ye:Ye),(ze===3||ze===5||ze===7||ze===9)&&Be.push("-")}for(var Ze=oe-16,ut=new Uint8Array(Ze),Qe=0;Qe<Ze;Qe++)ut[Qe]=ie[re++];ee.push({payloadType:he,pts:J,uuid:Be.join(""),userData:(0,H.utf8ArrayToStr)(ut),userDataBytes:ut})}}else if(oe<Le)re+=oe;else if(oe>Le)break}}function T(j){for(var Y=j.byteLength,J=[],ee=1;ee<Y-2;)j[ee]===0&&j[ee+1]===0&&j[ee+2]===3?(J.push(ee+2),ee+=2):ee++;if(J.length===0)return j;var ie=Y-J.length,re=new Uint8Array(ie),he=0;for(ee=0;ee<ie;he++,ee++)he===J[0]&&(he++,J.shift()),re[ee]=j[he];return re}function h(j){var Y=j[0],J="",ee="",ie=0,re=0,he=0,oe=0,ae=0,Ee=0;if(Y===0){for(;m(j.subarray(Ee,Ee+1))!=="\0";)J+=m(j.subarray(Ee,Ee+1)),Ee+=1;for(J+=m(j.subarray(Ee,Ee+1)),Ee+=1;m(j.subarray(Ee,Ee+1))!=="\0";)ee+=m(j.subarray(Ee,Ee+1)),Ee+=1;ee+=m(j.subarray(Ee,Ee+1)),Ee+=1,ie=E(j,12),re=E(j,16),oe=E(j,20),ae=E(j,24),Ee=28}else if(Y===1){Ee+=4,ie=E(j,Ee),Ee+=4;var Le=E(j,Ee);Ee+=4;var Fe=E(j,Ee);for(Ee+=4,he=Math.pow(2,32)*Le+Fe,Number.isSafeInteger(he)||(he=Number.MAX_SAFE_INTEGER,console.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),oe=E(j,Ee),Ee+=4,ae=E(j,Ee),Ee+=4;m(j.subarray(Ee,Ee+1))!=="\0";)J+=m(j.subarray(Ee,Ee+1)),Ee+=1;for(J+=m(j.subarray(Ee,Ee+1)),Ee+=1;m(j.subarray(Ee,Ee+1))!=="\0";)ee+=m(j.subarray(Ee,Ee+1)),Ee+=1;ee+=m(j.subarray(Ee,Ee+1)),Ee+=1}var Xe=j.subarray(Ee,j.byteLength);return{schemeIdUri:J,value:ee,timeScale:ie,presentationTime:he,presentationTimeDelta:re,eventDuration:oe,id:ae,payload:Xe}}function n(j){for(var Y=arguments.length,J=new Array(Y>1?Y-1:0),ee=1;ee<Y;ee++)J[ee-1]=arguments[ee];for(var ie=J.length,re=8,he=ie;he--;)re+=J[he].byteLength;var oe=new Uint8Array(re);for(oe[0]=re>>24&255,oe[1]=re>>16&255,oe[2]=re>>8&255,oe[3]=re&255,oe.set(j,4),he=0,re=8;he<ie;he++)oe.set(J[he],re),re+=J[he].byteLength;return oe}function N(j,Y,J){if(j.byteLength!==16)throw new RangeError("Invalid system id");var ee,ie;if(Y){ee=1,ie=new Uint8Array(Y.length*16);for(var re=0;re<Y.length;re++){var he=Y[re];if(he.byteLength!==16)throw new RangeError("Invalid key");ie.set(he,re*16)}}else ee=0,ie=new Uint8Array;var oe;ee>0?(oe=new Uint8Array(4),Y.length>0&&new DataView(oe.buffer).setUint32(0,Y.length,!1)):oe=new Uint8Array;var ae=new Uint8Array(4);return J&&J.byteLength>0&&new DataView(ae.buffer).setUint32(0,J.byteLength,!1),n([112,115,115,104],new Uint8Array([ee,0,0,0]),j,oe,ie,ae,J||new Uint8Array)}function U(j){if(!(j instanceof ArrayBuffer)||j.byteLength<32)return null;var Y={version:0,systemId:"",kids:null,data:null},J=new DataView(j),ee=J.getUint32(0);if(j.byteLength!==ee&&ee>44)return null;var ie=J.getUint32(4);if(ie!==1886614376)return null;if(Y.version=J.getUint32(8)>>>24,Y.version>1)return null;Y.systemId=M.default.hexDump(new Uint8Array(j,12,16));var re=J.getUint32(28);if(Y.version===0){if(ee-32<re)return null;Y.data=new Uint8Array(j,32,re)}else if(Y.version===1){Y.kids=[];for(var he=0;he<re;he++)Y.kids.push(new Uint8Array(j,32+he*16,16))}return Y}},"./src/utils/numeric-encoding-utils.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{base64Decode:()=>g,base64DecodeToStr:()=>H,base64Encode:()=>D,base64ToBase64Url:()=>W,base64UrlEncode:()=>M,strToBase64Encode:()=>r});function W(p){return p.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function r(p){return btoa(p)}function H(p){return atob(p)}function D(p){return btoa(String.fromCharCode.apply(String,p))}function M(p){return W(D(p))}function g(p){return Uint8Array.from(atob(p),function(u){return u.charCodeAt(0)})}},"./src/utils/output-filter.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>W});var W=function(){function r(D,M){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=D,this.trackName=M}var H=r.prototype;return H.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},H.newCue=function(M,g,p){(this.startTime===null||this.startTime>M)&&(this.startTime=M),this.endTime=g,this.screen=p,this.timelineController.createCaptionsTrack(this.trackName)},H.reset=function(){this.cueRanges=[],this.startTime=null},r}()},"./src/utils/texttrack-utils.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{addCueToTrack:()=>H,clearCurrentCues:()=>D,getCuesInRange:()=>p,removeCuesInRange:()=>M,sendAddTrackEvent:()=>r});var W=F("./src/utils/logger.ts");function r(u,m){var b;try{b=new Event("addtrack")}catch(E){b=document.createEvent("Event"),b.initEvent("addtrack",!1,!1)}b.track=u,m.dispatchEvent(b)}function H(u,m){var b=u.mode;if(b==="disabled"&&(u.mode="hidden"),u.cues&&!u.cues.getCueById(m.id))try{if(u.addCue(m),!u.cues.getCueById(m.id))throw new Error("addCue is failed for: "+m)}catch(_){W.logger.debug("[texttrack-utils]: "+_);var E=new self.TextTrackCue(m.startTime,m.endTime,m.text);E.id=m.id,u.addCue(E)}b==="disabled"&&(u.mode=b)}function D(u){var m=u.mode;if(m==="disabled"&&(u.mode="hidden"),u.cues)for(var b=u.cues.length;b--;)u.removeCue(u.cues[b]);m==="disabled"&&(u.mode=m)}function M(u,m,b,E){var _=u.mode;if(_==="disabled"&&(u.mode="hidden"),u.cues&&u.cues.length>0)for(var f=p(u.cues,m,b),O=0;O<f.length;O++)(!E||E(f[O]))&&u.removeCue(f[O]);_==="disabled"&&(u.mode=_)}function g(u,m){if(m<u[0].startTime)return 0;var b=u.length-1;if(m>u[b].endTime)return-1;for(var E=0,_=b;E<=_;){var f=Math.floor((_+E)/2);if(m<u[f].startTime)_=f-1;else if(m>u[f].startTime&&E<b)E=f+1;else return f}return u[E].startTime-m<m-u[_].startTime?E:_}function p(u,m,b){var E=[],_=g(u,m);if(_>-1)for(var f=_,O=u.length;f<O;f++){var w=u[f];if(w.startTime>=m&&w.endTime<=b)E.push(w);else if(w.startTime>b)return E}return E}},"./src/utils/time-ranges.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>r});var W={toString:function(D){for(var M="",g=D.length,p=0;p<g;p++)M+="["+D.start(p).toFixed(3)+"-"+D.end(p).toFixed(3)+"]";return M}};const r=W},"./src/utils/timescale-conversion.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{toMpegTsClockFromTimescale:()=>M,toMsFromMpegTsClock:()=>D,toTimescaleFromBase:()=>r,toTimescaleFromScale:()=>H});var W=9e4;function r(g,p,u,m){u===void 0&&(u=1),m===void 0&&(m=!1);var b=g*p*u;return m?Math.round(b):b}function H(g,p,u,m){return u===void 0&&(u=1),m===void 0&&(m=!1),r(g,p,1/u,m)}function D(g,p){return p===void 0&&(p=!1),r(g,1e3,1/W,p)}function M(g,p){return p===void 0&&(p=1),r(g,W,1/p)}},"./src/utils/typed-array.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{sliceUint8:()=>W});function W(r,H,D){return Uint8Array.prototype.slice?r.slice(H,D):new Uint8Array(Array.prototype.slice.call(r,H,D))}},"./src/utils/vttcue.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>W});const W=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var r=["","lr","rl"],H=["start","middle","end","left","right"];function D(m,b){if(typeof b!="string")return!1;if(!Array.isArray(m))return!1;var E=b.toLowerCase();return~m.indexOf(E)?E:!1}function M(m){return D(r,m)}function g(m){return D(H,m)}function p(m){for(var b=arguments.length,E=new Array(b>1?b-1:0),_=1;_<b;_++)E[_-1]=arguments[_];for(var f=1;f<arguments.length;f++){var O=arguments[f];for(var w in O)m[w]=O[w]}return m}function u(m,b,E){var _=this,f={enumerable:!0};_.hasBeenReset=!1;var O="",w=!1,R=m,x=b,I=E,k=null,A="",P=!0,S="auto",C="start",c=50,o="middle",v=50,l="middle";Object.defineProperty(_,"id",p({},f,{get:function(){return O},set:function(T){O=""+T}})),Object.defineProperty(_,"pauseOnExit",p({},f,{get:function(){return w},set:function(T){w=!!T}})),Object.defineProperty(_,"startTime",p({},f,{get:function(){return R},set:function(T){if(typeof T!="number")throw new TypeError("Start time must be set to a number.");R=T,this.hasBeenReset=!0}})),Object.defineProperty(_,"endTime",p({},f,{get:function(){return x},set:function(T){if(typeof T!="number")throw new TypeError("End time must be set to a number.");x=T,this.hasBeenReset=!0}})),Object.defineProperty(_,"text",p({},f,{get:function(){return I},set:function(T){I=""+T,this.hasBeenReset=!0}})),Object.defineProperty(_,"region",p({},f,{get:function(){return k},set:function(T){k=T,this.hasBeenReset=!0}})),Object.defineProperty(_,"vertical",p({},f,{get:function(){return A},set:function(T){var h=M(T);if(h===!1)throw new SyntaxError("An invalid or illegal string was specified.");A=h,this.hasBeenReset=!0}})),Object.defineProperty(_,"snapToLines",p({},f,{get:function(){return P},set:function(T){P=!!T,this.hasBeenReset=!0}})),Object.defineProperty(_,"line",p({},f,{get:function(){return S},set:function(T){if(typeof T!="number"&&T!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");S=T,this.hasBeenReset=!0}})),Object.defineProperty(_,"lineAlign",p({},f,{get:function(){return C},set:function(T){var h=g(T);if(!h)throw new SyntaxError("An invalid or illegal string was specified.");C=h,this.hasBeenReset=!0}})),Object.defineProperty(_,"position",p({},f,{get:function(){return c},set:function(T){if(T<0||T>100)throw new Error("Position must be between 0 and 100.");c=T,this.hasBeenReset=!0}})),Object.defineProperty(_,"positionAlign",p({},f,{get:function(){return o},set:function(T){var h=g(T);if(!h)throw new SyntaxError("An invalid or illegal string was specified.");o=h,this.hasBeenReset=!0}})),Object.defineProperty(_,"size",p({},f,{get:function(){return v},set:function(T){if(T<0||T>100)throw new Error("Size must be between 0 and 100.");v=T,this.hasBeenReset=!0}})),Object.defineProperty(_,"align",p({},f,{get:function(){return l},set:function(T){var h=g(T);if(!h)throw new SyntaxError("An invalid or illegal string was specified.");l=h,this.hasBeenReset=!0}})),_.displayState=void 0}return u.prototype.getCueAsHTML=function(){var m=self.WebVTT;return m.convertCueToDOMTree(self,this.text)},u}()},"./src/utils/vttparser.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{VTTParser:()=>b,fixLineBreaks:()=>m,parseTimeStamp:()=>H});var W=F("./src/utils/vttcue.ts"),r=function(){function E(){}var _=E.prototype;return _.decode=function(O,w){if(!O)return"";if(typeof O!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(O))},E}();function H(E){function _(O,w,R,x){return(O|0)*3600+(w|0)*60+(R|0)+parseFloat(x||0)}var f=E.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return f?parseFloat(f[2])>59?_(f[2],f[3],0,f[4]):_(f[1],f[2],f[3],f[4]):null}var D=function(){function E(){this.values=Object.create(null)}var _=E.prototype;return _.set=function(O,w){!this.get(O)&&w!==""&&(this.values[O]=w)},_.get=function(O,w,R){return R?this.has(O)?this.values[O]:w[R]:this.has(O)?this.values[O]:w},_.has=function(O){return O in this.values},_.alt=function(O,w,R){for(var x=0;x<R.length;++x)if(w===R[x]){this.set(O,w);break}},_.integer=function(O,w){/^-?\d+$/.test(w)&&this.set(O,parseInt(w,10))},_.percent=function(O,w){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(w)){var R=parseFloat(w);if(R>=0&&R<=100)return this.set(O,R),!0}return!1},E}();function M(E,_,f,O){var w=O?E.split(O):[E];for(var R in w){if(typeof w[R]!="string")continue;var x=w[R].split(f);if(x.length!==2)continue;var I=x[0],k=x[1];_(I,k)}}var g=new W.default(0,0,""),p=g.align==="middle"?"middle":"center";function u(E,_,f){var O=E;function w(){var I=H(E);if(I===null)throw new Error("Malformed timestamp: "+O);return E=E.replace(/^[^\sa-zA-Z-]+/,""),I}function R(I,k){var A=new D;M(I,function(C,c){var o;switch(C){case"region":for(var v=f.length-1;v>=0;v--)if(f[v].id===c){A.set(C,f[v].region);break}break;case"vertical":A.alt(C,c,["rl","lr"]);break;case"line":o=c.split(","),A.integer(C,o[0]),A.percent(C,o[0])&&A.set("snapToLines",!1),A.alt(C,o[0],["auto"]),o.length===2&&A.alt("lineAlign",o[1],["start",p,"end"]);break;case"position":o=c.split(","),A.percent(C,o[0]),o.length===2&&A.alt("positionAlign",o[1],["start",p,"end","line-left","line-right","auto"]);break;case"size":A.percent(C,c);break;case"align":A.alt(C,c,["start",p,"end","left","right"]);break}},/:/,/\s/),k.region=A.get("region",null),k.vertical=A.get("vertical","");var P=A.get("line","auto");P==="auto"&&g.line===-1&&(P=-1),k.line=P,k.lineAlign=A.get("lineAlign","start"),k.snapToLines=A.get("snapToLines",!0),k.size=A.get("size",100),k.align=A.get("align",p);var S=A.get("position","auto");S==="auto"&&g.position===50&&(S=k.align==="start"||k.align==="left"?0:k.align==="end"||k.align==="right"?100:50),k.position=S}function x(){E=E.replace(/^\s+/,"")}if(x(),_.startTime=w(),x(),E.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+O);E=E.slice(3),x(),_.endTime=w(),x(),R(E,_)}function m(E){return E.replace(/<br(?: \/)?>/gi,`
|
|
`)}var b=function(){function E(){this.state="INITIAL",this.buffer="",this.decoder=new r,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var _=E.prototype;return _.parse=function(O){var w=this;O&&(w.buffer+=w.decoder.decode(O,{stream:!0}));function R(){var S=w.buffer,C=0;for(S=m(S);C<S.length&&S[C]!=="\r"&&S[C]!==`
|
|
`;)++C;var c=S.slice(0,C);return S[C]==="\r"&&++C,S[C]===`
|
|
`&&++C,w.buffer=S.slice(C),c}function x(S){M(S,function(C,c){},/:/)}try{var I="";if(w.state==="INITIAL"){if(!/\r\n|\n/.test(w.buffer))return this;I=R();var k=I.match(/^()?WEBVTT([ \t].*)?$/);if(!k||!k[0])throw new Error("Malformed WebVTT signature.");w.state="HEADER"}for(var A=!1;w.buffer;){if(!/\r\n|\n/.test(w.buffer))return this;A?A=!1:I=R();switch(w.state){case"HEADER":/:/.test(I)?x(I):I||(w.state="ID");continue;case"NOTE":I||(w.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(I)){w.state="NOTE";break}if(!I)continue;if(w.cue=new W.default(0,0,""),w.state="CUE",I.indexOf("-->")===-1){w.cue.id=I;continue}case"CUE":if(!w.cue){w.state="BADCUE";continue}try{u(I,w.cue,w.regionList)}catch(S){w.cue=null,w.state="BADCUE";continue}w.state="CUETEXT";continue;case"CUETEXT":{var P=I.indexOf("-->")!==-1;if(!I||P&&(A=!0)){w.oncue&&w.cue&&w.oncue(w.cue),w.cue=null,w.state="ID";continue}if(w.cue===null)continue;w.cue.text&&(w.cue.text+=`
|
|
`),w.cue.text+=I}continue;case"BADCUE":I||(w.state="ID")}}}catch(S){w.state==="CUETEXT"&&w.cue&&w.oncue&&w.oncue(w.cue),w.cue=null,w.state=w.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},_.flush=function(){var O=this;try{if((O.cue||O.state==="HEADER")&&(O.buffer+=`
|
|
|
|
`,O.parse()),O.state==="INITIAL"||O.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(w){O.onparsingerror&&O.onparsingerror(w)}return O.onflush&&O.onflush(),this},E}()},"./src/utils/webvtt-parser.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{generateCueId:()=>b,parseWebVTT:()=>_});var W=F("./src/polyfills/number.ts"),r=F("./src/utils/vttparser.ts"),H=F("./src/demux/id3.ts"),D=F("./src/utils/timescale-conversion.ts"),M=F("./src/remux/mp4-remuxer.ts"),g=/\r\n|\n\r|\n|\r/g,p=function(O,w,R){return R===void 0&&(R=0),O.slice(R,R+w.length)===w},u=function(O){var w=parseInt(O.slice(-3)),R=parseInt(O.slice(-6,-4)),x=parseInt(O.slice(-9,-7)),I=O.length>9?parseInt(O.substring(0,O.indexOf(":"))):0;if(!(0,W.isFiniteNumber)(w)||!(0,W.isFiniteNumber)(R)||!(0,W.isFiniteNumber)(x)||!(0,W.isFiniteNumber)(I))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+O);return w+=1e3*R,w+=60*1e3*x,w+=60*60*1e3*I,w},m=function(O){for(var w=5381,R=O.length;R;)w=w*33^O.charCodeAt(--R);return(w>>>0).toString()};function b(f,O,w){return m(f.toString())+m(O.toString())+m(w)}var E=function(O,w,R){var x=O[w],I=O[x.prevCC];if(!I||!I.new&&x.new){O.ccOffset=O.presentationOffset=x.start,x.new=!1;return}for(;(k=I)!==null&&k!==void 0&&k.new;){var k;O.ccOffset+=x.start-I.start,x.new=!1,x=I,I=O[x.prevCC]}O.presentationOffset=R};function _(f,O,w,R,x,I,k,A){var P=new r.VTTParser,S=(0,H.utf8ArrayToStr)(new Uint8Array(f)).trim().replace(g,`
|
|
`).split(`
|
|
`),C=[],c=(0,D.toMpegTsClockFromTimescale)(O,w),o="00:00.000",v=0,l=0,a,T=!0;P.oncue=function(h){var n=R[x],N=R.ccOffset,U=(v-c)/9e4;n!=null&&n.new&&(l!==void 0?N=R.ccOffset=n.start:E(R,x,U)),U&&(N=U-R.presentationOffset);var j=h.endTime-h.startTime,Y=(0,M.normalizePts)((h.startTime+N-l)*9e4,I*9e4)/9e4;h.startTime=Math.max(Y,0),h.endTime=Math.max(Y+j,0);var J=h.text.trim();h.text=decodeURIComponent(encodeURIComponent(J)),h.id||(h.id=b(h.startTime,h.endTime,J)),h.endTime>0&&C.push(h)},P.onparsingerror=function(h){a=h},P.onflush=function(){if(a){A(a);return}k(C)},S.forEach(function(h){if(T)if(p(h,"X-TIMESTAMP-MAP=")){T=!1,h.slice(16).split(",").forEach(function(n){p(n,"LOCAL:")?o=n.slice(6):p(n,"MPEGTS:")&&(v=parseInt(n.slice(7)))});try{l=u(o)/1e3}catch(n){a=n}return}else h===""&&(T=!1);P.parse(h+`
|
|
`)}),P.flush()}},"./src/utils/xhr-loader.ts":(le,X,F)=>{"use strict";F.r(X),F.d(X,{default:()=>M});var W=F("./src/utils/logger.ts"),r=F("./src/loader/load-stats.ts"),H=/^age:\s*[\d.]+\s*$/m,D=function(){function g(u){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=u?u.xhrSetup:null,this.stats=new r.LoadStats,this.retryDelay=0}var p=g.prototype;return p.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},p.abortInternal=function(){var m=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),m&&(m.onreadystatechange=null,m.onprogress=null,m.readyState!==4&&(this.stats.aborted=!0,m.abort()))},p.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},p.load=function(m,b,E){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=m,this.config=b,this.callbacks=E,this.retryDelay=b.retryDelay,this.loadInternal()},p.loadInternal=function(){var m=this.config,b=this.context;if(!m)return;var E=this.loader=new self.XMLHttpRequest,_=this.stats;_.loading.first=0,_.loaded=0;var f=this.xhrSetup;try{if(f)try{f(E,b.url)}catch(R){E.open("GET",b.url,!0),f(E,b.url)}E.readyState||E.open("GET",b.url,!0);var O=this.context.headers;if(O)for(var w in O)E.setRequestHeader(w,O[w])}catch(R){this.callbacks.onError({code:E.status,text:R.message},b,E);return}b.rangeEnd&&E.setRequestHeader("Range","bytes="+b.rangeStart+"-"+(b.rangeEnd-1)),E.onreadystatechange=this.readystatechange.bind(this),E.onprogress=this.loadprogress.bind(this),E.responseType=b.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout),E.send()},p.readystatechange=function(){var m=this.context,b=this.loader,E=this.stats;if(!m||!b)return;var _=b.readyState,f=this.config;if(E.aborted)return;if(_>=2)if(self.clearTimeout(this.requestTimeout),E.loading.first===0&&(E.loading.first=Math.max(self.performance.now(),E.loading.start)),_===4){b.onreadystatechange=null,b.onprogress=null;var O=b.status,w=b.responseType==="arraybuffer";if(O>=200&&O<300&&(w&&b.response||b.responseText!==null)){E.loading.end=Math.max(self.performance.now(),E.loading.first);var R,x;if(w?(R=b.response,x=R.byteLength):(R=b.responseText,x=R.length),E.loaded=E.total=x,!this.callbacks)return;var I=this.callbacks.onProgress;if(I&&I(E,m,R,b),!this.callbacks)return;var k={url:b.responseURL,data:R};this.callbacks.onSuccess(k,E,m,b)}else E.retry>=f.maxRetry||O>=400&&O<499?(W.logger.error(O+" while loading "+m.url),this.callbacks.onError({code:O,text:b.statusText},m,b)):(W.logger.warn(O+" while loading "+m.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,f.maxRetryDelay),E.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),f.timeout)},p.loadtimeout=function(){W.logger.warn("timeout while loading "+this.context.url);var m=this.callbacks;m&&(this.abortInternal(),m.onTimeout(this.stats,this.context,this.loader))},p.loadprogress=function(m){var b=this.stats;b.loaded=m.loaded,m.lengthComputable&&(b.total=m.total)},p.getCacheAge=function(){var m=null;if(this.loader&&H.test(this.loader.getAllResponseHeaders())){var b=this.loader.getResponseHeader("age");m=b?parseFloat(b):null}return m},g}();const M=D},"./node_modules/eventemitter3/index.js":le=>{"use strict";var X=Object.prototype.hasOwnProperty,F="~";function W(){}Object.create&&(W.prototype=Object.create(null),new W().__proto__||(F=!1));function r(g,p,u){this.fn=g,this.context=p,this.once=u||!1}function H(g,p,u,m,b){if(typeof u!="function")throw new TypeError("The listener must be a function");var E=new r(u,m||g,b),_=F?F+p:p;return g._events[_]?g._events[_].fn?g._events[_]=[g._events[_],E]:g._events[_].push(E):(g._events[_]=E,g._eventsCount++),g}function D(g,p){--g._eventsCount===0?g._events=new W:delete g._events[p]}function M(){this._events=new W,this._eventsCount=0}M.prototype.eventNames=function(){var p=[],u,m;if(this._eventsCount===0)return p;for(m in u=this._events)X.call(u,m)&&p.push(F?m.slice(1):m);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(u)):p},M.prototype.listeners=function(p){var u=F?F+p:p,m=this._events[u];if(!m)return[];if(m.fn)return[m.fn];for(var b=0,E=m.length,_=new Array(E);b<E;b++)_[b]=m[b].fn;return _},M.prototype.listenerCount=function(p){var u=F?F+p:p,m=this._events[u];return m?m.fn?1:m.length:0},M.prototype.emit=function(p,u,m,b,E,_){var f=F?F+p:p;if(!this._events[f])return!1;var O=this._events[f],w=arguments.length,R,x;if(O.fn){O.once&&this.removeListener(p,O.fn,void 0,!0);switch(w){case 1:return O.fn.call(O.context),!0;case 2:return O.fn.call(O.context,u),!0;case 3:return O.fn.call(O.context,u,m),!0;case 4:return O.fn.call(O.context,u,m,b),!0;case 5:return O.fn.call(O.context,u,m,b,E),!0;case 6:return O.fn.call(O.context,u,m,b,E,_),!0}for(x=1,R=new Array(w-1);x<w;x++)R[x-1]=arguments[x];O.fn.apply(O.context,R)}else{var I=O.length,k;for(x=0;x<I;x++){O[x].once&&this.removeListener(p,O[x].fn,void 0,!0);switch(w){case 1:O[x].fn.call(O[x].context);break;case 2:O[x].fn.call(O[x].context,u);break;case 3:O[x].fn.call(O[x].context,u,m);break;case 4:O[x].fn.call(O[x].context,u,m,b);break;default:if(!R)for(k=1,R=new Array(w-1);k<w;k++)R[k-1]=arguments[k];O[x].fn.apply(O[x].context,R)}}}return!0},M.prototype.on=function(p,u,m){return H(this,p,u,m,!1)},M.prototype.once=function(p,u,m){return H(this,p,u,m,!0)},M.prototype.removeListener=function(p,u,m,b){var E=F?F+p:p;if(!this._events[E])return this;if(!u)return D(this,E),this;var _=this._events[E];if(_.fn)_.fn===u&&(!b||_.once)&&(!m||_.context===m)&&D(this,E);else{for(var f=0,O=[],w=_.length;f<w;f++)(_[f].fn!==u||b&&!_[f].once||m&&_[f].context!==m)&&O.push(_[f]);O.length?this._events[E]=O.length===1?O[0]:O:D(this,E)}return this},M.prototype.removeAllListeners=function(p){var u;return p?(u=F?F+p:p,this._events[u]&&D(this,u)):(this._events=new W,this._eventsCount=0),this},M.prototype.off=M.prototype.removeListener,M.prototype.addListener=M.prototype.on,M.prefixed=F,M.EventEmitter=M,le.exports=M},"./node_modules/url-toolkit/src/url-toolkit.js":function(le){(function(X){var F=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,W=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,D={buildAbsoluteURL:function(M,g,p){if(p=p||{},M=M.trim(),g=g.trim(),!g){if(!p.alwaysNormalize)return M;var u=D.parseURL(M);if(!u)throw new Error("Error trying to parse base URL.");return u.path=D.normalizePath(u.path),D.buildURLFromParts(u)}var m=D.parseURL(g);if(!m)throw new Error("Error trying to parse relative URL.");if(m.scheme)return p.alwaysNormalize?(m.path=D.normalizePath(m.path),D.buildURLFromParts(m)):g;var b=D.parseURL(M);if(!b)throw new Error("Error trying to parse base URL.");if(!b.netLoc&&b.path&&b.path[0]!=="/"){var E=W.exec(b.path);b.netLoc=E[1],b.path=E[2]}b.netLoc&&!b.path&&(b.path="/");var _={scheme:b.scheme,netLoc:m.netLoc,path:null,params:m.params,query:m.query,fragment:m.fragment};if(!m.netLoc&&(_.netLoc=b.netLoc,m.path[0]!=="/"))if(!m.path)_.path=b.path,m.params||(_.params=b.params,m.query||(_.query=b.query));else{var f=b.path,O=f.substring(0,f.lastIndexOf("/")+1)+m.path;_.path=D.normalizePath(O)}return _.path===null&&(_.path=p.alwaysNormalize?D.normalizePath(m.path):m.path),D.buildURLFromParts(_)},parseURL:function(M){var g=F.exec(M);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(M){for(M=M.split("").reverse().join("").replace(r,"");M.length!==(M=M.replace(H,"")).length;);return M.split("").reverse().join("")},buildURLFromParts:function(M){return M.scheme+M.netLoc+M.path+M.params+M.query+M.fragment}};le.exports=D})(this)}},Se={};function ce(le){var X=Se[le];if(X!==void 0)return X.exports;var F=Se[le]={exports:{}};return se[le].call(F.exports,F,F.exports,ce),F.exports}ce.m=se,(()=>{ce.n=le=>{var X=le&&le.__esModule?()=>le.default:()=>le;return ce.d(X,{a:X}),X}})(),(()=>{ce.d=(le,X)=>{for(var F in X)ce.o(X,F)&&!ce.o(le,F)&&Object.defineProperty(le,F,{enumerable:!0,get:X[F]})}})(),(()=>{ce.o=(le,X)=>Object.prototype.hasOwnProperty.call(le,X)})(),(()=>{ce.r=le=>{typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(le,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(le,"__esModule",{value:!0})}})();var ye=ce("./src/hls.ts");return ye=ye.default,ye})())},vHTk:function(at,ve,Z){at.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wx14:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return se});function se(){return se=Object.assign?Object.assign.bind():function(Se){for(var ce=1;ce<arguments.length;ce++){var ye=arguments[ce];for(var le in ye)Object.prototype.hasOwnProperty.call(ye,le)&&(Se[le]=ye[le])}return Se},se.apply(this,arguments)}},zLVn:function(at,ve,Z){"use strict";Z.d(ve,"a",function(){return se});function se(Se,ce){if(Se==null)return{};var ye={},le=Object.keys(Se),X,F;for(F=0;F<le.length;F++){if(X=le[F],ce.indexOf(X)>=0)continue;ye[X]=Se[X]}return ye}}}]);
|